multi-agents-cli 1.0.79 → 1.0.81
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 +2 -2
- package/core/workflow/run.js +103 -0
- package/init.js +5 -1
- package/package.json +1 -1
package/core/workflow/agent.js
CHANGED
|
@@ -1346,7 +1346,7 @@ ${excludedUrls}
|
|
|
1346
1346
|
private: true,
|
|
1347
1347
|
scripts: {
|
|
1348
1348
|
init: 'multi-agents init',
|
|
1349
|
-
agent: `node ${ROOT}/.workflow/
|
|
1349
|
+
agent: `node ${ROOT}/.workflow/run.js`,
|
|
1350
1350
|
restart: `node ${ROOT}/.workflow/restart.js`,
|
|
1351
1351
|
reset: `node ${ROOT}/.workflow/reset.js`,
|
|
1352
1352
|
complete: `node ${ROOT}/.workflow/complete.js`,
|
|
@@ -1412,7 +1412,7 @@ ${excludedUrls}
|
|
|
1412
1412
|
{ label: `${green('→')} IDE + new terminal ${dim('(Claude Code CLI)')} ${dim('← recommended')}` },
|
|
1413
1413
|
{ label: `${green('→')} IDE only` },
|
|
1414
1414
|
{ label: `${green('→')} Claude Code CLI only ${dim('(new terminal)')}` },
|
|
1415
|
-
{ label: `${dim('?')}
|
|
1415
|
+
{ label: `${dim('?')} Still need help?` },
|
|
1416
1416
|
], rl);
|
|
1417
1417
|
|
|
1418
1418
|
if (sessionIdx === 0) {
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Workflow bootstrap — checks CLI version and auto-updates .workflow/ if behind,
|
|
6
|
+
* then spawns agent.js. This is the actual entry point for npm run agent.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { execSync, spawn } = require('child_process');
|
|
12
|
+
|
|
13
|
+
const ROOT = path.join(__dirname, '..');
|
|
14
|
+
const WORKFLOW_DIR = __dirname;
|
|
15
|
+
const VERSION_FILE = path.join(WORKFLOW_DIR, '.version');
|
|
16
|
+
|
|
17
|
+
const c = {
|
|
18
|
+
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
19
|
+
green: '\x1b[32m', yellow: '\x1b[33m',
|
|
20
|
+
};
|
|
21
|
+
const dim = (s) => `${c.dim}${s}${c.reset}`;
|
|
22
|
+
const green = (s) => `${c.green}${s}${c.reset}`;
|
|
23
|
+
const bold = (s) => `${c.bold}${s}${c.reset}`;
|
|
24
|
+
|
|
25
|
+
const getInstalledVersion = () => {
|
|
26
|
+
try {
|
|
27
|
+
return execSync('npm list -g multi-agents-cli --json', { stdio: 'pipe', encoding: 'utf8' });
|
|
28
|
+
} catch { return null; }
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getCurrentVersion = () => {
|
|
32
|
+
try {
|
|
33
|
+
// Walk up from .workflow/ to find the CLI package.json
|
|
34
|
+
const pkgPath = path.join(__dirname, '..', 'node_modules', 'multi-agents-cli', 'package.json');
|
|
35
|
+
if (fs.existsSync(pkgPath)) return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version;
|
|
36
|
+
// Global fallback
|
|
37
|
+
const globalPkg = execSync('npm root -g', { stdio: 'pipe', encoding: 'utf8' }).trim();
|
|
38
|
+
const globalPath = path.join(globalPkg, 'multi-agents-cli', 'package.json');
|
|
39
|
+
if (fs.existsSync(globalPath)) return JSON.parse(fs.readFileSync(globalPath, 'utf8')).version;
|
|
40
|
+
} catch {}
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getStampedVersion = () => {
|
|
45
|
+
try { return fs.readFileSync(VERSION_FILE, 'utf8').trim(); } catch { return null; }
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const copyWorkflow = (cliRoot) => {
|
|
49
|
+
const src = path.join(cliRoot, 'core', 'workflow');
|
|
50
|
+
const dest = WORKFLOW_DIR;
|
|
51
|
+
if (!fs.existsSync(src)) return false;
|
|
52
|
+
for (const file of fs.readdirSync(src)) {
|
|
53
|
+
fs.copyFileSync(path.join(src, file), path.join(dest, file));
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const findCliRoot = () => {
|
|
59
|
+
try {
|
|
60
|
+
const globalPkg = execSync('npm root -g', { stdio: 'pipe', encoding: 'utf8' }).trim();
|
|
61
|
+
const p = path.join(globalPkg, 'multi-agents-cli');
|
|
62
|
+
if (fs.existsSync(p)) return p;
|
|
63
|
+
} catch {}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const main = async () => {
|
|
68
|
+
const stamped = getStampedVersion();
|
|
69
|
+
const installed = getCurrentVersion();
|
|
70
|
+
|
|
71
|
+
if (installed && installed !== stamped) {
|
|
72
|
+
// Show spinner while updating
|
|
73
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
74
|
+
let i = 0;
|
|
75
|
+
const spin = setInterval(() => {
|
|
76
|
+
process.stdout.write(`\r ${frames[i++ % frames.length]} Updating workflow scripts...`);
|
|
77
|
+
}, 60);
|
|
78
|
+
|
|
79
|
+
const cliRoot = findCliRoot();
|
|
80
|
+
let updated = false;
|
|
81
|
+
if (cliRoot) {
|
|
82
|
+
updated = copyWorkflow(cliRoot);
|
|
83
|
+
if (updated) fs.writeFileSync(VERSION_FILE, installed, 'utf8');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
clearInterval(spin);
|
|
87
|
+
if (updated) {
|
|
88
|
+
process.stdout.write('\r' + ' '.repeat(40) + '\r');
|
|
89
|
+
console.log(` ${green('✓')} Workflow updated to ${bold('v' + installed)}\n`);
|
|
90
|
+
} else {
|
|
91
|
+
process.stdout.write('\r' + ' '.repeat(40) + '\r');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Spawn agent.js
|
|
96
|
+
const child = spawn('node', [path.join(WORKFLOW_DIR, 'agent.js'), ...process.argv.slice(2)], {
|
|
97
|
+
stdio: 'inherit',
|
|
98
|
+
cwd: ROOT,
|
|
99
|
+
});
|
|
100
|
+
child.on('exit', code => process.exit(code ?? 0));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
main().catch(err => { console.error(err.message); process.exit(1); });
|
package/init.js
CHANGED
|
@@ -409,6 +409,10 @@ const main = async () => {
|
|
|
409
409
|
fs.mkdirSync(WORKFLOW_DEST, { recursive: true });
|
|
410
410
|
copyDir(WORKFLOW_SRC, WORKFLOW_DEST);
|
|
411
411
|
console.log(` ${green('✓')} Workflow scripts copied (.workflow/)`);
|
|
412
|
+
try {
|
|
413
|
+
const cliPkg = require('./package.json');
|
|
414
|
+
fs.writeFileSync(path.join(WORKFLOW_DEST, '.version'), cliPkg.version, 'utf8');
|
|
415
|
+
} catch { /* best-effort */ }
|
|
412
416
|
|
|
413
417
|
writeConfig(path.join(ROOT, 'CLAUDE.md'), { PROJECT_NAME: projectName, PROJECT_ROOT: projectName });
|
|
414
418
|
console.log(` ${green('✓')} CLAUDE.md configured`);
|
|
@@ -596,7 +600,7 @@ Before starting any task, verify:
|
|
|
596
600
|
dependencies: { prompts: '^2.4.2' },
|
|
597
601
|
scripts: {
|
|
598
602
|
init: 'multi-agents init',
|
|
599
|
-
agent: 'node .workflow/
|
|
603
|
+
agent: 'node .workflow/run.js',
|
|
600
604
|
restart: 'node .workflow/restart.js',
|
|
601
605
|
reset: 'node .workflow/reset.js',
|
|
602
606
|
complete: 'node .workflow/complete.js',
|
package/package.json
CHANGED