kushi-agents 5.9.3 → 5.9.5
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/bin/cli.mjs +83 -7
- package/bin/kushi-agents.mjs +5 -0
- package/bin/kushi.mjs +4 -0
- package/package.json +3 -3
package/bin/cli.mjs
CHANGED
|
@@ -6,17 +6,15 @@ import { runMultiHost } from '../src/multi-host.mjs';
|
|
|
6
6
|
const args = process.argv.slice(2);
|
|
7
7
|
|
|
8
8
|
// ── bare invocation ──────────────────────────────────────────────────────────
|
|
9
|
-
// Two bins share this cli
|
|
10
|
-
//
|
|
9
|
+
// Two bins share this cli (via thin wrappers in bin/kushi.mjs and
|
|
10
|
+
// bin/kushi-agents.mjs that set KUSHI_BIN_NAME). Behavior diverges on no-args:
|
|
11
11
|
// - `kushi-agents` (no args) on a TTY → setup wizard (first-install ergonomics)
|
|
12
12
|
// - `kushi` (no args) on a TTY → Docker-style help (post-install verb)
|
|
13
13
|
// - Either, non-TTY → welcome card (no side effects)
|
|
14
14
|
// Override env vars: KUSHI_FORCE_WIZARD=1 forces wizard; KUSHI_SKIP_WELCOME=1
|
|
15
15
|
// forces the welcome card.
|
|
16
16
|
if (args.length === 0) {
|
|
17
|
-
const
|
|
18
|
-
const invokedAs = (process.argv[1] || '').toLowerCase();
|
|
19
|
-
const isInstallerBin = /kushi-agents(\.cmd|\.js|\.mjs)?$/.test(path0.basename(invokedAs));
|
|
17
|
+
const isInstallerBin = process.env.KUSHI_BIN_NAME === 'kushi-agents';
|
|
20
18
|
const forceWelcome = process.env.KUSHI_SKIP_WELCOME === '1';
|
|
21
19
|
const forceWizard = process.env.KUSHI_FORCE_WIZARD === '1';
|
|
22
20
|
const tty = process.stdin.isTTY && !forceWelcome;
|
|
@@ -35,6 +33,22 @@ if (args.length === 0) {
|
|
|
35
33
|
process.exit(0);
|
|
36
34
|
}
|
|
37
35
|
|
|
36
|
+
// ── version flag (v5.9.5+) ──────────────────────────────────────────────────
|
|
37
|
+
// `kushi --version` / `-v` / `version` → print version and exit. Previously
|
|
38
|
+
// these fell through to the installer's main() which printed the banner and
|
|
39
|
+
// started the install flow.
|
|
40
|
+
if (args.length > 0 && (args[0] === '--version' || args[0] === '-v' || args[0] === 'version')) {
|
|
41
|
+
const pathMod = await import('node:path');
|
|
42
|
+
const urlMod = await import('node:url');
|
|
43
|
+
const fsMod = await import('node:fs');
|
|
44
|
+
const here = pathMod.dirname(urlMod.fileURLToPath(import.meta.url));
|
|
45
|
+
const repoRoot = pathMod.resolve(here, '..');
|
|
46
|
+
let version = 'unknown';
|
|
47
|
+
try { version = JSON.parse(fsMod.readFileSync(pathMod.join(repoRoot, 'package.json'), 'utf-8')).version; } catch {}
|
|
48
|
+
console.log(version);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
38
52
|
// ── doctor verb (v5.4.0+) ───────────────────────────────────────────────────
|
|
39
53
|
if (args.length > 0 && args[0] === 'doctor') {
|
|
40
54
|
const { spawnSync } = await import('node:child_process');
|
|
@@ -278,6 +292,7 @@ Install (run via npx — first-time / host install):
|
|
|
278
292
|
WorkIQ: --with-workiq | --workiq-path <abs> | --skip-workiq-check
|
|
279
293
|
|
|
280
294
|
Run 'kushi <command> --help' for more information on a command (where supported).
|
|
295
|
+
Run 'kushi --version' to print the installed version.
|
|
281
296
|
Docs: https://gim-home.github.io/kushi/
|
|
282
297
|
|
|
283
298
|
In VS Code Chat the prefix is "@Kushi". In Clawpilot just say "kushi <verb>".
|
|
@@ -340,12 +355,43 @@ if (args.length > 0 && args[0] === 'uninstall' && !args.includes('--clawpilot')
|
|
|
340
355
|
|
|
341
356
|
if (args.length > 0 && args[0] === 'upgrade') {
|
|
342
357
|
// Upgrade: npm i -g @latest, then re-seed assets in cwd preserving config.
|
|
358
|
+
// v5.9.5: capture stderr so users see WHY npm failed; detect Windows
|
|
359
|
+
// self-replacement (kushi.cmd locked because it's the running shell) and
|
|
360
|
+
// print a clear "rerun from a fresh shell" hint.
|
|
343
361
|
const { spawnSync } = await import('node:child_process');
|
|
344
362
|
console.log('\n Upgrading kushi-agents globally via npm...\n');
|
|
345
363
|
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
346
|
-
const r1 = spawnSync(npm, ['install', '-g', 'kushi-agents@latest'], {
|
|
364
|
+
const r1 = spawnSync(npm, ['install', '-g', 'kushi-agents@latest'], {
|
|
365
|
+
stdio: ['inherit', 'inherit', 'pipe'],
|
|
366
|
+
encoding: 'utf-8',
|
|
367
|
+
});
|
|
347
368
|
if (r1.status !== 0) {
|
|
348
|
-
|
|
369
|
+
const stderr = (r1.stderr || '').toString();
|
|
370
|
+
if (stderr) {
|
|
371
|
+
console.error(stderr);
|
|
372
|
+
}
|
|
373
|
+
const looksLikeSelfReplace = process.platform === 'win32' && (
|
|
374
|
+
/EPERM|EBUSY|operation not permitted|kushi\.cmd|kushi-agents\.cmd|in use/i.test(stderr)
|
|
375
|
+
);
|
|
376
|
+
if (looksLikeSelfReplace) {
|
|
377
|
+
console.error([
|
|
378
|
+
'',
|
|
379
|
+
' npm could not overwrite the running kushi.cmd shim.',
|
|
380
|
+
' This is a known Windows limitation when `kushi upgrade` is launched from kushi itself.',
|
|
381
|
+
'',
|
|
382
|
+
' Fix: open a NEW PowerShell window and run:',
|
|
383
|
+
'',
|
|
384
|
+
' npm i -g kushi-agents@latest',
|
|
385
|
+
'',
|
|
386
|
+
' Then re-seed your workspace:',
|
|
387
|
+
'',
|
|
388
|
+
' cd ' + process.cwd(),
|
|
389
|
+
' npx kushi-agents@latest --force',
|
|
390
|
+
'',
|
|
391
|
+
].join('\n'));
|
|
392
|
+
} else if (!stderr) {
|
|
393
|
+
console.error('\n npm install failed (no stderr captured). Try:\n npm i -g kushi-agents@latest --foreground-scripts --loglevel=verbose\n');
|
|
394
|
+
}
|
|
349
395
|
process.exit(r1.status ?? 1);
|
|
350
396
|
}
|
|
351
397
|
console.log('\n Refreshing assets in cwd (config preserved)...\n');
|
|
@@ -359,6 +405,36 @@ if (args.length > 0 && args[0] === 'upgrade') {
|
|
|
359
405
|
}
|
|
360
406
|
}
|
|
361
407
|
|
|
408
|
+
// ── chat-verb guard (v5.9.4+) ───────────────────────────────────────────────
|
|
409
|
+
// These verbs are dispatched by Copilot Chat (`@Kushi <verb>`), not the CLI.
|
|
410
|
+
// If a user types e.g. `kushi ask HCA "..."` in PowerShell, fall through to
|
|
411
|
+
// installer used to silently run. Now we print a friendly redirect.
|
|
412
|
+
const CHAT_ONLY_VERBS = new Set([
|
|
413
|
+
'ask', 'bootstrap', 'refresh', 'status', 'consolidate', 'tour', 'dashboard',
|
|
414
|
+
'aggregate', 'fde-intake', 'fde-report', 'fde-triage', 'link-entities',
|
|
415
|
+
'migrate-files', 'pull', 'schema-evolve', 'teach', 'vertex-link',
|
|
416
|
+
'emit-vertex',
|
|
417
|
+
]);
|
|
418
|
+
if (args.length > 0 && CHAT_ONLY_VERBS.has(args[0])) {
|
|
419
|
+
const verb = args[0];
|
|
420
|
+
const rest = args.slice(1).map(a => a.includes(' ') ? `"${a}"` : a).join(' ');
|
|
421
|
+
console.log(`
|
|
422
|
+
'${verb}' is a chat verb — run it from Copilot Chat, not PowerShell.
|
|
423
|
+
|
|
424
|
+
In VS Code Copilot Chat:
|
|
425
|
+
@Kushi ${verb}${rest ? ' ' + rest : ' <project> [args]'}
|
|
426
|
+
|
|
427
|
+
In Clawpilot:
|
|
428
|
+
kushi ${verb}${rest ? ' ' + rest : ' <project> [args]'}
|
|
429
|
+
|
|
430
|
+
CLI verbs (run from PowerShell): kushi help, kushi wiki, kushi doctor,
|
|
431
|
+
kushi upgrade, kushi uninstall, kushi setup,
|
|
432
|
+
kushi state, kushi promote, kushi global, kushi lint
|
|
433
|
+
See: kushi help
|
|
434
|
+
`);
|
|
435
|
+
process.exit(2);
|
|
436
|
+
}
|
|
437
|
+
|
|
362
438
|
// ── multi-host mode (v5.0.2+) ───────────────────────────────────────────────
|
|
363
439
|
// Trigger when the user passes any of: --vscode, --all-hosts, --uninstall.
|
|
364
440
|
// --clawpilot ALONE continues to route through the legacy main.mjs path so
|
package/bin/kushi.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kushi-agents",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.5",
|
|
4
4
|
"description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"kushi": "./bin/
|
|
8
|
-
"kushi-agents": "./bin/
|
|
7
|
+
"kushi": "./bin/kushi.mjs",
|
|
8
|
+
"kushi-agents": "./bin/kushi-agents.mjs"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"bin/",
|