@open-artifacts/bus 0.240.0 → 0.241.0
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/assets/oa-bus.ts +1 -1
- package/assets/openclaw/index.js +1 -1
- package/assets/openclaw/package.json +1 -1
- package/dist/index.js +289 -57
- package/package.json +2 -2
package/assets/oa-bus.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
11
11
|
type Json = Record<string, unknown>;
|
|
12
12
|
|
|
13
13
|
/** The IPC marker (CONTRACT.md): the package version, stamped by the CLI's bundler. */
|
|
14
|
-
const CLIENT_VERSION = "0.
|
|
14
|
+
const CLIENT_VERSION = "0.241.0";
|
|
15
15
|
|
|
16
16
|
type Frame = Json & { type: string; id: string };
|
|
17
17
|
type Ctx = {
|
package/assets/openclaw/index.js
CHANGED
|
@@ -27876,7 +27876,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
|
|
|
27876
27876
|
var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
27877
27877
|
var isWellFormed2 = (s) => s.isWellFormed();
|
|
27878
27878
|
var WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
27879
|
-
var CLIENT_VERSION = true ? "0.
|
|
27879
|
+
var CLIENT_VERSION = true ? "0.241.0" : "0.0.0";
|
|
27880
27880
|
var clientVersion = {
|
|
27881
27881
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
27882
27882
|
};
|
package/dist/index.js
CHANGED
|
@@ -32905,7 +32905,7 @@ var init_frames = __esm({
|
|
|
32905
32905
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32906
32906
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32907
32907
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32908
|
-
CLIENT_VERSION = true ? "0.
|
|
32908
|
+
CLIENT_VERSION = true ? "0.241.0" : "0.0.0";
|
|
32909
32909
|
clientVersion = {
|
|
32910
32910
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32911
32911
|
};
|
|
@@ -59599,7 +59599,7 @@ var noService = {
|
|
|
59599
59599
|
remove: async () => ({}),
|
|
59600
59600
|
cli: () => ["oa-bus"]
|
|
59601
59601
|
};
|
|
59602
|
-
var VERSION = true ? "0.
|
|
59602
|
+
var VERSION = true ? "0.241.0" : JSON.parse(
|
|
59603
59603
|
readFileSync23(new URL("../package.json", import.meta.url), "utf8")
|
|
59604
59604
|
).version;
|
|
59605
59605
|
var which = (cmd) => {
|
|
@@ -62987,6 +62987,10 @@ var PROJECT_HABITS_FILE = {
|
|
|
62987
62987
|
opencode: "AGENTS.md"
|
|
62988
62988
|
};
|
|
62989
62989
|
var projectHabitsTarget = (cwd, h) => join35(cwd, PROJECT_HABITS_FILE[h]);
|
|
62990
|
+
var gitignoreLiteral = (path) => (
|
|
62991
|
+
// Spaces are escaped as well: git ignores a trailing one unless it is.
|
|
62992
|
+
path.replace(/[\\*?[\]! ]/g, (c) => `\\${c}`)
|
|
62993
|
+
);
|
|
62990
62994
|
var projectOf = (v) => {
|
|
62991
62995
|
const p = typeof v === "object" && v !== null ? v : {};
|
|
62992
62996
|
const exclude = [];
|
|
@@ -63001,6 +63005,16 @@ var projectOf = (v) => {
|
|
|
63001
63005
|
}
|
|
63002
63006
|
return { files: p.files ?? {}, exclude };
|
|
63003
63007
|
};
|
|
63008
|
+
function projectHabitsFileState(cwd, h) {
|
|
63009
|
+
const path = projectHabitsTarget(cwd, h);
|
|
63010
|
+
try {
|
|
63011
|
+
if (brokenLink(path)) return { state: "broken", path };
|
|
63012
|
+
if (!existsSync13(path)) return { state: "absent", path };
|
|
63013
|
+
return { ...blockState(readFileSync29(path, "utf8")), path };
|
|
63014
|
+
} catch {
|
|
63015
|
+
return { state: "broken", path };
|
|
63016
|
+
}
|
|
63017
|
+
}
|
|
63004
63018
|
function writeProjectHabits(deps2, harnesses, io = {}) {
|
|
63005
63019
|
const files2 = [];
|
|
63006
63020
|
const notes = [];
|
|
@@ -63046,7 +63060,7 @@ function writeProjectHabits(deps2, harnesses, io = {}) {
|
|
|
63046
63060
|
files_[path] = { added: separatorFor(before), created: true };
|
|
63047
63061
|
files2.push(path);
|
|
63048
63062
|
if (!exists3 && io.excludeFile !== void 0 && io.exclude !== void 0) {
|
|
63049
|
-
const line = `/${rel}`;
|
|
63063
|
+
const line = `/${gitignoreLiteral(rel)}`;
|
|
63050
63064
|
if (io.exclude(line))
|
|
63051
63065
|
exclude.push({ file: io.excludeFile, line, for: path });
|
|
63052
63066
|
}
|
|
@@ -63065,27 +63079,26 @@ function removeProjectHabits(deps2, only) {
|
|
|
63065
63079
|
const cur = record6(deps2.busHome).project;
|
|
63066
63080
|
const kept = { ...cur.files };
|
|
63067
63081
|
const exclude = [...cur.exclude];
|
|
63082
|
+
const cleaned = /* @__PURE__ */ new Set();
|
|
63068
63083
|
for (const [path, rec] of Object.entries(cur.files)) {
|
|
63069
63084
|
if (only !== void 0 && !only(path)) continue;
|
|
63070
63085
|
try {
|
|
63071
|
-
if (brokenLink(path) || !existsSync13(path)) {
|
|
63072
|
-
delete kept[path];
|
|
63073
|
-
continue;
|
|
63074
|
-
}
|
|
63075
|
-
if (isLink(path)) {
|
|
63076
|
-
notes.push(`Left ${path} alone: it is now a symlink.`);
|
|
63086
|
+
if (brokenLink(path) || !existsSync13(path) || isLink(path)) {
|
|
63077
63087
|
delete kept[path];
|
|
63088
|
+
cleaned.add(path);
|
|
63078
63089
|
continue;
|
|
63079
63090
|
}
|
|
63080
63091
|
const before = readFileSync29(path, "utf8");
|
|
63081
63092
|
if (blockState(before).state === "absent") {
|
|
63082
63093
|
delete kept[path];
|
|
63094
|
+
cleaned.add(path);
|
|
63083
63095
|
continue;
|
|
63084
63096
|
}
|
|
63085
63097
|
const after = withHabits(before, null, rec?.added);
|
|
63086
63098
|
if (rec?.created && after.trim() === "") rmSync17(path, { force: true });
|
|
63087
63099
|
else writeAtomic(path, after);
|
|
63088
63100
|
delete kept[path];
|
|
63101
|
+
cleaned.add(path);
|
|
63089
63102
|
files2.push(path);
|
|
63090
63103
|
} catch (e) {
|
|
63091
63104
|
notes.push(
|
|
@@ -63095,6 +63108,7 @@ function removeProjectHabits(deps2, only) {
|
|
|
63095
63108
|
}
|
|
63096
63109
|
for (const e of [...exclude]) {
|
|
63097
63110
|
if (only !== void 0 && (e.for === void 0 || !only(e.for))) continue;
|
|
63111
|
+
if (e.for !== void 0 && !cleaned.has(e.for)) continue;
|
|
63098
63112
|
try {
|
|
63099
63113
|
const text3 = readFileSync29(e.file, "utf8");
|
|
63100
63114
|
const lines = text3.split("\n");
|
|
@@ -63405,11 +63419,24 @@ var probe = (path) => {
|
|
|
63405
63419
|
var habitsOptedOut = (busHome2) => record6(busHome2).optedOut;
|
|
63406
63420
|
var setHabitsOptOut = (busHome2, optedOut, at) => saveRecord(busHome2, { optedOut, at });
|
|
63407
63421
|
var OMP_NOTE = "omp: not supported yet";
|
|
63422
|
+
var HABITS_GLOBAL_UPDATE_TEXT = "The habits for every project on this machine changed in this release, in {files}:";
|
|
63423
|
+
var HABITS_QUESTION_TEXT = "The bus would add {count} habits to this project only, in {files}:";
|
|
63408
63424
|
var habitsQuestion = (shownFiles, bus = BUS_CMD) => {
|
|
63409
|
-
const yes2 = `${bus} install --habits`;
|
|
63410
|
-
const no2 = `${bus} install --no-habits`;
|
|
63411
|
-
const text3 =
|
|
63412
|
-
|
|
63425
|
+
const yes2 = `${bus} install --habits-project`;
|
|
63426
|
+
const no2 = `${bus} install --no-habits-project`;
|
|
63427
|
+
const text3 = HABITS_QUESTION_TEXT.replace(
|
|
63428
|
+
"{count}",
|
|
63429
|
+
String(HABITS_LINES.length)
|
|
63430
|
+
).replace("{files}", shownFiles.join(" and "));
|
|
63431
|
+
return {
|
|
63432
|
+
text: text3,
|
|
63433
|
+
lines: HABITS_LINES.slice(),
|
|
63434
|
+
note: OMP_NOTE,
|
|
63435
|
+
yes: yes2,
|
|
63436
|
+
no: no2,
|
|
63437
|
+
global: `${bus} install --habits`,
|
|
63438
|
+
never: `${bus} install --no-habits`
|
|
63439
|
+
};
|
|
63413
63440
|
};
|
|
63414
63441
|
var habitsQuestionLines = (q) => [
|
|
63415
63442
|
"Installed. One question for your user before you finish:",
|
|
@@ -63419,7 +63446,9 @@ var habitsQuestionLines = (q) => [
|
|
|
63419
63446
|
...q.lines.map((l) => ` ${l}`),
|
|
63420
63447
|
` ${q.note}`,
|
|
63421
63448
|
`Yes: ${q.yes}`,
|
|
63422
|
-
`No: ${q.no}
|
|
63449
|
+
`No: ${q.no}`,
|
|
63450
|
+
...q.global ? [`All projects (invasive): ${q.global}`] : [],
|
|
63451
|
+
...q.never ? [`Never ask again on this machine: ${q.never}`] : []
|
|
63423
63452
|
];
|
|
63424
63453
|
|
|
63425
63454
|
// src/steps/opencode-proof.ts
|
|
@@ -66457,6 +66486,82 @@ function disclosure(ctx, pending) {
|
|
|
66457
66486
|
...HABITS_LINES.map((l) => ` ${l}`)
|
|
66458
66487
|
];
|
|
66459
66488
|
}
|
|
66489
|
+
async function isRepoTop(ctx) {
|
|
66490
|
+
if (!ctx.which("git")) return "no";
|
|
66491
|
+
const r = await ctx.exec("git", ["-C", ctx.cwd, "rev-parse", "--show-toplevel"], {
|
|
66492
|
+
timeoutMs: 5e3
|
|
66493
|
+
}).catch(() => void 0);
|
|
66494
|
+
if (r?.code !== 0) return "no";
|
|
66495
|
+
const root = realpathOr(r.stdout.trim());
|
|
66496
|
+
if (root === realpathOr(ctx.userHome)) return "home";
|
|
66497
|
+
return { root };
|
|
66498
|
+
}
|
|
66499
|
+
var readBlocked = (busHome2) => {
|
|
66500
|
+
const raw = readInstallFile(join47(busHome2, "install.json")).habits ?? {};
|
|
66501
|
+
const out = {};
|
|
66502
|
+
if (typeof raw.projectBlocked === "object" && raw.projectBlocked !== null) {
|
|
66503
|
+
for (const [root, list] of Object.entries(
|
|
66504
|
+
raw.projectBlocked
|
|
66505
|
+
))
|
|
66506
|
+
if (Array.isArray(list))
|
|
66507
|
+
out[root] = list.filter((h) => typeof h === "string");
|
|
66508
|
+
}
|
|
66509
|
+
return out;
|
|
66510
|
+
};
|
|
66511
|
+
var saveBlocked = (busHome2, map2) => {
|
|
66512
|
+
updateInstallFile(join47(busHome2, "install.json"), {
|
|
66513
|
+
habits: { ...habitsRecord(busHome2), projectBlocked: map2 }
|
|
66514
|
+
});
|
|
66515
|
+
};
|
|
66516
|
+
var habitsRecord = (busHome2) => readInstallFile(join47(busHome2, "install.json")).habits ?? {};
|
|
66517
|
+
var pluginLineSaid = (busHome2) => habitsRecord(busHome2).pluginLineSaid === true;
|
|
66518
|
+
var markPluginLineSaid = (busHome2) => {
|
|
66519
|
+
updateInstallFile(join47(busHome2, "install.json"), {
|
|
66520
|
+
habits: { ...habitsRecord(busHome2), pluginLineSaid: true }
|
|
66521
|
+
});
|
|
66522
|
+
};
|
|
66523
|
+
var noteBlocked = (ctx, folder, blocked, json4) => {
|
|
66524
|
+
const said = readBlocked(ctx.home);
|
|
66525
|
+
const fresh = blocked.filter((h) => !(said[folder] ?? []).includes(h));
|
|
66526
|
+
if (fresh.length === 0) return "";
|
|
66527
|
+
const why2 = `${fresh.join(", ")} read this project's AGENTS.md, but git tracks it, so the habits cannot go there without committing them. \`--habits\` adds them for all projects.`;
|
|
66528
|
+
saveBlocked(ctx.home, {
|
|
66529
|
+
...said,
|
|
66530
|
+
[folder]: [...said[folder] ?? [], ...fresh]
|
|
66531
|
+
});
|
|
66532
|
+
if (!json4) say(ctx, why2);
|
|
66533
|
+
return why2;
|
|
66534
|
+
};
|
|
66535
|
+
var readDeclined = (busHome2) => {
|
|
66536
|
+
const raw = habitsRecord(busHome2).projectDeclined;
|
|
66537
|
+
const out = {};
|
|
66538
|
+
if (typeof raw === "object" && raw !== null) {
|
|
66539
|
+
for (const [root, v] of Object.entries(raw))
|
|
66540
|
+
if (v === true) out[root] = true;
|
|
66541
|
+
}
|
|
66542
|
+
return out;
|
|
66543
|
+
};
|
|
66544
|
+
var setDeclined = (busHome2, root, off) => {
|
|
66545
|
+
const cur = readDeclined(busHome2);
|
|
66546
|
+
if (off) cur[root] = true;
|
|
66547
|
+
else delete cur[root];
|
|
66548
|
+
updateInstallFile(join47(busHome2, "install.json"), {
|
|
66549
|
+
habits: { ...habitsRecord(busHome2), projectDeclined: cur }
|
|
66550
|
+
});
|
|
66551
|
+
};
|
|
66552
|
+
var moveOffered = (busHome2) => habitsRecord(busHome2).projectMoveOffered === true;
|
|
66553
|
+
var markMoveOffered = (busHome2) => {
|
|
66554
|
+
updateInstallFile(join47(busHome2, "install.json"), {
|
|
66555
|
+
habits: { ...habitsRecord(busHome2), projectMoveOffered: true }
|
|
66556
|
+
});
|
|
66557
|
+
};
|
|
66558
|
+
var realpathOr = (p) => {
|
|
66559
|
+
try {
|
|
66560
|
+
return realpathSync16(p);
|
|
66561
|
+
} catch {
|
|
66562
|
+
return resolve15(p);
|
|
66563
|
+
}
|
|
66564
|
+
};
|
|
66460
66565
|
async function projectIo(ctx) {
|
|
66461
66566
|
if (!ctx.which("git")) return {};
|
|
66462
66567
|
const git3 = (args) => ctx.exec("git", ["-C", ctx.cwd, ...args], { timeoutMs: 5e3 });
|
|
@@ -66518,10 +66623,24 @@ async function habitsProject(ctx) {
|
|
|
66518
66623
|
question: null,
|
|
66519
66624
|
plugins: pluginStates(ctx)
|
|
66520
66625
|
};
|
|
66521
|
-
if (targets.length === 0
|
|
66522
|
-
|
|
66626
|
+
if (targets.length === 0) {
|
|
66627
|
+
say(
|
|
66628
|
+
ctx,
|
|
66629
|
+
"No harness here has a project instruction file to put the habits in, so nothing was written. Install a harness first (Claude Code, Codex, pi or OpenCode), then run this again."
|
|
66630
|
+
);
|
|
66631
|
+
return none2;
|
|
66632
|
+
}
|
|
66633
|
+
const repo = await isRepoTop(ctx);
|
|
66634
|
+
if (repo === "home" || repo === "no") {
|
|
66635
|
+
say(
|
|
66636
|
+
ctx,
|
|
66637
|
+
repo === "home" ? "This is your home folder, not a project: habits written here would reach every project under it. Run the install at the top of a project instead." : "This folder is not inside a git repository, so there is no project to write the habits to."
|
|
66638
|
+
);
|
|
66639
|
+
return none2;
|
|
66640
|
+
}
|
|
66641
|
+
const io = await projectIo({ ...ctx, cwd: repo.root });
|
|
66523
66642
|
const r = writeProjectHabits(
|
|
66524
|
-
{ home: ctx.userHome, env: ctx.env, busHome: ctx.home, cwd:
|
|
66643
|
+
{ home: ctx.userHome, env: ctx.env, busHome: ctx.home, cwd: repo.root },
|
|
66525
66644
|
targets,
|
|
66526
66645
|
io
|
|
66527
66646
|
);
|
|
@@ -66529,6 +66648,7 @@ async function habitsProject(ctx) {
|
|
|
66529
66648
|
r.notes.push(
|
|
66530
66649
|
`The ${plugins2.map((p) => p.label).join(", ")} plugin carries the habits machine-wide, so this command leaves it alone. Turn those on or off with ${ctx.busCmd} install --habits and --no-habits.`
|
|
66531
66650
|
);
|
|
66651
|
+
setDeclined(ctx.home, repo.root, false);
|
|
66532
66652
|
if (r.files.length > 0)
|
|
66533
66653
|
say(ctx, `Habits on in this folder: ${shown2(ctx, r.files)}`);
|
|
66534
66654
|
for (const n of r.notes) say(ctx, n);
|
|
@@ -66539,7 +66659,7 @@ async function habitsProject(ctx) {
|
|
|
66539
66659
|
plugins: pluginStates(ctx)
|
|
66540
66660
|
};
|
|
66541
66661
|
}
|
|
66542
|
-
function habitsProjectOff(ctx) {
|
|
66662
|
+
async function habitsProjectOff(ctx) {
|
|
66543
66663
|
const real3 = (p) => {
|
|
66544
66664
|
try {
|
|
66545
66665
|
return realpathSync16(p);
|
|
@@ -66547,11 +66667,20 @@ function habitsProjectOff(ctx) {
|
|
|
66547
66667
|
return resolve15(p);
|
|
66548
66668
|
}
|
|
66549
66669
|
};
|
|
66550
|
-
const
|
|
66670
|
+
const repo = await isRepoTop(ctx);
|
|
66671
|
+
if (repo === "home" || repo === "no") {
|
|
66672
|
+
say(
|
|
66673
|
+
ctx,
|
|
66674
|
+
repo === "home" ? "This is your home folder, not a project, so there are no project habits to turn off here." : "This folder is not inside a git repo, so there are no project habits to turn off here."
|
|
66675
|
+
);
|
|
66676
|
+
return 0;
|
|
66677
|
+
}
|
|
66678
|
+
const cwd = repo.root;
|
|
66551
66679
|
const r = removeProjectHabits(
|
|
66552
66680
|
{ home: ctx.userHome, env: ctx.env, busHome: ctx.home },
|
|
66553
66681
|
(path) => dirname21(real3(path)) === cwd
|
|
66554
66682
|
);
|
|
66683
|
+
setDeclined(ctx.home, cwd, true);
|
|
66555
66684
|
if (r.files.length === 0 && r.notes.length === 0) {
|
|
66556
66685
|
say(ctx, `No bus habits here to remove in ${tilde(ctx, cwd)}.`);
|
|
66557
66686
|
return 0;
|
|
@@ -66572,32 +66701,142 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
66572
66701
|
if (habitsOptedOut(ctx.home))
|
|
66573
66702
|
return { ...none2, state: "off", question: null };
|
|
66574
66703
|
if (targets.length === 0 && plugins2.length === 0) return none2;
|
|
66575
|
-
|
|
66576
|
-
|
|
66577
|
-
|
|
66578
|
-
|
|
66579
|
-
|
|
66580
|
-
|
|
66581
|
-
|
|
66582
|
-
|
|
66583
|
-
|
|
66584
|
-
|
|
66585
|
-
|
|
66704
|
+
if (plugins2.length > 0 && !json4 && !pluginLineSaid(ctx.home)) {
|
|
66705
|
+
say(
|
|
66706
|
+
ctx,
|
|
66707
|
+
`The ${plugins2.map((p) => p.label).join(", ")} plugin carries the habits machine-wide; change that with install --habits and --no-habits.`
|
|
66708
|
+
);
|
|
66709
|
+
markPluginLineSaid(ctx.home);
|
|
66710
|
+
}
|
|
66711
|
+
const repoTop = await isRepoTop(ctx);
|
|
66712
|
+
const folder = repoTop === "home" || repoTop === "no" ? ctx.cwd : repoTop.root;
|
|
66713
|
+
const io = await projectIo({ ...ctx, cwd: folder });
|
|
66714
|
+
const nameOf2 = (h) => io.rel?.(PROJECT_HABITS_FILE[h]) ?? PROJECT_HABITS_FILE[h];
|
|
66715
|
+
const writable = targets.filter((h) => io.tracked?.(nameOf2(h)) !== true);
|
|
66716
|
+
const blocked = targets.filter((h) => io.tracked?.(nameOf2(h)) === true);
|
|
66717
|
+
const globalStates = targets.map((h) => habitsFileState(deps(ctx), h));
|
|
66718
|
+
const globalPending = globalStates.filter(
|
|
66719
|
+
(st) => st.state === "changed" || st.state === "broken"
|
|
66720
|
+
);
|
|
66721
|
+
const globalOn = globalStates.filter((st) => st.state === "current");
|
|
66722
|
+
if (globalOn.length > 0 && globalPending.length === 0) {
|
|
66723
|
+
if (!json4 && !moveOffered(ctx.home)) {
|
|
66724
|
+
say(
|
|
66725
|
+
ctx,
|
|
66726
|
+
"Habits are on for every project on this machine. To keep them in projects only, run install --habits-project in a project and install --no-habits for these global ones."
|
|
66727
|
+
);
|
|
66728
|
+
markMoveOffered(ctx.home);
|
|
66729
|
+
}
|
|
66730
|
+
return {
|
|
66731
|
+
...none2,
|
|
66732
|
+
state: "on",
|
|
66733
|
+
files: globalStates.map((st) => st.path),
|
|
66734
|
+
question: null
|
|
66735
|
+
};
|
|
66736
|
+
}
|
|
66737
|
+
if (globalPending.length > 0) {
|
|
66738
|
+
const changedGlobals = targets.filter(
|
|
66739
|
+
(h) => habitsFileState(deps(ctx), h).state === "changed"
|
|
66740
|
+
);
|
|
66741
|
+
if (ctx.stdinIsTTY && ctx.readLine && !json4) {
|
|
66742
|
+
say(
|
|
66743
|
+
ctx,
|
|
66744
|
+
"",
|
|
66745
|
+
disclosure(
|
|
66746
|
+
ctx,
|
|
66747
|
+
globalPending.map((st) => ({ path: st.path, s: st }))
|
|
66748
|
+
)
|
|
66749
|
+
);
|
|
66750
|
+
const a = (await ctx.readLine("Update them? [Y/n] ")).trim().toLowerCase();
|
|
66751
|
+
if (a === "" || a === "y" || a === "yes") {
|
|
66752
|
+
writeHabits(deps(ctx), changedGlobals, { explicit: a !== "" });
|
|
66753
|
+
say(ctx, "Habits updated for every project on this machine.");
|
|
66586
66754
|
}
|
|
66587
|
-
|
|
66755
|
+
return {
|
|
66756
|
+
...none2,
|
|
66757
|
+
state: "changed",
|
|
66758
|
+
files: globalStates.map((st) => st.path),
|
|
66759
|
+
question: null
|
|
66760
|
+
};
|
|
66761
|
+
}
|
|
66762
|
+
const bus = json4 ? BUS_CMD : ctx.busCmd;
|
|
66763
|
+
const files2 = globalStates.map((st) => one2(ctx, st.path)).join(" and ");
|
|
66764
|
+
const q = {
|
|
66765
|
+
...habitsQuestion([files2], bus),
|
|
66766
|
+
text: HABITS_GLOBAL_UPDATE_TEXT.replace("{files}", files2),
|
|
66767
|
+
yes: `${bus} install --habits`,
|
|
66768
|
+
// Declining a global update is not a project answer: nothing here may
|
|
66769
|
+
// mark the current folder declined.
|
|
66770
|
+
no: `${bus} install --no-habits`,
|
|
66771
|
+
never: void 0,
|
|
66772
|
+
note: `These are for every project on this machine. ${OMP_NOTE}`
|
|
66773
|
+
};
|
|
66774
|
+
q.global = void 0;
|
|
66775
|
+
return {
|
|
66776
|
+
...none2,
|
|
66777
|
+
state: "changed",
|
|
66778
|
+
files: globalStates.map((st) => st.path),
|
|
66779
|
+
question: q
|
|
66780
|
+
};
|
|
66781
|
+
}
|
|
66782
|
+
if (repoTop !== "home" && repoTop !== "no" && readDeclined(ctx.home)[folder]) {
|
|
66783
|
+
return { ...none2, state: "off", files: [], question: null };
|
|
66784
|
+
}
|
|
66785
|
+
const states = [
|
|
66786
|
+
...writable.map((h) => {
|
|
66787
|
+
const st = projectHabitsFileState(folder, h);
|
|
66788
|
+
return { path: st.path, s: st };
|
|
66789
|
+
})
|
|
66588
66790
|
];
|
|
66791
|
+
const whyBlocked = (list) => `${list.join(", ")} read this project's AGENTS.md, but git tracks it, so the habits cannot go there without committing them. \`--habits\` adds them for all projects.`;
|
|
66589
66792
|
const pending = states.filter((p) => p.s.state !== "current");
|
|
66590
66793
|
const have = states.filter((p) => p.s.state === "current").map((p) => p.path);
|
|
66591
|
-
if (pending.length === 0)
|
|
66794
|
+
if (pending.length === 0) {
|
|
66795
|
+
if (writable.length === 0 && blocked.length > 0) {
|
|
66796
|
+
const whyBlockedNow = noteBlocked(ctx, folder, blocked, json4);
|
|
66797
|
+
return {
|
|
66798
|
+
...none2,
|
|
66799
|
+
state: "undecided",
|
|
66800
|
+
files: have,
|
|
66801
|
+
question: null,
|
|
66802
|
+
...whyBlockedNow ? { note: whyBlockedNow } : {}
|
|
66803
|
+
};
|
|
66804
|
+
}
|
|
66592
66805
|
return { ...none2, state: "on", files: have, question: null };
|
|
66806
|
+
}
|
|
66593
66807
|
const changed = pending.some((p) => p.s.state === "changed");
|
|
66594
66808
|
const state = changed ? "changed" : "undecided";
|
|
66809
|
+
if (repoTop === "home" || repoTop === "no") {
|
|
66810
|
+
const why2 = repoTop === "home" ? "This is your home folder, not a project: habits written here would reach every project under it. Run the install at the top of a project instead." : "This folder is not inside a git repository, so there is no project to write the habits to.";
|
|
66811
|
+
if (ctx.stdinIsTTY && ctx.readLine && !json4) {
|
|
66812
|
+
say(ctx, why2);
|
|
66813
|
+
return { ...none2, state, files: have, question: null };
|
|
66814
|
+
}
|
|
66815
|
+
if (!json4) say(ctx, why2);
|
|
66816
|
+
return { ...none2, state, files: have, question: null, note: why2 };
|
|
66817
|
+
}
|
|
66595
66818
|
const asked = pending.map((p) => p.path);
|
|
66596
66819
|
const question = habitsQuestion(
|
|
66597
66820
|
pending.map((p) => p.label ?? one2(ctx, p.path)),
|
|
66598
66821
|
// --json goes to an agent that may hand the commands to its user's own shell.
|
|
66599
66822
|
json4 ? BUS_CMD : ctx.busCmd
|
|
66600
66823
|
);
|
|
66824
|
+
if (blocked.length > 0) {
|
|
66825
|
+
const said = readBlocked(ctx.home);
|
|
66826
|
+
const root = folder;
|
|
66827
|
+
const fresh = blocked.filter((h) => !(said[root] ?? []).includes(h));
|
|
66828
|
+
if (fresh.length > 0) {
|
|
66829
|
+
question.note = `${whyBlocked(fresh)} ${question.note}`;
|
|
66830
|
+
saveBlocked(ctx.home, {
|
|
66831
|
+
...said,
|
|
66832
|
+
[root]: [...said[root] ?? [], ...fresh]
|
|
66833
|
+
});
|
|
66834
|
+
}
|
|
66835
|
+
}
|
|
66836
|
+
if (plugins2.length > 0)
|
|
66837
|
+
question.note = `${question.note} The ${plugins2.map((p) => p.label).join(
|
|
66838
|
+
", "
|
|
66839
|
+
)} plugin carries them machine-wide; change that with install --habits and --no-habits.`;
|
|
66601
66840
|
if (ctx.stdinIsTTY && ctx.readLine && !json4) {
|
|
66602
66841
|
say(ctx, "", disclosure(ctx, pending));
|
|
66603
66842
|
const outside = pending.some(
|
|
@@ -66614,22 +66853,21 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
66614
66853
|
return { ...none2, state, files: have, question };
|
|
66615
66854
|
}
|
|
66616
66855
|
if (a === "" || a === "y" || a === "yes") {
|
|
66617
|
-
const r =
|
|
66618
|
-
|
|
66619
|
-
|
|
66620
|
-
(h) => asked.includes(
|
|
66856
|
+
const r = writeProjectHabits(
|
|
66857
|
+
{ home: ctx.userHome, env: ctx.env, busHome: ctx.home, cwd: folder },
|
|
66858
|
+
writable.filter(
|
|
66859
|
+
(h) => asked.includes(projectHabitsFileState(folder, h).path)
|
|
66621
66860
|
),
|
|
66622
|
-
|
|
66861
|
+
io
|
|
66623
66862
|
);
|
|
66624
|
-
const pl =
|
|
66625
|
-
|
|
66626
|
-
plugins2.filter(
|
|
66627
|
-
(p) => asked.includes(join47(p.dir(ctx.userHome, ctx.env), p.marker))
|
|
66628
|
-
),
|
|
66629
|
-
true
|
|
66630
|
-
);
|
|
66631
|
-
if (!changed) setHabitsOptOut(ctx.home, false, stamp(ctx));
|
|
66863
|
+
const pl = { changed: [], notes: [], pluginFiles: [], incomplete: false };
|
|
66864
|
+
if (!changed) setDeclined(ctx.home, folder, false);
|
|
66632
66865
|
if (r.files.length > 0) say(ctx, `Habits on in ${shown2(ctx, r.files)}`);
|
|
66866
|
+
if (plugins2.length > 0)
|
|
66867
|
+
say(
|
|
66868
|
+
ctx,
|
|
66869
|
+
`The ${plugins2.map((p) => p.label).join(", ")} plugin carries the habits machine-wide, so it was left as it is. Change it with install --habits and --no-habits.`
|
|
66870
|
+
);
|
|
66633
66871
|
for (const p of pl.changed) say(ctx, pluginOn(p));
|
|
66634
66872
|
for (const n of [...r.notes, ...pl.notes]) say(ctx, n);
|
|
66635
66873
|
return {
|
|
@@ -66642,17 +66880,11 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
66642
66880
|
}
|
|
66643
66881
|
if (a === "n" || a === "no") {
|
|
66644
66882
|
if (!changed) {
|
|
66645
|
-
|
|
66646
|
-
|
|
66647
|
-
|
|
66648
|
-
|
|
66649
|
-
|
|
66650
|
-
"Habits are still on in some places (see below). Your opt-out is saved, so a reinstall won't add them back."
|
|
66651
|
-
);
|
|
66652
|
-
for (const n of off.notes) say(ctx, n);
|
|
66653
|
-
return { ...none2, state: "on", plugins: pluginStates(ctx) };
|
|
66654
|
-
}
|
|
66655
|
-
say(ctx, "Habits off. A reinstall will not add them back.");
|
|
66883
|
+
setDeclined(ctx.home, folder, true);
|
|
66884
|
+
say(
|
|
66885
|
+
ctx,
|
|
66886
|
+
"Habits stay off in this project. Other projects will still be asked; install --no-habits turns them off everywhere and never asks again."
|
|
66887
|
+
);
|
|
66656
66888
|
return { ...none2, state: "off", plugins: pluginStates(ctx) };
|
|
66657
66889
|
}
|
|
66658
66890
|
say(ctx, "Left the habits as they were.");
|
|
@@ -66667,7 +66899,7 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
66667
66899
|
async function habitsCommand(mode, ctx) {
|
|
66668
66900
|
say(ctx, ctx.copy.header(ctx.version), "");
|
|
66669
66901
|
if (mode === "show") return show(ctx);
|
|
66670
|
-
if (mode === "project-off") return habitsProjectOff(ctx);
|
|
66902
|
+
if (mode === "project-off") return await habitsProjectOff(ctx);
|
|
66671
66903
|
if (mode === "project") {
|
|
66672
66904
|
try {
|
|
66673
66905
|
const r = await habitsProject(ctx);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-artifacts/bus",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.241.0",
|
|
5
5
|
"description": "The Open Artifacts bus: your AI agents reach each other across machines.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"oaBus": {
|
|
32
|
-
"commit": "
|
|
32
|
+
"commit": "6e5fb101a93e36be9f2bd90c9b777214d8541173"
|
|
33
33
|
}
|
|
34
34
|
}
|