bankai-cli 0.6.12 → 0.6.13
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/dist/main.js +37 -9
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -14,10 +14,23 @@ import chalk2 from "chalk";
|
|
|
14
14
|
// src/registry/builtin.ts
|
|
15
15
|
var builtinAgents = [
|
|
16
16
|
{
|
|
17
|
-
type: "
|
|
17
|
+
type: "settings",
|
|
18
18
|
cmd: "claude",
|
|
19
19
|
displayName: "Claude Code",
|
|
20
|
-
lines: ["claude --dangerously-skip-permissions"]
|
|
20
|
+
lines: ["claude --dangerously-skip-permissions"],
|
|
21
|
+
targets: [
|
|
22
|
+
{
|
|
23
|
+
kind: "json",
|
|
24
|
+
scope: "global",
|
|
25
|
+
filePath: "~/.claude/settings.json",
|
|
26
|
+
merge: {
|
|
27
|
+
sandbox: {
|
|
28
|
+
enabled: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
description: "Global (~/.claude/settings.json) \u2014 disable sandbox"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
21
34
|
},
|
|
22
35
|
{
|
|
23
36
|
type: "cli",
|
|
@@ -290,6 +303,18 @@ function deepMerge(base, overlay) {
|
|
|
290
303
|
baseVal,
|
|
291
304
|
overVal
|
|
292
305
|
);
|
|
306
|
+
} else if (Array.isArray(baseVal) && Array.isArray(overVal)) {
|
|
307
|
+
if (overVal.length === 0) {
|
|
308
|
+
result[key] = [];
|
|
309
|
+
} else {
|
|
310
|
+
const merged = [...baseVal];
|
|
311
|
+
for (const item of overVal) {
|
|
312
|
+
if (!merged.some((existing) => JSON.stringify(existing) === JSON.stringify(item))) {
|
|
313
|
+
merged.push(item);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
result[key] = merged;
|
|
317
|
+
}
|
|
293
318
|
} else {
|
|
294
319
|
result[key] = overVal;
|
|
295
320
|
}
|
|
@@ -304,8 +329,9 @@ function isDeepSubset(haystack, needle) {
|
|
|
304
329
|
return Object.keys(n).every((key) => isDeepSubset(h[key], n[key]));
|
|
305
330
|
}
|
|
306
331
|
if (Array.isArray(needle) && Array.isArray(haystack)) {
|
|
307
|
-
|
|
308
|
-
|
|
332
|
+
return needle.every(
|
|
333
|
+
(needleItem) => haystack.some((haystackItem) => isDeepSubset(haystackItem, needleItem))
|
|
334
|
+
);
|
|
309
335
|
}
|
|
310
336
|
return JSON.stringify(haystack) === JSON.stringify(needle);
|
|
311
337
|
}
|
|
@@ -441,6 +467,7 @@ function setNestedValue(obj, path3, value) {
|
|
|
441
467
|
|
|
442
468
|
// src/commands/apply.ts
|
|
443
469
|
async function applySettingsAgent(agent) {
|
|
470
|
+
let anyFailed = false;
|
|
444
471
|
const name = agent.displayName ?? agent.cmd;
|
|
445
472
|
console.log(chalk.bold.cyan(`# ${name}`));
|
|
446
473
|
console.log(chalk.dim("This agent uses settings files instead of CLI flags.\n"));
|
|
@@ -456,7 +483,7 @@ async function applySettingsAgent(agent) {
|
|
|
456
483
|
for (const s of statuses) {
|
|
457
484
|
console.log(chalk.green(` \u2713 ${s.target.description ?? s.target.kind}`));
|
|
458
485
|
}
|
|
459
|
-
return;
|
|
486
|
+
return false;
|
|
460
487
|
}
|
|
461
488
|
for (const s of statuses) {
|
|
462
489
|
const label = s.target.description ?? s.target.kind;
|
|
@@ -475,10 +502,11 @@ async function applySettingsAgent(agent) {
|
|
|
475
502
|
console.log(chalk.green(` \u2713 Applied: ${label}`));
|
|
476
503
|
} catch (err) {
|
|
477
504
|
const msg = err instanceof Error ? err.message : String(err);
|
|
478
|
-
console.error(chalk.
|
|
479
|
-
|
|
505
|
+
console.error(chalk.yellow(` \u26A0 Failed: ${label} \u2014 ${msg} (continuing anyway)`));
|
|
506
|
+
anyFailed = true;
|
|
480
507
|
}
|
|
481
508
|
}
|
|
509
|
+
return anyFailed;
|
|
482
510
|
}
|
|
483
511
|
|
|
484
512
|
// src/commands/run.ts
|
|
@@ -535,10 +563,10 @@ Run ${chalk2.yellow("bankai agents")} to see available agents, or ${chalk2.yello
|
|
|
535
563
|
}
|
|
536
564
|
if (agent.type === "settings") {
|
|
537
565
|
if (agent.cmd === "cursor-agent") ensureCursorAgentTrust();
|
|
538
|
-
await applySettingsAgent(agent);
|
|
566
|
+
const settingsFailed = await applySettingsAgent(agent);
|
|
539
567
|
const line = agent.lines?.[0] ?? agent.cmd;
|
|
540
568
|
const code = await execAgent(line, extraArgs);
|
|
541
|
-
process.exitCode = code;
|
|
569
|
+
process.exitCode = code || (settingsFailed ? 1 : 0);
|
|
542
570
|
} else {
|
|
543
571
|
if (agent.cmd === "codex") ensureCodexTrust();
|
|
544
572
|
const line = agent.lines[0];
|