proagents 1.6.19 → 1.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +13 -1
- package/.proagents/.cursorrules +25 -10
- package/.proagents/.windsurfrules +25 -10
- package/.proagents/AGENTS.md +30 -11
- package/.proagents/AI_INSTRUCTIONS.md +86 -30
- package/.proagents/BOLT.md +25 -10
- package/.proagents/CLAUDE.md +25 -10
- package/.proagents/GEMINI.md +25 -10
- package/.proagents/KIRO.md +25 -10
- package/.proagents/LOVABLE.md +25 -10
- package/.proagents/PROAGENTS.md +96 -343
- package/.proagents/REPLIT.md +25 -10
- package/.proagents/activity.log +1 -0
- package/.proagents/platforms.yaml +66 -0
- package/.proagents/prompts/ai-add.md +80 -0
- package/.proagents/prompts/ai-list.md +41 -0
- package/.proagents/prompts/ai-remove.md +112 -0
- package/.proagents/prompts/ai-sync.md +96 -0
- package/lib/commands/ai.js +100 -48
- package/lib/commands/init.js +32 -14
- package/package.json +1 -1
- package/.proagents/ANTIGRAVITY.md +0 -61
- package/.proagents/CHATGPT.md +0 -57
- package/.proagents/GROQ.md +0 -57
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# pa:ai-add - Add AI Platform
|
|
2
|
+
|
|
3
|
+
Add a new AI platform configuration to this project.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
### 1. Read Available Platforms
|
|
8
|
+
|
|
9
|
+
**IMPORTANT:** Always read the authoritative list first - do not hallucinate platforms.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
cat .proagents/platforms.yaml
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Show Options to User
|
|
16
|
+
|
|
17
|
+
Display platforms grouped by category:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
IDE-based AI Assistants:
|
|
21
|
+
1. claude - Claude Code (CLAUDE.md)
|
|
22
|
+
2. cursor - Cursor (.cursorrules)
|
|
23
|
+
3. windsurf - Windsurf (.windsurfrules)
|
|
24
|
+
4. copilot - GitHub Copilot (.github/copilot-instructions.md)
|
|
25
|
+
5. kiro - AWS Kiro (KIRO.md)
|
|
26
|
+
6. gemini - Gemini (GEMINI.md)
|
|
27
|
+
|
|
28
|
+
Web-based AI Platforms:
|
|
29
|
+
7. replit - Replit AI (REPLIT.md)
|
|
30
|
+
8. bolt - Bolt.new (BOLT.md)
|
|
31
|
+
9. lovable - Lovable (LOVABLE.md)
|
|
32
|
+
|
|
33
|
+
Auto-handled (use AGENTS.md):
|
|
34
|
+
- ChatGPT, Groq, Antigravity, Codex CLI, OpenAI API
|
|
35
|
+
|
|
36
|
+
Which platform to add?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Create the File
|
|
40
|
+
|
|
41
|
+
After user selects platform:
|
|
42
|
+
|
|
43
|
+
1. **Read source template** from `.proagents/{file}`
|
|
44
|
+
2. **Check if target file exists** in project root:
|
|
45
|
+
- If exists: Merge using markers (append ProAgents section)
|
|
46
|
+
- If not exists: Create new file with markers
|
|
47
|
+
|
|
48
|
+
3. **Wrap content with markers:**
|
|
49
|
+
```
|
|
50
|
+
<!-- PROAGENTS_START -->
|
|
51
|
+
{content from template}
|
|
52
|
+
<!-- PROAGENTS_END -->
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 4. Update Config
|
|
56
|
+
|
|
57
|
+
Add platform to `ai_platforms` array in `./proagents.config.yaml`:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
ai_platforms:
|
|
61
|
+
- claude
|
|
62
|
+
- cursor
|
|
63
|
+
- {new_platform} # Add this
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 5. Confirm
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Added {platform_name}!
|
|
70
|
+
File: {file_path}
|
|
71
|
+
Config updated: ./proagents.config.yaml
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Merge Rules
|
|
75
|
+
|
|
76
|
+
When target file already exists:
|
|
77
|
+
|
|
78
|
+
1. **Has PROAGENTS markers:** Update content between markers only
|
|
79
|
+
2. **No markers:** Append ProAgents section at end with markers
|
|
80
|
+
3. **Never overwrite** user's existing configuration
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# pa:ai-list - List AI Platforms
|
|
2
|
+
|
|
3
|
+
Show which AI platforms are configured for this project.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. **Read config file:**
|
|
8
|
+
```bash
|
|
9
|
+
cat ./proagents.config.yaml
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2. **Extract `ai_platforms` array** from the config
|
|
13
|
+
|
|
14
|
+
3. **Display installed platforms:**
|
|
15
|
+
```
|
|
16
|
+
Installed AI Platforms:
|
|
17
|
+
- Claude Code (CLAUDE.md)
|
|
18
|
+
- Cursor (.cursorrules)
|
|
19
|
+
- ...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
4. **Show available platforms** (not yet installed):
|
|
23
|
+
- Read `.proagents/platforms.yaml` for full list
|
|
24
|
+
- Compare with installed list
|
|
25
|
+
- Show what can be added
|
|
26
|
+
|
|
27
|
+
## Output Format
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Installed AI Platforms:
|
|
31
|
+
[x] claude - Claude Code
|
|
32
|
+
[x] cursor - Cursor
|
|
33
|
+
|
|
34
|
+
Available to Add:
|
|
35
|
+
[ ] windsurf - Windsurf
|
|
36
|
+
[ ] copilot - GitHub Copilot
|
|
37
|
+
[ ] gemini - Gemini
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
Use pa:ai-add to add more platforms.
|
|
41
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# pa:ai-remove - Remove AI Platform
|
|
2
|
+
|
|
3
|
+
Remove an AI platform configuration from this project.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
### 1. Show Installed Platforms
|
|
8
|
+
|
|
9
|
+
Read config and show what's installed:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
cat ./proagents.config.yaml
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Display:
|
|
16
|
+
```
|
|
17
|
+
Installed AI Platforms:
|
|
18
|
+
1. claude - Claude Code (CLAUDE.md)
|
|
19
|
+
2. cursor - Cursor (.cursorrules)
|
|
20
|
+
|
|
21
|
+
Which platform to remove?
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Locate the File
|
|
25
|
+
|
|
26
|
+
Get file path from `.proagents/platforms.yaml`:
|
|
27
|
+
- claude → `CLAUDE.md`
|
|
28
|
+
- cursor → `.cursorrules`
|
|
29
|
+
- copilot → `.github/copilot-instructions.md`
|
|
30
|
+
- etc.
|
|
31
|
+
|
|
32
|
+
### 3. Remove ProAgents Content
|
|
33
|
+
|
|
34
|
+
**CRITICAL: Follow these rules carefully to avoid deleting user's config.**
|
|
35
|
+
|
|
36
|
+
#### Step 3a: Check for Markers
|
|
37
|
+
|
|
38
|
+
Look for these markers in the file:
|
|
39
|
+
```
|
|
40
|
+
<!-- PROAGENTS_START -->
|
|
41
|
+
...content...
|
|
42
|
+
<!-- PROAGENTS_END -->
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Step 3b: If Markers Found
|
|
46
|
+
|
|
47
|
+
1. Remove ONLY the content between markers (including the markers)
|
|
48
|
+
2. Keep ALL other content in the file
|
|
49
|
+
3. Clean up extra blank lines
|
|
50
|
+
4. If file is empty after removal → delete the file
|
|
51
|
+
5. If file has remaining content → keep the file
|
|
52
|
+
|
|
53
|
+
**Example:**
|
|
54
|
+
```
|
|
55
|
+
# My Custom Rules ← KEEP
|
|
56
|
+
Some user config ← KEEP
|
|
57
|
+
|
|
58
|
+
<!-- PROAGENTS_START --> ← REMOVE
|
|
59
|
+
ProAgents content... ← REMOVE
|
|
60
|
+
<!-- PROAGENTS_END --> ← REMOVE
|
|
61
|
+
|
|
62
|
+
# More user config ← KEEP
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Step 3c: If NO Markers Found
|
|
66
|
+
|
|
67
|
+
**DO NOT DELETE THE FILE.**
|
|
68
|
+
|
|
69
|
+
The file may contain user's own configuration that predates ProAgents or was manually edited.
|
|
70
|
+
|
|
71
|
+
Action:
|
|
72
|
+
1. Warn user: "No ProAgents markers found in {file}"
|
|
73
|
+
2. Suggest: "Manual cleanup may be needed"
|
|
74
|
+
3. Skip file removal
|
|
75
|
+
4. Still update config (step 4)
|
|
76
|
+
|
|
77
|
+
### 4. Update Config
|
|
78
|
+
|
|
79
|
+
Remove platform from `ai_platforms` in `./proagents.config.yaml`:
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
ai_platforms:
|
|
83
|
+
- claude
|
|
84
|
+
# - cursor ← removed
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 5. Confirm
|
|
88
|
+
|
|
89
|
+
Success cases:
|
|
90
|
+
```
|
|
91
|
+
Removed {platform}:
|
|
92
|
+
- Deleted: {file} (file only had ProAgents content)
|
|
93
|
+
OR
|
|
94
|
+
- Cleaned: {file} (kept your custom config)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Skip case:
|
|
98
|
+
```
|
|
99
|
+
Skipped {platform}:
|
|
100
|
+
- No ProAgents markers in {file}
|
|
101
|
+
- Manual cleanup may be needed
|
|
102
|
+
- Config updated anyway
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Safety Summary
|
|
106
|
+
|
|
107
|
+
| Scenario | Action |
|
|
108
|
+
|----------|--------|
|
|
109
|
+
| File has markers, only ProAgents content | Delete file |
|
|
110
|
+
| File has markers + user content | Remove markers section, keep rest |
|
|
111
|
+
| File has no markers | **SKIP - don't delete** |
|
|
112
|
+
| File doesn't exist | Skip silently |
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# pa:ai-sync - Sync AI Platform Config
|
|
2
|
+
|
|
3
|
+
Synchronize the config file with actual AI instruction files (fix mismatches).
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- After manually adding/removing AI files
|
|
8
|
+
- When config is out of sync with files
|
|
9
|
+
- To detect and fix inconsistencies
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
### 1. Read Current Config
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cat ./proagents.config.yaml
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Extract `ai_platforms` array.
|
|
20
|
+
|
|
21
|
+
### 2. Read Platform Definitions
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cat .proagents/platforms.yaml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Scan for Existing Files
|
|
28
|
+
|
|
29
|
+
Check project root for each platform's file:
|
|
30
|
+
|
|
31
|
+
| Platform | File to Check |
|
|
32
|
+
|----------|---------------|
|
|
33
|
+
| claude | `CLAUDE.md` |
|
|
34
|
+
| cursor | `.cursorrules` |
|
|
35
|
+
| windsurf | `.windsurfrules` |
|
|
36
|
+
| copilot | `.github/copilot-instructions.md` |
|
|
37
|
+
| kiro | `KIRO.md` |
|
|
38
|
+
| gemini | `GEMINI.md` |
|
|
39
|
+
| replit | `REPLIT.md` |
|
|
40
|
+
| bolt | `BOLT.md` |
|
|
41
|
+
| lovable | `LOVABLE.md` |
|
|
42
|
+
|
|
43
|
+
### 4. Compare and Report
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
AI Platform Sync Status:
|
|
47
|
+
|
|
48
|
+
In Config + File Exists:
|
|
49
|
+
[x] claude - CLAUDE.md
|
|
50
|
+
[x] cursor - .cursorrules
|
|
51
|
+
|
|
52
|
+
In Config but File Missing:
|
|
53
|
+
[!] windsurf - .windsurfrules NOT FOUND
|
|
54
|
+
|
|
55
|
+
File Exists but Not in Config:
|
|
56
|
+
[?] gemini - GEMINI.md exists
|
|
57
|
+
|
|
58
|
+
Actions needed:
|
|
59
|
+
1. Add windsurf file OR remove from config
|
|
60
|
+
2. Add gemini to config OR delete file
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 5. Ask User for Action
|
|
64
|
+
|
|
65
|
+
For each mismatch:
|
|
66
|
+
|
|
67
|
+
**File missing:**
|
|
68
|
+
```
|
|
69
|
+
windsurf is in config but file doesn't exist.
|
|
70
|
+
1. Create the file (copy from .proagents/)
|
|
71
|
+
2. Remove from config
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**File exists but not in config:**
|
|
75
|
+
```
|
|
76
|
+
GEMINI.md exists but gemini not in config.
|
|
77
|
+
1. Add to config
|
|
78
|
+
2. Delete the file
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 6. Apply Fixes
|
|
82
|
+
|
|
83
|
+
Based on user choice:
|
|
84
|
+
- Create missing files (use `pa:ai-add` logic)
|
|
85
|
+
- Remove orphaned entries from config
|
|
86
|
+
- Add discovered platforms to config
|
|
87
|
+
- Delete orphaned files (use `pa:ai-remove` logic)
|
|
88
|
+
|
|
89
|
+
### 7. Confirm
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Sync complete!
|
|
93
|
+
- Added: gemini to config
|
|
94
|
+
- Created: .windsurfrules
|
|
95
|
+
- Removed: kiro from config (file was missing)
|
|
96
|
+
```
|
package/lib/commands/ai.js
CHANGED
|
@@ -8,8 +8,50 @@ import yaml from 'js-yaml';
|
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = dirname(__filename);
|
|
10
10
|
|
|
11
|
+
// Load platforms from YAML (single source of truth)
|
|
12
|
+
// Priority: 1) User's project .proagents/platforms.yaml, 2) npm package's platforms.yaml
|
|
13
|
+
function loadPlatformsFromYaml() {
|
|
14
|
+
// First, try user's project directory
|
|
15
|
+
const userYamlPath = join(process.cwd(), '.proagents', 'platforms.yaml');
|
|
16
|
+
if (existsSync(userYamlPath)) {
|
|
17
|
+
try {
|
|
18
|
+
const content = readFileSync(userYamlPath, 'utf-8');
|
|
19
|
+
return yaml.load(content);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
// Fall through to npm package
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Fallback to npm package's platforms.yaml
|
|
26
|
+
const packageYamlPath = join(__dirname, '..', '..', '.proagents', 'platforms.yaml');
|
|
27
|
+
if (existsSync(packageYamlPath)) {
|
|
28
|
+
try {
|
|
29
|
+
const content = readFileSync(packageYamlPath, 'utf-8');
|
|
30
|
+
return yaml.load(content);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.warn('Warning: Could not load platforms.yaml, using defaults');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Fallback to defaults if YAML doesn't exist
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Load from YAML or use defaults
|
|
41
|
+
const platformsConfig = loadPlatformsFromYaml();
|
|
42
|
+
|
|
11
43
|
// AI Platform definitions grouped by type
|
|
12
|
-
export const AI_PLATFORMS = {
|
|
44
|
+
export const AI_PLATFORMS = platformsConfig ? {
|
|
45
|
+
ide: {
|
|
46
|
+
label: platformsConfig.ide?.label || 'IDE-based AI Assistants',
|
|
47
|
+
platforms: platformsConfig.ide?.platforms || []
|
|
48
|
+
},
|
|
49
|
+
web: {
|
|
50
|
+
label: platformsConfig.web?.label || 'Web-based AI Platforms',
|
|
51
|
+
platforms: platformsConfig.web?.platforms || []
|
|
52
|
+
}
|
|
53
|
+
} : {
|
|
54
|
+
// Fallback defaults (only used if platforms.yaml is missing)
|
|
13
55
|
ide: {
|
|
14
56
|
label: 'IDE-based AI Assistants',
|
|
15
57
|
platforms: [
|
|
@@ -18,34 +60,28 @@ export const AI_PLATFORMS = {
|
|
|
18
60
|
{ id: 'windsurf', name: 'Windsurf', file: '.windsurfrules', desc: 'Codeium Windsurf IDE' },
|
|
19
61
|
{ id: 'copilot', name: 'GitHub Copilot', file: '.github/copilot-instructions.md', desc: 'GitHub Copilot' },
|
|
20
62
|
{ id: 'kiro', name: 'AWS Kiro', file: 'KIRO.md', desc: 'AWS Kiro IDE' },
|
|
21
|
-
{ id: '
|
|
63
|
+
{ id: 'gemini', name: 'Gemini', file: 'GEMINI.md', desc: 'Google Gemini / AI Studio' },
|
|
22
64
|
]
|
|
23
65
|
},
|
|
24
66
|
web: {
|
|
25
67
|
label: 'Web-based AI Platforms',
|
|
26
68
|
platforms: [
|
|
27
|
-
{ id: 'chatgpt', name: 'ChatGPT', file: 'CHATGPT.md', desc: 'OpenAI ChatGPT' },
|
|
28
|
-
{ id: 'gemini', name: 'Gemini', file: 'GEMINI.md', desc: 'Google Gemini' },
|
|
29
69
|
{ id: 'replit', name: 'Replit AI', file: 'REPLIT.md', desc: 'Replit Ghostwriter' },
|
|
30
70
|
{ id: 'bolt', name: 'Bolt.new', file: 'BOLT.md', desc: 'StackBlitz Bolt' },
|
|
31
71
|
{ id: 'lovable', name: 'Lovable', file: 'LOVABLE.md', desc: 'Lovable (GPT Engineer)' },
|
|
32
|
-
{ id: 'groq', name: 'Groq', file: 'GROQ.md', desc: 'Groq fast inference' },
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
cli: {
|
|
36
|
-
label: 'CLI-based AI Agents',
|
|
37
|
-
platforms: [
|
|
38
|
-
{ id: 'codex', name: 'Codex CLI', file: 'AGENTS.md', desc: 'OpenAI Codex CLI' },
|
|
39
72
|
]
|
|
40
73
|
}
|
|
41
74
|
};
|
|
42
75
|
|
|
76
|
+
// Auto-handled platforms (use AGENTS.md, no separate file needed)
|
|
77
|
+
export const AUTO_HANDLED_PLATFORMS = platformsConfig?.auto_handled ||
|
|
78
|
+
['ChatGPT', 'Groq', 'Antigravity', 'Codex CLI', 'OpenAI API'];
|
|
79
|
+
|
|
43
80
|
// Get all platforms as flat array
|
|
44
81
|
export function getAllPlatforms() {
|
|
45
82
|
return [
|
|
46
83
|
...AI_PLATFORMS.ide.platforms,
|
|
47
84
|
...AI_PLATFORMS.web.platforms,
|
|
48
|
-
...AI_PLATFORMS.cli.platforms,
|
|
49
85
|
];
|
|
50
86
|
}
|
|
51
87
|
|
|
@@ -115,7 +151,12 @@ export async function selectPlatforms(previouslySelected = []) {
|
|
|
115
151
|
const preselected = [...new Set([...autoSelected, ...(previouslySelected || [])])];
|
|
116
152
|
|
|
117
153
|
console.log('\n' + chalk.bold('Which AI platform(s) do you use?'));
|
|
118
|
-
console.log(chalk.gray('(Enter numbers separated by commas, or "all" for all platforms)
|
|
154
|
+
console.log(chalk.gray('(Enter numbers separated by commas, or "all" for all platforms)'));
|
|
155
|
+
|
|
156
|
+
// Show auto-handled platforms info
|
|
157
|
+
console.log(chalk.cyan.bold('\n Auto-handled (via AGENTS.md):'));
|
|
158
|
+
console.log(chalk.gray(' ' + AUTO_HANDLED_PLATFORMS.join(', ')));
|
|
159
|
+
console.log(chalk.gray(' → These work automatically, no installation needed\n'));
|
|
119
160
|
|
|
120
161
|
let index = 1;
|
|
121
162
|
const indexMap = {};
|
|
@@ -155,20 +196,6 @@ export async function selectPlatforms(previouslySelected = []) {
|
|
|
155
196
|
|
|
156
197
|
console.log('');
|
|
157
198
|
|
|
158
|
-
// CLI-based platforms
|
|
159
|
-
console.log(chalk.cyan.bold(` ${AI_PLATFORMS.cli.label}:`));
|
|
160
|
-
for (const platform of AI_PLATFORMS.cli.platforms) {
|
|
161
|
-
const wasPreviouslySelected = previouslySelected && previouslySelected.includes(platform.id);
|
|
162
|
-
const isPreselected = preselected.includes(platform.id);
|
|
163
|
-
const marker = wasPreviouslySelected ? chalk.green(' ✓ (previously selected)') : '';
|
|
164
|
-
console.log(chalk.white(` ${index}. ${platform.name}`) + chalk.gray(` - ${platform.desc}`) + marker);
|
|
165
|
-
indexMap[index] = platform.id;
|
|
166
|
-
if (isPreselected) preSelectedIndices.push(index);
|
|
167
|
-
index++;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
console.log('');
|
|
171
|
-
|
|
172
199
|
// Show default based on preselected (auto-detected + previously selected)
|
|
173
200
|
const defaultHint = preSelectedIndices.length > 0
|
|
174
201
|
? `Enter for selected: ${preSelectedIndices.join(',')}`
|
|
@@ -253,12 +280,9 @@ function removeProagentsSectionFromFile(filePath) {
|
|
|
253
280
|
return 'cleaned';
|
|
254
281
|
}
|
|
255
282
|
} else {
|
|
256
|
-
// No ProAgents markers -
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
rmSync(filePath, { force: true });
|
|
260
|
-
return 'deleted';
|
|
261
|
-
}
|
|
283
|
+
// No ProAgents markers found - we cannot safely determine what to remove
|
|
284
|
+
// Don't delete the file as it may contain user's own configuration
|
|
285
|
+
// User should manually clean up files without proper markers
|
|
262
286
|
return 'skipped';
|
|
263
287
|
}
|
|
264
288
|
} catch (error) {
|
|
@@ -346,6 +370,24 @@ export function copyPlatformFiles(selectedIds, sourceDir, targetDir) {
|
|
|
346
370
|
return results;
|
|
347
371
|
}
|
|
348
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Copy universal AGENTS.md file (always present, not a selectable platform)
|
|
375
|
+
* @param {string} sourceDir - Source directory (.proagents folder in npm package)
|
|
376
|
+
* @param {string} targetDir - Target directory (project root)
|
|
377
|
+
* @returns {string} - 'created', 'updated', or 'skipped'
|
|
378
|
+
*/
|
|
379
|
+
export function copyUniversalAIFile(sourceDir, targetDir) {
|
|
380
|
+
const sourcePath = join(sourceDir, 'AGENTS.md');
|
|
381
|
+
const targetPath = join(targetDir, 'AGENTS.md');
|
|
382
|
+
|
|
383
|
+
if (!existsSync(sourcePath)) {
|
|
384
|
+
return 'skipped';
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const result = mergeAIInstructions(sourcePath, targetPath);
|
|
388
|
+
return result;
|
|
389
|
+
}
|
|
390
|
+
|
|
349
391
|
/**
|
|
350
392
|
* Save selected platforms to config
|
|
351
393
|
*/
|
|
@@ -431,6 +473,20 @@ export function getInstalledPlatforms(targetDir, configPath) {
|
|
|
431
473
|
* Show available platforms that can be added
|
|
432
474
|
*/
|
|
433
475
|
export function showAvailablePlatforms(currentIds) {
|
|
476
|
+
// Show auto-handled platforms info
|
|
477
|
+
console.log(chalk.cyan.bold('\n Auto-handled (via AGENTS.md):'));
|
|
478
|
+
console.log(chalk.gray(' ' + AUTO_HANDLED_PLATFORMS.join(', ')));
|
|
479
|
+
console.log(chalk.gray(' → These work automatically, no installation needed'));
|
|
480
|
+
console.log(chalk.yellow(' ⚠️ Do not remove AGENTS.md - required for these platforms'));
|
|
481
|
+
|
|
482
|
+
// Show user's installed platforms
|
|
483
|
+
const installedNames = currentIds
|
|
484
|
+
.map(id => getPlatformById(id)?.name)
|
|
485
|
+
.filter(Boolean);
|
|
486
|
+
if (installedNames.length > 0) {
|
|
487
|
+
console.log(chalk.green('\n Your platforms: ') + chalk.white(installedNames.join(', ')));
|
|
488
|
+
}
|
|
489
|
+
|
|
434
490
|
console.log('\n' + chalk.bold('Available AI Platforms:\n'));
|
|
435
491
|
|
|
436
492
|
let index = 1;
|
|
@@ -464,21 +520,6 @@ export function showAvailablePlatforms(currentIds) {
|
|
|
464
520
|
index++;
|
|
465
521
|
}
|
|
466
522
|
|
|
467
|
-
console.log('');
|
|
468
|
-
|
|
469
|
-
// CLI-based platforms
|
|
470
|
-
console.log(chalk.cyan.bold(` ${AI_PLATFORMS.cli.label}:`));
|
|
471
|
-
for (const platform of AI_PLATFORMS.cli.platforms) {
|
|
472
|
-
const status = currentIds.includes(platform.id)
|
|
473
|
-
? chalk.green(' ✓ (installed)')
|
|
474
|
-
: chalk.gray(' (not installed)');
|
|
475
|
-
console.log(chalk.white(` ${index}. ${platform.name}`) + status);
|
|
476
|
-
if (!currentIds.includes(platform.id)) {
|
|
477
|
-
available.push({ index, platform });
|
|
478
|
-
}
|
|
479
|
-
index++;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
523
|
return available;
|
|
483
524
|
}
|
|
484
525
|
|
|
@@ -540,6 +581,12 @@ export async function aiAddCommand() {
|
|
|
540
581
|
// Copy files for new platforms
|
|
541
582
|
const results = copyPlatformFiles(toAdd, sourceDir, targetDir);
|
|
542
583
|
|
|
584
|
+
// Ensure universal AGENTS.md exists (auto-handled platforms)
|
|
585
|
+
const agentsResult = copyUniversalAIFile(sourceDir, targetDir);
|
|
586
|
+
if (agentsResult === 'created') {
|
|
587
|
+
results.created.push('AGENTS.md (auto-handled)');
|
|
588
|
+
}
|
|
589
|
+
|
|
543
590
|
// Update config
|
|
544
591
|
const newIds = [...currentIds, ...toAdd];
|
|
545
592
|
savePlatformConfig(newIds, configPath);
|
|
@@ -658,6 +705,8 @@ export async function aiRemoveCommand() {
|
|
|
658
705
|
results.deleted.push(platform.name);
|
|
659
706
|
} else if (result === 'cleaned') {
|
|
660
707
|
results.cleaned.push(platform.name);
|
|
708
|
+
} else if (result === 'skipped') {
|
|
709
|
+
results.skipped.push(platform.name);
|
|
661
710
|
}
|
|
662
711
|
}
|
|
663
712
|
}
|
|
@@ -670,6 +719,9 @@ export async function aiRemoveCommand() {
|
|
|
670
719
|
if (results.cleaned.length > 0) {
|
|
671
720
|
console.log(chalk.green(`✓ Cleaned ProAgents section from: ${results.cleaned.join(', ')} (kept your custom config)`));
|
|
672
721
|
}
|
|
722
|
+
if (results.skipped.length > 0) {
|
|
723
|
+
console.log(chalk.yellow(`⚠ Skipped: ${results.skipped.join(', ')} (no ProAgents markers found - manual cleanup may be needed)`));
|
|
724
|
+
}
|
|
673
725
|
|
|
674
726
|
console.log(chalk.gray('\nConfig updated in proagents.config.yaml\n'));
|
|
675
727
|
}
|
package/lib/commands/init.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
import { createInterface } from 'readline';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import yaml from 'js-yaml';
|
|
7
|
-
import { selectPlatforms, copyPlatformFiles, savePlatformConfig, loadPlatformConfig } from './ai.js';
|
|
7
|
+
import { selectPlatforms, copyPlatformFiles, copyUniversalAIFile, savePlatformConfig, loadPlatformConfig } from './ai.js';
|
|
8
8
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = dirname(__filename);
|
|
@@ -213,9 +213,12 @@ const FRAMEWORK_FILES = [
|
|
|
213
213
|
'GETTING-STARTED-STORY.md',
|
|
214
214
|
'slash-commands.json',
|
|
215
215
|
'AI_INSTRUCTIONS.md', // Universal instructions kept for reference
|
|
216
|
-
'
|
|
216
|
+
'platforms.yaml', // Single source of truth for AI platforms
|
|
217
217
|
];
|
|
218
218
|
|
|
219
|
+
// Universal AI file - always copied to project root (not selectable)
|
|
220
|
+
const UNIVERSAL_AI_FILE = 'AGENTS.md';
|
|
221
|
+
|
|
219
222
|
// Project type definitions for detection
|
|
220
223
|
const PROJECT_TYPES = [
|
|
221
224
|
{
|
|
@@ -1243,6 +1246,14 @@ For detailed commands, see \`./.proagents/PROAGENTS.md\`
|
|
|
1243
1246
|
// Copy AI instruction files for selected platforms (merges with existing files)
|
|
1244
1247
|
const aiResults = copyPlatformFiles(selectedPlatforms, sourceDir, targetDir);
|
|
1245
1248
|
|
|
1249
|
+
// Always copy universal AGENTS.md
|
|
1250
|
+
const agentsResult = copyUniversalAIFile(sourceDir, targetDir);
|
|
1251
|
+
if (agentsResult === 'created') {
|
|
1252
|
+
aiResults.created.push('AGENTS.md');
|
|
1253
|
+
} else if (agentsResult === 'updated') {
|
|
1254
|
+
aiResults.updated.push('AGENTS.md');
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1246
1257
|
if (aiResults.created.length > 0) {
|
|
1247
1258
|
console.log(chalk.green(`✓ Created AI files: ${aiResults.created.join(', ')}`));
|
|
1248
1259
|
}
|
|
@@ -1376,21 +1387,28 @@ async function smartUpdate(sourceDir, targetDir) {
|
|
|
1376
1387
|
|
|
1377
1388
|
// Copy AI instruction files for configured platforms (merges with existing files)
|
|
1378
1389
|
const projectRoot = join(targetDir, '..');
|
|
1379
|
-
const configPath = join(
|
|
1390
|
+
const configPath = join(projectRoot, 'proagents.config.yaml');
|
|
1380
1391
|
const selectedPlatforms = loadPlatformConfig(configPath);
|
|
1381
1392
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1393
|
+
// Copy AI instruction files for configured platforms
|
|
1394
|
+
const aiResults = copyPlatformFiles(selectedPlatforms, sourceDir, projectRoot);
|
|
1384
1395
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1396
|
+
// Always copy universal AGENTS.md
|
|
1397
|
+
const agentsResult = copyUniversalAIFile(sourceDir, projectRoot);
|
|
1398
|
+
if (agentsResult === 'created') {
|
|
1399
|
+
aiResults.created.push('AGENTS.md');
|
|
1400
|
+
} else if (agentsResult === 'updated') {
|
|
1401
|
+
aiResults.updated.push('AGENTS.md');
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
if (aiResults.created.length > 0) {
|
|
1405
|
+
console.log(chalk.green(`✓ Created new AI files: ${aiResults.created.join(', ')}`));
|
|
1406
|
+
}
|
|
1407
|
+
if (aiResults.updated.length > 0) {
|
|
1408
|
+
console.log(chalk.green(`✓ Updated AI files: ${aiResults.updated.join(', ')}`));
|
|
1409
|
+
}
|
|
1410
|
+
if (aiResults.merged.length > 0) {
|
|
1411
|
+
console.log(chalk.green(`✓ Merged with existing: ${aiResults.merged.join(', ')}`));
|
|
1394
1412
|
}
|
|
1395
1413
|
|
|
1396
1414
|
// Update framework files within preserved paths (templates, README, schemas)
|