proagents 1.6.13 → 1.6.15

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.
@@ -0,0 +1,60 @@
1
+ {
2
+ "_template_info": {
3
+ "description": "Template reference for common-patterns.json schema",
4
+ "note": "DO NOT modify this file - it gets updated with ProAgents upgrades",
5
+ "usage": "AI reads this to understand expected schema for common-patterns.json"
6
+ },
7
+
8
+ "$schema": "../schemas/patterns-schema.json",
9
+ "version": "1.0.0",
10
+ "updated_at": "2024-01-15T10:30:00Z",
11
+
12
+ "patterns": {
13
+ "component_patterns": [
14
+ {
15
+ "id": "pattern-id",
16
+ "name": "Pattern Name",
17
+ "frequency": 95,
18
+ "confidence": 0.98,
19
+ "template": "code template with {{placeholders}}"
20
+ }
21
+ ],
22
+ "api_patterns": [],
23
+ "error_handling": [],
24
+ "testing_patterns": []
25
+ },
26
+
27
+ "anti_patterns": [
28
+ {
29
+ "id": "anti-pattern-id",
30
+ "name": "Anti-pattern Name",
31
+ "detected_count": 0,
32
+ "suggestion": "How to fix",
33
+ "auto_suggest": true
34
+ }
35
+ ],
36
+
37
+ "learned_from": {
38
+ "codebase_analysis": 0,
39
+ "user_corrections": 0,
40
+ "explicit_teaching": 0
41
+ },
42
+
43
+ "_schema_notes": {
44
+ "patterns": {
45
+ "component_patterns": "React/Vue/etc component patterns",
46
+ "api_patterns": "API handler patterns",
47
+ "error_handling": "Error handling patterns",
48
+ "testing_patterns": "Test structure patterns"
49
+ },
50
+ "pattern_fields": {
51
+ "id": "Unique identifier",
52
+ "name": "Human-readable name",
53
+ "frequency": "How often used (0-100)",
54
+ "confidence": "AI confidence (0-1)",
55
+ "template": "Code template with {{placeholders}}"
56
+ },
57
+ "anti_patterns": "Patterns to avoid",
58
+ "learned_from": "Source of learning data"
59
+ }
60
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "_template_info": {
3
+ "description": "Template reference for user-preferences.json schema",
4
+ "note": "DO NOT modify this file - it gets updated with ProAgents upgrades",
5
+ "usage": "AI reads this to understand expected schema for user-preferences.json"
6
+ },
7
+
8
+ "$schema": "../schemas/user-preferences-schema.json",
9
+ "version": "1.0.0",
10
+ "updated_at": "2024-01-15T10:30:00Z",
11
+
12
+ "checkpoint_preferences": {
13
+ "usually_skips": ["after_requirements", "after_documentation"],
14
+ "always_reviews": ["after_design", "before_deployment"],
15
+ "auto_approve_conditions": [
16
+ {
17
+ "checkpoint": "after_analysis",
18
+ "condition": "files_changed < 5",
19
+ "confidence": 0.85
20
+ }
21
+ ]
22
+ },
23
+
24
+ "workflow_preferences": {
25
+ "preferred_mode": "full",
26
+ "skip_phases_for_bug_fixes": ["design", "documentation"],
27
+ "detail_level": "high",
28
+ "verbosity": "moderate"
29
+ },
30
+
31
+ "code_preferences": {
32
+ "naming_style": {
33
+ "components": "PascalCase",
34
+ "functions": "camelCase",
35
+ "constants": "UPPER_SNAKE_CASE",
36
+ "files": "kebab-case"
37
+ },
38
+ "formatting": {
39
+ "indent": 2,
40
+ "quotes": "single",
41
+ "semicolons": true,
42
+ "trailing_commas": "es5"
43
+ },
44
+ "patterns": {
45
+ "state_management": "zustand",
46
+ "data_fetching": "react-query",
47
+ "styling": "tailwind"
48
+ }
49
+ },
50
+
51
+ "review_preferences": {
52
+ "focus_areas": ["security", "performance", "accessibility"],
53
+ "thoroughness": "high",
54
+ "comment_style": "inline"
55
+ },
56
+
57
+ "notification_preferences": {
58
+ "on_checkpoint": true,
59
+ "on_completion": true,
60
+ "on_error": true,
61
+ "channels": ["terminal"]
62
+ },
63
+
64
+ "learning_consent": {
65
+ "track_corrections": true,
66
+ "track_patterns": true,
67
+ "share_anonymized": false
68
+ },
69
+
70
+ "_schema_notes": {
71
+ "checkpoint_preferences": "User's checkpoint review preferences",
72
+ "workflow_preferences": "How user prefers to work",
73
+ "code_preferences": "Coding style and patterns",
74
+ "review_preferences": "Code review settings",
75
+ "notification_preferences": "When to notify",
76
+ "learning_consent": "Privacy settings for learning"
77
+ }
78
+ }
@@ -0,0 +1,55 @@
1
+ # ProAgents Commands for Codex
2
+
3
+ This project uses ProAgents - an AI-agnostic development workflow framework.
4
+
5
+ ## MANDATORY: Every pa: Command Flow
6
+
7
+ ### BEFORE Any pa: Command (Auto-Sync)
8
+
9
+ **Read these files FIRST before doing anything:**
10
+
11
+ ```bash
12
+ cat .proagents/worklog/_context.md # Current state
13
+ cat .proagents/changelog/_recent.md # Recent changes
14
+ tail -10 .proagents/activity.log # Recent activity
15
+ ```
16
+
17
+ **This applies to EVERY command:** `pa:fix`, `pa:feature`, `pa:test`, `pa:doc`, etc.
18
+
19
+ ### AFTER Any pa: Command (Auto-Log)
20
+
21
+ **After EVERY file edit, IMMEDIATELY update these files:**
22
+
23
+ 1. `.proagents/changelog/_recent.md` - Prepend change summary
24
+ 2. `.proagents/changelog/modules/[module].md` - Based on file path
25
+ 3. `.proagents/worklog/_context.md` - Update current state
26
+
27
+ Module detection: `src/api/*`→api, `src/auth/*`→auth, `src/components/*`→ui
28
+
29
+ ## Essential Commands
30
+
31
+ | Command | Action |
32
+ |---------|--------|
33
+ | `pa:feature "name"` | Start new feature workflow |
34
+ | `pa:fix "bug"` | Quick bug fix mode |
35
+ | `pa:doc` | Documentation options |
36
+ | `pa:qa` | Quality assurance checks |
37
+ | `pa:test` | Run test workflow |
38
+ | `pa:deploy` | Deployment preparation |
39
+ | `pa:status` | Show current progress |
40
+
41
+ ## Full Command Reference
42
+
43
+ For complete command list, see: `./.proagents/AI_INSTRUCTIONS.md`
44
+
45
+ ## On `pa:` Command
46
+
47
+ 1. Read the corresponding file from `./.proagents/prompts/` or `./.proagents/workflow-modes/`
48
+ 2. Follow the workflow instructions
49
+ 3. Use project config from `./.proagents/proagents.config.yaml`
50
+
51
+ ## Key Files
52
+
53
+ - `./.proagents/AI_INSTRUCTIONS.md` - Complete command reference
54
+ - `./.proagents/WORKFLOW.md` - Full 10-phase workflow
55
+ - `./.proagents/prompts/` - Phase-specific prompts
@@ -41,6 +41,8 @@ tail -10 .proagents/activity.log 2>/dev/null
41
41
  5. AI logs to activity.log ← LOG ACTIVITY
42
42
  ```
43
43
 
44
+ **Note:** When updating `_recent.md` or `_context.md`, first read the corresponding `*.template.md` file to use the latest format. See "Using Template Reference Files" section below.
45
+
44
46
  ---
45
47
 
46
48
  ## CRITICAL PRINCIPLE: ALWAYS DO, NEVER JUST TELL
@@ -155,6 +157,37 @@ AI immediately updates these files (no user prompt needed):
155
157
  4. .proagents/changelog/modules/X.md ← Based on file path
156
158
  ```
157
159
 
160
+ ### Using Template Reference Files
161
+
162
+ **IMPORTANT:** Template files (`*.template.md`, `*.template.json`) provide the latest format for user data files.
163
+
164
+ | User Data File (EDIT THIS) | Template Reference (READ ONLY) |
165
+ |----------------------------|-------------------------------|
166
+ | `changelog/_recent.md` | `changelog/_recent.template.md` |
167
+ | `worklog/_context.md` | `worklog/_context.template.md` |
168
+ | `worklog/ai-stats.json` | `worklog/ai-stats.template.json` |
169
+ | `active-features/_index.json` | `active-features/_index.template.json` |
170
+ | `.learning/global/user-preferences.json` | `.learning/global/user-preferences.template.json` |
171
+ | `.learning/global/common-patterns.json` | `.learning/global/common-patterns.template.json` |
172
+
173
+ **How to use:**
174
+ 1. **Read the template FIRST** before creating/updating user data files
175
+ 2. **Apply the template format** to user data (structure, fields, sections)
176
+ 3. **NEVER modify template files** - they are READ ONLY (updated by framework)
177
+
178
+ **Why templates exist:**
179
+ - Templates get updated when ProAgents upgrades (new fields, better structure)
180
+ - User data files are preserved during upgrades (your content stays safe)
181
+ - AI always has access to the latest format by reading templates
182
+
183
+ **Common mistake to avoid:**
184
+ ```
185
+ WRONG: Edit _recent.template.md directly
186
+ RIGHT: Read _recent.template.md, then edit _recent.md using that format
187
+ ```
188
+
189
+ ---
190
+
158
191
  ### Auto-Log Format for _recent.md:
159
192
 
160
193
  After editing `src/auth/login.ts`, AI prepends to `_recent.md`:
@@ -0,0 +1,75 @@
1
+ {
2
+ "_template_info": {
3
+ "description": "Template reference for _index.json schema",
4
+ "note": "DO NOT modify this file - it gets updated with ProAgents upgrades",
5
+ "usage": "AI reads this to understand expected schema for _index.json"
6
+ },
7
+
8
+ "$schema": "./schemas/index-schema.json",
9
+ "version": "1.0.0",
10
+ "last_updated": "2024-03-13T10:30:00Z",
11
+
12
+ "active_features": [
13
+ {
14
+ "id": "feature-user-auth",
15
+ "name": "User Authentication",
16
+ "started_at": "2024-03-10T09:00:00Z",
17
+ "started_by": "claude",
18
+ "priority": "high",
19
+ "progress": 45,
20
+ "phase": "implementation"
21
+ }
22
+ ],
23
+
24
+ "paused_features": [
25
+ {
26
+ "id": "feature-dark-mode",
27
+ "name": "Dark Mode",
28
+ "paused_at": "2024-03-12T14:00:00Z",
29
+ "reason": "Waiting for design review"
30
+ }
31
+ ],
32
+
33
+ "completed_features": [
34
+ {
35
+ "id": "feature-login",
36
+ "name": "Login Page",
37
+ "completed_at": "2024-03-08T16:30:00Z",
38
+ "duration_days": 3
39
+ }
40
+ ],
41
+
42
+ "conflicts": {
43
+ "active": [],
44
+ "resolved": [
45
+ {
46
+ "files": ["src/auth.ts"],
47
+ "features": ["feature-user-auth", "feature-login"],
48
+ "resolved_at": "2024-03-08T12:00:00Z"
49
+ }
50
+ ]
51
+ },
52
+
53
+ "statistics": {
54
+ "total_active": 1,
55
+ "total_paused": 1,
56
+ "total_completed": 1,
57
+ "average_completion_days": 3,
58
+ "conflict_rate": 0.1
59
+ },
60
+
61
+ "_schema": {
62
+ "active_features": {
63
+ "type": "array",
64
+ "items": {
65
+ "id": "string - Unique feature ID",
66
+ "name": "string - Human-readable name",
67
+ "started_at": "string - ISO timestamp",
68
+ "started_by": "string - AI platform that started",
69
+ "priority": "string - low/medium/high",
70
+ "progress": "number - 0-100 percentage",
71
+ "phase": "string - planning/design/implementation/testing/review"
72
+ }
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,51 @@
1
+ # Recent Changes - Template Reference
2
+
3
+ > This is the FORMAT REFERENCE for `_recent.md`.
4
+ > AI should read this template when creating/updating `_recent.md`.
5
+ > DO NOT modify this file - it gets updated with ProAgents upgrades.
6
+
7
+ ---
8
+
9
+ ## Expected Structure
10
+
11
+ ```markdown
12
+ # Recent Changes
13
+
14
+ > Last 10 changes across all features/modules.
15
+ > Auto-updated by AI after each code change.
16
+
17
+ ---
18
+
19
+ ## Latest Changes
20
+
21
+ ### YYYY-MM-DD - [Change Type]
22
+ **Module:** [auto-detected from file path]
23
+ **AI:** [Platform] ([model])
24
+ **Files:** path/to/file.ts (+lines, -lines)
25
+ **Summary:** Brief description of change
26
+
27
+ ---
28
+ ```
29
+
30
+ ## Entry Format
31
+
32
+ Each entry should include:
33
+
34
+ | Field | Description | Example |
35
+ |-------|-------------|---------|
36
+ | Date | ISO format | `2024-03-13` |
37
+ | Change Type | bug-fix, feature, refactor, docs | `bug-fix` |
38
+ | Module | Auto-detected from path | `auth`, `api`, `ui` |
39
+ | AI | Platform and model | `Claude (opus-4)` |
40
+ | Files | Changed files with line counts | `src/auth.ts (+15, -3)` |
41
+ | Summary | Brief description | `Fixed login timeout issue` |
42
+
43
+ ## Auto-Update Rules
44
+
45
+ 1. **Prepend** new entries (newest first)
46
+ 2. **Keep only last 10** entries
47
+ 3. **Auto-detect module** from file path:
48
+ - `src/api/*` → api
49
+ - `src/auth/*` → auth
50
+ - `src/components/*` → ui
51
+ 4. **Update after every file edit**
@@ -0,0 +1,82 @@
1
+ # Current Project Context - Template Reference
2
+
3
+ > This is the FORMAT REFERENCE for `_context.md`.
4
+ > AI should read this template when creating/updating `_context.md`.
5
+ > DO NOT modify this file - it gets updated with ProAgents upgrades.
6
+
7
+ ---
8
+
9
+ ## Expected Structure
10
+
11
+ ```markdown
12
+ # Current Project Context
13
+
14
+ > **For AI Assistants:** Read this file first to understand current state.
15
+ > **Auto-updated** after each code change.
16
+
17
+ Last Updated: [ISO timestamp]
18
+ Last AI: [Platform (model)]
19
+
20
+ ---
21
+
22
+ ## Quick Summary
23
+ <!-- AI auto-generates - keep under 5 lines -->
24
+ ```
25
+ Last: [Last action]
26
+ Active: [Feature name or "No active features"]
27
+ Pending: [N] tasks
28
+ Tests: [Passing/Failing/Unknown]
29
+ Status: [Current status]
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Test Status
35
+ <!-- AI updates after running tests -->
36
+ ```
37
+ Status: [Passing/Failing/Unknown]
38
+ Last Run: [Timestamp]
39
+ Failing: [Test names or "None"]
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Feature Progress
45
+ <!-- AI auto-calculates -->
46
+ ```
47
+ [Feature name]: [X]% ([done]/[total] tasks)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Active Work
53
+ [Current active features or tasks]
54
+
55
+ ---
56
+
57
+ ## Recent Changes
58
+ [Last 3-5 changes]
59
+
60
+ ---
61
+
62
+ ## Pending Items
63
+ [Outstanding tasks]
64
+
65
+ ---
66
+
67
+ ## Quick Stats
68
+ | Metric | Value |
69
+ |--------|-------|
70
+ | Active Features | [N] |
71
+ | Completed Today | [N] |
72
+ | Open Issues | [N] |
73
+ ```
74
+
75
+ ## Auto-Update Rules
76
+
77
+ 1. **Update `Last Updated`** with current timestamp
78
+ 2. **Update `Last AI`** with current platform
79
+ 3. **Keep Quick Summary under 5 lines**
80
+ 4. **Update Test Status after test runs**
81
+ 5. **Update Recent Changes with last 3-5 items**
82
+ 6. **Calculate Feature Progress from active-features/**
@@ -0,0 +1,54 @@
1
+ {
2
+ "_template_info": {
3
+ "description": "Template reference for ai-stats.json schema",
4
+ "note": "DO NOT modify this file - it gets updated with ProAgents upgrades",
5
+ "usage": "AI reads this to understand expected schema for ai-stats.json"
6
+ },
7
+
8
+ "ai_platforms": {
9
+ "claude": {
10
+ "sessions": 0,
11
+ "tasks_completed": 0,
12
+ "files_modified": 0,
13
+ "reverts": 0,
14
+ "avg_session_minutes": 0,
15
+ "last_session": "2024-03-13T10:30:00Z"
16
+ },
17
+ "chatgpt": {
18
+ "sessions": 0,
19
+ "tasks_completed": 0,
20
+ "files_modified": 0,
21
+ "reverts": 0,
22
+ "avg_session_minutes": 0,
23
+ "last_session": null
24
+ }
25
+ },
26
+
27
+ "totals": {
28
+ "total_sessions": 0,
29
+ "total_tasks": 0,
30
+ "total_files_modified": 0,
31
+ "total_reverts": 0
32
+ },
33
+
34
+ "_schema": {
35
+ "ai_platforms": {
36
+ "type": "object",
37
+ "description": "Stats per AI platform",
38
+ "properties": {
39
+ "[platform_id]": {
40
+ "sessions": "number - Total sessions by this AI",
41
+ "tasks_completed": "number - Tasks completed",
42
+ "files_modified": "number - Files modified",
43
+ "reverts": "number - Changes reverted by user",
44
+ "avg_session_minutes": "number - Average session duration",
45
+ "last_session": "string|null - ISO timestamp of last session"
46
+ }
47
+ }
48
+ },
49
+ "totals": {
50
+ "type": "object",
51
+ "description": "Aggregated totals across all AIs"
52
+ }
53
+ }
54
+ }
@@ -24,13 +24,19 @@ export const AI_PLATFORMS = {
24
24
  web: {
25
25
  label: 'Web-based AI Platforms',
26
26
  platforms: [
27
- { id: 'chatgpt', name: 'ChatGPT / Codex', file: 'CHATGPT.md', desc: 'OpenAI ChatGPT' },
27
+ { id: 'chatgpt', name: 'ChatGPT', file: 'CHATGPT.md', desc: 'OpenAI ChatGPT' },
28
28
  { id: 'gemini', name: 'Gemini', file: 'GEMINI.md', desc: 'Google Gemini' },
29
29
  { id: 'replit', name: 'Replit AI', file: 'REPLIT.md', desc: 'Replit Ghostwriter' },
30
30
  { id: 'bolt', name: 'Bolt.new', file: 'BOLT.md', desc: 'StackBlitz Bolt' },
31
31
  { id: 'lovable', name: 'Lovable', file: 'LOVABLE.md', desc: 'Lovable (GPT Engineer)' },
32
32
  { id: 'groq', name: 'Groq', file: 'GROQ.md', desc: 'Groq fast inference' },
33
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
+ ]
34
40
  }
35
41
  };
36
42
 
@@ -39,6 +45,7 @@ export function getAllPlatforms() {
39
45
  return [
40
46
  ...AI_PLATFORMS.ide.platforms,
41
47
  ...AI_PLATFORMS.web.platforms,
48
+ ...AI_PLATFORMS.cli.platforms,
42
49
  ];
43
50
  }
44
51
 
@@ -47,6 +54,39 @@ export function getPlatformById(id) {
47
54
  return getAllPlatforms().find(p => p.id === id);
48
55
  }
49
56
 
57
+ /**
58
+ * Detect current IDE from environment variables
59
+ * Returns platform ID if detected and it's in our AI_PLATFORMS config, null otherwise
60
+ * Note: VS Code is NOT an AI platform, so we skip it even if detected
61
+ */
62
+ export function detectIDE() {
63
+ // Cursor IDE - check for Cursor-specific env vars
64
+ if (process.env.CURSOR_TRACE_ID || process.env.CURSOR_CHANNEL || process.env.CURSOR_SESSION_ID) {
65
+ return 'cursor';
66
+ }
67
+
68
+ // Windsurf IDE - Codeium's IDE
69
+ if (process.env.WINDSURF_SESSION_ID || process.env.CODEIUM_API_KEY ||
70
+ (process.env.TERM_PROGRAM && process.env.TERM_PROGRAM.toLowerCase().includes('windsurf'))) {
71
+ return 'windsurf';
72
+ }
73
+
74
+ // AWS Kiro IDE
75
+ if (process.env.KIRO_SESSION || process.env.KIRO_API_KEY ||
76
+ (process.env.TERM_PROGRAM && process.env.TERM_PROGRAM.toLowerCase().includes('kiro'))) {
77
+ return 'kiro';
78
+ }
79
+
80
+ // VS Code - NOT an AI platform, explicitly return null
81
+ // This prevents accidental detection as we don't want to create files for plain VS Code
82
+ if (process.env.TERM_PROGRAM === 'vscode' || process.env.VSCODE_GIT_IPC_HANDLE) {
83
+ return null;
84
+ }
85
+
86
+ // No AI-powered IDE detected
87
+ return null;
88
+ }
89
+
50
90
  /**
51
91
  * Interactive platform selection using readline
52
92
  * @param {string[]} previouslySelected - Previously selected platforms (from interrupted setup)
@@ -59,6 +99,21 @@ export async function selectPlatforms(previouslySelected = []) {
59
99
 
60
100
  const question = (prompt) => new Promise(resolve => rl.question(prompt, resolve));
61
101
 
102
+ // Auto-detect IDE and pre-select it
103
+ const detectedIDE = detectIDE();
104
+ let autoSelected = [];
105
+
106
+ if (detectedIDE) {
107
+ const platform = getPlatformById(detectedIDE);
108
+ if (platform) {
109
+ console.log(chalk.green(`\n✓ Detected ${platform.name} IDE - auto-selected`));
110
+ autoSelected = [detectedIDE];
111
+ }
112
+ }
113
+
114
+ // Merge auto-detected with previously selected
115
+ const preselected = [...new Set([...autoSelected, ...(previouslySelected || [])])];
116
+
62
117
  console.log('\n' + chalk.bold('Which AI platform(s) do you use?'));
63
118
  console.log(chalk.gray('(Enter numbers separated by commas, or "all" for all platforms)\n'));
64
119
 
@@ -69,11 +124,18 @@ export async function selectPlatforms(previouslySelected = []) {
69
124
  // IDE-based platforms
70
125
  console.log(chalk.cyan.bold(` ${AI_PLATFORMS.ide.label}:`));
71
126
  for (const platform of AI_PLATFORMS.ide.platforms) {
72
- const wasSelected = previouslySelected && previouslySelected.includes(platform.id);
73
- const marker = wasSelected ? chalk.green(' ✓ (previously selected)') : '';
127
+ const isAutoDetected = autoSelected.includes(platform.id);
128
+ const wasPreviouslySelected = previouslySelected && previouslySelected.includes(platform.id);
129
+ const isPreselected = preselected.includes(platform.id);
130
+ let marker = '';
131
+ if (isAutoDetected) {
132
+ marker = chalk.green(' ✓ (auto-detected)');
133
+ } else if (wasPreviouslySelected) {
134
+ marker = chalk.green(' ✓ (previously selected)');
135
+ }
74
136
  console.log(chalk.white(` ${index}. ${platform.name}`) + chalk.gray(` - ${platform.desc}`) + marker);
75
137
  indexMap[index] = platform.id;
76
- if (wasSelected) preSelectedIndices.push(index);
138
+ if (isPreselected) preSelectedIndices.push(index);
77
139
  index++;
78
140
  }
79
141
 
@@ -82,27 +144,42 @@ export async function selectPlatforms(previouslySelected = []) {
82
144
  // Web-based platforms
83
145
  console.log(chalk.cyan.bold(` ${AI_PLATFORMS.web.label}:`));
84
146
  for (const platform of AI_PLATFORMS.web.platforms) {
85
- const wasSelected = previouslySelected && previouslySelected.includes(platform.id);
86
- const marker = wasSelected ? chalk.green(' ✓ (previously selected)') : '';
147
+ const wasPreviouslySelected = previouslySelected && previouslySelected.includes(platform.id);
148
+ const isPreselected = preselected.includes(platform.id);
149
+ const marker = wasPreviouslySelected ? chalk.green(' ✓ (previously selected)') : '';
87
150
  console.log(chalk.white(` ${index}. ${platform.name}`) + chalk.gray(` - ${platform.desc}`) + marker);
88
151
  indexMap[index] = platform.id;
89
- if (wasSelected) preSelectedIndices.push(index);
152
+ if (isPreselected) preSelectedIndices.push(index);
90
153
  index++;
91
154
  }
92
155
 
93
156
  console.log('');
94
157
 
95
- // Show default based on previous selection
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
+ // Show default based on preselected (auto-detected + previously selected)
96
173
  const defaultHint = preSelectedIndices.length > 0
97
- ? `Enter for previous: ${preSelectedIndices.join(',')}`
174
+ ? `Enter for selected: ${preSelectedIndices.join(',')}`
98
175
  : 'e.g., 1,2,3 or "all"';
99
176
 
100
177
  const answer = await question(chalk.yellow(`Your selection (${defaultHint}): `));
101
178
  rl.close();
102
179
 
103
- // If user just pressed enter and we have previous selections, use them
180
+ // If user just pressed enter and we have preselected platforms, use them
104
181
  if (answer.trim() === '' && preSelectedIndices.length > 0) {
105
- return previouslySelected;
182
+ return preselected;
106
183
  }
107
184
 
108
185
  if (answer.toLowerCase() === 'all') {
@@ -387,6 +464,21 @@ export function showAvailablePlatforms(currentIds) {
387
464
  index++;
388
465
  }
389
466
 
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
+
390
482
  return available;
391
483
  }
392
484
 
@@ -16,8 +16,131 @@ const PRESERVE_PATHS = [
16
16
  'cache', // Cached analysis
17
17
  'changelog', // Change history (user data)
18
18
  'worklog', // Work context (user data)
19
+ 'sessions', // Session data
20
+ 'backups', // User backups
19
21
  ];
20
22
 
23
+ // Files within PRESERVE_PATHS that should always be UPDATED (framework files)
24
+ // These patterns match files that should be overwritten with latest framework version
25
+ const UPDATE_WITHIN_PRESERVED = [
26
+ 'README.md', // Documentation
27
+ 'entry-template.md', // Changelog entry template
28
+ '*.template.md', // All template markdown files
29
+ '*.template.json', // All template JSON files
30
+ 'schemas', // Schema folders
31
+ ];
32
+
33
+ /**
34
+ * Backup user data before fresh install
35
+ * Returns object mapping path to temp backup location
36
+ */
37
+ function backupUserData(proagentsDir) {
38
+ const preserved = {};
39
+ for (const path of PRESERVE_PATHS) {
40
+ const fullPath = join(proagentsDir, path);
41
+ if (existsSync(fullPath)) {
42
+ const tempPath = join(proagentsDir, '..', `.proagents-backup-${path.replace(/\//g, '-')}`);
43
+ try {
44
+ cpSync(fullPath, tempPath, { recursive: true });
45
+ preserved[path] = tempPath;
46
+ } catch (err) {
47
+ // Silently continue if backup fails
48
+ }
49
+ }
50
+ }
51
+ return preserved;
52
+ }
53
+
54
+ /**
55
+ * Restore user data after fresh install
56
+ */
57
+ function restoreUserData(proagentsDir, preserved) {
58
+ for (const [path, tempPath] of Object.entries(preserved)) {
59
+ const fullPath = join(proagentsDir, path);
60
+ if (existsSync(tempPath)) {
61
+ try {
62
+ // Remove the framework's empty/default version
63
+ if (existsSync(fullPath)) {
64
+ rmSync(fullPath, { recursive: true, force: true });
65
+ }
66
+ // Restore user's data
67
+ cpSync(tempPath, fullPath, { recursive: true });
68
+ // Clean up temp backup
69
+ rmSync(tempPath, { recursive: true, force: true });
70
+ } catch (err) {
71
+ // Silently continue if restore fails
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Update framework files within preserved paths
79
+ * After restoring user data, this copies framework files like README.md, *.template.*, schemas/
80
+ */
81
+ function updateFrameworkInPreserved(sourceDir, proagentsDir) {
82
+ for (const preservedPath of PRESERVE_PATHS) {
83
+ const sourcePath = join(sourceDir, preservedPath);
84
+ const targetPath = join(proagentsDir, preservedPath);
85
+
86
+ if (!existsSync(sourcePath) || !existsSync(targetPath)) continue;
87
+
88
+ try {
89
+ // Update README.md if exists
90
+ const sourceReadme = join(sourcePath, 'README.md');
91
+ const targetReadme = join(targetPath, 'README.md');
92
+ if (existsSync(sourceReadme)) {
93
+ cpSync(sourceReadme, targetReadme, { force: true });
94
+ }
95
+
96
+ // Update entry-template.md (for changelog)
97
+ const sourceEntryTemplate = join(sourcePath, 'entry-template.md');
98
+ const targetEntryTemplate = join(targetPath, 'entry-template.md');
99
+ if (existsSync(sourceEntryTemplate)) {
100
+ cpSync(sourceEntryTemplate, targetEntryTemplate, { force: true });
101
+ }
102
+
103
+ // Update schemas folder if exists
104
+ const sourceSchemas = join(sourcePath, 'schemas');
105
+ const targetSchemas = join(targetPath, 'schemas');
106
+ if (existsSync(sourceSchemas)) {
107
+ if (existsSync(targetSchemas)) {
108
+ rmSync(targetSchemas, { recursive: true, force: true });
109
+ }
110
+ cpSync(sourceSchemas, targetSchemas, { recursive: true });
111
+ }
112
+
113
+ // Update all *.template.md and *.template.json files
114
+ if (existsSync(sourcePath)) {
115
+ const entries = readdirSync(sourcePath, { withFileTypes: true });
116
+ for (const entry of entries) {
117
+ if (entry.isFile() && (entry.name.endsWith('.template.md') || entry.name.endsWith('.template.json'))) {
118
+ cpSync(join(sourcePath, entry.name), join(targetPath, entry.name), { force: true });
119
+ }
120
+ // Also check subdirectories (like .learning/global/)
121
+ if (entry.isDirectory()) {
122
+ const subPath = join(sourcePath, entry.name);
123
+ const subTargetPath = join(targetPath, entry.name);
124
+ if (existsSync(subPath)) {
125
+ const subEntries = readdirSync(subPath, { withFileTypes: true });
126
+ for (const subEntry of subEntries) {
127
+ if (subEntry.isFile() && (subEntry.name.endsWith('.template.md') || subEntry.name.endsWith('.template.json'))) {
128
+ if (!existsSync(subTargetPath)) {
129
+ mkdirSync(subTargetPath, { recursive: true });
130
+ }
131
+ cpSync(join(subPath, subEntry.name), join(subTargetPath, subEntry.name), { force: true });
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ } catch (err) {
139
+ // Silently continue if update fails
140
+ }
141
+ }
142
+ }
143
+
21
144
  // Config file is handled specially - merged not preserved
22
145
  const CONFIG_FILE = 'proagents.config.yaml';
23
146
 
@@ -90,6 +213,7 @@ const FRAMEWORK_FILES = [
90
213
  'GETTING-STARTED-STORY.md',
91
214
  'slash-commands.json',
92
215
  'AI_INSTRUCTIONS.md', // Universal instructions kept for reference
216
+ 'AGENTS.md', // Universal AI instruction file (works with most AI platforms)
93
217
  ];
94
218
 
95
219
  // Project type definitions for detection
@@ -611,7 +735,7 @@ function checkIncompleteSetup(targetDir) {
611
735
  }
612
736
 
613
737
  // Check 2: No AI instruction files at all = incomplete
614
- const aiFiles = ['CLAUDE.md', '.cursorrules', '.windsurfrules', 'CHATGPT.md', 'GEMINI.md'];
738
+ const aiFiles = ['AGENTS.md', 'CLAUDE.md', '.cursorrules', '.windsurfrules', 'CHATGPT.md', 'GEMINI.md'];
615
739
  const hasAnyAiFile = aiFiles.some(f => existsSync(join(targetDir, f)));
616
740
  if (!hasAnyAiFile) {
617
741
  return true;
@@ -667,6 +791,27 @@ async function promptIncompleteSetupChoice() {
667
791
  return 'continue';
668
792
  }
669
793
 
794
+ /**
795
+ * Confirm destructive "Restart fresh" action
796
+ */
797
+ async function confirmRestartFresh() {
798
+ const rl = createInterface({
799
+ input: process.stdin,
800
+ output: process.stdout
801
+ });
802
+
803
+ const question = (prompt) => new Promise(resolve => rl.question(prompt, resolve));
804
+
805
+ console.log(chalk.red.bold('\n⚠️ WARNING: This will DELETE all data in .proagents/'));
806
+ console.log(chalk.yellow(' Including: changelog, worklog, sessions, learning data, etc.'));
807
+ console.log(chalk.gray(' This action cannot be undone.\n'));
808
+
809
+ const answer = await question(chalk.red('Type "DELETE" to confirm, or press Enter to cancel: '));
810
+ rl.close();
811
+
812
+ return answer.trim().toUpperCase() === 'DELETE';
813
+ }
814
+
670
815
  /**
671
816
  * Prompt user for .gitignore preference
672
817
  */
@@ -981,6 +1126,12 @@ export async function initCommand(options = {}) {
981
1126
  console.log(chalk.cyan('\nContinuing setup...\n'));
982
1127
  // Fall through to fresh install (but keep .proagents folder)
983
1128
  } else if (choice === 'restart') {
1129
+ // Confirm destructive action
1130
+ const confirmed = await confirmRestartFresh();
1131
+ if (!confirmed) {
1132
+ console.log(chalk.yellow('\nCancelled. No changes made.\n'));
1133
+ return;
1134
+ }
984
1135
  console.log(chalk.cyan('\nRestarting fresh setup...\n'));
985
1136
  rmSync(proagentsDir, { recursive: true, force: true });
986
1137
  // Fall through to fresh install
@@ -1026,7 +1177,21 @@ export async function initCommand(options = {}) {
1026
1177
 
1027
1178
  // Fresh install or force overwrite
1028
1179
  console.log(chalk.gray('Copying framework files...'));
1180
+
1181
+ // Backup user data if .proagents exists (to preserve changelog, worklog, etc.)
1182
+ const userDataBackup = existsSync(proagentsDir) ? backupUserData(proagentsDir) : {};
1183
+
1029
1184
  cpSync(sourceDir, proagentsDir, { recursive: true, force: true });
1185
+
1186
+ // Restore user data after framework copy
1187
+ if (Object.keys(userDataBackup).length > 0) {
1188
+ restoreUserData(proagentsDir, userDataBackup);
1189
+ // Update framework files within preserved paths (README.md, templates, schemas)
1190
+ updateFrameworkInPreserved(sourceDir, proagentsDir);
1191
+ console.log(chalk.green('✓ Preserved user data (changelog, worklog, sessions, etc.)'));
1192
+ console.log(chalk.green('✓ Updated templates and documentation in preserved folders'));
1193
+ }
1194
+
1030
1195
  console.log(chalk.green('✓ Framework files copied to ./.proagents/'));
1031
1196
 
1032
1197
  // Create config if not skipped
@@ -1398,6 +1563,9 @@ async function smartUpdate(sourceDir, targetDir) {
1398
1563
  }
1399
1564
  }
1400
1565
 
1566
+ // Update framework files within preserved paths (templates, README, schemas)
1567
+ updateFrameworkInPreserved(sourceDir, targetDir);
1568
+
1401
1569
  console.log(chalk.gray('\nTip: Use "proagents ai add" to add more AI platforms'));
1402
1570
  }
1403
1571
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proagents",
3
- "version": "1.6.13",
3
+ "version": "1.6.15",
4
4
  "description": "AI-agnostic development workflow framework that automates the full software development lifecycle",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",