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,23 +2,32 @@
2
2
  allowed-tools: [Read, Write, Bash]
3
3
  description: 'Ship feature with automated workflow'
4
4
  timestamp-rule: 'GetTimestamp() and GetDate() 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/shipped.json'
8
+ claude-context: 'context/shipped.md'
9
+ backend-sync: 'sync/pending.json'
6
10
  ---
7
11
 
8
12
  # /p:ship - Ship Feature Workflow
9
13
 
10
- ## Architecture: MD-First
14
+ ## Architecture: Write-Through Pattern
11
15
 
12
- **Source of Truth**: `progress/shipped.md`, `planning/roadmap.md`
16
+ ```
17
+ User Action → Storage (JSON) → Context (MD) → Sync Events
18
+ ```
13
19
 
14
- MD files are the source of truth. Write directly to MD files.
20
+ **Source of Truth**: `storage/shipped.json`
21
+ **Claude Context**: `context/shipped.md` (generated)
22
+ **Backend Sync**: `sync/pending.json` (events)
15
23
 
16
24
  ## Context Variables
17
25
  - `{projectId}`: From `.prjct/prjct.config.json`
18
26
  - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
19
- - `{shippedPath}`: `{globalPath}/progress/shipped.md`
20
- - `{roadmapPath}`: `{globalPath}/planning/roadmap.md`
21
- - `{memoryPath}`: `{globalPath}/memory/context.jsonl`
27
+ - `{shippedStoragePath}`: `{globalPath}/storage/shipped.json`
28
+ - `{shippedContextPath}`: `{globalPath}/context/shipped.md`
29
+ - `{syncPath}`: `{globalPath}/sync/pending.json`
30
+ - `{memoryPath}`: `{globalPath}/memory/events.jsonl`
22
31
  - `{snapshotDir}`: `{globalPath}/snapshots`
23
32
  - `{feature}`: User-provided feature name
24
33
  - `{outcome}`: User-provided outcome status (optional)
@@ -35,14 +44,6 @@ Track what happened after shipping:
35
44
 
36
45
  If no outcome provided, default to `monitoring`.
37
46
 
38
- Prompt (optional):
39
- ```
40
- Ship outcome? (default: monitoring)
41
- 1. validated - Confirmed working
42
- 2. monitoring - Watching metrics
43
- 3. known-issues - Has minor issues
44
- ```
45
-
46
47
  ## Step 1: Read Config
47
48
 
48
49
  READ: `.prjct/prjct.config.json`
@@ -70,7 +71,6 @@ IF not a git repo:
70
71
 
71
72
  ### Lint Check
72
73
  BASH: `npm run lint 2>&1 || echo "LINT_SKIP"`
73
-
74
74
  CAPTURE output as {lintResult}
75
75
 
76
76
  IF contains "LINT_SKIP" OR contains "missing script":
@@ -82,7 +82,6 @@ ELSE:
82
82
 
83
83
  ### Test Check
84
84
  BASH: `npm test 2>&1 || echo "TEST_SKIP"`
85
-
86
85
  CAPTURE output as {testResult}
87
86
 
88
87
  IF contains "TEST_SKIP" OR contains "missing script":
@@ -96,118 +95,42 @@ ELSE:
96
95
 
97
96
  ## Step 4: Version Bump (MANDATORY)
98
97
 
99
- **CRITICAL**: Version bump is ALWAYS required. No exceptions.
100
-
101
- ### Read Current Version (Language Agnostic)
102
-
103
- Detect project type and read version from appropriate file:
98
+ ### Read Current Version
99
+ Detect project type and read version:
104
100
 
105
101
  | File | Language | Version Location |
106
102
  |------|----------|------------------|
107
103
  | `package.json` | Node.js | `"version": "X.Y.Z"` |
108
104
  | `Cargo.toml` | Rust | `version = "X.Y.Z"` |
109
105
  | `pyproject.toml` | Python | `version = "X.Y.Z"` |
110
- | `go.mod` | Go | Use git tags |
111
106
  | `VERSION` | Any | Plain text `X.Y.Z` |
112
107
 
113
- BASH: Check which config exists:
114
- ```bash
115
- ls package.json Cargo.toml pyproject.toml VERSION 2>/dev/null | head -1
116
- ```
117
-
118
- READ appropriate file and EXTRACT: {currentVersion}
119
-
120
- IF no version file found:
121
- CREATE: `VERSION` file with content `0.0.0`
122
- {currentVersion} = "0.0.0"
123
-
124
108
  ### Determine Bump Type
125
-
126
109
  BASH: `git log --oneline -10`
127
110
 
128
- ANALYZE commit messages:
129
-
130
111
  IF any commit contains "BREAKING" OR "major:":
131
112
  {bumpType} = "major"
132
- {newVersion} = increment X in X.Y.Z, set Y=0, Z=0
133
-
134
113
  ELSE IF any commit contains "feat:" OR "feature:":
135
114
  {bumpType} = "minor"
136
- {newVersion} = increment Y in X.Y.Z, set Z=0
137
-
138
115
  ELSE:
139
116
  {bumpType} = "patch"
140
- {newVersion} = increment Z in X.Y.Z
141
-
142
- ### Update Version File (MANDATORY)
143
-
144
- Update the same file where version was read:
145
- - `package.json`: Update `"version"` field
146
- - `Cargo.toml`: Update `version` in `[package]`
147
- - `pyproject.toml`: Update `version` in `[project]`
148
- - `VERSION`: Replace entire content
149
117
 
150
- WRITE the updated file.
151
-
152
- **This step MUST complete. If it fails, STOP and report error.**
118
+ ### Update Version File
119
+ Update the version file with {newVersion}
153
120
 
154
121
  ## Step 5: Update CHANGELOG (MANDATORY)
155
122
 
156
- **CRITICAL**: CHANGELOG.md MUST be created/updated. No exceptions.
157
-
158
- ### Check if CHANGELOG exists
159
-
160
- BASH: `ls CHANGELOG.md 2>/dev/null || echo "NOT_FOUND"`
161
-
162
- IF "NOT_FOUND":
163
- CREATE new CHANGELOG.md with header:
164
- ```markdown
165
- # Changelog
166
-
167
- All notable changes to this project will be documented in this file.
168
-
169
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
170
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
171
-
172
- ```
173
-
174
- ### Get Recent Commits for Changelog
175
-
123
+ ### Get Recent Commits
176
124
  BASH: `git log --oneline -20 --pretty=format:"- %s"`
177
125
  CAPTURE as {commitList}
178
126
 
179
- ### Format New Entry
180
-
181
- ```markdown
182
- ## [{newVersion}] - {GetDate()}
183
-
184
- ### {feature}
185
-
186
- #### Changes
187
- {commitList}
188
-
189
- #### Quality
190
- - Lint: {lintStatus}
191
- - Tests: {testStatus}
192
-
193
- ---
194
-
195
- ```
196
-
197
- ### Insert Entry
198
-
199
- READ: `CHANGELOG.md`
200
- INSERT new entry after "# Changelog" header (or after the preamble text)
201
- WRITE: `CHANGELOG.md`
202
-
203
- **This step MUST complete. CHANGELOG.md MUST exist in repo after ship.**
127
+ ### Create/Update CHANGELOG.md
128
+ INSERT new entry after header.
204
129
 
205
130
  ## Step 6: Git Commit
206
131
 
207
- ### Stage Changes
208
132
  BASH: `git add .`
209
133
 
210
- ### Create Commit
211
134
  BASH: `git commit -m "$(cat <<'EOF'
212
135
  feat: Ship {feature} v{newVersion}
213
136
 
@@ -220,141 +143,116 @@ EOF
220
143
 
221
144
  BASH: `git push 2>&1`
222
145
 
223
- CAPTURE output as {pushResult}
224
-
225
146
  IF contains "rejected" OR contains "failed":
226
147
  OUTPUT: "⚠️ Push failed. Try: git pull --rebase && git push"
227
- CONTINUE (don't stop)
148
+ CONTINUE
228
149
 
229
- IF contains "no upstream":
230
- BASH: `git push -u origin HEAD`
231
-
232
- ## Step 8: Update Shipped (MD)
150
+ ## Step 8: Update Storage (SOURCE OF TRUTH)
233
151
 
234
152
  SET: {now} = GetTimestamp()
235
- GENERATE: {shipId} = "ship_" + 8 random alphanumeric chars
236
-
237
- READ: `{shippedPath}` (or create default if not exists)
238
-
239
- Default structure:
240
- ```markdown
241
- # Shipped
242
-
243
- ## Recent
153
+ GENERATE: {shipId} = UUID v4
244
154
 
245
- _Nothing shipped yet_
246
-
247
- ## Archive
155
+ ### Read existing shipped
156
+ READ: `{shippedStoragePath}` or create default:
157
+ ```json
158
+ {
159
+ "shipped": [],
160
+ "lastUpdated": null
161
+ }
162
+ ```
248
163
 
249
- _No archived ships_
164
+ ### Create ship object
165
+ ```json
166
+ {
167
+ "id": "{shipId}",
168
+ "name": "{feature}",
169
+ "version": "{newVersion}",
170
+ "outcome": "{outcome}",
171
+ "shippedAt": "{now}",
172
+ "lint": "{lintStatus}",
173
+ "tests": "{testStatus}",
174
+ "commits": {commits}
175
+ }
250
176
  ```
251
177
 
252
- ### Get changes from git
253
- BASH: `git log --oneline -5`
254
- CAPTURE commit messages as {changes}
178
+ ### Update shipped.json
179
+ PREPEND new ship to shipped array
180
+ SET: lastUpdated = {now}
181
+ WRITE: `{shippedStoragePath}`
255
182
 
256
- ### Update shipped.md
183
+ ## Step 9: Generate Context (FOR CLAUDE)
257
184
 
258
- Parse existing content and add new ship under "## Recent" section:
185
+ WRITE: `{shippedContextPath}`
259
186
 
260
187
  ```markdown
261
- # Shipped
262
-
263
- ## Recent
188
+ # SHIPPED 🚀
264
189
 
265
- ### {feature} (v{newVersion})
266
- - **ID**: {shipId}
267
- - **Shipped**: {now}
268
- - **Outcome**: {outcome}
269
- - **Lint**: {lintStatus}
270
- - **Tests**: {testStatus}
271
- - **Changes**:
272
- {changes as bullet list}
190
+ ## {Month Year}
273
191
 
274
- {...existing recent ships}
192
+ {FOR EACH ship in shipped WHERE month matches:}
193
+ - **{ship.name}** v{ship.version} - {ship.shippedAt}
194
+ {END FOR}
275
195
 
276
- ## Archive
196
+ ---
277
197
 
278
- {...existing archive}
198
+ **Total shipped:** {shipped.length}
279
199
  ```
280
200
 
281
- WRITE: `{shippedPath}`
282
-
283
- ## Step 9: Update Roadmap Status (MD)
284
-
285
- READ: `{roadmapPath}`
286
-
287
- ### Find matching feature and update status
288
- Look for feature entry matching {feature}:
289
- - Change status from `pending` or `active` to `shipped`
290
- - Add `Shipped: {now}` line
291
- - Add `Version: {newVersion}` line
292
-
293
- WRITE: `{roadmapPath}`
201
+ ## Step 10: Queue Sync Event (FOR BACKEND)
294
202
 
295
- ## Step 10: Log to Memory
296
-
297
- APPEND to: `{memoryPath}`
298
-
299
- Single line (JSONL):
203
+ READ: `{syncPath}` or create empty array
204
+ APPEND event:
300
205
  ```json
301
- {"timestamp":"{now}","action":"feature_shipped","shipId":"{shipId}","feature":"{feature}","version":"{newVersion}","outcome":"{outcome}"}
206
+ {
207
+ "type": "feature.shipped",
208
+ "path": ["shipped"],
209
+ "data": {
210
+ "shipId": "{shipId}",
211
+ "name": "{feature}",
212
+ "version": "{newVersion}",
213
+ "outcome": "{outcome}",
214
+ "shippedAt": "{now}"
215
+ },
216
+ "timestamp": "{now}",
217
+ "projectId": "{projectId}"
218
+ }
302
219
  ```
220
+ WRITE: `{syncPath}`
303
221
 
304
- ## Step 11: Create Snapshot (Undo/Redo Support)
305
-
306
- This creates a snapshot for the undo/redo system.
222
+ ## Step 11: Log to Daily Session
307
223
 
308
- ### Initialize Snapshot Directory
309
- BASH: `mkdir -p {snapshotDir}`
224
+ GET: {date} = YYYY-MM-DD from {now}
225
+ GET: {yearMonth} = YYYY-MM from {now}
226
+ SET: {dailySessionPath} = `{globalPath}/progress/sessions/{yearMonth}/{date}.jsonl`
310
227
 
311
- ### Check if Git Repo Exists
312
- BASH: `ls {snapshotDir}/.git 2>/dev/null || echo "INIT_NEEDED"`
228
+ BASH: `mkdir -p {globalPath}/progress/sessions/{yearMonth}`
313
229
 
314
- IF output contains "INIT_NEEDED":
315
- BASH: `cd {snapshotDir} && git init && git config user.email "prjct@local" && git config user.name "prjct-snapshots" && git commit --allow-empty -m "init: snapshot system"`
316
-
317
- ### Copy Changed Files to Snapshot
318
- BASH: `git diff --name-only HEAD~1 2>/dev/null || git diff --name-only`
319
- CAPTURE as {changedFiles}
320
-
321
- For each file in {changedFiles}:
322
- - Source: `{projectPath}/{file}`
323
- - Destination: `{snapshotDir}/{file}`
324
- - Create parent directories if needed
325
- - Copy file content
326
-
327
- ### Commit Snapshot
328
- BASH: `cd {snapshotDir} && git add -A && git commit -m "Ship: {feature} (v{newVersion})" 2>/dev/null || echo "NO_CHANGES"`
329
-
330
- ### Get Snapshot Hash
331
- BASH: `cd {snapshotDir} && git rev-parse --short HEAD`
332
- CAPTURE as {snapshotHash}
333
-
334
- ### Clear Redo Stack (new snapshot invalidates redo)
335
- WRITE: `{snapshotDir}/redo-stack.json`
336
- Content: `[]`
230
+ APPEND to: `{dailySessionPath}`
231
+ ```json
232
+ {"ts":"{now}","type":"feature_ship","name":"{feature}","version":"{newVersion}"}
233
+ ```
337
234
 
338
- ### Log Snapshot
339
- APPEND to: `{snapshotDir}/manifest.jsonl`
235
+ ## Step 12: Log to Memory (AUDIT TRAIL)
340
236
 
341
- Single line (JSONL):
237
+ APPEND to: `{memoryPath}`
342
238
  ```json
343
- {"type":"snapshot","hash":"{snapshotHash}","message":"Ship: {feature}","version":"{newVersion}","timestamp":"{GetTimestamp()}"}
239
+ {"timestamp":"{now}","action":"feature_shipped","shipId":"{shipId}","feature":"{feature}","version":"{newVersion}","outcome":"{outcome}"}
344
240
  ```
345
241
 
346
- ## Step 12: Run Deep Sync
242
+ ## Step 13: Update project.json
243
+
244
+ SET: {projectJsonPath} = `{globalPath}/project.json`
347
245
 
348
- **CRITICAL**: After shipping, run a full sync to update ALL project data.
246
+ READ: `{projectJsonPath}`
247
+ UPDATE:
248
+ - `"version"`: Set to `{newVersion}`
249
+ - `"hasUncommittedChanges"`: Set to `false`
250
+ - `"lastSync"`: Set to `{now}`
251
+ WRITE: `{projectJsonPath}`
349
252
 
350
- Execute `/p:sync` logic:
351
- - Update `project.json` with new version, commit count
352
- - Update `CLAUDE.md` Quick Reference table
353
- - Sync `core/now.md` (clear completed task)
354
- - Sync `core/next.md` (remove shipped items)
355
- - Update all stats and metadata
253
+ ## Step 14: Run Deep Sync
356
254
 
357
- This ensures the dashboard reflects the latest state after shipping.
255
+ Execute `/p:sync` logic to update all context files.
358
256
 
359
257
  ## Output
360
258
 
@@ -367,12 +265,8 @@ Outcome: {outcome}
367
265
  Lint: {lintStatus}
368
266
  Tests: {testStatus}
369
267
  Commit: {commitHash}
370
- Snapshot: {snapshotHash}
371
268
 
372
269
  🔄 Synced project data
373
- ├── Files: {fileCount}
374
- ├── Commits: {commitCount}
375
- └── All MD files updated
376
270
 
377
271
  Next:
378
272
  • /p:undo - Revert this ship if needed
@@ -389,18 +283,11 @@ Next:
389
283
  | Lint fails | Show warning | CONTINUE |
390
284
  | Tests fail | Show warning | CONTINUE |
391
285
  | Push fails | Show fix command | CONTINUE |
392
- | No version file | CREATE `VERSION` file | CONTINUE |
393
286
  | Version bump fails | "Failed to update version" | STOP |
394
- | CHANGELOG fails | "Failed to update changelog" | STOP |
395
-
396
- **MANDATORY outputs (never skip):**
397
- - Version file updated (package.json, Cargo.toml, pyproject.toml, or VERSION)
398
- - `CHANGELOG.md` with new entry
399
- - Git commit with version in message
400
287
 
401
288
  ## Examples
402
289
 
403
- ### Example 1: Full Success (validated)
290
+ ### Example 1: Full Success
404
291
  ```
405
292
  🚀 Shipped: user authentication
406
293
 
@@ -410,10 +297,10 @@ Lint: passed
410
297
  Tests: passed
411
298
  Commit: abc1234
412
299
 
413
- Next: /p:feature | /p:recap | compact
300
+ Next: /p:feature | /p:recap
414
301
  ```
415
302
 
416
- ### Example 2: With Warnings (monitoring)
303
+ ### Example 2: With Warnings
417
304
  ```
418
305
  🚀 Shipped: bug fixes
419
306
 
@@ -425,20 +312,5 @@ Commit: def5678
425
312
 
426
313
  ⚠️ Consider fixing lint warnings
427
314
 
428
- Next: /p:feature | /p:recap | compact
429
- ```
430
-
431
- ### Example 3: Known Issues
432
- ```
433
- 🚀 Shipped: performance updates
434
-
435
- Version: 1.2.0 → 1.2.1
436
- Outcome: known-issues
437
- Lint: passed
438
- Tests: passed
439
- Commit: ghi9012
440
-
441
- Note: Minor edge case in Safari, tracking issue #45
442
-
443
- Next: /p:feature | /p:recap | compact
315
+ Next: /p:feature | /p:recap
444
316
  ```
@@ -3,19 +3,36 @@ allowed-tools: [Read, Write, Glob, GetTimestamp, GetDate]
3
3
  description: 'Spec-driven development for complex features'
4
4
  timestamp-rule: 'GetTimestamp() and GetDate() for ALL timestamps'
5
5
  think-triggers: [explore_to_edit, complex_analysis]
6
+ architecture: 'Write-Through (JSON → MD → Events)'
7
+ storage-layer: true
8
+ source-of-truth: 'storage/specs.json'
9
+ claude-context: 'context/specs/'
6
10
  ---
7
11
 
8
- # /p:spec
12
+ # /p:spec - Spec-Driven Development
9
13
 
10
14
  Spec-Driven Development. Creates detailed specifications for complex features before implementation.
11
15
 
16
+ ## Architecture: Write-Through Pattern
17
+
18
+ **Source of Truth**: `storage/specs.json`
19
+ **Claude Context**: `context/specs/{slug}.md` (generated)
20
+
12
21
  ## Think First
22
+
13
23
  Before creating spec, analyze:
14
24
  1. Is this feature complex enough for a spec? (auth, payments, migrations = yes)
15
25
  2. What are the key architectural decisions to make?
16
26
  3. Are there multiple valid approaches? Document tradeoffs.
17
27
  4. What questions should I ask the user before proceeding?
18
28
 
29
+ ## Context Variables
30
+ - `{projectId}`: From `.prjct/prjct.config.json`
31
+ - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
32
+ - `{specsStoragePath}`: `{globalPath}/storage/specs.json`
33
+ - `{specsContextPath}`: `{globalPath}/context/specs/`
34
+ - `{queuePath}`: `{globalPath}/storage/queue.json`
35
+
19
36
  ## Purpose
20
37
 
21
38
  For features that require:
@@ -38,9 +55,9 @@ For features that require:
38
55
  /p:spec "Dark Mode"
39
56
  1. Analyze: Context, patterns, dependencies
40
57
  2. Propose: Requirements + Design + Tasks
41
- 3. Write: `planning/specs/{slug}.md`
58
+ 3. Write: `storage/specs.json` + generate `context/specs/{slug}.md`
42
59
  4. Ask: User approval
43
- 5. On approve: Add tasks to queue, start first
60
+ 5. On approve: Add tasks to `storage/queue.json`, start first
44
61
  ```
45
62
 
46
63
  ## Spec Structure
@@ -73,6 +90,28 @@ For features that require:
73
90
  - {edge cases to consider}
74
91
  ```
75
92
 
93
+ ## Storage Format
94
+
95
+ ### storage/specs.json
96
+ ```json
97
+ {
98
+ "specs": [
99
+ {
100
+ "id": "{specId}",
101
+ "name": "{feature}",
102
+ "slug": "{feature-slug}",
103
+ "status": "PENDING_APPROVAL",
104
+ "requirements": [...],
105
+ "design": {...},
106
+ "tasks": [...],
107
+ "createdAt": "{timestamp}",
108
+ "approvedAt": null
109
+ }
110
+ ],
111
+ "lastUpdated": "{timestamp}"
112
+ }
113
+ ```
114
+
76
115
  ## Validation
77
116
 
78
117
  - Feature name required for creation
@@ -80,11 +119,6 @@ For features that require:
80
119
  - Each task should be 20-30 minutes
81
120
  - Check for existing spec with same name
82
121
 
83
- ## Data
84
-
85
- Session: `{"ts":"{GetTimestamp()}","type":"spec_create","name":"{feature}","requirements":{n},"tasks":{n},"effort":"{Xh}"}`
86
- Spec file: `planning/specs/{feature-slug}.md`
87
-
88
122
  ## Response
89
123
 
90
124
  ### On creation:
@@ -126,3 +160,59 @@ Use /p:done when complete
126
160
  → Breaks into: toggle, state, styles, persist, test
127
161
  → Estimates ~3h total
128
162
  ```
163
+
164
+ ## Decision Logging (absorbed from /p:decision)
165
+
166
+ Specs now capture architectural decisions inline. When making design choices:
167
+
168
+ ### Decision Format
169
+
170
+ ```
171
+ /p:spec "API Design"
172
+
173
+ [During spec creation, capture decisions:]
174
+
175
+ Decision: Use REST instead of GraphQL
176
+ Reasoning: Simpler for this use case, team familiarity
177
+ Alternatives: GraphQL, gRPC
178
+ ```
179
+
180
+ ### Storage
181
+
182
+ Decisions are stored in the spec itself:
183
+ ```json
184
+ {
185
+ "id": "{specId}",
186
+ "name": "{feature}",
187
+ "decisions": [
188
+ {
189
+ "id": "{decisionId}",
190
+ "decision": "Use REST instead of GraphQL",
191
+ "reasoning": "Simpler for this use case",
192
+ "alternatives": ["GraphQL", "gRPC"],
193
+ "createdAt": "{timestamp}"
194
+ }
195
+ ]
196
+ }
197
+ ```
198
+
199
+ ### Response (with decisions)
200
+ ```
201
+ 📝 Decision logged: Use REST instead of GraphQL
202
+
203
+ ID: {decisionId}
204
+ Reasoning: Simpler for this use case
205
+ Alternatives: GraphQL, gRPC
206
+
207
+ This creates institutional memory to avoid:
208
+ - Repeating the same debates
209
+ - Forgetting why something was done a certain way
210
+ - Making inconsistent choices
211
+ ```
212
+
213
+ ## Natural Language Support
214
+
215
+ - "p. spec" → Interactive spec creation
216
+ - "p. spec dark mode" → Create spec for dark mode
217
+ - "p. design spec auth" → Create spec for auth
218
+ - "p. decision use postgres" → Log decision (now part of spec)
@@ -1,17 +1,37 @@
1
1
  ---
2
2
  allowed-tools: [Read]
3
3
  description: 'Context-aware suggestions based on project state and momentum'
4
+ architecture: 'Write-Through (JSON → MD → Events)'
5
+ storage-layer: true
6
+ source-of-truth: 'storage/*.json'
4
7
  ---
5
8
 
6
- # /p:suggest
9
+ # /p:suggest - Context-Aware Suggestions
10
+
11
+ ## Architecture: Write-Through Pattern
12
+
13
+ Reads from **Storage (JSON)** as source of truth.
14
+
15
+ **Source of Truth**:
16
+ - `storage/state.json` - Current task
17
+ - `storage/queue.json` - Task queue
18
+ - `storage/shipped.json` - Shipped features
7
19
 
8
20
  ## Purpose
9
21
 
10
22
  Analyze project state and recommend next actions based on current task, queue, last ship time, velocity, and momentum patterns.
11
23
 
24
+ ## Context Variables
25
+ - `{projectId}`: From `.prjct/prjct.config.json`
26
+ - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
27
+ - `{statePath}`: `{globalPath}/storage/state.json`
28
+ - `{queuePath}`: `{globalPath}/storage/queue.json`
29
+ - `{shippedPath}`: `{globalPath}/storage/shipped.json`
30
+ - `{sessionsPath}`: `{globalPath}/progress/sessions`
31
+
12
32
  ## Flow
13
33
 
14
- 1. **Read state files**: `core/now.md`, `core/next.md`, `progress/shipped.md`, `planning/roadmap.md`, sessions (last 7 days)
34
+ 1. **Read storage files**: `storage/state.json`, `storage/queue.json`, `storage/shipped.json`, sessions (last 7 days)
15
35
  2. **Calculate metrics**: Days since ship, active task duration, queue size, velocity (features/week), completion rate
16
36
  3. **Detect patterns**: Long-running task (>1 day), stale queue, high velocity, low activity, blocked
17
37
  4. **Generate recommendations**: Immediate action, urgency alerts, momentum tips, strategic suggestions