prjct-cli 0.5.1 → 0.7.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 (81) hide show
  1. package/CHANGELOG.md +220 -7
  2. package/CLAUDE.md +476 -55
  3. package/README.md +48 -55
  4. package/bin/prjct +170 -225
  5. package/core/agentic/command-executor.js +113 -0
  6. package/core/agentic/context-builder.js +85 -0
  7. package/core/agentic/prompt-builder.js +86 -0
  8. package/core/agentic/template-loader.js +104 -0
  9. package/core/agentic/tool-registry.js +117 -0
  10. package/core/command-registry.js +597 -0
  11. package/core/commands.js +2046 -2028
  12. package/core/domain/agent-generator.js +118 -0
  13. package/core/domain/analyzer.js +211 -0
  14. package/core/domain/architect-session.js +300 -0
  15. package/core/{agents → infrastructure/agents}/claude-agent.js +16 -13
  16. package/core/{author-detector.js → infrastructure/author-detector.js} +3 -1
  17. package/core/{capability-installer.js → infrastructure/capability-installer.js} +3 -6
  18. package/core/{command-installer.js → infrastructure/command-installer.js} +4 -2
  19. package/core/{config-manager.js → infrastructure/config-manager.js} +4 -4
  20. package/core/{editors-config.js → infrastructure/editors-config.js} +2 -10
  21. package/core/{migrator.js → infrastructure/migrator.js} +34 -19
  22. package/core/{path-manager.js → infrastructure/path-manager.js} +20 -44
  23. package/core/{session-manager.js → infrastructure/session-manager.js} +45 -105
  24. package/core/{update-checker.js → infrastructure/update-checker.js} +67 -67
  25. package/core/{animations-simple.js → utils/animations.js} +3 -23
  26. package/core/utils/date-helper.js +238 -0
  27. package/core/utils/file-helper.js +327 -0
  28. package/core/utils/jsonl-helper.js +206 -0
  29. package/core/{project-capabilities.js → utils/project-capabilities.js} +21 -22
  30. package/core/utils/session-helper.js +277 -0
  31. package/core/{version.js → utils/version.js} +1 -1
  32. package/package.json +5 -12
  33. package/templates/agents/AGENTS.md +151 -99
  34. package/templates/analysis/analyze.md +84 -0
  35. package/templates/commands/analyze.md +37 -233
  36. package/templates/commands/bug.md +79 -0
  37. package/templates/commands/build.md +44 -0
  38. package/templates/commands/cleanup.md +24 -84
  39. package/templates/commands/design.md +20 -95
  40. package/templates/commands/done.md +17 -180
  41. package/templates/commands/feature.md +113 -0
  42. package/templates/commands/fix.md +58 -66
  43. package/templates/commands/git.md +35 -57
  44. package/templates/commands/help.md +18 -52
  45. package/templates/commands/idea.md +18 -34
  46. package/templates/commands/init.md +65 -257
  47. package/templates/commands/next.md +20 -60
  48. package/templates/commands/now.md +21 -23
  49. package/templates/commands/progress.md +40 -73
  50. package/templates/commands/recap.md +52 -75
  51. package/templates/commands/roadmap.md +30 -85
  52. package/templates/commands/ship.md +93 -126
  53. package/templates/commands/status.md +42 -0
  54. package/templates/commands/sync.md +19 -205
  55. package/templates/commands/task.md +19 -79
  56. package/templates/commands/test.md +25 -71
  57. package/templates/commands/workflow.md +20 -210
  58. package/core/agent-generator.js +0 -516
  59. package/core/analyzer.js +0 -600
  60. package/core/animations.js +0 -277
  61. package/core/git-integration.js +0 -401
  62. package/core/workflow-engine.js +0 -213
  63. package/core/workflow-prompts.js +0 -192
  64. package/core/workflow-rules.js +0 -147
  65. package/scripts/post-install.js +0 -121
  66. package/scripts/preuninstall.js +0 -94
  67. package/scripts/verify-installation.sh +0 -158
  68. package/templates/agents/be.template.md +0 -42
  69. package/templates/agents/data.template.md +0 -41
  70. package/templates/agents/devops.template.md +0 -41
  71. package/templates/agents/fe.template.md +0 -42
  72. package/templates/agents/mobile.template.md +0 -41
  73. package/templates/agents/pm.template.md +0 -84
  74. package/templates/agents/qa.template.md +0 -54
  75. package/templates/agents/scribe.template.md +0 -95
  76. package/templates/agents/security.template.md +0 -41
  77. package/templates/agents/ux.template.md +0 -49
  78. package/templates/commands/context.md +0 -105
  79. package/templates/commands/stuck.md +0 -48
  80. package/templates/examples/natural-language-examples.md +0 -532
  81. /package/core/{agent-detector.js → infrastructure/agent-detector.js} +0 -0
@@ -0,0 +1,597 @@
1
+ /**
2
+ * Command Registry - Single Source of Truth
3
+ *
4
+ * All prjct commands are defined here with metadata.
5
+ * This registry is used by:
6
+ * - bin/prjct (terminal CLI)
7
+ * - website/Commands.tsx (documentation site)
8
+ * - CLAUDE.md (AI assistant instructions)
9
+ * - scripts/validate-commands.js (validation)
10
+ *
11
+ * @version 0.6.0 - Simplified workflow with 9 core commands
12
+ */
13
+
14
+ const COMMANDS = [
15
+ // ===== CORE WORKFLOW COMMANDS (9 essential) =====
16
+
17
+ // 1. Initialize
18
+ {
19
+ name: 'init',
20
+ category: 'core',
21
+ description: 'Deep project analysis and initialization',
22
+ usage: {
23
+ claude: '/p:init "[idea]"',
24
+ terminal: 'prjct init "[idea]"',
25
+ },
26
+ params: '[idea]',
27
+ implemented: true,
28
+ hasTemplate: true,
29
+ icon: 'Zap',
30
+ requiresInit: false,
31
+ blockingRules: null,
32
+ features: [
33
+ 'Architect mode for blank projects',
34
+ 'Auto tech stack recommendation',
35
+ 'Project structure generation',
36
+ 'Initial roadmap creation',
37
+ 'Analyzes existing codebases',
38
+ ],
39
+ },
40
+
41
+ // 2. Feature with Roadmap (NEW - replaces idea)
42
+ {
43
+ name: 'feature',
44
+ category: 'core',
45
+ description: 'Add feature with value analysis, roadmap, and task breakdown',
46
+ usage: {
47
+ claude: '/p:feature "add unit testing"',
48
+ terminal: 'prjct feature "add unit testing"',
49
+ },
50
+ params: '<description>',
51
+ implemented: true,
52
+ hasTemplate: true,
53
+ icon: 'Package',
54
+ requiresInit: true,
55
+ blockingRules: null,
56
+ features: [
57
+ 'Value analysis (impact/effort/timing)',
58
+ 'Auto roadmap generation',
59
+ 'Task breakdown',
60
+ 'Auto-start first task',
61
+ 'Timing recommendations',
62
+ ],
63
+ },
64
+
65
+ // DEPRECATED: Use /p:feature instead
66
+ {
67
+ name: 'idea',
68
+ category: 'deprecated',
69
+ description: '[DEPRECATED] Use /p:feature instead',
70
+ usage: {
71
+ claude: null,
72
+ terminal: null,
73
+ },
74
+ params: '<text>',
75
+ implemented: false,
76
+ hasTemplate: true,
77
+ icon: 'Lightbulb',
78
+ requiresInit: true,
79
+ blockingRules: null,
80
+ deprecated: true,
81
+ replacedBy: 'feature',
82
+ },
83
+
84
+ // 3. Strategic Roadmap
85
+ {
86
+ name: 'roadmap',
87
+ category: 'core',
88
+ description: 'Strategic planning with ASCII logic maps',
89
+ usage: {
90
+ claude: '/p:roadmap',
91
+ terminal: 'prjct roadmap',
92
+ },
93
+ params: null,
94
+ implemented: false,
95
+ hasTemplate: true,
96
+ icon: 'Map',
97
+ requiresInit: true,
98
+ blockingRules: null,
99
+ features: [
100
+ 'ASCII logic maps (not mermaid)',
101
+ 'Shows approved ideas',
102
+ 'Implementation status',
103
+ 'Dependencies visualization',
104
+ ],
105
+ },
106
+
107
+ // 4. Status Dashboard
108
+ {
109
+ name: 'status',
110
+ category: 'core',
111
+ description: 'KPI dashboard with ASCII graphics',
112
+ usage: {
113
+ claude: '/p:status',
114
+ terminal: 'prjct status',
115
+ },
116
+ params: null,
117
+ implemented: false,
118
+ hasTemplate: true,
119
+ icon: 'BarChart3',
120
+ requiresInit: true,
121
+ blockingRules: null,
122
+ features: [
123
+ 'ASCII progress bars',
124
+ 'Task completion metrics',
125
+ 'Current focus display',
126
+ 'Time tracking',
127
+ 'Visual KPI dashboard',
128
+ ],
129
+ },
130
+
131
+ // 5. Current Task
132
+ {
133
+ name: 'now',
134
+ category: 'core',
135
+ description: 'Show current working task',
136
+ usage: {
137
+ claude: '/p:now',
138
+ terminal: 'prjct now',
139
+ },
140
+ params: null,
141
+ implemented: true,
142
+ hasTemplate: true,
143
+ icon: 'Target',
144
+ requiresInit: true,
145
+ blockingRules: null,
146
+ },
147
+
148
+ // 6. Build (Start Task)
149
+ {
150
+ name: 'build',
151
+ category: 'core',
152
+ description: 'Start task with agent assignment and tracking',
153
+ usage: {
154
+ claude: '/p:build "implement auth"',
155
+ terminal: 'prjct build "implement auth"',
156
+ },
157
+ params: '<task> | [1-5]',
158
+ implemented: false,
159
+ hasTemplate: true,
160
+ icon: 'Play',
161
+ requiresInit: true,
162
+ blockingRules: {
163
+ check: 'now.md must be empty',
164
+ message: 'Complete current task with /p:done first',
165
+ },
166
+ features: [
167
+ 'Agent assignment (auto or manual)',
168
+ 'GitHub dev tracking',
169
+ 'Time estimation by complexity',
170
+ 'Start time tracking',
171
+ 'Moves to now.md with metadata',
172
+ ],
173
+ },
174
+
175
+ // 7. Next Tasks
176
+ {
177
+ name: 'next',
178
+ category: 'core',
179
+ description: 'Show top 5 non-blocking priority tasks',
180
+ usage: {
181
+ claude: '/p:next',
182
+ terminal: 'prjct next',
183
+ },
184
+ params: null,
185
+ implemented: true, // Needs blocking logic
186
+ hasTemplate: true,
187
+ icon: 'List',
188
+ requiresInit: true,
189
+ blockingRules: {
190
+ check: 'filters blocked tasks',
191
+ message: 'Shows warning if now.md is active',
192
+ },
193
+ features: [
194
+ 'Filters out blocked tasks',
195
+ 'Shows top 5 by priority',
196
+ 'Numbered 1-5 for quick selection',
197
+ 'Warns if active task exists',
198
+ ],
199
+ },
200
+
201
+ // 8. Complete Task
202
+ {
203
+ name: 'done',
204
+ category: 'core',
205
+ description: 'Mark current task as complete',
206
+ usage: {
207
+ claude: '/p:done',
208
+ terminal: 'prjct done',
209
+ },
210
+ params: null,
211
+ implemented: true,
212
+ hasTemplate: true,
213
+ icon: 'CheckCircle',
214
+ requiresInit: true,
215
+ blockingRules: {
216
+ check: 'now.md must have content',
217
+ message: 'No active task to complete',
218
+ },
219
+ },
220
+
221
+ // 9. Ship Feature
222
+ {
223
+ name: 'ship',
224
+ category: 'core',
225
+ description: 'Commit, push, and celebrate shipped feature',
226
+ usage: {
227
+ claude: '/p:ship "user authentication"',
228
+ terminal: 'prjct ship "user authentication"',
229
+ },
230
+ params: '<feature>',
231
+ implemented: true, // Complete automated workflow
232
+ hasTemplate: true,
233
+ icon: 'Rocket',
234
+ requiresInit: true,
235
+ blockingRules: null,
236
+ features: [
237
+ 'Lint checks (non-blocking)',
238
+ 'Run tests (non-blocking)',
239
+ 'Update docs',
240
+ 'Update version',
241
+ 'Update CHANGELOG',
242
+ 'Git commit + push',
243
+ 'Recommend compact',
244
+ ],
245
+ },
246
+
247
+ // 10. Bug Tracking
248
+ {
249
+ name: 'bug',
250
+ category: 'core',
251
+ description: 'Report and track bugs with priority',
252
+ usage: {
253
+ claude: '/p:bug "login button not working"',
254
+ terminal: 'prjct bug "login button not working"',
255
+ },
256
+ params: '<description>',
257
+ implemented: true,
258
+ hasTemplate: true,
259
+ icon: 'Bug',
260
+ requiresInit: true,
261
+ blockingRules: null,
262
+ features: [
263
+ 'Auto-detect severity (critical/high/medium/low)',
264
+ 'Priority placement in next.md',
265
+ 'Bug tracking in memory',
266
+ 'Quick bug resolution workflow',
267
+ ],
268
+ },
269
+
270
+ // 11. Architect Execute
271
+ {
272
+ name: 'architect',
273
+ category: 'core',
274
+ description: 'Execute architect plan and generate code',
275
+ usage: {
276
+ claude: '/p:architect execute',
277
+ terminal: 'prjct architect execute',
278
+ },
279
+ params: 'execute',
280
+ implemented: true,
281
+ hasTemplate: false,
282
+ icon: 'Hammer',
283
+ requiresInit: true,
284
+ blockingRules: null,
285
+ features: [
286
+ 'Reads architect-session.md plan',
287
+ 'Generates code structure',
288
+ 'Uses Context7 for documentation',
289
+ 'Language-agnostic implementation',
290
+ ],
291
+ },
292
+
293
+ // ===== OPTIONAL COMMANDS (Advanced features) =====
294
+
295
+ // DEPRECATED: Workflow is now automatic in /p:ship
296
+ {
297
+ name: 'workflow',
298
+ category: 'deprecated',
299
+ description: '[DEPRECATED] Workflow is now automatic in /p:ship',
300
+ usage: {
301
+ claude: null,
302
+ terminal: null,
303
+ },
304
+ params: null,
305
+ implemented: false,
306
+ hasTemplate: true,
307
+ icon: 'GitBranch',
308
+ requiresInit: true,
309
+ blockingRules: null,
310
+ deprecated: true,
311
+ replacedBy: 'ship',
312
+ },
313
+ {
314
+ name: 'design',
315
+ category: 'optional',
316
+ description: 'Design system architecture, APIs, and components',
317
+ usage: {
318
+ claude: '/p:design authentication --type architecture',
319
+ terminal: 'prjct design authentication --type architecture',
320
+ },
321
+ params: '[target] --type architecture|api|component|database|flow',
322
+ implemented: true,
323
+ hasTemplate: true,
324
+ icon: 'Palette',
325
+ requiresInit: true,
326
+ blockingRules: null,
327
+ isOptional: true,
328
+ },
329
+ {
330
+ name: 'cleanup',
331
+ category: 'optional',
332
+ description: 'Clean up temp files and old entries',
333
+ usage: {
334
+ claude: '/p:cleanup',
335
+ terminal: 'prjct cleanup',
336
+ },
337
+ params: null,
338
+ implemented: true,
339
+ hasTemplate: true,
340
+ icon: 'Zap',
341
+ requiresInit: true,
342
+ blockingRules: null,
343
+ isOptional: true,
344
+ },
345
+ {
346
+ name: 'stuck',
347
+ category: 'optional',
348
+ description: 'Get contextual help with problems',
349
+ usage: {
350
+ claude: '/p:stuck "CORS error in API calls"',
351
+ terminal: 'prjct stuck "CORS error in API calls"',
352
+ },
353
+ params: '<issue description>',
354
+ implemented: true,
355
+ hasTemplate: true,
356
+ icon: 'HelpCircle',
357
+ requiresInit: true,
358
+ blockingRules: null,
359
+ isOptional: true,
360
+ },
361
+ {
362
+ name: 'analyze',
363
+ category: 'optional',
364
+ description: 'Analyze repository and sync tasks',
365
+ usage: {
366
+ claude: '/p:analyze',
367
+ terminal: 'prjct analyze',
368
+ },
369
+ params: null,
370
+ implemented: true,
371
+ hasTemplate: true,
372
+ icon: 'Search',
373
+ requiresInit: true,
374
+ blockingRules: null,
375
+ isOptional: true,
376
+ },
377
+ {
378
+ name: 'sync',
379
+ category: 'optional',
380
+ description: 'Sync project state and update workflow agents',
381
+ usage: {
382
+ claude: '/p:sync',
383
+ terminal: 'prjct sync',
384
+ },
385
+ params: null,
386
+ implemented: true,
387
+ hasTemplate: true,
388
+ icon: 'RefreshCw',
389
+ requiresInit: true,
390
+ blockingRules: null,
391
+ isOptional: true,
392
+ },
393
+
394
+ // ===== SETUP COMMANDS (Not part of daily workflow) =====
395
+ {
396
+ name: 'start',
397
+ category: 'setup',
398
+ description: 'First-time setup (install commands to editors)',
399
+ usage: {
400
+ claude: null,
401
+ terminal: 'prjct start',
402
+ },
403
+ params: null,
404
+ implemented: true,
405
+ hasTemplate: false,
406
+ icon: 'Terminal',
407
+ requiresInit: false,
408
+ blockingRules: null,
409
+ },
410
+ {
411
+ name: 'setup',
412
+ category: 'setup',
413
+ description: 'Reconfigure editor installations',
414
+ usage: {
415
+ claude: null,
416
+ terminal: 'prjct setup [--force] [--editor <name>]',
417
+ },
418
+ params: '[--force] [--editor <name>]',
419
+ implemented: true,
420
+ hasTemplate: false,
421
+ icon: 'Settings',
422
+ requiresInit: false,
423
+ blockingRules: null,
424
+ },
425
+ {
426
+ name: 'migrate-all',
427
+ category: 'setup',
428
+ description: 'Migrate all legacy projects',
429
+ usage: {
430
+ claude: null,
431
+ terminal: 'prjct migrate-all [--deep-scan] [--remove-legacy] [--dry-run]',
432
+ },
433
+ params: '[--deep-scan] [--remove-legacy] [--dry-run]',
434
+ implemented: true,
435
+ hasTemplate: false,
436
+ icon: 'Database',
437
+ requiresInit: false,
438
+ blockingRules: null,
439
+ },
440
+ ]
441
+
442
+ /**
443
+ * Category metadata
444
+ */
445
+ const CATEGORIES = {
446
+ core: {
447
+ title: 'Core Workflow',
448
+ icon: 'Zap',
449
+ description: '9 essential commands for daily development workflow',
450
+ order: 1,
451
+ },
452
+ optional: {
453
+ title: 'Optional Commands',
454
+ icon: 'Package',
455
+ description: 'Advanced features for specialized workflows',
456
+ order: 2,
457
+ },
458
+ setup: {
459
+ title: 'Setup',
460
+ icon: 'Terminal',
461
+ description: 'Installation and configuration (not for daily use)',
462
+ order: 3,
463
+ },
464
+ }
465
+
466
+ /**
467
+ * Helper functions
468
+ */
469
+ const registry = {
470
+ /**
471
+ * Get all commands
472
+ */
473
+ getAll: () => COMMANDS,
474
+
475
+ /**
476
+ * Get command by name
477
+ */
478
+ getByName: (name) => COMMANDS.find((c) => c.name === name),
479
+
480
+ /**
481
+ * Get commands by category
482
+ */
483
+ getByCategory: (category) => COMMANDS.filter((c) => c.category === category),
484
+
485
+ /**
486
+ * Get all implemented commands
487
+ */
488
+ getAllImplemented: () => COMMANDS.filter((c) => c.implemented),
489
+
490
+ /**
491
+ * Get all commands with templates
492
+ */
493
+ getAllWithTemplates: () => COMMANDS.filter((c) => c.hasTemplate),
494
+
495
+ /**
496
+ * Get commands available in Claude Code
497
+ */
498
+ getClaudeCommands: () => COMMANDS.filter((c) => c.usage.claude !== null),
499
+
500
+ /**
501
+ * Get commands available in terminal
502
+ */
503
+ getTerminalCommands: () => COMMANDS.filter((c) => c.usage.terminal !== null),
504
+
505
+ /**
506
+ * Get all categories
507
+ */
508
+ getCategories: () => CATEGORIES,
509
+
510
+ /**
511
+ * Get category metadata
512
+ */
513
+ getCategory: (category) => CATEGORIES[category],
514
+
515
+ /**
516
+ * Validate command registry
517
+ */
518
+ validate: () => {
519
+ const issues = []
520
+
521
+ // Check for duplicate names
522
+ const names = COMMANDS.map((c) => c.name)
523
+ const duplicates = names.filter((name, index) => names.indexOf(name) !== index)
524
+ if (duplicates.length > 0) {
525
+ issues.push(`Duplicate command names: ${duplicates.join(', ')}`)
526
+ }
527
+
528
+ // Check for commands with templates but not implemented
529
+ const notImplemented = COMMANDS.filter((c) => c.hasTemplate && !c.implemented)
530
+ if (notImplemented.length > 0) {
531
+ issues.push(
532
+ `Commands with templates but not implemented: ${notImplemented.map((c) => c.name).join(', ')}`
533
+ )
534
+ }
535
+
536
+ // Check for invalid categories
537
+ const validCategories = Object.keys(CATEGORIES)
538
+ const invalidCategories = COMMANDS.filter((c) => !validCategories.includes(c.category))
539
+ if (invalidCategories.length > 0) {
540
+ issues.push(
541
+ `Invalid categories: ${invalidCategories.map((c) => `${c.name}:${c.category}`).join(', ')}`
542
+ )
543
+ }
544
+
545
+ return {
546
+ valid: issues.length === 0,
547
+ issues,
548
+ }
549
+ },
550
+
551
+ /**
552
+ * Get core commands only (9 essential)
553
+ */
554
+ getCoreCommands: () => COMMANDS.filter((c) => c.category === 'core'),
555
+
556
+ /**
557
+ * Get optional commands
558
+ */
559
+ getOptionalCommands: () => COMMANDS.filter((c) => c.category === 'optional'),
560
+
561
+ /**
562
+ * Get commands that require initialization
563
+ */
564
+ getRequiresInit: () => COMMANDS.filter((c) => c.requiresInit),
565
+
566
+ /**
567
+ * Get commands with blocking rules
568
+ * NOTE: Blocking rules are now handled by Claude reading templates, not deterministic code
569
+ */
570
+ getWithBlockingRules: () => COMMANDS.filter((c) => c.blockingRules !== null),
571
+
572
+ /**
573
+ * Get statistics
574
+ */
575
+ getStats: () => ({
576
+ total: COMMANDS.length,
577
+ core: COMMANDS.filter((c) => c.category === 'core').length,
578
+ optional: COMMANDS.filter((c) => c.category === 'optional').length,
579
+ setup: COMMANDS.filter((c) => c.category === 'setup').length,
580
+ implemented: COMMANDS.filter((c) => c.implemented).length,
581
+ withTemplates: COMMANDS.filter((c) => c.hasTemplate).length,
582
+ claudeOnly: COMMANDS.filter((c) => c.usage.claude && !c.usage.terminal).length,
583
+ terminalOnly: COMMANDS.filter((c) => !c.usage.claude && c.usage.terminal).length,
584
+ both: COMMANDS.filter((c) => c.usage.claude && c.usage.terminal).length,
585
+ requiresInit: COMMANDS.filter((c) => c.requiresInit).length,
586
+ withBlockingRules: COMMANDS.filter((c) => c.blockingRules !== null).length,
587
+ byCategory: Object.keys(CATEGORIES).reduce(
588
+ (acc, cat) => ({
589
+ ...acc,
590
+ [cat]: COMMANDS.filter((c) => c.category === cat).length,
591
+ }),
592
+ {}
593
+ ),
594
+ }),
595
+ }
596
+
597
+ module.exports = registry