prjct-cli 0.28.2 → 0.28.4

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 (33) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/core/agentic/index.ts +11 -1
  3. package/core/agentic/memory-system.ts +44 -5
  4. package/core/agentic/smart-context.ts +36 -64
  5. package/core/agentic/token-estimator.ts +264 -0
  6. package/core/infrastructure/path-manager.ts +7 -7
  7. package/core/infrastructure/setup.ts +28 -0
  8. package/core/infrastructure/slash-command-registry.ts +176 -0
  9. package/core/types/integrations.ts +28 -1
  10. package/package.json +1 -1
  11. package/templates/agentic/subagent-generation.md +237 -90
  12. package/templates/commands/bug.md +51 -392
  13. package/templates/commands/done.md +53 -232
  14. package/templates/commands/setup-statusline.md +138 -0
  15. package/templates/commands/ship.md +86 -668
  16. package/templates/commands/sync.md +189 -552
  17. package/templates/commands/task.md +50 -276
  18. package/templates/global/CLAUDE.md +101 -161
  19. package/templates/guides/agent-generation.md +164 -0
  20. package/templates/guides/claude-code-ux.md +232 -0
  21. package/templates/guides/integrations.md +149 -0
  22. package/templates/mcp-config.json +23 -18
  23. package/templates/shared/git-operations.md +68 -0
  24. package/templates/shared/io-patterns.md +72 -0
  25. package/templates/shared/standard.md +70 -0
  26. package/templates/shared/validation.md +75 -0
  27. package/CLAUDE.md +0 -204
  28. package/templates/agentic/agents/uxui.md +0 -218
  29. package/templates/subagents/domain/backend.md +0 -106
  30. package/templates/subagents/domain/database.md +0 -118
  31. package/templates/subagents/domain/devops.md +0 -149
  32. package/templates/subagents/domain/frontend.md +0 -100
  33. package/templates/subagents/domain/testing.md +0 -166
@@ -5,54 +5,14 @@ description: 'Unified task workflow with intelligent classification'
5
5
 
6
6
  # p. task - Start Any Task
7
7
 
8
- Start any work with automatic classification and intelligent breakdown.
8
+ **See:** `@templates/shared/standard.md` for context variables and patterns.
9
9
 
10
- ## @ Agent Mentions
10
+ ## @ Mentions
11
11
 
12
- Invoke specific agents directly in your task using @ notation:
12
+ | `@frontend` `@backend` `@database` `@uxui` `@testing` `@devops` | Load domain agents |
13
+ | `@explore` `@general` `@plan` | Claude Code subagents |
13
14
 
14
- | Mention | Agent | Use Case |
15
- |---------|-------|----------|
16
- | `@frontend` | frontend.md | UI components, React/Vue |
17
- | `@backend` | backend.md | APIs, server logic |
18
- | `@database` | database.md | Schema, queries |
19
- | `@uxui` | uxui.md | UX patterns, design |
20
- | `@testing` | testing.md | Tests, coverage |
21
- | `@devops` | devops.md | CI/CD, Docker |
22
-
23
- **Examples:**
24
- - `p. task @frontend add button` - Loads frontend specialist
25
- - `p. task @frontend @uxui dark mode` - Loads both agents
26
- - `p. task @backend optimize API` - Loads backend specialist
27
-
28
- **Note:** If no @ mention, agents are auto-assigned based on task analysis.
29
-
30
- ## Claude Code Subagents
31
-
32
- Special @ mentions invoke Claude Code's native subagents:
33
-
34
- | Mention | Subagent | Use Case |
35
- |---------|----------|----------|
36
- | `@explore` | Explore | Fast codebase search, find patterns |
37
- | `@general` | General | Complex multi-step research |
38
- | `@plan` | Plan | Architecture design, implementation planning |
39
-
40
- **Examples:**
41
- - `p. task @explore find all API endpoints`
42
- - `p. task @general research caching strategies`
43
- - `p. task @plan design authentication system`
44
-
45
- **Combined:**
46
- - `p. task @frontend @explore add button like existing ones`
47
- → Loads frontend agent + uses Explore subagent to find similar buttons
48
-
49
- ---
50
-
51
- ## Context Variables
52
-
53
- - `{projectId}`: From `.prjct/prjct.config.json`
54
- - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
55
- - `{task}`: User-provided task description
15
+ Example: `p. task @frontend @explore add button like existing ones`
56
16
 
57
17
  ---
58
18
 
@@ -70,259 +30,88 @@ Special @ mentions invoke Claude Code's native subagents:
70
30
 
71
31
  ---
72
32
 
73
- ## Step 1: Validate Project
74
-
75
- ```
76
- READ: .prjct/prjct.config.json
77
- EXTRACT: projectId
78
- SET: globalPath = ~/.prjct-cli/projects/{projectId}
79
-
80
- IF file not found:
81
- OUTPUT: "No prjct project. Run `p. init` first."
82
- STOP
83
- ```
84
-
85
- ---
86
-
87
- ## Step 2: Handle No Task Description
33
+ ## Step 1: Validate & Load State (PARALLEL)
88
34
 
89
35
  ```
90
- IF no task provided:
91
- READ: {globalPath}/storage/state.json
92
-
93
- IF currentTask exists AND status == "active":
94
- OUTPUT current task status with elapsed time
95
- STOP
96
- ELSE:
97
- OUTPUT: "No current task. Use `p. task <description>` to start one."
98
- STOP
99
- ```
100
-
101
- ---
102
-
103
- ## Step 3: Handle Active Task Conflict
36
+ READ (parallel):
37
+ - .prjct/prjct.config.json → {projectId}
38
+ - {globalPath}/storage/state.json → {state}
104
39
 
105
- ```
106
- READ: {globalPath}/storage/state.json
107
-
108
- IF currentTask exists AND status == "active" AND description != {task}:
109
- USE AskUserQuestion:
110
- question: "Active task: '{currentTask.description}'. How to proceed?"
111
- options:
112
- - "Complete current first" → complete it, then continue
113
- - "Pause and switch" → pause it, then continue
114
- - "Cancel" → stay with current task
40
+ IF no config: "No prjct project. Run `p. init`" → STOP
41
+ IF no task AND state.currentTask: Show status → STOP
42
+ IF no task: "Use `p. task <description>`" → STOP
43
+ IF state.currentTask.status == "active":
44
+ AskUserQuestion: "Active task. Complete, Pause, or Cancel?"
115
45
  ```
116
46
 
117
47
  ---
118
48
 
119
- ## Step 4: Agentic Classification
120
-
121
- **CRITICAL: Use reasoning, NOT keyword matching.**
49
+ ## Step 2: Classify & Branch
122
50
 
123
- Analyze the task holistically:
51
+ ### Classification (Reasoning, NOT keywords)
124
52
 
125
- | Type | When to Use |
126
- |------|-------------|
127
- | `feature` | Adds new functionality that didn't exist |
128
- | `bug` | Something is broken or incorrect |
129
- | `improvement` | Enhances existing functionality |
130
- | `refactor` | Reorganizes code, same behavior |
131
- | `chore` | Maintenance, deps, docs, config |
53
+ | Type | Signal |
54
+ |------|--------|
55
+ | `feature` | New functionality |
56
+ | `bug` | Broken behavior |
57
+ | `improvement` | Enhance existing |
58
+ | `refactor` | Reorganize, same behavior |
59
+ | `chore` | Maintenance, deps, docs |
132
60
 
133
- **Reasoning Examples:**
134
- - "add error handling to login" → Reasoning: Adding new functionality → `feature`
135
- - "fix button that doesn't submit" → Reasoning: Broken behavior → `bug`
136
- - "make dashboard load faster" → Reasoning: Enhancing performance → `improvement`
137
- - "split UserService into modules" → Reasoning: Reorganizing code → `refactor`
61
+ ### Git Branch (if on main)
138
62
 
63
+ ```bash
64
+ git branch --show-current && git status --porcelain
139
65
  ```
140
- OUTPUT:
141
- Analyzing: {task}
142
- Intent: {your reasoning}
143
- Classification: {taskType}
144
- ```
145
-
146
- ---
147
-
148
- ## Step 5: Git Branch Management
149
66
 
150
- ```
151
- BASH: git branch --show-current
152
- SET: currentBranch = result
153
-
154
- IF currentBranch == "main" OR currentBranch == "master":
155
- # Handle uncommitted changes first
156
- IF git status shows changes:
157
- USE AskUserQuestion: "Uncommitted changes. Stash, commit, or abort?"
158
-
159
- # Create branch
160
- SET: branchName = {taskType}/{slugify(task)}
161
- BASH: git checkout -b {branchName}
162
- OUTPUT: "Created branch: {branchName}"
163
- ```
67
+ IF on main AND clean: `git checkout -b {type}/{slug}`
68
+ IF on main AND dirty: AskUserQuestion Stash/Commit/Abort
164
69
 
165
70
  ---
166
71
 
167
- ## 5-Phase Workflow
72
+ ## Step 3: 5-Phase Workflow
168
73
 
169
74
  ### Phase 1: Discovery
170
- Summarize what you understand:
171
75
  ```
172
- Building: {one-sentence summary}
76
+ Building: {one-line summary}
173
77
  Type: {taskType}
174
-
175
- Requirements:
176
- - {req 1}
177
- - {req 2}
178
-
179
- Success looks like:
180
- - {criteria 1}
181
- - {criteria 2}
78
+ Requirements: {2-3 bullets}
182
79
  ```
183
80
 
184
- ### Phase 2: Exploration
185
- Use Task(Explore) agent to find:
186
- - Similar existing code
187
- - Patterns used in this codebase
188
- - Key files that would be affected
81
+ ### Phase 2: Exploration (PARALLEL)
189
82
 
190
- **Load skills based on task type:**
191
83
  ```
192
- READ: {globalPath}/config/skills.json (if exists)
193
-
194
- IF task involves UI/frontend:
195
- Invoke Skill("frontend-design") for design patterns
196
- OUTPUT: "🎨 Using frontend-design skill"
197
-
198
- IF task involves backend/API:
199
- Invoke Skill("javascript-typescript") OR Skill("python-development")
200
- OUTPUT: "⚙️ Using {skill} skill"
201
- ```
202
-
203
- ```
204
- OUTPUT:
205
- Found similar:
206
- - {code} in {file}
207
-
208
- Patterns used:
209
- - {pattern}: {where}
210
-
211
- Key files:
212
- - {file}: {what changes}
213
-
214
- Skills activated: {skills used}
84
+ Task(Explore): Find similar code, patterns, affected files
85
+ READ: {globalPath}/config/skills.json → invoke matching skills
215
86
  ```
216
87
 
217
88
  ### Phase 3: Questions
218
- If anything is unclear, use AskUserQuestion.
219
- If everything is clear, say so and continue.
89
+ AskUserQuestion if unclear. Otherwise continue.
220
90
 
221
91
  ### Phase 4: Design
222
- Load relevant agents from `{globalPath}/agents/` and their linked skills:
223
92
 
224
- **Agent + Skill Loading:**
225
93
  ```
226
- FOR EACH relevant agent in {globalPath}/agents/:
227
- READ agent file
228
- PARSE frontmatter get `skills` array
229
-
230
- IF skills exist:
231
- FOR EACH skill in skills:
232
- Invoke Skill(skill) for domain expertise
233
- OUTPUT: "📚 {agent} using /{skill}"
94
+ READ (parallel): {globalPath}/agents/{detected domains}.md
95
+ FOR EACH agent.skills: Invoke Skill()
96
+ FOR EACH agent.mcp: Query context7
234
97
  ```
235
98
 
236
- **Example flow for UI feature:**
237
- 1. Load `uxui.md` agent (has `skills: [frontend-design]`)
238
- 2. Invoke `/frontend-design` skill
239
- 3. Skill provides anti-AI-slop patterns, typography guidelines
240
- 4. Agent applies them to design options
99
+ Propose 2 options → AskUserQuestion for approval.
241
100
 
242
- Propose 2-3 approaches:
243
-
244
- ```
245
- ### Option 1: Minimal
246
- - Approach: {desc}
247
- - Files: {count}
248
- - Pros/Cons: ...
249
-
250
- ### Option 2: Clean Architecture
251
- - Approach: {desc}
252
- - Files: {count}
253
- - Pros/Cons: ...
254
-
255
- ### Option 3: Recommended (Skill-informed)
256
- - Approach: {desc}
257
- - Files: {count}
258
- - Pros/Cons: ...
259
- - Skills applied: {skills}
260
- ```
261
-
262
- Use AskUserQuestion to get approval.
263
-
264
- ### Phase 5: Task Breakdown
265
- Break into actionable subtasks:
266
- - Each task: 30min - 2h
267
- - Ordered by dependency
268
- - Include testing as final task
269
-
270
- ```
271
- Tasks for {task}:
272
- 1. {subtask 1}
273
- 2. {subtask 2}
274
- ...
275
- n. Write tests and verify
276
- ```
101
+ ### Phase 5: Breakdown
102
+ Subtasks: 30min-2h each, dependency order, tests last.
277
103
 
278
104
  ---
279
105
 
280
- ## Step 6: Update Storage
281
-
282
- ### Write state.json
283
- ```json
284
- {
285
- "currentTask": {
286
- "id": "{uuid}",
287
- "description": "{firstSubtask}",
288
- "type": "{taskType}",
289
- "status": "active",
290
- "sessionId": "{uuid}",
291
- "featureId": "{uuid}",
292
- "startedAt": "{timestamp}",
293
- "branch": {
294
- "name": "{branchName}",
295
- "baseBranch": "{baseBranch}"
296
- },
297
- "subtasks": [...],
298
- "currentSubtaskIndex": 0,
299
- "parentDescription": "{task}"
300
- },
301
- "lastUpdated": "{timestamp}"
302
- }
303
- ```
304
-
305
- ### Write queue.json
306
- Add all subtasks to queue with featureId linking them.
307
-
308
- ### Generate context/now.md
309
- ```markdown
310
- # NOW
311
-
312
- **{firstSubtask.description}**
106
+ ## Step 4: Update Storage (PARALLEL WRITES)
313
107
 
314
- Type: {taskType}
315
- Feature: {task}
316
- Branch: {branchName}
317
108
  ```
109
+ WRITE (parallel):
110
+ - {globalPath}/storage/state.json → currentTask with subtasks
111
+ - {globalPath}/storage/queue.json → add subtasks with featureId
112
+ - {globalPath}/context/now.md → current task summary
318
113
 
319
- ---
320
-
321
- ## Step 7: Log to Memory
322
-
323
- ```
324
- APPEND to {globalPath}/memory/events.jsonl:
325
- {"timestamp":"{now}","action":"task_started","taskId":"{id}","type":"{type}","description":"{task}"}
114
+ APPEND: {globalPath}/memory/events.jsonl
326
115
  ```
327
116
 
328
117
  ---
@@ -330,24 +119,9 @@ APPEND to {globalPath}/memory/events.jsonl:
330
119
  ## Output
331
120
 
332
121
  ```
333
- {task}
334
- Type: {taskType}
335
-
336
- Branch: {branchName}
337
- Subtasks: {count}
338
-
122
+ {task} | {taskType}
123
+ Branch: {branchName} | Subtasks: {count}
339
124
  Started: {firstSubtask}
340
125
 
341
- Next: Work on the task, then `p. done`
126
+ Next: p. done
342
127
  ```
343
-
344
- ---
345
-
346
- ## Error Handling
347
-
348
- | Error | Action |
349
- |-------|--------|
350
- | No config | "No prjct project. Run `p. init` first." → STOP |
351
- | No task | Show current task or prompt for one |
352
- | Active task | Ask user what to do |
353
- | Branch fails | Show error, suggest fix |