prjct-cli 0.8.8 → 0.9.2

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 (40) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/core/__tests__/agentic/agent-router.test.js +398 -0
  3. package/core/__tests__/agentic/context-filter.test.js +494 -0
  4. package/core/__tests__/domain/analyzer.test.js +324 -0
  5. package/core/__tests__/infrastructure/author-detector.test.js +103 -0
  6. package/core/__tests__/infrastructure/config-manager.test.js +454 -0
  7. package/core/__tests__/infrastructure/path-manager.test.js +412 -0
  8. package/core/__tests__/utils/jsonl-helper.test.js +387 -0
  9. package/core/agentic/agent-router.js +482 -0
  10. package/core/agentic/command-executor.js +70 -15
  11. package/core/agentic/context-filter.js +549 -0
  12. package/core/agentic/prompt-builder.js +48 -38
  13. package/core/command-registry.js +104 -164
  14. package/core/domain/agent-generator.js +55 -44
  15. package/core/domain/architecture-generator.js +561 -0
  16. package/core/domain/task-stack.js +496 -0
  17. package/package.json +2 -1
  18. package/templates/commands/analyze.md +10 -53
  19. package/templates/commands/bug.md +11 -70
  20. package/templates/commands/build.md +7 -37
  21. package/templates/commands/cleanup.md +9 -32
  22. package/templates/commands/dash.md +241 -0
  23. package/templates/commands/design.md +5 -28
  24. package/templates/commands/done.md +6 -20
  25. package/templates/commands/feature.md +11 -83
  26. package/templates/commands/help.md +9 -38
  27. package/templates/commands/idea.md +7 -28
  28. package/templates/commands/init.md +10 -89
  29. package/templates/commands/next.md +6 -26
  30. package/templates/commands/now.md +6 -26
  31. package/templates/commands/pause.md +18 -0
  32. package/templates/commands/progress.md +5 -50
  33. package/templates/commands/recap.md +5 -54
  34. package/templates/commands/resume.md +97 -0
  35. package/templates/commands/ship.md +13 -68
  36. package/templates/commands/status.md +7 -32
  37. package/templates/commands/sync.md +7 -24
  38. package/templates/commands/work.md +44 -0
  39. package/templates/commands/workflow.md +3 -25
  40. package/templates/planning-methodology.md +195 -0
@@ -8,7 +8,7 @@
8
8
  * - CLAUDE.md (AI assistant instructions)
9
9
  * - scripts/validate-commands.js (validation)
10
10
  *
11
- * @version 0.8.0 - Conversational interface with zero memorization
11
+ * @version 0.9.0 - Simplified commands with pause/resume and intelligent idea development
12
12
  */
13
13
 
14
14
  const COMMANDS = [
@@ -38,137 +38,129 @@ const COMMANDS = [
38
38
  ],
39
39
  },
40
40
 
41
- // 2. Feature with Roadmap (NEW - replaces idea)
41
+ // 2. Idea Development - Transform ideas into complete architectures
42
42
  {
43
- name: 'feature',
43
+ name: 'idea',
44
44
  category: 'core',
45
- description: 'Add feature with value analysis, roadmap, and task breakdown',
45
+ description: 'Transform ideas into complete technical architectures',
46
46
  usage: {
47
- claude: '/p:feature "add unit testing"',
48
- terminal: 'prjct feature "add unit testing"',
47
+ claude: '/p:idea "build a CRM with AI"',
48
+ terminal: 'prjct idea "build a CRM with AI"',
49
49
  },
50
50
  params: '<description>',
51
51
  implemented: true,
52
52
  hasTemplate: true,
53
- icon: 'Package',
53
+ icon: 'Lightbulb',
54
54
  requiresInit: true,
55
55
  blockingRules: null,
56
56
  features: [
57
- 'Value analysis (impact/effort/timing)',
58
- 'Auto roadmap generation',
59
- 'Task breakdown',
60
- 'Auto-start first task',
61
- 'Timing recommendations',
57
+ 'Simple ideas → Quick capture',
58
+ 'Complex ideas → Full architecture',
59
+ 'Interactive discovery process',
60
+ 'Tech stack recommendation',
61
+ 'Complete roadmap generation',
62
+ 'Database schema design',
63
+ 'API specification',
62
64
  ],
63
65
  },
64
66
 
65
- // DEPRECATED: Use /p:feature instead
67
+ // 3. Feature with Roadmap
66
68
  {
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',
69
+ name: 'feature',
87
70
  category: 'core',
88
- description: 'Strategic planning with ASCII logic maps',
71
+ description: 'Add feature with value analysis, roadmap, and task breakdown',
89
72
  usage: {
90
- claude: '/p:roadmap',
91
- terminal: 'prjct roadmap',
73
+ claude: '/p:feature "add unit testing"',
74
+ terminal: 'prjct feature "add unit testing"',
92
75
  },
93
- params: null,
76
+ params: '<description>',
94
77
  implemented: true,
95
78
  hasTemplate: true,
96
- icon: 'Map',
79
+ icon: 'Package',
97
80
  requiresInit: true,
98
81
  blockingRules: null,
99
82
  features: [
100
- 'ASCII logic maps (not mermaid)',
101
- 'Shows approved ideas',
102
- 'Implementation status',
103
- 'Dependencies visualization',
83
+ 'Value analysis (impact/effort/timing)',
84
+ 'Auto roadmap generation',
85
+ 'Task breakdown',
86
+ 'Auto-start first task',
87
+ 'Timing recommendations',
104
88
  ],
105
89
  },
106
90
 
107
- // 4. Status Dashboard
91
+ // 4. Work - Unified task management (replaces now + build)
108
92
  {
109
- name: 'status',
93
+ name: 'work',
110
94
  category: 'core',
111
- description: 'KPI dashboard with ASCII graphics',
95
+ description: 'Show current or start new task',
112
96
  usage: {
113
- claude: '/p:status',
114
- terminal: 'prjct status',
97
+ claude: '/p:work ["task"]',
98
+ terminal: 'prjct work ["task"]',
115
99
  },
116
- params: null,
100
+ params: '[task]',
117
101
  implemented: true,
118
102
  hasTemplate: true,
119
- icon: 'BarChart3',
103
+ icon: 'Target',
120
104
  requiresInit: true,
121
105
  blockingRules: null,
122
106
  features: [
123
- 'ASCII progress bars',
124
- 'Task completion metrics',
125
- 'Current focus display',
126
- 'Time tracking',
127
- 'Visual KPI dashboard',
107
+ 'No params → Show current task',
108
+ 'With task → Start new task',
109
+ 'Auto agent assignment',
110
+ 'Supports task numbers',
111
+ 'Replaces /p:now and /p:build',
128
112
  ],
129
113
  },
130
114
 
131
- // 5. Current Task
115
+ // 5. Pause - Pause active task
132
116
  {
133
- name: 'now',
117
+ name: 'pause',
134
118
  category: 'core',
135
- description: 'Show current working task',
119
+ description: 'Pause active task to handle interruption',
136
120
  usage: {
137
- claude: '/p:now',
138
- terminal: 'prjct now',
121
+ claude: '/p:pause ["reason"]',
122
+ terminal: 'prjct pause ["reason"]',
139
123
  },
140
- params: null,
124
+ params: '[reason]',
141
125
  implemented: true,
142
126
  hasTemplate: true,
143
- icon: 'Target',
127
+ icon: 'Pause',
144
128
  requiresInit: true,
145
- blockingRules: null,
129
+ blockingRules: {
130
+ check: 'Active task exists',
131
+ message: 'No active task to pause',
132
+ },
133
+ features: [
134
+ 'Preserves task context',
135
+ 'Optional pause reason',
136
+ 'Tracks paused duration',
137
+ 'Allows multiple paused tasks',
138
+ ],
146
139
  },
147
140
 
148
- // 6. Build (Start Task)
141
+ // 6. Resume - Resume paused task
149
142
  {
150
- name: 'build',
143
+ name: 'resume',
151
144
  category: 'core',
152
- description: 'Start task with agent assignment and tracking',
145
+ description: 'Resume most recently paused task',
153
146
  usage: {
154
- claude: '/p:build "implement auth"',
155
- terminal: 'prjct build "implement auth"',
147
+ claude: '/p:resume [task_id]',
148
+ terminal: 'prjct resume [task_id]',
156
149
  },
157
- params: '<task> | [1-5]',
150
+ params: '[task_id]',
158
151
  implemented: true,
159
152
  hasTemplate: true,
160
153
  icon: 'Play',
161
154
  requiresInit: true,
162
155
  blockingRules: {
163
- check: 'now.md must be empty',
164
- message: 'Complete current task with /p:done first',
156
+ check: 'Paused tasks exist',
157
+ message: 'No paused tasks to resume',
165
158
  },
166
159
  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',
160
+ 'Resume last paused',
161
+ 'Resume specific task',
162
+ 'Resume by number',
163
+ 'Calculates active time',
172
164
  ],
173
165
  },
174
166
 
@@ -267,97 +259,77 @@ const COMMANDS = [
267
259
  ],
268
260
  },
269
261
 
270
- // 11. Ask - Intent to Action
262
+ // 11. Dashboard - Unified project view (replaces status, recap, progress, roadmap)
271
263
  {
272
- name: 'ask',
264
+ name: 'dash',
273
265
  category: 'core',
274
- description: 'Conversational intent to action translator',
266
+ description: 'Unified dashboard - status, progress, and roadmap',
275
267
  usage: {
276
- claude: '/p:ask "what you want to do"',
277
- terminal: 'prjct ask "what you want to do"',
268
+ claude: '/p:dash [view]',
269
+ terminal: 'prjct dash [view]',
278
270
  },
279
- params: '<description>',
271
+ params: '[week|month|roadmap|compact]',
280
272
  implemented: true,
281
273
  hasTemplate: true,
282
- icon: 'MessageCircle',
283
- requiresInit: false, // Can work before init to guide setup
274
+ icon: 'BarChart3',
275
+ requiresInit: true,
284
276
  blockingRules: null,
285
277
  features: [
286
- 'Natural language understanding',
287
- 'Recommends command flow',
288
- 'Educational explanations',
289
- 'Interactive confirmation',
290
- 'Works in any language',
278
+ 'Project overview',
279
+ 'Weekly/monthly progress',
280
+ 'Roadmap view',
281
+ 'ASCII graphics',
282
+ 'Replaces 4 commands',
291
283
  ],
292
284
  },
293
285
 
294
- // 12. Suggest - Context-Aware Recommendations
286
+ // 12. Help - Enhanced contextual help (absorbs ask, suggest, stuck)
295
287
  {
296
- name: 'suggest',
288
+ name: 'help',
297
289
  category: 'core',
298
- description: 'Context-aware next steps suggestions',
290
+ description: 'Contextual help and guidance',
299
291
  usage: {
300
- claude: '/p:suggest',
301
- terminal: 'prjct suggest',
292
+ claude: '/p:help [topic]',
293
+ terminal: 'prjct help [topic]',
302
294
  },
303
- params: null,
295
+ params: '[topic]',
304
296
  implemented: true,
305
297
  hasTemplate: true,
306
- icon: 'Lightbulb',
307
- requiresInit: true,
298
+ icon: 'HelpCircle',
299
+ requiresInit: false,
308
300
  blockingRules: null,
309
301
  features: [
310
- 'Analyzes project state',
311
- 'Recommends actions',
312
- 'Urgency detection',
313
- 'Momentum tracking',
314
- 'Personalized suggestions',
302
+ 'Context-aware suggestions',
303
+ 'Intent to action translator',
304
+ 'Problem solving guidance',
305
+ 'Absorbs ask/suggest/stuck',
315
306
  ],
316
307
  },
317
308
 
318
- // 13. Architect Execute
309
+ // 13. Sync - Sync project state
319
310
  {
320
- name: 'architect',
311
+ name: 'sync',
321
312
  category: 'core',
322
- description: 'Execute architect plan and generate code',
313
+ description: 'Sync project state and update workflow agents',
323
314
  usage: {
324
- claude: '/p:architect execute',
325
- terminal: 'prjct architect execute',
315
+ claude: '/p:sync',
316
+ terminal: 'prjct sync',
326
317
  },
327
- params: 'execute',
318
+ params: null,
328
319
  implemented: true,
329
- hasTemplate: false,
330
- icon: 'Hammer',
320
+ hasTemplate: true,
321
+ icon: 'RefreshCw',
331
322
  requiresInit: true,
332
323
  blockingRules: null,
333
324
  features: [
334
- 'Reads architect-session.md plan',
335
- 'Generates code structure',
336
- 'Uses Context7 for documentation',
337
- 'Language-agnostic implementation',
325
+ 'Syncs project state',
326
+ 'Updates dynamic agents',
327
+ 'Refreshes context',
338
328
  ],
339
329
  },
340
330
 
341
331
  // ===== OPTIONAL COMMANDS (Advanced features) =====
342
332
 
343
- // DEPRECATED: Workflow is now automatic in /p:ship
344
- {
345
- name: 'workflow',
346
- category: 'deprecated',
347
- description: '[DEPRECATED] Workflow is now automatic in /p:ship',
348
- usage: {
349
- claude: null,
350
- terminal: null,
351
- },
352
- params: null,
353
- implemented: false,
354
- hasTemplate: true,
355
- icon: 'GitBranch',
356
- requiresInit: true,
357
- blockingRules: null,
358
- deprecated: true,
359
- replacedBy: 'ship',
360
- },
361
333
  {
362
334
  name: 'design',
363
335
  category: 'optional',
@@ -390,22 +362,6 @@ const COMMANDS = [
390
362
  blockingRules: null,
391
363
  isOptional: true,
392
364
  },
393
- {
394
- name: 'stuck',
395
- category: 'optional',
396
- description: 'Get contextual help with problems',
397
- usage: {
398
- claude: '/p:stuck "CORS error in API calls"',
399
- terminal: 'prjct stuck "CORS error in API calls"',
400
- },
401
- params: '<issue description>',
402
- implemented: true,
403
- hasTemplate: true,
404
- icon: 'HelpCircle',
405
- requiresInit: true,
406
- blockingRules: null,
407
- isOptional: true,
408
- },
409
365
  {
410
366
  name: 'analyze',
411
367
  category: 'optional',
@@ -422,22 +378,6 @@ const COMMANDS = [
422
378
  blockingRules: null,
423
379
  isOptional: true,
424
380
  },
425
- {
426
- name: 'sync',
427
- category: 'optional',
428
- description: 'Sync project state and update workflow agents',
429
- usage: {
430
- claude: '/p:sync',
431
- terminal: 'prjct sync',
432
- },
433
- params: null,
434
- implemented: true,
435
- hasTemplate: true,
436
- icon: 'RefreshCw',
437
- requiresInit: true,
438
- blockingRules: null,
439
- isOptional: true,
440
- },
441
381
 
442
382
  // ===== SETUP COMMANDS (Not part of daily workflow) =====
443
383
  {
@@ -494,7 +434,7 @@ const CATEGORIES = {
494
434
  core: {
495
435
  title: 'Core Workflow',
496
436
  icon: 'Zap',
497
- description: '13 essential commands for daily development workflow',
437
+ description: '13 essential commands for daily development workflow (simplified)',
498
438
  order: 1,
499
439
  },
500
440
  optional: {
@@ -3,71 +3,82 @@ const path = require('path')
3
3
  const os = require('os')
4
4
 
5
5
  /**
6
- * AgentGenerator - Dynamic agent generation for prjct-cli
7
- *
8
- * 100% AGENTIC - Claude decides which agents to create based on project analysis.
9
- * NO predetermined patterns, NO if/else logic, NO assumptions.
10
- *
11
- * @version 0.6.0 - Fully agentic refactor
6
+ * AgentGenerator - Universal Dynamic Agent Generation
7
+ * Optimized for minimal context usage
8
+ * @version 1.0.0
12
9
  */
13
10
  class AgentGenerator {
14
11
  constructor(projectId = null) {
15
12
  this.projectId = projectId
16
-
17
- // Agents are stored in global project directory
18
- if (projectId) {
19
- this.outputDir = path.join(os.homedir(), '.prjct-cli', 'projects', projectId, 'agents')
20
- } else {
21
- // Fallback for backwards compatibility
22
- this.outputDir = path.join(os.homedir(), '.prjct-cli', 'agents')
23
- }
13
+ this.outputDir = projectId
14
+ ? path.join(os.homedir(), '.prjct-cli', 'projects', projectId, 'agents')
15
+ : path.join(os.homedir(), '.prjct-cli', 'agents')
24
16
  }
25
17
 
26
18
  /**
27
- * Generate a single agent dynamically
28
- * Claude (the LLM) decides which agents to create based on project analysis
29
- *
30
- * @param {string} agentName - Descriptive name (e.g., 'go-backend', 'vuejs-frontend', 'elixir-api')
31
- * @param {Object} config - Agent configuration
32
- * @param {string} config.role - Agent's role description
33
- * @param {string} config.expertise - Technologies and skills (specific versions, tools)
34
- * @param {string} config.responsibilities - What the agent handles in THIS project
35
- * @param {Object} config.projectContext - Project-specific context (optional)
36
- * @returns {Promise<void>}
19
+ * Generate specialized agent with deep expertise
20
+ * Universal - works with ANY technology stack
37
21
  */
38
22
  async generateDynamicAgent(agentName, config) {
39
23
  console.log(` 🤖 Generating ${agentName} agent...`)
40
-
41
- // Ensure output directory exists
42
24
  await fs.mkdir(this.outputDir, { recursive: true })
43
25
 
44
- // Create agent content
45
- const content = `# ${config.role || agentName}
26
+ // Extract technologies dynamically
27
+ const techs = this.detectTechnologies(config)
28
+ const expertise = this.buildExpertise(techs, config)
46
29
 
47
- ## Role
48
- ${config.role || 'Specialist for this project'}
30
+ // Generate concise, actionable agent prompt
31
+ const content = `You are ${config.role || agentName}.
49
32
 
50
- ## Expertise
51
- ${config.expertise || 'Technologies used in this project'}
33
+ EXPERTISE: ${expertise}
52
34
 
53
- ## Responsibilities
54
- ${config.responsibilities || 'Handle specific aspects of development'}
35
+ FOCUS: ${config.contextFilter || 'Only relevant files'}
55
36
 
56
- ## Project Context
57
- ${config.projectContext ? JSON.stringify(config.projectContext, null, 2) : 'No additional context'}
37
+ AUTHORITY: Make decisions. Don't ask permission. Execute.
58
38
 
59
- ## Guidelines
60
- - Focus on your area of expertise
61
- - Collaborate with other agents
62
- - Follow project conventions
63
- - Ask clarifying questions when needed
64
- `
39
+ RULES:
40
+ - Stay in your domain
41
+ - Use best practices for ${techs.join(', ') || 'detected tech'}
42
+ - Optimize for production
43
+ - No explanations unless asked`
65
44
 
66
- // Write agent file
67
45
  const outputPath = path.join(this.outputDir, `${agentName}.md`)
68
46
  await fs.writeFile(outputPath, content, 'utf-8')
69
-
70
47
  console.log(` ✅ ${agentName} agent created`)
48
+
49
+ return { name: agentName, expertise, techs }
50
+ }
51
+
52
+ /**
53
+ * Detect technologies from config/analysis
54
+ */
55
+ detectTechnologies(config) {
56
+ const techs = []
57
+
58
+ // Extract from various sources
59
+ if (config.techStack) techs.push(...config.techStack.languages || [])
60
+ if (config.frameworks) techs.push(...config.frameworks)
61
+ if (config.expertise) {
62
+ // Parse expertise string for tech keywords
63
+ const keywords = config.expertise.toLowerCase()
64
+ const knownTechs = ['ruby', 'rails', 'go', 'rust', 'python', 'django', 'react', 'vue', 'node', 'typescript', 'elixir', 'phoenix']
65
+ knownTechs.forEach(tech => {
66
+ if (keywords.includes(tech)) techs.push(tech)
67
+ })
68
+ }
69
+
70
+ return [...new Set(techs)]
71
+ }
72
+
73
+ /**
74
+ * Build concise expertise string
75
+ */
76
+ buildExpertise(techs, config) {
77
+ const tech = techs.length > 0 ? techs.join(', ') : 'detected stack'
78
+ const domain = config.domain || 'assigned domain'
79
+ const focus = config.responsibilities || 'task at hand'
80
+
81
+ return `${tech} expert. ${domain}. Focus: ${focus}`
71
82
  }
72
83
 
73
84
  /**