multi-agents-cli 1.0.57 → 1.0.58
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 +123 -0
- package/package.json +1 -1
package/core/workflow/agent.js
CHANGED
|
@@ -169,6 +169,51 @@ const openIDE = (worktreePath) => {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
+
|
|
173
|
+
// ── Open new OS terminal with Claude Code CLI ─────────────────────────────────
|
|
174
|
+
|
|
175
|
+
const openTerminal = (worktreePath) => {
|
|
176
|
+
try {
|
|
177
|
+
if (process.platform === 'darwin') {
|
|
178
|
+
execSync(`osascript -e 'tell app "Terminal" to do script "cd \\"${worktreePath}\\" && claude"'`, { stdio: 'pipe' });
|
|
179
|
+
} else if (process.platform === 'win32') {
|
|
180
|
+
execSync(`start cmd /k "cd /d "${worktreePath}" && claude"`, { stdio: 'pipe' });
|
|
181
|
+
} else {
|
|
182
|
+
execSync(`gnome-terminal -- bash -c "cd '${worktreePath}' && claude; exec bash" &`, { stdio: 'pipe' });
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
} catch { return false; }
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
// ── Workspace tree display ────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
const displayWorkspaceTree = (worktreeName, worktreePath, project, agent, framework) => {
|
|
192
|
+
const fwFile = framework ? framework.toLowerCase().replace(/[^a-z0-9]/g, '-') + '.md' : null;
|
|
193
|
+
console.log(`\n ${bold('Your workspace is ready:')}\n`);
|
|
194
|
+
console.log(` worktrees/`);
|
|
195
|
+
console.log(` ${dim('└──')} ${cyan(worktreeName + '/')} ${dim('<- scope (' + project + ') - agent (' + agent + ') - timestamp')}`);
|
|
196
|
+
console.log(` ${dim(' |-- TASK.md')} ${dim('<- read this first, contains your task')}`);
|
|
197
|
+
console.log(` ${dim(' |-- .claude-scope')} ${dim('<- scope identity (' + project + ' / ' + agent + ')')}`);
|
|
198
|
+
console.log(` ${dim(' |-- scope.json')} ${dim('<- enforcement policy reference')}`);
|
|
199
|
+
console.log(` ${dim(' |-- package.json')} ${dim('<- run npm run complete when done')}`);
|
|
200
|
+
console.log(` ${dim(' |-- ' + project + '/')} ${dim('<- your work goes here')}`);
|
|
201
|
+
console.log(` ${dim(' | |-- CLAUDE.md')} ${dim('<- ' + project + '-specific rules and stack config')}`);
|
|
202
|
+
console.log(` ${dim(' |-- .agents/')}`);
|
|
203
|
+
console.log(` ${dim(' | |-- ' + project + '/')}`);
|
|
204
|
+
console.log(` ${dim(' | |-- ' + agent + '.md')} ${dim('<- agent instructions, loaded by Claude Code')}`);
|
|
205
|
+
if (fwFile) {
|
|
206
|
+
console.log(` ${dim(' |-- .frameworks/')}`);
|
|
207
|
+
console.log(` ${dim(' | |-- ' + project + '/')}`);
|
|
208
|
+
console.log(` ${dim(' | |-- ' + fwFile)} ${dim('<- framework scaffold conventions')}`);
|
|
209
|
+
}
|
|
210
|
+
console.log(` ${dim(' |-- .workflow/')} ${dim('<- workflow scripts (do not edit)')}`);
|
|
211
|
+
console.log(` ${dim(' |-- agent.js')}`);
|
|
212
|
+
console.log(` ${dim(' |-- complete.js')}`);
|
|
213
|
+
console.log(` ${dim(' |-- guards.js')}`);
|
|
214
|
+
console.log('');
|
|
215
|
+
};
|
|
216
|
+
|
|
172
217
|
// ── Agent map ─────────────────────────────────────────────────────────────────
|
|
173
218
|
|
|
174
219
|
const AGENTS = {
|
|
@@ -1344,6 +1389,84 @@ ${excludedUrls}
|
|
|
1344
1389
|
}
|
|
1345
1390
|
}
|
|
1346
1391
|
|
|
1392
|
+
// ── Session start selection ──────────────────────────────────────────────────
|
|
1393
|
+
|
|
1394
|
+
separator();
|
|
1395
|
+
console.log(`\n${bold(' Workspace is set up and ready.')}\n`);
|
|
1396
|
+
|
|
1397
|
+
const sessionIdx = await arrowSelect('How would you like to start the session?', [
|
|
1398
|
+
{ label: `${green('→')} IDE + new terminal ${dim('(Claude Code CLI)')} ${dim('← recommended')}` },
|
|
1399
|
+
{ label: `${green('→')} IDE only` },
|
|
1400
|
+
{ label: `${green('→')} Claude Code CLI only ${dim('(new terminal)')}` },
|
|
1401
|
+
{ label: `${dim('?')} I\'ll continue from here, where do I start?` },
|
|
1402
|
+
], rl);
|
|
1403
|
+
|
|
1404
|
+
if (sessionIdx === 0) {
|
|
1405
|
+
const openedIDE = openIDE(worktreePath);
|
|
1406
|
+
if (openedIDE) console.log(` ${green('✓')} ${openedIDE} opened`);
|
|
1407
|
+
else console.log(` ${yellow('!')} Could not open IDE - open manually at: ${dim(worktreePath)}`);
|
|
1408
|
+
const termOpened = openTerminal(worktreePath);
|
|
1409
|
+
if (termOpened) console.log(` ${green('✓')} New terminal opened with Claude Code CLI`);
|
|
1410
|
+
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1411
|
+
separator();
|
|
1412
|
+
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1413
|
+
|
|
1414
|
+
} else if (sessionIdx === 1) {
|
|
1415
|
+
const openedIDE = openIDE(worktreePath);
|
|
1416
|
+
if (openedIDE) console.log(` ${green('✓')} ${openedIDE} opened`);
|
|
1417
|
+
else console.log(` ${yellow('!')} Could not open IDE - open manually at: ${dim(worktreePath)}`);
|
|
1418
|
+
separator();
|
|
1419
|
+
console.log(`\n ${dim('Open a NEW Claude Code session and type')} ${cyan('go')} ${dim('to start.')}\n`);
|
|
1420
|
+
console.log(` ${dim('When done, run:')} ${cyan('npm run complete')}\n`);
|
|
1421
|
+
|
|
1422
|
+
} else if (sessionIdx === 2) {
|
|
1423
|
+
const termOpened = openTerminal(worktreePath);
|
|
1424
|
+
if (termOpened) console.log(` ${green('✓')} New terminal opened with Claude Code CLI`);
|
|
1425
|
+
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1426
|
+
separator();
|
|
1427
|
+
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1428
|
+
|
|
1429
|
+
} else {
|
|
1430
|
+
separator();
|
|
1431
|
+
const subIdx = await arrowSelect('What would you like to view?', [
|
|
1432
|
+
{ label: 'View instructions' },
|
|
1433
|
+
{ label: 'View folder structure' },
|
|
1434
|
+
{ label: 'View available agents' },
|
|
1435
|
+
], rl);
|
|
1436
|
+
|
|
1437
|
+
if (subIdx === 0) {
|
|
1438
|
+
separator();
|
|
1439
|
+
console.log(`\n ${bold('How to start your agent session:')}\n`);
|
|
1440
|
+
console.log(` ${bold('1.')} Open your IDE at:`);
|
|
1441
|
+
console.log(` ${cyan(worktreePath)}\n`);
|
|
1442
|
+
console.log(` ${bold('2.')} Open a NEW Claude Code session and type ${cyan('go')} to start`);
|
|
1443
|
+
console.log(dim(' Do NOT reuse a previous session.\n'));
|
|
1444
|
+
console.log(` ${bold('3.')} Let the agent run autonomously\n`);
|
|
1445
|
+
console.log(` ${bold('4.')} When done, run: ${cyan('npm run complete')} to merge into main\n`);
|
|
1446
|
+
|
|
1447
|
+
} else if (subIdx === 1) {
|
|
1448
|
+
const framework = config.client?.framework || config.backend?.framework || '';
|
|
1449
|
+
displayWorkspaceTree(worktreeName, worktreePath, project, agent, framework);
|
|
1450
|
+
|
|
1451
|
+
} else {
|
|
1452
|
+
const allAgents = AGENTS[project] || [];
|
|
1453
|
+
const completed = buildEntries.filter(e => e.scope === project && e.status === 'COMPLETED').map(e => e.agent);
|
|
1454
|
+
separator();
|
|
1455
|
+
console.log(`\n ${bold('Available agents for ' + project + ':')}\n`);
|
|
1456
|
+
allAgents.forEach(a => {
|
|
1457
|
+
const done = completed.includes(a);
|
|
1458
|
+
const current = a === agent;
|
|
1459
|
+
const icon = current ? cyan('→') : done ? green('✓') : dim('·');
|
|
1460
|
+
const label = current ? bold(cyan(a)) : done ? dim(a + ' (completed)') : a;
|
|
1461
|
+
console.log(` ${icon} ${label}`);
|
|
1462
|
+
});
|
|
1463
|
+
console.log('');
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
separator();
|
|
1468
|
+
console.log('');
|
|
1469
|
+
rl.close();
|
|
1347
1470
|
// ── Ready to open workspace? ──────────────────────────────────────────────────
|
|
1348
1471
|
|
|
1349
1472
|
separator();
|
package/package.json
CHANGED