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
|
@@ -3,95 +3,33 @@ const path = require('path')
|
|
|
3
3
|
const os = require('os')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* CommandInstaller - Installs prjct commands to
|
|
6
|
+
* CommandInstaller - Installs prjct commands to Claude (Code + Desktop)
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 100% Claude-focused architecture
|
|
9
|
+
* Handles installation and synchronization of /p:* commands
|
|
10
|
+
* to Claude's native slash command system
|
|
10
11
|
*
|
|
11
|
-
* @version 0.
|
|
12
|
+
* @version 0.5.0
|
|
12
13
|
*/
|
|
13
14
|
class CommandInstaller {
|
|
14
15
|
constructor() {
|
|
15
16
|
this.homeDir = os.homedir()
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
this.editors = {
|
|
19
|
-
claude: {
|
|
20
|
-
name: 'Claude Code',
|
|
21
|
-
commandsPath: path.join(this.homeDir, '.claude', 'commands', 'p'),
|
|
22
|
-
configPath: path.join(this.homeDir, '.claude'),
|
|
23
|
-
format: 'slash-commands', // *.md with frontmatter
|
|
24
|
-
detected: false,
|
|
25
|
-
},
|
|
26
|
-
cursor: {
|
|
27
|
-
name: 'Cursor AI',
|
|
28
|
-
commandsPath: path.join(this.homeDir, '.cursor', 'commands', 'p'),
|
|
29
|
-
configPath: path.join(this.homeDir, '.cursor'),
|
|
30
|
-
format: 'slash-commands', // *.md with frontmatter
|
|
31
|
-
detected: false,
|
|
32
|
-
},
|
|
33
|
-
codex: {
|
|
34
|
-
name: 'OpenAI Codex',
|
|
35
|
-
commandsPath: path.join(this.homeDir, '.codex', 'instructions.md'),
|
|
36
|
-
configPath: path.join(this.homeDir, '.codex'),
|
|
37
|
-
format: 'agents-md', // Single instructions.md file
|
|
38
|
-
detected: false,
|
|
39
|
-
projectBased: false,
|
|
40
|
-
},
|
|
41
|
-
windsurf: {
|
|
42
|
-
name: 'Windsurf/Codeium',
|
|
43
|
-
commandsPath: path.join(this.homeDir, '.windsurf', 'workflows'),
|
|
44
|
-
configPath: path.join(this.homeDir, '.windsurf'),
|
|
45
|
-
format: 'workflows', // *.md workflows
|
|
46
|
-
detected: false,
|
|
47
|
-
projectBased: false,
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
17
|
+
this.claudeCommandsPath = path.join(this.homeDir, '.claude', 'commands', 'p')
|
|
18
|
+
this.claudeConfigPath = path.join(this.homeDir, '.claude')
|
|
51
19
|
this.templatesDir = path.join(__dirname, '..', 'templates', 'commands')
|
|
52
|
-
this.agentsTemplateDir = path.join(__dirname, '..', 'templates', 'agents')
|
|
53
|
-
this.workflowsTemplateDir = path.join(__dirname, '..', 'templates', 'workflows')
|
|
54
20
|
}
|
|
55
21
|
|
|
56
22
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
23
|
+
* Detect if Claude is installed
|
|
24
|
+
* @returns {Promise<boolean>} True if Claude directory exists
|
|
59
25
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* Detect which AI editors are installed
|
|
67
|
-
* @param {string} projectPath - Optional project path for project-based editors
|
|
68
|
-
* @returns {Promise<Object>} Object with editor detection results
|
|
69
|
-
*/
|
|
70
|
-
async detectEditors(projectPath = null) {
|
|
71
|
-
if (projectPath) {
|
|
72
|
-
this.setProjectPath(projectPath)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const results = {}
|
|
76
|
-
|
|
77
|
-
for (const [key, editor] of Object.entries(this.editors)) {
|
|
78
|
-
try {
|
|
79
|
-
await fs.access(editor.configPath)
|
|
80
|
-
editor.detected = true
|
|
81
|
-
|
|
82
|
-
let commandPath = editor.commandsPath
|
|
83
|
-
if (!commandPath && editor.projectBased) {
|
|
84
|
-
commandPath = path.join(this.projectPath, 'AGENTS.md')
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
results[key] = { detected: true, path: commandPath, format: editor.format }
|
|
88
|
-
} catch {
|
|
89
|
-
editor.detected = false
|
|
90
|
-
results[key] = { detected: false, path: null, format: editor.format }
|
|
91
|
-
}
|
|
26
|
+
async detectClaude() {
|
|
27
|
+
try {
|
|
28
|
+
await fs.access(this.claudeConfigPath)
|
|
29
|
+
return true
|
|
30
|
+
} catch {
|
|
31
|
+
return false
|
|
92
32
|
}
|
|
93
|
-
|
|
94
|
-
return results
|
|
95
33
|
}
|
|
96
34
|
|
|
97
35
|
/**
|
|
@@ -103,6 +41,7 @@ class CommandInstaller {
|
|
|
103
41
|
const files = await fs.readdir(this.templatesDir)
|
|
104
42
|
return files.filter(f => f.endsWith('.md'))
|
|
105
43
|
} catch (error) {
|
|
44
|
+
// Fallback to core commands if template directory not accessible
|
|
106
45
|
return [
|
|
107
46
|
'init.md',
|
|
108
47
|
'now.md',
|
|
@@ -115,809 +54,173 @@ class CommandInstaller {
|
|
|
115
54
|
'stuck.md',
|
|
116
55
|
'context.md',
|
|
117
56
|
'analyze.md',
|
|
57
|
+
'sync.md',
|
|
118
58
|
'roadmap.md',
|
|
119
59
|
'task.md',
|
|
120
60
|
'git.md',
|
|
121
61
|
'fix.md',
|
|
122
62
|
'test.md',
|
|
63
|
+
'cleanup.md',
|
|
64
|
+
'design.md',
|
|
123
65
|
]
|
|
124
66
|
}
|
|
125
67
|
}
|
|
126
68
|
|
|
127
69
|
/**
|
|
128
|
-
*
|
|
129
|
-
* @returns {Promise<
|
|
130
|
-
*/
|
|
131
|
-
async generateAgentsMd() {
|
|
132
|
-
const templatePath = path.join(this.agentsTemplateDir, 'AGENTS.md')
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
return await fs.readFile(templatePath, 'utf-8')
|
|
136
|
-
} catch {
|
|
137
|
-
const existingPath = path.join(this.projectPath, 'AGENTS.md')
|
|
138
|
-
try {
|
|
139
|
-
return await fs.readFile(existingPath, 'utf-8')
|
|
140
|
-
} catch {
|
|
141
|
-
return `# AGENTS.md - OpenAI Codex Configuration
|
|
142
|
-
|
|
143
|
-
This file provides guidance to OpenAI Codex when working with this repository.
|
|
144
|
-
|
|
145
|
-
## prjct Commands
|
|
146
|
-
|
|
147
|
-
The project uses prjct-cli for project management. All commands access global data in \`~/.prjct-cli/projects/{id}/\`.
|
|
148
|
-
|
|
149
|
-
### /p:init
|
|
150
|
-
Initialize prjct in current project. Creates global structure and local config.
|
|
151
|
-
|
|
152
|
-
### /p:now [task]
|
|
153
|
-
Set or show current task.
|
|
154
|
-
- Read: Show current task from global storage
|
|
155
|
-
- Write: Update task in \`~/.prjct-cli/projects/{id}/core/now.md\`
|
|
156
|
-
|
|
157
|
-
### /p:done
|
|
158
|
-
Complete current task and clear focus.
|
|
159
|
-
|
|
160
|
-
### /p:ship <feature>
|
|
161
|
-
Ship and celebrate a completed feature.
|
|
162
|
-
|
|
163
|
-
### /p:next
|
|
164
|
-
Show priority queue of upcoming tasks.
|
|
165
|
-
|
|
166
|
-
### /p:idea <text>
|
|
167
|
-
Capture an idea quickly to the backlog.
|
|
168
|
-
|
|
169
|
-
### /p:recap
|
|
170
|
-
Show project overview with progress metrics.
|
|
171
|
-
|
|
172
|
-
See complete command documentation in the prjct-cli repository.
|
|
173
|
-
`
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Generate Windsurf workflow content
|
|
180
|
-
* @param {string} commandName - Command name (e.g., 'now', 'done')
|
|
181
|
-
* @returns {Promise<string>} Workflow content
|
|
182
|
-
*/
|
|
183
|
-
async generateWorkflow(commandName) {
|
|
184
|
-
const templatePath = path.join(this.workflowsTemplateDir, `${commandName}.md`)
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
return await fs.readFile(templatePath, 'utf-8')
|
|
188
|
-
} catch {
|
|
189
|
-
const invocableName = `p:${commandName}`
|
|
190
|
-
return `---
|
|
191
|
-
title: prjct ${commandName}
|
|
192
|
-
invocable_name: ${invocableName}
|
|
193
|
-
description: Execute prjct ${commandName} command
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
# Steps
|
|
197
|
-
|
|
198
|
-
1. Read project config from \`.prjct/prjct.config.json\`
|
|
199
|
-
2. Get project ID from config
|
|
200
|
-
3. Execute ${commandName} operation on global data in \`~/.prjct-cli/projects/{id}/\`
|
|
201
|
-
4. Update relevant files in appropriate layers (core, progress, planning, memory)
|
|
202
|
-
5. Log action to memory with timestamp
|
|
203
|
-
6. Display confirmation with next suggested actions
|
|
204
|
-
|
|
205
|
-
For detailed implementation, see prjct-cli documentation.
|
|
206
|
-
`
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Install commands to a specific editor
|
|
212
|
-
* @param {string} editorKey - Editor identifier (claude, cursor, codex, windsurf)
|
|
213
|
-
* @param {boolean} forceUpdate - Force update existing commands
|
|
214
|
-
* @returns {Promise<Object>} Installation result
|
|
70
|
+
* Install commands to Claude
|
|
71
|
+
* @returns {Promise<Object>} Installation results
|
|
215
72
|
*/
|
|
216
|
-
async
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
if (!editor) {
|
|
220
|
-
return { success: false, message: `Unknown editor: ${editorKey}` }
|
|
221
|
-
}
|
|
73
|
+
async installCommands() {
|
|
74
|
+
const claudeDetected = await this.detectClaude()
|
|
222
75
|
|
|
223
|
-
if (!
|
|
224
|
-
return { success: false, message: `${editor.name} not detected` }
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
switch (editor.format) {
|
|
229
|
-
case 'slash-commands':
|
|
230
|
-
return await this.installSlashCommands(editorKey, forceUpdate)
|
|
231
|
-
case 'agents-md':
|
|
232
|
-
return await this.installAgentsMd(editorKey, forceUpdate)
|
|
233
|
-
case 'workflows':
|
|
234
|
-
return await this.installWorkflows(editorKey, forceUpdate)
|
|
235
|
-
default:
|
|
236
|
-
return {
|
|
237
|
-
success: false,
|
|
238
|
-
message: `Unknown format: ${editor.format}`,
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
} catch (error) {
|
|
76
|
+
if (!claudeDetected) {
|
|
242
77
|
return {
|
|
243
78
|
success: false,
|
|
244
|
-
|
|
79
|
+
error: 'Claude not detected. Please install Claude Code or Claude Desktop first.',
|
|
245
80
|
}
|
|
246
81
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Install slash commands format (Claude, Cursor)
|
|
251
|
-
*/
|
|
252
|
-
async installSlashCommands(editorKey, forceUpdate) {
|
|
253
|
-
const editor = this.editors[editorKey]
|
|
254
|
-
|
|
255
|
-
await fs.mkdir(editor.commandsPath, { recursive: true })
|
|
256
|
-
|
|
257
|
-
const commandFiles = await this.getCommandFiles()
|
|
258
|
-
const installed = []
|
|
259
|
-
const skipped = []
|
|
260
|
-
const updated = []
|
|
261
82
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const exists = await this.fileExists(targetPath)
|
|
83
|
+
try {
|
|
84
|
+
// Ensure commands directory exists
|
|
85
|
+
await fs.mkdir(this.claudeCommandsPath, { recursive: true })
|
|
267
86
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
87
|
+
const commandFiles = await this.getCommandFiles()
|
|
88
|
+
const installed = []
|
|
89
|
+
const errors = []
|
|
272
90
|
|
|
273
|
-
|
|
274
|
-
try {
|
|
275
|
-
content = await fs.readFile(templatePath, 'utf-8')
|
|
276
|
-
} catch {
|
|
277
|
-
const claudePath = path.join(this.editors.claude.commandsPath, filename)
|
|
91
|
+
for (const file of commandFiles) {
|
|
278
92
|
try {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
} catch {
|
|
282
|
-
skipped.push(filename)
|
|
283
|
-
continue
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
await fs.writeFile(targetPath, content, 'utf-8')
|
|
288
|
-
|
|
289
|
-
if (exists) {
|
|
290
|
-
updated.push(filename)
|
|
291
|
-
} else {
|
|
292
|
-
installed.push(filename)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
success: true,
|
|
298
|
-
editor: editor.name,
|
|
299
|
-
format: 'slash-commands',
|
|
300
|
-
installed: installed.length,
|
|
301
|
-
updated: updated.length,
|
|
302
|
-
skipped: skipped.length,
|
|
303
|
-
details: { installed, updated, skipped },
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Install AGENTS.md format (Codex)
|
|
309
|
-
*/
|
|
310
|
-
async installAgentsMd(editorKey, forceUpdate) {
|
|
311
|
-
const editor = this.editors[editorKey]
|
|
312
|
-
const targetPath = editor.commandsPath
|
|
313
|
-
|
|
314
|
-
const exists = await this.fileExists(targetPath)
|
|
315
|
-
|
|
316
|
-
if (exists && !forceUpdate) {
|
|
317
|
-
return {
|
|
318
|
-
success: true,
|
|
319
|
-
editor: editor.name,
|
|
320
|
-
format: 'agents-md',
|
|
321
|
-
installed: 0,
|
|
322
|
-
updated: 0,
|
|
323
|
-
skipped: 1,
|
|
324
|
-
details: { installed: [], updated: [], skipped: ['AGENTS.md'] },
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const content = await this.generateAgentsMd()
|
|
329
|
-
|
|
330
|
-
await fs.writeFile(targetPath, content, 'utf-8')
|
|
331
|
-
|
|
332
|
-
return {
|
|
333
|
-
success: true,
|
|
334
|
-
editor: editor.name,
|
|
335
|
-
format: 'agents-md',
|
|
336
|
-
installed: exists ? 0 : 1,
|
|
337
|
-
updated: exists ? 1 : 0,
|
|
338
|
-
skipped: 0,
|
|
339
|
-
details: {
|
|
340
|
-
installed: exists ? [] : ['AGENTS.md'],
|
|
341
|
-
updated: exists ? ['AGENTS.md'] : [],
|
|
342
|
-
skipped: [],
|
|
343
|
-
},
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Install workflows format (Windsurf)
|
|
349
|
-
*/
|
|
350
|
-
async installWorkflows(editorKey, forceUpdate) {
|
|
351
|
-
const editor = this.editors[editorKey]
|
|
352
|
-
|
|
353
|
-
await fs.mkdir(editor.commandsPath, { recursive: true })
|
|
354
|
-
|
|
355
|
-
const commandFiles = await this.getCommandFiles()
|
|
356
|
-
const commandNames = commandFiles.map(f => f.replace('.md', ''))
|
|
357
|
-
|
|
358
|
-
const installed = []
|
|
359
|
-
const skipped = []
|
|
360
|
-
const updated = []
|
|
93
|
+
const sourcePath = path.join(this.templatesDir, file)
|
|
94
|
+
const destPath = path.join(this.claudeCommandsPath, file)
|
|
361
95
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const targetPath = path.join(editor.commandsPath, filename)
|
|
96
|
+
const content = await fs.readFile(sourcePath, 'utf-8')
|
|
97
|
+
await fs.writeFile(destPath, content, 'utf-8')
|
|
365
98
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
skipped.push(filename)
|
|
370
|
-
continue
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
const content = await this.generateWorkflow(commandName)
|
|
374
|
-
|
|
375
|
-
await fs.writeFile(targetPath, content, 'utf-8')
|
|
376
|
-
|
|
377
|
-
if (exists) {
|
|
378
|
-
updated.push(filename)
|
|
379
|
-
} else {
|
|
380
|
-
installed.push(filename)
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return {
|
|
385
|
-
success: true,
|
|
386
|
-
editor: editor.name,
|
|
387
|
-
format: 'workflows',
|
|
388
|
-
installed: installed.length,
|
|
389
|
-
updated: updated.length,
|
|
390
|
-
skipped: skipped.length,
|
|
391
|
-
details: { installed, updated, skipped },
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Install commands to selected editors
|
|
397
|
-
* @param {string[]} selectedEditors - Array of editor keys to install to
|
|
398
|
-
* @param {boolean} forceUpdate - Force update existing commands
|
|
399
|
-
* @returns {Promise<Object>} Installation results for selected editors
|
|
400
|
-
*/
|
|
401
|
-
async installToSelected(selectedEditors, forceUpdate = false) {
|
|
402
|
-
await this.detectEditors(this.projectPath)
|
|
403
|
-
|
|
404
|
-
const results = {}
|
|
405
|
-
const installedTo = []
|
|
406
|
-
const successfulEditors = []
|
|
407
|
-
|
|
408
|
-
for (const editorKey of selectedEditors) {
|
|
409
|
-
const editor = this.editors[editorKey]
|
|
410
|
-
|
|
411
|
-
if (!editor) {
|
|
412
|
-
results[editorKey] = {
|
|
413
|
-
success: false,
|
|
414
|
-
message: `Unknown editor: ${editorKey}`,
|
|
415
|
-
}
|
|
416
|
-
continue
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (!editor.detected) {
|
|
420
|
-
results[editorKey] = {
|
|
421
|
-
success: false,
|
|
422
|
-
message: `${editor.name} not detected on this system`,
|
|
99
|
+
installed.push(file.replace('.md', ''))
|
|
100
|
+
} catch (error) {
|
|
101
|
+
errors.push({ file, error: error.message })
|
|
423
102
|
}
|
|
424
|
-
continue
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
results[editorKey] = await this.installToEditor(editorKey, forceUpdate)
|
|
428
|
-
if (results[editorKey].success) {
|
|
429
|
-
installedTo.push(editor.name)
|
|
430
|
-
successfulEditors.push(editorKey)
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (installedTo.length === 0) {
|
|
435
|
-
return {
|
|
436
|
-
success: false,
|
|
437
|
-
message: 'No editors were successfully installed to',
|
|
438
|
-
results,
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
const totalInstalled = Object.values(results)
|
|
443
|
-
.reduce((sum, r) => sum + (r.installed || 0), 0)
|
|
444
|
-
const totalUpdated = Object.values(results)
|
|
445
|
-
.reduce((sum, r) => sum + (r.updated || 0), 0)
|
|
446
|
-
|
|
447
|
-
// Always save editor selections to config for tracking updates
|
|
448
|
-
if (successfulEditors.length > 0) {
|
|
449
|
-
await this.saveEditorConfig(successfulEditors)
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
return {
|
|
453
|
-
success: true,
|
|
454
|
-
editors: installedTo,
|
|
455
|
-
totalInstalled,
|
|
456
|
-
totalUpdated,
|
|
457
|
-
results,
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Install commands to all detected editors
|
|
463
|
-
* @param {boolean} forceUpdate - Force update existing commands
|
|
464
|
-
* @returns {Promise<Object>} Installation results for all editors
|
|
465
|
-
*/
|
|
466
|
-
async installToAll(forceUpdate = false) {
|
|
467
|
-
const detection = await this.detectEditors(this.projectPath)
|
|
468
|
-
const detectedEditors = Object.entries(detection)
|
|
469
|
-
.filter(([_, info]) => info.detected)
|
|
470
|
-
.map(([key, _]) => key)
|
|
471
|
-
|
|
472
|
-
if (detectedEditors.length === 0) {
|
|
473
|
-
return {
|
|
474
|
-
success: false,
|
|
475
|
-
message: 'No AI editors detected',
|
|
476
|
-
results: {},
|
|
477
103
|
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return await this.installToSelected(detectedEditors, forceUpdate)
|
|
481
|
-
}
|
|
482
104
|
|
|
483
|
-
/**
|
|
484
|
-
* Interactive installation with user selection using prompts
|
|
485
|
-
* @param {boolean} forceUpdate - Force update existing commands
|
|
486
|
-
* @returns {Promise<Object>} Installation results
|
|
487
|
-
*/
|
|
488
|
-
async interactiveInstall(forceUpdate = false) {
|
|
489
|
-
const prompts = require('prompts')
|
|
490
|
-
|
|
491
|
-
// Detect all editors
|
|
492
|
-
const detected = await this.detectEditors(this.projectPath)
|
|
493
|
-
|
|
494
|
-
// Create choices for prompts
|
|
495
|
-
const availableEditors = Object.entries(detected)
|
|
496
|
-
.filter(([_, info]) => info.detected)
|
|
497
|
-
.map(([key, info]) => ({
|
|
498
|
-
title: `${this.editors[key].name} (${info.path})`,
|
|
499
|
-
value: key,
|
|
500
|
-
selected: true, // Pre-select all detected editors
|
|
501
|
-
}))
|
|
502
|
-
|
|
503
|
-
if (availableEditors.length === 0) {
|
|
504
105
|
return {
|
|
505
|
-
success:
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
106
|
+
success: true,
|
|
107
|
+
installed,
|
|
108
|
+
errors,
|
|
109
|
+
path: this.claudeCommandsPath,
|
|
509
110
|
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// Show interactive selection prompt
|
|
513
|
-
const response = await prompts({
|
|
514
|
-
type: 'multiselect',
|
|
515
|
-
name: 'selectedEditors',
|
|
516
|
-
message: 'Select AI editors to install commands to:',
|
|
517
|
-
choices: availableEditors,
|
|
518
|
-
min: 1,
|
|
519
|
-
hint: '- Space to select. Return to submit',
|
|
520
|
-
instructions: false,
|
|
521
|
-
})
|
|
522
|
-
|
|
523
|
-
// Check if user cancelled
|
|
524
|
-
if (!response.selectedEditors || response.selectedEditors.length === 0) {
|
|
111
|
+
} catch (error) {
|
|
525
112
|
return {
|
|
526
113
|
success: false,
|
|
527
|
-
|
|
528
|
-
editors: [],
|
|
529
|
-
results: {},
|
|
114
|
+
error: error.message,
|
|
530
115
|
}
|
|
531
116
|
}
|
|
532
|
-
|
|
533
|
-
// Install to selected editors
|
|
534
|
-
return await this.installToSelected(response.selectedEditors, forceUpdate)
|
|
535
117
|
}
|
|
536
118
|
|
|
537
119
|
/**
|
|
538
|
-
*
|
|
539
|
-
* @
|
|
540
|
-
* @returns {string} Updated content
|
|
541
|
-
*/
|
|
542
|
-
updateCommandForGlobalArchitecture(content) {
|
|
543
|
-
let updated = content.replace(
|
|
544
|
-
/\.prjct\//g,
|
|
545
|
-
'~/.prjct-cli/projects/{id}/',
|
|
546
|
-
)
|
|
547
|
-
|
|
548
|
-
if (!content.includes('Global Architecture')) {
|
|
549
|
-
const frontmatter = content.match(/^---[\s\S]*?---/m)
|
|
550
|
-
if (frontmatter) {
|
|
551
|
-
const note = `
|
|
552
|
-
|
|
553
|
-
## Global Architecture
|
|
554
|
-
This command uses the global prjct architecture:
|
|
555
|
-
- Data stored in: \`~/.prjct-cli/projects/{id}/\`
|
|
556
|
-
- Config stored in: \`{project}/.prjct/prjct.config.json\`
|
|
557
|
-
- Commands synchronized across all editors
|
|
558
|
-
|
|
559
|
-
`
|
|
560
|
-
updated = content.replace(frontmatter[0], frontmatter[0] + note)
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return updated
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Check if a file exists
|
|
569
|
-
* @param {string} filePath - Path to check
|
|
570
|
-
* @returns {Promise<boolean>} True if file exists
|
|
571
|
-
*/
|
|
572
|
-
async fileExists(filePath) {
|
|
573
|
-
try {
|
|
574
|
-
await fs.access(filePath)
|
|
575
|
-
return true
|
|
576
|
-
} catch {
|
|
577
|
-
return false
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* Create command templates directory and copy existing commands
|
|
583
|
-
* @returns {Promise<Object>} Template creation result
|
|
120
|
+
* Uninstall commands from Claude
|
|
121
|
+
* @returns {Promise<Object>} Uninstallation results
|
|
584
122
|
*/
|
|
585
|
-
async
|
|
123
|
+
async uninstallCommands() {
|
|
586
124
|
try {
|
|
587
|
-
await
|
|
125
|
+
const commandFiles = await this.getCommandFiles()
|
|
126
|
+
const uninstalled = []
|
|
127
|
+
const errors = []
|
|
588
128
|
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
129
|
+
for (const file of commandFiles) {
|
|
130
|
+
try {
|
|
131
|
+
const filePath = path.join(this.claudeCommandsPath, file)
|
|
132
|
+
await fs.unlink(filePath)
|
|
133
|
+
uninstalled.push(file.replace('.md', ''))
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (error.code !== 'ENOENT') {
|
|
136
|
+
errors.push({ file, error: error.message })
|
|
137
|
+
}
|
|
596
138
|
}
|
|
597
139
|
}
|
|
598
140
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const sourcePath = path.join(claudeCommandsPath, filename)
|
|
605
|
-
const targetPath = path.join(this.templatesDir, filename)
|
|
606
|
-
|
|
607
|
-
const content = await fs.readFile(sourcePath, 'utf-8')
|
|
608
|
-
const updated = this.updateCommandForGlobalArchitecture(content)
|
|
609
|
-
|
|
610
|
-
await fs.writeFile(targetPath, updated, 'utf-8')
|
|
611
|
-
copied++
|
|
141
|
+
// Try to remove the /p directory if empty
|
|
142
|
+
try {
|
|
143
|
+
await fs.rmdir(this.claudeCommandsPath)
|
|
144
|
+
} catch {
|
|
145
|
+
// Directory not empty or doesn't exist - that's fine
|
|
612
146
|
}
|
|
613
147
|
|
|
614
148
|
return {
|
|
615
149
|
success: true,
|
|
616
|
-
|
|
617
|
-
|
|
150
|
+
uninstalled,
|
|
151
|
+
errors,
|
|
618
152
|
}
|
|
619
153
|
} catch (error) {
|
|
620
154
|
return {
|
|
621
155
|
success: false,
|
|
622
|
-
|
|
156
|
+
error: error.message,
|
|
623
157
|
}
|
|
624
158
|
}
|
|
625
159
|
}
|
|
626
160
|
|
|
627
161
|
/**
|
|
628
|
-
*
|
|
629
|
-
* @
|
|
630
|
-
* @returns {string} Formatted report
|
|
162
|
+
* Check if commands are already installed
|
|
163
|
+
* @returns {Promise<Object>} Installation status
|
|
631
164
|
*/
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return `❌ Installation failed: ${results.message}`
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// Handle single editor installation (installToEditor returns different format)
|
|
638
|
-
if (results.editor && !results.editors) {
|
|
639
|
-
const lines = [
|
|
640
|
-
'✅ Command Installation Complete!',
|
|
641
|
-
'',
|
|
642
|
-
`📦 Editor: ${results.editor}`,
|
|
643
|
-
`📝 Commands installed: ${results.installed}`,
|
|
644
|
-
`🔄 Commands updated: ${results.updated}`,
|
|
645
|
-
`⊘ Commands skipped: ${results.skipped}`,
|
|
646
|
-
'',
|
|
647
|
-
'💡 Commands are now available in your editor!',
|
|
648
|
-
]
|
|
649
|
-
return lines.join('\n')
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// Handle multiple editors installation (installToSelected/installToAll)
|
|
653
|
-
const lines = [
|
|
654
|
-
'✅ Command Installation Complete!',
|
|
655
|
-
'',
|
|
656
|
-
`📦 Editors: ${results.editors.join(', ')}`,
|
|
657
|
-
`📝 Commands installed: ${results.totalInstalled}`,
|
|
658
|
-
`🔄 Commands updated: ${results.totalUpdated}`,
|
|
659
|
-
'',
|
|
660
|
-
]
|
|
165
|
+
async checkInstallation() {
|
|
166
|
+
const claudeDetected = await this.detectClaude()
|
|
661
167
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
lines.push(` ↻ Updated: ${result.updated}`)
|
|
667
|
-
lines.push(` ⊘ Skipped: ${result.skipped}`)
|
|
168
|
+
if (!claudeDetected) {
|
|
169
|
+
return {
|
|
170
|
+
installed: false,
|
|
171
|
+
claudeDetected: false,
|
|
668
172
|
}
|
|
669
173
|
}
|
|
670
174
|
|
|
671
|
-
lines.push('')
|
|
672
|
-
lines.push('💡 Commands are now available in all detected editors!')
|
|
673
|
-
|
|
674
|
-
return lines.join('\n')
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* Save editor configuration to track installed editors
|
|
679
|
-
* @param {string[]} editors - Array of successfully installed editor keys
|
|
680
|
-
* @returns {Promise<void>}
|
|
681
|
-
*/
|
|
682
|
-
async saveEditorConfig(editors) {
|
|
683
175
|
try {
|
|
684
|
-
|
|
685
|
-
const
|
|
176
|
+
await fs.access(this.claudeCommandsPath)
|
|
177
|
+
const files = await fs.readdir(this.claudeCommandsPath)
|
|
178
|
+
const installedCommands = files.filter(f => f.endsWith('.md')).map(f => f.replace('.md', ''))
|
|
686
179
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
180
|
+
return {
|
|
181
|
+
installed: installedCommands.length > 0,
|
|
182
|
+
claudeDetected: true,
|
|
183
|
+
commands: installedCommands,
|
|
184
|
+
path: this.claudeCommandsPath,
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
return {
|
|
188
|
+
installed: false,
|
|
189
|
+
claudeDetected: true,
|
|
190
|
+
commands: [],
|
|
694
191
|
}
|
|
695
|
-
|
|
696
|
-
await editorsConfig.saveConfig(
|
|
697
|
-
editors,
|
|
698
|
-
paths,
|
|
699
|
-
packageJson.version,
|
|
700
|
-
)
|
|
701
|
-
} catch (error) {
|
|
702
|
-
// Don't fail installation if config save fails
|
|
703
|
-
console.error('[command-installer] Error saving editor config:', error.message)
|
|
704
192
|
}
|
|
705
193
|
}
|
|
706
194
|
|
|
707
195
|
/**
|
|
708
|
-
*
|
|
709
|
-
* @returns {Promise<Object>}
|
|
196
|
+
* Update commands (reinstall with latest templates)
|
|
197
|
+
* @returns {Promise<Object>} Update results
|
|
710
198
|
*/
|
|
711
|
-
async
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
editors: [],
|
|
715
|
-
details: {},
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
const mcpConfigTemplate = path.join(__dirname, '..', 'templates', 'mcp-config.json')
|
|
719
|
-
const mcpConfig = JSON.parse(await fs.readFile(mcpConfigTemplate, 'utf-8'))
|
|
720
|
-
|
|
721
|
-
try {
|
|
722
|
-
// 1. Claude Code: ~/.config/claude/claude_desktop_config.json
|
|
723
|
-
if (this.editors.claude.detected) {
|
|
724
|
-
const claudeConfigDir = path.join(this.homeDir, '.config', 'claude')
|
|
725
|
-
const claudeConfigFile = path.join(claudeConfigDir, 'claude_desktop_config.json')
|
|
726
|
-
|
|
727
|
-
await fs.mkdir(claudeConfigDir, { recursive: true })
|
|
728
|
-
|
|
729
|
-
let config = {}
|
|
730
|
-
if (await this.fileExists(claudeConfigFile)) {
|
|
731
|
-
const content = await fs.readFile(claudeConfigFile, 'utf-8')
|
|
732
|
-
config = JSON.parse(content)
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
// Merge Context7 into existing config
|
|
736
|
-
config.mcpServers = config.mcpServers || {}
|
|
737
|
-
config.mcpServers.context7 = mcpConfig.mcpServers.context7
|
|
738
|
-
|
|
739
|
-
await fs.writeFile(claudeConfigFile, JSON.stringify(config, null, 2), 'utf-8')
|
|
740
|
-
results.editors.push('Claude Code')
|
|
741
|
-
results.details.claude = { success: true, path: claudeConfigFile }
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
// 2. Cursor: ~/.cursor/mcp.json
|
|
745
|
-
if (this.editors.cursor.detected) {
|
|
746
|
-
const cursorMcpFile = path.join(this.homeDir, '.cursor', 'mcp.json')
|
|
747
|
-
await fs.mkdir(path.dirname(cursorMcpFile), { recursive: true })
|
|
748
|
-
|
|
749
|
-
let config = {}
|
|
750
|
-
if (await this.fileExists(cursorMcpFile)) {
|
|
751
|
-
const content = await fs.readFile(cursorMcpFile, 'utf-8')
|
|
752
|
-
config = JSON.parse(content)
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
config.mcpServers = config.mcpServers || {}
|
|
756
|
-
config.mcpServers.context7 = mcpConfig.mcpServers.context7
|
|
757
|
-
|
|
758
|
-
await fs.writeFile(cursorMcpFile, JSON.stringify(config, null, 2), 'utf-8')
|
|
759
|
-
results.editors.push('Cursor')
|
|
760
|
-
results.details.cursor = { success: true, path: cursorMcpFile }
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
// 3. Windsurf: ~/.windsurf/mcp.json
|
|
764
|
-
if (this.editors.windsurf.detected) {
|
|
765
|
-
const windsurfMcpFile = path.join(this.homeDir, '.windsurf', 'mcp.json')
|
|
766
|
-
await fs.mkdir(path.dirname(windsurfMcpFile), { recursive: true })
|
|
767
|
-
|
|
768
|
-
let config = {}
|
|
769
|
-
if (await this.fileExists(windsurfMcpFile)) {
|
|
770
|
-
const content = await fs.readFile(windsurfMcpFile, 'utf-8')
|
|
771
|
-
config = JSON.parse(content)
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
config.mcpServers = config.mcpServers || {}
|
|
775
|
-
config.mcpServers.context7 = mcpConfig.mcpServers.context7
|
|
776
|
-
|
|
777
|
-
await fs.writeFile(windsurfMcpFile, JSON.stringify(config, null, 2), 'utf-8')
|
|
778
|
-
results.editors.push('Windsurf')
|
|
779
|
-
results.details.windsurf = { success: true, path: windsurfMcpFile }
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
// 4. Codex: Add MCP instructions to ~/.codex/instructions.md
|
|
783
|
-
if (this.editors.codex.detected) {
|
|
784
|
-
const codexInstructions = this.editors.codex.commandsPath
|
|
785
|
-
|
|
786
|
-
let content = ''
|
|
787
|
-
if (await this.fileExists(codexInstructions)) {
|
|
788
|
-
content = await fs.readFile(codexInstructions, 'utf-8')
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
// Add MCP section if not present
|
|
792
|
-
if (!content.includes('## MCP Integration')) {
|
|
793
|
-
const mcpSection = '\n\n## MCP Integration\n\nThe system integrates with MCP servers:\n\n- **Context7**: Library documentation lookup\n- **Filesystem**: Direct file manipulation\n- **Memory**: Persistent decision storage\n- **Sequential**: Deep reasoning for complex problems\n\n### Using Context7\n\nFor any library or framework questions, use Context7 MCP to lookup official documentation:\n\n```\n# Example: Get React hooks documentation\nUse Context7 to lookup React hooks patterns before implementing\n```\n'
|
|
794
|
-
content += mcpSection
|
|
795
|
-
await fs.writeFile(codexInstructions, content, 'utf-8')
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
results.editors.push('Codex')
|
|
799
|
-
results.details.codex = { success: true, path: codexInstructions }
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
results.message = `Context7 MCP installed for: ${results.editors.join(', ')}`
|
|
803
|
-
} catch (error) {
|
|
804
|
-
results.success = false
|
|
805
|
-
results.message = `Context7 installation failed: ${error.message}`
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
return results
|
|
199
|
+
async updateCommands() {
|
|
200
|
+
// Simply reinstall - will overwrite with latest templates
|
|
201
|
+
return await this.installCommands()
|
|
809
202
|
}
|
|
810
203
|
|
|
811
204
|
/**
|
|
812
|
-
*
|
|
813
|
-
* @
|
|
814
|
-
* @returns {Promise<Object>} Uninstallation result
|
|
205
|
+
* Get installation path for Claude commands
|
|
206
|
+
* @returns {string} Path to Claude commands directory
|
|
815
207
|
*/
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (!editor) {
|
|
820
|
-
return { success: false, editor: editorKey, message: `Unknown editor: ${editorKey}` }
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
try {
|
|
824
|
-
switch (editor.format) {
|
|
825
|
-
case 'slash-commands':
|
|
826
|
-
// Remove the /p commands directory
|
|
827
|
-
await fs.rm(editor.commandsPath, { recursive: true, force: true })
|
|
828
|
-
return {
|
|
829
|
-
success: true,
|
|
830
|
-
editor: editor.name,
|
|
831
|
-
path: editor.commandsPath,
|
|
832
|
-
message: `Removed slash commands from ${editor.name}`,
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
case 'agents-md':
|
|
836
|
-
// Remove AGENTS.md if it exists
|
|
837
|
-
const exists = await this.fileExists(editor.commandsPath)
|
|
838
|
-
if (exists) {
|
|
839
|
-
await fs.unlink(editor.commandsPath)
|
|
840
|
-
}
|
|
841
|
-
return {
|
|
842
|
-
success: true,
|
|
843
|
-
editor: editor.name,
|
|
844
|
-
path: editor.commandsPath,
|
|
845
|
-
message: `Removed AGENTS.md from ${editor.name}`,
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
case 'workflows':
|
|
849
|
-
// Remove all p_*.md workflow files
|
|
850
|
-
try {
|
|
851
|
-
const files = await fs.readdir(editor.commandsPath)
|
|
852
|
-
const prjctWorkflows = files.filter(f => f.startsWith('p_') && f.endsWith('.md'))
|
|
853
|
-
|
|
854
|
-
for (const file of prjctWorkflows) {
|
|
855
|
-
await fs.unlink(path.join(editor.commandsPath, file))
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
return {
|
|
859
|
-
success: true,
|
|
860
|
-
editor: editor.name,
|
|
861
|
-
path: editor.commandsPath,
|
|
862
|
-
removed: prjctWorkflows.length,
|
|
863
|
-
message: `Removed ${prjctWorkflows.length} workflows from ${editor.name}`,
|
|
864
|
-
}
|
|
865
|
-
} catch (error) {
|
|
866
|
-
// Directory might not exist, that's ok
|
|
867
|
-
return {
|
|
868
|
-
success: true,
|
|
869
|
-
editor: editor.name,
|
|
870
|
-
message: `No workflows found in ${editor.name}`,
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
default:
|
|
875
|
-
return {
|
|
876
|
-
success: false,
|
|
877
|
-
editor: editor.name,
|
|
878
|
-
message: `Unknown format: ${editor.format}`,
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
} catch (error) {
|
|
882
|
-
return {
|
|
883
|
-
success: false,
|
|
884
|
-
editor: editor.name,
|
|
885
|
-
message: `Uninstall failed: ${error.message}`,
|
|
886
|
-
}
|
|
887
|
-
}
|
|
208
|
+
getInstallPath() {
|
|
209
|
+
return this.claudeCommandsPath
|
|
888
210
|
}
|
|
889
211
|
|
|
890
212
|
/**
|
|
891
|
-
*
|
|
892
|
-
* @
|
|
213
|
+
* Verify command template exists
|
|
214
|
+
* @param {string} commandName - Command name (without .md extension)
|
|
215
|
+
* @returns {Promise<boolean>} True if template exists
|
|
893
216
|
*/
|
|
894
|
-
async
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
message: 'No editors tracked, nothing to uninstall',
|
|
902
|
-
results: {},
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
const results = {}
|
|
907
|
-
const successfulEditors = []
|
|
908
|
-
|
|
909
|
-
for (const editorKey of trackedEditors) {
|
|
910
|
-
results[editorKey] = await this.uninstallFromEditor(editorKey)
|
|
911
|
-
if (results[editorKey].success) {
|
|
912
|
-
successfulEditors.push(this.editors[editorKey]?.name || editorKey)
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
return {
|
|
917
|
-
success: true,
|
|
918
|
-
editors: successfulEditors,
|
|
919
|
-
totalRemoved: successfulEditors.length,
|
|
920
|
-
results,
|
|
217
|
+
async verifyTemplate(commandName) {
|
|
218
|
+
try {
|
|
219
|
+
const templatePath = path.join(this.templatesDir, `${commandName}.md`)
|
|
220
|
+
await fs.access(templatePath)
|
|
221
|
+
return true
|
|
222
|
+
} catch {
|
|
223
|
+
return false
|
|
921
224
|
}
|
|
922
225
|
}
|
|
923
226
|
}
|