multi-agents-cli 1.1.14 → 1.1.16
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/core/workflow/agent.js +92 -4
- package/package.json +1 -1
package/core/workflow/agent.js
CHANGED
|
@@ -123,6 +123,96 @@ if (!config.ide) {
|
|
|
123
123
|
process.exit(1);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// ── Claude Code CLI gate ─────────────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
const checkClaudeAuth = () => {
|
|
129
|
+
try { execSync('claude --version', { stdio: 'pipe' }); return true; } catch { return false; }
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const installClaudeCode = () => {
|
|
133
|
+
const frames = ['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'];
|
|
134
|
+
let i = 0;
|
|
135
|
+
const spin = setInterval(() => process.stdout.write(`\r ${frames[i++ % frames.length]} Installing Claude Code CLI...`), 60);
|
|
136
|
+
try {
|
|
137
|
+
execSync('npm install -g @anthropic-ai/claude-code', { stdio: 'pipe' });
|
|
138
|
+
clearInterval(spin);
|
|
139
|
+
process.stdout.write('\r' + ' '.repeat(40) + '\r');
|
|
140
|
+
console.log(` ${green('✓')} Claude Code CLI installed\n`);
|
|
141
|
+
return true;
|
|
142
|
+
} catch {
|
|
143
|
+
clearInterval(spin);
|
|
144
|
+
process.stdout.write('\r' + ' '.repeat(40) + '\r');
|
|
145
|
+
console.log(` ${red('✖')} Installation failed - try manually: ${cyan('npm install -g @anthropic-ai/claude-code')}\n`);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const runClaudeLogin = () => {
|
|
151
|
+
const { spawnSync } = require('child_process');
|
|
152
|
+
console.log(`\n ${dim('Running claude login...')}\n`);
|
|
153
|
+
const result = spawnSync('claude', ['login'], { stdio: 'inherit' });
|
|
154
|
+
return result.status === 0;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
let claudeInstalled = false;
|
|
158
|
+
try { execSync('which claude', { stdio: 'pipe' }); claudeInstalled = true; } catch {}
|
|
159
|
+
|
|
160
|
+
await (async () => {
|
|
161
|
+
if (!claudeInstalled) {
|
|
162
|
+
console.log(`\n${red(' ✖ Claude Code CLI not found.')}\n`);
|
|
163
|
+
const installIdx = await prompts({
|
|
164
|
+
type: 'select',
|
|
165
|
+
name: 'value',
|
|
166
|
+
message: 'How would you like to proceed?',
|
|
167
|
+
choices: [
|
|
168
|
+
{ title: `${green('→')} I have an account - install Claude Code for me`, value: 0 },
|
|
169
|
+
{ title: `${dim('→')} I don\'t have an account yet - show me how to get started`, value: 1 },
|
|
170
|
+
{ title: `${dim('←')} Exit`, value: 2 },
|
|
171
|
+
],
|
|
172
|
+
}, { onCancel: () => process.exit(0) });
|
|
173
|
+
|
|
174
|
+
if (installIdx.value === 2 || installIdx.value === undefined) process.exit(0);
|
|
175
|
+
|
|
176
|
+
if (installIdx.value === 1) {
|
|
177
|
+
console.log(`\n ${bold('To get started with Claude Code:')}\n`);
|
|
178
|
+
console.log(` ${bold('1.')} Create a free account at ${cyan('https://claude.ai/signup')}`);
|
|
179
|
+
console.log(` ${bold('2.')} Install Claude Code: ${cyan('npm install -g @anthropic-ai/claude-code')}`);
|
|
180
|
+
console.log(` ${bold('3.')} Authenticate: ${cyan('claude login')}`);
|
|
181
|
+
console.log(` ${bold('4.')} Re-run: ${cyan('npm run agent')}\n`);
|
|
182
|
+
const { execSync: _open } = require('child_process');
|
|
183
|
+
try { _open('open https://claude.ai/signup', { stdio: 'pipe' }); } catch {}
|
|
184
|
+
process.exit(0);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const installed = installClaudeCode();
|
|
188
|
+
if (!installed) process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Auth check
|
|
192
|
+
let claudeAuthed = false;
|
|
193
|
+
try { execSync('claude --version', { stdio: 'pipe' }); claudeAuthed = true; } catch {}
|
|
194
|
+
|
|
195
|
+
if (!claudeAuthed) {
|
|
196
|
+
console.log(`\n${red(' ✖ Claude Code not authenticated.')}\n`);
|
|
197
|
+
const authIdx = await prompts({
|
|
198
|
+
type: 'select',
|
|
199
|
+
name: 'value',
|
|
200
|
+
message: 'How would you like to proceed?',
|
|
201
|
+
choices: [
|
|
202
|
+
{ title: `${green('→')} Run claude login now`, value: 0 },
|
|
203
|
+
{ title: `${dim('←')} Exit`, value: 1 },
|
|
204
|
+
],
|
|
205
|
+
}, { onCancel: () => process.exit(0) });
|
|
206
|
+
|
|
207
|
+
if (authIdx.value === 1 || authIdx.value === undefined) process.exit(0);
|
|
208
|
+
const loggedIn = runClaudeLogin();
|
|
209
|
+
if (!loggedIn) {
|
|
210
|
+
console.log(`\n ${red('✖')} Login failed - re-run ${cyan('npm run agent')} after authenticating\n`);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})();
|
|
215
|
+
|
|
126
216
|
// ── Open IDE ──────────────────────────────────────────────────────────────────
|
|
127
217
|
|
|
128
218
|
const openIDE = (worktreePath) => {
|
|
@@ -1185,8 +1275,7 @@ const main = async () => {
|
|
|
1185
1275
|
const ctxRes = await prompts({
|
|
1186
1276
|
type: 'text',
|
|
1187
1277
|
name: 'value',
|
|
1188
|
-
message: '* What are you building?',
|
|
1189
|
-
hint: '(e.g. A stock market prediction app with AI insights)',
|
|
1278
|
+
message: '* What are you building? (e.g. A stock market prediction app with AI insights)',
|
|
1190
1279
|
}, { onCancel: () => process.exit(0) });
|
|
1191
1280
|
const rawCtx = (ctxRes.value || '').trim();
|
|
1192
1281
|
projectContext = rawCtx;
|
|
@@ -1207,9 +1296,8 @@ const main = async () => {
|
|
|
1207
1296
|
const res = await prompts({
|
|
1208
1297
|
type: 'text',
|
|
1209
1298
|
name: 'value',
|
|
1210
|
-
message: `* Task description (${agent} agent)`,
|
|
1299
|
+
message: `* Task description (${agent} agent) — ${defaultTask ? 'Enter to use default, or type your own' : 'describe what this agent should build or fix'}`,
|
|
1211
1300
|
initial: defaultTask || '',
|
|
1212
|
-
hint: defaultTask ? '(Enter to use default, or type your own)' : '(describe what this agent should build or fix)',
|
|
1213
1301
|
}, { onCancel: () => process.exit(0) });
|
|
1214
1302
|
|
|
1215
1303
|
if (res.value === undefined) continue flowLoop; // Esc = back
|
package/package.json
CHANGED