@uzysjung/agent-harness 26.182.0 → 26.183.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/README.ko.md +2 -2
- package/README.md +2 -2
- package/dist/{chunk-OYXKVPAB.js → chunk-LVDKJMNG.js} +4 -4
- package/dist/chunk-LVDKJMNG.js.map +1 -0
- package/dist/index.js +101 -63
- package/dist/index.js.map +1 -1
- package/dist/trust-tier-drift.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-OYXKVPAB.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ import {
|
|
|
150
150
|
withoutAppleDouble,
|
|
151
151
|
wrapHarnessBlock,
|
|
152
152
|
writeInstallLog
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-LVDKJMNG.js";
|
|
154
154
|
|
|
155
155
|
// node_modules/sisteransi/src/index.js
|
|
156
156
|
var require_src = __commonJS({
|
|
@@ -1229,6 +1229,8 @@ var SHARED_BY_ALL = (self) => [
|
|
|
1229
1229
|
];
|
|
1230
1230
|
var CLI_OWNERSHIP = {
|
|
1231
1231
|
claude: [
|
|
1232
|
+
// #953 (ADR-118) — Codex 의 경로 룰 포인터가 `.claude/rules/` 를 가리킬 수 있다. 이 자리를 지우는 `uninstall --cli claude` 는
|
|
1233
|
+
// `AGENTS.md` 재렌더(인라인)와 묶여 있다(`agentsMdRerenderSet`) — 지우는 길을 더하면 그 재렌더도 함께 묶는다
|
|
1232
1234
|
{ path: ".claude/", kind: "recorded", sharedWith: [] },
|
|
1233
1235
|
{ path: HARNESS_ANCHOR_FILE, kind: "anchor", sharedWith: [] },
|
|
1234
1236
|
{ path: "CLAUDE.md", kind: "import-block", sharedWith: [] },
|
|
@@ -1954,7 +1956,7 @@ function legacyGitignoreSeed(text, render, previous) {
|
|
|
1954
1956
|
// src/installer.ts
|
|
1955
1957
|
init_esm_shims();
|
|
1956
1958
|
import { chmodSync as chmodSync3, existsSync as existsSync20, readdirSync as readdirSync5, readFileSync as readFileSync22, writeFileSync as writeFileSync7 } from "fs";
|
|
1957
|
-
import { basename as basename6, join as join30, relative as
|
|
1959
|
+
import { basename as basename6, join as join30, relative as relative8, resolve, sep as sep9 } from "path";
|
|
1958
1960
|
|
|
1959
1961
|
// src/agents-md-render.ts
|
|
1960
1962
|
init_esm_shims();
|
|
@@ -2137,7 +2139,7 @@ function installCiScaffold(ctx) {
|
|
|
2137
2139
|
// src/cli-transforms.ts
|
|
2138
2140
|
init_esm_shims();
|
|
2139
2141
|
import { existsSync as existsSync15, readFileSync as readFileSync14 } from "fs";
|
|
2140
|
-
import { join as join19 } from "path";
|
|
2142
|
+
import { join as join19, relative as relative4, sep as sep5 } from "path";
|
|
2141
2143
|
|
|
2142
2144
|
// src/agents-md-transform.ts
|
|
2143
2145
|
init_esm_shims();
|
|
@@ -2319,10 +2321,10 @@ function ruleHeadings(harnessRoot) {
|
|
|
2319
2321
|
);
|
|
2320
2322
|
}
|
|
2321
2323
|
var PATH_RULE_POINTER_LEAD = "> \uC544\uB798 \uD30C\uC77C\uC744 \uB9CC\uB4E4\uAC70\uB098 \uACE0\uCE58\uAE30 \uC804\uC5D0 \uADF8 \uB8F0\uC744 \uC77D\uACE0 \uB530\uB978\uB2E4 \u2014 \uBCF8\uBB38\uC740 \uC5EC\uAE30 \uC5C6\uB2E4.";
|
|
2322
|
-
function pathRulePointerLine(rule) {
|
|
2323
|
-
return `> - ${rule.paths.map((p2) => `\`${p2}\``).join(" \xB7 ")} \u2192
|
|
2324
|
+
function pathRulePointerLine(rule, folder) {
|
|
2325
|
+
return `> - ${rule.paths.map((p2) => `\`${p2}\``).join(" \xB7 ")} \u2192 \`${folder}/${rule.name}.md\``;
|
|
2324
2326
|
}
|
|
2325
|
-
var POINTER_TARGET = /^> - .+ →
|
|
2327
|
+
var POINTER_TARGET = /^> - .+ → `((?:\.agents|\.claude)\/rules\/[^`/]+\.md)`$/;
|
|
2326
2328
|
function pathRulePointerTargets(text) {
|
|
2327
2329
|
return text.split("\n").flatMap((l) => POINTER_TARGET.exec(l.replace(/\r$/, ""))?.[1] ?? []);
|
|
2328
2330
|
}
|
|
@@ -2330,10 +2332,15 @@ function renderRulesBlock(rules, pathRulesViaFiles = false) {
|
|
|
2330
2332
|
if (rules.length === 0) return "";
|
|
2331
2333
|
const always = rules.filter((r) => r.paths.length === 0);
|
|
2332
2334
|
const path = rules.filter((r) => r.paths.length > 0);
|
|
2333
|
-
const bodies = (pathRulesViaFiles ? always : [...always, ...path]).map(
|
|
2335
|
+
const bodies = (pathRulesViaFiles !== false ? always : [...always, ...path]).map(
|
|
2334
2336
|
(r) => r.body.replace(/^#\s+/, "## ")
|
|
2335
2337
|
);
|
|
2336
|
-
const pointers = pathRulesViaFiles && path.length > 0 ? [
|
|
2338
|
+
const pointers = pathRulesViaFiles !== false && path.length > 0 ? [
|
|
2339
|
+
[
|
|
2340
|
+
PATH_RULE_POINTER_LEAD,
|
|
2341
|
+
...path.map((r) => pathRulePointerLine(r, pathRulesViaFiles))
|
|
2342
|
+
].join("\n")
|
|
2343
|
+
] : [];
|
|
2337
2344
|
return [...bodies, ...pointers].join("\n\n---\n\n");
|
|
2338
2345
|
}
|
|
2339
2346
|
|
|
@@ -2659,7 +2666,7 @@ function runAgentsMdTransform(params) {
|
|
|
2659
2666
|
),
|
|
2660
2667
|
harnessRules: renderRulesBlock(
|
|
2661
2668
|
portRules(harnessRoot, params.rules),
|
|
2662
|
-
params.pathRulesViaFiles
|
|
2669
|
+
sectionsModel ? params.pathRulesViaFiles : false
|
|
2663
2670
|
),
|
|
2664
2671
|
clis,
|
|
2665
2672
|
rulesViaInstructions: params.rulesViaInstructions && sectionsModel
|
|
@@ -3449,12 +3456,12 @@ function adapterExcluded(harnessRoot, excluded) {
|
|
|
3449
3456
|
}
|
|
3450
3457
|
return out;
|
|
3451
3458
|
}
|
|
3452
|
-
function wroteEveryRule(harnessRoot,
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
);
|
|
3459
|
+
function wroteEveryRule(harnessRoot, folder, written, rules) {
|
|
3460
|
+
return portRules(harnessRoot, rules).every((r) => written.has(`${folder}/${r.name}.md`));
|
|
3461
|
+
}
|
|
3462
|
+
function antigravityRuleWrites(projectDir, report) {
|
|
3463
|
+
if (report === null) return null;
|
|
3464
|
+
return new Set(report.harnessRuleFiles.map((f) => relative4(projectDir, f).split(sep5).join("/")));
|
|
3458
3465
|
}
|
|
3459
3466
|
function mcpSources(harnessRoot) {
|
|
3460
3467
|
return {
|
|
@@ -3583,8 +3590,9 @@ function runCliTransforms(params) {
|
|
|
3583
3590
|
}
|
|
3584
3591
|
let agentsMd = null;
|
|
3585
3592
|
if (agentsSet.length > 0) {
|
|
3586
|
-
const
|
|
3587
|
-
const
|
|
3593
|
+
const agentsRules = params.cumulativeRules ?? rules;
|
|
3594
|
+
const agRules = antigravityRuleWrites(projectDir, antigravity);
|
|
3595
|
+
const wroteAllTo = (folder, written) => written !== null && wroteEveryRule(harnessRoot, folder, written, agentsRules);
|
|
3588
3596
|
agentsMd = runAgentsMdTransform({
|
|
3589
3597
|
harnessRoot,
|
|
3590
3598
|
projectDir,
|
|
@@ -3594,11 +3602,13 @@ function runCliTransforms(params) {
|
|
|
3594
3602
|
// #944 (ADR-116) — 룰 본문 대신 위치 안내는 이번 실행이 OpenCode 의 도달을 **보장했을 때만**(집합이 아니라 쓴 결과로):
|
|
3595
3603
|
// ① Codex ∉ 집합 ② opencode 변환이 이번에 돌았다 ③ Antigravity 가 이번 룰을 전부 `.agents/rules/` 에 썼다 ④ 그 뒤
|
|
3596
3604
|
// 디스크의 `opencode.json` 에 룰 원소가 있다. 하나라도 거짓이면 인라인 — OpenCode 가 룰을 0번 받는 실행은 없다
|
|
3597
|
-
rulesViaInstructions: !agentsSet.includes("codex") && opencode?.rulesViaInstructions === true &&
|
|
3598
|
-
// #948 (ADR-117) — Codex 의 경로 룰은
|
|
3599
|
-
//
|
|
3600
|
-
//
|
|
3601
|
-
|
|
3605
|
+
rulesViaInstructions: !agentsSet.includes("codex") && opencode?.rulesViaInstructions === true && wroteAllTo(".agents/rules", agRules),
|
|
3606
|
+
// #948 (ADR-117) · #953 (ADR-118) — Codex 의 경로 룰은 이번 실행이 쓴 룰 파일을 가리키는 목록으로(실 Codex 포인터 15/15 ·
|
|
3607
|
+
// `.claude/rules/` 4/4): ① Codex ∈ 집합 ② OpenCode ∉ 집합(OpenCode 의 포인터 따르기는 재지 않았다) ③a Antigravity 가 이번 룰
|
|
3608
|
+
// 전부를 `.agents/rules/` 에 썼다 → 그 폴더 ③b 아니면 이번 실행의 하네스 writer(Claude Code 단계 — 이 변환 앞)가 이번 룰 전부를
|
|
3609
|
+
// `.claude/rules/` 에 남겼다 → 그 폴더(④ 절 모델은 변환이 본다). 대조 목록은 렌더하는 `agentsRules`(누적일 수 있다). 하나라도
|
|
3610
|
+
// 거짓이면 인라인 — 포인터는 이번 실행이 실재를 보장한 파일만 가리킨다
|
|
3611
|
+
pathRulesViaFiles: !agentsSet.includes("codex") || agentsSet.includes("opencode") ? false : wroteAllTo(".agents/rules", agRules) ? ".agents/rules" : wroteAllTo(".claude/rules", params.harnessWrote ?? null) ? ".claude/rules" : false,
|
|
3602
3612
|
baseline,
|
|
3603
3613
|
refreshOnly,
|
|
3604
3614
|
// ADR-099 R2 — 기록이 이 파일을 읽는 CLI 를 깔린 것으로 말하면 없어도 만든다(26.164.0 이하 Antigravity 단독 설치본은
|
|
@@ -3702,7 +3712,7 @@ function holdsHarnessBytes(log, projectDir, path, isTarget = recordedTrackTarget
|
|
|
3702
3712
|
|
|
3703
3713
|
// src/harness-slot.ts
|
|
3704
3714
|
init_esm_shims();
|
|
3705
|
-
import { isAbsolute, join as join21, posix as posix2, relative as
|
|
3715
|
+
import { isAbsolute, join as join21, posix as posix2, relative as relative5, sep as sep6 } from "path";
|
|
3706
3716
|
var ownedOf = (...kinds) => [
|
|
3707
3717
|
...new Set(
|
|
3708
3718
|
Object.values(CLI_OWNERSHIP).flat().filter((o) => kinds.includes(o.kind)).map((o) => o.path)
|
|
@@ -3729,9 +3739,9 @@ function realRel(projectDir, norm, follow) {
|
|
|
3729
3739
|
return dir === null ? null : join21(dir, posix2.basename(norm));
|
|
3730
3740
|
})();
|
|
3731
3741
|
if (target === null) return null;
|
|
3732
|
-
const rel =
|
|
3742
|
+
const rel = relative5(resolveWriteTarget(projectDir) ?? projectDir, target);
|
|
3733
3743
|
if (rel === "" || isAbsolute(rel)) return null;
|
|
3734
|
-
const slash = rel.split(
|
|
3744
|
+
const slash = rel.split(sep6).join("/");
|
|
3735
3745
|
return slash === ".." || slash.startsWith("../") ? null : slash;
|
|
3736
3746
|
}
|
|
3737
3747
|
function inSlotByName(path, slots = HARNESS_FILES) {
|
|
@@ -3928,7 +3938,7 @@ import {
|
|
|
3928
3938
|
rmSync as rmSync3
|
|
3929
3939
|
} from "fs";
|
|
3930
3940
|
import { homedir as homedir2 } from "os";
|
|
3931
|
-
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute2, join as join24, relative as
|
|
3941
|
+
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute2, join as join24, relative as relative6, sep as sep7 } from "path";
|
|
3932
3942
|
function outsideSlotNote(o) {
|
|
3933
3943
|
return o.slot !== void 0 ? `${o.slot}/ left as is (links outside the skill folders: ${o.target})` : `${o.root}/ left as is (links outside the project: ${o.target})`;
|
|
3934
3944
|
}
|
|
@@ -4483,12 +4493,12 @@ function reclaimCopy(projectDir, slot, home, ctx) {
|
|
|
4483
4493
|
return res.removed.length > 0 || res.left.length > 0 ? res : null;
|
|
4484
4494
|
}
|
|
4485
4495
|
function inCanonicalSkillRoot(projectDir, real) {
|
|
4486
|
-
const rel =
|
|
4496
|
+
const rel = relative6(realOrNull(projectDir) ?? projectDir, real).split(sep7).join("/");
|
|
4487
4497
|
return SKILL_ROOTS.some((r) => rel.startsWith(`${r}/`));
|
|
4488
4498
|
}
|
|
4489
4499
|
function inProjectSpelling(projectDir, real) {
|
|
4490
|
-
const at2 =
|
|
4491
|
-
return at2 === "" || at2 === ".." || at2.startsWith(`..${
|
|
4500
|
+
const at2 = relative6(realOrNull(projectDir) ?? projectDir, real);
|
|
4501
|
+
return at2 === "" || at2 === ".." || at2.startsWith(`..${sep7}`) || isAbsolute2(at2) ? real : join24(projectDir, at2);
|
|
4492
4502
|
}
|
|
4493
4503
|
function realOrNull(abs) {
|
|
4494
4504
|
try {
|
|
@@ -4614,7 +4624,7 @@ function inSkillFolders(projectDir, slot) {
|
|
|
4614
4624
|
const roots = SKILL_ROOTS.flatMap((r) => {
|
|
4615
4625
|
const real = resolveWriteTarget(join24(projectDir, r));
|
|
4616
4626
|
if (real === null) return [r];
|
|
4617
|
-
const rel =
|
|
4627
|
+
const rel = relative6(base, real).split(sep7).join("/");
|
|
4618
4628
|
return rel === "" || rel === ".." || rel.startsWith("../") || isAbsolute2(rel) ? [r] : [r, rel];
|
|
4619
4629
|
});
|
|
4620
4630
|
const places = [...new Set(roots.map((r) => name === "" ? `${r}/` : `${r}/${name}/`))];
|
|
@@ -4672,7 +4682,7 @@ function pruneEmptyDirs(dir) {
|
|
|
4672
4682
|
}
|
|
4673
4683
|
}
|
|
4674
4684
|
function toProjectRel(projectDir, abs) {
|
|
4675
|
-
return
|
|
4685
|
+
return relative6(projectDir, abs).split(sep7).join("/");
|
|
4676
4686
|
}
|
|
4677
4687
|
function recordRefreshedFiles(projectDir, log, report, displaced, writeLog) {
|
|
4678
4688
|
const next = new Map(
|
|
@@ -5111,7 +5121,7 @@ import {
|
|
|
5111
5121
|
unlinkSync as unlinkSync2,
|
|
5112
5122
|
writeFileSync as writeFileSync6
|
|
5113
5123
|
} from "fs";
|
|
5114
|
-
import { basename as basename5, dirname as dirname7, join as join29, relative as
|
|
5124
|
+
import { basename as basename5, dirname as dirname7, join as join29, relative as relative7, sep as sep8 } from "path";
|
|
5115
5125
|
var LEGACY_ANCHOR_FILE2 = ".claude/CLAUDE.md";
|
|
5116
5126
|
function buildUpdateSpec(projectDir, tracks, only) {
|
|
5117
5127
|
const log = readInstallLog(projectDir);
|
|
@@ -5225,7 +5235,8 @@ function runUpdateMode(projectDir, templatesDir, harnessRoot, deps = {}, only) {
|
|
|
5225
5235
|
harnessRoot,
|
|
5226
5236
|
legacyDroppedKeys(logAtStart),
|
|
5227
5237
|
harnessMcp,
|
|
5228
|
-
report.skillsSkippedLinks.filter((id) => linksToProjectSharedSkill(projectDir, id))
|
|
5238
|
+
report.skillsSkippedLinks.filter((id) => linksToProjectSharedSkill(projectDir, id)),
|
|
5239
|
+
harness.wrote
|
|
5229
5240
|
) : {
|
|
5230
5241
|
externalUpdated: 0,
|
|
5231
5242
|
externalBackedUp: [],
|
|
@@ -5727,7 +5738,7 @@ function updateHarnessFiles(args) {
|
|
|
5727
5738
|
function removedRow(projectDir, path, why, judged, backupAbs) {
|
|
5728
5739
|
const { line, recorded: recorded2 } = judged;
|
|
5729
5740
|
if (backupAbs === null) return { path, verdict: "remove", recorded: recorded2, line: `${why} \u2014 ${line}` };
|
|
5730
|
-
const backup =
|
|
5741
|
+
const backup = relative7(projectDir, backupAbs).split(sep8).join("/");
|
|
5731
5742
|
return {
|
|
5732
5743
|
path,
|
|
5733
5744
|
verdict: "backup+remove",
|
|
@@ -5884,7 +5895,7 @@ function syncHarnessAnchor(projectDir, templatesDir, report, outside, judged, no
|
|
|
5884
5895
|
if (!owned) {
|
|
5885
5896
|
const backup = backupFile(anchor, now);
|
|
5886
5897
|
report.anchorBackedUp = true;
|
|
5887
|
-
const rel =
|
|
5898
|
+
const rel = relative7(projectDir, backup).split(sep8).join("/");
|
|
5888
5899
|
const rec = recorded2?.path === HARNESS_ANCHOR_FILE ? { state: "sha", sha256: recorded2.sha256 } : { state: "no-sha" };
|
|
5889
5900
|
const next = readFileSync21(templateMd, "utf8");
|
|
5890
5901
|
const { line } = judge({ op: "write", kind: "harness", rec, disk: current, next });
|
|
@@ -6058,7 +6069,7 @@ function changedRemoteMcp(writes) {
|
|
|
6058
6069
|
const changed = /* @__PURE__ */ new Set([...mcp.added, ...mcp.replaced ?? []]);
|
|
6059
6070
|
return (mcp.remote ?? []).filter((r) => changed.has(r.name));
|
|
6060
6071
|
}
|
|
6061
|
-
function refreshExternalCli(projectDir, harnessRoot, droppedKeys, harnessMcp, linkedIds) {
|
|
6072
|
+
function refreshExternalCli(projectDir, harnessRoot, droppedKeys, harnessMcp, linkedIds, harnessWrote) {
|
|
6062
6073
|
const log = readInstallLog(projectDir);
|
|
6063
6074
|
const presentBefore = sharedSkillIdsOnDisk(projectDir);
|
|
6064
6075
|
const rulesBefore = /* @__PURE__ */ new Set();
|
|
@@ -6088,7 +6099,9 @@ function refreshExternalCli(projectDir, harnessRoot, droppedKeys, harnessMcp, li
|
|
|
6088
6099
|
recordedClis: log === null ? [] : installedClis(log),
|
|
6089
6100
|
// #761 B-1 — 외부 기록이 아예 없던 옛 판의 산출물은 첫 접촉이 아니라 체크섬 없는 하네스 파일이다(install 과 같은 판정).
|
|
6090
6101
|
// 앞 단계(하네스 파일 쓰기)가 헬퍼만 든 `externalFiles` 를 적어도 같은 답이다 — 헬퍼는 외부 자리로 세지 않는다(B-2)
|
|
6091
|
-
owned: recordedOwner(log)
|
|
6102
|
+
owned: recordedOwner(log),
|
|
6103
|
+
// #953 (ADR-118) — install 과 같은 인자: 이번 실행의 하네스 writer 가 이 변환 앞에서 남긴 경로(`.claude/rules/` 포인터의 근거)
|
|
6104
|
+
harnessWrote
|
|
6092
6105
|
});
|
|
6093
6106
|
const linked = refreshLinkedSkillBodies({
|
|
6094
6107
|
harnessRoot,
|
|
@@ -6208,7 +6221,7 @@ function refreshExternalCli(projectDir, harnessRoot, droppedKeys, harnessMcp, li
|
|
|
6208
6221
|
],
|
|
6209
6222
|
anchorRetired: result.anchorRetired,
|
|
6210
6223
|
retiredCommands: (result.opencode?.retiredCommands ?? []).map(
|
|
6211
|
-
(p2) =>
|
|
6224
|
+
(p2) => relative7(projectDir, p2).split(sep8).join("/")
|
|
6212
6225
|
),
|
|
6213
6226
|
anchorDisplaced,
|
|
6214
6227
|
agentsMd: agentsMdNews(result.agentsMd, agentsMdBefore, priorPaths),
|
|
@@ -6330,7 +6343,7 @@ function runInstall(ctx) {
|
|
|
6330
6343
|
JSON.parse(readFileSync22(settingsPath, "utf8"));
|
|
6331
6344
|
} catch {
|
|
6332
6345
|
throw new Error(
|
|
6333
|
-
`${
|
|
6346
|
+
`${relative8(process.cwd(), settingsPath)} is not valid JSON \u2014 left untouched, so no hooks were wired. Fix or delete that file, then run the install again`
|
|
6334
6347
|
);
|
|
6335
6348
|
}
|
|
6336
6349
|
}
|
|
@@ -6427,6 +6440,9 @@ function runInstallStages(ctx, args) {
|
|
|
6427
6440
|
...manifestSpec,
|
|
6428
6441
|
tracks: [.../* @__PURE__ */ new Set([...(previousLog?.spec.tracks ?? []).filter(isTrack), ...spec.tracks])]
|
|
6429
6442
|
}).filter((r) => !isBaselineExcluded(`.claude/rules/${r}.md`, baselineExcluded)),
|
|
6443
|
+
// #953 (ADR-118) — 위 Claude Code 단계가 이번에 판정해 남긴 경로(같은 writer 의 원장). Codex 의 경로 룰 포인터가 `.claude/rules/`
|
|
6444
|
+
// 를 가리켜도 되는지의 근거다 — claude 를 안 고른 실행은 거기 룰이 없어 인라인이다
|
|
6445
|
+
harnessWrote: new Set(writer.ledger().writes.map((w3) => w3.path)),
|
|
6430
6446
|
// #568 — Codex · OpenCode 의 MCP 서버는 `.mcp.json` 에 쓴 것과 같은 값이다.
|
|
6431
6447
|
mcp: harnessMcp,
|
|
6432
6448
|
previousExternal: previousLog?.externalFiles ?? [],
|
|
@@ -6976,7 +6992,7 @@ function recordInterruptedInstall(ctx, error, run) {
|
|
|
6976
6992
|
const codexTrust = registeredTrust(journal.codexOptIn, ctx.projectDir);
|
|
6977
6993
|
const written = writtenSoFar(ledger, cliFiles, rootFiles, stage.rootImportWritten);
|
|
6978
6994
|
if (codexTrust) written.push(`${codexTrust.configPath} (Codex trust entry for this folder)`);
|
|
6979
|
-
const projectRel = (abs) =>
|
|
6995
|
+
const projectRel = (abs) => relative8(ctx.projectDir, abs).split(sep9).join("/");
|
|
6980
6996
|
const writtenSet = new Set(written);
|
|
6981
6997
|
const backups = [...own.backups, ...journal.backups].map((abs) => {
|
|
6982
6998
|
const original = projectRel(backupOriginal(abs) ?? abs);
|
|
@@ -7158,7 +7174,7 @@ function shellArg(s) {
|
|
|
7158
7174
|
// src/commands/install-render.ts
|
|
7159
7175
|
init_esm_shims();
|
|
7160
7176
|
import { existsSync as existsSync22, readdirSync as readdirSync6, readFileSync as readFileSync24 } from "fs";
|
|
7161
|
-
import { basename as basename8, join as join32, relative as
|
|
7177
|
+
import { basename as basename8, dirname as dirname8, join as join32, relative as relative9, sep as sep10 } from "path";
|
|
7162
7178
|
|
|
7163
7179
|
// src/preset-recommend.ts
|
|
7164
7180
|
init_esm_shims();
|
|
@@ -7516,7 +7532,16 @@ function rulesInsideAgentsMd(spec, cost) {
|
|
|
7516
7532
|
...cost,
|
|
7517
7533
|
rules: outside.reduce((sum, f) => sum + fileTokens(f), 0),
|
|
7518
7534
|
rulesInline: rendered ? "rendered" : "planned",
|
|
7519
|
-
...outside.length > 0 ? {
|
|
7535
|
+
...outside.length > 0 ? {
|
|
7536
|
+
rulesOutside: {
|
|
7537
|
+
count: outside.length,
|
|
7538
|
+
dir: [
|
|
7539
|
+
...new Set(
|
|
7540
|
+
outside.map((f) => relative9(spec.projectDir, dirname8(f)).split(sep10).join("/"))
|
|
7541
|
+
)
|
|
7542
|
+
].join(" \xB7 ")
|
|
7543
|
+
}
|
|
7544
|
+
} : {},
|
|
7520
7545
|
contextNote: "whole file, incl. your text"
|
|
7521
7546
|
});
|
|
7522
7547
|
}
|
|
@@ -7524,7 +7549,7 @@ function pointedRuleFiles(spec) {
|
|
|
7524
7549
|
if (!rulesInline(spec)) return [];
|
|
7525
7550
|
const agents = join32(spec.projectDir, "AGENTS.md");
|
|
7526
7551
|
if (!existsSync22(agents)) return [];
|
|
7527
|
-
return pathRulePointerTargets(readFileSync24(agents, "utf8")).map((
|
|
7552
|
+
return pathRulePointerTargets(readFileSync24(agents, "utf8")).map((rel) => join32(spec.projectDir, rel)).filter((f) => existsSync22(f));
|
|
7528
7553
|
}
|
|
7529
7554
|
function rulesInline(spec) {
|
|
7530
7555
|
if (!spec.cli.includes("codex") && !spec.cli.includes("opencode")) return false;
|
|
@@ -8590,7 +8615,7 @@ function renderInterruptedInstall(err, e2, cwd = process.cwd()) {
|
|
|
8590
8615
|
}
|
|
8591
8616
|
const { path, error } = e2.record;
|
|
8592
8617
|
err(
|
|
8593
|
-
path !== null ? ` Already in place before it stopped \u2014 recorded in ${
|
|
8618
|
+
path !== null ? ` Already in place before it stopped \u2014 recorded in ${relative9(cwd, path) || path}:` : " Already in place before it stopped:"
|
|
8594
8619
|
);
|
|
8595
8620
|
for (const [key, n] of groups) {
|
|
8596
8621
|
err(` ${key.endsWith("/") ? `${key} (${n} file${n === 1 ? "" : "s"})` : key}`);
|
|
@@ -9064,7 +9089,7 @@ import {
|
|
|
9064
9089
|
statSync as statSync4,
|
|
9065
9090
|
writeFileSync as writeFileSync8
|
|
9066
9091
|
} from "fs";
|
|
9067
|
-
import { dirname as
|
|
9092
|
+
import { dirname as dirname9, join as join34, relative as relative10, resolve as resolve4, sep as sep11 } from "path";
|
|
9068
9093
|
|
|
9069
9094
|
// src/track-removal.ts
|
|
9070
9095
|
init_esm_shims();
|
|
@@ -10891,9 +10916,7 @@ function uninstallAction(options, deps = {}) {
|
|
|
10891
10916
|
}
|
|
10892
10917
|
const blocked = unwritablePaths({ projectDir, installLog, targetAssets, selectedIds });
|
|
10893
10918
|
if (blocked.length > 0) {
|
|
10894
|
-
|
|
10895
|
-
for (const p2 of blocked) err(c.dim(` \xB7 ${p2 === "." ? "the project folder" : p2}`));
|
|
10896
|
-
err(c.dim(" Fix the permissions, then run the same command again."));
|
|
10919
|
+
reportUnwritable(blocked, err);
|
|
10897
10920
|
exit(1);
|
|
10898
10921
|
return;
|
|
10899
10922
|
}
|
|
@@ -11009,7 +11032,7 @@ function unwritablePaths(ctx) {
|
|
|
11009
11032
|
if (!safeExists(abs)) return;
|
|
11010
11033
|
const real = safeRealpath(abs);
|
|
11011
11034
|
if (real !== null && isOutsideProject(projectDir, real)) return;
|
|
11012
|
-
need.add(
|
|
11035
|
+
need.add(dirname9(path));
|
|
11013
11036
|
};
|
|
11014
11037
|
for (const a of project)
|
|
11015
11038
|
if (a.method === "skill") for (const f of a.files ?? []) parentOf(f.path);
|
|
@@ -11025,7 +11048,10 @@ function unwritablePaths(ctx) {
|
|
|
11025
11048
|
for (const f of installLog.rootFiles ?? []) if (f.change === "displaced") parentOf(f.path);
|
|
11026
11049
|
if (hasRootImport(projectDir)) need.add("CLAUDE.md");
|
|
11027
11050
|
}
|
|
11028
|
-
return [...need]
|
|
11051
|
+
return notWritable(projectDir, [...need]);
|
|
11052
|
+
}
|
|
11053
|
+
function notWritable(projectDir, paths) {
|
|
11054
|
+
return paths.filter((p2) => {
|
|
11029
11055
|
try {
|
|
11030
11056
|
accessSync2(join34(projectDir, p2), fsConstants2.W_OK);
|
|
11031
11057
|
return false;
|
|
@@ -11034,6 +11060,11 @@ function unwritablePaths(ctx) {
|
|
|
11034
11060
|
}
|
|
11035
11061
|
});
|
|
11036
11062
|
}
|
|
11063
|
+
function reportUnwritable(blocked, err) {
|
|
11064
|
+
err(status.failure(c.red("ERROR: uninstall cannot write here \u2014 nothing was removed:")));
|
|
11065
|
+
for (const p2 of blocked) err(c.dim(` \xB7 ${p2 === "." ? "the project folder" : p2}`));
|
|
11066
|
+
err(c.dim(" Fix the permissions, then run the same command again."));
|
|
11067
|
+
}
|
|
11037
11068
|
function safeExists(abs) {
|
|
11038
11069
|
try {
|
|
11039
11070
|
lstatSync8(abs);
|
|
@@ -11387,8 +11418,7 @@ function keptForRemainingLines(plan, preview) {
|
|
|
11387
11418
|
function displayNames(clis) {
|
|
11388
11419
|
return clis.map((c3) => CLI_DISPLAY_NAMES[c3]).join(" \xB7 ");
|
|
11389
11420
|
}
|
|
11390
|
-
function agentsMdRerenderSet(
|
|
11391
|
-
if (target !== null && !isAgentsMdCli(target)) return null;
|
|
11421
|
+
function agentsMdRerenderSet(remaining, log, projectDir) {
|
|
11392
11422
|
const set = agentsMdClis(remaining);
|
|
11393
11423
|
if (set.length === 0) return null;
|
|
11394
11424
|
const recorded2 = (log.externalFiles ?? []).some((f) => f.path === AGENTS_MD2) || (log.portions ?? []).some((p2) => p2.path === AGENTS_MD2);
|
|
@@ -11505,6 +11535,14 @@ function runScopedRemoval(ctx, io, plan) {
|
|
|
11505
11535
|
""
|
|
11506
11536
|
];
|
|
11507
11537
|
for (const line of header) io.log(line);
|
|
11538
|
+
if (!preview && plan.rerenderSet !== null) {
|
|
11539
|
+
const blocked = notWritable(projectDir, [AGENTS_MD2]);
|
|
11540
|
+
if (blocked.length > 0) {
|
|
11541
|
+
reportUnwritable(blocked, io.err);
|
|
11542
|
+
io.exit(1);
|
|
11543
|
+
return;
|
|
11544
|
+
}
|
|
11545
|
+
}
|
|
11508
11546
|
const done = removeHarnessFiles(installLog, projectDir, plan.scope, {
|
|
11509
11547
|
rm: preview ? () => {
|
|
11510
11548
|
} : io.rm,
|
|
@@ -11576,7 +11614,7 @@ function removeCliAction(ctx, io) {
|
|
|
11576
11614
|
...keptForRemainingLines(plan, preview),
|
|
11577
11615
|
...assetsLeftLines(installLog, projectDir, plan.scope)
|
|
11578
11616
|
],
|
|
11579
|
-
rerenderSet: agentsMdRerenderSet(
|
|
11617
|
+
rerenderSet: agentsMdRerenderSet(remaining, installLog, projectDir),
|
|
11580
11618
|
settle: (done) => settleCliLog(ctx, target, remaining, done, done.anchor.removed)
|
|
11581
11619
|
});
|
|
11582
11620
|
}
|
|
@@ -11598,7 +11636,7 @@ function removeTrackAction(ctx, io) {
|
|
|
11598
11636
|
remaining: removal.remaining,
|
|
11599
11637
|
scope: { ...TRACK_SCOPE, has: removal.has },
|
|
11600
11638
|
leftLines: (preview, done) => preview ? trackNotes(ctx, removal, done, false).map((l) => ` \u25CB ${l}`) : trackNotes(ctx, removal, done, true),
|
|
11601
|
-
rerenderSet: agentsMdRerenderSet(
|
|
11639
|
+
rerenderSet: agentsMdRerenderSet(installedClis(installLog), installLog, projectDir),
|
|
11602
11640
|
settle: (done) => settleTrackLog(ctx, target, removal.remaining, done)
|
|
11603
11641
|
});
|
|
11604
11642
|
}
|
|
@@ -11994,7 +12032,7 @@ function removeHarnessFiles(log, projectDir, scope, io) {
|
|
|
11994
12032
|
write: io.write
|
|
11995
12033
|
});
|
|
11996
12034
|
if (io.write) {
|
|
11997
|
-
for (const p2 of pruneFrom) pruneEmptyDirsUpward(projectDir,
|
|
12035
|
+
for (const p2 of pruneFrom) pruneEmptyDirsUpward(projectDir, dirname9(join34(projectDir, p2)));
|
|
11998
12036
|
for (const d2 of scope.skeleton) {
|
|
11999
12037
|
const abs = join34(projectDir, d2);
|
|
12000
12038
|
if (outsideProjectTarget(projectDir, abs) !== null) continue;
|
|
@@ -12102,7 +12140,7 @@ function removeRecordedFile(path, ctx) {
|
|
|
12102
12140
|
if (verdict.verdict !== "remove" && verdict.verdict !== "backup+remove") return;
|
|
12103
12141
|
let backup = null;
|
|
12104
12142
|
if (verdict.verdict === "backup+remove") {
|
|
12105
|
-
backup = io.write ?
|
|
12143
|
+
backup = io.write ? relative10(projectDir, backupFile(effective)).split(sep11).join("/") : `${relative10(projectDir, effective).split(sep11).join("/")}.backup-<time>`;
|
|
12106
12144
|
}
|
|
12107
12145
|
if (io.write) {
|
|
12108
12146
|
if (effective !== abs) io.rm(abs);
|
|
@@ -12515,7 +12553,7 @@ function removeAnchor(log, projectDir, io) {
|
|
|
12515
12553
|
]
|
|
12516
12554
|
};
|
|
12517
12555
|
}
|
|
12518
|
-
const backup = edited ?
|
|
12556
|
+
const backup = edited ? relative10(projectDir, backupFile(abs)).split(sep11).join("/") : null;
|
|
12519
12557
|
io.rm(abs);
|
|
12520
12558
|
return {
|
|
12521
12559
|
removed: true,
|
|
@@ -12578,7 +12616,7 @@ function removeLegacyAgentsMd(path, abs, effective, strip, ctx) {
|
|
|
12578
12616
|
let backup = `${path}.backup-<time>`;
|
|
12579
12617
|
try {
|
|
12580
12618
|
if (io.write) {
|
|
12581
|
-
backup =
|
|
12619
|
+
backup = relative10(projectDir, backupFile(effective)).split(sep11).join("/");
|
|
12582
12620
|
if (strip.remainder !== null) {
|
|
12583
12621
|
writeFileSync8(effective, neutralizeScaffoldBanner(strip.remainder), "utf8");
|
|
12584
12622
|
} else {
|
|
@@ -12756,7 +12794,7 @@ function removeToolFiles(files, projectDir, rm) {
|
|
|
12756
12794
|
try {
|
|
12757
12795
|
if (hashContent(readFileSync26(abs, "utf8")) !== sha256) {
|
|
12758
12796
|
const backup = backupFile(abs);
|
|
12759
|
-
notes.push(`backed up ${path} \u2192 ${
|
|
12797
|
+
notes.push(`backed up ${path} \u2192 ${relative10(projectDir, backup)} (changed since install)`);
|
|
12760
12798
|
}
|
|
12761
12799
|
rm(abs);
|
|
12762
12800
|
removed.push(path);
|
|
@@ -12765,21 +12803,21 @@ function removeToolFiles(files, projectDir, rm) {
|
|
|
12765
12803
|
notes.push(`left ${path} \u2014 ${e2 instanceof Error ? e2.message : String(e2)}`);
|
|
12766
12804
|
}
|
|
12767
12805
|
}
|
|
12768
|
-
for (const path of removed) pruneEmptyDirsUpward(projectDir,
|
|
12806
|
+
for (const path of removed) pruneEmptyDirsUpward(projectDir, dirname9(join34(projectDir, path)));
|
|
12769
12807
|
return failed > 0 ? { ok: false, message: `${failed} file(s) could not be removed`, notes } : { ok: true, notes };
|
|
12770
12808
|
}
|
|
12771
12809
|
function pruneEmptyDirsUpward(projectDir, startDir) {
|
|
12772
12810
|
let cursor = startDir;
|
|
12773
12811
|
while (true) {
|
|
12774
|
-
const rel =
|
|
12775
|
-
if (rel === "" || rel.startsWith(`..${
|
|
12812
|
+
const rel = relative10(projectDir, cursor);
|
|
12813
|
+
if (rel === "" || rel.startsWith(`..${sep11}`) || rel === "..") return;
|
|
12776
12814
|
try {
|
|
12777
12815
|
if (readdirSync7(cursor).length > 0) return;
|
|
12778
12816
|
rmdirSync3(cursor);
|
|
12779
12817
|
} catch {
|
|
12780
12818
|
return;
|
|
12781
12819
|
}
|
|
12782
|
-
cursor =
|
|
12820
|
+
cursor = dirname9(cursor);
|
|
12783
12821
|
}
|
|
12784
12822
|
}
|
|
12785
12823
|
function stripRootImport(projectDir) {
|