@sabaiway/agent-workflow-kit 14.46.0 → 14.47.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 +16 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/migrations/3.0.0-hardened-core-loop.md +5 -5
- package/package.json +1 -1
- package/references/modes/recommendations.md +1 -1
- package/tools/apply-danger-check.mjs +1 -8
- package/tools/git-hooks.mjs +13 -48
- package/tools/recommendations.mjs +1 -1
- package/tools/script-priors.mjs +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ 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.47.0 — the `hook-checks` item no longer replaces your hook installer; a hook line it left out names the upgrade (AD-199)
|
|
8
|
+
|
|
9
|
+
**Applying `hook-checks` no longer replaces your hook installer.** Before, its apply first replaced a
|
|
10
|
+
`scripts/install-git-hooks.mjs` an earlier release shipped with the kit's current one, and could put it in place
|
|
11
|
+
beside older installer tests. Since 14.46.0 the upgrade keeps every kit script current, so that replace only repeated
|
|
12
|
+
the upgrade's work, and it is gone:
|
|
13
|
+
|
|
14
|
+
- **`hook-checks` runs your installer as it stands.** Its preview prints no `refresh:` line, the apply itself writes
|
|
15
|
+
and restores no file (the installer still writes the hook), and the check before the apply refuses any write for
|
|
16
|
+
this item. Its note in the Recommendations mode no longer warns that the replace may grow a recorded size.
|
|
17
|
+
- **A hook line the installer left out names the upgrade.** When the installer exits 0 but the hook lacks a line the
|
|
18
|
+
`commit-guard` or `hook-checks` apply passed, the apply still exits 6, and its line now ends by naming
|
|
19
|
+
`/agent-workflow-kit upgrade`, which brings the installer to the kit's current body (a body a release shipped
|
|
20
|
+
refreshed with no question, any other kept aside and replaced on its one yes), then says to apply the item again. Before, the line called a refresh from the kit's copy your own step.
|
|
21
|
+
- Migration note 3.0.0 step 4 says the same.
|
|
22
|
+
|
|
7
23
|
## 14.46.0 — every upgrade keeps all the kit's scripts in your `scripts/` current, an edit kept aside and replaced on the one yes (AD-198)
|
|
8
24
|
|
|
9
25
|
**A kit script in `scripts/` no longer stays stale or missing forever.** Before, the upgrade's `scripts` step
|
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.47.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-kit
|
package/capability.json
CHANGED
|
@@ -27,11 +27,11 @@ loudly, never silently.
|
|
|
27
27
|
advisor's `commit-guard` item arms the pre-commit hook: the agent applies it on the user's yes
|
|
28
28
|
after its check, by the consent route of the Recommendations mode, and the apply reads the hook
|
|
29
29
|
back to verify the arm took. A 2.x deployment's project-local `scripts/install-git-hooks.mjs`
|
|
30
|
-
predates the arm
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
predates the arm: an unarmed hook after the installer's exit 0 makes the apply exit 6 with
|
|
31
|
+
one line naming the hook and the guard line the installer left out, ending with the upgrade
|
|
32
|
+
route — `/agent-workflow-kit upgrade` keeps that installer aside and replaces it with the kit's
|
|
33
|
+
current body on its one yes (an installer this old is never refreshed without that yes) — and
|
|
34
|
+
the item returns at the next run.
|
|
35
35
|
5. **Re-stamp:** init/upgrade re-stamps `docs/ai/.workflow-version` to 3.0.0.
|
|
36
36
|
|
|
37
37
|
## Verification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.47.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",
|
|
@@ -38,7 +38,7 @@ A variant's posture note, where its key has one, is printed by `init` from this
|
|
|
38
38
|
- `source-size` — the arms differ by what the declared gate IS. **`adopted-elsewhere`** — the gate runs a DIFFERENT real copy of this checker (a vendored deployment): the practice runs, the advisor cannot resolve it as its own sibling, and the realpath anchor does not widen (that stops a lookalike). So the convergence is the ack writer's preview (`--lane source-size-copy` → `sourceSizeCopyAck`), never `--adopt`, which would mint and then be refused by the fill on the declared id. The fingerprint binds the declared claims AS AUTHORED, sorted, not resolved paths, so a second external copy re-fires it. **`id-squatter`** — a gate carries the `source-size` id and is not this checker under any reading: it claims the practice while nothing measures module size, so it is the user's own step (rename the id, or repoint the cmd at this `--check`). **`unminted`**, for both copies: a gate refusing every run over an authored or incomplete record (over an absent one the check judges layout alone), attention, and NO acknowledgement silences it; only the verb differs (with the gate declared elsewhere, `--write-baseline`). **`schema-1`** — the check stops on a minted schema-1 config, so this arm comes first: its `--write-baseline` line carries NO reason (a pinned one would launder a raise; a raise riding the move refuses and you relay it), every run until the move. **`layout`** — on a config with no layout record, the record of the piles already there comes first, as its own item: a no writes nothing and the item returns every run; its `recipe:` line names the branch states, and `source-size.layout` is applied before the `hook-checks` check line runs, whose layout line follows that record. Risk profile: `docs/ai/gates.json` is a PRIVILEGED file, so every arm here either records an acknowledgement or hands you an edit — the kit declares nothing on its own.
|
|
39
39
|
- `gate-hook` — the base arm is the ordinary opt-in wiring offer on the harness lane: the agent applies it on the chat yes after the check; `init` previews and applies it on the terminal yes as the route the user may take instead. The **`marker-stale`** arm is not: the placed hook validates your declaration through its OWN baked copy and goes dark on any key it does not know, so a declaration carrying the `lcovProducer` key under a hook that predates it silently turns auto-approval OFF, and every gate prompts again with no error anywhere. The condition is the key's PRESENCE, not its value: `"lcovProducer": false` darkens it exactly as `true` does. The arm is deliberately marker-scoped — a stale hook is otherwise harmless — and it is a harness item: its writer is `gate-hook --apply --reseed`, which replaces the placed hook with the bundled bytes in place (and wires the entry only while it is unwired), so the agent applies it on the chat yes after the check, whose result names the replaced file with the old and the new digest; `init` applies it on the terminal y as the route the user may take instead. When the read-lane is also enabled, this arm and `read-lane.stale` would report the same file with the same recovery, so exactly one renders — **this one**: a hook that postdates the read-lane and merely predates the marker key reads `lanes.json` perfectly well. Risk profile: one placed hook file replaced by the bundled runtime; the declaration is never touched.
|
|
40
40
|
- `enforcement` — copies the bundled `references/scripts/*.mjs` runnable scripts and their tests, then runs the project's own hook installer, which installs the pre-commit hook. The lane is harness: the agent applies the item on the chat yes after the check, whose result shows each script the kit places with its bytes and the installer it runs with its bytes; `init` applies it on the batch terminal yes as the route the user may take instead. The copy is create-only: an existing file stands and nothing is written through a link, and the offer renders only when `scripts/` is absent or a plain directory contains no bundled basename. The hook invokes `node` directly, so a committer without it on PATH gets a loud failure. The installer refuses to overwrite a pre-commit hook it did not write: an install it refuses removes the scripts this apply copied, and the item is offered again with the installer's output shown; over a pre-commit hook the installer did not write the item is not offered — its skip names the user's own step. Risk profile: local tooling and a Git hook are added on the chat yes after the check, or on init's y.
|
|
41
|
-
- `hook-checks` — the agent applies the item on the chat yes after the check
|
|
41
|
+
- `hook-checks` — the agent applies the item on the chat yes after the check; `init` applies it on the terminal y as the route the user may take instead. Risk profile: future commits stop on the rules check and, where judged, on the size check's findings — lines, aggregate and layout; over a clone with no pre-commit hook the installer writes its whole hook, so commits also stop on its docs, archive and `scripts/` test lines.
|
|
42
42
|
- `attribution` — the agent applies the item on the chat yes after the check, setting one key in the project `.claude/settings.json`; `init` applies it on the terminal y as the route the user may take instead. An existing "includeCoAuthoredBy": false already converges the item unless an "attribution" key sets a commit or PR text; a local-scope override is the user's own edit. Risk profile: one settings key, nothing widened.
|
|
43
43
|
- `footprint-global` — the agent applies the item on the chat yes after the check, which prints each line it removes; `init` applies it on the terminal y as the route the user may take instead. Another of the user's repositories may rely on the same lines: a no keeps the block, and the item returns at the next run. The apply prints the removed lines as a backup. Risk profile: lines removed from the machine-global excludes file.
|
|
44
44
|
- `mcp-channel` — the offer is to REGISTER the kit's read-only stdio MCP server in this project on the harness lane: a registration is a command your MCP client will RUN. The agent applies it on the chat yes after the check; `init` previews the exact entry and applies it on the terminal y as the route the user may take instead. What the registration buys: path questions and literal searches become typed tool calls whose arguments are named JSON fields instead of a string handed to a shell, so a pipe, a redirect or a quote inside a pattern or a path stays DATA and is never interpreted. Posture: the server is a **read-only child of your client** (path/type/size/line facts and literal search over this project root; no write and no exec API), and like the client itself it runs **outside the Bash sandbox** — the sandbox is not what bounds it, the server's own root containment is. The two allow rules it adds make those two tools promptless and nothing else. The **`.differing`** arm is also a harness item: an `agent-workflow` entry already stands in `.mcp.json` and **structurally differs** from what this kit copy would write (another kit copy, a hand-edited path, an added `env`; the comparison ignores key order, so re-serialized identical bytes are the same registration). The check shows the entry standing in `.mcp.json` and the entry it would write; the chat yes confirms the replacement. `init` previews `mcp --replace` and replaces only on the terminal y. Stated limit: this item does **not** detect a `disabledMcpjsonServers` veto, so a converged `mcp-channel` means *what the mode writes is in place*, not *the client will load it* — see `${CLAUDE_SKILL_DIR}/references/modes/mcp.md`. Risk profile: a new read-only channel your client will launch; no write or exec exposure; a differing registration is replaced only on the checked chat yes or the terminal y and every other declaration is kept.
|
|
@@ -26,7 +26,6 @@ import { findOnPath } from './detect-backends.mjs';
|
|
|
26
26
|
import { consoleArgv } from './write-lanes.mjs';
|
|
27
27
|
import { BUNDLED_SCRIPT_NAMES, INSTALLER_REL, SCRIPTS_REL, formatPlan, planGitHooks } from './git-hooks.mjs';
|
|
28
28
|
import { ATTRIBUTION_HIDDEN, ATTRIBUTION_KEY, writeAttribution } from './attribution.mjs';
|
|
29
|
-
import { classifyDeployedScript } from './script-priors.mjs';
|
|
30
29
|
import { globalRemovalOf, planGlobalRemoval } from './hide-footprint.mjs';
|
|
31
30
|
import { isDirectRun } from './direct-run.mjs';
|
|
32
31
|
import { dirCovers as covers } from './declared-paths.mjs';
|
|
@@ -221,7 +220,7 @@ export const scopeOf = (variant, facts, deps = {}) => {
|
|
|
221
220
|
const scripts = join(facts.root, SCRIPTS_REL);
|
|
222
221
|
if (GIT_VARIANTS.includes(variant)) {
|
|
223
222
|
directories.splice(0, directories.length, ...(variant === 'hook-checks' ? [] : [scripts]));
|
|
224
|
-
|
|
223
|
+
if (variant !== 'hook-checks') filePaths.push(...BUNDLED_SCRIPT_NAMES.map((name) => join(scripts, name)));
|
|
225
224
|
}
|
|
226
225
|
const rules = ['--rules-check', join(facts.toolsDir, 'project-rules', 'rules-cli.mjs')];
|
|
227
226
|
const layout = ['--layout-check', join(facts.toolsDir, 'source-size-check.mjs')];
|
|
@@ -318,12 +317,6 @@ export const plannedChange = (variant, facts, deps = {}) => {
|
|
|
318
317
|
} else if (GIT_VARIANTS.includes(variant)) {
|
|
319
318
|
const plan = (deps.planGitHooks ?? planGitHooks)({ root: facts.root, variant, toolsDir: facts.toolsDir });
|
|
320
319
|
for (const copy of plan.copies.filter(({ action }) => action === 'created')) writes.push({ path: copy.path, bytes: copy.bytes });
|
|
321
|
-
if (plan.refresh) {
|
|
322
|
-
// The one replace hook-checks makes: the bundled installer's bytes over a catalogued prior body.
|
|
323
|
-
const bundled = readFileSync(join(facts.toolsDir, '..', 'references', INSTALLER_REL));
|
|
324
|
-
const { path, bytes, replaces } = plan.refresh;
|
|
325
|
-
writes.push({ path, bytes, replaces, matches: bundled.equals(bytes) && classifyDeployedScript(replaces, basename(INSTALLER_REL), bundled) === 'prior' });
|
|
326
|
-
}
|
|
327
320
|
runs = { argv: plan.runs.shown, line: formatPlan(plan).at(-1) };
|
|
328
321
|
} else if (variant === WORKTREES) {
|
|
329
322
|
const plan = writeVelocityProfile({ cwd: facts.root, dryRun: true, worktrees: true }, writerDeps);
|
package/tools/git-hooks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// git-hooks.mjs — the thin writer of the three git-hook items (`enforcement`, `commit-guard`,
|
|
3
|
-
// `hook-checks`): it copies the bundled scripts create-only
|
|
4
|
-
//
|
|
3
|
+
// `hook-checks`): it copies the bundled scripts create-only and spawns the project's own
|
|
4
|
+
// scripts/install-git-hooks.mjs as it stands, which decides the hook at the write. The leaf
|
|
5
5
|
// decides nothing about the hook: the danger check binds the copies and the installer bytes this dry run
|
|
6
6
|
// answers, never git's hooks dir. It is also the home of the one pre-commit reader, which the
|
|
7
7
|
// commit-guard and hook-checks applies run after the installer to verify the arm.
|
|
@@ -10,12 +10,11 @@ import { createHash } from 'node:crypto';
|
|
|
10
10
|
import { spawnSync } from 'node:child_process';
|
|
11
11
|
import { dirname, join, resolve } from 'node:path';
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
-
import {
|
|
13
|
+
import { writeProjectFileCreateOnly } from './atomic-write.mjs';
|
|
14
14
|
import { BUNDLED_SCRIPT_NAMES, INSTALLER_REL, NODE_EVIDENCE_SCRIPTS, SCRIPTS_DIR } from './node-evidence.mjs';
|
|
15
15
|
import { shellQuoteArg } from './repo-lex.mjs';
|
|
16
16
|
import { GIT_MAX_BUFFER } from './git-env.mjs';
|
|
17
17
|
import { isDirectRun } from './direct-run.mjs';
|
|
18
|
-
import { classifyDeployedScript } from './script-priors.mjs';
|
|
19
18
|
import { checkRules } from './project-rules/index.mjs';
|
|
20
19
|
import { readLayoutSetup } from './source-size-core.mjs';
|
|
21
20
|
|
|
@@ -34,6 +33,8 @@ const USAGE = 'usage: git-hooks (--enforcement | --commit-guard | --hook-checks)
|
|
|
34
33
|
const sha = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
35
34
|
const usageError = (message) => Object.assign(new Error(message), { exitCode: EXIT_USAGE });
|
|
36
35
|
const refusal = (message) => Object.assign(new Error(message), { exitCode: EXIT_REFUSED });
|
|
36
|
+
// The one route the two re-read lines end with: an installer that left a passed line out is not the kit's current body.
|
|
37
|
+
export const UPGRADE_ROUTE = "/agent-workflow-kit upgrade refreshes, with no question, an installer body it knows a release shipped, and on its one yes keeps any other installer aside and replaces it with the kit's current body; if it stops on another cause, resolve the cause it names and run it again; then apply this item again";
|
|
37
38
|
|
|
38
39
|
const nodeAt = (path, lstat) => {
|
|
39
40
|
try {
|
|
@@ -122,7 +123,7 @@ export const plannedRoles = (answers, hook) => ROLES.filter(({ key }) =>
|
|
|
122
123
|
export const unsafeToolsPath = (toolsDir, platform) => (ROLES.some(({ tool }) => safeHookPath(tool(toolsDir), platform) === null)
|
|
123
124
|
? `the kit's tools path ${toolsDir} carries ", $, a backtick, a backslash, CR or LF — a hook line would not run the file it names` : null);
|
|
124
125
|
|
|
125
|
-
// hook-checks: the lines it arms, from the two answers and the hook
|
|
126
|
+
// hook-checks: the lines it arms, from the two answers and the hook; the installer runs as it stands.
|
|
126
127
|
const planHookChecks = ({ root, toolsDir, installer, scriptsNode, kinds, readFile, deps }) => {
|
|
127
128
|
if (!isPlainDir(scriptsNode) || kinds.get(INSTALLER_NAME) !== 'file') throw refusal(`${installer} is absent — nothing here places the hook installer`);
|
|
128
129
|
const unsafe = unsafeToolsPath(toolsDir, deps.platform);
|
|
@@ -135,12 +136,9 @@ const planHookChecks = ({ root, toolsDir, installer, scriptsNode, kinds, readFil
|
|
|
135
136
|
if (roles.length === 0) {
|
|
136
137
|
throw refusal(`nothing to plan — ${ROLES.map(({ key, role }) => `the ${role} line: ${hook[`${key}Armed`] ? 'armed' : `not armable (${answers[key].why})`}`).join('; ')}`);
|
|
137
138
|
}
|
|
138
|
-
const deployed = readFile(installer);
|
|
139
|
-
const bundled = readFile(join(bundleDir(toolsDir), INSTALLER_NAME));
|
|
140
|
-
const refresh = classifyDeployedScript(deployed, INSTALLER_NAME, bundled) === 'prior' ? { path: installer, bytes: bundled, replaces: deployed } : null;
|
|
141
139
|
const flags = roles.flatMap(({ flag, tool }) => [flag, tool(toolsDir)]);
|
|
142
|
-
return { root, variant: 'hook-checks', scriptsCreated: false, copies: [],
|
|
143
|
-
runs: { argv: ['node', installer, ...flags], shown: ['node', INSTALLER_REL, ...flags], bytes:
|
|
140
|
+
return { root, variant: 'hook-checks', scriptsCreated: false, copies: [], roles: roles.map(({ key }) => key),
|
|
141
|
+
runs: { argv: ['node', installer, ...flags], shown: ['node', INSTALLER_REL, ...flags], bytes: readFile(installer) } };
|
|
144
142
|
};
|
|
145
143
|
|
|
146
144
|
// The dry run: what the apply copies and the installer it runs, with the bytes of each.
|
|
@@ -177,7 +175,6 @@ export const planGitHooks = ({ root, variant, toolsDir = TOOLS, lstat = lstatSyn
|
|
|
177
175
|
|
|
178
176
|
export const formatPlan = (plan) => [
|
|
179
177
|
...plan.copies.map(({ name, action, bytes }) => `copy: ${SCRIPTS_REL}/${name} ${action}${action === 'created' ? ` sha256:${sha(bytes)}` : ''}`),
|
|
180
|
-
...(plan.refresh ? [`refresh: ${INSTALLER_REL} sha256:${sha(plan.refresh.bytes)} — replaces sha256:${sha(plan.refresh.replaces)}`] : []),
|
|
181
178
|
`runs: ${plan.runs.shown.map(shellQuoteArg).join(' ')} sha256:${sha(plan.runs.bytes)}`,
|
|
182
179
|
];
|
|
183
180
|
|
|
@@ -219,58 +216,26 @@ const rollBack = (plan, created, io) => {
|
|
|
219
216
|
return left;
|
|
220
217
|
};
|
|
221
218
|
|
|
222
|
-
//
|
|
223
|
-
const hookBytes = (path, readFile) => {
|
|
224
|
-
try {
|
|
225
|
-
return readFile(path);
|
|
226
|
-
} catch (error) {
|
|
227
|
-
return error?.code === 'ENOENT' ? null : undefined;
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
const sameHook = (left, right) => left !== undefined && right !== undefined && (left === null ? right === null : right !== null && left.equals(right));
|
|
231
|
-
|
|
232
|
-
// hook-checks at the write: the refresh, the spawn, the re-read of every passed line; on a failed outcome
|
|
233
|
-
// the prior installer comes back exactly when the hook still holds the bytes it held before the spawn.
|
|
219
|
+
// hook-checks at the write: the spawn, then the re-read of every passed line; it writes and restores nothing.
|
|
234
220
|
const applyHookChecks = (plan, resolved) => {
|
|
235
221
|
const hooksDir = resolveGitHooksPath(plan.root, resolved.env);
|
|
236
222
|
const preCommit = hooksDir === null ? null : join(hooksDir, 'pre-commit');
|
|
237
|
-
const before = preCommit === null ? null : hookBytes(preCommit, resolved.readFile);
|
|
238
|
-
const replace = (bytes) => resolved.replaceFile(plan.root, plan.runs.argv[1], bytes, {}, { label: INSTALLER_REL });
|
|
239
|
-
if (plan.refresh) {
|
|
240
|
-
try {
|
|
241
|
-
replace(plan.refresh.bytes);
|
|
242
|
-
} catch (error) {
|
|
243
|
-
resolved.error(error?.message ?? String(error));
|
|
244
|
-
return EXIT_INCOMPLETE;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
223
|
const child = resolved.spawn(plan.runs.argv, { cwd: plan.root, env: resolved.env, stdio: 'inherit' });
|
|
248
224
|
const hook = readPreCommitState(plan.root, { env: resolved.env, toolsDir: resolved.toolsDir, platform: resolved.platform, gitHooksPath: () => hooksDir });
|
|
249
225
|
const failure = child.status !== 0 ? `installer exited ${child.status ?? child.signal ?? child.error?.code}`
|
|
250
226
|
: hook.state === 'no-hooks-dir' ? null
|
|
251
227
|
: hook.state === 'unreadable' ? `${preCommit} is unreadable (${hook.code}) after the installer exited 0`
|
|
252
|
-
: ROLES.filter(({ key }) => plan.roles.includes(key)).map(({ key, role
|
|
253
|
-
? `${preCommit} carries no ${role} line after the installer exited 0 —
|
|
228
|
+
: ROLES.filter(({ key }) => plan.roles.includes(key)).map(({ key, role }) => (!hook[`${key}Armed`]
|
|
229
|
+
? `${preCommit} carries no ${role} line after the installer exited 0 — ${UPGRADE_ROUTE}`
|
|
254
230
|
: hook[`${key}Foreign`] ? `${preCommit} still carries a ${role} line on a path other than this kit's after the installer exited 0` : null)).find(Boolean) ?? null;
|
|
255
231
|
if (failure === null) return EXIT_OK;
|
|
256
232
|
resolved.error(failure);
|
|
257
|
-
if (!plan.refresh) return EXIT_INCOMPLETE;
|
|
258
|
-
if (!sameHook(before, preCommit === null ? null : hookBytes(preCommit, resolved.readFile))) {
|
|
259
|
-
resolved.error(`${INSTALLER_REL} keeps the refreshed bytes: ${preCommit} no longer holds what it held before the installer ran, or cannot be read, and the prior body would drop the new lines at its next run`);
|
|
260
|
-
return EXIT_INCOMPLETE;
|
|
261
|
-
}
|
|
262
|
-
try {
|
|
263
|
-
replace(plan.refresh.replaces);
|
|
264
|
-
} catch (error) {
|
|
265
|
-
resolved.error(`not restored: ${INSTALLER_REL} (${error?.message ?? error})`);
|
|
266
|
-
}
|
|
267
233
|
return EXIT_INCOMPLETE;
|
|
268
234
|
};
|
|
269
235
|
|
|
270
236
|
export const applyGitHooks = (plan, io = {}) => {
|
|
271
237
|
const resolved = { lstat: lstatSync, unlink: unlinkSync, rmdir: rmdirSync, readdir: readdirSync, env: process.env,
|
|
272
|
-
log: console.log, error: console.error, writeFile: writeProjectFileCreateOnly, toolsDir: TOOLS,
|
|
273
|
-
replaceFile: writeContainedFileAtomic, platform: process.platform,
|
|
238
|
+
log: console.log, error: console.error, writeFile: writeProjectFileCreateOnly, toolsDir: TOOLS, platform: process.platform,
|
|
274
239
|
spawn: (argv, options) => spawnSync(argv[0], argv.slice(1), options), ...io };
|
|
275
240
|
if (plan.variant === 'hook-checks') return applyHookChecks(plan, resolved);
|
|
276
241
|
const created = [];
|
|
@@ -308,7 +273,7 @@ export const applyGitHooks = (plan, io = {}) => {
|
|
|
308
273
|
if (hook.state === 'no-hooks-dir' || hook.armed) return EXIT_OK;
|
|
309
274
|
const path = join(hooksDir, 'pre-commit');
|
|
310
275
|
resolved.error(hook.state === 'unreadable' ? `${path} is unreadable (${hook.code}) after the installer exited 0`
|
|
311
|
-
: `${path} carries no commit-guard line after the installer exited 0 —
|
|
276
|
+
: `${path} carries no commit-guard line after the installer exited 0 — ${UPGRADE_ROUTE}`);
|
|
312
277
|
return EXIT_INCOMPLETE;
|
|
313
278
|
};
|
|
314
279
|
|
|
@@ -297,7 +297,7 @@ export const WHATS = Object.freeze({
|
|
|
297
297
|
'gate-hook': '{n} declared gate(s) prompt per run — the gate-approval hook is not wired',
|
|
298
298
|
'gate-hook.marker-stale': 'the declaration carries the lcovProducer key but the placed hook predates it — the hook goes dark and every gate prompts',
|
|
299
299
|
'commit-guard': 'the gate matrix is final-run-capable but no commit-guard arms the pre-commit hook — a commit needs no green receipt yet',
|
|
300
|
-
'hook-checks': 'the pre-commit hook lacks this kit\'s {checks} — the kit arms each line
|
|
300
|
+
'hook-checks': 'the pre-commit hook lacks this kit\'s {checks} — the kit arms each line',
|
|
301
301
|
enforcement: ENFORCEMENT_WHAT,
|
|
302
302
|
'read-lane': 'the gate hook is wired but the read-only compound lane is off — pipes/chains of seeded reads still prompt one by one',
|
|
303
303
|
'read-lane.stale': 'the read-lane is ON but the placed gate hook is stale — an old hook never reads lanes.json, so the lane is silently dark; reseed it',
|
package/tools/script-priors.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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
|
-
// replaces a deployed script — the spec-layer ensure for its pairs
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// lens-region idiom (AD-041) over whole script bodies.
|
|
3
|
+
// replaces a deployed script — the spec-layer ensure for its pairs and the upgrade's `scripts` ensure
|
|
4
|
+
// for every other kit script: `current` (byte-equal to the bundled copy) · `prior` (a body a release
|
|
5
|
+
// shipped, never edited since) · `custom` (anything else — kept aside and replaced only by the replace
|
|
6
|
+
// run the user's yes starts). The lens-region idiom (AD-041) over whole script bodies.
|
|
8
7
|
//
|
|
9
8
|
// Append discipline: when a release changes one of PRIOR_FILES, append the OUTGOING body's row here
|
|
10
9
|
// in the same release and copy its bytes to test/fixtures/script-priors/<firstShipped>/<file>.txt —
|