prjct-cli 0.4.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.
- package/CHANGELOG.md +312 -0
- package/CLAUDE.md +300 -0
- package/LICENSE +21 -0
- package/README.md +424 -0
- package/bin/prjct +214 -0
- package/core/agent-detector.js +249 -0
- package/core/agents/claude-agent.js +250 -0
- package/core/agents/codex-agent.js +256 -0
- package/core/agents/terminal-agent.js +465 -0
- package/core/analyzer.js +596 -0
- package/core/animations-simple.js +240 -0
- package/core/animations.js +277 -0
- package/core/author-detector.js +218 -0
- package/core/capability-installer.js +190 -0
- package/core/command-installer.js +775 -0
- package/core/commands.js +2050 -0
- package/core/config-manager.js +335 -0
- package/core/migrator.js +784 -0
- package/core/path-manager.js +324 -0
- package/core/project-capabilities.js +144 -0
- package/core/session-manager.js +439 -0
- package/core/version.js +107 -0
- package/core/workflow-engine.js +213 -0
- package/core/workflow-prompts.js +192 -0
- package/core/workflow-rules.js +147 -0
- package/package.json +80 -0
- package/scripts/install.sh +433 -0
- package/scripts/verify-installation.sh +158 -0
- package/templates/agents/AGENTS.md +164 -0
- package/templates/commands/analyze.md +125 -0
- package/templates/commands/cleanup.md +102 -0
- package/templates/commands/context.md +105 -0
- package/templates/commands/design.md +113 -0
- package/templates/commands/done.md +44 -0
- package/templates/commands/fix.md +87 -0
- package/templates/commands/git.md +79 -0
- package/templates/commands/help.md +72 -0
- package/templates/commands/idea.md +50 -0
- package/templates/commands/init.md +237 -0
- package/templates/commands/next.md +74 -0
- package/templates/commands/now.md +35 -0
- package/templates/commands/progress.md +92 -0
- package/templates/commands/recap.md +86 -0
- package/templates/commands/roadmap.md +107 -0
- package/templates/commands/ship.md +41 -0
- package/templates/commands/stuck.md +48 -0
- package/templates/commands/task.md +97 -0
- package/templates/commands/test.md +94 -0
- package/templates/commands/workflow.md +224 -0
- package/templates/examples/natural-language-examples.md +320 -0
- package/templates/mcp-config.json +8 -0
- package/templates/workflows/analyze.md +159 -0
- package/templates/workflows/cleanup.md +73 -0
- package/templates/workflows/context.md +72 -0
- package/templates/workflows/design.md +88 -0
- package/templates/workflows/done.md +20 -0
- package/templates/workflows/fix.md +201 -0
- package/templates/workflows/git.md +192 -0
- package/templates/workflows/help.md +13 -0
- package/templates/workflows/idea.md +22 -0
- package/templates/workflows/init.md +80 -0
- package/templates/workflows/natural-language-handler.md +183 -0
- package/templates/workflows/next.md +44 -0
- package/templates/workflows/now.md +19 -0
- package/templates/workflows/progress.md +113 -0
- package/templates/workflows/recap.md +66 -0
- package/templates/workflows/roadmap.md +95 -0
- package/templates/workflows/ship.md +18 -0
- package/templates/workflows/stuck.md +25 -0
- package/templates/workflows/task.md +109 -0
- package/templates/workflows/test.md +243 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Workflow System for AI Assistants
|
|
2
|
+
|
|
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.
|
|
5
|
+
|
|
6
|
+
## How It Works
|
|
7
|
+
|
|
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
|
+
```
|
|
118
|
+
/p:workflow
|
|
119
|
+
```
|
|
120
|
+
Shows current workflow state, active step, progress.
|
|
121
|
+
|
|
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
|
|
153
|
+
|
|
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)
|
|
167
|
+
|
|
168
|
+
⚠️ Missing test capability for "test" step
|
|
169
|
+
→ User chooses: 2 (skip)
|
|
170
|
+
→ Step skipped, workflow completes
|
|
171
|
+
```
|
|
172
|
+
|
|
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
|
+
```
|
|
183
|
+
|
|
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
|
|
193
|
+
|
|
194
|
+
## Error Handling
|
|
195
|
+
|
|
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
|
|
207
|
+
```
|
|
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)
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
# Natural Language Examples
|
|
2
|
+
|
|
3
|
+
Real-world examples showing how the **semantic intent detection** works.
|
|
4
|
+
|
|
5
|
+
> **Important**: These are examples, not the only valid phrases! The LLM understands intent semantically, so users can express themselves in countless ways.
|
|
6
|
+
|
|
7
|
+
## Example 1: Starting a Task
|
|
8
|
+
|
|
9
|
+
**User says (any of these work):**
|
|
10
|
+
- "I want to start building the user authentication system"
|
|
11
|
+
- "Let me work on the auth flow"
|
|
12
|
+
- "Starting the login feature now"
|
|
13
|
+
- "Voy a hacer la autenticación de usuarios"
|
|
14
|
+
|
|
15
|
+
**Claude Code understands:**
|
|
16
|
+
- Intent: User wants to start working on something
|
|
17
|
+
- Command: `/p:now`
|
|
18
|
+
- Parameter: [extracted task description]
|
|
19
|
+
|
|
20
|
+
**Claude Code response:**
|
|
21
|
+
```markdown
|
|
22
|
+
💬 I understood: "start working on building the user authentication system"
|
|
23
|
+
⚡ Executing: /p:now "building the user authentication system"
|
|
24
|
+
|
|
25
|
+
🎯 Working on: building the user authentication system
|
|
26
|
+
Started: 2:30 PM
|
|
27
|
+
|
|
28
|
+
When you're done:
|
|
29
|
+
• Say "I'm done" or "finished"
|
|
30
|
+
• Or: /p:done
|
|
31
|
+
|
|
32
|
+
Need help? Say "I'm stuck" or use /p:stuck
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Example 2: Completing a Task
|
|
38
|
+
|
|
39
|
+
**User says (any of these work):**
|
|
40
|
+
- "I'm done"
|
|
41
|
+
- "finished"
|
|
42
|
+
- "terminé"
|
|
43
|
+
- "all done with this"
|
|
44
|
+
- "completed it"
|
|
45
|
+
|
|
46
|
+
**Claude Code understands:**
|
|
47
|
+
- Intent: User finished their current work
|
|
48
|
+
- Command: `/p:done`
|
|
49
|
+
|
|
50
|
+
**Claude Code response:**
|
|
51
|
+
```markdown
|
|
52
|
+
💬 I understood: "task completion"
|
|
53
|
+
⚡ Executing: /p:done
|
|
54
|
+
|
|
55
|
+
✅ Task complete: building the user authentication system (2h 15m)
|
|
56
|
+
|
|
57
|
+
What's next?
|
|
58
|
+
• "start next task" → Begin working
|
|
59
|
+
• "ship this feature" → Track & celebrate
|
|
60
|
+
• "add new idea" → Brainstorm
|
|
61
|
+
|
|
62
|
+
Or use: /p:now | /p:ship | /p:idea
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Example 3: Shipping a Feature
|
|
68
|
+
|
|
69
|
+
**User says:**
|
|
70
|
+
```
|
|
71
|
+
ship the authentication system
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Claude Code response:**
|
|
75
|
+
```markdown
|
|
76
|
+
💬 I understood: "ship feature"
|
|
77
|
+
⚡ Executing: /p:ship "authentication system"
|
|
78
|
+
|
|
79
|
+
🚀 authentication system shipped!
|
|
80
|
+
|
|
81
|
+
📈 This week: 3 | Total: 12
|
|
82
|
+
Velocity: 1.2 features/day
|
|
83
|
+
|
|
84
|
+
Keep the momentum!
|
|
85
|
+
• "start next task" → Keep building
|
|
86
|
+
• "see my progress" → View stats
|
|
87
|
+
• "plan ahead" → Strategic thinking
|
|
88
|
+
|
|
89
|
+
Or use: /p:now | /p:recap | /p:roadmap
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Example 4: Capturing an Idea
|
|
95
|
+
|
|
96
|
+
**User says:**
|
|
97
|
+
```
|
|
98
|
+
I have an idea about adding dark mode to the dashboard
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Claude Code response:**
|
|
102
|
+
```markdown
|
|
103
|
+
💬 I understood: "capture idea"
|
|
104
|
+
⚡ Executing: /p:idea "adding dark mode to the dashboard"
|
|
105
|
+
|
|
106
|
+
💡 Idea captured: adding dark mode to the dashboard
|
|
107
|
+
|
|
108
|
+
Ready to start?
|
|
109
|
+
• "start this" → Begin now
|
|
110
|
+
• "plan more" → Keep brainstorming
|
|
111
|
+
• "see ideas" → View backlog
|
|
112
|
+
|
|
113
|
+
Or use: /p:now | /p:idea | /p:recap
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Example 5: Viewing Progress
|
|
119
|
+
|
|
120
|
+
**User says:**
|
|
121
|
+
```
|
|
122
|
+
show me my progress
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Claude Code response:**
|
|
126
|
+
```markdown
|
|
127
|
+
💬 I understood: "view progress"
|
|
128
|
+
⚡ Executing: /p:recap
|
|
129
|
+
|
|
130
|
+
📊 Recap
|
|
131
|
+
|
|
132
|
+
🎯 Current: building user dashboard
|
|
133
|
+
🚀 Shipped: 3
|
|
134
|
+
📝 Queue: 5
|
|
135
|
+
💡 Ideas: 8
|
|
136
|
+
|
|
137
|
+
Recent: authentication system (2h ago)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Example 6: Getting Help
|
|
143
|
+
|
|
144
|
+
**User says:**
|
|
145
|
+
```
|
|
146
|
+
I'm stuck on this CORS error with the API
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Claude Code response:**
|
|
150
|
+
```markdown
|
|
151
|
+
💬 I understood: "need help"
|
|
152
|
+
⚡ Executing: /p:stuck "CORS error with the API"
|
|
153
|
+
|
|
154
|
+
🆘 Let's solve: CORS error with the API
|
|
155
|
+
|
|
156
|
+
Common solutions:
|
|
157
|
+
1. Add CORS headers to API responses
|
|
158
|
+
2. Configure proxy in development
|
|
159
|
+
3. Check credentials mode
|
|
160
|
+
|
|
161
|
+
Need to break this down?
|
|
162
|
+
• "start fixing CORS" → Focus on solution
|
|
163
|
+
• "add as task" → Queue for later
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Example 7: Viewing Queue
|
|
169
|
+
|
|
170
|
+
**User says:**
|
|
171
|
+
```
|
|
172
|
+
what should I work on next?
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Claude Code response:**
|
|
176
|
+
```markdown
|
|
177
|
+
💬 I understood: "view queue"
|
|
178
|
+
⚡ Executing: /p:next
|
|
179
|
+
|
|
180
|
+
📋 Priority Queue
|
|
181
|
+
|
|
182
|
+
1. Fix login bug (Priority: High)
|
|
183
|
+
2. Add user profile page
|
|
184
|
+
3. Implement password reset
|
|
185
|
+
4. Add email verification
|
|
186
|
+
5. Create admin dashboard
|
|
187
|
+
|
|
188
|
+
Ready to start?
|
|
189
|
+
• Say "start [task]"
|
|
190
|
+
• Or: /p:now "[task]"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Example 8: Any Language Works
|
|
196
|
+
|
|
197
|
+
**User says (Spanish):**
|
|
198
|
+
```
|
|
199
|
+
quiero empezar a trabajar en la página de login
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Claude Code understands:**
|
|
203
|
+
- Intent: User wants to start working (expressed in Spanish)
|
|
204
|
+
- Command: `/p:now`
|
|
205
|
+
- Parameter: "trabajar en la página de login"
|
|
206
|
+
|
|
207
|
+
**Claude Code response:**
|
|
208
|
+
```markdown
|
|
209
|
+
💬 I understood: "start working on the login page"
|
|
210
|
+
⚡ Executing: /p:now "trabajar en la página de login"
|
|
211
|
+
|
|
212
|
+
🎯 Working on: trabajar en la página de login
|
|
213
|
+
Started: 2:30 PM
|
|
214
|
+
|
|
215
|
+
When you're done:
|
|
216
|
+
• Say "I'm done" or "terminé"
|
|
217
|
+
• Or: /p:done
|
|
218
|
+
|
|
219
|
+
Need help? Say "I'm stuck" or use /p:stuck
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
> **Note**: The LLM can respond in the user's language or English - both work!
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Example 9: Mixed Commands
|
|
227
|
+
|
|
228
|
+
**User says:**
|
|
229
|
+
```
|
|
230
|
+
I'm done with the login, now I want to start the API work
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Claude Code response:**
|
|
234
|
+
```markdown
|
|
235
|
+
💬 I understood: "complete task + start new task"
|
|
236
|
+
⚡ Executing: /p:done → /p:now "API work"
|
|
237
|
+
|
|
238
|
+
✅ Task complete: login page (1h 45m)
|
|
239
|
+
|
|
240
|
+
🎯 Working on: API work
|
|
241
|
+
Started: 4:15 PM
|
|
242
|
+
|
|
243
|
+
What's next?
|
|
244
|
+
• Say "I'm done" when finished
|
|
245
|
+
• Or: /p:done
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Example 10: Ambiguous Input
|
|
251
|
+
|
|
252
|
+
**User says:**
|
|
253
|
+
```
|
|
254
|
+
help
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Claude Code response:**
|
|
258
|
+
```markdown
|
|
259
|
+
💬 I need clarification:
|
|
260
|
+
|
|
261
|
+
Did you mean:
|
|
262
|
+
1. 📖 Interactive guide → Use /p:help
|
|
263
|
+
2. 🆘 I'm stuck on something → Say "I'm stuck on [problem]" or use /p:stuck
|
|
264
|
+
|
|
265
|
+
Which one?
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Implementation Notes
|
|
271
|
+
|
|
272
|
+
### Semantic Understanding (Not Pattern Matching!)
|
|
273
|
+
|
|
274
|
+
**Key Principle**: The LLM understands intent semantically, not through regex or hardcoded phrases.
|
|
275
|
+
|
|
276
|
+
```javascript
|
|
277
|
+
// ❌ DON'T DO THIS
|
|
278
|
+
if (message.includes("I want to start")) {
|
|
279
|
+
// Too rigid!
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ✅ DO THIS
|
|
283
|
+
// Use your LLM understanding:
|
|
284
|
+
// "What is the user trying to accomplish?"
|
|
285
|
+
const intent = semanticallyUnderstand(message)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Detection Flow
|
|
289
|
+
1. **Check for `/p:` commands** - Execute directly if present
|
|
290
|
+
2. **Understand user intent** - What are they trying to do?
|
|
291
|
+
3. **Map to appropriate command** - Based on semantic meaning
|
|
292
|
+
4. **Extract parameters** - Pull relevant information
|
|
293
|
+
5. **Show transparency** - Communicate what you understood
|
|
294
|
+
6. **Execute and respond** - Run command and guide next steps
|
|
295
|
+
|
|
296
|
+
### Transparency Format
|
|
297
|
+
Always show what you understood:
|
|
298
|
+
```
|
|
299
|
+
💬 I understood: "[your interpretation of their intent]"
|
|
300
|
+
⚡ Executing: /p:[command] [params]
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Multilingual Support
|
|
304
|
+
If you understand the intent in **any language**, execute it:
|
|
305
|
+
- **English**: "I want to start the API"
|
|
306
|
+
- **Spanish**: "Quiero empezar con la autenticación"
|
|
307
|
+
- **Casual**: "gonna work on that bug"
|
|
308
|
+
- **Formal**: "I shall commence development"
|
|
309
|
+
- **Mixed**: "voy a hacer the dashboard"
|
|
310
|
+
|
|
311
|
+
**All work!** Trust your semantic understanding.
|
|
312
|
+
|
|
313
|
+
### Parameter Extraction
|
|
314
|
+
Pull the meaningful information from the message:
|
|
315
|
+
- **For `/p:now`**: What task are they describing?
|
|
316
|
+
- **For `/p:ship`**: What feature are they shipping?
|
|
317
|
+
- **For `/p:idea`**: What's their idea?
|
|
318
|
+
- **For `/p:stuck`**: What problem are they facing?
|
|
319
|
+
|
|
320
|
+
Use context and understanding, not string manipulation!
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: prjct analyze
|
|
3
|
+
invocable_name: p:analyze
|
|
4
|
+
description: Generate or update repository analysis using global prjct architecture
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Steps
|
|
8
|
+
|
|
9
|
+
1. Read project config from `.prjct/prjct.config.json`
|
|
10
|
+
2. Extract `projectId` and `author` from config
|
|
11
|
+
3. Analyze project structure:
|
|
12
|
+
- File tree and organization
|
|
13
|
+
- Package dependencies
|
|
14
|
+
- Framework detection
|
|
15
|
+
- Code patterns and conventions
|
|
16
|
+
4. Analyze technical stack:
|
|
17
|
+
- Languages and versions
|
|
18
|
+
- Frameworks and libraries
|
|
19
|
+
- Build tools and scripts
|
|
20
|
+
- Testing setup
|
|
21
|
+
5. Identify key components:
|
|
22
|
+
- Entry points
|
|
23
|
+
- Core modules
|
|
24
|
+
- API endpoints
|
|
25
|
+
- UI components
|
|
26
|
+
6. Assess project health:
|
|
27
|
+
- Code quality indicators
|
|
28
|
+
- Test coverage
|
|
29
|
+
- Documentation coverage
|
|
30
|
+
- Technical debt
|
|
31
|
+
7. Generate or update analysis file: `~/.prjct-cli/projects/{projectId}/analysis/repo-summary.md`
|
|
32
|
+
8. Update project context: `~/.prjct-cli/projects/{projectId}/core/context.md`
|
|
33
|
+
9. Log analysis to memory
|
|
34
|
+
10. Display summary and insights
|
|
35
|
+
|
|
36
|
+
# Response Format
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
🔍 Repository Analysis Complete
|
|
40
|
+
|
|
41
|
+
## Project Overview
|
|
42
|
+
- Name: {project-name}
|
|
43
|
+
- Type: {app-type}
|
|
44
|
+
- Primary Language: {language}
|
|
45
|
+
- Framework: {framework}
|
|
46
|
+
|
|
47
|
+
## Technical Stack
|
|
48
|
+
**Languages**: {languages with percentages}
|
|
49
|
+
**Frameworks**: {frameworks and versions}
|
|
50
|
+
**Key Dependencies**:
|
|
51
|
+
- {dep 1} ({version})
|
|
52
|
+
- {dep 2} ({version})
|
|
53
|
+
- {dep 3} ({version})
|
|
54
|
+
|
|
55
|
+
## Project Structure
|
|
56
|
+
{directory-tree-summary}
|
|
57
|
+
|
|
58
|
+
## Key Components
|
|
59
|
+
- **Entry Points**: {files}
|
|
60
|
+
- **Core Modules**: {modules}
|
|
61
|
+
- **API Layer**: {endpoints-count} endpoints
|
|
62
|
+
- **UI Components**: {components-count} components
|
|
63
|
+
- **Tests**: {tests-count} test files
|
|
64
|
+
|
|
65
|
+
## Code Patterns
|
|
66
|
+
- Architecture: {pattern} (e.g., MVC, Clean, Microservices)
|
|
67
|
+
- State Management: {approach}
|
|
68
|
+
- API Style: {REST/GraphQL/gRPC}
|
|
69
|
+
- Error Handling: {pattern}
|
|
70
|
+
|
|
71
|
+
## Project Health
|
|
72
|
+
- Code Quality: {score/10}
|
|
73
|
+
- Test Coverage: {X}%
|
|
74
|
+
- Documentation: {Good/Fair/Needs Improvement}
|
|
75
|
+
- Technical Debt: {Low/Medium/High}
|
|
76
|
+
|
|
77
|
+
## Insights
|
|
78
|
+
{key-insights-from-analysis}
|
|
79
|
+
|
|
80
|
+
## Recommendations
|
|
81
|
+
1. {recommendation-1}
|
|
82
|
+
2. {recommendation-2}
|
|
83
|
+
3. {recommendation-3}
|
|
84
|
+
|
|
85
|
+
📄 Full analysis saved to: ~/.prjct-cli/projects/{id}/analysis/repo-summary.md
|
|
86
|
+
|
|
87
|
+
Use /p:context to see how this integrates with your workflow
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
# Analysis Depth
|
|
91
|
+
|
|
92
|
+
**Quick Analysis** (default):
|
|
93
|
+
- File structure scan
|
|
94
|
+
- Package.json/requirements parsing
|
|
95
|
+
- Framework detection
|
|
96
|
+
- Basic metrics
|
|
97
|
+
|
|
98
|
+
**Deep Analysis** (optional):
|
|
99
|
+
- Code complexity analysis
|
|
100
|
+
- Dependency graph
|
|
101
|
+
- Test coverage calculation
|
|
102
|
+
- Documentation audit
|
|
103
|
+
- Security scan
|
|
104
|
+
|
|
105
|
+
# Framework Detection
|
|
106
|
+
|
|
107
|
+
Auto-detect:
|
|
108
|
+
- **Frontend**: React, Vue, Angular, Svelte, Next.js
|
|
109
|
+
- **Backend**: Express, Fastify, NestJS, Django, Flask
|
|
110
|
+
- **Mobile**: React Native, Flutter, Swift, Kotlin
|
|
111
|
+
- **Desktop**: Electron, Tauri
|
|
112
|
+
- **Database**: PostgreSQL, MongoDB, Redis, MySQL
|
|
113
|
+
|
|
114
|
+
# Analysis File Structure
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
# Repository Analysis - {date}
|
|
118
|
+
|
|
119
|
+
## Overview
|
|
120
|
+
{summary}
|
|
121
|
+
|
|
122
|
+
## Stack
|
|
123
|
+
{detailed-stack-info}
|
|
124
|
+
|
|
125
|
+
## Architecture
|
|
126
|
+
{architectural-patterns}
|
|
127
|
+
|
|
128
|
+
## Dependencies
|
|
129
|
+
{dependency-analysis}
|
|
130
|
+
|
|
131
|
+
## Code Organization
|
|
132
|
+
{structure-details}
|
|
133
|
+
|
|
134
|
+
## Quality Metrics
|
|
135
|
+
{metrics-and-scores}
|
|
136
|
+
|
|
137
|
+
## Recommendations
|
|
138
|
+
{actionable-improvements}
|
|
139
|
+
|
|
140
|
+
## Change Log
|
|
141
|
+
- {date}: Initial analysis
|
|
142
|
+
- {date}: Updated after refactoring
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
# Integration with Workflow
|
|
146
|
+
|
|
147
|
+
Analysis helps with:
|
|
148
|
+
- `/p:stuck` - Provides technical context for help
|
|
149
|
+
- `/p:task` - Informs task breakdown based on architecture
|
|
150
|
+
- `/p:roadmap` - Aligns roadmap with technical reality
|
|
151
|
+
- `/p:now` - Better task context awareness
|
|
152
|
+
|
|
153
|
+
# Global Architecture Notes
|
|
154
|
+
|
|
155
|
+
- **Analysis Location**: `~/.prjct-cli/projects/{id}/analysis/repo-summary.md`
|
|
156
|
+
- **Context Update**: `~/.prjct-cli/projects/{id}/core/context.md`
|
|
157
|
+
- **Memory Logging**: `~/.prjct-cli/projects/{id}/memory/context.jsonl`
|
|
158
|
+
- **Config Location**: `{project}/.prjct/prjct.config.json`
|
|
159
|
+
- **Use Case**: Onboarding, debugging, refactoring, planning
|