multi-agents-cli 1.0.60 → 1.0.62
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 +98 -65
- package/package.json +1 -1
package/core/workflow/agent.js
CHANGED
|
@@ -170,12 +170,13 @@ const openIDE = (worktreePath) => {
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
|
|
174
|
+
// ── Open new OS terminal with Claude Code CLI ───────────────────────────────
|
|
174
175
|
|
|
175
176
|
const openTerminal = (worktreePath) => {
|
|
176
177
|
try {
|
|
177
178
|
if (process.platform === 'darwin') {
|
|
178
|
-
execSync(`osascript -e 'tell app "Terminal" to do script "cd
|
|
179
|
+
execSync(`osascript -e 'tell app "Terminal" to do script "cd \"${worktreePath}\" && claude"'`, { stdio: 'pipe' });
|
|
179
180
|
} else if (process.platform === 'win32') {
|
|
180
181
|
execSync(`start cmd /k "cd /d "${worktreePath}" && claude"`, { stdio: 'pipe' });
|
|
181
182
|
} else {
|
|
@@ -185,8 +186,7 @@ const openTerminal = (worktreePath) => {
|
|
|
185
186
|
} catch { return false; }
|
|
186
187
|
};
|
|
187
188
|
|
|
188
|
-
|
|
189
|
-
// ── Workspace tree display ────────────────────────────────────────────────────
|
|
189
|
+
// ── Workspace tree display ──────────────────────────────────────────────────
|
|
190
190
|
|
|
191
191
|
const displayWorkspaceTree = (worktreeName, worktreePath, project, agent, framework) => {
|
|
192
192
|
const fwFile = framework ? framework.toLowerCase().replace(/[^a-z0-9]/g, '-') + '.md' : null;
|
|
@@ -1228,15 +1228,6 @@ Mark each step complete. Only proceed to the task below when all are checked.
|
|
|
1228
1228
|
);
|
|
1229
1229
|
console.log(` ${green('✓')} .claude-scope written`);
|
|
1230
1230
|
|
|
1231
|
-
// ── Write scope.json ─────────────────────────────────────────────────────────
|
|
1232
|
-
|
|
1233
|
-
fs.writeFileSync(
|
|
1234
|
-
path.join(worktreePath, 'scope.json'),
|
|
1235
|
-
JSON.stringify({ agent, scope: project, branch: branchName, policy: project }, null, 2),
|
|
1236
|
-
'utf8'
|
|
1237
|
-
);
|
|
1238
|
-
console.log(` ${green('✓')} scope.json written`);
|
|
1239
|
-
|
|
1240
1231
|
// ── Generate IDE settings ─────────────────────────────────────────────────────
|
|
1241
1232
|
|
|
1242
1233
|
const excludedFolders = {
|
|
@@ -1389,16 +1380,17 @@ ${excludedUrls}
|
|
|
1389
1380
|
}
|
|
1390
1381
|
}
|
|
1391
1382
|
|
|
1392
|
-
// ── Session start selection
|
|
1383
|
+
// ── Session start selection ─────────────────────────────────────────────────
|
|
1393
1384
|
|
|
1394
1385
|
separator();
|
|
1395
1386
|
console.log(`\n${bold(' Workspace is set up and ready.')}\n`);
|
|
1396
1387
|
|
|
1388
|
+
sessionLoop: while (true) {
|
|
1397
1389
|
const sessionIdx = await arrowSelect('How would you like to start the session?', [
|
|
1398
1390
|
{ label: `${green('→')} IDE + new terminal ${dim('(Claude Code CLI)')} ${dim('← recommended')}` },
|
|
1399
1391
|
{ label: `${green('→')} IDE only` },
|
|
1400
1392
|
{ label: `${green('→')} Claude Code CLI only ${dim('(new terminal)')}` },
|
|
1401
|
-
{ label: `${dim('?')} I
|
|
1393
|
+
{ label: `${dim('?')} I'll continue from here, where do I start?` },
|
|
1402
1394
|
], rl);
|
|
1403
1395
|
|
|
1404
1396
|
if (sessionIdx === 0) {
|
|
@@ -1410,6 +1402,7 @@ ${excludedUrls}
|
|
|
1410
1402
|
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1411
1403
|
separator();
|
|
1412
1404
|
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1405
|
+
break sessionLoop;
|
|
1413
1406
|
|
|
1414
1407
|
} else if (sessionIdx === 1) {
|
|
1415
1408
|
const openedIDE = openIDE(worktreePath);
|
|
@@ -1418,6 +1411,7 @@ ${excludedUrls}
|
|
|
1418
1411
|
separator();
|
|
1419
1412
|
console.log(`\n ${dim('Open a NEW Claude Code session and type')} ${cyan('go')} ${dim('to start.')}\n`);
|
|
1420
1413
|
console.log(` ${dim('When done, run:')} ${cyan('npm run complete')}\n`);
|
|
1414
|
+
break sessionLoop;
|
|
1421
1415
|
|
|
1422
1416
|
} else if (sessionIdx === 2) {
|
|
1423
1417
|
const termOpened = openTerminal(worktreePath);
|
|
@@ -1425,6 +1419,7 @@ ${excludedUrls}
|
|
|
1425
1419
|
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1426
1420
|
separator();
|
|
1427
1421
|
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1422
|
+
break sessionLoop;
|
|
1428
1423
|
|
|
1429
1424
|
} else {
|
|
1430
1425
|
separator();
|
|
@@ -1432,8 +1427,11 @@ ${excludedUrls}
|
|
|
1432
1427
|
{ label: 'View instructions' },
|
|
1433
1428
|
{ label: 'View folder structure' },
|
|
1434
1429
|
{ label: 'View available agents' },
|
|
1430
|
+
{ label: `${dim('←')} Back to session options` },
|
|
1435
1431
|
], rl);
|
|
1436
1432
|
|
|
1433
|
+
if (subIdx === 3) { continue sessionLoop; }
|
|
1434
|
+
|
|
1437
1435
|
if (subIdx === 0) {
|
|
1438
1436
|
separator();
|
|
1439
1437
|
console.log(`\n ${bold('How to start your agent session:')}\n`);
|
|
@@ -1443,12 +1441,20 @@ ${excludedUrls}
|
|
|
1443
1441
|
console.log(dim(' Do NOT reuse a previous session.\n'));
|
|
1444
1442
|
console.log(` ${bold('3.')} Let the agent run autonomously\n`);
|
|
1445
1443
|
console.log(` ${bold('4.')} When done, run: ${cyan('npm run complete')} to merge into main\n`);
|
|
1444
|
+
separator();
|
|
1445
|
+
console.log('');
|
|
1446
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1447
|
+
continue sessionLoop;
|
|
1446
1448
|
|
|
1447
1449
|
} else if (subIdx === 1) {
|
|
1448
1450
|
const framework = config.client?.framework || config.backend?.framework || '';
|
|
1449
1451
|
displayWorkspaceTree(worktreeName, worktreePath, project, agent, framework);
|
|
1452
|
+
separator();
|
|
1453
|
+
console.log('');
|
|
1454
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1455
|
+
continue sessionLoop;
|
|
1450
1456
|
|
|
1451
|
-
} else {
|
|
1457
|
+
} else if (subIdx === 2) {
|
|
1452
1458
|
const allAgents = AGENTS[project] || [];
|
|
1453
1459
|
const completed = buildEntries.filter(e => e.scope === project && e.status === 'COMPLETED').map(e => e.agent);
|
|
1454
1460
|
separator();
|
|
@@ -1461,72 +1467,99 @@ ${excludedUrls}
|
|
|
1461
1467
|
console.log(` ${icon} ${label}`);
|
|
1462
1468
|
});
|
|
1463
1469
|
console.log('');
|
|
1470
|
+
separator();
|
|
1471
|
+
console.log('');
|
|
1472
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1473
|
+
continue sessionLoop;
|
|
1464
1474
|
}
|
|
1465
1475
|
}
|
|
1476
|
+
} // end sessionLoop
|
|
1477
|
+
// ── Session start selection ─────────────────────────────────────────────────
|
|
1466
1478
|
|
|
1467
1479
|
separator();
|
|
1468
|
-
console.log('');
|
|
1469
|
-
rl.close();
|
|
1470
|
-
// ── Ready to open workspace? ──────────────────────────────────────────────────
|
|
1471
|
-
|
|
1472
|
-
separator();
|
|
1473
|
-
console.log(`\n${bold(' Workspace is set up and ready.')}`);
|
|
1474
|
-
console.log(dim(` Worktree: worktrees/${worktreeName}\n`));
|
|
1475
|
-
console.log(` ${yellow('⚠')} ${bold('Once your IDE opens and is ready, open a NEW session in Claude Code CLI or Claude Code Extension - and type go or start to initiate')}`);
|
|
1476
|
-
console.log(dim(' Do NOT reuse a previous session - the agent needs a clean context.'));
|
|
1480
|
+
console.log(`\n${bold(' Workspace is set up and ready.')}\n`);
|
|
1477
1481
|
|
|
1478
|
-
const
|
|
1482
|
+
const sessionIdx = await arrowSelect('How would you like to start the session?', [
|
|
1483
|
+
{ label: `${green('→')} IDE + new terminal ${dim('(Claude Code CLI)')} ${dim('← recommended')}` },
|
|
1484
|
+
{ label: `${green('→')} IDE only` },
|
|
1485
|
+
{ label: `${green('→')} Claude Code CLI only ${dim('(new terminal)')}` },
|
|
1486
|
+
{ label: `${dim('?')} I'll continue from here, where do I start?` },
|
|
1487
|
+
], rl);
|
|
1479
1488
|
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1489
|
+
if (sessionIdx === 0) {
|
|
1490
|
+
const openedIDE = openIDE(worktreePath);
|
|
1491
|
+
if (openedIDE) console.log(` ${green('✓')} ${openedIDE} opened`);
|
|
1492
|
+
else console.log(` ${yellow('!')} Could not open IDE - open manually at: ${dim(worktreePath)}`);
|
|
1493
|
+
const termOpened = openTerminal(worktreePath);
|
|
1494
|
+
if (termOpened) console.log(` ${green('✓')} New terminal opened with Claude Code CLI`);
|
|
1495
|
+
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1482
1496
|
separator();
|
|
1483
|
-
console.log(`\n${
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
console.log(
|
|
1488
|
-
console.log(` ${
|
|
1497
|
+
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1498
|
+
|
|
1499
|
+
} else if (sessionIdx === 1) {
|
|
1500
|
+
const openedIDE = openIDE(worktreePath);
|
|
1501
|
+
if (openedIDE) console.log(` ${green('✓')} ${openedIDE} opened`);
|
|
1502
|
+
else console.log(` ${yellow('!')} Could not open IDE - open manually at: ${dim(worktreePath)}`);
|
|
1489
1503
|
separator();
|
|
1490
|
-
console.log('');
|
|
1491
|
-
|
|
1492
|
-
return;
|
|
1493
|
-
}
|
|
1504
|
+
console.log(`\n ${dim('Open a NEW Claude Code session and type')} ${cyan('go')} ${dim('to start.')}\n`);
|
|
1505
|
+
console.log(` ${dim('When done, run:')} ${cyan('npm run complete')}\n`);
|
|
1494
1506
|
|
|
1495
|
-
|
|
1507
|
+
} else if (sessionIdx === 2) {
|
|
1508
|
+
const termOpened = openTerminal(worktreePath);
|
|
1509
|
+
if (termOpened) console.log(` ${green('✓')} New terminal opened with Claude Code CLI`);
|
|
1510
|
+
else console.log(` ${yellow('!')} Could not open terminal - run ${cyan('claude')} manually in: ${dim(worktreePath)}`);
|
|
1511
|
+
separator();
|
|
1512
|
+
console.log(`\n ${dim('When the agent is done, run:')} ${cyan('npm run complete')}\n`);
|
|
1496
1513
|
|
|
1497
|
-
const openedIDE = openIDE(worktreePath);
|
|
1498
|
-
if (openedIDE) {
|
|
1499
|
-
console.log(` ${green('✓')} ${openedIDE} opened at worktrees/${worktreeName}`);
|
|
1500
1514
|
} else {
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1515
|
+
separator();
|
|
1516
|
+
const subIdx = await arrowSelect('What would you like to view?', [
|
|
1517
|
+
{ label: 'View instructions' },
|
|
1518
|
+
{ label: 'View folder structure' },
|
|
1519
|
+
{ label: 'View available agents' },
|
|
1520
|
+
], rl);
|
|
1506
1521
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1522
|
+
if (subIdx === 0) {
|
|
1523
|
+
separator();
|
|
1524
|
+
console.log(`\n ${bold('How to start your agent session:')}\n`);
|
|
1525
|
+
console.log(` ${bold('1.')} Open your IDE at:`);
|
|
1526
|
+
console.log(` ${cyan(worktreePath)}\n`);
|
|
1527
|
+
console.log(` ${bold('2.')} Open a NEW Claude Code session and type ${cyan('go')} to start`);
|
|
1528
|
+
console.log(dim(' Do NOT reuse a previous session.\n'));
|
|
1529
|
+
console.log(` ${bold('3.')} Let the agent run autonomously\n`);
|
|
1530
|
+
console.log(` ${bold('4.')} When done, run: ${cyan('npm run complete')} to merge into main\n`);
|
|
1531
|
+
separator();
|
|
1532
|
+
console.log('');
|
|
1533
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1514
1534
|
|
|
1515
|
-
|
|
1535
|
+
} else if (subIdx === 1) {
|
|
1536
|
+
const framework = config.client?.framework || config.backend?.framework || '';
|
|
1537
|
+
displayWorkspaceTree(worktreeName, worktreePath, project, agent, framework);
|
|
1538
|
+
separator();
|
|
1539
|
+
console.log('');
|
|
1540
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1516
1541
|
|
|
1517
|
-
|
|
1542
|
+
} else {
|
|
1543
|
+
const allAgents = AGENTS[project] || [];
|
|
1544
|
+
const completed = buildEntries.filter(e => e.scope === project && e.status === 'COMPLETED').map(e => e.agent);
|
|
1545
|
+
separator();
|
|
1546
|
+
console.log(`\n ${bold('Available agents for ' + project + ':')}\n`);
|
|
1547
|
+
allAgents.forEach(a => {
|
|
1548
|
+
const done = completed.includes(a);
|
|
1549
|
+
const current = a === agent;
|
|
1550
|
+
const icon = current ? cyan('→') : done ? green('✓') : dim('·');
|
|
1551
|
+
const label = current ? bold(cyan(a)) : done ? dim(a + ' (completed)') : a;
|
|
1552
|
+
console.log(` ${icon} ${label}`);
|
|
1553
|
+
});
|
|
1554
|
+
console.log('');
|
|
1555
|
+
separator();
|
|
1556
|
+
console.log('');
|
|
1557
|
+
await arrowSelect('Press enter to continue', [{ label: 'OK, got it' }], rl);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1518
1560
|
|
|
1519
|
-
separator();
|
|
1520
|
-
console.log(`\n${bold(green(' Workspace ready!'))}\n`);
|
|
1521
|
-
console.log(` ${bold('1.')} Your IDE should be open at: ${cyan(`worktrees/${worktreeName}`)}`);
|
|
1522
|
-
console.log(dim(' If not, open it manually at the path above.\n'));
|
|
1523
|
-
console.log(` ${bold('2.')} ${bold(yellow('Open a NEW session in Claude Code CLI or Claude Code Extension - and type go or start to initiate'))}`);
|
|
1524
|
-
console.log(dim(' Do NOT reuse a previous session.\n'));
|
|
1525
|
-
console.log(` ${bold('3.')} Start the session and let the agent run.\n`);
|
|
1526
|
-
console.log(` ${bold('4.')} When the agent is done, run: ${cyan('npm run complete')} to merge the task into main.\n`);
|
|
1527
1561
|
separator();
|
|
1528
1562
|
console.log('');
|
|
1529
|
-
|
|
1530
1563
|
rl.close();
|
|
1531
1564
|
};
|
|
1532
1565
|
|
package/package.json
CHANGED