SecondMe Project Initialization
Initialize SecondMe project configuration, supporting direct parsing of App Info format or manual credential input.
Tool Usage: Use the
tool when collecting user input.
Workflow
Step 0: Environment Check
Important Reminder: The current directory will be used as the project root directory, and the Next.js project will be initialized directly here.
-
Display the current working directory path for user confirmation:
📂 Current Working Directory: /path/to/current/dir
⚠️ The Next.js project will be initialized directly in this directory. Please ensure you are running this in a new empty folder.
-
Check the contents of the current directory (excluding configuration files like
,
,
,
):
- If the directory is empty or only contains configuration files: Proceed to the next step
- If other files exist: Issue a warning
⚠️ The current directory is not empty and contains the following files/folders:
- src/
- package.json
- ...
Continuing may overwrite existing files. Are you sure you want to proceed?
- Use to let the user confirm whether to continue
Step 1: Check Existing Configuration
First, check if
exists in the project root directory:
If it exists:
- Read and display a summary of the current configuration:
📋 Existing Configuration:
- App Name: secondme-tinder
- Client ID: 71658da7-***
- Database: postgresql://***
- Selected Modules: auth, chat, profile
- Current Stage: init
- Ask the user whether to modify the configuration or continue using it
If it does not exist: Proceed to Step 2
Step 2: Collect Configuration Information
First, ask the user if they already have the Client ID and Client Secret for the SecondMe application.
If the user does not have credentials, guide them to register on the developer platform:
📌 Don't have SecondMe application credentials yet? Follow these steps to obtain them:
1. Visit the SecondMe Developer Platform: https://develop.second.me
2. Register and log in to your account
3. Create a new App
4. After creation, you will get App Info (including Client ID, Client Secret, etc.)
5. Copy and paste the App Info here
Prompt the user to continue after obtaining the credentials. If the user already has credentials, proceed with the following process.
Method 1: Parse App Info Format (Recommended)
If the user provides information in the following format, parse it automatically:
## App Info
- App Name: secondme-tinder
- Client ID: 71658da7-659c-414a-abdf-cb6472037fc2
- Client Secret: <your-secret>
- Redirect URIs:
- http://localhost:3000/api/auth/callback
- https://xxx.vercel.app/api/auth/callback
- Allowed Scopes: user.info, user.info.shades, user.info.softmemory, chat, note.add, voice
Parsing Rules:
| Field | Extraction Method |
|---|
| Directly extract App Name |
| Directly extract Client ID |
| Directly extract Client Secret |
| Prioritize the URI with (for development) |
| Save all Redirect URIs in a list |
| Automatically infer based on Allowed Scopes (see the table below) |
Scopes to Modules Mapping:
| Scope | Module |
|---|
| (Required) |
| |
| |
| |
| |
| |
| Record but do not generate code temporarily |
Additional Information to Collect After Parsing:
Method 2: Manual Input
If the user does not provide App Info, collect the following information in order:
-
App Name (Optional)
- Prompt: Please enter the application name
- Default value:
-
Client ID (Required)
- Prompt: Please enter the Client ID of your SecondMe application
- If the user does not have one, prompt: Please register and create an App at https://develop.second.me to obtain it
- Validation: Non-empty
-
Client Secret (Required)
- Prompt: Please enter the Client Secret of your SecondMe application
- If the user does not have one, prompt: Please register and create an App at https://develop.second.me to obtain it
- Validation: Non-empty
-
Redirect URI (Optional)
- Prompt: Please enter the callback URL
- Default value:
http://localhost:3000/api/auth/callback
-
Database URL (Required)
- Prompt: Please enter the database connection string
- Provide format examples:
- PostgreSQL:
postgresql://user:pass@localhost:5432/dbname
- MySQL:
mysql://user:pass@localhost:3306/dbname
- SQLite:
-
Feature Module Selection (Multiple Selection)
Step 3: Confirm Module Selection
Display the modules inferred from Scopes (or selected by the user):
| Module | Description | Notes |
|---|
| OAuth Authentication | Required, automatically included |
| User Information Display | Optional |
| Chat Functionality | Optional |
| Structured Action Judgment (Returns JSON) | Optional, reuses scope permissions |
| Note-taking Functionality | Optional |
Ask the user if they need to adjust the module selection.
Step 4: Generate Configuration Files
4.1 Create
json
{
"version": "1.0",
"stage": "init",
"app_name": "secondme-tinder",
"modules": ["auth", "chat", "profile"],
"config": {
"client_id": "71658da7-659c-414a-abdf-cb6472037fc2",
"client_secret": "User-provided Client Secret",
"redirect_uri": "http://localhost:3000/api/auth/callback",
"redirect_uris": [
"http://localhost:3000/api/auth/callback",
"https://xxx.vercel.app/api/auth/callback"
],
"database_url": "User-provided database connection string",
"allowed_scopes": ["user.info", "user.info.shades", "chat", "note.add"]
},
"api": {
"base_url": "https://app.mindos.com/gate/lab",
"oauth_url": "https://go.second.me/oauth/",
"token_endpoint": "https://app.mindos.com/gate/lab/api/oauth/token",
"access_token_ttl": 7200,
"refresh_token_ttl": 2592000
},
"docs": {
"quickstart": "https://develop-docs.second.me/zh/docs",
"oauth2": "https://develop-docs.second.me/zh/docs/authentication/oauth2",
"api_reference": "https://develop-docs.second.me/zh/docs/api-reference/secondme",
"errors": "https://develop-docs.second.me/zh/docs/errors"
},
"prd": {}
}
4.2 Create or Update
Create
in the project root directory with the following content:
markdown
# SecondMe Integration Project
## Application Information
- **App Name**: [app_name]
- **Client ID**: [Partially hidden client_id]
## API Documentation
Refer to the official documentation during development (read from the `docs` field in `.secondme/state.json`):
|------|--------|
| Quick Start | `docs.quickstart` |
| OAuth2 Authentication | `docs.oauth2` |
| API Reference | `docs.api_reference` |
| Error Codes | `docs.errors` |
## Key Information
- API Base URL: [Read from state.json api.base_url]
- OAuth Authorization URL: [Read from state.json api.oauth_url]
- Access Token Expiry: 2 hours
- Refresh Token Expiry: 30 days
> All API endpoint configurations can be found in the `api` and `docs` fields of `.secondme/state.json`
## Selected Modules
[Dynamically generate module list based on inference/selection]
## Permission List (Scopes)
Based on Allowed Scopes in App Info:
|------|------|------|
| `user.info` | Basic user information | ✅ Authorized |
| `user.info.shades` | User interest tags | ✅ Authorized |
| `chat` | Chat functionality | ✅ Authorized |
| `note.add` | Add notes | ✅ Authorized |
Step 5: Output Results
Display success message and next steps:
✅ SecondMe project configuration is complete!
Application Name: secondme-tinder
Configuration saved to .secondme/state.json
Created/updated CLAUDE.md (contains SecondMe API documentation links)
Selected Modules (Inferred from Allowed Scopes):
- auth ✓
- profile ✓ (user.info.shades)
- chat ✓
- note ✓
⚠️ Important: Add .secondme/ to .gitignore to protect sensitive information
Next Steps:
- Run /secondme-prd to define product requirements (Recommended)
- Or run /secondme-nextjs --quick to quickly generate the project
Output Files
| File | Description |
|---|
| Project state and configuration |
| API reference documentation for development reference |
App Info Format Example
The following is the complete App Info format, which users can copy directly from the SecondMe Developer Backend:
## App Info
- App Name: my-app
- Client ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- Client Secret: your-secret-here
- Redirect URIs:
- http://localhost:3000/api/auth/callback
- https://my-app.vercel.app/api/auth/callback
- https://my-app.com/api/auth/callback
- Allowed Scopes: user.info, user.info.shades, user.info.softmemory, chat, note.add
Error Handling
- App Info format cannot be parsed: Prompt format error and switch to manual input mode
- Client Secret is a placeholder: Prompt user to fill in the actual Secret
- Database connection string format error: Display correct format examples
- Insufficient permissions to create directory: Prompt to check directory permissions