prjct-cli 0.5.0 → 0.6.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +169 -1
  2. package/CLAUDE.md +43 -28
  3. package/README.md +4 -4
  4. package/bin/prjct +78 -63
  5. package/core/agent-generator.js +19 -10
  6. package/core/ascii-graphics.js +433 -0
  7. package/core/command-registry.js +553 -0
  8. package/core/commands.js +274 -62
  9. package/core/task-schema.js +342 -0
  10. package/package.json +4 -3
  11. package/templates/agents/AGENTS.md +79 -101
  12. package/templates/agents/be.template.md +14 -29
  13. package/templates/agents/coordinator.template.md +34 -0
  14. package/templates/agents/data.template.md +14 -28
  15. package/templates/agents/devops.template.md +14 -28
  16. package/templates/agents/fe.template.md +14 -29
  17. package/templates/agents/mobile.template.md +14 -28
  18. package/templates/agents/qa.template.md +14 -41
  19. package/templates/agents/scribe.template.md +15 -81
  20. package/templates/agents/security.template.md +14 -28
  21. package/templates/agents/ux.template.md +14 -36
  22. package/templates/commands/analyze.md +36 -239
  23. package/templates/commands/build.md +41 -0
  24. package/templates/commands/cleanup.md +24 -87
  25. package/templates/commands/context.md +24 -93
  26. package/templates/commands/design.md +20 -98
  27. package/templates/commands/done.md +16 -181
  28. package/templates/commands/fix.md +27 -66
  29. package/templates/commands/git.md +33 -60
  30. package/templates/commands/help.md +18 -52
  31. package/templates/commands/idea.md +11 -36
  32. package/templates/commands/init.md +30 -277
  33. package/templates/commands/next.md +20 -62
  34. package/templates/commands/now.md +18 -22
  35. package/templates/commands/progress.md +23 -78
  36. package/templates/commands/recap.md +22 -74
  37. package/templates/commands/roadmap.md +21 -90
  38. package/templates/commands/ship.md +26 -161
  39. package/templates/commands/status.md +40 -0
  40. package/templates/commands/stuck.md +21 -33
  41. package/templates/commands/sync.md +19 -209
  42. package/templates/commands/task.md +18 -80
  43. package/templates/commands/test.md +23 -72
  44. package/templates/commands/workflow.md +20 -212
  45. package/templates/agents/pm.template.md +0 -84
@@ -1,220 +1,30 @@
1
1
  ---
2
- allowed-tools: [Read, Write, Bash, Glob, Grep, TodoWrite]
3
- description: "Sync project state and update AI agents based on latest analysis"
2
+ allowed-tools: [Read, Bash, TodoWrite]
3
+ description: "Sync project state and agents"
4
4
  ---
5
5
 
6
- # /p:sync - Sync Project State
6
+ # /p:sync
7
7
 
8
- ## Purpose
9
- Re-analyze the project and update all AI agents with current project state, stack changes, and new requirements.
8
+ ## Flow
9
+ 1. Run: `/p:analyze` get current state
10
+ 2. Compare: with previous analysis
11
+ 3. Update: all existing agents with new context
12
+ 4. Add: newly required agents
13
+ 5. Remove: obsolete agents (with confirmation)
14
+ 6. Log: changes to `memory/context.jsonl`
10
15
 
11
- ## Global Architecture
12
- This command uses the global prjct architecture:
13
- - Data stored in: `~/.prjct-cli/projects/{id}/`
14
- - Config stored in: `{project}/.prjct/prjct.config.json`
15
- - Agents updated in: `~/.claude/agents/`
16
-
17
- ## Usage
18
- ```
19
- /p:sync
20
- ```
21
-
22
- ## When to Run
23
- - After major dependency changes
24
- - When adding new frameworks or tools
25
- - After significant architecture changes
26
- - When project type changes (e.g., adding mobile support)
27
- - Periodically to keep agents up-to-date
28
-
29
- ## Execution Flow
30
-
31
- ### 1. Re-run Project Analysis
32
-
33
- Execute `/p:analyze` to get current project state:
34
- ```javascript
35
- // This will:
36
- // 1. Scan all files and directories
37
- // 2. Detect current stack and frameworks
38
- // 3. Check git status
39
- // 4. Compare with previous analysis
40
- // 5. Identify what changed
41
- ```
42
-
43
- ### 2. Detect Changes
44
-
45
- Compare new analysis with previous:
46
- ```javascript
47
- const previousAnalysis = await readFile('.prjct/analysis/repo-summary.md')
48
- const currentAnalysis = await runAnalyze()
49
-
50
- const changes = {
51
- newDependencies: [],
52
- removedDependencies: [],
53
- newFrameworks: [],
54
- stackChanges: [],
55
- structureChanges: []
56
- }
57
-
58
- // Detect what changed
59
- if (currentAnalysis.frameworks !== previousAnalysis.frameworks) {
60
- changes.newFrameworks = difference(current, previous)
61
- }
62
- ```
63
-
64
- ### 3. Update Existing Agents
65
-
66
- Regenerate all current agents with new context:
67
- ```javascript
68
- const agentGenerator = require('../core/agent-generator')
69
-
70
- // Update all existing agents
71
- const updated = await agentGenerator.updateExistingAgents(currentAnalysis)
72
-
73
- console.log(`↻ Updated ${updated.length} agents with new context`)
74
- ```
75
-
76
- ### 4. Add New Agents
77
-
78
- Generate any newly required agents:
79
- ```javascript
80
- // Detect newly required agents
81
- const existingAgents = await listAgentFiles()
82
- const requiredAgents = detectRequiredAgents(currentAnalysis)
83
- const newAgents = requiredAgents.filter(a => !existingAgents.includes(a))
84
-
85
- if (newAgents.length > 0) {
86
- for (const agentType of newAgents) {
87
- await agentGenerator.generateAgent(agentType, currentAnalysis)
88
- console.log(`✅ Added ${agentType} agent`)
89
- }
90
- }
16
+ ## Response
91
17
  ```
18
+ 🔄 Sync complete!
92
19
 
93
- ### 5. Remove Obsolete Agents (Optional)
94
-
95
- Ask user if agents should be removed:
96
- ```javascript
97
- const obsoleteAgents = existingAgents.filter(a => !requiredAgents.includes(a))
98
-
99
- if (obsoleteAgents.length > 0) {
100
- console.log(`\n⚠️ The following agents may no longer be needed:`)
101
- obsoleteAgents.forEach(a => console.log(` - ${a}`))
102
-
103
- const shouldRemove = await confirmWithUser('\nRemove these agents? (y/n): ')
104
-
105
- if (shouldRemove) {
106
- await agentGenerator.cleanupObsoleteAgents(requiredAgents)
107
- }
108
- }
109
- ```
110
-
111
- ### 6. Update Analysis File
112
-
113
- Save new analysis:
114
- ```bash
115
- # Backup previous analysis
116
- cp .prjct/analysis/repo-summary.md .prjct/analysis/repo-summary.backup.md
117
-
118
- # Save new analysis
119
- # (already saved by /p:analyze)
120
- ```
20
+ 📊 Changes:
21
+ • {N} agents updated
22
+ {N} agents added
23
+ • {N} agents removed
121
24
 
122
- ### 7. Update Memory Log
25
+ Stack changes:
26
+ • {changes_list}
123
27
 
124
- Log sync action:
125
- ```jsonl
126
- {"timestamp":"2025-10-02T14:30:00Z","action":"sync","author":"Name","changes":{"addedAgents":["mobile"],"updatedAgents":["fe","be"],"removedAgents":[],"stackChanges":["added react-native"]}}
28
+ /p:status | /p:context
127
29
  ```
128
30
 
129
- ## Output Examples
130
-
131
- ### No Changes
132
- ```
133
- 🔄 Syncing project state...
134
-
135
- 📊 Analysis Complete
136
- No significant changes detected
137
-
138
- 🤖 Agents Status
139
- ✓ All 7 agents are up-to-date
140
-
141
- ✅ Sync complete! Everything is current.
142
- ```
143
-
144
- ### With Changes
145
- ```
146
- 🔄 Syncing project state...
147
-
148
- 📊 Changes Detected
149
- ✅ New dependency: @tanstack/react-query
150
- ✅ New framework: Expo (React Native)
151
- ℹ️ Architecture: Still feature-based
152
-
153
- 🤖 Agent Updates
154
- ↻ FE agent - Added React Query patterns
155
- ↻ BE agent - Updated API integration context
156
- ✅ Mobile agent - ADDED (React Native detected)
157
- ✓ Other agents - No changes needed
158
-
159
- ⚠️ Obsolete Agents
160
- - devops (Docker removed from project)
161
-
162
- Remove obsolete agents? (y/n): _
163
-
164
- ✅ Sync complete!
165
- - 2 agents updated
166
- - 1 agent added
167
- - 1 agent removed
168
- ```
169
-
170
- ### Stack Migration
171
- ```
172
- 🔄 Syncing project state...
173
-
174
- 📊 Major Changes Detected
175
- ⚠️ Framework changed: Vue → React
176
- ⚠️ Build tool changed: Webpack → Vite
177
- ✅ New: TypeScript added
178
-
179
- 🤖 Full Agent Regeneration
180
- ↻ PM - Updated with React patterns
181
- ↻ UX - Updated component guidelines
182
- ↻ FE - COMPLETELY REGENERATED for React + TS
183
- ↻ BE - Updated API patterns
184
- ↻ QA - Updated test framework context
185
- ↻ Scribe - Updated documentation style
186
-
187
- ✅ Sync complete! All agents updated for new stack.
188
-
189
- 💡 Tip: Review agent descriptions to see new capabilities.
190
- ```
191
-
192
- ## Error Handling
193
-
194
- - **No .prjct/**: Error - Project not initialized, run `/p:init` first
195
- - **No analysis file**: Warning - Running first-time analysis
196
- - **Agent generation fails**: Warn but continue with others
197
- - **Permission issues**: Suggest checking `~/.claude/agents/` permissions
198
-
199
- ## Notes
200
-
201
- - Sync is safe to run anytime
202
- - Existing agents are updated, not deleted (unless confirmed)
203
- - Git status is refreshed during sync
204
- - Analysis diff helps track project evolution
205
- - Agents get project-specific context from analysis
206
-
207
- ## Related Commands
208
-
209
- - `/p:analyze` - Just analyze without updating agents
210
- - `/p:init` - Initialize project (first-time setup)
211
- - `/p:context` - View current project context
212
-
213
- ## Implementation Notes
214
-
215
- The sync command should:
216
- 1. Be idempotent (safe to run multiple times)
217
- 2. Preserve manual agent customizations (warn if detected)
218
- 3. Create backups before major changes
219
- 4. Provide clear diff of what changed
220
- 5. Allow granular control (which agents to update)
@@ -1,97 +1,35 @@
1
1
  ---
2
- allowed-tools: [Read, Write, Edit, TodoWrite, Bash, Glob]
3
- description: "Break down and execute complex tasks systematically"
2
+ allowed-tools: [Read, Write, TodoWrite]
3
+ description: "Break down complex tasks"
4
4
  ---
5
5
 
6
- ## Global Architecture
7
- This command uses the global prjct architecture:
8
- - Data stored in: `~/.prjct-cli/projects/{id}/`
9
- - Config stored in: `{project}/.prjct/prjct.config.json`
10
- - Commands synchronized across all editors
11
-
12
-
13
-
14
- # /p:task - Complex Task Execution
15
-
16
- ## Purpose
17
- Handle complex features by breaking them down, executing systematically, and tracking progress. No overwhelm.
6
+ # /p:task
18
7
 
19
8
  ## Usage
20
9
  ```
21
10
  /p:task <description>
22
11
  ```
23
12
 
24
- ## Execution
25
- 1. Analyze task complexity
26
- 2. Break into 3-7 subtasks automatically
27
- 3. Create execution plan in `.prjct/planning/tasks/`
28
- 4. Execute each subtask with validation
29
- 5. Track progress and update metrics
30
-
31
- ## Implementation
13
+ ## Flow
14
+ 1. Analyze: task complexity
15
+ 2. Break down: into 3-7 subtasks
16
+ 3. Create: execution plan
17
+ 4. Execute: each subtask with validation
18
+ 5. Track: progress in `planning/tasks/`
32
19
 
33
- **Task breakdown**:
34
- - Identify main components needed
35
- - Order by dependencies
36
- - Estimate time for each
37
- - Create actionable subtasks
38
-
39
- **Example breakdown**:
20
+ ## Response
40
21
  ```
41
- /p:task "implement user authentication"
42
-
43
- 📋 Task Plan Created:
44
-
45
- 1. Database schema (15 min)
46
- - User table with email/password
47
- - Sessions table
48
-
49
- 2. Auth middleware (30 min)
50
- - JWT token generation
51
- - Route protection
22
+ 📋 Task Plan: {description}
52
23
 
53
- 3. API endpoints (45 min)
54
- - POST /auth/signup
55
- - POST /auth/login
56
- - POST /auth/logout
24
+ Breakdown:
25
+ 1. {subtask} (~{time})
26
+ 2. {subtask} (~{time})
27
+ 3. {subtask} (~{time})
57
28
 
58
- 4. Frontend forms (30 min)
59
- - Login component
60
- - Signup component
61
-
62
- 5. Testing (20 min)
63
- - Auth flow tests
64
- - Security tests
29
+ Est total: {total_time}
65
30
 
66
31
  🚀 Starting execution...
67
- [1/5] Creating database schema... ✅
68
- [2/5] Building auth middleware... 🔄
69
- ```
70
-
71
- **Progress tracking**:
72
- - Real-time status updates
73
- - Save progress between sessions
74
- - Resume interrupted tasks
75
- - Log to `.prjct/memory/context.jsonl`
76
-
77
- **Response format**:
78
- ```
79
- ✅ Task completed: User authentication
80
-
81
- 📊 Execution Summary:
82
- • Time: 2h 15min (estimated 2h 20min)
83
- • Subtasks: 5/5 completed
84
- • Tests: All passing
85
- • Files: 12 created/modified
86
-
87
- 📝 Logged to: .prjct/planning/tasks/auth_system.md
88
-
89
- 💡 Next: /p:ship "user authentication"
32
+ [1/{N}] {subtask}... ✅
33
+ [2/{N}] {subtask}... 🔄
90
34
  ```
91
35
 
92
- ## Features
93
- - Automatic task decomposition
94
- - Progress persistence
95
- - Time tracking
96
- - Dependency management
97
- - Smart validation gates
@@ -1,94 +1,45 @@
1
1
  ---
2
- allowed-tools: [Bash, Read, Edit, Glob]
3
- description: "Run tests and auto-fix simple failures"
2
+ allowed-tools: [Bash, Read, Edit]
3
+ description: "Run tests with auto-fix"
4
4
  ---
5
5
 
6
- ## Global Architecture
7
- This command uses the global prjct architecture:
8
- - Data stored in: `~/.prjct-cli/projects/{id}/`
9
- - Config stored in: `{project}/.prjct/prjct.config.json`
10
- - Commands synchronized across all editors
11
-
12
-
13
-
14
- # /p:test - Smart Test Execution
15
-
16
- ## Purpose
17
- Run tests, show failures clearly, and auto-fix obvious issues. Ship with confidence.
6
+ # /p:test
18
7
 
19
8
  ## Usage
20
9
  ```
21
- /p:test [all|unit|e2e|failed]
22
- ```
23
-
24
- Default: all
25
-
26
- ## Execution
27
- 1. Detect test runner (jest/vitest/mocha/pytest)
28
- 2. Run tests with appropriate command
29
- 3. Parse and display results with clarity
30
- 4. Auto-fix simple test failures
31
- 5. Update `.prjct/progress/metrics.md` with coverage
32
-
33
- ## Implementation
34
-
35
- **Test detection**:
36
- ```bash
37
- # Auto-detect test command from package.json or config
38
- - npm test / npm run test
39
- - pytest / python -m pytest
40
- - go test ./...
41
- - cargo test
10
+ /p:test [all|unit|e2e|failed|fix] # Default: all
42
11
  ```
43
12
 
44
- **Auto-fixable issues**:
45
- - Snapshot updates Update automatically
46
- - Timeout errors Increase timeout
47
- - Import errors → Fix imports
48
- - Expected vs received Show diff clearly
13
+ ## Flow
14
+ 1. Detect: test runner (jest/vitest/pytest/etc)
15
+ 2. Run: tests with appropriate command
16
+ 3. Parse: results
17
+ 4. Auto-fix: simple failures (snapshots, timeouts, imports)
18
+ 5. Update: coverage in `progress/metrics.md`
49
19
 
50
- **Response format for success**:
20
+ ## Response (success)
51
21
  ```
52
22
  ✅ All tests passing!
53
23
 
54
- 📊 Test Results:
55
- • Unit: 45/45 passed
56
- • Integration: 12/12 passed
57
- • E2E: 8/8 passed
24
+ 📊 Results:
25
+ • Unit: {N}/{N}
26
+ • Integration: {N}/{N}
27
+ • E2E: {N}/{N}
58
28
 
59
- 🎯 Coverage: 87% (+2%)
60
- ⚡ Time: 4.2s
29
+ 🎯 Coverage: {X}%
30
+ ⚡ Time: {X}s
61
31
 
62
- 🚀 Ready to ship!
32
+ /p:ship
63
33
  ```
64
34
 
65
- **Response format for failures**:
35
+ ## Response (failures)
66
36
  ```
67
- 3 tests failing
37
+ {N} tests failing
68
38
 
69
- 1️⃣ UserService.test.js:
70
- Expected: "John Doe"
71
- Received: "John"
39
+ {failure_details}
72
40
 
73
- 💡 Auto-fix available: /p:test fix
41
+ 💡 Auto-fix: /p:test fix
74
42
 
75
- 2️⃣ auth.e2e.js:
76
- Timeout after 5000ms
77
-
78
- 💡 Increasing timeout to 10000ms...
79
-
80
- 📊 Summary: 62/65 passed (95%)
43
+ 📊 Summary: {passed}/{total} ({X}%)
81
44
  ```
82
45
 
83
- **Quick commands**:
84
- - `/p:test` - Run all tests
85
- - `/p:test failed` - Re-run only failed tests
86
- - `/p:test watch` - Run in watch mode
87
- - `/p:test fix` - Apply available auto-fixes
88
-
89
- ## Features
90
- - Smart failure detection
91
- - Clear error messages
92
- - Auto-fix common issues
93
- - Coverage tracking
94
- - Performance monitoring