prjct-cli 0.4.8 โ 0.5.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.
- package/CHANGELOG.md +337 -0
- package/CLAUDE.md +109 -3
- package/README.md +228 -93
- package/core/agent-detector.js +55 -122
- package/core/agent-generator.js +516 -0
- package/core/command-installer.js +109 -806
- package/core/commands.js +5 -34
- package/core/editors-config.js +9 -28
- package/core/git-integration.js +401 -0
- package/package.json +10 -7
- package/scripts/install.sh +0 -1
- package/templates/agents/be.template.md +42 -0
- package/templates/agents/data.template.md +41 -0
- package/templates/agents/devops.template.md +41 -0
- package/templates/agents/fe.template.md +42 -0
- package/templates/agents/mobile.template.md +41 -0
- package/templates/agents/pm.template.md +84 -0
- package/templates/agents/qa.template.md +54 -0
- package/templates/agents/scribe.template.md +95 -0
- package/templates/agents/security.template.md +41 -0
- package/templates/agents/ux.template.md +49 -0
- package/templates/commands/analyze.md +137 -3
- package/templates/commands/done.md +154 -5
- package/templates/commands/init.md +61 -3
- package/templates/commands/ship.md +146 -6
- package/templates/commands/sync.md +220 -0
- package/templates/examples/natural-language-examples.md +234 -22
- package/core/agents/codex-agent.js +0 -256
- package/core/agents/terminal-agent.js +0 -465
- package/templates/workflows/analyze.md +0 -159
- package/templates/workflows/cleanup.md +0 -73
- package/templates/workflows/context.md +0 -72
- package/templates/workflows/design.md +0 -88
- package/templates/workflows/done.md +0 -20
- package/templates/workflows/fix.md +0 -201
- package/templates/workflows/git.md +0 -192
- package/templates/workflows/help.md +0 -13
- package/templates/workflows/idea.md +0 -22
- package/templates/workflows/init.md +0 -80
- package/templates/workflows/natural-language-handler.md +0 -183
- package/templates/workflows/next.md +0 -44
- package/templates/workflows/now.md +0 -19
- package/templates/workflows/progress.md +0 -113
- package/templates/workflows/recap.md +0 -66
- package/templates/workflows/roadmap.md +0 -95
- package/templates/workflows/ship.md +0 -18
- package/templates/workflows/stuck.md +0 -25
- package/templates/workflows/task.md +0 -109
- package/templates/workflows/test.md +0 -243
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal Agent Adapter
|
|
3
|
-
* Implements prjct commands for terminal/CLI environment
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs').promises
|
|
7
|
-
|
|
8
|
-
let chalk
|
|
9
|
-
let animations
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
chalk = require('chalk')
|
|
13
|
-
|
|
14
|
-
if (chalk.supportsColor && chalk.supportsColor.has16m) {
|
|
15
|
-
animations = require('../animations')
|
|
16
|
-
} else {
|
|
17
|
-
animations = require('../animations-simple')
|
|
18
|
-
}
|
|
19
|
-
} catch (e) {
|
|
20
|
-
chalk = {
|
|
21
|
-
green: (str) => str,
|
|
22
|
-
blue: (str) => str,
|
|
23
|
-
yellow: (str) => str,
|
|
24
|
-
red: (str) => str,
|
|
25
|
-
cyan: (str) => str,
|
|
26
|
-
magenta: (str) => str,
|
|
27
|
-
bold: (str) => str,
|
|
28
|
-
dim: (str) => str,
|
|
29
|
-
}
|
|
30
|
-
animations = null
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
class TerminalAgent {
|
|
34
|
-
constructor() {
|
|
35
|
-
this.name = 'Terminal/CLI'
|
|
36
|
-
this.type = 'terminal'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Format response for terminal with ANSI colors and emojis
|
|
41
|
-
*/
|
|
42
|
-
formatResponse(message, type = 'info') {
|
|
43
|
-
if (animations) {
|
|
44
|
-
if (type === 'success' && message.includes('Cleanup complete')) {
|
|
45
|
-
const filesMatch = message.match(/Files removed: (\d+)/)
|
|
46
|
-
const tasksMatch = message.match(/Tasks archived: (\d+)/)
|
|
47
|
-
const spaceMatch = message.match(/Space freed: ([\d.]+)/)
|
|
48
|
-
|
|
49
|
-
if (filesMatch && tasksMatch && spaceMatch) {
|
|
50
|
-
return animations.formatCleanup(
|
|
51
|
-
parseInt(filesMatch[1]),
|
|
52
|
-
parseInt(tasksMatch[1]),
|
|
53
|
-
parseFloat(spaceMatch[1]),
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
switch (type) {
|
|
59
|
-
case 'success':
|
|
60
|
-
return animations.formatSuccess(message)
|
|
61
|
-
case 'error':
|
|
62
|
-
return animations.formatError(message)
|
|
63
|
-
case 'ship':
|
|
64
|
-
return animations.formatShip(message, 1)
|
|
65
|
-
case 'focus':
|
|
66
|
-
return animations.formatFocus(message, new Date().toISOString())
|
|
67
|
-
case 'idea':
|
|
68
|
-
return animations.formatIdea(message)
|
|
69
|
-
default: {
|
|
70
|
-
const emojis = {
|
|
71
|
-
warning: 'โ ๏ธ',
|
|
72
|
-
info: 'โน๏ธ',
|
|
73
|
-
celebrate: '๐',
|
|
74
|
-
progress: '๐',
|
|
75
|
-
task: '๐',
|
|
76
|
-
}
|
|
77
|
-
const emoji = emojis[type] || '๐ฌ'
|
|
78
|
-
return `${emoji} ${animations.colors.text(message)}`
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const emojis = {
|
|
84
|
-
success: 'โ
',
|
|
85
|
-
error: 'โ',
|
|
86
|
-
warning: 'โ ๏ธ',
|
|
87
|
-
info: 'โน๏ธ',
|
|
88
|
-
celebrate: '๐',
|
|
89
|
-
ship: '๐',
|
|
90
|
-
focus: '๐ฏ',
|
|
91
|
-
idea: '๐ก',
|
|
92
|
-
progress: '๐',
|
|
93
|
-
task: '๐',
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const colors = {
|
|
97
|
-
success: chalk.green,
|
|
98
|
-
error: chalk.red,
|
|
99
|
-
warning: chalk.yellow,
|
|
100
|
-
info: chalk.blue,
|
|
101
|
-
celebrate: chalk.magenta,
|
|
102
|
-
ship: chalk.cyan,
|
|
103
|
-
focus: chalk.green,
|
|
104
|
-
idea: chalk.yellow,
|
|
105
|
-
progress: chalk.blue,
|
|
106
|
-
task: chalk.cyan,
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const emoji = emojis[type] || emojis.info
|
|
110
|
-
const color = colors[type] || colors.info
|
|
111
|
-
|
|
112
|
-
return `${emoji} ${color(message)}`
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Read file using native fs
|
|
117
|
-
*/
|
|
118
|
-
async readFile(filePath) {
|
|
119
|
-
try {
|
|
120
|
-
return await fs.readFile(filePath, 'utf8')
|
|
121
|
-
} catch (error) {
|
|
122
|
-
throw new Error(`Failed to read file ${filePath}: ${error.message}`)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Write file using native fs
|
|
128
|
-
*/
|
|
129
|
-
async writeFile(filePath, content) {
|
|
130
|
-
try {
|
|
131
|
-
await fs.writeFile(filePath, content, 'utf8')
|
|
132
|
-
} catch (error) {
|
|
133
|
-
throw new Error(`Failed to write file ${filePath}: ${error.message}`)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* List directory contents
|
|
139
|
-
*/
|
|
140
|
-
async listDirectory(dirPath) {
|
|
141
|
-
try {
|
|
142
|
-
return await fs.readdir(dirPath)
|
|
143
|
-
} catch (error) {
|
|
144
|
-
throw new Error(`Failed to list directory ${dirPath}: ${error.message}`)
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Check if file exists
|
|
150
|
-
*/
|
|
151
|
-
async fileExists(filePath) {
|
|
152
|
-
try {
|
|
153
|
-
await fs.access(filePath)
|
|
154
|
-
return true
|
|
155
|
-
} catch {
|
|
156
|
-
return false
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Create directory
|
|
162
|
-
*/
|
|
163
|
-
async createDirectory(dirPath) {
|
|
164
|
-
try {
|
|
165
|
-
await fs.mkdir(dirPath, { recursive: true })
|
|
166
|
-
} catch (error) {
|
|
167
|
-
throw new Error(`Failed to create directory ${dirPath}: ${error.message}`)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Get current timestamp in ISO format
|
|
173
|
-
*/
|
|
174
|
-
getTimestamp() {
|
|
175
|
-
return new Date().toISOString()
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Format task list with colors
|
|
180
|
-
*/
|
|
181
|
-
formatTaskList(tasks) {
|
|
182
|
-
if (!tasks || tasks.length === 0) {
|
|
183
|
-
return this.formatResponse('No tasks in queue', 'info')
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (animations) {
|
|
187
|
-
let output = animations.colors.primary.bold('\n๐ Task Queue\n')
|
|
188
|
-
output += animations.colors.dim('โ'.repeat(40)) + '\n'
|
|
189
|
-
|
|
190
|
-
tasks.forEach((task, index) => {
|
|
191
|
-
output += animations.colors.task(` ${index + 1}.`) + ` ${animations.colors.text(task)}\n`
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
return output
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
let output = chalk.bold('\n๐ Task Queue\n')
|
|
198
|
-
output += chalk.dim('โ'.repeat(40)) + '\n'
|
|
199
|
-
|
|
200
|
-
tasks.forEach((task, index) => {
|
|
201
|
-
output += chalk.cyan(` ${index + 1}.`) + ` ${task}\n`
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
return output
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Format recap with colored output
|
|
209
|
-
*/
|
|
210
|
-
formatRecap(data) {
|
|
211
|
-
if (animations) {
|
|
212
|
-
return animations.formatRecap(data)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
let output = '\n' + chalk.bold('๐ Project Recap\n')
|
|
216
|
-
output += chalk.dim('โ'.repeat(40)) + '\n\n'
|
|
217
|
-
|
|
218
|
-
output += `${chalk.green('๐ฏ Current Task:')} ${data.currentTask || chalk.dim('None')}\n`
|
|
219
|
-
output += `${chalk.cyan('๐ Shipped Features:')} ${chalk.bold(data.shippedCount)} total\n`
|
|
220
|
-
output += `${chalk.blue('๐ Queued Tasks:')} ${data.queuedCount}\n`
|
|
221
|
-
output += `${chalk.yellow('๐ก Ideas Captured:')} ${data.ideasCount}\n`
|
|
222
|
-
|
|
223
|
-
if (data.recentActivity) {
|
|
224
|
-
output += '\n' + chalk.bold('Recent Activity:\n')
|
|
225
|
-
output += data.recentActivity
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
output += '\n' + chalk.dim('โ'.repeat(40))
|
|
229
|
-
output += '\n' + chalk.green('๐ช Keep shipping! Every feature counts!')
|
|
230
|
-
|
|
231
|
-
return output
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Format progress report
|
|
236
|
-
*/
|
|
237
|
-
formatProgress(data) {
|
|
238
|
-
if (animations) {
|
|
239
|
-
const trend =
|
|
240
|
-
data.velocity > data.previousVelocity
|
|
241
|
-
? '๐'
|
|
242
|
-
: data.velocity < data.previousVelocity
|
|
243
|
-
? '๐'
|
|
244
|
-
: 'โก๏ธ'
|
|
245
|
-
|
|
246
|
-
const divider = animations.colors.primary('โ'.repeat(40))
|
|
247
|
-
|
|
248
|
-
let output = '\n' + divider + '\n'
|
|
249
|
-
output += animations.colors.primary.bold(`๐ PROGRESS REPORT - ${data.period.toUpperCase()}\n`)
|
|
250
|
-
output += divider + '\n\n'
|
|
251
|
-
|
|
252
|
-
output += animations.colors.text('Features Shipped: ') + animations.colors.success.bold(data.count) + '\n'
|
|
253
|
-
output += animations.colors.text('Velocity: ') + animations.colors.info.bold(data.velocity.toFixed(1) + ' features/day') + ' ' + trend + '\n'
|
|
254
|
-
|
|
255
|
-
if (data.recentFeatures) {
|
|
256
|
-
output += '\n' + animations.colors.primary.bold('Recent Wins:\n')
|
|
257
|
-
output += data.recentFeatures
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
output += '\n' + divider
|
|
261
|
-
output += '\n' + animations.colors.celebrate(data.motivationalMessage || '๐ Keep shipping!')
|
|
262
|
-
|
|
263
|
-
return output
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const trend =
|
|
267
|
-
data.velocity > data.previousVelocity
|
|
268
|
-
? '๐'
|
|
269
|
-
: data.velocity < data.previousVelocity
|
|
270
|
-
? '๐'
|
|
271
|
-
: 'โก๏ธ'
|
|
272
|
-
|
|
273
|
-
let output = '\n' + chalk.bold(`๐ Progress Report (${data.period})\n`)
|
|
274
|
-
output += chalk.dim('โ'.repeat(40)) + '\n\n'
|
|
275
|
-
|
|
276
|
-
output += `${chalk.green('Features Shipped:')} ${chalk.bold(data.count)}\n`
|
|
277
|
-
output += `${chalk.blue('Velocity:')} ${data.velocity.toFixed(1)} features/day ${trend}\n`
|
|
278
|
-
|
|
279
|
-
if (data.recentFeatures) {
|
|
280
|
-
output += '\n' + chalk.bold('Recent Wins:\n')
|
|
281
|
-
output += data.recentFeatures
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
output += '\n' + chalk.dim('โ'.repeat(40))
|
|
285
|
-
output += '\n' + chalk.green(data.motivationalMessage)
|
|
286
|
-
|
|
287
|
-
return output
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Get help content based on issue type
|
|
292
|
-
*/
|
|
293
|
-
getHelpContent(issue) {
|
|
294
|
-
if (animations) {
|
|
295
|
-
const c = animations.colors
|
|
296
|
-
const helps = {
|
|
297
|
-
debugging: `
|
|
298
|
-
${c.error.bold('๐ Debugging Strategy:')}
|
|
299
|
-
${c.secondary('1.')} ${c.text.bold('Isolate')} - Comment out code until error disappears
|
|
300
|
-
${c.secondary('2.')} ${c.text.bold('Log')} - Add console.log at key points
|
|
301
|
-
${c.secondary('3.')} ${c.text.bold('Simplify')} - Create minimal reproduction
|
|
302
|
-
${c.secondary('4.')} ${c.text.bold('Research')} - Search for exact error message
|
|
303
|
-
${c.secondary('5.')} ${c.text.bold('Break')} - Take a walk, fresh perspective helps!
|
|
304
|
-
`,
|
|
305
|
-
design: `
|
|
306
|
-
${c.primary.bold('๐จ Design Approach:')}
|
|
307
|
-
${c.secondary('1.')} ${c.text.bold('Start Simple')} - Basic version first
|
|
308
|
-
${c.secondary('2.')} ${c.text.bold('User First')} - What problem does this solve?
|
|
309
|
-
${c.secondary('3.')} ${c.text.bold('Iterate')} - Ship v1, improve based on feedback
|
|
310
|
-
${c.secondary('4.')} ${c.text.bold('Patterns')} - Look for similar solutions
|
|
311
|
-
${c.secondary('5.')} ${c.text.bold('Validate')} - Show mockup before building
|
|
312
|
-
`,
|
|
313
|
-
performance: `
|
|
314
|
-
${c.warning.bold('โก Performance Strategy:')}
|
|
315
|
-
${c.secondary('1.')} ${c.text.bold('Measure First')} - Profile before optimizing
|
|
316
|
-
${c.secondary('2.')} ${c.text.bold('Biggest Wins')} - Focus on slowest parts
|
|
317
|
-
${c.secondary('3.')} ${c.text.bold('Cache')} - Store expensive computations
|
|
318
|
-
${c.secondary('4.')} ${c.text.bold('Lazy Load')} - Defer non-critical work
|
|
319
|
-
${c.secondary('5.')} ${c.text.bold('Monitor')} - Track improvements
|
|
320
|
-
`,
|
|
321
|
-
default: `
|
|
322
|
-
${c.idea.bold('๐ก General Strategy:')}
|
|
323
|
-
${c.secondary('1.')} ${c.text.bold('Break It Down')} - Divide into smaller tasks
|
|
324
|
-
${c.secondary('2.')} ${c.text.bold('Start Small')} - Implement simplest part first
|
|
325
|
-
${c.secondary('3.')} ${c.text.bold('Test Often')} - Verify each step works
|
|
326
|
-
${c.secondary('4.')} ${c.text.bold('Document')} - Write down what you learn
|
|
327
|
-
${c.secondary('5.')} ${c.text.bold('Ship It')} - Perfect is the enemy of done
|
|
328
|
-
`,
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const helpType =
|
|
332
|
-
Object.keys(helps).find((key) => issue.toLowerCase().includes(key)) || 'default'
|
|
333
|
-
|
|
334
|
-
return helps[helpType]
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
const helps = {
|
|
338
|
-
debugging: `
|
|
339
|
-
${chalk.bold('๐ Debugging Strategy:')}
|
|
340
|
-
${chalk.cyan('1.')} ${chalk.bold('Isolate')} - Comment out code until error disappears
|
|
341
|
-
${chalk.cyan('2.')} ${chalk.bold('Log')} - Add console.log at key points
|
|
342
|
-
${chalk.cyan('3.')} ${chalk.bold('Simplify')} - Create minimal reproduction
|
|
343
|
-
${chalk.cyan('4.')} ${chalk.bold('Research')} - Search for exact error message
|
|
344
|
-
${chalk.cyan('5.')} ${chalk.bold('Break')} - Take a walk, fresh perspective helps!
|
|
345
|
-
`,
|
|
346
|
-
design: `
|
|
347
|
-
${chalk.bold('๐จ Design Approach:')}
|
|
348
|
-
${chalk.cyan('1.')} ${chalk.bold('Start Simple')} - Basic version first
|
|
349
|
-
${chalk.cyan('2.')} ${chalk.bold('User First')} - What problem does this solve?
|
|
350
|
-
${chalk.cyan('3.')} ${chalk.bold('Iterate')} - Ship v1, improve based on feedback
|
|
351
|
-
${chalk.cyan('4.')} ${chalk.bold('Patterns')} - Look for similar solutions
|
|
352
|
-
${chalk.cyan('5.')} ${chalk.bold('Validate')} - Show mockup before building
|
|
353
|
-
`,
|
|
354
|
-
performance: `
|
|
355
|
-
${chalk.bold('โก Performance Strategy:')}
|
|
356
|
-
${chalk.cyan('1.')} ${chalk.bold('Measure First')} - Profile before optimizing
|
|
357
|
-
${chalk.cyan('2.')} ${chalk.bold('Biggest Wins')} - Focus on slowest parts
|
|
358
|
-
${chalk.cyan('3.')} ${chalk.bold('Cache')} - Store expensive computations
|
|
359
|
-
${chalk.cyan('4.')} ${chalk.bold('Lazy Load')} - Defer non-critical work
|
|
360
|
-
${chalk.cyan('5.')} ${chalk.bold('Monitor')} - Track improvements
|
|
361
|
-
`,
|
|
362
|
-
default: `
|
|
363
|
-
${chalk.bold('๐ก General Strategy:')}
|
|
364
|
-
${chalk.cyan('1.')} ${chalk.bold('Break It Down')} - Divide into smaller tasks
|
|
365
|
-
${chalk.cyan('2.')} ${chalk.bold('Start Small')} - Implement simplest part first
|
|
366
|
-
${chalk.cyan('3.')} ${chalk.bold('Test Often')} - Verify each step works
|
|
367
|
-
${chalk.cyan('4.')} ${chalk.bold('Document')} - Write down what you learn
|
|
368
|
-
${chalk.cyan('5.')} ${chalk.bold('Ship It')} - Perfect is the enemy of done
|
|
369
|
-
`,
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const helpType =
|
|
373
|
-
Object.keys(helps).find((key) => issue.toLowerCase().includes(key)) || 'default'
|
|
374
|
-
|
|
375
|
-
return helps[helpType]
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Suggest next action based on context
|
|
380
|
-
*/
|
|
381
|
-
suggestNextAction(context) {
|
|
382
|
-
if (animations) {
|
|
383
|
-
const c = animations.colors
|
|
384
|
-
const suggestions = {
|
|
385
|
-
taskCompleted:
|
|
386
|
-
c.dim('โ Ready for the next challenge? Use ') +
|
|
387
|
-
c.success('prjct next') +
|
|
388
|
-
c.dim(' to see your queue!'),
|
|
389
|
-
featureShipped:
|
|
390
|
-
c.dim('โ Awesome! Take a moment to celebrate, then ') +
|
|
391
|
-
c.ship('prjct now') +
|
|
392
|
-
c.dim(' for next focus!'),
|
|
393
|
-
ideaCaptured:
|
|
394
|
-
c.dim('โ Great idea! Use ') +
|
|
395
|
-
c.idea('prjct now') +
|
|
396
|
-
c.dim(' to start working on it!'),
|
|
397
|
-
initialized: c.dim('โ All set! Start with ') + c.primary('prjct now "your first task"'),
|
|
398
|
-
stuck:
|
|
399
|
-
c.dim('โ You got this! Break it down with ') +
|
|
400
|
-
c.focus('prjct idea') +
|
|
401
|
-
c.dim(' for each step'),
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return suggestions[context] || c.dim('โ What would you like to work on next?')
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const suggestions = {
|
|
408
|
-
taskCompleted:
|
|
409
|
-
chalk.dim('โ Ready for the next challenge? Use ') +
|
|
410
|
-
chalk.green('prjct next') +
|
|
411
|
-
chalk.dim(' to see your queue!'),
|
|
412
|
-
featureShipped:
|
|
413
|
-
chalk.dim('โ Awesome! Take a moment to celebrate, then ') +
|
|
414
|
-
chalk.green('prjct now') +
|
|
415
|
-
chalk.dim(' for next focus!'),
|
|
416
|
-
ideaCaptured:
|
|
417
|
-
chalk.dim('โ Great idea! Use ') +
|
|
418
|
-
chalk.green('prjct now') +
|
|
419
|
-
chalk.dim(' to start working on it!'),
|
|
420
|
-
initialized: chalk.dim('โ All set! Start with ') + chalk.green('prjct now "your first task"'),
|
|
421
|
-
stuck:
|
|
422
|
-
chalk.dim('โ You got this! Break it down with ') +
|
|
423
|
-
chalk.green('prjct idea') +
|
|
424
|
-
chalk.dim(' for each step'),
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
return suggestions[context] || chalk.dim('โ What would you like to work on next?')
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Clear terminal screen (for better UX)
|
|
432
|
-
*/
|
|
433
|
-
clearScreen() {
|
|
434
|
-
if (process.stdout.isTTY) {
|
|
435
|
-
process.stdout.write('\x1Bc')
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Show progress spinner for long operations
|
|
441
|
-
*/
|
|
442
|
-
showSpinner(message) {
|
|
443
|
-
if (!process.stdout.isTTY) return
|
|
444
|
-
|
|
445
|
-
const frames = animations?.frames?.loading || ['โ ', 'โ ', 'โ น', 'โ ธ', 'โ ผ', 'โ ด', 'โ ฆ', 'โ ง', 'โ ', 'โ ']
|
|
446
|
-
let i = 0
|
|
447
|
-
|
|
448
|
-
const formattedMessage = animations
|
|
449
|
-
? animations.colors.text(message)
|
|
450
|
-
: message
|
|
451
|
-
|
|
452
|
-
const interval = setInterval(() => {
|
|
453
|
-
const frame = animations?.colors?.primary(frames[i]) || frames[i]
|
|
454
|
-
process.stdout.write(`\r${frame} ${formattedMessage}`)
|
|
455
|
-
i = (i + 1) % frames.length
|
|
456
|
-
}, 80)
|
|
457
|
-
|
|
458
|
-
return () => {
|
|
459
|
-
clearInterval(interval)
|
|
460
|
-
process.stdout.write('\r' + ' '.repeat(message.length + 2) + '\r')
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
module.exports = TerminalAgent
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: prjct analyze
|
|
3
|
-
invocable_name: p:analyze
|
|
4
|
-
description: Generate or update repository analysis using global prjct architecture
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Steps
|
|
8
|
-
|
|
9
|
-
1. Read project config from `.prjct/prjct.config.json`
|
|
10
|
-
2. Extract `projectId` and `author` from config
|
|
11
|
-
3. Analyze project structure:
|
|
12
|
-
- File tree and organization
|
|
13
|
-
- Package dependencies
|
|
14
|
-
- Framework detection
|
|
15
|
-
- Code patterns and conventions
|
|
16
|
-
4. Analyze technical stack:
|
|
17
|
-
- Languages and versions
|
|
18
|
-
- Frameworks and libraries
|
|
19
|
-
- Build tools and scripts
|
|
20
|
-
- Testing setup
|
|
21
|
-
5. Identify key components:
|
|
22
|
-
- Entry points
|
|
23
|
-
- Core modules
|
|
24
|
-
- API endpoints
|
|
25
|
-
- UI components
|
|
26
|
-
6. Assess project health:
|
|
27
|
-
- Code quality indicators
|
|
28
|
-
- Test coverage
|
|
29
|
-
- Documentation coverage
|
|
30
|
-
- Technical debt
|
|
31
|
-
7. Generate or update analysis file: `~/.prjct-cli/projects/{projectId}/analysis/repo-summary.md`
|
|
32
|
-
8. Update project context: `~/.prjct-cli/projects/{projectId}/core/context.md`
|
|
33
|
-
9. Log analysis to memory
|
|
34
|
-
10. Display summary and insights
|
|
35
|
-
|
|
36
|
-
# Response Format
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
๐ Repository Analysis Complete
|
|
40
|
-
|
|
41
|
-
## Project Overview
|
|
42
|
-
- Name: {project-name}
|
|
43
|
-
- Type: {app-type}
|
|
44
|
-
- Primary Language: {language}
|
|
45
|
-
- Framework: {framework}
|
|
46
|
-
|
|
47
|
-
## Technical Stack
|
|
48
|
-
**Languages**: {languages with percentages}
|
|
49
|
-
**Frameworks**: {frameworks and versions}
|
|
50
|
-
**Key Dependencies**:
|
|
51
|
-
- {dep 1} ({version})
|
|
52
|
-
- {dep 2} ({version})
|
|
53
|
-
- {dep 3} ({version})
|
|
54
|
-
|
|
55
|
-
## Project Structure
|
|
56
|
-
{directory-tree-summary}
|
|
57
|
-
|
|
58
|
-
## Key Components
|
|
59
|
-
- **Entry Points**: {files}
|
|
60
|
-
- **Core Modules**: {modules}
|
|
61
|
-
- **API Layer**: {endpoints-count} endpoints
|
|
62
|
-
- **UI Components**: {components-count} components
|
|
63
|
-
- **Tests**: {tests-count} test files
|
|
64
|
-
|
|
65
|
-
## Code Patterns
|
|
66
|
-
- Architecture: {pattern} (e.g., MVC, Clean, Microservices)
|
|
67
|
-
- State Management: {approach}
|
|
68
|
-
- API Style: {REST/GraphQL/gRPC}
|
|
69
|
-
- Error Handling: {pattern}
|
|
70
|
-
|
|
71
|
-
## Project Health
|
|
72
|
-
- Code Quality: {score/10}
|
|
73
|
-
- Test Coverage: {X}%
|
|
74
|
-
- Documentation: {Good/Fair/Needs Improvement}
|
|
75
|
-
- Technical Debt: {Low/Medium/High}
|
|
76
|
-
|
|
77
|
-
## Insights
|
|
78
|
-
{key-insights-from-analysis}
|
|
79
|
-
|
|
80
|
-
## Recommendations
|
|
81
|
-
1. {recommendation-1}
|
|
82
|
-
2. {recommendation-2}
|
|
83
|
-
3. {recommendation-3}
|
|
84
|
-
|
|
85
|
-
๐ Full analysis saved to: ~/.prjct-cli/projects/{id}/analysis/repo-summary.md
|
|
86
|
-
|
|
87
|
-
Use /p:context to see how this integrates with your workflow
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
# Analysis Depth
|
|
91
|
-
|
|
92
|
-
**Quick Analysis** (default):
|
|
93
|
-
- File structure scan
|
|
94
|
-
- Package.json/requirements parsing
|
|
95
|
-
- Framework detection
|
|
96
|
-
- Basic metrics
|
|
97
|
-
|
|
98
|
-
**Deep Analysis** (optional):
|
|
99
|
-
- Code complexity analysis
|
|
100
|
-
- Dependency graph
|
|
101
|
-
- Test coverage calculation
|
|
102
|
-
- Documentation audit
|
|
103
|
-
- Security scan
|
|
104
|
-
|
|
105
|
-
# Framework Detection
|
|
106
|
-
|
|
107
|
-
Auto-detect:
|
|
108
|
-
- **Frontend**: React, Vue, Angular, Svelte, Next.js
|
|
109
|
-
- **Backend**: Express, Fastify, NestJS, Django, Flask
|
|
110
|
-
- **Mobile**: React Native, Flutter, Swift, Kotlin
|
|
111
|
-
- **Desktop**: Electron, Tauri
|
|
112
|
-
- **Database**: PostgreSQL, MongoDB, Redis, MySQL
|
|
113
|
-
|
|
114
|
-
# Analysis File Structure
|
|
115
|
-
|
|
116
|
-
```markdown
|
|
117
|
-
# Repository Analysis - {date}
|
|
118
|
-
|
|
119
|
-
## Overview
|
|
120
|
-
{summary}
|
|
121
|
-
|
|
122
|
-
## Stack
|
|
123
|
-
{detailed-stack-info}
|
|
124
|
-
|
|
125
|
-
## Architecture
|
|
126
|
-
{architectural-patterns}
|
|
127
|
-
|
|
128
|
-
## Dependencies
|
|
129
|
-
{dependency-analysis}
|
|
130
|
-
|
|
131
|
-
## Code Organization
|
|
132
|
-
{structure-details}
|
|
133
|
-
|
|
134
|
-
## Quality Metrics
|
|
135
|
-
{metrics-and-scores}
|
|
136
|
-
|
|
137
|
-
## Recommendations
|
|
138
|
-
{actionable-improvements}
|
|
139
|
-
|
|
140
|
-
## Change Log
|
|
141
|
-
- {date}: Initial analysis
|
|
142
|
-
- {date}: Updated after refactoring
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
# Integration with Workflow
|
|
146
|
-
|
|
147
|
-
Analysis helps with:
|
|
148
|
-
- `/p:stuck` - Provides technical context for help
|
|
149
|
-
- `/p:task` - Informs task breakdown based on architecture
|
|
150
|
-
- `/p:roadmap` - Aligns roadmap with technical reality
|
|
151
|
-
- `/p:now` - Better task context awareness
|
|
152
|
-
|
|
153
|
-
# Global Architecture Notes
|
|
154
|
-
|
|
155
|
-
- **Analysis Location**: `~/.prjct-cli/projects/{id}/analysis/repo-summary.md`
|
|
156
|
-
- **Context Update**: `~/.prjct-cli/projects/{id}/core/context.md`
|
|
157
|
-
- **Memory Logging**: `~/.prjct-cli/projects/{id}/memory/context.jsonl`
|
|
158
|
-
- **Config Location**: `{project}/.prjct/prjct.config.json`
|
|
159
|
-
- **Use Case**: Onboarding, debugging, refactoring, planning
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: prjct cleanup
|
|
3
|
-
invocable_name: p:cleanup
|
|
4
|
-
description: Advanced code cleanup and optimization with backup capabilities
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Steps
|
|
8
|
-
|
|
9
|
-
1. Read project config from `.prjct/prjct.config.json`
|
|
10
|
-
2. Extract `projectId` and `author` from config
|
|
11
|
-
3. Parse cleanup arguments (target, type, mode)
|
|
12
|
-
4. Create backup to `~/.prjct-cli/projects/{id}/backups/{timestamp}/` before aggressive cleanup
|
|
13
|
-
5. Execute cleanup by type:
|
|
14
|
-
- **code**: Remove console.logs, commented code, dead code
|
|
15
|
-
- **imports**: Remove unused imports, organize imports
|
|
16
|
-
- **files**: Remove temp files, empty files, backups
|
|
17
|
-
- **deps**: Analyze and remove unused npm dependencies
|
|
18
|
-
- **memory**: Archive old memory entries (>30 days) to `~/.prjct-cli/projects/{id}/memory/archive/`
|
|
19
|
-
- **all**: All cleanup types
|
|
20
|
-
6. Validate syntax after changes (JavaScript/TypeScript)
|
|
21
|
-
7. Log all changes to `~/.prjct-cli/projects/{id}/memory/cleanup-log.jsonl`
|
|
22
|
-
8. Log action with author to context.jsonl
|
|
23
|
-
9. Display cleanup results with metrics
|
|
24
|
-
|
|
25
|
-
# Response Format
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
๐งน โจ Cleanup Complete! โจ ๐งน
|
|
29
|
-
|
|
30
|
-
๐ Cleanup Results:
|
|
31
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
32
|
-
|
|
33
|
-
๐๏ธ Dead Code Removed:
|
|
34
|
-
โข Console.logs: {count} statements
|
|
35
|
-
โข Commented code: {count} blocks
|
|
36
|
-
โข Unused functions: {count}
|
|
37
|
-
|
|
38
|
-
๐ฆ Imports Optimized:
|
|
39
|
-
โข Unused imports: {count} removed
|
|
40
|
-
โข Files organized: {count}
|
|
41
|
-
|
|
42
|
-
๐ Files Cleaned:
|
|
43
|
-
โข Temp files: {count} removed
|
|
44
|
-
โข Empty files: {count} removed
|
|
45
|
-
โข Space freed: {size} MB
|
|
46
|
-
|
|
47
|
-
๐ Dependencies:
|
|
48
|
-
โข Unused packages: {count} removed
|
|
49
|
-
โข Size reduced: {size} MB
|
|
50
|
-
|
|
51
|
-
๐ฆ Archived:
|
|
52
|
-
โข Memory entries: {count} (older than 30 days)
|
|
53
|
-
|
|
54
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
55
|
-
โจ Your project is clean and optimized!
|
|
56
|
-
|
|
57
|
-
๐ก Tip: Run with --dry-run first to preview changes
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
# Safety Measures
|
|
61
|
-
|
|
62
|
-
- Create backup before aggressive cleanup
|
|
63
|
-
- Log all changes to cleanup-log.jsonl
|
|
64
|
-
- Validate syntax after modifications
|
|
65
|
-
- Skip files with uncommitted git changes
|
|
66
|
-
- Provide --dry-run option to preview
|
|
67
|
-
|
|
68
|
-
# Global Architecture Notes
|
|
69
|
-
|
|
70
|
-
- **Data Location**: `~/.prjct-cli/projects/{id}/`
|
|
71
|
-
- **Config Location**: `{project}/.prjct/prjct.config.json`
|
|
72
|
-
- **Backup Location**: `~/.prjct-cli/projects/{id}/backups/{timestamp}/`
|
|
73
|
-
- **Cleanup Log**: `~/.prjct-cli/projects/{id}/memory/cleanup-log.jsonl`
|