prjct-cli 0.13.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +106 -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/ship.md +103 -231
  160. package/templates/commands/spec.md +98 -8
  161. package/templates/commands/suggest.md +22 -2
  162. package/templates/commands/sync.md +192 -203
  163. package/templates/commands/undo.md +6 -4
  164. package/core/data/agents-manager.ts +0 -76
  165. package/core/data/analysis-manager.ts +0 -83
  166. package/core/data/base-manager.ts +0 -156
  167. package/core/data/ideas-manager.ts +0 -81
  168. package/core/data/outcomes-manager.ts +0 -96
  169. package/core/data/project-manager.ts +0 -75
  170. package/core/data/roadmap-manager.ts +0 -118
  171. package/core/data/shipped-manager.ts +0 -65
  172. package/core/data/state-manager.ts +0 -214
  173. package/core/state/index.ts +0 -25
  174. package/core/state/manager.ts +0 -376
  175. package/core/state/types.ts +0 -185
  176. package/core/utils/project-capabilities.ts +0 -156
  177. package/core/view-generator.ts +0 -536
  178. package/packages/web/app/project/[id]/stats/loading.tsx +0 -43
  179. package/packages/web/app/project/[id]/stats/page.tsx +0 -253
  180. package/templates/agent-assignment.md +0 -72
  181. package/templates/analysis/project-analysis.md +0 -78
  182. package/templates/checklists/accessibility.md +0 -33
  183. package/templates/commands/build.md +0 -17
  184. package/templates/commands/decision.md +0 -226
  185. package/templates/commands/fix.md +0 -79
  186. package/templates/commands/help.md +0 -61
  187. package/templates/commands/progress.md +0 -14
  188. package/templates/commands/recap.md +0 -14
  189. package/templates/commands/roadmap.md +0 -52
  190. package/templates/commands/status.md +0 -17
  191. package/templates/commands/task.md +0 -63
  192. package/templates/commands/work.md +0 -44
  193. package/templates/commands/workflow.md +0 -12
@@ -2,35 +2,116 @@
2
2
  allowed-tools: [Read, Write, Bash]
3
3
  description: 'Initialize prjct'
4
4
  timestamp-rule: 'GetTimestamp() for all timestamps'
5
+ architecture: 'Write-Through (JSON → MD → Events)'
6
+ storage-layer: true
5
7
  ---
6
8
 
7
- # /p:init
9
+ # /p:init - Initialize Project
10
+
11
+ ## Architecture: Write-Through Pattern
12
+
13
+ Creates the full storage structure for a new project.
8
14
 
9
15
  ## Context Variables
10
- - `{projectId}`: Generated unique ID (12 chars hex)
16
+ - `{projectId}`: Generated UUID (standard format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
11
17
  - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
12
18
  - `{cwd}`: Current working directory (repository path)
13
19
 
20
+ ## Project ID Format
21
+
22
+ **CRITICAL**: Project IDs MUST be standard UUIDs for PostgreSQL consistency.
23
+
24
+ ```
25
+ Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
26
+ Example: 550e8400-e29b-41d4-a716-446655440000
27
+ ```
28
+
29
+ Generate using: `crypto.randomUUID()`
30
+
14
31
  ## Flow
15
32
 
16
- **Existing**: ID → dirs → config → analyze → agents
17
- **Blank + idea**: ARCHITECT → analyze → recommend stack → create → roadmap
33
+ 1. **Check existing**: Read `.prjct/prjct.config.json`
34
+ 2. **Generate UUID**: Use `crypto.randomUUID()`
35
+ 3. **Create directories**: storage/, context/, sync/, agents/, memory/
36
+ 4. **Create config files**: local + global
37
+ 5. **Analyze project**: Detect stack, dependencies
38
+ 6. **Generate agents**: Based on detected stack
39
+
40
+ ## Directory Structure
41
+
42
+ ```
43
+ ~/.prjct-cli/projects/{projectId}/
44
+ ├── storage/ # Source of Truth (JSON)
45
+ │ ├── state.json # Current + paused task
46
+ │ ├── queue.json # Task queue
47
+ │ ├── ideas.json # Ideas list
48
+ │ └── shipped.json # Shipped features
49
+ ├── context/ # For Claude (MD)
50
+ │ ├── CLAUDE.md # Full context
51
+ │ ├── now.md # Current task
52
+ │ ├── next.md # Queue
53
+ │ ├── ideas.md # Ideas
54
+ │ └── shipped.md # Shipped
55
+ ├── sync/ # Backend Sync
56
+ │ └── pending.json # Events queue
57
+ ├── agents/ # Specialists
58
+ ├── memory/ # Audit Trail
59
+ │ └── events.jsonl
60
+ ├── progress/ # Historical Data
61
+ │ └── sessions/{YYYY-MM}/
62
+ └── project.json # Metadata
63
+ ```
64
+
65
+ ## Step: Create Storage Files
66
+
67
+ ### storage/state.json
68
+ ```json
69
+ {
70
+ "currentTask": null,
71
+ "pausedTask": null,
72
+ "previousTask": null,
73
+ "lastUpdated": null
74
+ }
75
+ ```
76
+
77
+ ### storage/queue.json
78
+ ```json
79
+ {
80
+ "tasks": [],
81
+ "lastUpdated": null
82
+ }
83
+ ```
84
+
85
+ ### storage/ideas.json
86
+ ```json
87
+ {
88
+ "ideas": [],
89
+ "lastUpdated": null
90
+ }
91
+ ```
18
92
 
19
- ## Structure
20
- `~/.prjct-cli/projects/{id}/`: core, progress, planning, analysis, agents, memory
93
+ ### storage/shipped.json
94
+ ```json
95
+ {
96
+ "shipped": [],
97
+ "lastUpdated": null
98
+ }
99
+ ```
21
100
 
22
- ## Config
23
- `.prjct/prjct.config.json`: version, projectId, dataPath, author
101
+ ### sync/pending.json
102
+ ```json
103
+ []
104
+ ```
24
105
 
25
106
  ## Step: Create project.json (REQUIRED)
26
107
 
27
- This file is the source of truth for the web dashboard. It maps projectId → repoPath.
108
+ This file is the source of truth for the web dashboard.
28
109
 
29
110
  ### Determine Project Name
30
111
  - Try package.json → `name` field
31
112
  - Try Cargo.toml → `[package] name`
32
113
  - Try pyproject.toml → `[project] name`
33
- - Fallback to directory name (last segment of current path)
114
+ - Fallback to directory name
34
115
 
35
116
  WRITE: `{globalPath}/project.json`
36
117
 
@@ -44,18 +125,41 @@ WRITE: `{globalPath}/project.json`
44
125
  }
45
126
  ```
46
127
 
128
+ ## Step: Create Local Config
129
+
130
+ WRITE: `.prjct/prjct.config.json`
131
+
132
+ ```json
133
+ {
134
+ "projectId": "{projectId}",
135
+ "dataPath": "~/.prjct-cli/projects/{projectId}"
136
+ }
137
+ ```
138
+
47
139
  ## Response
48
- `✅ Init | {stack} | {N} agents | Next: /p:feature or /p:help`
49
140
 
50
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
- 🎯 WHAT'S NEXT?
52
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
141
+ ```
142
+ Initialized prjct
143
+
144
+ Project ID: {projectId}
145
+ Data Path: ~/.prjct-cli/projects/{projectId}/
53
146
 
54
- 1. 🚀 Start first feature (RECOMMENDED) → /p:feature "{first_feature}"
55
- 2. 📊 See roadmap /p:roadmap
56
- 3. 🔍 Review structure → /p:recap
57
- 4. 💡 Modify plan → Just tell me
147
+ Structure:
148
+ ├── storage/ # JSON (source of truth)
149
+ ├── context/ # MD (for Claude)
150
+ ├── sync/ # Backend events
151
+ └── agents/ # Specialists
152
+
153
+ Next:
154
+ • /p:sync - Analyze project and generate agents
155
+ • /p:feature "{first_feature}" - Start first feature
156
+ • /p:help - See all commands
157
+ ```
58
158
 
59
- 💬 REMEMBER: Talk naturally! "Start with auth" / "Show roadmap" / "Add another feature"
159
+ ## Error Handling
60
160
 
61
- Ready to start building? 🚀
161
+ | Error | Response |
162
+ |-------|----------|
163
+ | Already initialized | Show existing projectId |
164
+ | Permission denied | Suggest chmod |
165
+ | Write fails | Show error |
@@ -1,61 +1,96 @@
1
1
  ---
2
2
  allowed-tools: [Read, Write, Bash]
3
- description: 'Migrate all legacy projects to global storage architecture'
3
+ description: 'Migrate all projects to UUID format'
4
4
  ---
5
5
 
6
6
  # /p:migrate-all
7
7
 
8
+ Migrate all projects to UUID format.
9
+
8
10
  ## Usage
9
11
 
10
12
  ```
11
- /p:migrate-all [--deep-scan] [--remove-legacy] [--dry-run]
13
+ /p:migrate-all [--deep-scan] [--dry-run]
12
14
  ```
13
15
 
14
16
  ## What It Does
15
17
 
16
- 1. **Scans global storage** → Reads all project IDs from `~/.prjct-cli/projects/`
17
- 2. **Detects legacy structure** → Checks each project for old `.prjct/` directory
18
- 3. **Migrates each project** → Moves data from local `.prjct/` to global storage
19
- 4. **Cleanup (optional)** → Removes legacy `.prjct/` directories (with `--remove-legacy`)
20
- 5. **Reports summary** → Shows migrated, skipped, failed counts
18
+ 1. **Scans global storage** → Lists all projects in `~/.prjct-cli/projects/`
19
+ 2. **Checks UUID format** → Identifies projects with non-UUID IDs
20
+ 3. **Migrates each project** → Renames folders and updates configs to UUID
21
+ 4. **Reports summary** → Shows migrated, skipped, failed counts
21
22
 
22
23
  ## Options
23
24
 
24
- - `--deep-scan`: Scan entire file system (slow but thorough)
25
- - `--remove-legacy`: Delete old `.prjct/` after successful migration
25
+ - `--deep-scan`: Also scan for projects in common locations
26
26
  - `--dry-run`: Show what would be migrated without making changes
27
27
 
28
- ## When to Use
28
+ ## Migration Flow
29
+
30
+ For each project:
31
+
32
+ 1. Read `project.json` to get current ID
33
+ 2. Check if ID is already UUID format
34
+ 3. If not UUID:
35
+ - Generate new UUID
36
+ - Rename folder to new UUID
37
+ - Update `project.json`
38
+ - Find and update linked `.prjct/prjct.config.json`
39
+
40
+ ## UUID Format
29
41
 
30
- - After major version updates (architecture changes)
31
- - Upgrading from v0.7.x to v0.8.x (new global storage)
32
- - Troubleshooting projects not working after update
42
+ Standard UUID: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` (36 chars)
43
+ Example: `550e8400-e29b-41d4-a716-446655440000`
33
44
 
34
- ## Migration: Before → After
45
+ ## Before → After
35
46
 
36
- **Before (Legacy)**:
47
+ **Before**:
37
48
  ```
38
- your-project/.prjct/ # All data locally
39
- core/, planning/, progress/, memory/, analysis/
49
+ ~/.prjct-cli/projects/
50
+ 3a5667a5dedb/ # Hash-based ID
51
+ abc12345/ # Short ID
40
52
  ```
41
53
 
42
- **After (Global)**:
54
+ **After**:
43
55
  ```
44
- your-project/.prjct/
45
- prjct.config.json # Minimal (projectId + dataPath only)
46
-
47
- ~/.prjct-cli/projects/{id}/
48
- core/, planning/, progress/, memory/, analysis/, agents/
56
+ ~/.prjct-cli/projects/
57
+ 550e8400-e29b-41d4-a716-446655440000/ # UUID
58
+ 7c9e6679-7425-40de-944b-e07fc1f90ae7/ # UUID
49
59
  ```
50
60
 
51
61
  ## Safety
52
62
 
53
- - **Idempotent**: Safe to run multiple times
54
- - **Non-destructive**: Original files only removed with `--remove-legacy`
63
+ - **Idempotent**: Safe to run multiple times (skips UUIDs)
64
+ - **Non-destructive**: Renames, doesn't delete
55
65
  - **Dry run**: Test with `--dry-run` first
56
- - **Automatic backup**: Legacy data preserved until explicitly removed
57
66
 
58
67
  ## Requirements
59
68
 
60
- - Write permissions to `~/.prjct-cli/` and project directories
61
- - Projects must have valid global config in `project.json`
69
+ - Write permissions to `~/.prjct-cli/`
70
+ - Projects must have valid `project.json`
71
+
72
+ ## Output
73
+
74
+ ```
75
+ 📦 UUID Migration
76
+
77
+ Scanning ~/.prjct-cli/projects/...
78
+
79
+ Found 5 projects:
80
+ - 3a5667a5dedb: Needs migration
81
+ - abc12345: Needs migration
82
+ - 550e8400-e29b-...: Already UUID ✓
83
+ - def67890: Needs migration
84
+ - 7c9e6679-7425-...: Already UUID ✓
85
+
86
+ Migrating 3 projects...
87
+
88
+ ✅ 3a5667a5dedb → 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
89
+ ✅ abc12345 → 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
90
+ ✅ def67890 → 2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e
91
+
92
+ Summary:
93
+ - Migrated: 3
94
+ - Skipped (already UUID): 2
95
+ - Failed: 0
96
+ ```
@@ -0,0 +1,140 @@
1
+ ---
2
+ allowed-tools: [Read, Write, Bash, Glob]
3
+ description: 'Migrate project to UUID format + sync'
4
+ ---
5
+
6
+ # /p:migrate - UUID Migration
7
+
8
+ Migrate project ID to UUID format and run full sync.
9
+
10
+ ## Context Variables
11
+
12
+ - `{projectId}`: Current ID from `.prjct/prjct.config.json`
13
+ - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
14
+
15
+ ## Step 1: Read Configuration
16
+
17
+ READ: `.prjct/prjct.config.json`
18
+ EXTRACT: `projectId`
19
+
20
+ IF file not found:
21
+ OUTPUT: "No prjct project. Run /p:init first."
22
+ STOP
23
+
24
+ ## Step 2: Check UUID Format
25
+
26
+ UUID format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` (36 chars with dashes)
27
+
28
+ IF projectId matches UUID regex `/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i`:
29
+ OUTPUT: "✅ Already UUID: {projectId}"
30
+ GOTO: Step 7 (Run Sync)
31
+
32
+ IF projectId does NOT match UUID format:
33
+ CONTINUE to Step 3
34
+
35
+ ## Step 3: Generate New UUID
36
+
37
+ Generate new UUID using Node.js `crypto.randomUUID()`.
38
+
39
+ Store:
40
+ - `{oldId}` = current projectId
41
+ - `{newId}` = generated UUID
42
+
43
+ ## Step 4: Show Migration Plan
44
+
45
+ OUTPUT:
46
+ ```
47
+ 📦 UUID Migration Plan
48
+
49
+ Current ID: {oldId} (non-UUID format)
50
+ New UUID: {newId}
51
+
52
+ Actions:
53
+ 1. Rename folder: ~/.prjct-cli/projects/{oldId}/ → ~/.prjct-cli/projects/{newId}/
54
+ 2. Update .prjct/prjct.config.json
55
+ 3. Update project.json
56
+ 4. Run /p:sync
57
+
58
+ Continue? (yes/no)
59
+ ```
60
+
61
+ WAIT for user confirmation.
62
+
63
+ ## Step 5: Rename Global Folder
64
+
65
+ BASH:
66
+ ```bash
67
+ mv ~/.prjct-cli/projects/{oldId} ~/.prjct-cli/projects/{newId}
68
+ ```
69
+
70
+ IF error:
71
+ OUTPUT: "❌ Failed to rename folder: {error}"
72
+ STOP
73
+
74
+ ## Step 6: Update Configuration Files
75
+
76
+ ### Local Config (.prjct/prjct.config.json)
77
+
78
+ READ current config, UPDATE:
79
+ ```json
80
+ {
81
+ "projectId": "{newId}",
82
+ "dataPath": "~/.prjct-cli/projects/{newId}"
83
+ }
84
+ ```
85
+
86
+ WRITE back to `.prjct/prjct.config.json`
87
+
88
+ ### Global Config (project.json)
89
+
90
+ READ: `~/.prjct-cli/projects/{newId}/project.json`
91
+ REPLACE all occurrences of `{oldId}` with `{newId}`
92
+ WRITE back
93
+
94
+ ## Step 7: Run Sync
95
+
96
+ Execute `/p:sync` to:
97
+ - Analyze project
98
+ - Regenerate CLAUDE.md
99
+ - Update agents
100
+
101
+ ## Output
102
+
103
+ **If migrated:**
104
+ ```
105
+ ✅ Migrated to UUID
106
+
107
+ Old ID: {oldId}
108
+ New ID: {newId}
109
+
110
+ Updated:
111
+ - Folder renamed
112
+ - Config updated
113
+ - Sync completed
114
+
115
+ Next: Continue working with /p:now
116
+ ```
117
+
118
+ **If skipped (already UUID):**
119
+ ```
120
+ ✅ Already UUID: {projectId}
121
+
122
+ Sync completed.
123
+
124
+ Next: Continue working with /p:now
125
+ ```
126
+
127
+ ## Error Handling
128
+
129
+ | Error | Action |
130
+ |-------|--------|
131
+ | No config | "Run /p:init first" |
132
+ | Folder not found | "Global data missing - reinitialize" |
133
+ | Rename failed | Show error, abort |
134
+ | User cancels | STOP without changes |
135
+
136
+ ## Notes
137
+
138
+ - Migration is idempotent: if already UUID, skips to sync
139
+ - UUIDs are standard format for PostgreSQL consistency
140
+ - Always runs sync after migration
@@ -1,14 +1,124 @@
1
1
  ---
2
2
  allowed-tools: [Read]
3
3
  description: 'Show priority queue'
4
+ architecture: 'Write-Through (JSON → MD → Events)'
5
+ storage-layer: true
6
+ source-of-truth: 'storage/queue.json'
7
+ claude-context: 'context/next.md'
4
8
  ---
5
9
 
6
- # /p:next
10
+ # /p:next - Show Priority Queue
11
+
12
+ ## Architecture: Write-Through Pattern
13
+
14
+ Reads from **Storage (JSON)** as source of truth.
15
+
16
+ **Source of Truth**: `storage/queue.json`
17
+ **Also reads**: `storage/state.json` for current task status
18
+
19
+ ## Context Variables
20
+ - `{projectId}`: From `.prjct/prjct.config.json`
21
+ - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
22
+ - `{queuePath}`: `{globalPath}/storage/queue.json`
23
+ - `{statePath}`: `{globalPath}/storage/state.json`
7
24
 
8
25
  ## Flow
9
- 1. Check `core/now.md` → warn if active
10
- 2. Read `core/next.md` → top 5 non-blocked
26
+
27
+ 1. Read `storage/state.json` → Check if active task
28
+ 2. Read `storage/queue.json` → Get queue tasks
29
+ 3. Display top 5 non-blocked tasks
11
30
 
12
31
  ## Response
13
- **Active**: `⚠️ Active: {task} | Complete: /p:done`
14
- **Queue**: Show 1-5 → `/p:work {N}`
32
+
33
+ **If active task**:
34
+ ```
35
+ ⚠️ Active: {currentTask.description}
36
+
37
+ Complete with /p:done first, or:
38
+
39
+ 📋 Queue ({count})
40
+ 1. {task_1}
41
+ 2. {task_2}
42
+ 3. {task_3}
43
+ ...
44
+
45
+ Start: /p:work {N}
46
+ ```
47
+
48
+ **If no active task**:
49
+ ```
50
+ 📋 Queue ({count})
51
+
52
+ 1. {task_1} {priority}
53
+ 2. {task_2} {priority}
54
+ 3. {task_3} {priority}
55
+ 4. {task_4}
56
+ 5. {task_5}
57
+
58
+ {IF count > 5: ... and {count - 5} more}
59
+
60
+ Start: /p:work 1 or /p:now "{task}"
61
+ ```
62
+
63
+ **If empty queue**:
64
+ ```
65
+ 📋 Queue is empty
66
+
67
+ Add tasks:
68
+ • /p:feature "description"
69
+ • /p:bug "description"
70
+ • /p:idea "quick note"
71
+ ```
72
+
73
+ ## Data Source
74
+
75
+ | Data | Storage File | Field |
76
+ |------|--------------|-------|
77
+ | Current Task | `storage/state.json` | `currentTask` |
78
+ | Queue Tasks | `storage/queue.json` | `tasks[]` |
79
+ | Shipped | `storage/shipped.json` | `shipped[]` |
80
+
81
+ ## Usage Variants
82
+
83
+ ```
84
+ /p:next # Priority queue (default)
85
+ /p:next roadmap # Feature-grouped view
86
+ /p:next --roadmap # Same as above
87
+ ```
88
+
89
+ ## Roadmap View
90
+
91
+ When called with `roadmap` parameter, show feature-grouped view:
92
+
93
+ ```
94
+ 📍 PRODUCT ROADMAP
95
+
96
+ 🚀 Current Sprint
97
+ ├── ✅ {completed_feature} - shipped {date}
98
+ ├── 🔄 {active_feature} ({X}% complete)
99
+ │ └── 🎯 {current_task}
100
+ └── ⏳ {pending_feature} ({N} tasks)
101
+
102
+ 📅 Next Up ({N} features)
103
+ ├── {feature_1} - {effort}
104
+ └── {feature_2} - {effort}
105
+
106
+ 📊 Velocity: {X.X} features/week
107
+
108
+ /p:now "{next}" | /p:done
109
+ ```
110
+
111
+ ### Roadmap Data Aggregation
112
+
113
+ 1. Group queue tasks by `featureId`
114
+ 2. Calculate completion % per feature
115
+ 3. Sort by priority/dependency
116
+ 4. Show current task within active feature
117
+
118
+ ## Natural Language Support
119
+
120
+ - "p. next" → Priority queue
121
+ - "p. queue" → Priority queue
122
+ - "p. what's next" → Priority queue
123
+ - "p. roadmap" → Roadmap view
124
+ - "p. features" → Roadmap view