prjct-cli 0.6.0 → 0.7.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.
- package/CHANGELOG.md +67 -6
- package/CLAUDE.md +442 -36
- package/README.md +47 -54
- package/bin/prjct +174 -240
- package/core/agentic/command-executor.js +113 -0
- package/core/agentic/context-builder.js +85 -0
- package/core/agentic/prompt-builder.js +86 -0
- package/core/agentic/template-loader.js +104 -0
- package/core/agentic/tool-registry.js +117 -0
- package/core/command-registry.js +109 -65
- package/core/commands.js +2213 -2173
- package/core/domain/agent-generator.js +118 -0
- package/core/domain/analyzer.js +211 -0
- package/core/domain/architect-session.js +300 -0
- package/core/{agents → infrastructure/agents}/claude-agent.js +16 -13
- package/core/{author-detector.js → infrastructure/author-detector.js} +3 -1
- package/core/{capability-installer.js → infrastructure/capability-installer.js} +3 -6
- package/core/{command-installer.js → infrastructure/command-installer.js} +5 -3
- package/core/{config-manager.js → infrastructure/config-manager.js} +4 -4
- package/core/{editors-config.js → infrastructure/editors-config.js} +2 -10
- package/core/{migrator.js → infrastructure/migrator.js} +34 -19
- package/core/{path-manager.js → infrastructure/path-manager.js} +20 -44
- package/core/{session-manager.js → infrastructure/session-manager.js} +45 -105
- package/core/{update-checker.js → infrastructure/update-checker.js} +67 -67
- package/core/{animations-simple.js → utils/animations.js} +3 -23
- package/core/utils/date-helper.js +238 -0
- package/core/utils/file-helper.js +327 -0
- package/core/utils/jsonl-helper.js +206 -0
- package/core/{project-capabilities.js → utils/project-capabilities.js} +21 -22
- package/core/utils/session-helper.js +277 -0
- package/core/{version.js → utils/version.js} +1 -1
- package/package.json +4 -12
- package/templates/agents/AGENTS.md +101 -27
- package/templates/analysis/analyze.md +84 -0
- package/templates/commands/analyze.md +9 -2
- package/templates/commands/bug.md +79 -0
- package/templates/commands/build.md +5 -2
- package/templates/commands/cleanup.md +5 -2
- package/templates/commands/design.md +5 -2
- package/templates/commands/done.md +4 -2
- package/templates/commands/feature.md +113 -0
- package/templates/commands/fix.md +41 -10
- package/templates/commands/git.md +7 -2
- package/templates/commands/help.md +2 -2
- package/templates/commands/idea.md +14 -5
- package/templates/commands/init.md +62 -7
- package/templates/commands/next.md +4 -2
- package/templates/commands/now.md +4 -2
- package/templates/commands/progress.md +27 -5
- package/templates/commands/recap.md +39 -10
- package/templates/commands/roadmap.md +19 -5
- package/templates/commands/ship.md +118 -16
- package/templates/commands/status.md +4 -2
- package/templates/commands/sync.md +19 -15
- package/templates/commands/task.md +4 -2
- package/templates/commands/test.md +5 -2
- package/templates/commands/workflow.md +4 -2
- package/core/agent-generator.js +0 -525
- package/core/analyzer.js +0 -600
- package/core/animations.js +0 -277
- package/core/ascii-graphics.js +0 -433
- package/core/git-integration.js +0 -401
- package/core/task-schema.js +0 -342
- package/core/workflow-engine.js +0 -213
- package/core/workflow-prompts.js +0 -192
- package/core/workflow-rules.js +0 -147
- package/scripts/post-install.js +0 -121
- package/scripts/preuninstall.js +0 -94
- package/scripts/verify-installation.sh +0 -158
- package/templates/agents/be.template.md +0 -27
- package/templates/agents/coordinator.template.md +0 -34
- package/templates/agents/data.template.md +0 -27
- package/templates/agents/devops.template.md +0 -27
- package/templates/agents/fe.template.md +0 -27
- package/templates/agents/mobile.template.md +0 -27
- package/templates/agents/qa.template.md +0 -27
- package/templates/agents/scribe.template.md +0 -29
- package/templates/agents/security.template.md +0 -27
- package/templates/agents/ux.template.md +0 -27
- package/templates/commands/context.md +0 -36
- package/templates/commands/stuck.md +0 -36
- package/templates/examples/natural-language-examples.md +0 -532
- /package/core/{agent-detector.js → infrastructure/agent-detector.js} +0 -0
package/core/workflow-prompts.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive workflow prompts for missing capabilities
|
|
3
|
-
* Asks users before skipping or installing tools
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
class WorkflowPrompts {
|
|
7
|
-
/**
|
|
8
|
-
* Get recommendation based on detected stack
|
|
9
|
-
*/
|
|
10
|
-
getRecommendation(stepName, projectInfo = {}) {
|
|
11
|
-
const recommendations = {
|
|
12
|
-
design: {
|
|
13
|
-
tools: ['Figma plugin', 'Storybook', 'Design tokens'],
|
|
14
|
-
install: 'npx storybook@latest init',
|
|
15
|
-
reason: 'Component documentation and design system',
|
|
16
|
-
},
|
|
17
|
-
test: {
|
|
18
|
-
tools: this.getTestRecommendation(projectInfo),
|
|
19
|
-
install: this.getTestInstallCommand(projectInfo),
|
|
20
|
-
reason: 'Quality assurance and regression prevention',
|
|
21
|
-
},
|
|
22
|
-
docs: {
|
|
23
|
-
tools: ['JSDoc', 'TypeDoc', 'Docusaurus'],
|
|
24
|
-
install: 'npm install -D jsdoc',
|
|
25
|
-
reason: 'API documentation and code examples',
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return recommendations[stepName] || null
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Detect test framework based on project stack
|
|
34
|
-
*/
|
|
35
|
-
getTestRecommendation(projectInfo) {
|
|
36
|
-
const { framework, typescript } = projectInfo
|
|
37
|
-
|
|
38
|
-
if (framework === 'react') {
|
|
39
|
-
return typescript
|
|
40
|
-
? ['Vitest + Testing Library', 'Jest + Testing Library']
|
|
41
|
-
: ['Jest + Testing Library', 'Vitest']
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (framework === 'vue') {
|
|
45
|
-
return ['Vitest', '@vue/test-utils']
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (framework === 'angular') {
|
|
49
|
-
return ['Jasmine + Karma', 'Jest']
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Default Node.js
|
|
53
|
-
return typescript
|
|
54
|
-
? ['Vitest', 'Jest with ts-jest']
|
|
55
|
-
: ['Jest', 'Vitest', 'Mocha + Chai']
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get install command based on stack
|
|
60
|
-
*/
|
|
61
|
-
getTestInstallCommand(projectInfo) {
|
|
62
|
-
const { framework, typescript } = projectInfo
|
|
63
|
-
|
|
64
|
-
if (framework === 'react') {
|
|
65
|
-
return typescript
|
|
66
|
-
? 'npm install -D vitest @testing-library/react @testing-library/jest-dom'
|
|
67
|
-
: 'npm install -D jest @testing-library/react @testing-library/jest-dom'
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (framework === 'vue') {
|
|
71
|
-
return 'npm install -D vitest @vue/test-utils'
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (framework === 'angular') {
|
|
75
|
-
return 'npm install -D jest @types/jest ts-jest'
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return typescript
|
|
79
|
-
? 'npm install -D vitest'
|
|
80
|
-
: 'npm install -D jest'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Detect project stack from package.json
|
|
85
|
-
*/
|
|
86
|
-
async detectStack(projectPath) {
|
|
87
|
-
const fs = require('fs').promises
|
|
88
|
-
const path = require('path')
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
const pkgPath = path.join(projectPath, 'package.json')
|
|
92
|
-
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf8'))
|
|
93
|
-
|
|
94
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies }
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
framework: this.detectFramework(deps),
|
|
98
|
-
typescript: 'typescript' in deps,
|
|
99
|
-
bundler: this.detectBundler(deps),
|
|
100
|
-
runtime: this.detectRuntime(deps),
|
|
101
|
-
}
|
|
102
|
-
} catch {
|
|
103
|
-
return { framework: 'node', typescript: false }
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
detectFramework(deps) {
|
|
108
|
-
if ('react' in deps) return 'react'
|
|
109
|
-
if ('vue' in deps) return 'vue'
|
|
110
|
-
if ('@angular/core' in deps) return 'angular'
|
|
111
|
-
if ('next' in deps) return 'next'
|
|
112
|
-
if ('nuxt' in deps) return 'nuxt'
|
|
113
|
-
return 'node'
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
detectBundler(deps) {
|
|
117
|
-
if ('vite' in deps) return 'vite'
|
|
118
|
-
if ('webpack' in deps) return 'webpack'
|
|
119
|
-
if ('esbuild' in deps) return 'esbuild'
|
|
120
|
-
return null
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
detectRuntime(deps) {
|
|
124
|
-
if ('bun' in deps) return 'bun'
|
|
125
|
-
if ('deno' in deps) return 'deno'
|
|
126
|
-
return 'node'
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Build prompt message for missing capability
|
|
131
|
-
*/
|
|
132
|
-
async buildPrompt(step, capabilities, projectPath) {
|
|
133
|
-
const stack = await this.detectStack(projectPath)
|
|
134
|
-
const rec = this.getRecommendation(step.needs, stack)
|
|
135
|
-
|
|
136
|
-
if (!rec) {
|
|
137
|
-
return {
|
|
138
|
-
message: `⚠️ Step "${step.name}" requires ${step.needs} capability\n\nOptions:\n1. Skip this step\n2. Continue without ${step.needs}\n3. Pause workflow`,
|
|
139
|
-
options: ['skip', 'continue', 'pause'],
|
|
140
|
-
recommendation: null,
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const toolsList = rec.tools.join(', ')
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
message: `⚠️ Missing ${step.needs} capability for "${step.name}" step\n\n` +
|
|
148
|
-
`📋 Recommended: ${toolsList}\n` +
|
|
149
|
-
`💡 Reason: ${rec.reason}\n\n` +
|
|
150
|
-
'Options:\n' +
|
|
151
|
-
`1. Install recommended (${rec.install})\n` +
|
|
152
|
-
'2. Skip this step\n' +
|
|
153
|
-
`3. Continue without ${step.needs}\n` +
|
|
154
|
-
'4. Pause workflow',
|
|
155
|
-
options: ['install', 'skip', 'continue', 'pause'],
|
|
156
|
-
recommendation: rec,
|
|
157
|
-
stack,
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Parse user choice from response
|
|
163
|
-
*/
|
|
164
|
-
parseChoice(response) {
|
|
165
|
-
const lower = response.toLowerCase().trim()
|
|
166
|
-
|
|
167
|
-
if (lower.match(/^(1|install|yes|y)/)) return 'install'
|
|
168
|
-
if (lower.match(/^(2|skip|s)/)) return 'skip'
|
|
169
|
-
if (lower.match(/^(3|continue|c)/)) return 'continue'
|
|
170
|
-
if (lower.match(/^(4|pause|p)/)) return 'pause'
|
|
171
|
-
|
|
172
|
-
return 'skip' // Default to skip if unclear
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Create installation task for workflow
|
|
177
|
-
*/
|
|
178
|
-
createInstallTask(step, recommendation) {
|
|
179
|
-
return {
|
|
180
|
-
name: `install-${step.needs}`,
|
|
181
|
-
agent: 'devops',
|
|
182
|
-
action: `Install ${step.needs}: ${recommendation.install}`,
|
|
183
|
-
required: true,
|
|
184
|
-
type: 'install',
|
|
185
|
-
install: recommendation.install,
|
|
186
|
-
capability: step.needs,
|
|
187
|
-
reason: recommendation.reason,
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
module.exports = new WorkflowPrompts()
|
package/core/workflow-rules.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow Rules
|
|
3
|
-
* Defines workflows by task type with capability requirements
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
// UI Component workflow
|
|
8
|
-
ui: [
|
|
9
|
-
{
|
|
10
|
-
name: 'design',
|
|
11
|
-
agent: 'frontend',
|
|
12
|
-
action: 'Create component design',
|
|
13
|
-
required: false,
|
|
14
|
-
needs: 'design',
|
|
15
|
-
prompt: true,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: 'dev',
|
|
19
|
-
agent: 'frontend',
|
|
20
|
-
action: 'Implement component',
|
|
21
|
-
required: true,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'test',
|
|
25
|
-
agent: 'qa',
|
|
26
|
-
action: 'Create tests',
|
|
27
|
-
required: false,
|
|
28
|
-
needs: 'test',
|
|
29
|
-
retry: 3,
|
|
30
|
-
prompt: true,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'docs',
|
|
34
|
-
agent: 'scribe',
|
|
35
|
-
action: 'Document component',
|
|
36
|
-
required: false,
|
|
37
|
-
needs: 'docs',
|
|
38
|
-
prompt: true,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
// API Endpoint workflow
|
|
43
|
-
api: [
|
|
44
|
-
{
|
|
45
|
-
name: 'dev',
|
|
46
|
-
agent: 'backend',
|
|
47
|
-
action: 'Implement endpoint',
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'test',
|
|
52
|
-
agent: 'qa',
|
|
53
|
-
action: 'Create API tests',
|
|
54
|
-
required: false,
|
|
55
|
-
needs: 'test',
|
|
56
|
-
retry: 3,
|
|
57
|
-
prompt: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: 'docs',
|
|
61
|
-
agent: 'scribe',
|
|
62
|
-
action: 'Document API',
|
|
63
|
-
required: false,
|
|
64
|
-
needs: 'docs',
|
|
65
|
-
prompt: true,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
// Bug Fix workflow
|
|
70
|
-
bug: [
|
|
71
|
-
{
|
|
72
|
-
name: 'analyze',
|
|
73
|
-
agent: 'analyzer',
|
|
74
|
-
action: 'Analyze bug',
|
|
75
|
-
required: true,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'fix',
|
|
79
|
-
agent: 'auto',
|
|
80
|
-
action: 'Fix bug',
|
|
81
|
-
required: true,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'test',
|
|
85
|
-
agent: 'qa',
|
|
86
|
-
action: 'Verify fix',
|
|
87
|
-
required: false,
|
|
88
|
-
needs: 'test',
|
|
89
|
-
retry: 3,
|
|
90
|
-
prompt: true,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
|
|
94
|
-
// Refactor workflow
|
|
95
|
-
refactor: [
|
|
96
|
-
{
|
|
97
|
-
name: 'refactor',
|
|
98
|
-
agent: 'refactorer',
|
|
99
|
-
action: 'Refactor code',
|
|
100
|
-
required: true,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'test',
|
|
104
|
-
agent: 'qa',
|
|
105
|
-
action: 'Verify refactor',
|
|
106
|
-
required: false,
|
|
107
|
-
needs: 'test',
|
|
108
|
-
retry: 3,
|
|
109
|
-
prompt: true,
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
|
|
113
|
-
// Feature workflow (complete feature)
|
|
114
|
-
feature: [
|
|
115
|
-
{
|
|
116
|
-
name: 'design',
|
|
117
|
-
agent: 'architect',
|
|
118
|
-
action: 'Design feature',
|
|
119
|
-
required: false,
|
|
120
|
-
needs: 'design',
|
|
121
|
-
prompt: true,
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 'dev',
|
|
125
|
-
agent: 'auto',
|
|
126
|
-
action: 'Implement feature',
|
|
127
|
-
required: true,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'test',
|
|
131
|
-
agent: 'qa',
|
|
132
|
-
action: 'Test feature',
|
|
133
|
-
required: false,
|
|
134
|
-
needs: 'test',
|
|
135
|
-
retry: 3,
|
|
136
|
-
prompt: true,
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'docs',
|
|
140
|
-
agent: 'scribe',
|
|
141
|
-
action: 'Document feature',
|
|
142
|
-
required: false,
|
|
143
|
-
needs: 'docs',
|
|
144
|
-
prompt: true,
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
}
|
package/scripts/post-install.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Post-Install Script
|
|
5
|
-
*
|
|
6
|
-
* Runs automatically after `npm install -g prjct-cli` or `npm update -g prjct-cli`.
|
|
7
|
-
* Auto-updates slash commands in all previously configured editors.
|
|
8
|
-
*
|
|
9
|
-
* Flow:
|
|
10
|
-
* 1. Check if running as global install
|
|
11
|
-
* 2. Read tracked editors from ~/.prjct-cli/config/installed-editors.json
|
|
12
|
-
* 3. If config exists and version changed, force-update commands in tracked editors
|
|
13
|
-
* 4. Update version in config
|
|
14
|
-
*
|
|
15
|
-
* @version 0.4.4
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const path = require('path')
|
|
19
|
-
const chalk = require('chalk')
|
|
20
|
-
const { execSync } = require('child_process')
|
|
21
|
-
|
|
22
|
-
async function main() {
|
|
23
|
-
try {
|
|
24
|
-
// Get current package version
|
|
25
|
-
const packageJson = require('../package.json')
|
|
26
|
-
const currentVersion = packageJson.version
|
|
27
|
-
|
|
28
|
-
// Check if this is a global installation
|
|
29
|
-
const isGlobal = await checkIfGlobalInstall()
|
|
30
|
-
|
|
31
|
-
if (!isGlobal) {
|
|
32
|
-
// Skip post-install for local/dev installations
|
|
33
|
-
if (process.env.DEBUG) {
|
|
34
|
-
console.log(chalk.gray('[post-install] Skipping - not a global install'))
|
|
35
|
-
}
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Load editors config
|
|
40
|
-
const editorsConfig = require('../core/editors-config')
|
|
41
|
-
const configExists = await editorsConfig.configExists()
|
|
42
|
-
|
|
43
|
-
if (!configExists) {
|
|
44
|
-
// First-time install - show welcome message
|
|
45
|
-
console.log(chalk.cyan('\n✨ prjct-cli installed successfully!\n'))
|
|
46
|
-
console.log(chalk.gray('Run: ') + chalk.cyan('prjct start') + chalk.gray(' to get started\n'))
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Check if version has changed
|
|
51
|
-
const versionChanged = await editorsConfig.hasVersionChanged(currentVersion)
|
|
52
|
-
|
|
53
|
-
if (!versionChanged) {
|
|
54
|
-
// Same version, no update needed
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Get tracked editors
|
|
59
|
-
const trackedEditors = await editorsConfig.getTrackedEditors()
|
|
60
|
-
|
|
61
|
-
if (trackedEditors.length === 0) {
|
|
62
|
-
// No editors tracked yet
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(chalk.cyan('\n🔄 Updating prjct commands in configured editors...\n'))
|
|
67
|
-
|
|
68
|
-
// Load command installer
|
|
69
|
-
const commandInstaller = require('../core/command-installer')
|
|
70
|
-
|
|
71
|
-
// Force-update commands in all tracked editors
|
|
72
|
-
const results = await commandInstaller.installToSelected(trackedEditors, true)
|
|
73
|
-
|
|
74
|
-
if (results.success) {
|
|
75
|
-
console.log(chalk.green(`✅ Updated commands in: ${results.editors.join(', ')}`))
|
|
76
|
-
console.log(chalk.gray(` Commands updated: ${results.totalUpdated}`))
|
|
77
|
-
} else {
|
|
78
|
-
console.log(chalk.yellow('⚠️ Some editors could not be updated'))
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Update version in config
|
|
82
|
-
await editorsConfig.updateVersion(currentVersion)
|
|
83
|
-
|
|
84
|
-
console.log(chalk.cyan(`\n✨ prjct-cli ${currentVersion} is ready!\n`))
|
|
85
|
-
|
|
86
|
-
} catch (error) {
|
|
87
|
-
// Silently fail - don't block npm install
|
|
88
|
-
// Only log if explicitly debugging
|
|
89
|
-
if (process.env.DEBUG) {
|
|
90
|
-
console.error(chalk.red('[post-install] Error:'), error.message)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Check if package is being installed globally
|
|
97
|
-
* @returns {Promise<boolean>} True if global install
|
|
98
|
-
*/
|
|
99
|
-
async function checkIfGlobalInstall() {
|
|
100
|
-
try {
|
|
101
|
-
// Get npm global root directory
|
|
102
|
-
const globalRoot = execSync('npm root -g', { encoding: 'utf-8' }).trim()
|
|
103
|
-
|
|
104
|
-
// Get current package directory
|
|
105
|
-
const currentDir = path.resolve(__dirname, '..')
|
|
106
|
-
|
|
107
|
-
// Check if current directory is under global node_modules
|
|
108
|
-
return currentDir.startsWith(globalRoot)
|
|
109
|
-
} catch {
|
|
110
|
-
return false
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Run main function
|
|
115
|
-
main().catch(error => {
|
|
116
|
-
// Silently fail - don't block npm install
|
|
117
|
-
if (process.env.DEBUG) {
|
|
118
|
-
console.error('[post-install] Fatal error:', error)
|
|
119
|
-
}
|
|
120
|
-
process.exit(0) // Exit with success to not block npm install
|
|
121
|
-
})
|
package/scripts/preuninstall.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-Uninstall Script
|
|
5
|
-
*
|
|
6
|
-
* Runs automatically BEFORE `npm uninstall -g prjct-cli`.
|
|
7
|
-
* Cleans up slash commands from all tracked AI editors.
|
|
8
|
-
*
|
|
9
|
-
* Flow:
|
|
10
|
-
* 1. Check if running as global uninstall
|
|
11
|
-
* 2. Read tracked editors from ~/.prjct-cli/config/installed-editors.json
|
|
12
|
-
* 3. Remove all prjct commands from tracked editors
|
|
13
|
-
* 4. Delete tracking configuration
|
|
14
|
-
* 5. Clean exit (don't block uninstall)
|
|
15
|
-
*
|
|
16
|
-
* @version 0.4.4
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const chalk = require('chalk')
|
|
20
|
-
const { execSync } = require('child_process')
|
|
21
|
-
const path = require('path')
|
|
22
|
-
|
|
23
|
-
async function main() {
|
|
24
|
-
try {
|
|
25
|
-
// Check if this is a global uninstallation
|
|
26
|
-
const isGlobal = await checkIfGlobalInstall()
|
|
27
|
-
|
|
28
|
-
if (!isGlobal) {
|
|
29
|
-
// Skip cleanup for local/dev uninstalls
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Load editors config
|
|
34
|
-
const editorsConfig = require('../core/editors-config')
|
|
35
|
-
const configExists = await editorsConfig.configExists()
|
|
36
|
-
|
|
37
|
-
if (!configExists) {
|
|
38
|
-
// No config, nothing to clean up
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.log(chalk.cyan('\n🧹 Cleaning up prjct commands from AI editors...\n'))
|
|
43
|
-
|
|
44
|
-
// Load command installer
|
|
45
|
-
const commandInstaller = require('../core/command-installer')
|
|
46
|
-
|
|
47
|
-
// Uninstall from all tracked editors
|
|
48
|
-
const results = await commandInstaller.uninstallFromAll()
|
|
49
|
-
|
|
50
|
-
if (results.success && results.editors.length > 0) {
|
|
51
|
-
console.log(chalk.green(`✅ Removed from: ${results.editors.join(', ')}`))
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Delete tracking config
|
|
55
|
-
await editorsConfig.deleteConfig()
|
|
56
|
-
|
|
57
|
-
console.log(chalk.green('\n✨ prjct-cli uninstalled cleanly\n'))
|
|
58
|
-
|
|
59
|
-
} catch (error) {
|
|
60
|
-
// Silently fail - don't block npm uninstall
|
|
61
|
-
// Only log if explicitly debugging
|
|
62
|
-
if (process.env.DEBUG) {
|
|
63
|
-
console.error(chalk.red('[preuninstall] Error:'), error.message)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if package is being uninstalled globally
|
|
70
|
-
* @returns {Promise<boolean>} True if global uninstall
|
|
71
|
-
*/
|
|
72
|
-
async function checkIfGlobalInstall() {
|
|
73
|
-
try {
|
|
74
|
-
// Get npm global root directory
|
|
75
|
-
const globalRoot = execSync('npm root -g', { encoding: 'utf-8' }).trim()
|
|
76
|
-
|
|
77
|
-
// Get current package directory
|
|
78
|
-
const currentDir = path.resolve(__dirname, '..')
|
|
79
|
-
|
|
80
|
-
// Check if current directory is under global node_modules
|
|
81
|
-
return currentDir.startsWith(globalRoot)
|
|
82
|
-
} catch {
|
|
83
|
-
return false
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Run main function
|
|
88
|
-
main().catch(error => {
|
|
89
|
-
// Silently fail - don't block npm uninstall
|
|
90
|
-
if (process.env.DEBUG) {
|
|
91
|
-
console.error('[preuninstall] Fatal error:', error)
|
|
92
|
-
}
|
|
93
|
-
process.exit(0) // Exit with success to not block npm uninstall
|
|
94
|
-
})
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# prjct-cli Installation Verification Script
|
|
4
|
-
|
|
5
|
-
# Colors
|
|
6
|
-
GREEN='\033[0;32m'
|
|
7
|
-
RED='\033[0;31m'
|
|
8
|
-
YELLOW='\033[1;33m'
|
|
9
|
-
BLUE='\033[0;34m'
|
|
10
|
-
NC='\033[0m'
|
|
11
|
-
|
|
12
|
-
echo ""
|
|
13
|
-
echo "🔍 prjct-cli Installation Verification"
|
|
14
|
-
echo "======================================="
|
|
15
|
-
echo ""
|
|
16
|
-
|
|
17
|
-
ERRORS=0
|
|
18
|
-
WARNINGS=0
|
|
19
|
-
|
|
20
|
-
# Function to check and report
|
|
21
|
-
check() {
|
|
22
|
-
local description="$1"
|
|
23
|
-
local condition="$2"
|
|
24
|
-
|
|
25
|
-
if eval "$condition"; then
|
|
26
|
-
echo -e "${GREEN}✅ $description${NC}"
|
|
27
|
-
return 0
|
|
28
|
-
else
|
|
29
|
-
echo -e "${RED}❌ $description${NC}"
|
|
30
|
-
((ERRORS++))
|
|
31
|
-
return 1
|
|
32
|
-
fi
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
warn_check() {
|
|
36
|
-
local description="$1"
|
|
37
|
-
local condition="$2"
|
|
38
|
-
|
|
39
|
-
if eval "$condition"; then
|
|
40
|
-
echo -e "${GREEN}✅ $description${NC}"
|
|
41
|
-
return 0
|
|
42
|
-
else
|
|
43
|
-
echo -e "${YELLOW}⚠️ $description${NC}"
|
|
44
|
-
((WARNINGS++))
|
|
45
|
-
return 1
|
|
46
|
-
fi
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
# 1. Check installation directory
|
|
50
|
-
echo -e "${BLUE}📁 Checking installation...${NC}"
|
|
51
|
-
check "Installation directory exists" "[ -d $HOME/.prjct-cli ]"
|
|
52
|
-
check "Core directory exists" "[ -d $HOME/.prjct-cli/core ]"
|
|
53
|
-
check "Commands directory exists" "[ -d $HOME/.prjct-cli/commands ]"
|
|
54
|
-
check "Templates directory exists" "[ -d $HOME/.prjct-cli/templates ]"
|
|
55
|
-
echo ""
|
|
56
|
-
|
|
57
|
-
# 2. Check executable
|
|
58
|
-
echo -e "${BLUE}🔧 Checking executable...${NC}"
|
|
59
|
-
check "Binary exists" "[ -f $HOME/.prjct-cli/bin/prjct ]"
|
|
60
|
-
check "Binary is executable" "[ -x $HOME/.prjct-cli/bin/prjct ]"
|
|
61
|
-
|
|
62
|
-
# Check if in PATH
|
|
63
|
-
if command -v prjct &> /dev/null; then
|
|
64
|
-
echo -e "${GREEN}✅ prjct command available in PATH${NC}"
|
|
65
|
-
else
|
|
66
|
-
warn_check "prjct command in PATH" "false"
|
|
67
|
-
echo " Try: source ~/.bashrc or source ~/.zshrc"
|
|
68
|
-
fi
|
|
69
|
-
echo ""
|
|
70
|
-
|
|
71
|
-
# 3. Check Claude Code integration
|
|
72
|
-
echo -e "${BLUE}🤖 Checking Claude Code integration...${NC}"
|
|
73
|
-
if [ -d "$HOME/.claude" ]; then
|
|
74
|
-
check "Claude directory detected" "true"
|
|
75
|
-
check "Commands directory exists" "[ -d $HOME/.claude/commands/p ]"
|
|
76
|
-
|
|
77
|
-
# Check individual command files
|
|
78
|
-
for cmd in init now done ship next idea recap progress stuck context; do
|
|
79
|
-
warn_check "Command /p:$cmd installed" "[ -f $HOME/.claude/commands/p/$cmd.md ]"
|
|
80
|
-
done
|
|
81
|
-
|
|
82
|
-
# Check if commands are readable by Claude
|
|
83
|
-
if [ -f "$HOME/.claude/commands/p/init.md" ]; then
|
|
84
|
-
if grep -q "allowed-tools:" "$HOME/.claude/commands/p/init.md"; then
|
|
85
|
-
echo -e "${GREEN}✅ Commands have correct format${NC}"
|
|
86
|
-
else
|
|
87
|
-
echo -e "${YELLOW}⚠️ Commands may have incorrect format${NC}"
|
|
88
|
-
((WARNINGS++))
|
|
89
|
-
fi
|
|
90
|
-
fi
|
|
91
|
-
else
|
|
92
|
-
echo -e "${YELLOW}⚠️ Claude Code not detected${NC}"
|
|
93
|
-
((WARNINGS++))
|
|
94
|
-
fi
|
|
95
|
-
echo ""
|
|
96
|
-
|
|
97
|
-
# 4. Check Node.js dependencies
|
|
98
|
-
echo -e "${BLUE}📦 Checking dependencies...${NC}"
|
|
99
|
-
check "node_modules exists" "[ -d $HOME/.prjct-cli/node_modules ]"
|
|
100
|
-
check "package.json exists" "[ -f $HOME/.prjct-cli/package.json ]"
|
|
101
|
-
|
|
102
|
-
# Check specific dependencies
|
|
103
|
-
if [ -d "$HOME/.prjct-cli/node_modules" ]; then
|
|
104
|
-
warn_check "commander installed" "[ -d $HOME/.prjct-cli/node_modules/commander ]"
|
|
105
|
-
warn_check "chalk installed" "[ -d $HOME/.prjct-cli/node_modules/chalk ]"
|
|
106
|
-
warn_check "ora installed" "[ -d $HOME/.prjct-cli/node_modules/ora ]"
|
|
107
|
-
fi
|
|
108
|
-
echo ""
|
|
109
|
-
|
|
110
|
-
# 5. Test basic functionality
|
|
111
|
-
echo -e "${BLUE}🧪 Testing functionality...${NC}"
|
|
112
|
-
cd /tmp
|
|
113
|
-
rm -rf .prjct 2>/dev/null
|
|
114
|
-
|
|
115
|
-
# Test prjct command if available
|
|
116
|
-
if command -v prjct &> /dev/null; then
|
|
117
|
-
# Try to run help
|
|
118
|
-
if prjct 2>&1 | grep -q "Available commands"; then
|
|
119
|
-
echo -e "${GREEN}✅ prjct command works${NC}"
|
|
120
|
-
else
|
|
121
|
-
echo -e "${RED}❌ prjct command not working properly${NC}"
|
|
122
|
-
((ERRORS++))
|
|
123
|
-
fi
|
|
124
|
-
else
|
|
125
|
-
echo -e "${YELLOW}⚠️ Cannot test prjct command (not in PATH)${NC}"
|
|
126
|
-
((WARNINGS++))
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# Test direct execution
|
|
130
|
-
if $HOME/.prjct-cli/bin/prjct 2>&1 | grep -q "Available commands"; then
|
|
131
|
-
echo -e "${GREEN}✅ Direct execution works${NC}"
|
|
132
|
-
else
|
|
133
|
-
echo -e "${RED}❌ Direct execution not working${NC}"
|
|
134
|
-
((ERRORS++))
|
|
135
|
-
fi
|
|
136
|
-
echo ""
|
|
137
|
-
|
|
138
|
-
# Summary
|
|
139
|
-
echo "======================================="
|
|
140
|
-
if [ $ERRORS -eq 0 ]; then
|
|
141
|
-
if [ $WARNINGS -eq 0 ]; then
|
|
142
|
-
echo -e "${GREEN}🎉 All checks passed! prjct-cli is ready to use.${NC}"
|
|
143
|
-
echo ""
|
|
144
|
-
echo "Try these commands:"
|
|
145
|
-
echo " In Claude Code: /p:init"
|
|
146
|
-
echo " In Terminal: prjct init"
|
|
147
|
-
else
|
|
148
|
-
echo -e "${GREEN}✅ Installation successful with $WARNINGS warnings.${NC}"
|
|
149
|
-
echo ""
|
|
150
|
-
echo "Some features may need attention, but prjct-cli should work."
|
|
151
|
-
fi
|
|
152
|
-
else
|
|
153
|
-
echo -e "${RED}❌ Installation has $ERRORS errors and $WARNINGS warnings.${NC}"
|
|
154
|
-
echo ""
|
|
155
|
-
echo "Please run the installer again:"
|
|
156
|
-
echo " cd ~/.prjct-cli && ./setup.sh"
|
|
157
|
-
fi
|
|
158
|
-
echo ""
|