@sabaiway/agent-workflow-kit 14.41.0 → 14.43.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/CHANGELOG.md +44 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/modes/upgrade.md +2 -2
- package/references/scripts/install-git-hooks-repo-exec.test.mjs +55 -2
- package/references/scripts/install-git-hooks.mjs +3 -0
- package/references/scripts/install-git-hooks.test.mjs +20 -9
- package/tools/ensure-configs.mjs +6 -3
- package/tools/ensure-ops.mjs +68 -20
- package/tools/ensure-vocabulary.mjs +3 -3
- package/tools/script-priors.mjs +14 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,50 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
|
|
|
4
4
|
is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
|
|
5
5
|
every `migrations/<version>-<slug>.md` newer than it, in semver order.
|
|
6
6
|
|
|
7
|
+
## 14.43.0 — the commit hook runs your own scripts/pre-commit.local first, and the upgrade delivers that installer (AD-195)
|
|
8
|
+
|
|
9
|
+
**A deployment's own commit checks now go in `scripts/pre-commit.local`, with no edit of a kit file.** The bundled hook
|
|
10
|
+
installer (memory 8.4.0) writes, right after `set -e`, a comment line naming that file and
|
|
11
|
+
`if [ -f scripts/pre-commit.local ]; then bash scripts/pre-commit.local; fi`; the file runs with bash before the
|
|
12
|
+
kit's lines, and a non-zero exit stops the commit. The kit never writes, reads or ships it.
|
|
13
|
+
|
|
14
|
+
- **Delivered by the upgrade.** `script-priors.mjs` appends one 8.3.0 row per member of `INSTALLER_SET`, so the
|
|
15
|
+
enforcement-script ensure (op `scripts`) replaces an unedited 8.3.0 installer and its two suites with this kit's
|
|
16
|
+
copies, as it already did for 4.0.0-8.2.1. No ensure op, token or cause changes.
|
|
17
|
+
- **The hook itself gains the line only when the new installer next runs**: a visible deployment's `prepare`, or the
|
|
18
|
+
apply of the `enforcement`, `commit-guard` or `hook-checks` item (`hook-checks` refreshes a known-prior installer
|
|
19
|
+
first; the other two run the installer in place). The upgrade replaces the installer file, not the hook.
|
|
20
|
+
- Stated limit: where the 8.3.0 `install-git-hooks.test.mjs` stays beside the new installer — `hook-checks`
|
|
21
|
+
refreshing the installer alone (before the next upgrade, or while an edited member withholds the set), or a set
|
|
22
|
+
refresh stopped after the installer — that suite fails inside the hook and every commit stops: an unedited set or a
|
|
23
|
+
stopped refresh until the next upgrade refreshes the set, a withheld set until its edit is replaced.
|
|
24
|
+
|
|
25
|
+
Contracts: init-project revision 16 (part git-hooks revision 13).
|
|
26
|
+
|
|
27
|
+
## 14.42.0 — the upgrade refreshes the hook installer with its two suites, so a commit through the hook passes them again (AD-194)
|
|
28
|
+
|
|
29
|
+
**Where the hook installer and its two suites carry a body a release shipped (memory 4.0.0 to 8.2.1), the upgrade now
|
|
30
|
+
replaces all three with this kit's copies.** The earlier `install-git-hooks.test.mjs` spawned git with the variables
|
|
31
|
+
the hook inherits, so under a real `git commit` its linked-worktree test failed and the hook stopped every commit; after
|
|
32
|
+
one upgrade a commit from the main worktree passes both suites.
|
|
33
|
+
|
|
34
|
+
- **One set, one rule.** The enforcement-script ensure (`ensure-configs.mjs --reconcile`, op `scripts`) refreshes
|
|
35
|
+
`install-git-hooks.mjs`, `install-git-hooks.test.mjs` and `install-git-hooks-repo-exec.test.mjs` together on every
|
|
36
|
+
Node deployment, whatever its ADR layout, the installer first. An edited member keeps all three as they stand
|
|
37
|
+
(`customized-preserved`); an absent one is never placed; each member gets its own outcome line. A symlink, a
|
|
38
|
+
directory or an unreadable bundled member stops the op before any write; a write refused partway names the members
|
|
39
|
+
already replaced, none rolled back.
|
|
40
|
+
- **The two ADR outcomes that seed nothing** — an older ADR layout and a layout the op cannot read — still refresh the
|
|
41
|
+
set, and their line now says the ADR files were not seeded instead of that nothing was written.
|
|
42
|
+
- **The known-prior catalog.** `script-priors.mjs` exports `INSTALLER_SET` and appends three rows for the suites'
|
|
43
|
+
shipped bodies: `install-git-hooks.test.mjs` 4.0.0-7.1.2 and 7.2.0-8.2.1, `install-git-hooks-repo-exec.test.mjs`
|
|
44
|
+
4.0.0-8.2.1.
|
|
45
|
+
- `hook-checks` is unchanged: it still refreshes the installer alone, and the next upgrade refreshes the suites beside it.
|
|
46
|
+
- Stated limit: a commit from a linked worktree of a deployment still stops in the hook (debt row
|
|
47
|
+
LINKED-WORKTREE-COMMIT-STOPS-IN-THE-HOOK).
|
|
48
|
+
|
|
49
|
+
Contracts: init-project revision 15 (part git-hooks revision 12).
|
|
50
|
+
|
|
7
51
|
## 14.41.0 — the commit hook runs the project-rules check and the layout check, set up by two advisor items on your yes (AD-193)
|
|
8
52
|
|
|
9
53
|
**Two new advisor items set the checks up: `source-size.layout` records the directories already beyond the layout
|
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: agent-workflow-kit
|
|
|
3
3
|
description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
metadata:
|
|
6
|
-
version: '14.
|
|
6
|
+
version: '14.43.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-kit
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.43.0",
|
|
4
4
|
"description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -33,7 +33,7 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
33
33
|
|
|
34
34
|
**`footprint` — hidden-mode footprint reconcile (D9 / AD-014).** A deployment does not record whether it chose `hidden`, so first **infer visibility** — the dry-run writes **zero bytes** and reports one of — **visible** (the entry point is tracked) → nothing to do; **ambiguous** (untracked but not ignored — could be a fresh uncommitted repo, or a hide that broke) → **ASK** the user which it is, never guess; **hidden** → re-run without `--dry-run` to migrate any older **machine-global** hide to the **project-local** `.git/info/exclude` (one managed block; folds in the legacy `.claude/skills/` line), idempotently (a clean re-run is zero-diff). Handle its surfaced paths exactly as bootstrap step 9 (`${CLAUDE_SKILL_DIR}/references/modes/bootstrap.md`) (already-committed → show `git rm --cached`, ask before `--include`; generic-name present file → ask; **a leftover machine-wide ignore block is kept + reported — the advisor's `footprint-global` item removes it**). This runs on **every** hidden upgrade, like the methodology slot — no lineage-head bump, no migration file.
|
|
35
35
|
|
|
36
|
-
**`configs` — the project-configuration ensures, ONE run.** The ONE command performs **all nine** ensures — orchestration config · gate declaration · autonomy declaration · vehicles declaration · executor check · enforcement scripts · spec layer · project rules · navigator index — in a fixed order, and prints **one outcome line per ensure**: paste those lines into the step 4 / step 8 success report. Every SEED is **create-only** (an existing file is preserved byte-for-byte); a refresh-class op rewrites only what it owns — the outcome tokens by ensure, below, name each arm. One ensure failing **never** skips the others: each reports its own outcome and the run exits non-zero when any of them `failed`. The outcome tokens, by ensure: orchestration → `seeded` / `note-refreshed` / `already-current` / `customized-preserved` / `malformed-preserved`; gates, autonomy and vehicles → `seeded` / `already-present`; executor → `not-placed` / `already-current` / `pending`; scripts → `seeded` / `already-present` / `old-adr-layout-migration-instructed` / `skipped-no-node-evidence`; specs → `seeded` / `refreshed` / `already-present` / `customized-preserved` / `skipped-no-node-evidence`; rules → `seeded` / `refreshed` / `regenerated` / `pending` / `customized-preserved` / `already-current`; index → `regenerated` / `already-current` / `customized-preserved`; and any ensure may report `failed`, whose line OPENS with the cause (relay it with that cause — never soften it into a skip; an op that copies file by file also states when it stopped partway). The cause vocabulary is CLOSED — one of `race-unresolved`, `template-unreadable`, `bundle-unreadable`, `adr-layout-unverifiable`, `node-evidence-unverifiable`, `wrong-node-kind`, `vehicle-settings-unreadable`, `write-refused`, `unexpected-error`, `generator-unlaunchable`, `generator-failed`, `index-probe-failed`, `index-stale-after-write` — and every cause that can only arise AFTER the generator ran (`generator-failed`, and `index-probe-failed` / `index-stale-after-write` when they follow a reported regeneration) DISCLOSES in its own line that a write may already have landed. **A non-zero exit STOPs this upgrade — once row 3's replace ask is answered when a specs replace line printed, then as that ask says** — before the equal-head exit, the migrations and the re-stamp. Add `--dry-run` to preview without writing a byte. Like the pointer slots + the footprint reconcile, all nine reach an equal-head deployment **without a lineage-head bump or a migration file**.
|
|
36
|
+
**`configs` — the project-configuration ensures, ONE run.** The ONE command performs **all nine** ensures — orchestration config · gate declaration · autonomy declaration · vehicles declaration · executor check · enforcement scripts · spec layer · project rules · navigator index — in a fixed order, and prints **one outcome line per ensure**: paste those lines into the step 4 / step 8 success report. Every SEED is **create-only** (an existing file is preserved byte-for-byte); a refresh-class op rewrites only what it owns — the outcome tokens by ensure, below, name each arm. One ensure failing **never** skips the others: each reports its own outcome and the run exits non-zero when any of them `failed`. The outcome tokens, by ensure: orchestration → `seeded` / `note-refreshed` / `already-current` / `customized-preserved` / `malformed-preserved`; gates, autonomy and vehicles → `seeded` / `already-present`; executor → `not-placed` / `already-current` / `pending`; scripts → `seeded` / `refreshed` / `already-present` / `customized-preserved` / `old-adr-layout-migration-instructed` / `skipped-no-node-evidence`; specs → `seeded` / `refreshed` / `already-present` / `customized-preserved` / `skipped-no-node-evidence`; rules → `seeded` / `refreshed` / `regenerated` / `pending` / `customized-preserved` / `already-current`; index → `regenerated` / `already-current` / `customized-preserved`; and any ensure may report `failed`, whose line OPENS with the cause (relay it with that cause — never soften it into a skip; an op that copies file by file also states when it stopped partway). The cause vocabulary is CLOSED — one of `race-unresolved`, `template-unreadable`, `bundle-unreadable`, `adr-layout-unverifiable`, `node-evidence-unverifiable`, `wrong-node-kind`, `vehicle-settings-unreadable`, `write-refused`, `unexpected-error`, `generator-unlaunchable`, `generator-failed`, `index-probe-failed`, `index-stale-after-write` — and every cause that can only arise AFTER the generator ran (`generator-failed`, and `index-probe-failed` / `index-stale-after-write` when they follow a reported regeneration) DISCLOSES in its own line that a write may already have landed. **A non-zero exit STOPs this upgrade — once row 3's replace ask is answered when a specs replace line printed, then as that ask says** — before the equal-head exit, the migrations and the re-stamp. Add `--dry-run` to preview without writing a byte. Like the pointer slots + the footprint reconcile, all nine reach an equal-head deployment **without a lineage-head bump or a migration file**.
|
|
37
37
|
|
|
38
38
|
**What the orchestration-config ensure does.** `docs/ai/orchestration.json` must exist **and its onboarding note must be current**: created from the canonical seed if missing; if it already exists, **every activity/slot the user set is preserved** and ONLY the `_README` note is refreshed, and only when the existing one still matches a known prior canonical — `refreshIfCanonical` / `refreshReadme` in `tools/orchestration-config.mjs` decide it (CRLF/whitespace normalized first; a *customized* `_README` is preserved verbatim → `customized-preserved`; a *malformed* existing config is **preserved untouched + LOUD** → `malformed-preserved`, never clobbered and never silently skipped). The current note points at `/agent-workflow-kit set-recipe`. **Kit-owned:** in the **delegated** path memory only seeds/preserves the file (memory upgrade step 2) and this ensure applies the `_README` refresh; in the **fallback** path it does both. (Memory stays standalone.)
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
43
43
|
|
|
44
44
|
**What the executor ensure does.** It never writes: a placed `.claude/agents/executor.md` whose bytes differ from the body derived from `docs/ai/vehicles.json` is `pending` — the advisor's `executor-vehicle.differing` item re-derives it on the user's yes — and an absent one is `not-placed` (the agents mode places it on consent).
|
|
45
45
|
|
|
46
|
-
**What the enforcement-script ensure does.**
|
|
46
|
+
**What the enforcement-script ensure does.** First, on every Node deployment whatever its ADR layout, the hook installer and its two suites are refreshed together: a member on a body a release shipped becomes the bundled one, an edited member keeps all three as they stand, an absent one is never seeded. The pairs must exist in the project's `scripts/`: `archive-decisions.mjs` + `archive-decisions.test.mjs` and `markdown-blocks.mjs` + `markdown-blocks.test.mjs`, copied from `${CLAUDE_SKILL_DIR}/references/scripts/` if missing; **an existing file is preserved, never overwritten**. Nothing else is seeded — the other tokenizer-era tests red beside OLD archivers. **OLD ADR-store layout — DETECTED before the seed, never auto-migrated (AD-051, Decision 13):** on a `docs/ai/history/decisions-archive*.md` monolith (`old`), or no monolith but a deployed rotator predating the store (`old-unrotated`), the project is on the RETIRED 3-tier cascade, so no ADR file is seeded and the ensure reports `old-adr-layout-migration-instructed` (the new `archive-decisions.mjs` beside un-migrated monoliths would red their ADR gate). Relay it as the LOUD instruct it is: the fix is the opt-in **`/agent-workflow-kit migrate-adr-store`** (consent-gated; previews first, never commits), and the seed lands on the next upgrade. A layout the ensure cannot READ is `failed`, no ADR file seeded; under either, the set's refresh lines stand. The seed applies ONLY to a clean layout (neither signal). **Whether Node runs here is PROVEN, never proxied:** the ensure seeds on a regular `package.json` at the root OR on any kit-seeded `scripts/*.mjs` already deployed; only when every probe answers absent does it report `skipped-no-node-evidence`, a line naming every probe it checked, while the config ensures still run; a probe that cannot be read is `failed` with the cause `node-evidence-unverifiable`, nothing written. **A `skipped-*` outcome whose stated reason this tool could itself disprove may not exist**. The deployed pre-commit hook gains the `archive-decisions.mjs --check` line only when the hook is next refreshed (the `enforcement` check line and apply, by the consent route, copy nothing and re-run the installer, which refuses a non-marker hook as always); an OLD hook without the line is safe — the decisions gate is simply not enforced yet.
|
|
47
47
|
|
|
48
48
|
**What the navigator ensure does.** `docs/ai/index.md` is the always-loaded navigator the entry point declares, and it is GENERATED — no template ships it, so a deployment that never ran the generator boots from a broken entry point (and a Node project's hook fails its index check). The ensure runs the bundled generator's finalizer and reports `regenerated` (it was missing or stale — it was written) or `already-current` (nothing written); under a hook module that is not the bundled one, a write the project's own checker rejects is put back → `customized-preserved`. It never skips a No-Node project: the generator runs from `${CLAUDE_SKILL_DIR}/references/scripts/` on the agent host, not from the project's `scripts/`. **Its position in the run-list is EARLY and therefore NOT authoritative** — `lens` (and, on the migrated path, steps 6–7) still change `docs/ai` afterwards — so the authoritative run is the LATE `--only index` rung documented at both exits; the early one is idempotent: an untouched tree changes nothing.
|
|
49
49
|
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
// deploy-copy suite (install-git-hooks.test.mjs) keeps the consumer-shaped behavior pins. Every
|
|
5
5
|
// branch of the installer runs from here: fresh install, the guard arm/carry/disable/conflict
|
|
6
6
|
// lanes, the rules-check and layout-check arm/carry/duplicate/refusal lanes (win32 included), the
|
|
7
|
-
// unmanaged refusal, the up-to-date short-circuit,
|
|
7
|
+
// unmanaged refusal, the up-to-date short-circuit, the not-a-git-checkout skip, and the S71
|
|
8
|
+
// real-commit lane (real `git commit` through the written hook over stand-in scripts). Every child
|
|
8
9
|
// runs with each inherited GIT_* variable stripped, so a hook's environment never leaks in.
|
|
9
10
|
|
|
10
11
|
import { describe, it } from 'node:test';
|
|
11
12
|
import assert from 'node:assert/strict';
|
|
12
|
-
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync, realpathSync } from 'node:fs';
|
|
13
|
+
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync, realpathSync, chmodSync, statSync } from 'node:fs';
|
|
13
14
|
import { tmpdir } from 'node:os';
|
|
14
15
|
import { join, dirname } from 'node:path';
|
|
15
16
|
import { fileURLToPath } from 'node:url';
|
|
@@ -130,3 +131,55 @@ describe('install-git-hooks — the in-place installer under a GIT_DIR-pinned fi
|
|
|
130
131
|
rmSync(nowhere, { recursive: true, force: true });
|
|
131
132
|
});
|
|
132
133
|
});
|
|
134
|
+
|
|
135
|
+
// The commit lane also drops NODE_TEST_CONTEXT: an inherited one makes the hook's nested `node --test` skip every file.
|
|
136
|
+
const IDENTITY = { GIT_AUTHOR_NAME: 'p', GIT_AUTHOR_EMAIL: 'p@e', GIT_COMMITTER_NAME: 'p', GIT_COMMITTER_EMAIL: 'p@e' };
|
|
137
|
+
const bareAt = (home, extra = {}) => { const { NODE_TEST_CONTEXT: _, ...env } = envAt(home, { ...IDENTITY, ...extra }); return env; };
|
|
138
|
+
const passes = (r) => (assert.equal(r.status, 0, r.stderr), r);
|
|
139
|
+
|
|
140
|
+
// Passing stand-ins for every script the hook runs; check-docs-size.mjs, run right after the local line, records
|
|
141
|
+
// whether the marker existed. The marker and the record live in a sibling dir, outside the work tree.
|
|
142
|
+
const commitRepo = (root, side) => {
|
|
143
|
+
const [marker, record, local] = [join(side, 'marker'), join(side, 'record'), join(root, 'scripts', 'pre-commit.local')];
|
|
144
|
+
const git = (...args) => spawnChecked('git', args, { cwd: root, env: bareAt(root) });
|
|
145
|
+
mkdirSync(join(root, 'scripts'));
|
|
146
|
+
writeFileSync(join(root, 'scripts', 'check-docs-size.mjs'), `import { existsSync, writeFileSync } from 'node:fs';
|
|
147
|
+
if (!process.argv.includes('--check-index')) writeFileSync(${JSON.stringify(record)}, String(existsSync(${JSON.stringify(marker)})));\n`);
|
|
148
|
+
for (const name of ['archive-changelog', 'archive-issues', 'archive-decisions']) writeFileSync(join(root, 'scripts', `${name}.mjs`), 'process.exit(0);\n');
|
|
149
|
+
writeFileSync(join(root, 'scripts', 'stand-in.test.mjs'), "import { test } from 'node:test';\ntest('a passing stand-in', () => {});\n");
|
|
150
|
+
for (const args of [['init', '-q'], ['add', '-A'], ['commit', '-qm', 'base']]) passes(git(...args));
|
|
151
|
+
passes(spawnChecked(process.execPath, [INSTALLER], { env: bareAt(root, { GIT_DIR: join(root, '.git') }) }));
|
|
152
|
+
const head = () => git('rev-parse', 'HEAD').stdout.trim();
|
|
153
|
+
const commit = (body) => {
|
|
154
|
+
if (body !== undefined) { writeFileSync(local, body); chmodSync(local, 0o644); assert.equal(statSync(local).mode & 0o111, 0, 'the local file is not executable'); }
|
|
155
|
+
writeFileSync(join(root, 'change.txt'), 'change\n');
|
|
156
|
+
passes(git('add', 'change.txt'));
|
|
157
|
+
return git('commit', '-qm', 'change');
|
|
158
|
+
};
|
|
159
|
+
return { marker, record, head, commit };
|
|
160
|
+
};
|
|
161
|
+
const inCommitRepo = (cell) => () => {
|
|
162
|
+
const dirs = ['hooks-commit-', 'hooks-commit-side-'].map((prefix) => realpathSync(mkdtempSync(join(tmpdir(), prefix))));
|
|
163
|
+
try { cell(commitRepo(...dirs)); } finally { for (const dir of dirs) rmSync(dir, { recursive: true, force: true }); }
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
describe('spec:init-project/S71 the local hook file through real commits over stand-ins', () => {
|
|
167
|
+
it('a local file that writes a marker runs before the docs check, and the commit exits 0', { timeout: 120_000 }, inCommitRepo((fx) => {
|
|
168
|
+
passes(fx.commit(`printf made > "${fx.marker}"\n`));
|
|
169
|
+
assert.ok(existsSync(fx.marker), 'the local file ran: its marker appeared');
|
|
170
|
+
assert.equal(readFileSync(fx.record, 'utf8'), 'true', 'the marker existed when check-docs-size.mjs ran');
|
|
171
|
+
}));
|
|
172
|
+
|
|
173
|
+
it('a local file that exits 1 stops the commit: non-zero, no new commit', { timeout: 120_000 }, inCommitRepo((fx) => {
|
|
174
|
+
const before = fx.head();
|
|
175
|
+
assert.notEqual(fx.commit('exit 1\n').status, 0, 'a local file exiting 1 stops the commit');
|
|
176
|
+
assert.equal(fx.head(), before, 'no new commit');
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
it('with no local file the commit exits 0', { timeout: 120_000 }, inCommitRepo((fx) => {
|
|
180
|
+
const before = fx.head();
|
|
181
|
+
passes(fx.commit());
|
|
182
|
+
assert.notEqual(fx.head(), before, 'the commit landed');
|
|
183
|
+
assert.equal(readFileSync(fx.record, 'utf8'), 'false', 'the hook ran its stand-ins, with no marker');
|
|
184
|
+
}));
|
|
185
|
+
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// suite, so docs files cannot drift over their declared `maxLines`, the auto-generated
|
|
7
7
|
// `index.md` navigator cannot silently fall out of sync, stale archive entries never
|
|
8
8
|
// reach a commit, and regressions to the scripts themselves are caught at commit time.
|
|
9
|
+
// First after `set -e` it runs the project's own `scripts/pre-commit.local` with bash when present.
|
|
9
10
|
//
|
|
10
11
|
// The hooks location comes from git's OWN answer (`git rev-parse --git-path hooks`) — a linked
|
|
11
12
|
// worktree resolves ITS OWN hooks path (its `.git` is a FILE; a hardcoded `.git/hooks` would
|
|
@@ -161,6 +162,8 @@ ${MAGIC_MARKER}
|
|
|
161
162
|
# declared maxLines, the auto-generated index.md cannot silently go stale, stale
|
|
162
163
|
# archive entries never reach a commit, and regressions to the scripts are caught.
|
|
163
164
|
set -e
|
|
165
|
+
# Your own commit checks go in scripts/pre-commit.local; it runs first, with bash, when present.
|
|
166
|
+
if [ -f scripts/pre-commit.local ]; then bash scripts/pre-commit.local; fi
|
|
164
167
|
node scripts/check-docs-size.mjs
|
|
165
168
|
node scripts/check-docs-size.mjs --check-index
|
|
166
169
|
node scripts/archive-changelog.mjs --check
|
|
@@ -59,7 +59,7 @@ const markerFor = (name) => `# ${name}:install-git-hooks.mjs`;
|
|
|
59
59
|
const readHook = (root) => readFileSync(join(hooksPathOf(root), 'pre-commit'), 'utf8');
|
|
60
60
|
const stub = (root, rel) => (mkdirSync(dirname(join(root, rel)), { recursive: true }), writeFileSync(join(root, rel), '// a stand-in tool\n'), join(root, rel));
|
|
61
61
|
|
|
62
|
-
// The hook the
|
|
62
|
+
// The hook the 8.3.0 installer body writes with no guard: the six docs and scripts lines.
|
|
63
63
|
const plainHook = (root) => `#!/usr/bin/env bash
|
|
64
64
|
${markerFor(basename(root))}
|
|
65
65
|
# Auto-installed by scripts/install-git-hooks.mjs (run it from "prepare" or by hand).
|
|
@@ -75,6 +75,16 @@ node scripts/archive-issues.mjs --check
|
|
|
75
75
|
node scripts/archive-decisions.mjs --check
|
|
76
76
|
node --test scripts/*.test.mjs
|
|
77
77
|
`;
|
|
78
|
+
const LOCAL_LINE = 'if [ -f scripts/pre-commit.local ]; then bash scripts/pre-commit.local; fi';
|
|
79
|
+
// The plain hook every write carries: the 8.3.0 hook with, right after set -e, one `# ` comment naming
|
|
80
|
+
// scripts/pre-commit.local (its wording is free, so it is read from the written hook) and the exact local line.
|
|
81
|
+
const localHook = (root) => {
|
|
82
|
+
const lines = readHook(root).split('\n');
|
|
83
|
+
const comment = lines[lines.indexOf('set -e') + 1];
|
|
84
|
+
assert.ok(comment?.startsWith('# ') && comment.includes('scripts/pre-commit.local'), `right after set -e a # comment names scripts/pre-commit.local, got ${JSON.stringify(comment)}`);
|
|
85
|
+
assert.deepEqual(lines.filter((l) => l.includes('scripts/pre-commit.local')), [comment, LOCAL_LINE], 'the comment and the local line are the only lines naming scripts/pre-commit.local');
|
|
86
|
+
return plainHook(root).replace('set -e\n', `set -e\n${comment}\n${LOCAL_LINE}\n`);
|
|
87
|
+
};
|
|
78
88
|
const line = (path, role) => `node "${role ? shown(path) : path}" --check${role ? ` # ${role}` : ''}\n`;
|
|
79
89
|
|
|
80
90
|
describe('install-git-hooks — beside no package.json, or a malformed one, the marker names the directory basename', () => {
|
|
@@ -148,8 +158,9 @@ describe('spec:init-project/S58 install-git-hooks — the rules-check and layout
|
|
|
148
158
|
const [rules, layout, guard, guard2] = ['tools/rules-cli.mjs', 'tools/source-size-check.mjs', 'guard.mjs', 'g2/guard.mjs'].map((rel) => stub(root, rel));
|
|
149
159
|
installs(root, ['--commit-guard', 'guard.mjs']);
|
|
150
160
|
installs(root, ['--layout-check', 'tools/source-size-check.mjs']);
|
|
161
|
+
assert.equal(readHook(root), localHook(root) + line(layout, 'layout-check') + line(guard), 'the --layout-check run carried the guard line');
|
|
151
162
|
installs(root, ['--rules-check', rules]);
|
|
152
|
-
const armed =
|
|
163
|
+
const armed = localHook(root) + line(rules, 'rules-check') + line(layout, 'layout-check');
|
|
153
164
|
assert.equal(readHook(root), armed + line(guard), 'each arming run carried the other armed lines');
|
|
154
165
|
assert.match(installs(root).stdout, /already up to date/, 'a flagless re-run keeps all three');
|
|
155
166
|
assert.equal(readHook(root), armed + line(guard));
|
|
@@ -163,7 +174,7 @@ describe('spec:init-project/S58 install-git-hooks — the rules-check and layout
|
|
|
163
174
|
const [legacy, rules] = ['legacy/rules-cli.mjs', 'tools/rules-cli.mjs'].map((rel) => stub(root, rel));
|
|
164
175
|
installs(root, ['--commit-guard', legacy]);
|
|
165
176
|
installs(root, ['--rules-check', rules]);
|
|
166
|
-
const expected =
|
|
177
|
+
const expected = localHook(root) + line(rules, 'rules-check') + line(legacy);
|
|
167
178
|
assert.equal(readHook(root), expected);
|
|
168
179
|
installs(root);
|
|
169
180
|
assert.equal(readHook(root), expected, 'the flagless re-run keeps the legacy line as the guard');
|
|
@@ -183,11 +194,11 @@ describe('spec:init-project/S58 install-git-hooks — the rules-check and layout
|
|
|
183
194
|
}
|
|
184
195
|
}));
|
|
185
196
|
|
|
186
|
-
it('over a hook with no rules or layout line, a flagless and a --commit-guard run write the
|
|
197
|
+
it('over a hook with no rules or layout line, a flagless and a --commit-guard run write the plain hook with the comment line and the local line right after set -e', inProject(({ root }) => {
|
|
187
198
|
installs(root);
|
|
188
|
-
assert.equal(readHook(root),
|
|
199
|
+
assert.equal(readHook(root), localHook(root));
|
|
189
200
|
installs(root, ['--commit-guard', 'guard.mjs']);
|
|
190
|
-
assert.equal(readHook(root),
|
|
201
|
+
assert.equal(readHook(root), localHook(root) + line(join(root, 'guard.mjs')));
|
|
191
202
|
}));
|
|
192
203
|
|
|
193
204
|
it('a wrong file name, a shell-active path or a missing value exits 2, a missing file exits 1, each writing nothing', inProject(({ root }) => {
|
|
@@ -220,11 +231,11 @@ describe('spec:init-project/S58 install-git-hooks — the rules-check and layout
|
|
|
220
231
|
const armedAt = stub(root, 'a/b/rules-cli.mjs');
|
|
221
232
|
if (process.platform !== 'win32') { // there the backslash is refused, writing nothing
|
|
222
233
|
const posix = runInstaller(root, ['--rules-check', given]);
|
|
223
|
-
assert.deepEqual([posix.status, /a backslash, CR or LF/.test(posix.stderr), readHook(root)], [2, true,
|
|
234
|
+
assert.deepEqual([posix.status, /a backslash, CR or LF/.test(posix.stderr), readHook(root)], [2, true, localHook(root)], posix.stderr);
|
|
224
235
|
}
|
|
225
236
|
installs(root, ['--rules-check', given], WIN32);
|
|
226
|
-
assert.equal(readHook(root),
|
|
237
|
+
assert.equal(readHook(root), localHook(root) + line(armedAt, 'rules-check'));
|
|
227
238
|
assert.match(installs(root).stdout, /already up to date/, 'the flagless re-run recognises the win32-armed line');
|
|
228
|
-
assert.equal(readHook(root),
|
|
239
|
+
assert.equal(readHook(root), localHook(root) + line(armedAt, 'rules-check'));
|
|
229
240
|
}));
|
|
230
241
|
});
|
package/tools/ensure-configs.mjs
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
// autonomy docs/ai/autonomy.json seed-if-missing (same)
|
|
7
7
|
// vehicles docs/ai/vehicles.json seed-if-missing (same)
|
|
8
8
|
// executor .claude/agents/executor.md judged against docs/ai/vehicles.json, never written: a differing body is pending
|
|
9
|
-
// scripts scripts/<ADR enforcement>
|
|
9
|
+
// scripts scripts/<ADR enforcement> the hook installer and its two suites refreshed as one set on a shipped
|
|
10
|
+
// + the installer set prior body (an edited member keeps all three); ADR seeds seed-if-missing, layout detect first
|
|
10
11
|
// specs scripts/<spec layer> reader + checker pairs seeded when absent, refreshed only on
|
|
11
12
|
// + docs/ai/specs/index.md a shipped prior body, an edited one replaced only on the
|
|
12
13
|
// user's yes; store root seeded behind a current checker
|
|
@@ -96,8 +97,10 @@ the project's own checker judges the navigator and a write it rejects is put bac
|
|
|
96
97
|
The executor ensure writes nothing: a placed .claude/agents/executor.md whose bytes differ from the
|
|
97
98
|
body derived from docs/ai/vehicles.json is pending — the advisor's executor-vehicle.differing item
|
|
98
99
|
changes it on your yes; an absent file is never placed here.
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
A fifth refreshes too: the enforcement-script ensure refreshes the hook installer with its two suites
|
|
101
|
+
as one set on every Node deployment, whatever its ADR layout, only while each refreshed file is a body a
|
|
102
|
+
release shipped (an edited member keeps all three; an absent one is never placed); then it detects an
|
|
103
|
+
older ADR-store layout and instructs the opt-in migration instead of seeding the ADR files.
|
|
101
104
|
|
|
102
105
|
Exit codes: 0 every op fine; 1 an op failed (its line says so) or there is no deployment here; 2 usage.`;
|
|
103
106
|
|
package/tools/ensure-ops.mjs
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
// orchestration-write.mjs — the file's one writer. Nothing here re-derives either.
|
|
19
19
|
// • Every token names a state this run PROVED. `already-present` follows a probe; `skipped-no-node-evidence`
|
|
20
20
|
// names every Node probe that answered absent; an ADR-layout read that fails is `adr-layout-unverifiable` and
|
|
21
|
-
//
|
|
22
|
-
// tree as `none`, which here would mean seeding a rotator beside a store nobody could inspect)
|
|
21
|
+
// seeds no ADR file (the STRICT survey, fail-closed — the lenient status wrapper reads an unreadable
|
|
22
|
+
// tree as `none`, which here would mean seeding a rotator beside a store nobody could inspect); the
|
|
23
|
+
// installer set's refresh runs before and independent of that read, and its lines stand either way.
|
|
23
24
|
// • A failed op is a non-zero signal, never a line that reads like success.
|
|
24
25
|
//
|
|
25
26
|
// Dependency-free, Node >= 22. Every fs primitive is injectable (deps.*). No side effects on import.
|
|
@@ -29,14 +30,14 @@ import { spawnSync } from 'node:child_process';
|
|
|
29
30
|
import { join } from 'node:path';
|
|
30
31
|
import { CANON_README, CONFIG_REL, SEED_CONFIG, loadConfig, normalizeCanonical, refreshReadme } from './orchestration-config.mjs';
|
|
31
32
|
import { seedConfig, writeConfig } from './orchestration-write.mjs';
|
|
32
|
-
import { lstatNoFollow, writeDocsAiFileAtomic, writeProjectFileCreateOnly } from './atomic-write.mjs';
|
|
33
|
+
import { lstatNoFollow, writeContainedFileAtomic, writeDocsAiFileAtomic, writeProjectFileCreateOnly } from './atomic-write.mjs';
|
|
33
34
|
import { GATES_REL } from './gates-declaration.mjs';
|
|
34
35
|
import { AUTONOMY_REL } from './autonomy-config.mjs';
|
|
35
36
|
import { VEHICLES_REL } from './vehicle-settings.mjs';
|
|
36
37
|
import { surveyAdrLayoutStrict } from './family-registry.mjs';
|
|
37
38
|
import { ENSURE_TOKENS, FAILURE_CAUSES, SEED_SCRIPTS } from './ensure-vocabulary.mjs';
|
|
38
39
|
import { NODE_EVIDENCE, describeNodeProbes, probeNodeEvidence } from './node-evidence.mjs';
|
|
39
|
-
import { classifyDeployedScript } from './script-priors.mjs';
|
|
40
|
+
import { INSTALLER_SET, classifyDeployedScript } from './script-priors.mjs';
|
|
40
41
|
import { parseFrontmatter } from '../references/scripts/check-docs-size.mjs';
|
|
41
42
|
|
|
42
43
|
// The closed vocabulary lives in its own PURE leaf so the read-only doc-parity lint can bind the
|
|
@@ -229,33 +230,83 @@ export const nodeEvidenceRefusal = (op, cwd, lstat) => {
|
|
|
229
230
|
|
|
230
231
|
const OLD_ADR_LAYOUTS = new Set(['old', 'old-unrotated']);
|
|
231
232
|
|
|
232
|
-
// The scripts ensure
|
|
233
|
-
// so is the difference between a failure the reader can act on and one they
|
|
234
|
-
// — the CLI's summary
|
|
233
|
+
// The scripts ensure writes file by file, so a failure PARTWAY leaves earlier writes (refreshed set members,
|
|
234
|
+
// copied seeds) in place. Saying so is the difference between a failure the reader can act on and one they
|
|
235
|
+
// read as "nothing happened" — the CLI's summary claims nothing about writes; this line states the truth.
|
|
236
|
+
const REFRESHED = ' — refreshed to the bundled one';
|
|
235
237
|
const partialNote = (lines) => {
|
|
236
|
-
const copied = lines.filter((line) => line.includes(': copied from the bundled scripts')).length;
|
|
238
|
+
const copied = lines.filter((line) => line.includes(': copied from the bundled scripts') || line.endsWith(REFRESHED)).length;
|
|
237
239
|
return copied > 0 ? [`the copying stopped PARTWAY — the ${copied} file(s) named above were already copied and are NOT rolled back`] : [];
|
|
238
240
|
};
|
|
239
241
|
|
|
242
|
+
// ── the installer set: refreshed as ONE, before and independent of the ADR-layout read ──────────
|
|
243
|
+
|
|
244
|
+
// The deployed suites test the installer beside them, so the three move together: an edited member withholds
|
|
245
|
+
// all three, a prior one is replaced in INSTALLER_SET order (installer first), an absent one stays absent, and
|
|
246
|
+
// with none present nothing is read. → { refusal } or { lines, refreshed, withheld }, each line what this run did.
|
|
247
|
+
const WITHHELD = 'left as it stands because an edited member withholds the set';
|
|
248
|
+
const PRIOR_FATES = { written: REFRESHED, would: ' — would be refreshed to the bundled one', stopped: ' — not refreshed; the run stopped before it', refused: ' — not refreshed; its write was refused (above)' };
|
|
249
|
+
const SET_LINES = {
|
|
250
|
+
absent: () => 'absent — not placed by this op',
|
|
251
|
+
current: (withheld) => (withheld ? WITHHELD : 'already the bundled body — nothing written'),
|
|
252
|
+
custom: () => 'carries an edited body — preserved verbatim; an edited member withholds the set, so none of the three is refreshed',
|
|
253
|
+
prior: (withheld, fate) => (withheld ? WITHHELD : `matches a body an earlier release shipped${PRIOR_FATES[fate]}`),
|
|
254
|
+
};
|
|
255
|
+
const refreshInstallerSet = ({ cwd, kitRoot, dryRun, deps, read, lstat }) => {
|
|
256
|
+
const members = INSTALLER_SET.map((name) => ({ name, rel: `${SCRIPTS_DIR}/${name}`, state: 'absent', probe: probeSeedTarget(join(cwd, SCRIPTS_DIR, name), lstat) }));
|
|
257
|
+
if (!members.some((m) => m.probe.present)) return { lines: [], refreshed: false, withheld: false };
|
|
258
|
+
const wrong = members.find((m) => m.probe.wrongKind);
|
|
259
|
+
if (wrong) return { refusal: loud('scripts', 'wrong-node-kind', `${wrong.rel}: exists but is ${wrong.probe.wrongKind} — nothing was read or written; resolve it by hand, then re-run`) };
|
|
260
|
+
for (const m of members.filter((f) => f.probe.present)) {
|
|
261
|
+
try {
|
|
262
|
+
m.bundle = read(join(kitRoot, 'references', 'scripts', m.name));
|
|
263
|
+
} catch (err) {
|
|
264
|
+
return { refusal: loud('scripts', 'bundle-unreadable', `${m.rel}: the bundled script could not be read, so nothing was written — reinstall the kit. ${causeOf(err)}`) };
|
|
265
|
+
}
|
|
266
|
+
m.state = classifyDeployedScript(read(join(cwd, m.rel)), m.name, m.bundle);
|
|
267
|
+
}
|
|
268
|
+
const withheld = members.some((m) => m.state === 'custom');
|
|
269
|
+
const priors = withheld ? [] : members.filter((m) => m.state === 'prior');
|
|
270
|
+
const fates = new Map();
|
|
271
|
+
const notes = [];
|
|
272
|
+
const linesNow = () => [...members.map((m) => `${m.rel}: ${SET_LINES[m.state](withheld, fates.get(m.rel) ?? (dryRun ? 'would' : 'stopped'))}`), ...notes];
|
|
273
|
+
for (const m of dryRun ? [] : priors) {
|
|
274
|
+
try {
|
|
275
|
+
notes.push(...tmpNote(m.rel, writeContainedFileAtomic(cwd, join(cwd, m.rel), m.bundle, deps, { label: m.rel }).tmpLeftBehind));
|
|
276
|
+
} catch (err) {
|
|
277
|
+
fates.set(m.rel, 'refused');
|
|
278
|
+
const lines = linesNow();
|
|
279
|
+
return { refusal: loud('scripts', 'write-refused', `${m.rel}: ${causeOf(err)}`, ...lines, ...partialNote(lines)) };
|
|
280
|
+
}
|
|
281
|
+
fates.set(m.rel, 'written');
|
|
282
|
+
}
|
|
283
|
+
return { lines: linesNow(), refreshed: priors.length > 0, withheld };
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// The op's ONE token after the instructed migration: a seed, then the set's refresh, then an edited set kept.
|
|
287
|
+
const scriptsToken = (seeded, set, dryRun) => {
|
|
288
|
+
if (seeded) return dryRun ? 'would-seed' : 'seeded';
|
|
289
|
+
if (set.refreshed) return dryRun ? 'would-refresh' : 'refreshed';
|
|
290
|
+
return set.withheld ? 'customized-preserved' : 'already-present';
|
|
291
|
+
};
|
|
292
|
+
|
|
240
293
|
export const ensureScripts = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
241
294
|
const lstat = deps.lstat ?? lstatSync;
|
|
242
295
|
const read = deps.readFile ?? readFileSync;
|
|
243
296
|
const refusal = nodeEvidenceRefusal('scripts', cwd, lstat);
|
|
244
297
|
if (refusal) return refusal;
|
|
298
|
+
const set = refreshInstallerSet({ cwd, kitRoot, dryRun, deps, read, lstat });
|
|
299
|
+
if (set.refusal) return set.refusal;
|
|
245
300
|
let layout;
|
|
246
301
|
try {
|
|
247
302
|
layout = surveyAdrLayoutStrict(cwd, deps);
|
|
248
303
|
} catch (err) {
|
|
249
|
-
return loud('scripts', 'adr-layout-unverifiable', `${SCRIPTS_DIR}/: the ADR-store layout could not be read, so
|
|
304
|
+
return loud('scripts', 'adr-layout-unverifiable', `${SCRIPTS_DIR}/: the ADR-store layout could not be read, so the ADR files were not seeded — a rotator seeded beside an un-migrated store reds the ADR gate. ${causeOf(err)}`, ...set.lines, ...partialNote(set.lines));
|
|
250
305
|
}
|
|
251
306
|
if (OLD_ADR_LAYOUTS.has(layout)) {
|
|
252
|
-
return ok(
|
|
253
|
-
'scripts',
|
|
254
|
-
'old-adr-layout-migration-instructed',
|
|
255
|
-
`${SCRIPTS_DIR}/: this project is still on the older ADR layout (${layout}) — nothing written. Run the opt-in /agent-workflow-kit migrate-adr-store (it previews, and never commits); the seed lands on the next upgrade.`,
|
|
256
|
-
);
|
|
307
|
+
return ok('scripts', 'old-adr-layout-migration-instructed', ...set.lines, `${SCRIPTS_DIR}/: this project is still on the older ADR layout (${layout}) — the ADR files were not seeded. Run the opt-in /agent-workflow-kit migrate-adr-store (it previews, and never commits); the seed lands on the next upgrade.`);
|
|
257
308
|
}
|
|
258
|
-
const lines = [];
|
|
309
|
+
const lines = [...set.lines];
|
|
259
310
|
let anyCreated = false;
|
|
260
311
|
for (const name of SEED_SCRIPTS) {
|
|
261
312
|
const rel = `${SCRIPTS_DIR}/${name}`;
|
|
@@ -290,11 +341,8 @@ export const ensureScripts = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
290
341
|
lines.push(result.created ? `${rel}: copied from the bundled scripts` : `${rel}: appeared while this run was seeding it — the existing file stands`);
|
|
291
342
|
lines.push(...tmpNote(rel, result.tmpLeftBehind));
|
|
292
343
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return outcome('scripts', wouldSeed ? 'would-seed' : 'already-present', lines, false);
|
|
296
|
-
}
|
|
297
|
-
return outcome('scripts', anyCreated ? 'seeded' : 'already-present', lines, false);
|
|
344
|
+
const seeded = dryRun ? lines.some((line) => line.includes('would be copied')) : anyCreated;
|
|
345
|
+
return outcome('scripts', scriptsToken(seeded, set, dryRun), lines, false);
|
|
298
346
|
};
|
|
299
347
|
|
|
300
348
|
// ── docs/ai/index.md — the GENERATED navigator, regenerated when missing or stale ───────────────
|
|
@@ -16,9 +16,9 @@ export const ENSURE_OPS = Object.freeze(['orchestration', 'gates', 'autonomy', '
|
|
|
16
16
|
|
|
17
17
|
// Tokens that assert a WRITE happened. --dry-run may never emit one of these (the CLI's contract test
|
|
18
18
|
// walks this set), and each has exactly one `would-` counterpart below. `refreshed` is the spec-layer
|
|
19
|
-
// ensure's pair refresh (reader or checker)
|
|
20
|
-
// rewritten to the bundled one; a custom body is rewritten only by
|
|
21
|
-
// starts (--replace-custom), never by a plain run.
|
|
19
|
+
// ensure's pair refresh (reader or checker) or the scripts ensure's installer-set refresh — a deployed
|
|
20
|
+
// script on a body a release shipped, rewritten to the bundled one; a custom body is rewritten only by
|
|
21
|
+
// the replace run the user's yes starts (--replace-custom, the spec layer's), never by a plain run.
|
|
22
22
|
export const WRITE_TOKENS = Object.freeze(['seeded', 'note-refreshed', 'refreshed', 'regenerated']);
|
|
23
23
|
export const DRY_RUN_TOKENS = Object.freeze(['would-seed', 'would-refresh-note', 'would-refresh', 'would-regenerate']);
|
|
24
24
|
|
package/tools/script-priors.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// script-priors.mjs — the APPEND-ONLY catalog of every enforcement-script body this family has shipped
|
|
2
2
|
// into a project's `scripts/`, as sha256 digests, and the ONE classifier a refresh asks before it
|
|
3
3
|
// replaces a deployed script — the spec-layer ensure for its pairs, the `hook-checks` writer for the
|
|
4
|
-
// hook installer: `current` (byte-equal to the bundled copy) · `prior` (a body a release shipped, never
|
|
4
|
+
// hook installer alone and the upgrade's `scripts` ensure for the installer set: `current` (byte-equal to the bundled copy) · `prior` (a body a release shipped, never
|
|
5
5
|
// edited since) · `custom` (anything else — preserved verbatim, replaced only by the replace run the
|
|
6
6
|
// user's yes starts). The lens-region idiom (AD-041) over whole script bodies.
|
|
7
7
|
//
|
|
@@ -16,12 +16,17 @@ import { createHash } from 'node:crypto';
|
|
|
16
16
|
|
|
17
17
|
// The deployed scripts a refresh may REPLACE — the FULL refreshable catalog: the checker pair that
|
|
18
18
|
// imports the reader and (since 2a) the reader pair itself, which the spec-layer ensure refreshes, and
|
|
19
|
-
// the
|
|
20
|
-
// the refresh lane by design.
|
|
19
|
+
// the installer set: the `hook-checks` writer refreshes the installer alone, the upgrade's `scripts`
|
|
20
|
+
// ensure the installer with its two suites. Every other deployed script is outside the refresh lane by design.
|
|
21
21
|
export const PRIOR_FILES = Object.freeze([
|
|
22
22
|
'check-docs-size.mjs', 'check-docs-size.test.mjs', 'spec-schema.mjs', 'spec-schema.test.mjs', 'install-git-hooks.mjs',
|
|
23
|
+
'install-git-hooks.test.mjs', 'install-git-hooks-repo-exec.test.mjs',
|
|
23
24
|
]);
|
|
24
25
|
|
|
26
|
+
// The hook installer and the two suites that test it beside it — refreshed as ONE set, installer first,
|
|
27
|
+
// so a stop partway never leaves a bundled suite beside a prior installer.
|
|
28
|
+
export const INSTALLER_SET = Object.freeze(['install-git-hooks.mjs', 'install-git-hooks.test.mjs', 'install-git-hooks-repo-exec.test.mjs']);
|
|
29
|
+
|
|
25
30
|
const prior = (file, firstShipped, lastShipped, digest) => Object.freeze({ file, firstShipped, lastShipped, digest });
|
|
26
31
|
|
|
27
32
|
// One row per DISTINCT shipped body (memory package versions; the body is the memory canon the kit
|
|
@@ -40,6 +45,12 @@ export const SCRIPT_PRIORS = Object.freeze([
|
|
|
40
45
|
prior('spec-schema.test.mjs', '5.0.0', '7.2.1', '698564d7283281be1826019d214df475bb876687915de086818d8f5ece0e0336'),
|
|
41
46
|
prior('check-docs-size.mjs', '7.0.0', '8.1.5', '0cf90ae2cbfc809847574a8c71a6b1322c783359740b08e0ff179f0d9d04dffc'),
|
|
42
47
|
prior('install-git-hooks.mjs', '4.0.0', '8.2.1', '4c4010153cd3a9ca556f34d567d9985cff5c6e1b5ec3087ed7805e5c98f6f918'),
|
|
48
|
+
prior('install-git-hooks.test.mjs', '4.0.0', '7.1.2', '9603c4dec823d4de8b7b603563d98acb836c0f430565ef8b56c31db4aea4829b'),
|
|
49
|
+
prior('install-git-hooks.test.mjs', '7.2.0', '8.2.1', 'b57d6b2004ef1967034d9ad8d1f1db0a3b4972c6284bb8c79dea6900dcec0b69'),
|
|
50
|
+
prior('install-git-hooks-repo-exec.test.mjs', '4.0.0', '8.2.1', 'f12584b062cfa337f09f21b8d4d096549eaecc08242ee264e6f0b98226605464'),
|
|
51
|
+
prior('install-git-hooks.mjs', '8.3.0', '8.3.0', 'aa21b3dcbfc48ea1db7a33ed5a5c8cf30d911b266386b67159288cd12d28bc38'),
|
|
52
|
+
prior('install-git-hooks.test.mjs', '8.3.0', '8.3.0', '058ac6de4dd5f83c4f09c8afd72ef2bfda365a9aea55bddd0089ce89a4e941e2'),
|
|
53
|
+
prior('install-git-hooks-repo-exec.test.mjs', '8.3.0', '8.3.0', 'd5a3253fa0cd088733b927f2a7187c6484298f11dec48f6f63953e380b071c9a'),
|
|
43
54
|
]);
|
|
44
55
|
|
|
45
56
|
export const digestOf = (bytes) => createHash('sha256').update(bytes).digest('hex');
|