prjct-cli 0.13.3 → 0.15.1

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 (195) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/bin/prjct +10 -13
  3. package/core/agentic/memory-system/semantic-memories.ts +2 -1
  4. package/core/agentic/plan-mode/plan-mode.ts +2 -1
  5. package/core/agentic/prompt-builder.ts +22 -43
  6. package/core/agentic/services.ts +5 -5
  7. package/core/agentic/smart-context.ts +7 -2
  8. package/core/command-registry/core-commands.ts +54 -29
  9. package/core/command-registry/optional-commands.ts +64 -0
  10. package/core/command-registry/setup-commands.ts +18 -3
  11. package/core/commands/analysis.ts +21 -68
  12. package/core/commands/analytics.ts +247 -213
  13. package/core/commands/base.ts +1 -1
  14. package/core/commands/index.ts +41 -36
  15. package/core/commands/maintenance.ts +300 -31
  16. package/core/commands/planning.ts +233 -22
  17. package/core/commands/setup.ts +3 -8
  18. package/core/commands/shipping.ts +14 -18
  19. package/core/commands/types.ts +8 -6
  20. package/core/commands/workflow.ts +105 -100
  21. package/core/context/generator.ts +317 -0
  22. package/core/context-sync.ts +7 -350
  23. package/core/data/index.ts +13 -32
  24. package/core/data/md-ideas-manager.ts +155 -0
  25. package/core/data/md-queue-manager.ts +4 -3
  26. package/core/data/md-shipped-manager.ts +90 -0
  27. package/core/data/md-state-manager.ts +11 -7
  28. package/core/domain/agent-generator.ts +23 -63
  29. package/core/events/index.ts +143 -0
  30. package/core/index.ts +17 -14
  31. package/core/infrastructure/capability-installer.ts +13 -149
  32. package/core/infrastructure/migrator/project-scanner.ts +2 -1
  33. package/core/infrastructure/path-manager.ts +4 -6
  34. package/core/infrastructure/setup.ts +3 -0
  35. package/core/infrastructure/uuid-migration.ts +750 -0
  36. package/core/outcomes/recorder.ts +2 -1
  37. package/core/plugin/loader.ts +4 -7
  38. package/core/plugin/registry.ts +3 -3
  39. package/core/schemas/index.ts +23 -25
  40. package/core/schemas/state.ts +1 -0
  41. package/core/serializers/ideas-serializer.ts +187 -0
  42. package/core/serializers/index.ts +16 -0
  43. package/core/serializers/shipped-serializer.ts +108 -0
  44. package/core/session/utils.ts +3 -9
  45. package/core/storage/ideas-storage.ts +273 -0
  46. package/core/storage/index.ts +204 -0
  47. package/core/storage/queue-storage.ts +297 -0
  48. package/core/storage/shipped-storage.ts +223 -0
  49. package/core/storage/state-storage.ts +235 -0
  50. package/core/storage/storage-manager.ts +175 -0
  51. package/package.json +1 -1
  52. package/packages/web/app/api/projects/[id]/momentum/route.ts +257 -0
  53. package/packages/web/app/api/sessions/current/route.ts +132 -0
  54. package/packages/web/app/api/sessions/history/route.ts +96 -14
  55. package/packages/web/app/globals.css +5 -0
  56. package/packages/web/app/layout.tsx +2 -0
  57. package/packages/web/app/project/[id]/code/layout.tsx +18 -0
  58. package/packages/web/app/project/[id]/code/page.tsx +408 -0
  59. package/packages/web/app/project/[id]/page.tsx +359 -389
  60. package/packages/web/app/project/[id]/reports/page.tsx +59 -0
  61. package/packages/web/app/project/[id]/reports/print/page.tsx +58 -0
  62. package/packages/web/components/ActivityTimeline/ActivityTimeline.tsx +0 -1
  63. package/packages/web/components/AgentsCard/AgentsCard.tsx +64 -34
  64. package/packages/web/components/AgentsCard/AgentsCard.types.ts +1 -0
  65. package/packages/web/components/AppSidebar/AppSidebar.tsx +135 -11
  66. package/packages/web/components/BentoCard/BentoCard.constants.ts +3 -3
  67. package/packages/web/components/BentoCard/BentoCard.tsx +2 -1
  68. package/packages/web/components/BentoGrid/BentoGrid.tsx +2 -2
  69. package/packages/web/components/BlockersCard/BlockersCard.tsx +65 -57
  70. package/packages/web/components/BlockersCard/BlockersCard.types.ts +1 -0
  71. package/packages/web/components/CommandBar/CommandBar.tsx +67 -0
  72. package/packages/web/components/CommandBar/index.ts +1 -0
  73. package/packages/web/components/DashboardContent/DashboardContent.tsx +35 -5
  74. package/packages/web/components/DateGroup/DateGroup.tsx +1 -1
  75. package/packages/web/components/EmptyState/EmptyState.tsx +39 -21
  76. package/packages/web/components/EmptyState/EmptyState.types.ts +1 -0
  77. package/packages/web/components/EventRow/EventRow.tsx +4 -4
  78. package/packages/web/components/EventRow/EventRow.utils.ts +3 -3
  79. package/packages/web/components/HeroSection/HeroSection.tsx +52 -15
  80. package/packages/web/components/HeroSection/HeroSection.types.ts +4 -4
  81. package/packages/web/components/HeroSection/HeroSection.utils.ts +7 -3
  82. package/packages/web/components/IdeasCard/IdeasCard.tsx +94 -27
  83. package/packages/web/components/IdeasCard/IdeasCard.types.ts +1 -0
  84. package/packages/web/components/MasonryGrid/MasonryGrid.tsx +18 -0
  85. package/packages/web/components/MasonryGrid/index.ts +1 -0
  86. package/packages/web/components/MomentumWidget/MomentumWidget.tsx +119 -0
  87. package/packages/web/components/MomentumWidget/MomentumWidget.types.ts +16 -0
  88. package/packages/web/components/MomentumWidget/index.ts +2 -0
  89. package/packages/web/components/NowCard/NowCard.tsx +81 -56
  90. package/packages/web/components/NowCard/NowCard.types.ts +1 -0
  91. package/packages/web/components/PageHeader/PageHeader.tsx +24 -0
  92. package/packages/web/components/PageHeader/index.ts +1 -0
  93. package/packages/web/components/ProgressRing/ProgressRing.constants.ts +2 -2
  94. package/packages/web/components/ProjectAvatar/ProjectAvatar.tsx +2 -2
  95. package/packages/web/components/ProjectColorDot/ProjectColorDot.tsx +37 -0
  96. package/packages/web/components/ProjectColorDot/index.ts +1 -0
  97. package/packages/web/components/ProjectSelectorModal/ProjectSelectorModal.tsx +104 -0
  98. package/packages/web/components/ProjectSelectorModal/index.ts +1 -0
  99. package/packages/web/components/Providers/Providers.tsx +4 -1
  100. package/packages/web/components/QueueCard/QueueCard.tsx +78 -25
  101. package/packages/web/components/QueueCard/QueueCard.types.ts +1 -0
  102. package/packages/web/components/QueueCard/QueueCard.utils.ts +3 -3
  103. package/packages/web/components/RecoverCard/RecoverCard.tsx +72 -0
  104. package/packages/web/components/RecoverCard/RecoverCard.types.ts +16 -0
  105. package/packages/web/components/RecoverCard/index.ts +2 -0
  106. package/packages/web/components/RoadmapCard/RoadmapCard.tsx +101 -33
  107. package/packages/web/components/RoadmapCard/RoadmapCard.types.ts +1 -0
  108. package/packages/web/components/ShipsCard/ShipsCard.tsx +71 -28
  109. package/packages/web/components/ShipsCard/ShipsCard.types.ts +2 -0
  110. package/packages/web/components/SparklineChart/SparklineChart.tsx +20 -18
  111. package/packages/web/components/StatsMasonry/StatsMasonry.tsx +95 -0
  112. package/packages/web/components/StatsMasonry/index.ts +1 -0
  113. package/packages/web/components/StreakCard/StreakCard.tsx +37 -35
  114. package/packages/web/components/TasksCounter/TasksCounter.tsx +1 -1
  115. package/packages/web/components/TechStackBadges/TechStackBadges.tsx +12 -4
  116. package/packages/web/components/TerminalDock/DockToggleTab.tsx +29 -0
  117. package/packages/web/components/TerminalDock/TerminalDock.tsx +386 -0
  118. package/packages/web/components/TerminalDock/TerminalDockTab.tsx +130 -0
  119. package/packages/web/components/TerminalDock/TerminalTabBar.tsx +142 -0
  120. package/packages/web/components/TerminalDock/index.ts +2 -0
  121. package/packages/web/components/VelocityBadge/VelocityBadge.tsx +8 -3
  122. package/packages/web/components/VelocityCard/VelocityCard.tsx +49 -47
  123. package/packages/web/components/WeeklyReports/PrintableReport.tsx +259 -0
  124. package/packages/web/components/WeeklyReports/ReportPreviewCard.tsx +187 -0
  125. package/packages/web/components/WeeklyReports/WeekCalendar.tsx +288 -0
  126. package/packages/web/components/WeeklyReports/WeeklyReports.tsx +149 -0
  127. package/packages/web/components/WeeklyReports/index.ts +4 -0
  128. package/packages/web/components/WeeklySparkline/WeeklySparkline.tsx +16 -4
  129. package/packages/web/components/WeeklySparkline/WeeklySparkline.types.ts +1 -0
  130. package/packages/web/components/charts/SessionsChart.tsx +6 -3
  131. package/packages/web/components/ui/dialog.tsx +143 -0
  132. package/packages/web/components/ui/drawer.tsx +135 -0
  133. package/packages/web/components/ui/select.tsx +187 -0
  134. package/packages/web/context/GlobalTerminalContext.tsx +538 -0
  135. package/packages/web/lib/commands.ts +81 -0
  136. package/packages/web/lib/generate-week-report.ts +285 -0
  137. package/packages/web/lib/parse-prjct-files.ts +56 -55
  138. package/packages/web/lib/project-colors.ts +58 -0
  139. package/packages/web/lib/projects.ts +58 -5
  140. package/packages/web/lib/services/projects.server.ts +11 -1
  141. package/packages/web/next-env.d.ts +1 -1
  142. package/packages/web/package.json +5 -1
  143. package/templates/commands/analyze.md +39 -3
  144. package/templates/commands/ask.md +58 -3
  145. package/templates/commands/bug.md +117 -26
  146. package/templates/commands/dash.md +95 -158
  147. package/templates/commands/done.md +130 -148
  148. package/templates/commands/feature.md +125 -103
  149. package/templates/commands/git.md +18 -3
  150. package/templates/commands/idea.md +121 -38
  151. package/templates/commands/init.md +124 -20
  152. package/templates/commands/migrate-all.md +63 -28
  153. package/templates/commands/migrate.md +140 -0
  154. package/templates/commands/next.md +115 -5
  155. package/templates/commands/now.md +146 -82
  156. package/templates/commands/pause.md +89 -74
  157. package/templates/commands/redo.md +6 -4
  158. package/templates/commands/resume.md +141 -59
  159. package/templates/commands/setup.md +18 -3
  160. package/templates/commands/ship.md +103 -231
  161. package/templates/commands/spec.md +98 -8
  162. package/templates/commands/suggest.md +22 -2
  163. package/templates/commands/sync.md +192 -203
  164. package/templates/commands/undo.md +6 -4
  165. package/templates/mcp-config.json +20 -1
  166. package/core/data/agents-manager.ts +0 -76
  167. package/core/data/analysis-manager.ts +0 -83
  168. package/core/data/base-manager.ts +0 -156
  169. package/core/data/ideas-manager.ts +0 -81
  170. package/core/data/outcomes-manager.ts +0 -96
  171. package/core/data/project-manager.ts +0 -75
  172. package/core/data/roadmap-manager.ts +0 -118
  173. package/core/data/shipped-manager.ts +0 -65
  174. package/core/data/state-manager.ts +0 -214
  175. package/core/state/index.ts +0 -25
  176. package/core/state/manager.ts +0 -376
  177. package/core/state/types.ts +0 -185
  178. package/core/utils/project-capabilities.ts +0 -156
  179. package/core/view-generator.ts +0 -536
  180. package/packages/web/app/project/[id]/stats/loading.tsx +0 -43
  181. package/packages/web/app/project/[id]/stats/page.tsx +0 -253
  182. package/templates/agent-assignment.md +0 -72
  183. package/templates/analysis/project-analysis.md +0 -78
  184. package/templates/checklists/accessibility.md +0 -33
  185. package/templates/commands/build.md +0 -17
  186. package/templates/commands/decision.md +0 -226
  187. package/templates/commands/fix.md +0 -79
  188. package/templates/commands/help.md +0 -61
  189. package/templates/commands/progress.md +0 -14
  190. package/templates/commands/recap.md +0 -14
  191. package/templates/commands/roadmap.md +0 -52
  192. package/templates/commands/status.md +0 -17
  193. package/templates/commands/task.md +0 -63
  194. package/templates/commands/work.md +0 -44
  195. package/templates/commands/workflow.md +0 -12
@@ -2,13 +2,27 @@
2
2
  allowed-tools: [Read, Write, Bash, Glob, Grep]
3
3
  description: 'Deep sync - analyze git, update ALL project data'
4
4
  timestamp-rule: 'GetTimestamp() for all timestamps'
5
- architecture: 'MD-first - MD files are source of truth'
5
+ architecture: 'Write-Through (JSON MD Events)'
6
+ storage-layer: true
7
+ source-of-truth: 'storage/*.json'
8
+ claude-context: 'context/*.md'
9
+ backend-sync: 'sync/pending.json'
6
10
  ---
7
11
 
8
12
  # /p:sync - Deep Project Sync
9
13
 
10
14
  **CRITICAL**: This is a DEEP analysis. Sync EVERYTHING with the real state of the repository.
11
15
 
16
+ ## Architecture: Write-Through Pattern
17
+
18
+ ```
19
+ Git Analysis → Storage (JSON) → Context (MD) → Project Metadata
20
+ ```
21
+
22
+ **Source of Truth**: `storage/*.json` (state, queue, ideas, shipped)
23
+ **Claude Context**: `context/*.md` (now, next, ideas, shipped, CLAUDE.md)
24
+ **Project Metadata**: `project.json`
25
+
12
26
  ## What Gets Analyzed & Updated
13
27
 
14
28
  ### Git Analysis (Deep)
@@ -17,18 +31,21 @@ architecture: 'MD-first - MD files are source of truth'
17
31
  - `git diff` - What's changed since last commit
18
32
  - `git branch` - Current branch, feature branches
19
33
 
20
- ### ALL MD Files Updated
21
- - `core/now.md` - Current task (validate against git status)
22
- - `core/next.md` - Task queue (remove completed ones)
23
- - `progress/shipped.md` - Add tasks found in commits
24
- - `planning/ideas.md` - Keep valid, remove implemented
25
- - `planning/roadmap.md` - Update feature status
34
+ ### Storage Files (Source of Truth)
35
+ - `storage/state.json` - Current task state
36
+ - `storage/queue.json` - Task queue
37
+ - `storage/ideas.json` - Ideas list
38
+ - `storage/shipped.json` - Shipped features
39
+
40
+ ### Context Files (Generated for Claude)
41
+ - `context/now.md` - Current task (from state.json)
42
+ - `context/next.md` - Task queue (from queue.json)
43
+ - `context/ideas.md` - Ideas (from ideas.json)
44
+ - `context/shipped.md` - Shipped (from shipped.json)
45
+ - `context/CLAUDE.md` - Full project context
26
46
 
27
47
  ### Project Metadata
28
48
  - `project.json` - ALL fields with real data
29
- - `CLAUDE.md` - Quick Reference with real stats
30
- - `analysis/repo-summary.md` - Full analysis
31
- - `agents/*.md` - Specialized agents
32
49
 
33
50
  ## Context Variables
34
51
  - `{projectId}`: From `.prjct/prjct.config.json`
@@ -56,9 +73,9 @@ git status --porcelain
56
73
  ```
57
74
 
58
75
  EXTRACT:
59
- - `{stagedFiles}`: Files staged for commit (A, M, D prefixed with space)
60
- - `{modifiedFiles}`: Modified but not staged (M, D without space prefix)
61
- - `{untrackedFiles}`: New files (??)
76
+ - `{stagedFiles}`: Files staged for commit
77
+ - `{modifiedFiles}`: Modified but not staged
78
+ - `{untrackedFiles}`: New files
62
79
  - `{hasUncommittedChanges}`: true/false
63
80
 
64
81
  ### 2.2 Recent Commits (Last 20)
@@ -66,17 +83,14 @@ EXTRACT:
66
83
  git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short
67
84
  ```
68
85
 
69
- ANALYZE each commit message for:
70
- - Keywords: "feat:", "fix:", "complete", "done", "implement", "add", "finish"
71
- - Task patterns: "Task: X", "#123", issue references
72
- - Feature completions: "feat(auth):", "feat: user login"
86
+ ANALYZE each commit for completed tasks.
73
87
 
74
88
  EXTRACT: `{completedTasks}` - List of tasks found in commits
75
89
 
76
90
  ### 2.3 Current Branch Analysis
77
91
  ```bash
78
92
  git branch --show-current
79
- git log main..HEAD --oneline 2>/dev/null || git log master..HEAD --oneline 2>/dev/null
93
+ git log main..HEAD --oneline 2>/dev/null
80
94
  ```
81
95
 
82
96
  EXTRACT:
@@ -84,21 +98,13 @@ EXTRACT:
84
98
  - `{branchCommits}`: Commits ahead of main
85
99
  - `{isFeatureBranch}`: true if not main/master
86
100
 
87
- ### 2.4 Uncommitted Changes Summary
88
- ```bash
89
- git diff --stat
90
- git diff --cached --stat
91
- ```
92
-
93
- EXTRACT: `{changesDescription}` - What files are being worked on
94
-
95
101
  ---
96
102
 
97
103
  ## Step 3: Gather Project Stats
98
104
 
99
105
  ### Count Files
100
106
  ```bash
101
- find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./dist/*" -not -path "./.next/*" | wc -l
107
+ find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" \) -not -path "./node_modules/*" -not -path "./.git/*" | wc -l
102
108
  ```
103
109
  EXTRACT: `{fileCount}`
104
110
 
@@ -127,86 +133,120 @@ EXTRACT: `{languages}`, `{frameworks}`, `{techStack}`
127
133
 
128
134
  ---
129
135
 
130
- ## Step 4: Sync Core MD Files
136
+ ## Step 4: Regenerate ALL Context Files
131
137
 
132
- ### 4.1 Update now.md (Current Task)
138
+ ### 4.1 Read Storage (Source of Truth)
133
139
 
134
- READ: `{globalPath}/core/now.md`
140
+ READ: `{globalPath}/storage/state.json`
141
+ READ: `{globalPath}/storage/queue.json`
142
+ READ: `{globalPath}/storage/ideas.json`
143
+ READ: `{globalPath}/storage/shipped.json`
135
144
 
136
- **Logic:**
137
- - IF `{hasUncommittedChanges}` AND now.md is empty:
138
- - INFER task from modified files (e.g., "Working on: auth module")
139
- - UPDATE now.md with inferred task
145
+ ### 4.2 Generate context/now.md
140
146
 
141
- - IF now.md has task AND task appears in recent commits:
142
- - Task is DONE → Clear now.md, add to shipped.md
147
+ WRITE: `{globalPath}/context/now.md`
143
148
 
144
- - IF `{isFeatureBranch}`:
145
- - Suggest task based on branch name (e.g., `feature/auth` → "Implement authentication")
149
+ IF state.currentTask exists:
150
+ ```markdown
151
+ # NOW
146
152
 
147
- WRITE: `{globalPath}/core/now.md`
153
+ **{state.currentTask.description}**
148
154
 
149
- ### 4.2 Update next.md (Task Queue)
155
+ Started: {state.currentTask.startedAt}
156
+ Session: {state.currentTask.sessionId}
157
+ {IF estimate: Estimate: {state.currentTask.estimate}}
158
+ ```
150
159
 
151
- READ: `{globalPath}/core/next.md`
160
+ ELSE IF state.pausedTask exists:
161
+ ```markdown
162
+ # NOW
152
163
 
153
- **Logic:**
154
- - Parse existing tasks (lines starting with `- `)
155
- - For each task, check if it appears in `{completedTasks}` from commits
156
- - REMOVE completed tasks from queue
157
- - Keep remaining tasks
164
+ ⏸️ **{state.pausedTask.description}** (paused)
158
165
 
159
- WRITE: `{globalPath}/core/next.md`
166
+ Paused: {state.pausedTask.pausedAt}
167
+ Reason: {state.pausedTask.pauseReason}
168
+ ```
160
169
 
161
- ### 4.3 Update shipped.md (Completed Work)
170
+ ELSE:
171
+ ```markdown
172
+ # NOW
162
173
 
163
- READ: `{globalPath}/progress/shipped.md`
174
+ _No active task_
164
175
 
165
- **Logic:**
166
- - For each task in `{completedTasks}` from git commits:
167
- - Check if NOT already in shipped.md
168
- - ADD new entries with commit date
176
+ Use `/p:now <task>` to start working.
177
+ ```
178
+
179
+ ### 4.3 Generate context/next.md
180
+
181
+ WRITE: `{globalPath}/context/next.md`
169
182
 
170
- FORMAT for new entries:
171
183
  ```markdown
172
- - **{taskName}** - {date}
173
- - Commit: {commitHash}
184
+ # NEXT
185
+
186
+ ## Active
187
+
188
+ {FOR EACH task in queue.tasks WHERE section == "active":}
189
+ - [ ] {task.description} {task.priority ? `[${task.priority}]` : ''}
190
+ {END FOR}
191
+
192
+ ## Backlog
193
+
194
+ {FOR EACH task in queue.tasks WHERE section == "backlog":}
195
+ - [ ] {task.description}
196
+ {END FOR}
174
197
  ```
175
198
 
176
- WRITE: `{globalPath}/progress/shipped.md`
199
+ ### 4.4 Generate context/ideas.md
200
+
201
+ WRITE: `{globalPath}/context/ideas.md`
202
+
203
+ ```markdown
204
+ # IDEAS
177
205
 
178
- ### 4.4 Update ideas.md
206
+ ## Pending
179
207
 
180
- READ: `{globalPath}/planning/ideas.md`
208
+ {FOR EACH idea in ideas.ideas WHERE status == "pending":}
209
+ - **{idea.text}** {idea.tags.join(' ')}
210
+ - Priority: {idea.priority}
211
+ - Added: {idea.createdAt}
212
+ {END FOR}
181
213
 
182
- **Logic:**
183
- - Parse existing ideas
184
- - Check if any idea was implemented (appears in commits)
185
- - REMOVE implemented ideas OR mark as done
214
+ ## Converted
186
215
 
187
- WRITE: `{globalPath}/planning/ideas.md`
216
+ {FOR EACH idea in ideas.ideas WHERE status == "converted":}
217
+ - ~~{idea.text}~~ → Feature
218
+ {END FOR}
219
+ ```
188
220
 
189
- ### 4.5 Update roadmap.md
221
+ ### 4.5 Generate context/shipped.md
190
222
 
191
- READ: `{globalPath}/planning/roadmap.md`
223
+ WRITE: `{globalPath}/context/shipped.md`
192
224
 
193
- **Logic:**
194
- - Parse features and their status
195
- - For each feature, check commits for implementation
196
- - UPDATE status: planning → in-progress → completed
197
- - Add completion dates where applicable
225
+ ```markdown
226
+ # SHIPPED 🚀
198
227
 
199
- WRITE: `{globalPath}/planning/roadmap.md`
228
+ ## {Current Month Year}
229
+
230
+ {FOR EACH ship in shipped.shipped WHERE month matches:}
231
+ - **{ship.name}** v{ship.version} - {formatDate(ship.shippedAt)}
232
+ {END FOR}
200
233
 
201
234
  ---
202
235
 
203
- ## Step 5: Update CLAUDE.md
236
+ **Total shipped:** {shipped.shipped.length}
237
+ ```
204
238
 
205
- READ: `{globalPath}/CLAUDE.md`
239
+ ---
240
+
241
+ ## Step 5: Update context/CLAUDE.md
206
242
 
207
- ### Quick Reference Table (MUST UPDATE)
243
+ WRITE: `{globalPath}/context/CLAUDE.md`
208
244
 
209
245
  ```markdown
246
+ # {projectName} - Project Context
247
+ <!-- projectId: {projectId} -->
248
+ <!-- Generated: {GetTimestamp()} -->
249
+
210
250
  ## Quick Reference
211
251
 
212
252
  | Field | Value |
@@ -219,11 +259,7 @@ READ: `{globalPath}/CLAUDE.md`
219
259
  | **Branch** | {currentBranch} |
220
260
  | **Path** | {cwd} |
221
261
  | **Last Sync** | {GetTimestamp()} |
222
- ```
223
-
224
- ### Git Status Section
225
262
 
226
- ```markdown
227
263
  ## Current Git Status
228
264
 
229
265
  **Branch**: `{currentBranch}`
@@ -232,13 +268,46 @@ READ: `{globalPath}/CLAUDE.md`
232
268
  {IF hasUncommittedChanges}
233
269
  ### Modified Files
234
270
  {list of modified files}
235
-
236
- ### What's Being Worked On
237
- {changesDescription}
238
271
  {ENDIF}
239
- ```
240
272
 
241
- WRITE: `{globalPath}/CLAUDE.md`
273
+ ## PROJECT DATA
274
+
275
+ ### Dependencies
276
+ {list dependencies from package.json}
277
+
278
+ ### Scripts
279
+ {list scripts from package.json}
280
+
281
+ ## CURRENT STATE
282
+
283
+ **Now:** {currentTask or "_No active task_"}
284
+
285
+ **Queue ({queue.tasks.length}):**
286
+ {list first 5 tasks}
287
+
288
+ **Ideas ({ideas.ideas.length}):**
289
+ {list first 3 ideas}
290
+
291
+ ## DATA LOCATION
292
+
293
+ \`\`\`
294
+ ~/.prjct-cli/projects/{projectId}/
295
+ ├── storage/ # JSON (source of truth)
296
+ │ ├── state.json
297
+ │ ├── queue.json
298
+ │ ├── ideas.json
299
+ │ └── shipped.json
300
+ ├── context/ # MD (for Claude)
301
+ │ ├── CLAUDE.md
302
+ │ ├── now.md
303
+ │ ├── next.md
304
+ │ ├── ideas.md
305
+ │ └── shipped.md
306
+ ├── sync/ # Backend sync
307
+ │ └── pending.json
308
+ └── agents/ # Specialists
309
+ \`\`\`
310
+ ```
242
311
 
243
312
  ---
244
313
 
@@ -267,64 +336,28 @@ WRITE: `{globalPath}/project.json`
267
336
 
268
337
  ---
269
338
 
270
- ## Step 7: Generate Analysis Files
339
+ ## Step 7: Generate Agents (AGENTIC)
271
340
 
272
- ### repo-summary.md
273
- WRITE: `{globalPath}/analysis/repo-summary.md`
341
+ Based on detected stack, generate specialized agents.
274
342
 
275
- ```markdown
276
- # Repository Summary
277
-
278
- > Generated: {GetTimestamp()}
279
-
280
- ## Project
281
- - **Name**: {projectName}
282
- - **Version**: {version}
283
- - **Path**: {cwd}
284
-
285
- ## Stack
286
- - **Languages**: {languages}
287
- - **Frameworks**: {frameworks}
288
- - **Package Manager**: {packageManager}
289
-
290
- ## Stats
291
- - **Files**: {fileCount}
292
- - **Commits**: {commitCount}
293
- - **Contributors**: {contributorCount}
294
-
295
- ## Structure
296
- - **Source**: {sourceDir}
297
- - **Tests**: {testDir}
298
- - **Config**: {configFiles}
299
-
300
- ## Git Status
301
- - **Branch**: {currentBranch}
302
- - **Uncommitted**: {hasUncommittedChanges}
303
- - **Recent Activity**: {recentCommitCount} commits this week
343
+ For EACH specialist needed:
344
+ ```typescript
345
+ const generator = new AgentGenerator('{projectId}')
346
+ await generator.generateDynamicAgent('agent-name', {
347
+ role: 'specific role',
348
+ domain: 'domain',
349
+ expertise: 'technologies'
350
+ })
304
351
  ```
305
352
 
306
- ### patterns.md (Code patterns detected)
307
- Analyze code and WRITE: `{globalPath}/analysis/patterns.md`
308
-
309
353
  ---
310
354
 
311
- ## Step 8: Generate/Update Agents
355
+ ## Step 8: Log to Memory
312
356
 
313
- Based on detected stack, generate specialized agents in `{globalPath}/agents/`:
314
-
315
- - `coordinator.md` - Always generated
316
- - `fe.md` - If React/Vue/Angular detected
317
- - `be.md` - If Express/Fastify/Django detected
318
- - `qa.md` - If tests detected
319
-
320
- ---
321
-
322
- ## Step 9: Log to Memory
323
-
324
- APPEND to: `{globalPath}/memory/context.jsonl`
357
+ APPEND to: `{globalPath}/memory/events.jsonl`
325
358
 
326
359
  ```json
327
- {"ts":"{GetTimestamp()}","action":"sync","branch":"{currentBranch}","uncommitted":{hasUncommittedChanges},"tasksCompleted":{completedTaskCount},"fileCount":{fileCount},"commitCount":{commitCount}}
360
+ {"ts":"{GetTimestamp()}","action":"sync","branch":"{currentBranch}","uncommitted":{hasUncommittedChanges},"fileCount":{fileCount},"commitCount":{commitCount}}
328
361
  ```
329
362
 
330
363
  ---
@@ -345,24 +378,15 @@ APPEND to: `{globalPath}/memory/context.jsonl`
345
378
  ├── Uncommitted: {hasUncommittedChanges ? "Yes - " + modifiedCount + " files" : "Clean"}
346
379
  └── Recent: {recentCommitCount} commits this week
347
380
 
348
- Tasks Synced
349
- ├── Completed (from commits): {completedTaskCount}
350
- ├── Removed from queue: {removedFromQueue}
351
- └── Added to shipped: {addedToShipped}
352
-
353
- 📁 Files Updated
354
- ├── core/now.md
355
- ├── core/next.md
356
- ├── progress/shipped.md
357
- ├── planning/ideas.md
358
- ├── planning/roadmap.md
359
- ├── project.json
360
- ├── CLAUDE.md
361
- └── analysis/*.md
381
+ 📁 Context Updated
382
+ ├── context/now.md
383
+ ├── context/next.md
384
+ ├── context/ideas.md
385
+ ├── context/shipped.md
386
+ └── context/CLAUDE.md
362
387
 
363
388
  {IF hasUncommittedChanges}
364
- ⚠️ You have uncommitted changes:
365
- {changesDescription}
389
+ ⚠️ You have uncommitted changes
366
390
 
367
391
  Next: Commit your work or continue coding
368
392
  {ELSE}
@@ -385,60 +409,25 @@ Next: /p:now to start a new task
385
409
 
386
410
  ---
387
411
 
388
- ## Examples
389
-
390
- ### Example: Clean repo, tasks completed
391
- ```
392
- 🔄 Deep Sync Complete
393
-
394
- 📊 Project Stats
395
- ├── Files: 156
396
- ├── Commits: 234
397
- ├── Version: 1.2.0
398
- └── Stack: TypeScript + React + Node.js
399
-
400
- 🌿 Git Status
401
- ├── Branch: main
402
- ├── Uncommitted: Clean
403
- └── Recent: 8 commits this week
404
-
405
- ✅ Tasks Synced
406
- ├── Completed (from commits): 3
407
- ├── Removed from queue: 2
408
- └── Added to shipped: 3
409
-
410
- 📁 Files Updated
411
- ├── core/now.md (cleared - task completed)
412
- ├── core/next.md (2 tasks removed)
413
- ├── progress/shipped.md (+3 entries)
414
- └── All metadata updated
415
-
416
- ✨ Repository is clean!
417
-
418
- Next: /p:now to start a new task
419
- ```
412
+ ## File Structure Reference
420
413
 
421
- ### Example: Work in progress
422
414
  ```
423
- 🔄 Deep Sync Complete
424
-
425
- 📊 Project Stats
426
- ├── Files: 156
427
- ├── Commits: 234
428
- ├── Version: 1.2.0
429
- └── Stack: TypeScript + React + Node.js
430
-
431
- 🌿 Git Status
432
- ├── Branch: feature/auth
433
- ├── Uncommitted: Yes - 5 files
434
- └── Recent: 3 commits today
435
-
436
- ⚠️ You have uncommitted changes:
437
- M src/auth/login.tsx
438
- M src/auth/signup.tsx
439
- A src/auth/utils.ts
440
-
441
- Working on: Authentication module
442
-
443
- Next: Commit your work or continue coding
415
+ ~/.prjct-cli/projects/{projectId}/
416
+ ├── storage/ # Source of Truth (JSON)
417
+ │ ├── state.json # Current + paused task
418
+ ├── queue.json # Task queue
419
+ ├── ideas.json # Ideas list
420
+ │ └── shipped.json # Shipped features
421
+ ├── context/ # For Claude (MD)
422
+ │ ├── CLAUDE.md # Full context
423
+ │ ├── now.md # Current task
424
+ ├── next.md # Queue
425
+ ├── ideas.md # Ideas
426
+ └── shipped.md # Shipped
427
+ ├── sync/ # Backend Sync
428
+ │ └── pending.json # Events queue
429
+ ├── agents/ # Specialists
430
+ ├── memory/ # Audit Trail
431
+ └── events.jsonl
432
+ └── project.json # Metadata
444
433
  ```
@@ -2,6 +2,8 @@
2
2
  allowed-tools: [Read, Write, Bash]
3
3
  description: 'Undo last changes by restoring previous snapshot'
4
4
  timestamp-rule: 'GetTimestamp() for ALL timestamps'
5
+ architecture: 'Write-Through (JSON → MD → Events)'
6
+ storage-layer: true
5
7
  ---
6
8
 
7
9
  # /p:undo - Revert to Previous Snapshot
@@ -13,7 +15,7 @@ Reverts the project to the previous snapshot state. Uses Git-based snapshots sto
13
15
  - `{projectId}`: From `.prjct/prjct.config.json`
14
16
  - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
15
17
  - `{snapshotDir}`: `{globalPath}/snapshots`
16
- - `{memoryPath}`: `{globalPath}/memory/context.jsonl`
18
+ - `{memoryPath}`: `{globalPath}/memory/events.jsonl`
17
19
 
18
20
  ## Step 1: Read Config
19
21
 
@@ -29,7 +31,7 @@ IF file not found:
29
31
  BASH: `cd ~/.prjct-cli/projects/{projectId}/snapshots && git log --oneline -5 2>/dev/null || echo "NO_SNAPSHOTS"`
30
32
 
31
33
  IF output contains "NO_SNAPSHOTS" OR empty:
32
- OUTPUT: "⚠️ No snapshots available. Create one with /p:ship first."
34
+ OUTPUT: "No snapshots available. Create one with /p:ship first."
33
35
  STOP
34
36
 
35
37
  CAPTURE last two lines as:
@@ -37,7 +39,7 @@ CAPTURE last two lines as:
37
39
  - {previousHash}: Second line (snapshot to restore)
38
40
 
39
41
  IF only one snapshot exists:
40
- OUTPUT: "⚠️ Only one snapshot exists. Nothing to undo."
42
+ OUTPUT: "Only one snapshot exists. Nothing to undo."
41
43
  STOP
42
44
 
43
45
  ## Step 3: Get Current State Info
@@ -139,7 +141,7 @@ Files affected: 5
139
141
 
140
142
  ### Example 2: Nothing to Undo
141
143
  ```
142
- ⚠️ Only one snapshot exists. Nothing to undo.
144
+ Only one snapshot exists. Nothing to undo.
143
145
 
144
146
  Create more snapshots with /p:ship
145
147
  ```
@@ -2,7 +2,26 @@
2
2
  "mcpServers": {
3
3
  "context7": {
4
4
  "command": "npx",
5
- "args": ["-y", "@upstash/context7-mcp@latest"]
5
+ "args": ["-y", "@upstash/context7-mcp@latest"],
6
+ "description": "Library documentation lookup - use for framework/library docs"
7
+ }
8
+ },
9
+ "usage": {
10
+ "context7": {
11
+ "when": [
12
+ "Looking up official documentation for any library/framework",
13
+ "Implementing features using specific libraries (React, Next.js, etc)",
14
+ "Checking API references and best practices",
15
+ "Troubleshooting library-specific issues"
16
+ ],
17
+ "tools": [
18
+ "resolve-library-id: Find library ID from name (e.g., 'react' → '/facebook/react')",
19
+ "get-library-docs: Fetch documentation for a library ID"
20
+ ],
21
+ "examples": [
22
+ "resolve-library-id('nextjs') → get-library-docs('/vercel/next.js', 'app router')",
23
+ "resolve-library-id('tailwindcss') → get-library-docs('/tailwindlabs/tailwindcss', 'configuration')"
24
+ ]
6
25
  }
7
26
  }
8
27
  }
@@ -1,76 +0,0 @@
1
- /**
2
- * Agents Manager
3
- *
4
- * Manages agents.json - specialized AI agents.
5
- */
6
-
7
- import { ArrayManager } from './base-manager'
8
- import type { AgentSchema, AgentsSchema } from '../schemas'
9
- import { DEFAULT_AGENT } from '../schemas'
10
-
11
- class AgentsManager extends ArrayManager<AgentSchema> {
12
- constructor() {
13
- super('agents.json')
14
- }
15
-
16
- async getAgents(projectId: string): Promise<AgentsSchema> {
17
- return this.read(projectId)
18
- }
19
-
20
- async getAgent(projectId: string, name: string): Promise<AgentSchema | undefined> {
21
- return this.find(projectId, (agent) => agent.name === name)
22
- }
23
-
24
- async addAgent(
25
- projectId: string,
26
- agent: Pick<AgentSchema, 'name' | 'description'> & Partial<AgentSchema>
27
- ): Promise<AgentsSchema> {
28
- const fullAgent: AgentSchema = {
29
- ...DEFAULT_AGENT,
30
- ...agent
31
- }
32
- return this.add(projectId, fullAgent)
33
- }
34
-
35
- async updateAgent(
36
- projectId: string,
37
- name: string,
38
- updates: Partial<AgentSchema>
39
- ): Promise<AgentsSchema> {
40
- return this.updateItem(
41
- projectId,
42
- (agent) => agent.name === name,
43
- (agent) => ({ ...agent, ...updates })
44
- )
45
- }
46
-
47
- async removeAgent(projectId: string, name: string): Promise<AgentsSchema> {
48
- return this.remove(projectId, (agent) => agent.name === name)
49
- }
50
-
51
- async setAgents(projectId: string, agents: AgentsSchema): Promise<void> {
52
- await this.write(projectId, agents)
53
- }
54
-
55
- async incrementTasksCompleted(projectId: string, name: string): Promise<AgentsSchema> {
56
- return this.updateItem(
57
- projectId,
58
- (agent) => agent.name === name,
59
- (agent) => ({
60
- ...agent,
61
- tasksCompleted: (agent.tasksCompleted || 0) + 1
62
- })
63
- )
64
- }
65
-
66
- async updateSuccessRate(
67
- projectId: string,
68
- name: string,
69
- successRate: number
70
- ): Promise<AgentsSchema> {
71
- return this.updateAgent(projectId, name, { successRate })
72
- }
73
- }
74
-
75
- export const agentsManager = new AgentsManager()
76
- export default agentsManager