prjct-cli 0.8.6 โ†’ 0.9.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 (47) hide show
  1. package/CHANGELOG.md +216 -0
  2. package/CLAUDE.md +34 -0
  3. package/core/agentic/agent-router.js +482 -0
  4. package/core/agentic/command-executor.js +70 -15
  5. package/core/agentic/context-builder.js +4 -3
  6. package/core/agentic/context-filter.js +545 -0
  7. package/core/agentic/prompt-builder.js +48 -38
  8. package/core/agentic/tool-registry.js +35 -0
  9. package/core/command-registry.js +104 -164
  10. package/core/commands.js +84 -0
  11. package/core/domain/agent-generator.js +55 -44
  12. package/core/domain/architecture-generator.js +561 -0
  13. package/core/domain/task-stack.js +496 -0
  14. package/core/infrastructure/legacy-installer-detector.js +546 -0
  15. package/core/infrastructure/session-manager.js +14 -2
  16. package/core/infrastructure/setup.js +29 -11
  17. package/core/utils/jsonl-helper.js +137 -0
  18. package/package.json +1 -1
  19. package/scripts/install.sh +45 -8
  20. package/scripts/postinstall.js +5 -5
  21. package/templates/agents/AGENTS.md +3 -3
  22. package/templates/commands/analyze.md +10 -53
  23. package/templates/commands/ask.md +25 -338
  24. package/templates/commands/bug.md +11 -70
  25. package/templates/commands/build.md +8 -35
  26. package/templates/commands/cleanup.md +9 -32
  27. package/templates/commands/dash.md +241 -0
  28. package/templates/commands/design.md +5 -28
  29. package/templates/commands/done.md +6 -20
  30. package/templates/commands/feature.md +12 -225
  31. package/templates/commands/help.md +26 -313
  32. package/templates/commands/idea.md +7 -25
  33. package/templates/commands/init.md +15 -191
  34. package/templates/commands/migrate-all.md +25 -84
  35. package/templates/commands/next.md +6 -26
  36. package/templates/commands/now.md +6 -25
  37. package/templates/commands/pause.md +18 -0
  38. package/templates/commands/progress.md +5 -50
  39. package/templates/commands/recap.md +5 -54
  40. package/templates/commands/resume.md +97 -0
  41. package/templates/commands/ship.md +14 -135
  42. package/templates/commands/status.md +7 -32
  43. package/templates/commands/suggest.md +36 -495
  44. package/templates/commands/sync.md +7 -24
  45. package/templates/commands/work.md +44 -0
  46. package/templates/commands/workflow.md +3 -25
  47. package/templates/planning-methodology.md +195 -0
@@ -9,6 +9,7 @@ const path = require('path')
9
9
  const { promisify } = require('util')
10
10
  const { exec: execCallback } = require('child_process')
11
11
  const exec = promisify(execCallback)
12
+ const dateHelper = require('../utils/date-helper')
12
13
 
13
14
  class ToolRegistry {
14
15
  constructor() {
@@ -17,6 +18,9 @@ class ToolRegistry {
17
18
  Write: this.write.bind(this),
18
19
  Bash: this.bash.bind(this),
19
20
  Exec: this.bash.bind(this), // Alias
21
+ GetTimestamp: this.getTimestamp.bind(this),
22
+ GetDate: this.getDate.bind(this),
23
+ GetDateTime: this.getDateTime.bind(this),
20
24
  }
21
25
  }
22
26
 
@@ -112,6 +116,37 @@ class ToolRegistry {
112
116
  return []
113
117
  }
114
118
  }
119
+
120
+ /**
121
+ * Get current system timestamp (ISO format)
122
+ * LLM MUST use this instead of generating timestamps
123
+ * @returns {Promise<string>} ISO timestamp (e.g., "2025-10-07T14:30:00.000Z")
124
+ */
125
+ async getTimestamp() {
126
+ return dateHelper.getTimestamp()
127
+ }
128
+
129
+ /**
130
+ * Get current system date (YYYY-MM-DD)
131
+ * LLM MUST use this instead of generating dates
132
+ * @returns {Promise<string>} Date string (e.g., "2025-10-07")
133
+ */
134
+ async getDate() {
135
+ return dateHelper.getTodayKey()
136
+ }
137
+
138
+ /**
139
+ * Get current system date/time components
140
+ * @returns {Promise<Object>} Date components {timestamp, date, year, month, day}
141
+ */
142
+ async getDateTime() {
143
+ const now = new Date()
144
+ return {
145
+ timestamp: dateHelper.getTimestamp(),
146
+ date: dateHelper.getTodayKey(),
147
+ ...dateHelper.getYearMonthDay(now),
148
+ }
149
+ }
115
150
  }
116
151
 
117
152
  module.exports = new ToolRegistry()
@@ -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: {
package/core/commands.js CHANGED
@@ -1126,6 +1126,81 @@ class PrjctCommands {
1126
1126
  * /p:design - Design system architecture, APIs, and components
1127
1127
  * AGENTIC EXECUTION
1128
1128
  */
1129
+ /**
1130
+ * Memory cleanup helper
1131
+ * Rotates large JSONL files, archives old sessions, reports disk usage
1132
+ * @private
1133
+ */
1134
+ async _cleanupMemory(projectPath) {
1135
+ const projectId = await configManager.getProjectId(projectPath)
1136
+ const globalPath = pathManager.getGlobalProjectPath(projectId)
1137
+
1138
+ console.log('๐Ÿ“Š Analyzing disk usage...\n')
1139
+
1140
+ const results = {
1141
+ rotated: [],
1142
+ archived: [],
1143
+ totalSize: 0,
1144
+ freedSpace: 0,
1145
+ }
1146
+
1147
+ // 1. Check and rotate large JSONL files
1148
+ const jsonlFiles = [
1149
+ pathManager.getFilePath(projectId, 'memory', 'context.jsonl'),
1150
+ pathManager.getFilePath(projectId, 'progress', 'shipped.md'),
1151
+ pathManager.getFilePath(projectId, 'planning', 'ideas.md'),
1152
+ ]
1153
+
1154
+ for (const filePath of jsonlFiles) {
1155
+ try {
1156
+ const sizeMB = await jsonlHelper.getFileSizeMB(filePath)
1157
+ if (sizeMB > 0) {
1158
+ results.totalSize += sizeMB
1159
+
1160
+ const rotated = await jsonlHelper.rotateJsonLinesIfNeeded(filePath, 10)
1161
+ if (rotated) {
1162
+ results.rotated.push(path.basename(filePath))
1163
+ results.freedSpace += sizeMB
1164
+ }
1165
+ }
1166
+ } catch (error) {
1167
+ // File doesn't exist, skip
1168
+ }
1169
+ }
1170
+
1171
+ // 2. Report disk usage
1172
+ console.log('๐Ÿ’พ Disk Usage Report:\n')
1173
+ console.log(` Total size: ${results.totalSize.toFixed(2)}MB`)
1174
+ console.log(` Rotated files: ${results.rotated.length}`)
1175
+
1176
+ if (results.rotated.length > 0) {
1177
+ console.log(` Freed space: ${results.freedSpace.toFixed(2)}MB\n`)
1178
+ results.rotated.forEach((file) => console.log(` โœ“ ${file}`))
1179
+ } else {
1180
+ console.log(' โœ“ No rotation needed - all files under 10MB\n')
1181
+ }
1182
+
1183
+ // 3. Suggestions
1184
+ console.log('\n๐Ÿ’ก Recommendations:\n')
1185
+ console.log(' 1. Claude Code: Compact conversation regularly')
1186
+ console.log(' 2. Exclude from Spotlight: System Settings โ†’ Privacy')
1187
+ console.log(' 3. Clear npm cache: npm cache clean --force\n')
1188
+
1189
+ return { success: true, results }
1190
+ }
1191
+
1192
+ /**
1193
+ * Internal cleanup helper for memory during normal cleanup
1194
+ * @private
1195
+ */
1196
+ async _cleanupMemoryInternal(projectPath) {
1197
+ const projectId = await configManager.getProjectId(projectPath)
1198
+
1199
+ // Silently rotate large files
1200
+ const memoryPath = pathManager.getFilePath(projectId, 'memory', 'context.jsonl')
1201
+ await jsonlHelper.rotateJsonLinesIfNeeded(memoryPath, 10)
1202
+ }
1203
+
1129
1204
  async design(target = null, options = {}, projectPath = process.cwd()) {
1130
1205
  try {
1131
1206
  const initResult = await this.ensureProjectInit(projectPath)
@@ -1575,6 +1650,13 @@ Process flow for ${target}.
1575
1650
  const initResult = await this.ensureProjectInit(projectPath)
1576
1651
  if (!initResult.success) return initResult
1577
1652
 
1653
+ const isMemoryMode = _options.memory === true || _options.type === 'memory'
1654
+
1655
+ if (isMemoryMode) {
1656
+ console.log('๐Ÿงน Memory cleanup...\n')
1657
+ return await this._cleanupMemory(projectPath)
1658
+ }
1659
+
1578
1660
  console.log('๐Ÿงน Cleaning up project...\n')
1579
1661
 
1580
1662
  const context = await contextBuilder.build(projectPath)
@@ -1649,6 +1731,8 @@ Process flow for ${target}.
1649
1731
  console.log('โœ… Cleanup complete!\n')
1650
1732
  cleaned.forEach((item) => console.log(` โ€ข ${item}`))
1651
1733
 
1734
+ await this._cleanupMemoryInternal(projectPath)
1735
+
1652
1736
  await this.logToMemory(projectPath, 'cleanup_performed', {
1653
1737
  items: cleaned.length,
1654
1738
  timestamp: dateHelper.getTimestamp(),