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
package/core/agent-detector.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Detection Module for prjct-cli
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* 100% Claude-focused architecture
|
|
5
|
+
* Detects Claude Code and Claude Desktop environments
|
|
6
|
+
*
|
|
7
|
+
* @version 0.5.0
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
const fs = require('fs')
|
|
@@ -9,16 +13,10 @@ const path = require('path')
|
|
|
9
13
|
class AgentDetector {
|
|
10
14
|
constructor() {
|
|
11
15
|
this.detectedAgent = null
|
|
12
|
-
this.detectionMethods = [
|
|
13
|
-
this.detectByEnvironmentVariables.bind(this),
|
|
14
|
-
this.detectByConfigFiles.bind(this),
|
|
15
|
-
this.detectByRuntimeCapabilities.bind(this),
|
|
16
|
-
this.detectByFileSystem.bind(this),
|
|
17
|
-
]
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
|
-
* Main detection method -
|
|
19
|
+
* Main detection method - Claude or CLI fallback
|
|
22
20
|
* @returns {Object} Agent information
|
|
23
21
|
*/
|
|
24
22
|
async detect() {
|
|
@@ -26,107 +24,48 @@ class AgentDetector {
|
|
|
26
24
|
return this.detectedAgent
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return result
|
|
34
|
-
}
|
|
27
|
+
// Check for Claude environment
|
|
28
|
+
if (this.isClaudeEnvironment()) {
|
|
29
|
+
this.detectedAgent = this.getClaudeAgent()
|
|
30
|
+
return this.detectedAgent
|
|
35
31
|
}
|
|
36
32
|
|
|
33
|
+
// Fallback to terminal/CLI
|
|
37
34
|
this.detectedAgent = this.getTerminalAgent()
|
|
38
35
|
return this.detectedAgent
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
/**
|
|
42
|
-
*
|
|
39
|
+
* Check if running in Claude environment
|
|
40
|
+
* @returns {boolean} True if Claude detected
|
|
43
41
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return this.getCodexAgent()
|
|
47
|
-
}
|
|
48
|
-
|
|
42
|
+
isClaudeEnvironment() {
|
|
43
|
+
// Environment variables
|
|
49
44
|
if (process.env.CLAUDE_AGENT || process.env.ANTHROPIC_CLAUDE) {
|
|
50
|
-
return
|
|
45
|
+
return true
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
// MCP availability
|
|
49
|
+
if (global.mcp || process.env.MCP_AVAILABLE) {
|
|
50
|
+
return true
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Detect agent by configuration files
|
|
62
|
-
*/
|
|
63
|
-
async detectByConfigFiles() {
|
|
53
|
+
// Configuration files
|
|
64
54
|
const projectRoot = process.cwd()
|
|
65
|
-
|
|
66
|
-
if (fs.existsSync(path.join(projectRoot, 'AGENTS.md'))) {
|
|
67
|
-
if (!fs.existsSync(path.join(projectRoot, '.claude'))) {
|
|
68
|
-
return this.getCodexAgent()
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
55
|
if (fs.existsSync(path.join(projectRoot, 'CLAUDE.md'))) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (fs.existsSync(path.join(process.env.HOME || '', '.claude'))) {
|
|
77
|
-
return this.getClaudeAgent()
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return null
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Detect agent by runtime capabilities
|
|
85
|
-
*/
|
|
86
|
-
async detectByRuntimeCapabilities() {
|
|
87
|
-
try {
|
|
88
|
-
if (global.mcp || process.env.MCP_AVAILABLE) {
|
|
89
|
-
return this.getClaudeAgent()
|
|
90
|
-
}
|
|
91
|
-
} catch (e) {
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (this.isRunningInContainer()) {
|
|
95
|
-
return this.getCodexAgent()
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return null
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Detect agent by filesystem characteristics
|
|
103
|
-
*/
|
|
104
|
-
async detectByFileSystem() {
|
|
105
|
-
if (process.cwd().includes('/sandbox/') || process.cwd().includes('/tmp/codex/')) {
|
|
106
|
-
return this.getCodexAgent()
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (process.cwd().includes('/.claude/') || process.cwd().includes('/claude-workspace/')) {
|
|
110
|
-
return this.getClaudeAgent()
|
|
56
|
+
return true
|
|
111
57
|
}
|
|
112
58
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Check if running in a container
|
|
118
|
-
*/
|
|
119
|
-
isRunningInContainer() {
|
|
120
|
-
if (fs.existsSync('/.dockerenv')) {
|
|
59
|
+
// Claude directory in home
|
|
60
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || ''
|
|
61
|
+
if (fs.existsSync(path.join(homeDir, '.claude'))) {
|
|
121
62
|
return true
|
|
122
63
|
}
|
|
123
64
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
65
|
+
// Filesystem paths
|
|
66
|
+
const cwd = process.cwd()
|
|
67
|
+
if (cwd.includes('/.claude/') || cwd.includes('/claude-workspace/')) {
|
|
68
|
+
return true
|
|
130
69
|
}
|
|
131
70
|
|
|
132
71
|
return false
|
|
@@ -134,11 +73,12 @@ class AgentDetector {
|
|
|
134
73
|
|
|
135
74
|
/**
|
|
136
75
|
* Get Claude agent configuration
|
|
76
|
+
* Works for both Claude Code and Claude Desktop
|
|
137
77
|
*/
|
|
138
78
|
getClaudeAgent() {
|
|
139
79
|
return {
|
|
140
80
|
type: 'claude',
|
|
141
|
-
name: 'Claude Code',
|
|
81
|
+
name: 'Claude (Code + Desktop)',
|
|
142
82
|
capabilities: {
|
|
143
83
|
mcp: true,
|
|
144
84
|
filesystem: 'mcp',
|
|
@@ -146,46 +86,21 @@ class AgentDetector {
|
|
|
146
86
|
emojis: true,
|
|
147
87
|
colors: true,
|
|
148
88
|
interactive: true,
|
|
89
|
+
agents: true,
|
|
149
90
|
},
|
|
150
91
|
config: {
|
|
151
92
|
configFile: 'CLAUDE.md',
|
|
152
93
|
commandPrefix: '/p:',
|
|
153
94
|
responseStyle: 'rich',
|
|
154
95
|
dataDir: '.prjct',
|
|
96
|
+
agentsDir: '~/.claude/agents',
|
|
97
|
+
commandsDir: '~/.claude/commands/p',
|
|
155
98
|
},
|
|
156
99
|
environment: {
|
|
157
100
|
hasMCP: true,
|
|
158
101
|
sandboxed: false,
|
|
159
102
|
persistent: true,
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Get Codex agent configuration
|
|
166
|
-
*/
|
|
167
|
-
getCodexAgent() {
|
|
168
|
-
return {
|
|
169
|
-
type: 'codex',
|
|
170
|
-
name: 'OpenAI Codex',
|
|
171
|
-
capabilities: {
|
|
172
|
-
mcp: false,
|
|
173
|
-
filesystem: 'native',
|
|
174
|
-
markdown: true,
|
|
175
|
-
emojis: true,
|
|
176
|
-
colors: false,
|
|
177
|
-
interactive: false,
|
|
178
|
-
},
|
|
179
|
-
config: {
|
|
180
|
-
configFile: 'AGENTS.md',
|
|
181
|
-
commandPrefix: '/p:',
|
|
182
|
-
responseStyle: 'structured',
|
|
183
|
-
dataDir: '.prjct',
|
|
184
|
-
},
|
|
185
|
-
environment: {
|
|
186
|
-
hasMCP: false,
|
|
187
|
-
sandboxed: true,
|
|
188
|
-
persistent: false,
|
|
103
|
+
agentSystem: true,
|
|
189
104
|
},
|
|
190
105
|
}
|
|
191
106
|
}
|
|
@@ -204,17 +119,21 @@ class AgentDetector {
|
|
|
204
119
|
emojis: true,
|
|
205
120
|
colors: true,
|
|
206
121
|
interactive: true,
|
|
122
|
+
agents: false,
|
|
207
123
|
},
|
|
208
124
|
config: {
|
|
209
125
|
configFile: null,
|
|
210
126
|
commandPrefix: 'prjct',
|
|
211
127
|
responseStyle: 'cli',
|
|
212
128
|
dataDir: '.prjct',
|
|
129
|
+
agentsDir: null,
|
|
130
|
+
commandsDir: null,
|
|
213
131
|
},
|
|
214
132
|
environment: {
|
|
215
133
|
hasMCP: false,
|
|
216
134
|
sandboxed: false,
|
|
217
135
|
persistent: true,
|
|
136
|
+
agentSystem: false,
|
|
218
137
|
},
|
|
219
138
|
}
|
|
220
139
|
}
|
|
@@ -227,9 +146,6 @@ class AgentDetector {
|
|
|
227
146
|
case 'claude':
|
|
228
147
|
this.detectedAgent = this.getClaudeAgent()
|
|
229
148
|
break
|
|
230
|
-
case 'codex':
|
|
231
|
-
this.detectedAgent = this.getCodexAgent()
|
|
232
|
-
break
|
|
233
149
|
case 'terminal':
|
|
234
150
|
default:
|
|
235
151
|
this.detectedAgent = this.getTerminalAgent()
|
|
@@ -244,6 +160,23 @@ class AgentDetector {
|
|
|
244
160
|
reset() {
|
|
245
161
|
this.detectedAgent = null
|
|
246
162
|
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Check if current environment is Claude
|
|
166
|
+
* @returns {boolean} True if Claude
|
|
167
|
+
*/
|
|
168
|
+
isClaude() {
|
|
169
|
+
const agent = this.detectedAgent || this.isClaudeEnvironment()
|
|
170
|
+
return agent === true || (agent && agent.type === 'claude')
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Check if current environment is Terminal/CLI
|
|
175
|
+
* @returns {boolean} True if terminal
|
|
176
|
+
*/
|
|
177
|
+
isTerminal() {
|
|
178
|
+
return !this.isClaude()
|
|
179
|
+
}
|
|
247
180
|
}
|
|
248
181
|
|
|
249
182
|
module.exports = new AgentDetector()
|