multi-agents-cli 1.1.60 → 1.1.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.
@@ -1510,6 +1510,62 @@ Mark each step complete. Only proceed to the task below when all are checked.
1510
1510
  console.log(` ${yellow('ℹ Remote setup required')} - agent will handle this first.\n`);
1511
1511
  }
1512
1512
 
1513
+ // ── Defensive check: debris from prior failed launch ─────────────────────────
1514
+
1515
+ const agentBranchPrefix = `agent/${project}/${agent.toLowerCase()}/`;
1516
+ let existingBranches = [];
1517
+ try {
1518
+ const branchOut = execSync(`git branch --list "${agentBranchPrefix}*"`, { cwd: ROOT, stdio: 'pipe' }).toString().trim();
1519
+ existingBranches = branchOut ? branchOut.split('\n').map(b => b.trim()).filter(Boolean) : [];
1520
+ } catch {}
1521
+
1522
+ const worktreeExists = fs.existsSync(worktreePath);
1523
+
1524
+ if (existingBranches.length > 0 || worktreeExists) {
1525
+ console.log(`\n ${yellow('⚠ Debris detected from a prior launch:')}\n`);
1526
+ if (existingBranches.length > 0) {
1527
+ existingBranches.forEach(b => console.log(` ${dim('branch :')} ${yellow(b)}`));
1528
+ }
1529
+ if (worktreeExists) {
1530
+ console.log(` ${dim('worktree:')} ${yellow(`worktrees/${worktreeName}`)}`);
1531
+ }
1532
+ console.log('');
1533
+
1534
+ const debrisIdx = await arrowSelect('How do you want to proceed?', [
1535
+ { label: `${green('✓')} Clean up debris and continue` },
1536
+ { label: `${yellow('→')} Skip cleanup and continue anyway` },
1537
+ { label: `${red('✗')} Cancel` },
1538
+ ], rl);
1539
+
1540
+ if (debrisIdx === 2) {
1541
+ console.log(yellow('\n Cancelled.\n'));
1542
+ rl.close();
1543
+ return;
1544
+ }
1545
+
1546
+ if (debrisIdx === 0) {
1547
+ // Remove worktree if it exists
1548
+ if (worktreeExists) {
1549
+ try {
1550
+ execSync(`git worktree remove "${worktreePath}" --force`, { cwd: ROOT, stdio: 'pipe' });
1551
+ console.log(` ${green('✓')} Worktree removed`);
1552
+ } catch (e) {
1553
+ console.log(` ${yellow('!')} Could not remove worktree - continuing`);
1554
+ }
1555
+ }
1556
+ // Delete each stale branch
1557
+ for (const staleBranch of existingBranches) {
1558
+ try {
1559
+ execSync(`git branch -D "${staleBranch}"`, { cwd: ROOT, stdio: 'pipe' });
1560
+ console.log(` ${green('✓')} Branch deleted: ${staleBranch}`);
1561
+ } catch (e) {
1562
+ console.log(` ${yellow('!')} Could not delete branch ${staleBranch} - continuing`);
1563
+ }
1564
+ }
1565
+ console.log('');
1566
+ }
1567
+ }
1568
+
1513
1569
  // ── Create worktree ───────────────────────────────────────────────────────────
1514
1570
 
1515
1571
  try {
@@ -572,7 +572,7 @@ const main = async () => {
572
572
  const _tracking = guards.loadTracking(ROOT, config);
573
573
  const beSlot = _tracking?.backend?.INIT;
574
574
  if (
575
- _scope === 'logic' &&
575
+ _agent === 'LOGIC' &&
576
576
  _parts[0] === 'agent' && _parts[1] === 'client' &&
577
577
  beSlot?.backendLaunchTiming === 'after' &&
578
578
  beSlot?.status !== 'ACTIVE' &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-agents-cli",
3
- "version": "1.1.60",
3
+ "version": "1.1.62",
4
4
  "description": "Multi-agent workflow orchestration for Claude Code — isolated git worktrees, structured state tracking, autonomous task chaining",
5
5
  "keywords": [
6
6
  "claude-code",