@adamchanadam/agent-handoff-kit 0.3.42 → 0.3.43
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.en.md +81 -0
- package/README.md +5 -3
- package/bin/agent-handoff-kit.mjs +45 -12
- package/bin/installed-file-contract.mjs +74 -74
- package/bin/migration-baselines/official-origin-catalog.json +10039 -10039
- package/bin/official-origin-catalog.mjs +74 -74
- package/bin/semantic-candidate.mjs +594 -594
- package/bin/upgrade-inventory.mjs +587 -587
- package/bin/user-rules-router.mjs +461 -461
- package/package.json +20 -20
- package/packs/closeout.md +15 -15
- package/packs/communication.md +8 -8
- package/packs/onboarding.md +1 -1
- package/runtime-core/AGENTS.core.md +8 -8
- package/runtime-core/PROJECT_INDEX.md +1 -1
- package/runtime-core/SESSION_HANDOFF.md +12 -12
- package/runtime-core/START_NEXT_SESSION_PROMPT.txt +1 -1
- package/runtime-core/USER_RULES.md +30 -30
- package/runtime-core/USER_RULES_ENTRY.md +7 -7
package/README.en.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Agent Handoff Kit
|
|
2
|
+
|
|
3
|
+
[繁體中文](README.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
|
|
4
|
+
|
|
5
|
+
Current candidate: `v0.3.43` (not published). The currently published npm release is `v0.3.42`.
|
|
6
|
+
|
|
7
|
+
Agent Handoff Kit is a small continuity layer for local AI agents. It gives the next AI conversation an honest, readable project handoff: what happened, what matters next, what must not be broken, and which project files are authoritative.
|
|
8
|
+
|
|
9
|
+
It is for AI tools that can read and write your local project folder. It is not a prompt for ordinary web-chat AI that cannot access that folder.
|
|
10
|
+
|
|
11
|
+
## Start in three steps
|
|
12
|
+
|
|
13
|
+
1. Open an AI agent in the folder you want to work in and send it this message:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
Read https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html and install or upgrade Agent Handoff Kit in this folder.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. After installation, say `Start Agent Handoff` or `開工` to that AI.
|
|
20
|
+
3. When you are genuinely ending the session, say `wrap up` or `收工`.
|
|
21
|
+
|
|
22
|
+
You do not need to decide whether this is an install, upgrade, health check, or conflict. The AI must first show the folder it sees and ask for confirmation before it writes. Existing AI files such as `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md` are inspected rather than silently overwritten.
|
|
23
|
+
|
|
24
|
+
## Choose an entry point
|
|
25
|
+
|
|
26
|
+
| Page | What it is for |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| [This README](README.en.md) | Product purpose, safe use, and boundaries. |
|
|
29
|
+
| [60-second introduction](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) | A non-technical overview. |
|
|
30
|
+
| [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) | Three everyday scenarios from installation to handoff. |
|
|
31
|
+
| [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html) | The precise instructions an AI uses to install, upgrade, or stop safely. |
|
|
32
|
+
|
|
33
|
+
## What problem it solves
|
|
34
|
+
|
|
35
|
+
Long-running AI work usually fails at the boundaries between conversations:
|
|
36
|
+
|
|
37
|
+
| Problem | What the kit does |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| The next AI does not know the current state | Keeps a current handoff with objective, risks, validation, and next action. |
|
|
40
|
+
| New documents become disconnected | Routes important documents through the project index and rule packs. |
|
|
41
|
+
| A session ends without a usable handoff | A real closeout records the result and refreshes the next-session prompt. |
|
|
42
|
+
| An upgrade overwrites local material | Only exact, artifact-identified Kit content is replaceable; non-exact content is preserved or causes a safe stop. |
|
|
43
|
+
| A health check says success but gives contradictory advice | Doctor reads the same verified accepted state as the transaction, report, and success result. |
|
|
44
|
+
|
|
45
|
+
## What an upgrade promises
|
|
46
|
+
|
|
47
|
+
An upgrade must not trade safety for convenience. It must preserve user and user-AI content, update only exact Kit-managed bytes, keep effective rules reachable through the normal runtime entry, and recover to a complete old or complete new state if interrupted.
|
|
48
|
+
|
|
49
|
+
The published upgrade path is checked with a previous-version artifact, direct user rules in `AGENTS.md`, fresh formal user rules, repeated upgrades, bytes drift, and recovery. If ownership cannot be proved exactly, the tool must not guess from a title, language, location, or formatting.
|
|
50
|
+
|
|
51
|
+
## Everyday use
|
|
52
|
+
|
|
53
|
+
Use ordinary language. Examples:
|
|
54
|
+
|
|
55
|
+
- `Start Agent Handoff`
|
|
56
|
+
- `Help me review this proposal and keep the project handoff current.`
|
|
57
|
+
- `Please connect docs/research-notes.md to Agent Handoff Kit.`
|
|
58
|
+
- `wrap up`
|
|
59
|
+
|
|
60
|
+
A bare `Start Agent Handoff` or `開工` restores the minimum current state, shows the startup card and recommended next action, then stops. It does not authorize the AI to begin research, planning, QA, packaging, or file edits on its own. To continue work immediately, say so in the same message, for example: `Start Agent Handoff, continue the current task.`
|
|
61
|
+
|
|
62
|
+
## Technical boundary
|
|
63
|
+
|
|
64
|
+
The npm package contains only the runtime files needed by a project: the CLI, runtime core, and rule packs. Public source documentation and release QA live in the source repository and are deliberately not installed into user projects.
|
|
65
|
+
|
|
66
|
+
For manual terminal use, the canonical commands are:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
npx --yes @adamchanadam/agent-handoff-kit@latest init
|
|
70
|
+
npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run
|
|
71
|
+
npx --yes @adamchanadam/agent-handoff-kit@latest doctor
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`upgrade --dry-run` is only a preview. It is not a completed upgrade.
|
|
75
|
+
|
|
76
|
+
## Links
|
|
77
|
+
|
|
78
|
+
- [GitHub repository](https://github.com/Adamchanadam/agent-handoff-kit)
|
|
79
|
+
- [npm package](https://www.npmjs.com/package/@adamchanadam/agent-handoff-kit)
|
|
80
|
+
- [Traditional Chinese README](README.md)
|
|
81
|
+
- [License](LICENSE)
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# Agent Handoff Kit
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Agent Handoff Kit
|
|
2
|
+
|
|
3
|
+
English: [README.en.md](README.en.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
|
|
4
|
+
|
|
5
|
+
目前候選版本:`v0.3.43`(尚未發佈);正式可用版本仍是 `v0.3.42`。
|
|
4
6
|
|
|
5
7
|
<p align="center">
|
|
6
8
|
<img src="https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif" alt="Agent Handoff Kit 功能簡介動畫" width="720">
|
|
@@ -2186,10 +2186,14 @@ async function runDoctor(root, version, options = {}) {
|
|
|
2186
2186
|
// R-031.2 v0.3.2+: 項目狀態速覽 —— 三向 version 對比 + 距上次 closeout 幾耐 +
|
|
2187
2187
|
// 項目首次安裝距今幾耐。從用戶跑 doctor 嗰刻嘅 mental state 出發(confirm health /
|
|
2188
2188
|
// suspect drift / curious about version / continuity awareness),唔等用戶 ask AI。
|
|
2189
|
-
console.log("");
|
|
2190
|
-
console.log("項目狀態速覽:");
|
|
2189
|
+
console.log("");
|
|
2190
|
+
console.log("項目狀態速覽:");
|
|
2191
2191
|
const versionAlignment = await assessVersionAlignment(root, version, {
|
|
2192
|
-
skipRegistryLookup: options.skipVersionRegistryLookup === true
|
|
2192
|
+
skipRegistryLookup: options.skipVersionRegistryLookup === true,
|
|
2193
|
+
// checkCurrentStateWitness above has freshly verified both the journal
|
|
2194
|
+
// identity and active bytes. Only that verified transaction target may
|
|
2195
|
+
// speak for a preserved project's current product state.
|
|
2196
|
+
acceptedVersion: currentStateWitness?.transaction?.attemptedVersion ?? null
|
|
2193
2197
|
});
|
|
2194
2198
|
printVersionAlignment(versionAlignment);
|
|
2195
2199
|
const versionNextStep = getVersionAlignmentNextStep(versionAlignment);
|
|
@@ -6162,12 +6166,29 @@ async function assessVersionAlignment(root, cliVersion, options = {}) {
|
|
|
6162
6166
|
}
|
|
6163
6167
|
}
|
|
6164
6168
|
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6169
|
+
const acceptedVersion = isStableSemver(options.acceptedVersion ?? "")
|
|
6170
|
+
? options.acceptedVersion
|
|
6171
|
+
: null;
|
|
6172
|
+
return { cliVersion, rootVersion, npmLatest, acceptedVersion };
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
function printVersionAlignment(result) {
|
|
6176
|
+
const { cliVersion, rootVersion, npmLatest, acceptedVersion } = result;
|
|
6177
|
+
if (acceptedVersion !== null) {
|
|
6178
|
+
const metadata = rootVersion === null ? "項目版本記錄缺失" : `項目記錄 v${rootVersion}${rootVersion === acceptedVersion ? "" : "(保留資料)"}`;
|
|
6179
|
+
console.log(` 📦 版本:工具 v${cliVersion} / 已接受目前狀態 v${acceptedVersion} / ${metadata} / npm latest ${npmLatest ? "v" + npmLatest : "無法查詢"}`);
|
|
6180
|
+
if (compareSemver(acceptedVersion, cliVersion) < 0) {
|
|
6181
|
+
console.log(` 項目已接受的狀態是 v${acceptedVersion},目前工具是 v${cliVersion};要升級時先執行:npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run`);
|
|
6182
|
+
} else if (compareSemver(acceptedVersion, cliVersion) > 0) {
|
|
6183
|
+
console.log(` 項目已接受的狀態比目前工具新;請先用較新的工具執行 doctor 或 upgrade,不會用舊工具把項目降級。`);
|
|
6184
|
+
}
|
|
6185
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6186
|
+
console.log(` npm 有新版(v${npmLatest});doctor 只檢查不修改。要使用最新版時先執行:npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run`);
|
|
6187
|
+
console.log(" --dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。");
|
|
6188
|
+
}
|
|
6189
|
+
return;
|
|
6190
|
+
}
|
|
6191
|
+
if (rootVersion === null) {
|
|
6171
6192
|
console.log(` 📦 版本:工具 v${cliVersion} / 項目版本記錄缺失(可能曾經手動編輯)/ npm latest ${npmLatest ? "v" + npmLatest : "無法查詢"}`);
|
|
6172
6193
|
return;
|
|
6173
6194
|
}
|
|
@@ -6190,9 +6211,21 @@ function printVersionAlignment(result) {
|
|
|
6190
6211
|
}
|
|
6191
6212
|
}
|
|
6192
6213
|
|
|
6193
|
-
function getVersionAlignmentNextStep(result) {
|
|
6194
|
-
const { cliVersion, rootVersion, npmLatest } = result;
|
|
6195
|
-
if (
|
|
6214
|
+
function getVersionAlignmentNextStep(result) {
|
|
6215
|
+
const { cliVersion, rootVersion, npmLatest, acceptedVersion } = result;
|
|
6216
|
+
if (acceptedVersion !== null) {
|
|
6217
|
+
if (compareSemver(acceptedVersion, cliVersion) > 0) {
|
|
6218
|
+
return `檢查已通過,但項目已接受的狀態是 v${acceptedVersion},比目前工具 v${cliVersion} 新。請先使用較新的工具;doctor 不會用舊工具把項目降級。`;
|
|
6219
|
+
}
|
|
6220
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6221
|
+
return `檢查已通過,npm 有新版 v${npmLatest}。doctor 沒有修改檔案;要升級時先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。`;
|
|
6222
|
+
}
|
|
6223
|
+
if (compareSemver(acceptedVersion, cliVersion) < 0) {
|
|
6224
|
+
return `檢查已通過,但項目已接受的狀態仍是 v${acceptedVersion},目前工具是 v${cliVersion}。doctor 沒有修改檔案;要升級時先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認後再去掉 --dry-run 正式升級。`;
|
|
6225
|
+
}
|
|
6226
|
+
return null;
|
|
6227
|
+
}
|
|
6228
|
+
if (npmLatest && compareSemver(npmLatest, cliVersion) > 0) {
|
|
6196
6229
|
return `檢查已通過,但 npm 有新版 v${npmLatest}。doctor 沒有修改檔案;建議先執行 npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run。--dry-run 只預覽、不寫入;確認計劃沒問題後,再去掉 --dry-run 正式升級。`;
|
|
6197
6230
|
}
|
|
6198
6231
|
if (rootVersion === null) {
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
// Single source of truth for the historical files Agent Handoff Kit installs
|
|
2
|
-
// and upgrades. Fresh-only files are declared separately so their new path
|
|
3
|
-
// cannot silently become legacy ownership or upgrade evidence.
|
|
4
|
-
|
|
5
|
-
export const INSTALLED_FILE_CONTRACT_SCHEMA = 1;
|
|
6
|
-
|
|
7
|
-
export const installedFileContracts = Object.freeze([
|
|
8
|
-
contract("runtime-core/AGENTS.core.md", "AGENTS.md", "managed-core"),
|
|
9
|
-
contract("runtime-core/CLAUDE.md", "CLAUDE.md", "strict-bridge"),
|
|
10
|
-
contract("runtime-core/GEMINI.md", "GEMINI.md", "strict-bridge"),
|
|
11
|
-
contract("runtime-core/START_NEXT_SESSION_PROMPT.txt", "START_NEXT_SESSION_PROMPT.txt", "generated-state"),
|
|
12
|
-
contract("runtime-core/SESSION_HANDOFF.md", "dev/SESSION_HANDOFF.md", "stateful-handoff"),
|
|
13
|
-
contract("runtime-core/SESSION_LOG.md", "dev/SESSION_LOG.md", "stateful-log"),
|
|
14
|
-
contract("runtime-core/PROJECT_INDEX.md", "dev/PROJECT_INDEX.md", "stateful-index"),
|
|
15
|
-
contract("runtime-core/DOC_SYNC_REGISTRY.md", "dev/DOC_SYNC_REGISTRY.md", "stateful-registry"),
|
|
16
|
-
contract("runtime-core/RULE_PACKS.md", "dev/RULE_PACKS.md", "marked-routing-table"),
|
|
17
|
-
contract("runtime-core/PROJECT_DECISIONS.md", "dev/PROJECT_DECISIONS.md", "stateful-decisions"),
|
|
18
|
-
contract("packs/safety.md", "dev/rules/safety.md", "rule-pack"),
|
|
19
|
-
contract("packs/coding.md", "dev/rules/coding.md", "rule-pack"),
|
|
20
|
-
contract("packs/writing.md", "dev/rules/writing.md", "rule-pack"),
|
|
21
|
-
contract("packs/research.md", "dev/rules/research.md", "rule-pack"),
|
|
22
|
-
contract("packs/agent-governance.md", "dev/rules/agent-governance.md", "rule-pack"),
|
|
23
|
-
contract("packs/release.md", "dev/rules/release.md", "rule-pack"),
|
|
24
|
-
contract("packs/knowledge.md", "dev/rules/knowledge.md", "rule-pack"),
|
|
25
|
-
contract("packs/communication.md", "dev/rules/communication.md", "rule-pack"),
|
|
26
|
-
contract("packs/closeout.md", "dev/rules/closeout.md", "rule-pack"),
|
|
27
|
-
contract("packs/onboarding.md", "dev/rules/onboarding.md", "rule-pack"),
|
|
28
|
-
contract("packs/integrations.md", "dev/rules/integrations.md", "rule-pack")
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
export const installedMappings = Object.freeze(
|
|
32
|
-
installedFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// The router is installed on fresh roots, but is not evidence that an arbitrary
|
|
36
|
-
// legacy or mixed file is Kit-managed. Its upgrade treatment lives in a
|
|
37
|
-
// separate, state-bound transition contract below rather than the historical
|
|
38
|
-
// file catalog.
|
|
39
|
-
export const freshInstallFileContracts = Object.freeze([
|
|
40
|
-
...installedFileContracts,
|
|
41
|
-
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "fresh-user-router")
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
export const freshInstallMappings = Object.freeze(
|
|
45
|
-
freshInstallFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
// R-034: formal user-rule state is part of an upgrade only when the existing
|
|
49
|
-
// AGENTS.md entry and router form one verifiable formal state. This separate
|
|
50
|
-
// contract deliberately does not reclassify a path, title, or directory as
|
|
51
|
-
// historical Kit ownership.
|
|
52
|
-
export const upgradeStateFileContracts = Object.freeze([
|
|
53
|
-
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "accepted-user-rules-router")
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
export const upgradeStateMappings = Object.freeze(
|
|
57
|
-
upgradeStateFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
export const upgradeStateTargets = Object.freeze(
|
|
61
|
-
upgradeStateFileContracts.map(({ targetRel }) => targetRel)
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
export const requiredInstalledTargets = Object.freeze(
|
|
65
|
-
installedFileContracts.map(({ targetRel }) => targetRel)
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export function installedFileContract(targetRel) {
|
|
69
|
-
return installedFileContracts.find((item) => item.targetRel === targetRel) ?? null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function contract(sourceRel, targetRel, strategy) {
|
|
73
|
-
return Object.freeze({ sourceRel, targetRel, strategy });
|
|
74
|
-
}
|
|
1
|
+
// Single source of truth for the historical files Agent Handoff Kit installs
|
|
2
|
+
// and upgrades. Fresh-only files are declared separately so their new path
|
|
3
|
+
// cannot silently become legacy ownership or upgrade evidence.
|
|
4
|
+
|
|
5
|
+
export const INSTALLED_FILE_CONTRACT_SCHEMA = 1;
|
|
6
|
+
|
|
7
|
+
export const installedFileContracts = Object.freeze([
|
|
8
|
+
contract("runtime-core/AGENTS.core.md", "AGENTS.md", "managed-core"),
|
|
9
|
+
contract("runtime-core/CLAUDE.md", "CLAUDE.md", "strict-bridge"),
|
|
10
|
+
contract("runtime-core/GEMINI.md", "GEMINI.md", "strict-bridge"),
|
|
11
|
+
contract("runtime-core/START_NEXT_SESSION_PROMPT.txt", "START_NEXT_SESSION_PROMPT.txt", "generated-state"),
|
|
12
|
+
contract("runtime-core/SESSION_HANDOFF.md", "dev/SESSION_HANDOFF.md", "stateful-handoff"),
|
|
13
|
+
contract("runtime-core/SESSION_LOG.md", "dev/SESSION_LOG.md", "stateful-log"),
|
|
14
|
+
contract("runtime-core/PROJECT_INDEX.md", "dev/PROJECT_INDEX.md", "stateful-index"),
|
|
15
|
+
contract("runtime-core/DOC_SYNC_REGISTRY.md", "dev/DOC_SYNC_REGISTRY.md", "stateful-registry"),
|
|
16
|
+
contract("runtime-core/RULE_PACKS.md", "dev/RULE_PACKS.md", "marked-routing-table"),
|
|
17
|
+
contract("runtime-core/PROJECT_DECISIONS.md", "dev/PROJECT_DECISIONS.md", "stateful-decisions"),
|
|
18
|
+
contract("packs/safety.md", "dev/rules/safety.md", "rule-pack"),
|
|
19
|
+
contract("packs/coding.md", "dev/rules/coding.md", "rule-pack"),
|
|
20
|
+
contract("packs/writing.md", "dev/rules/writing.md", "rule-pack"),
|
|
21
|
+
contract("packs/research.md", "dev/rules/research.md", "rule-pack"),
|
|
22
|
+
contract("packs/agent-governance.md", "dev/rules/agent-governance.md", "rule-pack"),
|
|
23
|
+
contract("packs/release.md", "dev/rules/release.md", "rule-pack"),
|
|
24
|
+
contract("packs/knowledge.md", "dev/rules/knowledge.md", "rule-pack"),
|
|
25
|
+
contract("packs/communication.md", "dev/rules/communication.md", "rule-pack"),
|
|
26
|
+
contract("packs/closeout.md", "dev/rules/closeout.md", "rule-pack"),
|
|
27
|
+
contract("packs/onboarding.md", "dev/rules/onboarding.md", "rule-pack"),
|
|
28
|
+
contract("packs/integrations.md", "dev/rules/integrations.md", "rule-pack")
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const installedMappings = Object.freeze(
|
|
32
|
+
installedFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// The router is installed on fresh roots, but is not evidence that an arbitrary
|
|
36
|
+
// legacy or mixed file is Kit-managed. Its upgrade treatment lives in a
|
|
37
|
+
// separate, state-bound transition contract below rather than the historical
|
|
38
|
+
// file catalog.
|
|
39
|
+
export const freshInstallFileContracts = Object.freeze([
|
|
40
|
+
...installedFileContracts,
|
|
41
|
+
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "fresh-user-router")
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
export const freshInstallMappings = Object.freeze(
|
|
45
|
+
freshInstallFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// R-034: formal user-rule state is part of an upgrade only when the existing
|
|
49
|
+
// AGENTS.md entry and router form one verifiable formal state. This separate
|
|
50
|
+
// contract deliberately does not reclassify a path, title, or directory as
|
|
51
|
+
// historical Kit ownership.
|
|
52
|
+
export const upgradeStateFileContracts = Object.freeze([
|
|
53
|
+
contract("runtime-core/USER_RULES.md", "dev/USER_RULES.md", "accepted-user-rules-router")
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
export const upgradeStateMappings = Object.freeze(
|
|
57
|
+
upgradeStateFileContracts.map(({ sourceRel, targetRel }) => Object.freeze([sourceRel, targetRel]))
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const upgradeStateTargets = Object.freeze(
|
|
61
|
+
upgradeStateFileContracts.map(({ targetRel }) => targetRel)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const requiredInstalledTargets = Object.freeze(
|
|
65
|
+
installedFileContracts.map(({ targetRel }) => targetRel)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export function installedFileContract(targetRel) {
|
|
69
|
+
return installedFileContracts.find((item) => item.targetRel === targetRel) ?? null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function contract(sourceRel, targetRel, strategy) {
|
|
73
|
+
return Object.freeze({ sourceRel, targetRel, strategy });
|
|
74
|
+
}
|