multi-agents-cli 1.1.61 → 1.1.63
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
CHANGED
|
@@ -82,7 +82,15 @@ const red = (s) => `${c.red}${s}${c.reset}`;
|
|
|
82
82
|
|
|
83
83
|
// ── Paths ─────────────────────────────────────────────────────────────────────
|
|
84
84
|
|
|
85
|
-
const ROOT =
|
|
85
|
+
const ROOT = (() => {
|
|
86
|
+
try {
|
|
87
|
+
const common = execSync('git rev-parse --git-common-dir', { stdio: 'pipe' }).toString().trim();
|
|
88
|
+
return common.endsWith('/.git') ? common.slice(0, -5) : require('path').resolve(common, '..');
|
|
89
|
+
} catch {
|
|
90
|
+
console.error(' Not inside a git repository.\n');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
})();
|
|
86
94
|
const CONFIG_PATH = path.join(ROOT, '.scaffold', '.config.json');
|
|
87
95
|
const LOCK_PATH = path.join(ROOT, '.scaffold', '.initialized');
|
|
88
96
|
|
|
@@ -1510,6 +1518,62 @@ Mark each step complete. Only proceed to the task below when all are checked.
|
|
|
1510
1518
|
console.log(` ${yellow('ℹ Remote setup required')} - agent will handle this first.\n`);
|
|
1511
1519
|
}
|
|
1512
1520
|
|
|
1521
|
+
// ── Defensive check: debris from prior failed launch ─────────────────────────
|
|
1522
|
+
|
|
1523
|
+
const agentBranchPrefix = `agent/${project}/${agent.toLowerCase()}/`;
|
|
1524
|
+
let existingBranches = [];
|
|
1525
|
+
try {
|
|
1526
|
+
const branchOut = execSync(`git branch --list "${agentBranchPrefix}*"`, { cwd: ROOT, stdio: 'pipe' }).toString().trim();
|
|
1527
|
+
existingBranches = branchOut ? branchOut.split('\n').map(b => b.trim()).filter(Boolean) : [];
|
|
1528
|
+
} catch {}
|
|
1529
|
+
|
|
1530
|
+
const worktreeExists = fs.existsSync(worktreePath);
|
|
1531
|
+
|
|
1532
|
+
if (existingBranches.length > 0 || worktreeExists) {
|
|
1533
|
+
console.log(`\n ${yellow('⚠ Debris detected from a prior launch:')}\n`);
|
|
1534
|
+
if (existingBranches.length > 0) {
|
|
1535
|
+
existingBranches.forEach(b => console.log(` ${dim('branch :')} ${yellow(b)}`));
|
|
1536
|
+
}
|
|
1537
|
+
if (worktreeExists) {
|
|
1538
|
+
console.log(` ${dim('worktree:')} ${yellow(`worktrees/${worktreeName}`)}`);
|
|
1539
|
+
}
|
|
1540
|
+
console.log('');
|
|
1541
|
+
|
|
1542
|
+
const debrisIdx = await arrowSelect('How do you want to proceed?', [
|
|
1543
|
+
{ label: `${green('✓')} Clean up debris and continue` },
|
|
1544
|
+
{ label: `${yellow('→')} Skip cleanup and continue anyway` },
|
|
1545
|
+
{ label: `${red('✗')} Cancel` },
|
|
1546
|
+
], rl);
|
|
1547
|
+
|
|
1548
|
+
if (debrisIdx === 2) {
|
|
1549
|
+
console.log(yellow('\n Cancelled.\n'));
|
|
1550
|
+
rl.close();
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
if (debrisIdx === 0) {
|
|
1555
|
+
// Remove worktree if it exists
|
|
1556
|
+
if (worktreeExists) {
|
|
1557
|
+
try {
|
|
1558
|
+
execSync(`git worktree remove "${worktreePath}" --force`, { cwd: ROOT, stdio: 'pipe' });
|
|
1559
|
+
console.log(` ${green('✓')} Worktree removed`);
|
|
1560
|
+
} catch (e) {
|
|
1561
|
+
console.log(` ${yellow('!')} Could not remove worktree - continuing`);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
// Delete each stale branch
|
|
1565
|
+
for (const staleBranch of existingBranches) {
|
|
1566
|
+
try {
|
|
1567
|
+
execSync(`git branch -D "${staleBranch}"`, { cwd: ROOT, stdio: 'pipe' });
|
|
1568
|
+
console.log(` ${green('✓')} Branch deleted: ${staleBranch}`);
|
|
1569
|
+
} catch (e) {
|
|
1570
|
+
console.log(` ${yellow('!')} Could not delete branch ${staleBranch} - continuing`);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
console.log('');
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1513
1577
|
// ── Create worktree ───────────────────────────────────────────────────────────
|
|
1514
1578
|
|
|
1515
1579
|
try {
|
|
@@ -37,7 +37,15 @@ const red = (s) => `${c.red}${s}${c.reset}`;
|
|
|
37
37
|
|
|
38
38
|
// ── Paths ─────────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
const ROOT =
|
|
40
|
+
const ROOT = (() => {
|
|
41
|
+
try {
|
|
42
|
+
const common = execSync('git rev-parse --git-common-dir', { stdio: 'pipe' }).toString().trim();
|
|
43
|
+
return common.endsWith('/.git') ? common.slice(0, -5) : require('path').resolve(common, '..');
|
|
44
|
+
} catch {
|
|
45
|
+
console.error(' Not inside a git repository.\n');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
41
49
|
const CONFIG_PATH = path.join(ROOT, '.scaffold', '.config.json');
|
|
42
50
|
const LOCK_PATH = path.join(ROOT, '.scaffold', '.initialized');
|
|
43
51
|
|
package/core/workflow/reset.js
CHANGED
|
@@ -24,7 +24,15 @@ try { prompts = require('prompts'); } catch { prompts = null; }
|
|
|
24
24
|
|
|
25
25
|
// ── Self-relocate to repo root ────────────────────────────────────────────────
|
|
26
26
|
|
|
27
|
-
const ROOT =
|
|
27
|
+
const ROOT = (() => {
|
|
28
|
+
try {
|
|
29
|
+
const common = execSync('git rev-parse --git-common-dir', { stdio: 'pipe' }).toString().trim();
|
|
30
|
+
return common.endsWith('/.git') ? common.slice(0, -5) : require('path').resolve(common, '..');
|
|
31
|
+
} catch {
|
|
32
|
+
console.error(' Not inside a git repository.\n');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
28
36
|
|
|
29
37
|
// ── Colors ────────────────────────────────────────────────────────────────────
|
|
30
38
|
|
package/core/workflow/sync.js
CHANGED
|
@@ -17,7 +17,15 @@ const fs = require('fs');
|
|
|
17
17
|
const path = require('path');
|
|
18
18
|
const { execSync } = require('child_process');
|
|
19
19
|
|
|
20
|
-
const ROOT =
|
|
20
|
+
const ROOT = (() => {
|
|
21
|
+
try {
|
|
22
|
+
const common = execSync('git rev-parse --git-common-dir', { stdio: 'pipe' }).toString().trim();
|
|
23
|
+
return common.endsWith('/.git') ? common.slice(0, -5) : require('path').resolve(common, '..');
|
|
24
|
+
} catch {
|
|
25
|
+
console.error(' Not inside a git repository.\n');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
21
29
|
const TRACKING = path.join(ROOT, '.scaffold', '.tracking.json');
|
|
22
30
|
const BUILD = path.join(ROOT, 'BUILD_STATE.md');
|
|
23
31
|
|
package/package.json
CHANGED