prjct-cli 0.19.0 → 0.20.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 (230) hide show
  1. package/CHANGELOG.md +66 -6
  2. package/CLAUDE.md +56 -15
  3. package/README.md +5 -6
  4. package/bin/prjct +59 -42
  5. package/bin/prjct.ts +60 -0
  6. package/core/__tests__/agentic/memory-system.test.ts +18 -3
  7. package/core/__tests__/agentic/plan-mode.test.ts +55 -26
  8. package/core/__tests__/agentic/prompt-builder.test.ts +6 -6
  9. package/core/__tests__/utils/project-commands.test.ts +72 -0
  10. package/core/agentic/agent-router.ts +3 -12
  11. package/core/agentic/command-executor.ts +372 -3
  12. package/core/agentic/context-builder.ts +7 -27
  13. package/core/agentic/ground-truth.ts +604 -5
  14. package/core/agentic/index.ts +180 -0
  15. package/core/agentic/loop-detector.ts +418 -4
  16. package/core/agentic/memory-system.ts +857 -3
  17. package/core/agentic/plan-mode.ts +491 -4
  18. package/core/agentic/prompt-builder.ts +44 -65
  19. package/core/agentic/services.ts +13 -5
  20. package/core/agentic/skill-loader.ts +112 -0
  21. package/core/agentic/smart-context.ts +37 -122
  22. package/core/agentic/template-loader.ts +79 -122
  23. package/core/agentic/tool-registry.ts +5 -11
  24. package/core/agents/index.ts +1 -1
  25. package/core/agents/performance.ts +4 -2
  26. package/core/bus/bus.ts +262 -0
  27. package/core/bus/index.ts +3 -313
  28. package/core/commands/analysis.ts +5 -5
  29. package/core/commands/analytics.ts +11 -11
  30. package/core/commands/base.ts +33 -209
  31. package/core/commands/cleanup.ts +148 -0
  32. package/core/commands/command-data.ts +346 -0
  33. package/core/commands/commands.ts +216 -0
  34. package/core/commands/design.ts +83 -0
  35. package/core/commands/index.ts +13 -207
  36. package/core/commands/maintenance.ts +52 -473
  37. package/core/commands/planning.ts +3 -3
  38. package/core/commands/register.ts +104 -0
  39. package/core/commands/registry.ts +441 -0
  40. package/core/commands/setup.ts +25 -9
  41. package/core/commands/shipping.ts +48 -11
  42. package/core/commands/snapshots.ts +299 -0
  43. package/core/commands/workflow.ts +2 -2
  44. package/core/constants/index.ts +254 -4
  45. package/core/domain/agent-loader.ts +5 -6
  46. package/core/domain/task-stack.ts +555 -4
  47. package/core/errors.ts +127 -1
  48. package/core/events/events.ts +87 -0
  49. package/core/events/index.ts +4 -138
  50. package/core/index.ts +15 -23
  51. package/core/infrastructure/agent-detector.ts +126 -201
  52. package/core/infrastructure/author-detector.ts +99 -171
  53. package/core/infrastructure/command-installer.ts +476 -4
  54. package/core/infrastructure/config-manager.ts +41 -37
  55. package/core/infrastructure/path-manager.ts +59 -9
  56. package/core/infrastructure/permission-manager.ts +286 -0
  57. package/core/outcomes/analyzer.ts +7 -41
  58. package/core/outcomes/index.ts +1 -1
  59. package/core/outcomes/recorder.ts +1 -1
  60. package/core/{plugins → plugin/builtin}/webhook.ts +6 -22
  61. package/core/plugin/loader.ts +5 -5
  62. package/core/plugin/registry.ts +2 -2
  63. package/core/schemas/ideas.ts +85 -54
  64. package/core/schemas/index.ts +14 -33
  65. package/core/schemas/permissions.ts +177 -0
  66. package/core/schemas/project.ts +39 -12
  67. package/core/schemas/roadmap.ts +94 -59
  68. package/core/schemas/schemas.ts +39 -0
  69. package/core/schemas/shipped.ts +87 -60
  70. package/core/schemas/state.ts +110 -70
  71. package/core/server/index.ts +21 -0
  72. package/core/server/routes.ts +165 -0
  73. package/core/server/server.ts +136 -0
  74. package/core/server/sse.ts +135 -0
  75. package/core/services/agent-service.ts +170 -0
  76. package/core/services/breakdown-service.ts +126 -0
  77. package/core/services/index.ts +21 -0
  78. package/core/services/memory-service.ts +108 -0
  79. package/core/services/project-service.ts +146 -0
  80. package/core/services/skill-service.ts +253 -0
  81. package/core/session/compaction.ts +257 -0
  82. package/core/session/index.ts +20 -8
  83. package/core/{infrastructure/session-manager/migration.ts → session/log-migration.ts} +9 -9
  84. package/core/{infrastructure/session-manager/session-manager.ts → session/session-log-manager.ts} +27 -26
  85. package/core/session/{session-manager.ts → task-session-manager.ts} +7 -4
  86. package/core/session/utils.ts +1 -1
  87. package/core/storage/ideas-storage.ts +10 -26
  88. package/core/storage/index.ts +14 -162
  89. package/core/storage/queue-storage.ts +13 -11
  90. package/core/storage/shipped-storage.ts +4 -17
  91. package/core/storage/state-storage.ts +35 -43
  92. package/core/storage/storage-manager.ts +42 -52
  93. package/core/storage/storage.ts +160 -0
  94. package/core/sync/auth-config.ts +1 -8
  95. package/core/sync/index.ts +17 -10
  96. package/core/sync/oauth-handler.ts +1 -6
  97. package/core/sync/sync-client.ts +6 -34
  98. package/core/sync/sync-manager.ts +11 -40
  99. package/core/types/agentic.ts +577 -0
  100. package/core/types/agents.ts +145 -0
  101. package/core/types/bus.ts +82 -0
  102. package/core/types/commands.ts +366 -0
  103. package/core/types/config.ts +66 -0
  104. package/core/types/core.ts +96 -0
  105. package/core/types/domain.ts +71 -0
  106. package/core/types/events.ts +42 -0
  107. package/core/types/fs.ts +56 -0
  108. package/core/types/index.ts +387 -500
  109. package/core/types/infrastructure.ts +196 -0
  110. package/core/{agentic/memory-system/types.ts → types/memory.ts} +33 -8
  111. package/core/{outcomes/types.ts → types/outcomes.ts} +53 -8
  112. package/core/types/plugin.ts +25 -0
  113. package/core/types/server.ts +54 -0
  114. package/core/types/services.ts +65 -0
  115. package/core/types/session.ts +135 -0
  116. package/core/types/storage.ts +148 -0
  117. package/core/types/sync.ts +121 -0
  118. package/core/types/task.ts +72 -0
  119. package/core/types/template.ts +24 -0
  120. package/core/types/utils.ts +90 -0
  121. package/core/utils/cache.ts +195 -0
  122. package/core/utils/collection-filters.ts +245 -0
  123. package/core/utils/date-helper.ts +1 -5
  124. package/core/utils/file-helper.ts +20 -10
  125. package/core/utils/jsonl-helper.ts +5 -8
  126. package/core/utils/markdown-builder.ts +277 -0
  127. package/core/utils/project-commands.ts +132 -0
  128. package/core/utils/runtime.ts +119 -0
  129. package/dist/bin/prjct.mjs +12568 -0
  130. package/package.json +13 -8
  131. package/scripts/build.js +106 -0
  132. package/scripts/postinstall.js +50 -8
  133. package/templates/agentic/agents/uxui.md +210 -0
  134. package/templates/agentic/subagent-generation.md +1 -1
  135. package/templates/commands/bug.md +219 -41
  136. package/templates/commands/feature.md +368 -80
  137. package/templates/commands/serve.md +118 -0
  138. package/templates/commands/ship.md +152 -14
  139. package/templates/commands/skill.md +110 -0
  140. package/templates/commands/sync.md +63 -4
  141. package/templates/commands/test.md +40 -188
  142. package/templates/mcp-config.json +0 -36
  143. package/templates/permissions/default.jsonc +60 -0
  144. package/templates/permissions/permissive.jsonc +49 -0
  145. package/templates/permissions/strict.jsonc +62 -0
  146. package/templates/skills/code-review.md +47 -0
  147. package/templates/skills/debug.md +61 -0
  148. package/templates/skills/refactor.md +47 -0
  149. package/templates/subagents/domain/devops.md +1 -1
  150. package/templates/subagents/domain/testing.md +6 -10
  151. package/templates/subagents/workflow/prjct-shipper.md +16 -7
  152. package/templates/tools/bash.txt +22 -0
  153. package/templates/tools/edit.txt +18 -0
  154. package/templates/tools/glob.txt +19 -0
  155. package/templates/tools/grep.txt +21 -0
  156. package/templates/tools/read.txt +14 -0
  157. package/templates/tools/task.txt +20 -0
  158. package/templates/tools/webfetch.txt +16 -0
  159. package/templates/tools/websearch.txt +18 -0
  160. package/templates/tools/write.txt +17 -0
  161. package/core/agentic/command-executor/command-executor.ts +0 -312
  162. package/core/agentic/command-executor/index.ts +0 -16
  163. package/core/agentic/command-executor/status-signal.ts +0 -38
  164. package/core/agentic/command-executor/types.ts +0 -79
  165. package/core/agentic/ground-truth/index.ts +0 -76
  166. package/core/agentic/ground-truth/types.ts +0 -33
  167. package/core/agentic/ground-truth/utils.ts +0 -48
  168. package/core/agentic/ground-truth/verifiers/analyze.ts +0 -54
  169. package/core/agentic/ground-truth/verifiers/done.ts +0 -75
  170. package/core/agentic/ground-truth/verifiers/feature.ts +0 -70
  171. package/core/agentic/ground-truth/verifiers/index.ts +0 -37
  172. package/core/agentic/ground-truth/verifiers/init.ts +0 -52
  173. package/core/agentic/ground-truth/verifiers/now.ts +0 -57
  174. package/core/agentic/ground-truth/verifiers/ship.ts +0 -85
  175. package/core/agentic/ground-truth/verifiers/spec.ts +0 -45
  176. package/core/agentic/ground-truth/verifiers/sync.ts +0 -47
  177. package/core/agentic/ground-truth/verifiers.ts +0 -6
  178. package/core/agentic/loop-detector/error-analysis.ts +0 -97
  179. package/core/agentic/loop-detector/hallucination.ts +0 -71
  180. package/core/agentic/loop-detector/index.ts +0 -41
  181. package/core/agentic/loop-detector/loop-detector.ts +0 -222
  182. package/core/agentic/loop-detector/types.ts +0 -66
  183. package/core/agentic/memory-system/history.ts +0 -53
  184. package/core/agentic/memory-system/index.ts +0 -192
  185. package/core/agentic/memory-system/patterns.ts +0 -156
  186. package/core/agentic/memory-system/semantic-memories.ts +0 -278
  187. package/core/agentic/memory-system/session.ts +0 -21
  188. package/core/agentic/plan-mode/approval.ts +0 -57
  189. package/core/agentic/plan-mode/constants.ts +0 -44
  190. package/core/agentic/plan-mode/index.ts +0 -28
  191. package/core/agentic/plan-mode/plan-mode.ts +0 -407
  192. package/core/agentic/plan-mode/types.ts +0 -193
  193. package/core/agents/types.ts +0 -126
  194. package/core/command-registry/categories.ts +0 -23
  195. package/core/command-registry/commands.ts +0 -15
  196. package/core/command-registry/core-commands.ts +0 -344
  197. package/core/command-registry/index.ts +0 -158
  198. package/core/command-registry/optional-commands.ts +0 -163
  199. package/core/command-registry/setup-commands.ts +0 -83
  200. package/core/command-registry/types.ts +0 -59
  201. package/core/command-registry.ts +0 -9
  202. package/core/commands/types.ts +0 -185
  203. package/core/commands.ts +0 -11
  204. package/core/constants/formats.ts +0 -187
  205. package/core/context-sync.ts +0 -18
  206. package/core/data/index.ts +0 -27
  207. package/core/data/md-base-manager.ts +0 -203
  208. package/core/data/md-ideas-manager.ts +0 -155
  209. package/core/data/md-queue-manager.ts +0 -180
  210. package/core/data/md-shipped-manager.ts +0 -90
  211. package/core/data/md-state-manager.ts +0 -137
  212. package/core/domain/task-stack/index.ts +0 -19
  213. package/core/domain/task-stack/parser.ts +0 -86
  214. package/core/domain/task-stack/storage.ts +0 -123
  215. package/core/domain/task-stack/task-stack.ts +0 -340
  216. package/core/domain/task-stack/types.ts +0 -51
  217. package/core/infrastructure/command-installer/command-installer.ts +0 -327
  218. package/core/infrastructure/command-installer/global-config.ts +0 -136
  219. package/core/infrastructure/command-installer/index.ts +0 -25
  220. package/core/infrastructure/command-installer/types.ts +0 -41
  221. package/core/infrastructure/session-manager/index.ts +0 -23
  222. package/core/infrastructure/session-manager/types.ts +0 -45
  223. package/core/infrastructure/session-manager.ts +0 -8
  224. package/core/serializers/ideas-serializer.ts +0 -187
  225. package/core/serializers/index.ts +0 -36
  226. package/core/serializers/queue-serializer.ts +0 -210
  227. package/core/serializers/shipped-serializer.ts +0 -108
  228. package/core/serializers/state-serializer.ts +0 -136
  229. package/core/session/types.ts +0 -29
  230. /package/core/infrastructure/{agents/claude-agent.ts → claude-agent.ts} +0 -0
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Command Data - Static command definitions and categories
3
+ *
4
+ * Single source of truth for all command metadata.
5
+ * Used by registry for introspection and help display.
6
+ */
7
+
8
+ import type { CommandMeta, CategoryInfo } from '../types'
9
+
10
+ // Category definitions
11
+ export const CATEGORIES: Record<string, CategoryInfo> = {
12
+ core: {
13
+ title: 'Core Workflow',
14
+ description: '13 essential commands for daily development workflow',
15
+ order: 1,
16
+ },
17
+ optional: {
18
+ title: 'Optional Commands',
19
+ description: 'Advanced features for specialized workflows',
20
+ order: 2,
21
+ },
22
+ setup: {
23
+ title: 'Setup',
24
+ description: 'Installation and configuration (not for daily use)',
25
+ order: 3,
26
+ },
27
+ }
28
+
29
+ // All command definitions
30
+ export const COMMANDS: CommandMeta[] = [
31
+ // ===== CORE COMMANDS =====
32
+ {
33
+ name: 'init',
34
+ group: 'core',
35
+ description: 'Deep project analysis and initialization',
36
+ usage: { claude: '/p:init "[idea]"', terminal: 'prjct init "[idea]"' },
37
+ params: '[idea]',
38
+ implemented: true,
39
+ hasTemplate: true,
40
+ requiresProject: false,
41
+ features: ['Architect mode for blank projects', 'Auto tech stack recommendation', 'Analyzes existing codebases'],
42
+ },
43
+ {
44
+ name: 'idea',
45
+ group: 'core',
46
+ description: 'Transform ideas into complete technical architectures',
47
+ usage: { claude: '/p:idea "build a CRM"', terminal: 'prjct idea "build a CRM"' },
48
+ params: '<description>',
49
+ implemented: true,
50
+ hasTemplate: true,
51
+ requiresProject: true,
52
+ features: ['Simple ideas -> Quick capture', 'Complex ideas -> Full architecture'],
53
+ },
54
+ {
55
+ name: 'feature',
56
+ group: 'core',
57
+ description: 'Add feature with value analysis and task breakdown',
58
+ usage: { claude: '/p:feature "add testing"', terminal: 'prjct feature "add testing"' },
59
+ params: '<description>',
60
+ implemented: true,
61
+ hasTemplate: true,
62
+ requiresProject: true,
63
+ features: ['Value analysis', 'Auto roadmap generation', 'Task breakdown'],
64
+ },
65
+ {
66
+ name: 'spec',
67
+ group: 'core',
68
+ description: 'Create detailed specifications for complex features',
69
+ usage: { claude: '/p:spec "Dark Mode"', terminal: 'prjct spec "Dark Mode"' },
70
+ params: '[feature]',
71
+ implemented: true,
72
+ hasTemplate: true,
73
+ requiresProject: true,
74
+ },
75
+ {
76
+ name: 'now',
77
+ group: 'core',
78
+ description: 'Set or show current task with session tracking',
79
+ usage: { claude: '/p:now ["task"]', terminal: 'prjct now ["task"]' },
80
+ params: '[task] [estimate]',
81
+ implemented: true,
82
+ hasTemplate: true,
83
+ requiresProject: true,
84
+ },
85
+ {
86
+ name: 'work',
87
+ group: 'core',
88
+ description: 'Set or show current task (alias for now)',
89
+ usage: { claude: '/p:work ["task"]', terminal: 'prjct work ["task"]' },
90
+ params: '[task]',
91
+ implemented: true,
92
+ hasTemplate: true,
93
+ requiresProject: true,
94
+ },
95
+ {
96
+ name: 'pause',
97
+ group: 'core',
98
+ description: 'Pause active task to handle interruption',
99
+ usage: { claude: '/p:pause ["reason"]', terminal: 'prjct pause ["reason"]' },
100
+ params: '[reason]',
101
+ implemented: true,
102
+ hasTemplate: true,
103
+ requiresProject: true,
104
+ blockingRules: { check: 'Active task exists', message: 'No active task to pause' },
105
+ },
106
+ {
107
+ name: 'resume',
108
+ group: 'core',
109
+ description: 'Resume paused task or recover abandoned session',
110
+ usage: { claude: '/p:resume', terminal: 'prjct resume' },
111
+ params: '[task_id]',
112
+ implemented: true,
113
+ hasTemplate: true,
114
+ requiresProject: true,
115
+ },
116
+ {
117
+ name: 'next',
118
+ group: 'core',
119
+ description: 'Show priority queue or roadmap view',
120
+ usage: { claude: '/p:next', terminal: 'prjct next' },
121
+ params: '[roadmap]',
122
+ implemented: true,
123
+ hasTemplate: true,
124
+ requiresProject: true,
125
+ },
126
+ {
127
+ name: 'done',
128
+ group: 'core',
129
+ description: 'Mark current task as complete',
130
+ usage: { claude: '/p:done', terminal: 'prjct done' },
131
+ implemented: true,
132
+ hasTemplate: true,
133
+ requiresProject: true,
134
+ },
135
+ {
136
+ name: 'ship',
137
+ group: 'core',
138
+ description: 'Commit, push, and celebrate shipped feature',
139
+ usage: { claude: '/p:ship "feature"', terminal: 'prjct ship "feature"' },
140
+ params: '<feature>',
141
+ implemented: true,
142
+ hasTemplate: true,
143
+ requiresProject: true,
144
+ },
145
+ {
146
+ name: 'bug',
147
+ group: 'core',
148
+ description: 'Report and track bugs with priority',
149
+ usage: { claude: '/p:bug "description"', terminal: 'prjct bug "description"' },
150
+ params: '<description>',
151
+ implemented: true,
152
+ hasTemplate: true,
153
+ requiresProject: true,
154
+ },
155
+ {
156
+ name: 'dash',
157
+ group: 'core',
158
+ description: 'Unified dashboard - status, progress, and roadmap',
159
+ usage: { claude: '/p:dash [view]', terminal: 'prjct dash [view]' },
160
+ params: '[week|month|roadmap|compact]',
161
+ implemented: true,
162
+ hasTemplate: true,
163
+ requiresProject: true,
164
+ },
165
+ {
166
+ name: 'sync',
167
+ group: 'core',
168
+ description: 'Sync project state and update workflow agents',
169
+ usage: { claude: '/p:sync', terminal: 'prjct sync' },
170
+ implemented: true,
171
+ hasTemplate: true,
172
+ requiresProject: true,
173
+ },
174
+ {
175
+ name: 'suggest',
176
+ group: 'core',
177
+ description: 'Smart recommendations based on project state',
178
+ usage: { claude: '/p:suggest', terminal: 'prjct suggest' },
179
+ implemented: true,
180
+ hasTemplate: true,
181
+ requiresProject: true,
182
+ },
183
+ {
184
+ name: 'help',
185
+ group: 'core',
186
+ description: 'Contextual help and guidance',
187
+ usage: { claude: '/p:help [topic]', terminal: 'prjct help [topic]' },
188
+ params: '[topic]',
189
+ implemented: true,
190
+ hasTemplate: true,
191
+ requiresProject: false,
192
+ },
193
+
194
+ // ===== OPTIONAL COMMANDS =====
195
+ {
196
+ name: 'design',
197
+ group: 'optional',
198
+ description: 'Design system architecture, APIs, and components',
199
+ usage: { claude: '/p:design [target]', terminal: 'prjct design [target]' },
200
+ params: '[target] --type architecture|api|component',
201
+ implemented: true,
202
+ hasTemplate: true,
203
+ requiresProject: true,
204
+ isOptional: true,
205
+ },
206
+ {
207
+ name: 'cleanup',
208
+ group: 'optional',
209
+ description: 'Clean up temp files and old entries',
210
+ usage: { claude: '/p:cleanup', terminal: 'prjct cleanup' },
211
+ implemented: true,
212
+ hasTemplate: true,
213
+ requiresProject: true,
214
+ isOptional: true,
215
+ },
216
+ {
217
+ name: 'analyze',
218
+ group: 'optional',
219
+ description: 'Analyze repository and sync tasks',
220
+ usage: { claude: '/p:analyze', terminal: 'prjct analyze' },
221
+ implemented: true,
222
+ hasTemplate: true,
223
+ requiresProject: true,
224
+ isOptional: true,
225
+ },
226
+ {
227
+ name: 'undo',
228
+ group: 'optional',
229
+ description: 'Revert to previous snapshot',
230
+ usage: { claude: '/p:undo', terminal: 'prjct undo' },
231
+ implemented: true,
232
+ hasTemplate: true,
233
+ requiresProject: true,
234
+ isOptional: true,
235
+ features: ['Git-based snapshots', 'Preserves redo history'],
236
+ },
237
+ {
238
+ name: 'redo',
239
+ group: 'optional',
240
+ description: 'Redo previously undone changes',
241
+ usage: { claude: '/p:redo', terminal: 'prjct redo' },
242
+ implemented: true,
243
+ hasTemplate: true,
244
+ requiresProject: true,
245
+ isOptional: true,
246
+ },
247
+ {
248
+ name: 'history',
249
+ group: 'optional',
250
+ description: 'View snapshot history',
251
+ usage: { claude: '/p:history', terminal: 'prjct history' },
252
+ implemented: true,
253
+ hasTemplate: true,
254
+ requiresProject: true,
255
+ isOptional: true,
256
+ },
257
+ {
258
+ name: 'recover',
259
+ group: 'optional',
260
+ description: 'Recover abandoned session with context',
261
+ usage: { claude: '/p:recover', terminal: 'prjct recover' },
262
+ implemented: true,
263
+ hasTemplate: true,
264
+ requiresProject: true,
265
+ isOptional: true,
266
+ },
267
+ {
268
+ name: 'git',
269
+ group: 'optional',
270
+ description: 'Smart git operations with context',
271
+ usage: { claude: '/p:git [op]', terminal: 'prjct git [op]' },
272
+ params: '[operation]',
273
+ implemented: true,
274
+ hasTemplate: true,
275
+ requiresProject: true,
276
+ isOptional: true,
277
+ },
278
+ {
279
+ name: 'test',
280
+ group: 'optional',
281
+ description: 'Run tests with auto-fix',
282
+ usage: { claude: '/p:test', terminal: 'prjct test' },
283
+ implemented: true,
284
+ hasTemplate: true,
285
+ requiresProject: true,
286
+ isOptional: true,
287
+ },
288
+
289
+ // ===== SETUP COMMANDS =====
290
+ {
291
+ name: 'start',
292
+ group: 'setup',
293
+ description: 'First-time setup (install commands to editors)',
294
+ usage: { claude: null, terminal: 'prjct start' },
295
+ implemented: true,
296
+ hasTemplate: false,
297
+ requiresProject: false,
298
+ },
299
+ {
300
+ name: 'setup',
301
+ group: 'setup',
302
+ description: 'Reconfigure editor installations',
303
+ usage: { claude: '/p:setup', terminal: 'prjct setup' },
304
+ params: '[--force] [--editor <name>]',
305
+ implemented: true,
306
+ hasTemplate: true,
307
+ requiresProject: false,
308
+ },
309
+ {
310
+ name: 'migrate',
311
+ group: 'setup',
312
+ description: 'Migrate project to UUID format + sync',
313
+ usage: { claude: '/p:migrate', terminal: null },
314
+ implemented: true,
315
+ hasTemplate: true,
316
+ requiresProject: true,
317
+ },
318
+ {
319
+ name: 'migrate-all',
320
+ group: 'setup',
321
+ description: 'Migrate all legacy projects to UUID format',
322
+ usage: { claude: '/p:migrate-all', terminal: 'prjct migrate-all' },
323
+ params: '[--deep-scan] [--dry-run]',
324
+ implemented: true,
325
+ hasTemplate: true,
326
+ requiresProject: false,
327
+ },
328
+ {
329
+ name: 'auth',
330
+ group: 'setup',
331
+ description: 'Manage cloud authentication',
332
+ usage: { claude: '/p:auth [action]', terminal: 'prjct auth [action]' },
333
+ params: '[login|logout|status]',
334
+ implemented: true,
335
+ hasTemplate: true,
336
+ requiresProject: false,
337
+ },
338
+ ]
339
+
340
+ // Legacy compatibility - category field mapping
341
+ export function getCommandsWithCategory(): Array<CommandMeta & { category: string }> {
342
+ return COMMANDS.map(cmd => ({
343
+ ...cmd,
344
+ category: cmd.group, // Map group to category for backward compat
345
+ }))
346
+ }
@@ -0,0 +1,216 @@
1
+ /**
2
+ * prjct CLI Commands Handler
3
+ *
4
+ * MD-First Architecture - All state in Markdown files.
5
+ *
6
+ * COMMANDS (22 total):
7
+ * - Workflow (5): work, done, next, pause, resume
8
+ * - Planning (5): init, feature, bug, idea, spec
9
+ * - Shipping (1): ship
10
+ * - Analytics (2): dash, help
11
+ * - Maintenance (5): cleanup, design, recover, undo, redo, history
12
+ * - Analysis (2): analyze, sync
13
+ * - Setup (3): start, setup, migrateAll
14
+ */
15
+
16
+ import { WorkflowCommands } from './workflow'
17
+ import { PlanningCommands } from './planning'
18
+ import { ShippingCommands } from './shipping'
19
+ import { AnalyticsCommands } from './analytics'
20
+ import { MaintenanceCommands } from './maintenance'
21
+ import { AnalysisCommands } from './analysis'
22
+ import { SetupCommands } from './setup'
23
+
24
+ import type {
25
+ CommandResult,
26
+ AgentInfo,
27
+ Author,
28
+ DesignOptions,
29
+ CleanupOptions,
30
+ SetupOptions,
31
+ MigrateOptions,
32
+ AnalyzeOptions
33
+ } from '../types'
34
+
35
+ /**
36
+ * PrjctCommands - Combined class with all commands
37
+ * Uses mixins pattern to combine all command groups
38
+ */
39
+ class PrjctCommands {
40
+ // Instances of each command group
41
+ private workflow: WorkflowCommands
42
+ private planning: PlanningCommands
43
+ private shipping: ShippingCommands
44
+ private analytics: AnalyticsCommands
45
+ private maintenance: MaintenanceCommands
46
+ private analysis: AnalysisCommands
47
+ private setupCmds: SetupCommands
48
+
49
+ // Shared state
50
+ agent: unknown
51
+ agentInfo: AgentInfo | null
52
+ currentAuthor: Author | null
53
+ prjctDir: string
54
+
55
+ constructor() {
56
+ this.workflow = new WorkflowCommands()
57
+ this.planning = new PlanningCommands()
58
+ this.shipping = new ShippingCommands()
59
+ this.analytics = new AnalyticsCommands()
60
+ this.maintenance = new MaintenanceCommands()
61
+ this.analysis = new AnalysisCommands()
62
+ this.setupCmds = new SetupCommands()
63
+
64
+ this.agent = null
65
+ this.agentInfo = null
66
+ this.currentAuthor = null
67
+ this.prjctDir = '.prjct'
68
+ }
69
+
70
+ // ========== Workflow Commands ==========
71
+
72
+ async work(task: string | null = null, projectPath: string = process.cwd()): Promise<CommandResult> {
73
+ return this.workflow.now(task, projectPath)
74
+ }
75
+
76
+ async done(projectPath: string = process.cwd()): Promise<CommandResult> {
77
+ return this.workflow.done(projectPath)
78
+ }
79
+
80
+ async next(projectPath: string = process.cwd()): Promise<CommandResult> {
81
+ return this.workflow.next(projectPath)
82
+ }
83
+
84
+ async pause(reason: string = '', projectPath: string = process.cwd()): Promise<CommandResult> {
85
+ return this.workflow.pause(reason, projectPath)
86
+ }
87
+
88
+ async resume(taskId: string | null = null, projectPath: string = process.cwd()): Promise<CommandResult> {
89
+ return this.workflow.resume(taskId, projectPath)
90
+ }
91
+
92
+ // ========== Planning Commands ==========
93
+
94
+ async init(idea: string | null = null, projectPath: string = process.cwd()): Promise<CommandResult> {
95
+ return this.planning.init(idea, projectPath)
96
+ }
97
+
98
+ async feature(description: string, projectPath: string = process.cwd()): Promise<CommandResult> {
99
+ return this.planning.feature(description, projectPath)
100
+ }
101
+
102
+ async bug(description: string, projectPath: string = process.cwd()): Promise<CommandResult> {
103
+ return this.planning.bug(description, projectPath)
104
+ }
105
+
106
+ async idea(description: string, projectPath: string = process.cwd()): Promise<CommandResult> {
107
+ return this.planning.idea(description, projectPath)
108
+ }
109
+
110
+ async spec(featureName: string | null = null, projectPath: string = process.cwd()): Promise<CommandResult> {
111
+ return this.planning.spec(featureName, projectPath)
112
+ }
113
+
114
+ // ========== Shipping Commands ==========
115
+
116
+ async ship(feature: string | null, projectPath: string = process.cwd()): Promise<CommandResult> {
117
+ return this.shipping.ship(feature, projectPath)
118
+ }
119
+
120
+ // ========== Analytics Commands ==========
121
+
122
+ async dash(view: string = 'default', projectPath: string = process.cwd()): Promise<CommandResult> {
123
+ return this.analytics.dash(view, projectPath)
124
+ }
125
+
126
+ async help(topic: string = '', projectPath: string = process.cwd()): Promise<CommandResult> {
127
+ return this.analytics.help(topic, projectPath)
128
+ }
129
+
130
+ // ========== Maintenance Commands ==========
131
+
132
+ async cleanup(options: CleanupOptions = {}, projectPath: string = process.cwd()): Promise<CommandResult> {
133
+ return this.maintenance.cleanup(options, projectPath)
134
+ }
135
+
136
+ async design(target: string | null = null, options: DesignOptions = {}, projectPath: string = process.cwd()): Promise<CommandResult> {
137
+ return this.maintenance.design(target, options, projectPath)
138
+ }
139
+
140
+ async recover(projectPath: string = process.cwd()): Promise<CommandResult> {
141
+ return this.maintenance.recover(projectPath)
142
+ }
143
+
144
+ async undo(projectPath: string = process.cwd()): Promise<CommandResult> {
145
+ return this.maintenance.undo(projectPath)
146
+ }
147
+
148
+ async redo(projectPath: string = process.cwd()): Promise<CommandResult> {
149
+ return this.maintenance.redo(projectPath)
150
+ }
151
+
152
+ async history(projectPath: string = process.cwd()): Promise<CommandResult> {
153
+ return this.maintenance.history(projectPath)
154
+ }
155
+
156
+ // ========== Analysis Commands ==========
157
+
158
+ async analyze(options: AnalyzeOptions = {}, projectPath: string = process.cwd()): Promise<CommandResult> {
159
+ return this.analysis.analyze(options, projectPath)
160
+ }
161
+
162
+ async sync(projectPath: string = process.cwd()): Promise<CommandResult> {
163
+ return this.analysis.sync(projectPath)
164
+ }
165
+
166
+ // ========== Setup Commands ==========
167
+
168
+ async start(): Promise<CommandResult> {
169
+ return this.setupCmds.start()
170
+ }
171
+
172
+ async setup(options: SetupOptions = {}): Promise<CommandResult> {
173
+ return this.setupCmds.setup(options)
174
+ }
175
+
176
+ async migrateAll(options: MigrateOptions = {}): Promise<CommandResult> {
177
+ return this.setupCmds.migrateAll(options)
178
+ }
179
+
180
+ async installStatusLine(): Promise<{ success: boolean; error?: string }> {
181
+ return this.setupCmds.installStatusLine()
182
+ }
183
+
184
+ showAsciiArt(): void {
185
+ return this.setupCmds.showAsciiArt()
186
+ }
187
+
188
+ // ========== Delegated Base Methods ==========
189
+
190
+ async initializeAgent(): Promise<unknown> {
191
+ return this.workflow.initializeAgent()
192
+ }
193
+
194
+ async ensureProjectInit(projectPath: string): Promise<CommandResult> {
195
+ return this.workflow.ensureProjectInit(projectPath)
196
+ }
197
+
198
+ async ensureAuthor(): Promise<Author> {
199
+ return this.workflow.ensureAuthor()
200
+ }
201
+
202
+ async getGlobalProjectPath(projectPath: string): Promise<string> {
203
+ return this.workflow.getGlobalProjectPath(projectPath)
204
+ }
205
+
206
+ async logToMemory(projectPath: string, action: string, data: Record<string, unknown>): Promise<void> {
207
+ return this.workflow.logToMemory(projectPath, action, data)
208
+ }
209
+ }
210
+
211
+ // Export both class and singleton instance
212
+ const instance = new PrjctCommands()
213
+
214
+ export default instance
215
+ export { PrjctCommands }
216
+
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Design Commands
3
+ *
4
+ * System architecture, API, and component design operations.
5
+ */
6
+
7
+ import path from 'path'
8
+
9
+ import type { CommandResult, DesignOptions } from '../types'
10
+ import {
11
+ pathManager,
12
+ configManager,
13
+ fileHelper,
14
+ dateHelper,
15
+ out
16
+ } from './base'
17
+ import { memoryService } from '../services'
18
+
19
+ /**
20
+ * /p:design - Design system architecture, APIs, and components
21
+ */
22
+ export async function design(
23
+ target: string | null = null,
24
+ options: DesignOptions = {},
25
+ projectPath: string = process.cwd()
26
+ ): Promise<CommandResult> {
27
+ try {
28
+ const designType = options.type || 'architecture'
29
+ const validTypes = ['architecture', 'api', 'component', 'database', 'flow']
30
+
31
+ if (!validTypes.includes(designType)) {
32
+ out.fail(`invalid type: ${designType}`)
33
+ return { success: false, error: 'Invalid design type' }
34
+ }
35
+
36
+ const designTarget = target || 'system'
37
+ out.spin(`designing ${designType}...`)
38
+
39
+ const projectId = await configManager.getProjectId(projectPath)
40
+ const designsPath = path.join(
41
+ pathManager.getGlobalProjectPath(projectId!),
42
+ 'planning',
43
+ 'designs'
44
+ )
45
+ await fileHelper.ensureDir(designsPath)
46
+
47
+ let designContent = ''
48
+
49
+ switch (designType) {
50
+ case 'architecture':
51
+ designContent = `# Architecture Design: ${designTarget}\n\n*Use templates/design/architecture.md for full design*\n`
52
+ break
53
+ case 'api':
54
+ designContent = `# API Design: ${designTarget}\n\n*Use templates/design/api.md for full design*\n`
55
+ break
56
+ case 'component':
57
+ designContent = `# Component Design: ${designTarget}\n\n*Use templates/design/component.md for full design*\n`
58
+ break
59
+ case 'database':
60
+ designContent = `# Database Design: ${designTarget}\n\n*Use templates/design/database.md for full design*\n`
61
+ break
62
+ case 'flow':
63
+ designContent = `# Flow Design: ${designTarget}\n\n*Use templates/design/flow.md for full design*\n`
64
+ break
65
+ }
66
+
67
+ const designFileName = `${designType}-${designTarget.toLowerCase().replace(/\s+/g, '-')}.md`
68
+ const designFilePath = path.join(designsPath, designFileName)
69
+ await fileHelper.writeFile(designFilePath, designContent)
70
+
71
+ await memoryService.log(projectPath, 'design_created', {
72
+ type: designType,
73
+ target: designTarget,
74
+ timestamp: dateHelper.getTimestamp(),
75
+ })
76
+
77
+ out.done(`${designType} design created`)
78
+ return { success: true, designPath: designFilePath, type: designType, target: designTarget }
79
+ } catch (error) {
80
+ out.fail((error as Error).message)
81
+ return { success: false, error: (error as Error).message }
82
+ }
83
+ }