prjct-cli 0.5.1 → 0.7.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 (81) hide show
  1. package/CHANGELOG.md +220 -7
  2. package/CLAUDE.md +476 -55
  3. package/README.md +48 -55
  4. package/bin/prjct +170 -225
  5. package/core/agentic/command-executor.js +113 -0
  6. package/core/agentic/context-builder.js +85 -0
  7. package/core/agentic/prompt-builder.js +86 -0
  8. package/core/agentic/template-loader.js +104 -0
  9. package/core/agentic/tool-registry.js +117 -0
  10. package/core/command-registry.js +597 -0
  11. package/core/commands.js +2046 -2028
  12. package/core/domain/agent-generator.js +118 -0
  13. package/core/domain/analyzer.js +211 -0
  14. package/core/domain/architect-session.js +300 -0
  15. package/core/{agents → infrastructure/agents}/claude-agent.js +16 -13
  16. package/core/{author-detector.js → infrastructure/author-detector.js} +3 -1
  17. package/core/{capability-installer.js → infrastructure/capability-installer.js} +3 -6
  18. package/core/{command-installer.js → infrastructure/command-installer.js} +4 -2
  19. package/core/{config-manager.js → infrastructure/config-manager.js} +4 -4
  20. package/core/{editors-config.js → infrastructure/editors-config.js} +2 -10
  21. package/core/{migrator.js → infrastructure/migrator.js} +34 -19
  22. package/core/{path-manager.js → infrastructure/path-manager.js} +20 -44
  23. package/core/{session-manager.js → infrastructure/session-manager.js} +45 -105
  24. package/core/{update-checker.js → infrastructure/update-checker.js} +67 -67
  25. package/core/{animations-simple.js → utils/animations.js} +3 -23
  26. package/core/utils/date-helper.js +238 -0
  27. package/core/utils/file-helper.js +327 -0
  28. package/core/utils/jsonl-helper.js +206 -0
  29. package/core/{project-capabilities.js → utils/project-capabilities.js} +21 -22
  30. package/core/utils/session-helper.js +277 -0
  31. package/core/{version.js → utils/version.js} +1 -1
  32. package/package.json +5 -12
  33. package/templates/agents/AGENTS.md +151 -99
  34. package/templates/analysis/analyze.md +84 -0
  35. package/templates/commands/analyze.md +37 -233
  36. package/templates/commands/bug.md +79 -0
  37. package/templates/commands/build.md +44 -0
  38. package/templates/commands/cleanup.md +24 -84
  39. package/templates/commands/design.md +20 -95
  40. package/templates/commands/done.md +17 -180
  41. package/templates/commands/feature.md +113 -0
  42. package/templates/commands/fix.md +58 -66
  43. package/templates/commands/git.md +35 -57
  44. package/templates/commands/help.md +18 -52
  45. package/templates/commands/idea.md +18 -34
  46. package/templates/commands/init.md +65 -257
  47. package/templates/commands/next.md +20 -60
  48. package/templates/commands/now.md +21 -23
  49. package/templates/commands/progress.md +40 -73
  50. package/templates/commands/recap.md +52 -75
  51. package/templates/commands/roadmap.md +30 -85
  52. package/templates/commands/ship.md +93 -126
  53. package/templates/commands/status.md +42 -0
  54. package/templates/commands/sync.md +19 -205
  55. package/templates/commands/task.md +19 -79
  56. package/templates/commands/test.md +25 -71
  57. package/templates/commands/workflow.md +20 -210
  58. package/core/agent-generator.js +0 -516
  59. package/core/analyzer.js +0 -600
  60. package/core/animations.js +0 -277
  61. package/core/git-integration.js +0 -401
  62. package/core/workflow-engine.js +0 -213
  63. package/core/workflow-prompts.js +0 -192
  64. package/core/workflow-rules.js +0 -147
  65. package/scripts/post-install.js +0 -121
  66. package/scripts/preuninstall.js +0 -94
  67. package/scripts/verify-installation.sh +0 -158
  68. package/templates/agents/be.template.md +0 -42
  69. package/templates/agents/data.template.md +0 -41
  70. package/templates/agents/devops.template.md +0 -41
  71. package/templates/agents/fe.template.md +0 -42
  72. package/templates/agents/mobile.template.md +0 -41
  73. package/templates/agents/pm.template.md +0 -84
  74. package/templates/agents/qa.template.md +0 -54
  75. package/templates/agents/scribe.template.md +0 -95
  76. package/templates/agents/security.template.md +0 -41
  77. package/templates/agents/ux.template.md +0 -49
  78. package/templates/commands/context.md +0 -105
  79. package/templates/commands/stuck.md +0 -48
  80. package/templates/examples/natural-language-examples.md +0 -532
  81. /package/core/{agent-detector.js → infrastructure/agent-detector.js} +0 -0
@@ -1,94 +1,48 @@
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
9
+
20
10
  ```
21
- /p:test [all|unit|e2e|failed]
11
+ /p:test [all|unit|e2e|failed|fix] # Default: all
22
12
  ```
23
13
 
24
- Default: all
14
+ ## Flow
25
15
 
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
16
+ 1. Detect: test runner (jest/vitest/pytest/etc)
17
+ 2. Run: tests with appropriate command
18
+ 3. Parse: results
19
+ 4. Auto-fix: simple failures (snapshots, timeouts, imports)
20
+ 5. Update: coverage in `progress/metrics.md`
32
21
 
33
- ## Implementation
22
+ ## Response (success)
34
23
 
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
42
- ```
43
-
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
49
-
50
- **Response format for success**:
51
24
  ```
52
25
  ✅ All tests passing!
53
26
 
54
- 📊 Test Results:
55
- • Unit: 45/45 passed
56
- • Integration: 12/12 passed
57
- • E2E: 8/8 passed
58
-
59
- 🎯 Coverage: 87% (+2%)
60
- ⚡ Time: 4.2s
27
+ 📊 Results:
28
+ • Unit: {N}/{N}
29
+ • Integration: {N}/{N}
30
+ • E2E: {N}/{N}
61
31
 
62
- 🚀 Ready to ship!
63
- ```
32
+ 🎯 Coverage: {X}%
33
+ ⚡ Time: {X}s
64
34
 
65
- **Response format for failures**:
35
+ /p:ship
66
36
  ```
67
- ❌ 3 tests failing
68
37
 
69
- 1️⃣ UserService.test.js:
70
- Expected: "John Doe"
71
- Received: "John"
38
+ ## Response (failures)
72
39
 
73
- 💡 Auto-fix available: /p:test fix
40
+ ```
41
+ ❌ {N} tests failing
74
42
 
75
- 2️⃣ auth.e2e.js:
76
- Timeout after 5000ms
43
+ {failure_details}
77
44
 
78
- 💡 Increasing timeout to 10000ms...
45
+ 💡 Auto-fix: /p:test fix
79
46
 
80
- 📊 Summary: 62/65 passed (95%)
47
+ 📊 Summary: {passed}/{total} ({X}%)
81
48
  ```
82
-
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
@@ -1,224 +1,34 @@
1
- # Workflow System for AI Assistants
1
+ ---
2
+ allowed-tools: [Read, Write]
3
+ description: 'Show workflow status'
4
+ ---
2
5
 
3
- ## Overview
4
- Interactive agent workflows that orchestrate task execution with user guidance. When capabilities are missing, the system prompts for decisions rather than auto-skipping, and tracks all installation efforts as workflow tasks.
6
+ # /p:workflow
5
7
 
6
- ## How It Works
8
+ ## Usage
7
9
 
8
- ### 1. Automatic Workflow Detection
9
- When a task is added via `/p:idea`, the system:
10
- - Classifies task type: ui, api, bug, refactor, feature
11
- - Detects project capabilities (design system, tests, docs)
12
- - Marks steps that need user prompting when capabilities are missing
13
- - Initializes workflow with all steps (required + optional with prompts)
14
-
15
- ### 2. Workflow Types
16
-
17
- **UI Component** (ui):
18
- - design (optional - needs design system)
19
- - dev (required)
20
- - test (optional - needs test framework)
21
- - docs (optional - needs docs system)
22
-
23
- **API Endpoint** (api):
24
- - dev (required)
25
- - test (optional - needs test framework)
26
- - docs (optional - needs docs system)
27
-
28
- **Bug Fix** (bug):
29
- - analyze (required)
30
- - fix (required)
31
- - test (optional - needs test framework)
32
-
33
- **Refactor** (refactor):
34
- - refactor (required)
35
- - test (optional - needs test framework)
36
-
37
- **Feature** (feature):
38
- - design (optional - needs design system)
39
- - dev (required)
40
- - test (optional - needs test framework)
41
- - docs (optional - needs docs system)
42
-
43
- ### 3. Task Classification
44
-
45
- Keywords that trigger specific workflows:
46
-
47
- **UI**: button, form, modal, card, component, menu, nav, input
48
- **API**: endpoint, api, service, route, controller
49
- **Bug**: bug, fix, error, issue, broken
50
- **Refactor**: refactor, improve, optimize, clean
51
- **Feature**: feature, functionality, module
52
-
53
- Default: ui
54
-
55
- ### 4. Capability Detection
56
-
57
- The system detects capabilities by checking:
58
-
59
- **Design System**:
60
- - Folders: design/, designs/, .storybook/
61
- - Dependencies: @storybook/react, @storybook/vue
62
- - Files: *.figma
63
-
64
- **Test Framework**:
65
- - Dependencies: jest, vitest, mocha, @jest/core
66
- - Files: *.test.*, *.spec.*
67
- - Configs: jest.config.js, vitest.config.js
68
-
69
- **Documentation**:
70
- - Folders: docs/, documentation/
71
- - Files: README.md
72
- - Dependencies: typedoc, jsdoc
73
-
74
- ### 5. Interactive Workflow Execution
75
-
76
- **When step requires missing capability:**
77
- 1. System pauses and prompts user with options:
78
- - Install recommended tool (based on stack detection)
79
- - Skip this step
80
- - Continue without capability
81
- - Pause workflow
82
-
83
- 2. If user chooses installation:
84
- - Creates installation task (e.g., "Install Jest")
85
- - Inserts task into workflow at current position
86
- - Tracks installation effort as visible task
87
- - Executes installation command
88
- - Configures tool automatically
89
- - Verifies capability is now available
90
- - Continues to original step
91
-
92
- **When `/p:done` is executed:**
93
- - Marks current step as completed
94
- - Checks if next step needs prompting
95
- - Shows prompt if capability missing
96
- - Advances to next step (or completes workflow)
97
- - Updates now.md with next step details
98
- - Assigns appropriate agent for next step
99
- - Logs progress to memory
100
-
101
- ### 6. Step Structure
102
-
103
- Each step has:
104
- - **name**: Step identifier
105
- - **agent**: Assigned AI agent specialist
106
- - **action**: What to do
107
- - **required**: Must execute (true) or optional (false)
108
- - **needs**: Required capability (if optional)
109
- - **prompt**: Should prompt user when capability missing
110
- - **needsPrompt**: Flag set when step needs user decision
111
- - **retry**: Max retry attempts (for test steps)
112
- - **type**: 'install' for dynamically inserted installation tasks
113
-
114
- ## Commands
115
-
116
- ### View Workflow Status
117
10
  ```
118
- /p:workflow
11
+ /p:workflow # Show status
12
+ /p:workflow skip # Skip current step
119
13
  ```
120
- Shows current workflow state, active step, progress.
121
14
 
122
- ### Skip Current Step
123
- ```
124
- /p:workflow skip
125
- ```
126
- Skips current optional step, moves to next.
127
-
128
- ## Example Workflows
129
-
130
- ### Full Stack (Has Everything)
131
- ```
132
- /p:idea "Create login form"
133
- → Workflow: design→dev→test→docs
134
- → Execute each step with /p:done
135
- ```
136
-
137
- ### Missing Test Framework (Interactive)
138
- ```
139
- /p:idea "Create button component"
140
- → Workflow: dev→test→docs
141
- → /p:done (completes dev)
142
-
143
- ⚠️ Missing test capability for "test" step
144
-
145
- 📋 Recommended: Vitest, Jest + Testing Library
146
- 💡 Reason: Quality assurance and regression prevention
147
-
148
- Options:
149
- 1. Install recommended (npm install -D vitest @testing-library/react)
150
- 2. Skip this step
151
- 3. Continue without test
152
- 4. Pause workflow
15
+ ## Flow
153
16
 
154
- User chooses: 1 (install)
155
- System creates: "Install test framework" task
156
- System executes: npm install -D vitest...
157
- → System configures: vitest.config.js created
158
- → Installation tracked as completed task
159
- → Continues to test step
160
- ```
161
-
162
- ### User Skips Missing Capability
163
- ```
164
- /p:idea "Fix auth bug"
165
- → Workflow: analyze→fix→test
166
- → /p:done (completes fix)
17
+ 1. Read: `workflow/state.json`
18
+ 2. Display: current step + progress
19
+ 3. Check: capabilities for next steps
167
20
 
168
- ⚠️ Missing test capability for "test" step
169
- → User chooses: 2 (skip)
170
- → Step skipped, workflow completes
171
- ```
21
+ ## Response
172
22
 
173
- ### Installation Tracked as Task
174
- ```
175
- When user installs missing tool:
176
- 1. "Install Jest" task inserted at current position
177
- 2. Installation runs: npm install -D jest
178
- 3. Configuration created: jest.config.js
179
- 4. Task marked complete with duration (e.g., 1.2 min)
180
- 5. Installation visible in workflow progress
181
- 6. Workflow continues to intended step
182
23
  ```
24
+ 🔄 Workflow: {task_type}
183
25
 
184
- ## Best Practices
185
-
186
- 1. **Never hallucinate capabilities** - Only use what exists
187
- 2. **Always prompt when capability missing** - Never auto-skip, ask user first
188
- 3. **Track all installation efforts** - Every tool install becomes a visible task
189
- 4. **Recommend based on stack** - Detect framework and suggest appropriate tools
190
- 5. **Clear handoffs** - Each step completes before next starts
191
- 6. **Agent assignment** - Right specialist for each step
192
- 7. **State tracking** - Workflow progress and installations logged to memory
26
+ Progress: {current}/{total}
27
+ Current: {step_name} ({agent})
28
+ Status: {status}
193
29
 
194
- ## Error Handling
30
+ Next: {next_step}
31
+ {capability_prompt_if_needed}
195
32
 
196
- - If workflow init fails, task is still created (degrades gracefully)
197
- - Missing capabilities = prompt user, don't auto-skip or fail
198
- - Installation failures = notify user, offer alternatives or skip
199
- - Test failures can retry up to configured limit
200
- - Workflow can be cleared manually if needed
201
-
202
- ## State Management
203
-
204
- Workflow state stored in:
205
- ```
206
- ~/.prjct-cli/projects/{id}/workflow/state.json
33
+ /p:done | /p:workflow skip
207
34
  ```
208
-
209
- Contains:
210
- - task: Task description
211
- - type: Workflow type
212
- - caps: Detected capabilities
213
- - steps: All workflow steps (including dynamically inserted install tasks)
214
- - missingCapabilities: Array of capabilities that need prompting
215
- - current: Current step index
216
- - active: Workflow active flag
217
- - timestamps: Created, completed
218
-
219
- Each step tracks:
220
- - status: pending, in_progress, completed, skipped
221
- - needsPrompt: Boolean flag for user decision required
222
- - type: 'install' for installation tasks
223
- - insertedAt: Timestamp for dynamically added tasks
224
- - skipReason: Why step was skipped (if user chose skip)