buddy-agent-harness 0.18.0 → 0.19.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/dist/cli.mjs +42 -13
- package/dist/index.d.mts +12 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +42 -13
- package/dist/index.mjs.map +1 -1
- package/dist/skill-scripts/doctor.mjs +39 -39
- package/dist/skill-scripts/init.mjs +39 -39
- package/dist/skill-scripts/mcp.mjs +39 -39
- package/dist/skill-scripts/reference.mjs +39 -39
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/doctor-buddy-agent-harness/SKILL.md +1 -1
- package/skills/doctor-buddy-agent-harness/references/global-instructions.md +4 -1
- package/skills/doctor-buddy-agent-harness/references/harnesses/claude-code.md +1 -1
- package/skills/doctor-buddy-agent-harness/references/harnesses/codex.md +1 -1
- package/skills/doctor-buddy-agent-harness/references/harnesses/copilot-cli.md +1 -1
- package/skills/doctor-buddy-agent-harness/scripts/doctor.mjs +39 -39
- package/skills/enhance/SKILL.md +2 -1
- package/skills/enhance/scripts/doctor.mjs +39 -39
- package/skills/init-buddy-agent-harness/SKILL.md +1 -1
- package/skills/init-buddy-agent-harness/scripts/doctor.mjs +39 -39
- package/skills/init-buddy-agent-harness/scripts/init.mjs +39 -39
- package/skills/reference/SKILL.md +1 -1
- package/skills/reference/scripts/reference.mjs +39 -39
- package/skills/repair/SKILL.md +2 -2
- package/skills/repair/scripts/doctor.mjs +39 -39
- package/skills/repair/scripts/mcp.mjs +39 -39
- package/src/diagnose-bridges/diagnose-bridges.ts +1 -1
- package/src/diagnose-bridges/diagnose-global-instructions.ts +29 -11
- package/src/diagnose-bridges/doctor-guidance.ts +25 -2
- package/src/harness-registry/harness-registry.ts +7 -0
package/dist/cli.mjs
CHANGED
|
@@ -18006,6 +18006,7 @@ const harnessRegistry = [
|
|
|
18006
18006
|
detect: ".claude",
|
|
18007
18007
|
...skillsProjection("claude-code", "user"),
|
|
18008
18008
|
relocatedBy: "CLAUDE_CONFIG_DIR",
|
|
18009
|
+
emptyRelocatesToStart: true,
|
|
18009
18010
|
instructionBridge: {
|
|
18010
18011
|
kind: "import",
|
|
18011
18012
|
path: ".claude/CLAUDE.md",
|
|
@@ -18407,6 +18408,14 @@ const globalInstructionTable = {
|
|
|
18407
18408
|
instruction: `${handOver} move what ${file} says into ${globalFile} and remove it`
|
|
18408
18409
|
}),
|
|
18409
18410
|
skillRepair: () => "hand the user the move of what that file says into the global file, and its removal; write nothing yourself"
|
|
18411
|
+
},
|
|
18412
|
+
"global-instructions-emptied": {
|
|
18413
|
+
detail: "the variable is set but empty, which this harness reads as the directory it starts in rather than as unset — its user-scope file is whichever one sits there, not the one in its own folder",
|
|
18414
|
+
repair: ({ file }) => ({
|
|
18415
|
+
command: "",
|
|
18416
|
+
instruction: `${handOver} unset ${file.slice(1)} where your shell sets it, or set it to the folder you meant`
|
|
18417
|
+
}),
|
|
18418
|
+
skillRepair: () => "hand the user the step of unsetting that variable; write nothing yourself"
|
|
18410
18419
|
}
|
|
18411
18420
|
};
|
|
18412
18421
|
repairsOf(globalInstructionTable);
|
|
@@ -27936,18 +27945,35 @@ function importsGlobal(body, bridge, home) {
|
|
|
27936
27945
|
const spellings = bridge.kind === "import" ? [bridge.line, `@${join(home, globalInstructions)}`] : [];
|
|
27937
27946
|
return body.split("\n").some((line) => spellings.includes(line.trim()));
|
|
27938
27947
|
}
|
|
27939
|
-
/**
|
|
27940
|
-
|
|
27948
|
+
/**
|
|
27949
|
+
* Follows `relocatedBy` the way each harness does. An empty value is no value to Codex and Copilot CLI
|
|
27950
|
+
* (E-CODEX-06, E-COPILOT-06), and the directory Claude Code starts in to Claude Code (E-CC-20).
|
|
27951
|
+
*/
|
|
27952
|
+
function base(scope, env, start) {
|
|
27941
27953
|
const variable = scope.relocatedBy;
|
|
27942
|
-
const
|
|
27954
|
+
const value = variable === void 0 ? void 0 : env[variable];
|
|
27955
|
+
if (variable === void 0 || value === void 0) return {};
|
|
27956
|
+
if (value !== "") return { moved: {
|
|
27957
|
+
root: resolve(value),
|
|
27958
|
+
display: `$${variable}`
|
|
27959
|
+
} };
|
|
27960
|
+
return scope.emptyRelocatesToStart ? {
|
|
27961
|
+
moved: {
|
|
27962
|
+
root: start,
|
|
27963
|
+
display: "."
|
|
27964
|
+
},
|
|
27965
|
+
emptied: variable
|
|
27966
|
+
} : {};
|
|
27967
|
+
}
|
|
27968
|
+
function locate(home, scope, { moved }, path) {
|
|
27943
27969
|
if (!moved || path !== scope.detect && !path.startsWith(`${scope.detect}/`)) return {
|
|
27944
27970
|
absolute: join(home, path),
|
|
27945
27971
|
display: `~/${path}`
|
|
27946
27972
|
};
|
|
27947
27973
|
const rest = path.slice(scope.detect.length);
|
|
27948
27974
|
return {
|
|
27949
|
-
absolute: join(
|
|
27950
|
-
display:
|
|
27975
|
+
absolute: join(moved.root, rest),
|
|
27976
|
+
display: `${moved.display}${rest}`
|
|
27951
27977
|
};
|
|
27952
27978
|
}
|
|
27953
27979
|
/** A shadow is read only where it is a file holding more than whitespace (E-CODEX-06). */
|
|
@@ -28007,10 +28033,11 @@ function finding(path, problem, cli) {
|
|
|
28007
28033
|
}
|
|
28008
28034
|
/**
|
|
28009
28035
|
* Whether each harness the user has installed loads `~/.agents/AGENTS.md` through its own user-scope
|
|
28010
|
-
* file, read from wherever `env` moves it
|
|
28011
|
-
*
|
|
28036
|
+
* file, read from wherever `env` moves it — `start`, for a harness that reads an empty variable as
|
|
28037
|
+
* the directory it starts in. Read-only: the repair is handed to the user, since nothing here
|
|
28038
|
+
* writes outside the repository.
|
|
28012
28039
|
*/
|
|
28013
|
-
function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
28040
|
+
function diagnoseGlobalInstructions(home, preferred, cli, env = {}, start = process.cwd()) {
|
|
28014
28041
|
const hasGlobal = exists$1(join(home, globalInstructions));
|
|
28015
28042
|
const rows = [];
|
|
28016
28043
|
const findings = [];
|
|
@@ -28018,10 +28045,11 @@ function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
|
28018
28045
|
const user = harness.user;
|
|
28019
28046
|
const bridge = user?.instructionBridge;
|
|
28020
28047
|
if (!user || !bridge) continue;
|
|
28021
|
-
|
|
28022
|
-
|
|
28048
|
+
const moved = base(user, env, start);
|
|
28049
|
+
if (!preferred.includes(harness.name) && !isDirectory$1(locate(home, user, moved, user.detect).absolute)) continue;
|
|
28050
|
+
const file = locate(home, user, moved, bridge.path);
|
|
28023
28051
|
const inspection = inspect$1(home, file.absolute, bridge);
|
|
28024
|
-
const shadow = (user.shadowedBy ?? []).map((path) => locate(home, user,
|
|
28052
|
+
const shadow = (user.shadowedBy ?? []).map((path) => locate(home, user, moved, path)).find(({ absolute }) => readsAsShadow(absolute));
|
|
28025
28053
|
if (shadow !== void 0) {
|
|
28026
28054
|
const read = inspect$1(home, shadow.absolute, bridge);
|
|
28027
28055
|
if (read.status === "ok") {
|
|
@@ -28046,7 +28074,8 @@ function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
|
28046
28074
|
kind: inspection.kind,
|
|
28047
28075
|
status: inspection.status
|
|
28048
28076
|
});
|
|
28049
|
-
if (hasGlobal &&
|
|
28077
|
+
if (hasGlobal && moved.emptied) findings.push(finding(`$${moved.emptied}`, "global-instructions-emptied", cli));
|
|
28078
|
+
else if (hasGlobal && inspection.problem) findings.push(finding(file.display, inspection.problem, cli));
|
|
28050
28079
|
}
|
|
28051
28080
|
return {
|
|
28052
28081
|
globalInstructions: rows,
|
|
@@ -28472,7 +28501,7 @@ function diagnoseBridges({ root, harnesses: preferred = [], cli, home, env }) {
|
|
|
28472
28501
|
const global = home === void 0 ? {
|
|
28473
28502
|
globalInstructions: [],
|
|
28474
28503
|
findings: []
|
|
28475
|
-
} : diagnoseGlobalInstructions(home, preferred, cli, env);
|
|
28504
|
+
} : diagnoseGlobalInstructions(home, preferred, cli, env, root);
|
|
28476
28505
|
findings.push(...global.findings);
|
|
28477
28506
|
return {
|
|
28478
28507
|
bridges,
|
package/dist/index.d.mts
CHANGED
|
@@ -106,6 +106,11 @@ type HarnessScope = {
|
|
|
106
106
|
* under it is read from the variable's value instead.
|
|
107
107
|
*/
|
|
108
108
|
relocatedBy?: string;
|
|
109
|
+
/**
|
|
110
|
+
* `relocatedBy` set to an empty string is read as the directory the harness starts in, rather
|
|
111
|
+
* than as unset.
|
|
112
|
+
*/
|
|
113
|
+
emptyRelocatesToStart?: true;
|
|
109
114
|
/** Where this harness keeps its own MCP servers; `doctor` compares against it and never writes. */
|
|
110
115
|
mcpConfig?: McpConfig;
|
|
111
116
|
/** What this harness reads that no other can, reported so it can be converted to canonical form. */
|
|
@@ -142,7 +147,8 @@ type GlobalInstructionReport = {
|
|
|
142
147
|
harness: HarnessName;
|
|
143
148
|
/**
|
|
144
149
|
* The harness's user-scope instruction file, written from `~` so the report is publishable, or
|
|
145
|
-
* from the variable that moved it, such as `$CODEX_HOME
|
|
150
|
+
* from the variable that moved it, such as `$CODEX_HOME`, or from `.` where an empty variable moved
|
|
151
|
+
* it to the directory the harness starts in.
|
|
146
152
|
*/
|
|
147
153
|
path: string;
|
|
148
154
|
kind: GlobalInstructionKind;
|
|
@@ -150,10 +156,11 @@ type GlobalInstructionReport = {
|
|
|
150
156
|
};
|
|
151
157
|
/**
|
|
152
158
|
* Whether each harness the user has installed loads `~/.agents/AGENTS.md` through its own user-scope
|
|
153
|
-
* file, read from wherever `env` moves it
|
|
154
|
-
*
|
|
159
|
+
* file, read from wherever `env` moves it — `start`, for a harness that reads an empty variable as
|
|
160
|
+
* the directory it starts in. Read-only: the repair is handed to the user, since nothing here
|
|
161
|
+
* writes outside the repository.
|
|
155
162
|
*/
|
|
156
|
-
export declare function diagnoseGlobalInstructions(home: string, preferred: readonly HarnessName[], cli: string, env?: NodeJS.ProcessEnv): {
|
|
163
|
+
export declare function diagnoseGlobalInstructions(home: string, preferred: readonly HarnessName[], cli: string, env?: NodeJS.ProcessEnv, start?: string): {
|
|
157
164
|
globalInstructions: GlobalInstructionReport[];
|
|
158
165
|
findings: BridgeFinding[];
|
|
159
166
|
};
|
|
@@ -231,7 +238,7 @@ type NonstandardProblem = "nonstandard-instructions" | "nonstandard-rule" | "non
|
|
|
231
238
|
/** Every way a harness can end up reading none of `AGENTS.md`. */
|
|
232
239
|
type InstructionProblem = "no-instructions" | "instructions-missing" | "instructions-unbridged" | "instructions-unreadable" | "instructions-shadowing" | "instructions-superseded";
|
|
233
240
|
/** Every way a harness's user-scope instruction file fails to load `~/.agents/AGENTS.md`. */
|
|
234
|
-
type GlobalInstructionProblem = "global-instructions-missing" | "global-instructions-unbridged" | "global-instructions-overridden";
|
|
241
|
+
type GlobalInstructionProblem = "global-instructions-missing" | "global-instructions-unbridged" | "global-instructions-overridden" | "global-instructions-emptied";
|
|
235
242
|
/** Everything `doctor` can report against, across every section. */
|
|
236
243
|
type DoctorProblem = BridgeProblem | InstructionProblem | GlobalInstructionProblem | ConfigurationFault | McpProblem | NonstandardProblem;
|
|
237
244
|
/** Alias kept for callers that name the whole set rather than one section. */
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/cli.ts","../src/harness-registry/instruction-bridge.ts","../src/diagnose-mcp/mcp-model.ts","../src/mcp-dialects/mcp-dialects.ts","../src/harness-registry/mcp-config.ts","../src/harness-registry/nonstandard-artifact.ts","../src/harness-registry/harness-registry.ts","../src/diagnose-bridges/diagnose-global-instructions.ts","../src/diagnose-bridges/diagnose-instructions.ts","../src/diagnose-bridges/locator.ts","../src/diagnose-bridges/doctor-guidance.ts","../src/diagnose-bridges/git-bridge-state.ts","../src/diagnose-bridges/diagnose-bridges.ts","../src/diagnose-configuration/diagnose-configuration.ts","../src/references/reference-layers.ts","../src/references/reference-document.ts","../src/references/resolve-reference.ts","../src/references/reference-catalog.ts","../src/diagnose-bridges/doctor.command.ts","../src/diagnose-mcp/diagnose-mcp.ts","../src/diagnose-mcp/mcp-baseline.ts","../src/diagnose-mcp/mcp-sources.ts","../src/governance-overrides/governance-overrides.ts","../src/governance-overrides/governance.command.ts","../src/initialize-harnesses/init.command.ts","../src/skill-projection/skill-projection.ts","../src/initialize-harnesses/initialize-harnesses.ts","../src/mcp-inventory/mcp-inventory.ts","../src/references/reference.command.ts"],"mappings":";;;;;;;wBA0CsB,IAAI,iBAAiB;;;;;;;;KCrC/B;;EAGT;;EAEA;;EAEA;;;EAIA;;EAEA;;EAEA;;;EAIA;;EAEA;;;;KCzBS;;KAGA;EACX,YAAY;EACZ;EACA;EACA,MAAM,SAAS;EACf;EACA,UAAU,SAAS;EACnB;EACA;EACA;EACA;;;cAIY;KAaD,mBAAmB;;;KC5BnB;;;KCIA;;EAEX;;EAEA;EACA;;EAEA,SAAS;;EAET;;;;;;;;;KCXW;KAeA;;EAEX;;EAEA;EACA,MAAM;;;;KClBK;;KAiBA;;KAGA;;EAEX;;EAEA;;;;;EAKA,oBAAoB;;EAEpB;;;;;EAKA;;EAEA,YAAY;;EAEZ,uBAAuB;;KAGZ;EACX,MAAM;;EAEN,SAAS;;;;;EAKT,OAAO;;EAEP,aAAa;;;;;;qBA8BD,0BAA0B;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/cli.ts","../src/harness-registry/instruction-bridge.ts","../src/diagnose-mcp/mcp-model.ts","../src/mcp-dialects/mcp-dialects.ts","../src/harness-registry/mcp-config.ts","../src/harness-registry/nonstandard-artifact.ts","../src/harness-registry/harness-registry.ts","../src/diagnose-bridges/diagnose-global-instructions.ts","../src/diagnose-bridges/diagnose-instructions.ts","../src/diagnose-bridges/locator.ts","../src/diagnose-bridges/doctor-guidance.ts","../src/diagnose-bridges/git-bridge-state.ts","../src/diagnose-bridges/diagnose-bridges.ts","../src/diagnose-configuration/diagnose-configuration.ts","../src/references/reference-layers.ts","../src/references/reference-document.ts","../src/references/resolve-reference.ts","../src/references/reference-catalog.ts","../src/diagnose-bridges/doctor.command.ts","../src/diagnose-mcp/diagnose-mcp.ts","../src/diagnose-mcp/mcp-baseline.ts","../src/diagnose-mcp/mcp-sources.ts","../src/governance-overrides/governance-overrides.ts","../src/governance-overrides/governance.command.ts","../src/initialize-harnesses/init.command.ts","../src/skill-projection/skill-projection.ts","../src/initialize-harnesses/initialize-harnesses.ts","../src/mcp-inventory/mcp-inventory.ts","../src/references/reference.command.ts"],"mappings":";;;;;;;wBA0CsB,IAAI,iBAAiB;;;;;;;;KCrC/B;;EAGT;;EAEA;;EAEA;;;EAIA;;EAEA;;EAEA;;;EAIA;;EAEA;;;;KCzBS;;KAGA;EACX,YAAY;EACZ;EACA;EACA,MAAM,SAAS;EACf;EACA,UAAU,SAAS;EACnB;EACA;EACA;EACA;;;cAIY;KAaD,mBAAmB;;;KC5BnB;;;KCIA;;EAEX;;EAEA;EACA;;EAEA,SAAS;;EAET;;;;;;;;;KCXW;KAeA;;EAEX;;EAEA;EACA,MAAM;;;;KClBK;;KAiBA;;KAGA;;EAEX;;EAEA;;;;;EAKA,oBAAoB;;EAEpB;;;;;EAKA;;;;;EAKA;;EAEA,YAAY;;EAEZ,uBAAuB;;KAGZ;EACX,MAAM;;EAEN,SAAS;;;;;EAKT,OAAO;;EAEP,aAAa;;;;;;qBA8BD,0BAA0B;;;;KClF3B;;;;;;KAMA;KAEA;EACX,SAAS;;;;;;EAMT;EACA,MAAM;EACN,QAAQ;;;;;;;;wBAkGO,2BACf,cACA,oBAAoB,eACpB,aACA,MAAK,OAAO,YACZ;EACI,oBAAoB;EAA2B,UAAU;;;;;KCzHlD;;;;;KAKA;KAEA;EACX,SAAS;;EAET;EACA,MAAM;EACN,QAAQ;;;;;;wBA8EO,qBACf,cACA,oBAAoB,WACpB;EACI,cAAc;EAAqB,UAAU;;;;;;;;KCvGtC;EAAa;EAAc;;;;;;KAM3B;;EAEX;;EAEA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kB,cAAc,iBAAiB,oBAAoB;;;;;;wBAcrE,gBAAgB,iBAAiB,oBAAoB;;;;KC9IzD;;;;;EAKX;IAAU,OAAO;IAAiB;IAAc;;;EAEhD;IAAe;IAAc,OAAO;IAAiB;;;;KAI1C;EACX;EACA,OAAO;EACP;EACA;;;qBAwHY,mBAAmB,MAAI;;;qBC5IvB,aAAa,MAAI;qBAoDjB,gBAAgB,MAAI;wBAMjB,WAAW;EAAgB,WAAW,gBAAgB;;;;;;;;KChB1D;;;KC7CA;EACX;EACA,YAAY;EACZ;EACA,QAAQ;;KAEG;EACX;EACA,WAAW;EACX,QAAQ;EACR,QAAQ;;;;;EAKR,SAAS;;EAET;IAAc,MAAM;IAAa,YAAY;;EAC7C;;;;;;EAMA;EACA;;wBAGe,sBACf,MACA,WAAW,WACX,MACA,SACE,oBAAoB;;;;;;;KCzBX,iBAAiB;;KA6DjB;EACX,SAAS;EACT,OAAO;;EAEP;;EAEA;EACA,WAAW;;EAEX;;EAEA;;EAEA;EACA;;EAEA;;KAGW;;EAEX;;EAEA;;;;;EAKA,MAAM,SAAS;;EAEf,WAAW,OAAO;;;;;;;wBAuMH,eAAe,SAAS,wBAAwB;;;;KCvRpD;EACX;EACA,QAAQ;EACR,OAAO;EACP;EACA;EACA;EACA,WAAW;EACX;EACA,SAAS;EACT;EACA;EACA;EACA,QAAQ,KAAK;;KAGF;EACX;IAAU,MAAM;IAAe;IAAgB;IAAc;;;EAE7D,YAAY;EACZ;;KAiCW;EAA0B;EAAe,YAAY;;qBA4YpD,kBAAkB,MAAI"}
|
package/dist/index.mjs
CHANGED
|
@@ -622,6 +622,7 @@ const harnessRegistry = [
|
|
|
622
622
|
detect: ".claude",
|
|
623
623
|
...skillsProjection("claude-code", "user"),
|
|
624
624
|
relocatedBy: "CLAUDE_CONFIG_DIR",
|
|
625
|
+
emptyRelocatesToStart: true,
|
|
625
626
|
instructionBridge: {
|
|
626
627
|
kind: "import",
|
|
627
628
|
path: ".claude/CLAUDE.md",
|
|
@@ -1031,6 +1032,14 @@ const globalInstructionTable = {
|
|
|
1031
1032
|
instruction: `${handOver} move what ${file} says into ${globalFile} and remove it`
|
|
1032
1033
|
}),
|
|
1033
1034
|
skillRepair: () => "hand the user the move of what that file says into the global file, and its removal; write nothing yourself"
|
|
1035
|
+
},
|
|
1036
|
+
"global-instructions-emptied": {
|
|
1037
|
+
detail: "the variable is set but empty, which this harness reads as the directory it starts in rather than as unset — its user-scope file is whichever one sits there, not the one in its own folder",
|
|
1038
|
+
repair: ({ file }) => ({
|
|
1039
|
+
command: "",
|
|
1040
|
+
instruction: `${handOver} unset ${file.slice(1)} where your shell sets it, or set it to the folder you meant`
|
|
1041
|
+
}),
|
|
1042
|
+
skillRepair: () => "hand the user the step of unsetting that variable; write nothing yourself"
|
|
1034
1043
|
}
|
|
1035
1044
|
};
|
|
1036
1045
|
const globalInstructionRepairs = repairsOf(globalInstructionTable);
|
|
@@ -3086,18 +3095,35 @@ function importsGlobal(body, bridge, home) {
|
|
|
3086
3095
|
const spellings = bridge.kind === "import" ? [bridge.line, `@${join(home, globalInstructions)}`] : [];
|
|
3087
3096
|
return body.split("\n").some((line) => spellings.includes(line.trim()));
|
|
3088
3097
|
}
|
|
3089
|
-
/**
|
|
3090
|
-
|
|
3098
|
+
/**
|
|
3099
|
+
* Follows `relocatedBy` the way each harness does. An empty value is no value to Codex and Copilot CLI
|
|
3100
|
+
* (E-CODEX-06, E-COPILOT-06), and the directory Claude Code starts in to Claude Code (E-CC-20).
|
|
3101
|
+
*/
|
|
3102
|
+
function base(scope, env, start) {
|
|
3091
3103
|
const variable = scope.relocatedBy;
|
|
3092
|
-
const
|
|
3104
|
+
const value = variable === void 0 ? void 0 : env[variable];
|
|
3105
|
+
if (variable === void 0 || value === void 0) return {};
|
|
3106
|
+
if (value !== "") return { moved: {
|
|
3107
|
+
root: resolve(value),
|
|
3108
|
+
display: `$${variable}`
|
|
3109
|
+
} };
|
|
3110
|
+
return scope.emptyRelocatesToStart ? {
|
|
3111
|
+
moved: {
|
|
3112
|
+
root: start,
|
|
3113
|
+
display: "."
|
|
3114
|
+
},
|
|
3115
|
+
emptied: variable
|
|
3116
|
+
} : {};
|
|
3117
|
+
}
|
|
3118
|
+
function locate(home, scope, { moved }, path) {
|
|
3093
3119
|
if (!moved || path !== scope.detect && !path.startsWith(`${scope.detect}/`)) return {
|
|
3094
3120
|
absolute: join(home, path),
|
|
3095
3121
|
display: `~/${path}`
|
|
3096
3122
|
};
|
|
3097
3123
|
const rest = path.slice(scope.detect.length);
|
|
3098
3124
|
return {
|
|
3099
|
-
absolute: join(
|
|
3100
|
-
display:
|
|
3125
|
+
absolute: join(moved.root, rest),
|
|
3126
|
+
display: `${moved.display}${rest}`
|
|
3101
3127
|
};
|
|
3102
3128
|
}
|
|
3103
3129
|
/** A shadow is read only where it is a file holding more than whitespace (E-CODEX-06). */
|
|
@@ -3157,10 +3183,11 @@ function finding(path, problem, cli) {
|
|
|
3157
3183
|
}
|
|
3158
3184
|
/**
|
|
3159
3185
|
* Whether each harness the user has installed loads `~/.agents/AGENTS.md` through its own user-scope
|
|
3160
|
-
* file, read from wherever `env` moves it
|
|
3161
|
-
*
|
|
3186
|
+
* file, read from wherever `env` moves it — `start`, for a harness that reads an empty variable as
|
|
3187
|
+
* the directory it starts in. Read-only: the repair is handed to the user, since nothing here
|
|
3188
|
+
* writes outside the repository.
|
|
3162
3189
|
*/
|
|
3163
|
-
function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
3190
|
+
function diagnoseGlobalInstructions(home, preferred, cli, env = {}, start = process.cwd()) {
|
|
3164
3191
|
const hasGlobal = exists$1(join(home, globalInstructions));
|
|
3165
3192
|
const rows = [];
|
|
3166
3193
|
const findings = [];
|
|
@@ -3168,10 +3195,11 @@ function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
|
3168
3195
|
const user = harness.user;
|
|
3169
3196
|
const bridge = user?.instructionBridge;
|
|
3170
3197
|
if (!user || !bridge) continue;
|
|
3171
|
-
|
|
3172
|
-
|
|
3198
|
+
const moved = base(user, env, start);
|
|
3199
|
+
if (!preferred.includes(harness.name) && !isDirectory$1(locate(home, user, moved, user.detect).absolute)) continue;
|
|
3200
|
+
const file = locate(home, user, moved, bridge.path);
|
|
3173
3201
|
const inspection = inspect$1(home, file.absolute, bridge);
|
|
3174
|
-
const shadow = (user.shadowedBy ?? []).map((path) => locate(home, user,
|
|
3202
|
+
const shadow = (user.shadowedBy ?? []).map((path) => locate(home, user, moved, path)).find(({ absolute }) => readsAsShadow(absolute));
|
|
3175
3203
|
if (shadow !== void 0) {
|
|
3176
3204
|
const read = inspect$1(home, shadow.absolute, bridge);
|
|
3177
3205
|
if (read.status === "ok") {
|
|
@@ -3196,7 +3224,8 @@ function diagnoseGlobalInstructions(home, preferred, cli, env = {}) {
|
|
|
3196
3224
|
kind: inspection.kind,
|
|
3197
3225
|
status: inspection.status
|
|
3198
3226
|
});
|
|
3199
|
-
if (hasGlobal &&
|
|
3227
|
+
if (hasGlobal && moved.emptied) findings.push(finding(`$${moved.emptied}`, "global-instructions-emptied", cli));
|
|
3228
|
+
else if (hasGlobal && inspection.problem) findings.push(finding(file.display, inspection.problem, cli));
|
|
3200
3229
|
}
|
|
3201
3230
|
return {
|
|
3202
3231
|
globalInstructions: rows,
|
|
@@ -3622,7 +3651,7 @@ function diagnoseBridges({ root, harnesses: preferred = [], cli, home, env }) {
|
|
|
3622
3651
|
const global = home === void 0 ? {
|
|
3623
3652
|
globalInstructions: [],
|
|
3624
3653
|
findings: []
|
|
3625
|
-
} : diagnoseGlobalInstructions(home, preferred, cli, env);
|
|
3654
|
+
} : diagnoseGlobalInstructions(home, preferred, cli, env, root);
|
|
3626
3655
|
findings.push(...global.findings);
|
|
3627
3656
|
return {
|
|
3628
3657
|
bridges,
|