prjct-cli 0.35.3 → 0.35.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 (44) hide show
  1. package/core/commands/analysis.ts +58 -32
  2. package/core/commands/command-data.ts +11 -50
  3. package/core/commands/commands.ts +18 -21
  4. package/core/commands/context.ts +238 -0
  5. package/core/commands/register.ts +7 -5
  6. package/core/commands/setup.ts +1 -17
  7. package/core/index.ts +2 -4
  8. package/core/services/index.ts +2 -0
  9. package/core/services/sync-service.ts +1080 -0
  10. package/core/types/commands.ts +0 -12
  11. package/core/types/index.ts +0 -1
  12. package/dist/bin/prjct.mjs +1215 -307
  13. package/package.json +2 -8
  14. package/templates/agentic/agent-routing.md +22 -88
  15. package/templates/agentic/agents/uxui.md +42 -197
  16. package/templates/agentic/context-filtering.md +14 -56
  17. package/templates/agentic/orchestrator.md +26 -302
  18. package/templates/agentic/skill-integration.md +37 -289
  19. package/templates/agentic/subagent-generation.md +31 -104
  20. package/templates/agentic/task-fragmentation.md +39 -273
  21. package/templates/agents/AGENTS.md +32 -188
  22. package/templates/commands/bug.md +22 -520
  23. package/templates/commands/dash.md +26 -161
  24. package/templates/commands/done.md +19 -250
  25. package/templates/commands/enrich.md +21 -732
  26. package/templates/commands/idea.md +18 -160
  27. package/templates/commands/init.md +20 -209
  28. package/templates/commands/merge.md +21 -185
  29. package/templates/commands/next.md +21 -103
  30. package/templates/commands/pause.md +21 -272
  31. package/templates/commands/resume.md +18 -411
  32. package/templates/commands/setup.md +0 -1
  33. package/templates/commands/ship.md +30 -627
  34. package/templates/commands/sync.md +11 -1448
  35. package/templates/commands/task.md +17 -439
  36. package/templates/commands/test.md +30 -259
  37. package/CLAUDE.md +0 -211
  38. package/packages/shared/package.json +0 -29
  39. package/packages/shared/src/index.ts +0 -10
  40. package/packages/shared/src/schemas.ts +0 -124
  41. package/packages/shared/src/types.ts +0 -187
  42. package/packages/shared/src/unified.ts +0 -174
  43. package/packages/shared/src/utils.ts +0 -148
  44. package/packages/shared/tsconfig.json +0 -18
@@ -1,127 +1,54 @@
1
1
  # Sub-Agent Generation
2
2
 
3
- Generate Claude Code sub-agents for this project based on detected stack.
4
-
5
- ## Input Context
6
-
7
- You have access to:
8
- - `{analysis}` - repo-summary.md with detected technologies
9
- - `{projectPath}` - Path to project root
10
- - `{projectId}` - Project identifier
3
+ Generate project-specific agents based on detected stack.
11
4
 
12
5
  ## Output Location
13
6
 
14
- Write sub-agents to: `{globalPath}/agents/` (global storage, NOT local project)
7
+ `{globalPath}/agents/` (NEVER local project)
15
8
 
16
- ## Sub-Agent Format (Claude Code)
9
+ ## Agent Format
17
10
 
18
11
  ```markdown
19
12
  ---
20
13
  name: agent-name
21
- description: When to use this agent. Include "Use PROACTIVELY" for auto-invocation.
14
+ description: When to use. Include "Use PROACTIVELY" for auto-invoke.
22
15
  tools: Read, Write, Glob, Grep, Bash
23
16
  model: sonnet
24
17
  skills: [skill-name]
25
18
  ---
26
-
27
- Agent system prompt here...
19
+ Agent prompt...
28
20
  ```
29
21
 
30
- **The `skills` field links the agent to Claude Code skills from claude-plugins.dev.**
31
-
32
- ## Generation Rules
33
-
34
- ### 1. ALWAYS Generate Workflow Agents
35
-
36
- These are REQUIRED for every prjct project:
37
-
38
- #### prjct-workflow.md
39
- - Commands: /p:now, /p:done, /p:next, /p:pause, /p:resume
40
- - Tools: Read, Write, Glob
41
- - Purpose: Task lifecycle management
42
-
43
- #### prjct-planner.md
44
- - Commands: /p:feature, /p:idea, /p:spec, /p:bug
45
- - Tools: Read, Write, Glob, Grep
46
- - Purpose: Feature planning and breakdown
47
-
48
- #### prjct-shipper.md
49
- - Commands: /p:ship
50
- - Tools: Read, Write, Bash, Glob
51
- - Purpose: Git operations, testing, deployment
52
-
53
- ### 2. Generate Domain Agents Based on Stack
54
-
55
- Analyze `{analysis}` and create ONLY relevant domain agents:
56
-
57
- | If Detected | Generate | Tools | Skill |
58
- |-------------|----------|-------|-------|
59
- | React, Vue, Angular, Svelte, CSS, HTML | `frontend.md` | Read, Write, Glob, Grep | `frontend-design` |
60
- | Node.js, Express, Go, Python API, REST, GraphQL | `backend.md` | Read, Write, Bash, Glob, Grep | `javascript-typescript` or `python-development` |
61
- | PostgreSQL, MySQL, MongoDB, Redis, Prisma | `database.md` | Read, Write, Bash | (none) |
62
- | Docker, Kubernetes, CI/CD, GitHub Actions | `devops.md` | Read, Bash, Glob | `developer-kit` |
63
- | Bun test, Jest, Pytest, Testing Library | `testing.md` | Read, Write, Bash | `developer-kit` |
64
- | ANY frontend UI (web or mobile) | `uxui.md` | Read, Write, Glob, Grep | `frontend-design` |
65
-
66
- ### 3. Adapt to Project Context
67
-
68
- Each generated agent should include:
69
- - Project-specific paths from analysis
70
- - Detected frameworks and versions
71
- - Relevant patterns found in codebase
72
-
73
- ## Execution Steps
74
-
75
- 1. **Read Analysis**
76
- ```
77
- Read("{globalPath}/analysis/repo-summary.md")
78
- ```
22
+ ## Required Workflow Agents
79
23
 
80
- 2. **Create Directory**
81
- ```
82
- Bash("mkdir -p {globalPath}/agents")
83
- ```
24
+ | Agent | Purpose | Skill |
25
+ |-------|---------|-------|
26
+ | prjct-workflow.md | Task lifecycle | - |
27
+ | prjct-planner.md | Feature planning | feature-dev |
28
+ | prjct-shipper.md | Git, deploy | code-review |
84
29
 
85
- 3. **Generate Workflow Agents** (always)
86
- - Read template from `templates/subagents/workflow/prjct-workflow.md`
87
- - Adapt with project context
88
- - Write to `{globalPath}/agents/prjct-workflow.md`
89
- - Repeat for prjct-planner.md and prjct-shipper.md
30
+ ## Domain Agents (based on stack)
90
31
 
91
- 4. **Generate Domain Agents** (based on analysis)
92
- - For each detected technology stack:
93
- - Read corresponding template from `templates/subagents/domain/`
94
- - Adapt with project-specific details
95
- - Write to `{globalPath}/agents/`
32
+ | If Detected | Generate | Skill |
33
+ |-------------|----------|-------|
34
+ | React, Vue, CSS | frontend.md | frontend-design |
35
+ | Node, Express, API | backend.md | javascript-typescript |
36
+ | PostgreSQL, MongoDB | database.md | - |
37
+ | Docker, CI/CD | devops.md | developer-kit |
38
+ | Jest, Pytest | testing.md | developer-kit |
39
+ | Any UI | uxui.md | frontend-design |
96
40
 
97
- 5. **Link Skills to Agents**
98
- - Read `templates/config/skill-mappings.json`
99
- - For each generated agent, add the corresponding skill to frontmatter
100
- - Skill mappings:
101
- - `frontend.md` → `skills: [frontend-design]`
102
- - `uxui.md` → `skills: [frontend-design]`
103
- - `backend.md` → `skills: [javascript-typescript]` (or `python-development` for Python)
104
- - `testing.md` → `skills: [developer-kit]`
105
- - `devops.md` → `skills: [developer-kit]`
106
- - `prjct-planner.md` → `skills: [feature-dev]`
107
- - `prjct-shipper.md` → `skills: [code-review]`
41
+ ## Execution
108
42
 
109
- 6. **Report Generated Agents**
110
- ```
111
- Generated sub-agents in {globalPath}/agents/:
112
- - prjct-workflow.md (workflow)
113
- - prjct-planner.md (workflow) /feature-dev
114
- - prjct-shipper.md (workflow) /code-review
115
- - frontend.md (detected: React) → /frontend-design
116
- - backend.md (detected: Node.js) → /javascript-typescript
117
- ```
43
+ 1. Read `{globalPath}/analysis/repo-summary.md`
44
+ 2. Create `{globalPath}/agents/` directory
45
+ 3. Generate workflow agents (always)
46
+ 4. Generate domain agents (based on analysis)
47
+ 5. Add skills to frontmatter
48
+ 6. Report generated agents
118
49
 
119
- ## Critical Rules
50
+ ## Rules
120
51
 
121
- - **NEVER write agents to local project directories** (`.claude/`, `.prjct/`)
122
- - **ALWAYS write agents to `{globalPath}/agents/`** (global storage)
123
- - NEVER hardcode technology detection in TypeScript
124
- - ALWAYS read and analyze repo-summary.md
125
- - ADAPT templates to project context
126
- - Use Claude Code frontmatter format exactly
127
- - Include "Use PROACTIVELY" in descriptions for auto-invocation
52
+ - **ALWAYS** write to `{globalPath}/agents/`
53
+ - **NEVER** write to `.claude/` or `.prjct/`
54
+ - Adapt templates to project context
@@ -1,323 +1,89 @@
1
1
  # Task Fragmentation
2
2
 
3
- **Purpose**: Break complex multi-domain tasks into subtasks for specialist agents.
3
+ Break complex multi-domain tasks into subtasks.
4
4
 
5
5
  ## When to Fragment
6
6
 
7
- Fragment a task when:
8
- - It spans multiple domains (frontend + backend + database)
9
- - It would require loading 3+ agents for one-shot execution
10
- - One-shot implementation would saturate context
11
- - The task has natural dependency order
12
- - Complex enough that specialist focus improves quality
7
+ - Spans 3+ domains (frontend + backend + database)
8
+ - Has natural dependency order
9
+ - Too large for single execution
13
10
 
14
11
  ## When NOT to Fragment
15
12
 
16
- Keep as single task when:
17
13
  - Single domain only
18
14
  - Small, focused change
19
15
  - Already atomic
20
- - User explicitly requests one-shot execution
21
16
 
22
- ---
17
+ ## Dependency Order
23
18
 
24
- ## Fragmentation Algorithm
25
-
26
- ### Input
27
-
28
- ```
29
- Task: "{task description}"
30
- Available Agents: [list from {agentsDir}]
31
- Project Tech: {from repo-analysis.json}
32
- ```
33
-
34
- ### Process
35
-
36
- #### 1. Parse Intent
37
-
38
- What is the user trying to achieve?
39
- What are the moving parts?
40
-
41
- #### 2. Identify Components
42
-
43
- | Component | Domain | Indicator Keywords |
44
- |-----------|--------|-------------------|
45
- | Data layer changes | database | schema, migration, table, query, model |
46
- | API changes | backend | endpoint, API, route, controller, auth |
47
- | UI changes | frontend | component, form, page, UI, layout, styling |
48
- | Test changes | testing | test, spec, coverage, TDD |
49
- | Deploy changes | devops | deploy, CI/CD, pipeline, container |
50
-
51
- #### 3. Check Agent Availability
52
-
53
- For each identified component:
54
- - Does a matching agent exist in `{agentsDir}`?
55
- - If YES → Create subtask for that agent
56
- - If NO → Mark for generalist execution (rare)
57
-
58
- **Remember**: Agents in `{agentsDir}` are ALREADY project-specific (generated during `p. sync`). Don't second-guess whether they "match" the technology.
59
-
60
- #### 4. Order by Dependencies
61
-
62
- Typical dependency order:
63
- 1. **Database** (data models first)
19
+ 1. **Database** (models first)
64
20
  2. **Backend** (API using models)
65
21
  3. **Frontend** (UI using API)
66
22
  4. **Testing** (tests for all)
67
- 5. **DevOps** (deploy everything)
23
+ 5. **DevOps** (deploy)
68
24
 
69
- #### 5. Create Subtask Objects
25
+ ## Subtask Format
70
26
 
71
27
  ```json
72
28
  {
73
- "subtasks": [
74
- {
75
- "id": "subtask-1",
76
- "description": "Create users table schema",
77
- "domain": "database",
78
- "agent": "database.md",
79
- "dependsOn": [],
80
- "expectedOutput": "Migration file created"
81
- },
82
- {
83
- "id": "subtask-2",
84
- "description": "Create auth API endpoints",
85
- "domain": "backend",
86
- "agent": "backend.md",
87
- "dependsOn": ["subtask-1"],
88
- "expectedOutput": "Auth routes implemented"
89
- },
90
- {
91
- "id": "subtask-3",
92
- "description": "Create login form component",
93
- "domain": "frontend",
94
- "agent": "frontend.md",
95
- "dependsOn": ["subtask-2"],
96
- "expectedOutput": "Login form component"
97
- }
98
- ]
29
+ "subtasks": [{
30
+ "id": "subtask-1",
31
+ "description": "Create users table",
32
+ "domain": "database",
33
+ "agent": "database.md",
34
+ "dependsOn": []
35
+ }]
99
36
  }
100
37
  ```
101
38
 
102
- ---
103
-
104
- ## Output Format
105
-
106
- Report fragmentation plan before executing:
39
+ ## Output
107
40
 
108
41
  ```
109
- 🎯 Task: {original task}
110
-
111
- 📋 Subtasks (ordered by dependencies):
112
- ├─ 1. [database] Create users table schema
113
- ├─ 2. [backend] Create auth API endpoints
114
- └─ 3. [frontend] Create login form
42
+ 🎯 Task: {task}
115
43
 
116
- 🤖 Agents to invoke: database, backend, frontend
44
+ 📋 Subtasks:
45
+ ├─ 1. [database] Create schema
46
+ ├─ 2. [backend] Create API
47
+ └─ 3. [frontend] Create form
117
48
  ```
118
49
 
119
- ---
120
-
121
- ## Delegation Pattern
122
-
123
- For each subtask, delegate via Task tool:
50
+ ## Delegation
124
51
 
125
52
  ```
126
53
  Task(
127
54
  subagent_type: 'general-purpose',
128
55
  prompt: '
129
- ## Agent Assignment
130
- Read and apply: {agentsPath}/{domain}.md
131
-
132
- ## Subtask
133
- {subtask.description}
134
-
135
- ## Dependencies
136
- {list completed subtasks and their summaries}
137
-
138
- ## Previous Subtask Output
139
- {previousSubtask.summary if available}
140
-
141
- ## Expected Output
142
- {subtask.expectedOutput}
143
-
144
- ## MANDATORY: Summary on Completion
145
-
146
- When you complete this subtask, provide a summary:
147
-
148
- ### Summary
149
- [1-2 sentence description of what you did]
150
-
151
- ### Files Created/Modified
152
- [Table of files with actions]
153
-
154
- ### What Was Done
155
- [Numbered list of concrete actions]
156
-
157
- ### Output for Next Agent
158
- [What the next agent can use from your work]
159
-
160
- ### Notes for Integration
161
- [Any important notes for integration]
162
-
163
- ## IMPORTANT
56
+ Read: {agentsPath}/{domain}.md
57
+ Subtask: {description}
58
+ Previous: {previousSummary}
164
59
  Focus ONLY on this subtask.
165
- Do NOT implement other parts.
166
- Return when this subtask is complete.
167
60
  '
168
61
  )
169
62
  ```
170
63
 
171
- ---
172
-
173
- ## Summary Storage
174
-
175
- After each subtask completes, the summary is stored in `storage/state.json`:
176
-
177
- ```json
178
- {
179
- "currentTask": {
180
- "subtasks": [{
181
- "id": "subtask-1",
182
- "status": "completed",
183
- "summary": {
184
- "title": "Create auth schema",
185
- "description": "Created database schema for user authentication",
186
- "filesChanged": [
187
- { "path": "prisma/schema.prisma", "action": "modified" }
188
- ],
189
- "whatWasDone": [
190
- "Added User model",
191
- "Added Session model"
192
- ],
193
- "outputForNextAgent": "User and Session models available via Prisma",
194
- "notes": "Use bcrypt for password hashing"
195
- }
196
- }]
197
- }
198
- }
199
- ```
200
-
201
- ---
202
-
203
- ## Context Handoff
204
-
205
- Each subsequent subtask receives the previous subtask's summary:
206
-
207
- ```
208
- ## Previous Subtask Summary (CONTEXT)
209
- ${previousSubtask.summary}
210
-
211
- ## What's Available
212
- - User model (prisma.user)
213
- - Session model (prisma.session)
214
- - Notes: Use bcrypt for passwords
215
-
216
- ## Your Task
217
- Create auth API endpoints using the models from subtask 1.
218
- ```
219
-
220
- ---
221
-
222
- ## Progress Tracking
223
-
224
- The orchestrator updates progress after each subtask:
225
-
226
- ```
227
- 📊 Progress: 2/4 subtasks (50%)
228
-
229
- ✅ 1. [database] Create auth schema
230
- ✅ 2. [backend] Create auth API
231
- ▶️ 3. [frontend] Create login form ← CURRENT
232
- ⏳ 4. [testing] Add auth tests
233
- ```
234
-
235
- ---
236
-
237
- ## Aggregating Results
238
-
239
- After all subtasks complete, report aggregated status:
64
+ ## Progress
240
65
 
241
66
  ```
242
- Task Complete: add user authentication
243
-
244
- 📋 Subtasks Completed:
245
- ├─ ✅ 1. [database] Create auth schema
246
- │ Files: prisma/schema.prisma
247
-
248
- ├─ ✅ 2. [backend] Create auth API
249
- │ Files: src/routes/auth.ts, src/middleware/auth.ts
250
-
251
- ├─ ✅ 3. [frontend] Create login form
252
- │ Files: src/components/LoginForm.tsx
253
-
254
- └─ ✅ 4. [testing] Add auth tests
255
- Files: tests/auth.test.ts
256
-
257
- 📁 Total files affected: 5
258
- ⏱️ Total duration: {calculated from subtask times}
67
+ 📊 Progress: 2/4 (50%)
68
+ ✅ 1. [database] Done
69
+ 2. [backend] Done
70
+ ▶️ 3. [frontend] CURRENT
71
+ 4. [testing]
259
72
  ```
260
73
 
261
- ---
262
-
263
74
  ## Error Handling
264
75
 
265
- If a subtask fails:
266
-
267
76
  ```
268
- ❌ Subtask 2/4 failed: Create auth API
269
-
270
- Error: Database connection failed
77
+ ❌ Subtask 2/4 failed
271
78
 
272
79
  Options:
273
- 1. Retry this subtask
274
- 2. Skip and continue with remaining subtasks
275
- 3. Abort task and rollback
276
-
277
- What would you like to do?
278
- ```
279
-
280
- Use `AskUserQuestion` to get user decision on failure handling.
281
-
282
- ---
283
-
284
- ## Anti-Patterns to Avoid
285
-
286
- ### 1. Over-fragmentation
287
- ```
288
- ❌ WRONG: 10 subtasks for "add login button"
289
- ✅ RIGHT: Single task (already atomic)
290
- ```
291
-
292
- ### 2. Under-fragmentation
80
+ 1. Retry
81
+ 2. Skip and continue
82
+ 3. Abort
293
83
  ```
294
- ❌ WRONG: 1 subtask for "add complete auth system"
295
- ✅ RIGHT: 4 subtasks (database, backend, frontend, testing)
296
- ```
297
-
298
- ### 3. Wrong Dependency Order
299
- ```
300
- ❌ WRONG: Frontend before backend (depends on API)
301
- ✅ RIGHT: Database → Backend → Frontend
302
- ```
303
-
304
- ### 4. Missing Summaries
305
- ```
306
- ❌ WRONG: Subtask completes without summary
307
- ✅ RIGHT: Every subtask generates structured summary
308
- ```
309
-
310
- ---
311
-
312
- ## Integration with Storage
313
-
314
- The subtasks are stored in `storage/state.json` under `currentTask.subtasks`.
315
84
 
316
- Key methods available:
317
- - `stateStorage.createSubtasks(projectId, subtasks)` - Create subtasks
318
- - `stateStorage.completeSubtask(projectId, output, summary)` - Complete current subtask
319
- - `stateStorage.getCurrentSubtask(projectId)` - Get current subtask
320
- - `stateStorage.getNextSubtask(projectId)` - Get next subtask
321
- - `stateStorage.getSubtaskProgress(projectId)` - Get progress
85
+ ## Anti-Patterns
322
86
 
323
- These are called by the orchestrator as subtasks are processed.
87
+ - Over-fragmentation: 10 subtasks for "add button"
88
+ - Under-fragmentation: 1 subtask for "add auth system"
89
+ - Wrong order: Frontend before backend