multi-agents-cli 1.1.62 → 1.1.64
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 +21 -1
- package/core/workflow/complete.js +9 -1
- package/core/workflow/guards.js +35 -0
- package/core/workflow/reset.js +9 -1
- package/core/workflow/sync.js +9 -1
- package/init.js +8 -0
- package/package.json +1 -1
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
|
|
|
@@ -1405,6 +1413,18 @@ Mark each step complete. Only proceed to the task below when all are checked.
|
|
|
1405
1413
|
backendLaunchTiming: 'now',
|
|
1406
1414
|
}, ROOT);
|
|
1407
1415
|
|
|
1416
|
+
// Relationship
|
|
1417
|
+
guards.updateRelationship(ROOT, {
|
|
1418
|
+
author: worktreeName,
|
|
1419
|
+
parent: `${project}/${agent}`,
|
|
1420
|
+
child: 'backend/INIT',
|
|
1421
|
+
type: 'spawn',
|
|
1422
|
+
at: timestamp,
|
|
1423
|
+
parentBranch: branchName,
|
|
1424
|
+
childBranch: beBranchName,
|
|
1425
|
+
status: 'active',
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1408
1428
|
// TASKS_HISTORY
|
|
1409
1429
|
tasksHistory.ensureHistoryFile(ROOT);
|
|
1410
1430
|
tasksHistory.writeSessionEntry(ROOT, { scope: 'backend', agent: 'INIT', branch: beBranchName, task: beTask, launchedAt: new Date().toISOString() });
|
|
@@ -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/guards.js
CHANGED
|
@@ -107,6 +107,39 @@ const loadTracking = (ROOT, config) => {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
+
|
|
111
|
+
// ── Load relationships ────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
const loadRelationships = (ROOT) => {
|
|
114
|
+
const depPath = path.join(ROOT, '.scaffold', 'dependencies.json');
|
|
115
|
+
if (!fs.existsSync(depPath)) return { relationships: [] };
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(fs.readFileSync(depPath, 'utf8'));
|
|
118
|
+
} catch {
|
|
119
|
+
console.log(yellow(' ⚠ dependencies.json is corrupt - resetting.'));
|
|
120
|
+
const fresh = { relationships: [] };
|
|
121
|
+
fs.writeFileSync(depPath, JSON.stringify(fresh, null, 2), 'utf8');
|
|
122
|
+
return fresh;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// ── Update relationship entry ─────────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
const updateRelationship = (ROOT, entry) => {
|
|
129
|
+
const depPath = path.join(ROOT, '.scaffold', 'dependencies.json');
|
|
130
|
+
const deps = loadRelationships(ROOT);
|
|
131
|
+
const idx = deps.relationships.findIndex(
|
|
132
|
+
r => r.author === entry.author && r.type === entry.type && r.child === entry.child
|
|
133
|
+
);
|
|
134
|
+
if (idx !== -1) {
|
|
135
|
+
deps.relationships[idx] = { ...deps.relationships[idx], ...entry };
|
|
136
|
+
} else {
|
|
137
|
+
deps.relationships.push(entry);
|
|
138
|
+
}
|
|
139
|
+
fs.writeFileSync(depPath, JSON.stringify(deps, null, 2), 'utf8');
|
|
140
|
+
return deps;
|
|
141
|
+
};
|
|
142
|
+
|
|
110
143
|
// ── Write tracking slot ───────────────────────────────────────────────────────
|
|
111
144
|
|
|
112
145
|
const updateTrackingSlot = (tracking, scope, agent, data, ROOT) => {
|
|
@@ -673,6 +706,8 @@ module.exports = {
|
|
|
673
706
|
generateTrackingStructure,
|
|
674
707
|
loadTracking,
|
|
675
708
|
updateTrackingSlot,
|
|
709
|
+
loadRelationships,
|
|
710
|
+
updateRelationship,
|
|
676
711
|
clearTrackingSlot,
|
|
677
712
|
validateConfig,
|
|
678
713
|
checkAgentActive,
|
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/init.js
CHANGED
|
@@ -600,6 +600,14 @@ const main = async () => {
|
|
|
600
600
|
fs.writeFileSync(path.join(RUNTIME_DIR, '.config.json'), JSON.stringify(config, null, 2), 'utf8');
|
|
601
601
|
console.log(` ${green('✓')} .scaffold/.config.json written`);
|
|
602
602
|
|
|
603
|
+
// ── dependencies.json ─────────────────────────────────────────────────────────
|
|
604
|
+
|
|
605
|
+
const depsPath = path.join(RUNTIME_DIR, 'dependencies.json');
|
|
606
|
+
if (!fs.existsSync(depsPath)) {
|
|
607
|
+
fs.writeFileSync(depsPath, JSON.stringify({ relationships: [] }, null, 2), 'utf8');
|
|
608
|
+
console.log(` ${green('✓')} .scaffold/dependencies.json initialized`);
|
|
609
|
+
}
|
|
610
|
+
|
|
603
611
|
// ── scope-policy.json ─────────────────────────────────────────────────────────
|
|
604
612
|
|
|
605
613
|
const scopePolicy = {
|
package/package.json
CHANGED