@sabaiway/agent-workflow-kit 14.49.0 → 14.50.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 +29 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/modes/migrate-adr-store.md +2 -2
- package/references/modes/upgrade.md +5 -5
- package/tools/distribution-files/scripts.mjs +37 -37
- package/tools/ensure-configs.mjs +4 -3
- package/tools/ensure-vocabulary.mjs +4 -5
- package/tools/migrate-adr-store.mjs +3 -3
- package/tools/upgrade-runlist.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ 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.50.0 — the upgrade moves an older ADR layout itself, with no question (AD-203)
|
|
8
|
+
|
|
9
|
+
**`/agent-workflow-kit upgrade` now brings your ADR store current in the same run.** Before, on a project still on the
|
|
10
|
+
retired three-tier ADR layout (a `docs/ai/history/decisions-archive*.md` monolith, or a decisions script older than the
|
|
11
|
+
one-file-per-ADR store), the upgrade held back `archive-decisions.mjs`, its suite and `archiver-structure.test.mjs`,
|
|
12
|
+
reported `old-adr-layout-migration-instructed` and named the opt-in `/agent-workflow-kit migrate-adr-store`. Now:
|
|
13
|
+
|
|
14
|
+
- **Every kit script follows the one rule, whatever the layout.** The decisions script and its two suites are
|
|
15
|
+
refreshed, replaced or placed like every other kit script; the `scripts` step reads no ADR layout.
|
|
16
|
+
- **Then the store run.** After the last write, the step runs your project's `scripts/archive-decisions.mjs
|
|
17
|
+
--ensure-current` with no question. It moves a retired monolith into `docs/ai/adr/` records, rotates a HOT window over
|
|
18
|
+
its cap and writes the navigator, as needed, or writes nothing when the store is already current. When it brought
|
|
19
|
+
the store current, its lines follow the step's other lines, each under `ADR store: ` (for example `ADR store:
|
|
20
|
+
brought-current: migrated, navigator written`), and the step reports `refreshed`, or `seeded` when it also placed a
|
|
21
|
+
kit script. It runs wherever the step judged
|
|
22
|
+
the decisions script: always where you took the kit's scripts, and on a project that declined the enforcement offer
|
|
23
|
+
when that script or its suite stands in `scripts/`. It never runs after a write that failed.
|
|
24
|
+
- **A refusal stops the upgrade.** When the decisions script ends with an error, a signal or a non-zero exit, the step
|
|
25
|
+
reports `failed` with the cause `adr-store-not-current`, relays the script's own lines under `ADR store: `, and the
|
|
26
|
+
upgrade stops; the kit scripts written before it stay as written.
|
|
27
|
+
- **A dry run** spawns nothing and, where it judged the decisions script, ends with one line saying the store run
|
|
28
|
+
would follow the writes.
|
|
29
|
+
- **Retired:** the token `old-adr-layout-migration-instructed` and the cause `adr-layout-unverifiable`. The step's
|
|
30
|
+
tokens are `seeded`, `refreshed`, `already-present`, `not-placed` and `skipped-no-node-evidence`.
|
|
31
|
+
- **The opt-in `migrate-adr-store` mode** has nothing left to do after an upgrade where `scripts/` holds the decisions
|
|
32
|
+
script; it stays for a project whose `scripts/` holds no kit script.
|
|
33
|
+
|
|
34
|
+
MINOR: the upgrade gains the store run and one failure cause.
|
|
35
|
+
|
|
7
36
|
## 14.49.0 — the upgrade writes the kit's current scripts and hook installer with no question and no kept-aside copy (AD-202)
|
|
8
37
|
|
|
9
38
|
**`/agent-workflow-kit upgrade` no longer asks about its own scripts.** Before, an edited or absent kit script in
|
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.50.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.50.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",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- opt-in-capability: adr-store-migration -->
|
|
4
4
|
|
|
5
|
-
The **guarded ADR-store migration** — a one-time, opt-in move of an existing project's `docs/ai` from the retired 3-tier ADR cascade (HOT `decisions.md` → the WARM/COLD `decisions-archive*.md` monoliths) to the durable **one-file-per-ADR store** (HOT `decisions.md` + `docs/ai/adr/AD-NNN-slug.md` records + the `docs/ai/adr/log.md` navigator). **In-agent, opt-in
|
|
5
|
+
The **guarded ADR-store migration** — a one-time, opt-in move of an existing project's `docs/ai` from the retired 3-tier ADR cascade (HOT `decisions.md` → the WARM/COLD `decisions-archive*.md` monoliths) to the durable **one-file-per-ADR store** (HOT `decisions.md` + `docs/ai/adr/AD-NNN-slug.md` records + the `docs/ai/adr/log.md` navigator). **In-agent, opt-in**: the upgrade moves an older layout itself wherever `scripts/` holds the kit's rotator, so after a full upgrade this mode does nothing; it stays for a project whose `scripts/` holds no kit script. Run **`--dry-run` first, always**, show the user the plan in plain language, get explicit consent, then re-run with `--apply`. It **never commits**.
|
|
6
6
|
|
|
7
|
-
When to run it: `status`
|
|
7
|
+
When to run it: `status` reports an *old ADR layout*. That covers **two** shapes, and the remedy is the same for both — (1) a `decisions-archive*.md` monolith is still on disk, and (2) **no monolith was ever produced**: the project's deployed `scripts/archive-decisions.mjs` simply predates the store, so its own gate reports the retired three-tier world as healthy and would never mention the store. The second shape is detected by that deployed script's own provenance — never by "has `decisions.md`, lacks `adr/`", which would falsely accuse a project whose NEW rotator already reds its gate with an actionable fix, and every project that runs no Node. A project already on the one-file-per-ADR store with a fresh navigator — or a fresh deployment seeded with it — needs nothing here (the mode is a stated no-op).
|
|
8
8
|
|
|
9
9
|
On the no-monolith shape `--apply` does the same work minus the explosion: snapshot → refresh the deployed enforcement scripts → **seed** the store (`docs/ai/adr/` + the navigator + a regenerated `docs/ai/index.md`) → verify. It is **re-runnable to completion from any interruption**: a store directory alone never counts as finished (the navigator must exist and the project's own `--check` must pass), the whole script refresh is re-planned on every run with the rotation script written last, and a failed index regeneration fails the run **closed** rather than reporting success.
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
12
12
|
|
|
13
13
|
1. `pointers` — `node ${CLAUDE_SKILL_DIR}/tools/inject-methodology.mjs reconcile <project>/AGENTS.md` → per pointer: added · already present · skipped (reported) · a hard STOP; per Memory Map row of a rules theme: added · already present · refreshed · skipped (reported).
|
|
14
14
|
2. `footprint` — `node ${CLAUDE_SKILL_DIR}/tools/hide-footprint.mjs --dir <project> --reconcile --dry-run` → visibility: visible · ambiguous · hidden — consent (conditional): ambiguous → ask which it is BEFORE anything; hidden → the conditional re-run without `--dry-run` (its surfaced paths ask per bootstrap step 9).
|
|
15
|
-
3. `configs` — `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --cwd <project>` → one line per ensure: `seeded` / `note-refreshed` / `refreshed` / `regenerated` / `pending` / `already-current` / `customized-preserved` / `malformed-preserved` / `already-present` / `not-placed` / `skipped-no-node-evidence` / `
|
|
15
|
+
3. `configs` — `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --cwd <project>` → one line per ensure: `seeded` / `note-refreshed` / `refreshed` / `regenerated` / `pending` / `already-current` / `customized-preserved` / `malformed-preserved` / `already-present` / `not-placed` / `skipped-no-node-evidence` / `failed` — consent (conditional): a replace line → ONE yes naming every spec-layer file its block names, each edit's kept-aside copy and that the bundled body replaces it, asked even on a non-zero exit; on the yes run the printed line, then STOP if that run fails or an op it does not re-run failed; on a no STOP on any failed op.
|
|
16
16
|
4. `gates-migration` — `node ${CLAUDE_SKILL_DIR}/references/scripts/migrate-gates.mjs --kit-tools ${CLAUDE_SKILL_DIR}/tools --cwd <project>` → the preview plan · INERT checker · CUSTOMIZED entries, each named — consent: apply only on an explicit yes, re-run with `--apply`.
|
|
17
17
|
5. `bridges` — `node ${CLAUDE_SKILL_DIR}/tools/setup-backends.mjs --refresh-placed` → per-bridge lines: refreshed · already current · skipped — with its stated reason (not placed / newer than the bundle / unsupported host) · `skipped-readonly` · could not refresh.
|
|
18
18
|
6. `lens` — `node ${CLAUDE_SKILL_DIR}/tools/lens-region.mjs reconcile <project>/docs/ai/agent_rules.md` → per section: refreshed · already current · custom edit preserved · file absent / engine too old — skipped · over the line cap — refused · section absent — noted · a fully absent/invalid engine → hard STOP.
|
|
@@ -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` / `refreshed` / `already-present` / `not-placed` / `
|
|
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, and the scripts op's store run moves ADR entries, rewrites their inbound links in `docs/ai` pages and regenerates the index, as the rotator does — 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` / `not-placed` / `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-store-not-current`, `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 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,11 +43,11 @@ 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.** It judges every kit script — each `*.mjs` of `${CLAUDE_SKILL_DIR}/references/scripts/` but the spec-layer pairs — once the component is accepted: a kit script outside the seed names (memory's own copies) stands in `scripts/` as a regular file. Each file by proof, with no question and no copy kept: a shipped prior is refreshed, an edited body replaced (its line names where a lasting edit goes), an absent file placed, the current body left. The hook installer and its two suites go first; a closing line says the commit hook runs the files written. A declined enforcement offer keeps the standing seed files current with the modules they import, places no other kit script (one line says so) and words that hook-run line as a condition. With no kit script there: `not-placed`, nothing written. **
|
|
46
|
+
**What the enforcement-script ensure does.** It judges every kit script — each `*.mjs` of `${CLAUDE_SKILL_DIR}/references/scripts/` but the spec-layer pairs — once the component is accepted: a kit script outside the seed names (memory's own copies) stands in `scripts/` as a regular file. Each file by proof, with no question and no copy kept: a shipped prior is refreshed, an edited body replaced (its line names where a lasting edit goes), an absent file placed, the current body left. The hook installer and its two suites go first; a closing line says the commit hook runs the files written. A declined enforcement offer keeps the standing seed files current with the modules they import, places no other kit script (one line says so) and words that hook-run line as a condition. With no kit script there: `not-placed`, nothing written. **The ADR store, after the writes:** where the run judged the rotator, it runs `scripts/archive-decisions.mjs --ensure-current`, with no question, which brings the store current (an older layout moved) or writes nothing; its lines are relayed under `ADR store: `. A rotator that does not bring the store current is `failed` / `adr-store-not-current`, the scripts written above staying as written: its refusal stops the upgrade. Where the size practice measures `scripts/`, a write may grow a root past its record: the size check names its own reasoned `--write-baseline`. **Whether Node runs here is PROVEN, never proxied:** the ensure runs 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**. A deployed pre-commit hook takes a new installer body only when the installer next runs: the `enforcement` check line and apply, by the consent route, re-run it (it refuses a non-marker hook as always); until then `scripts/pre-commit.local` does not run.
|
|
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
|
|
|
50
|
-
**What the spec-layer ensure does.** A deployment older than the feature-spec layer lacks `scripts/spec-schema.mjs` and `docs/ai/specs/index.md`, and its deployed `check-docs-size.mjs` predates the store collapse. In ONE order: the reader pair, then the checker pair — each seeded when absent and REFRESHED only while a file's bytes are a body a release shipped (an append-only digest catalog → `refreshed`; an edited body is preserved verbatim and withholds the writes that depend on it, the checker lane waiting on a byte-current reader pair); the store root is seeded from the bundled template, date rendered, ONLY behind a checker pair current after the run — an older or edited checker renders the store row by row and reds the hook's `--check-index`; edited files are kept aside and replaced on row 3's yes. One token by precedence: `seeded` > `refreshed` > `customized-preserved` (an edited pair, and this run wrote nothing) > `already-present`; `skipped-no-node-evidence` only when neither a root `package.json` nor any kit-seeded `scripts/*.mjs` is present (the same Node-evidence probe the enforcement-script ensure uses; an unreadable probe is `failed` / `node-evidence-unverifiable`).
|
|
50
|
+
**What the spec-layer ensure does.** A deployment older than the feature-spec layer lacks `scripts/spec-schema.mjs` and `docs/ai/specs/index.md`, and its deployed `check-docs-size.mjs` predates the store collapse. In ONE order: the reader pair, then the checker pair — each seeded when absent and REFRESHED only while a file's bytes are a body a release shipped (an append-only digest catalog → `refreshed`; an edited body is preserved verbatim and withholds the writes that depend on it, the checker lane waiting on a byte-current reader pair); the store root is seeded from the bundled template, date rendered, ONLY behind a checker pair current after the run — an older or edited checker renders the store row by row and reds the hook's `--check-index`; edited files are kept aside and replaced on row 3's yes. One token by precedence: `seeded` > `refreshed` > `customized-preserved` (an edited pair, and this run wrote nothing) > `already-present`; `skipped-no-node-evidence` only when neither a root `package.json` nor any kit-seeded `scripts/*.mjs` is present (the same Node-evidence probe the enforcement-script ensure uses; an unreadable probe is `failed` / `node-evidence-unverifiable`). **The adoption state this seed leaves behind is reported, never assumed:** the Recommendations section (step 4 / 8) carries the `spec-adoption` item — `not adopted` (the store is absent: the seed offered, the decline the agent records), `adopting` (a store with no live contract: the decline offered), silenced by a recorded decline (`ack-write --lane spec-adoption`), and a store the probe cannot read is a stated skip — and `status` prints the same state on its own line.
|
|
51
51
|
|
|
52
52
|
**What the project-rules ensure does.** Each theme's kit file `docs/ai/rules/<theme>.md` is seeded, refreshed only from a body a release shipped (an edit is kept, its line saying it carries your edit), and with no local file its effective copy and record are rebuilt. With a local file it writes neither: `pending` prints the merge to do and its record command — do the merge, show the user what changed, then run that command. A kit-file line saying it carries your edit, whatever the run's token, is offered `/agent-workflow-kit rules` to move the edit into the local file.
|
|
53
53
|
|
|
@@ -112,7 +112,7 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
112
112
|
flagged + preserved, never edited. Runs on **every** upgrade; exit 0 covers every outcome.
|
|
113
113
|
**The LATE navigator finalizer — the AUTHORITATIVE run, after the last `docs/ai` mutation.** `lens` above rewrites `docs/ai/agent_rules.md`, so the step-3 index ensure is already behind by the time the run-list ends. Re-run that ONE op here, before the step-4 report: `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only index --cwd <project>`. Relay **this** line in the report (it supersedes the early one; an untouched tree changes nothing, a failure STOPs the upgrade like any other ensure). On the migrated path the same rung runs again at the END of step 7 — after the migrations, before the step-8 re-stamp.
|
|
114
114
|
4. **Equal-head exit — a real successful-exit report, not a bare stop.** If the stamp **equals** the head, the lineage is up to date — but step 3 (the stamp-independent reconciles) ran first and may have changed things, so this is a proper exit report, not a no-op:
|
|
115
|
-
- **A skip line that contradicts the observed tree is a FINDING, never pasted as neutral.** Every ensure skip names the fact it proved (the probes that answered absent
|
|
115
|
+
- **A skip line that contradicts the observed tree is a FINDING, never pasted as neutral.** Every ensure skip names the fact it proved (the probes that answered absent); if the tree you can see disproves that reason — a "no Node" skip beside deployed Node scripts, a "not deployed" skip beside a stamped `docs/ai` — do not relay the line as an outcome: raise it in the report as a defect of the tool, with the contradicting fact named, and stop short of any step that would build on the skip.
|
|
116
116
|
- **Report step 3's outcome in plain language** — for **each** `pointers` slot (workflow-methodology, orchestration-recipes and autonomy-policy) whether it was *added*, was *already present* (nothing changed), or was *skipped* (the soft-skip from step 3, with its reason — over the line limit / engine too old / the autonomy pointer's anchor absent), and each Memory Map row the same way (or *refreshed*); the **nine project-configuration ensure** (`configs`) lines exactly as the one ensure run composed them (the ensures and their outcome tokens are enumerated in step 3), each rendered in plain language: what was created, what was left exactly as the user wrote it, and — for a `failed` line — what stopped it; for the navigator, relay the **late** `--only index` line, not the early one; the **`gates-migration`** result — *nothing to migrate*, the shown plan *applied* on your explicit yes, or the plan *left unapplied* (consent not given), with any INERT checker or CUSTOMIZED entries named; the **placed-bridge refresh** (`bridges`) outcome — paste the tool's per-bridge lines verbatim (they are already plain: *refreshed* / *already current* / *skipped — not placed* / `skipped-readonly` with its re-scan verdict / *could not refresh* + recovery); the **agent-rules lens** (`lens`) outcome (*refreshed* / *already current* / *custom edit preserved + note* / *file absent* / *engine too old* / *over the line cap*) and the **Communication-section** outcome (its own set: refreshed / already current / custom preserved + note / section absent — noted / over the cap — refused) and the **story-sessions section** outcome (its own set: refreshed / already current / custom edit preserved + note / section absent — noted / over the file's line cap — refused); the **full-flow offer** (`tier`) lines; the **bridge-settings reconcile** (`bridge-settings`) outcome (paste the tool's line(s) verbatim); and, for a hidden deployment, whether the hidden-mode footprint (`footprint`) was *moved to project-local*, was *already project-local* (nothing changed), or needed a question (ambiguous visibility). Plain wording only — never the reconcile/slot/anchor/marker terms (the never-leak-kit-internals Gotcha — `${CLAUDE_SKILL_DIR}/references/shared/deploy-tail.md`).
|
|
117
117
|
- **Never surface the structure number on this exit.** Whatever step 3 did, do **not** recite the `docs/ai` structure version, the internal versioning vocabulary, or the two-axes note here — the number is inert on an equal-head exit; it belongs to *Version disclosure* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md` (shown at the never-downgrade STOP, the explicit status view, or on an explicit ask). Frame the success itself per the final bullet: if step 3 changed anything, say **what changed** in plain human terms; only a pure zero-diff no-op is *settings already current — no update needed*.
|
|
118
118
|
- **Render the mandatory Recommendations section — on this exit too, BEFORE the footer.** Run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root>` and PRESENT its output — from the `## Recommendations (agent-workflow)` header — in the user's conversational language: every fact, count and item from the tool, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; show the raw tool block on request. The section is present-even-when-empty (with everything optimal the body is exactly `no recommendations — flow optimal.`) and VERDICT-FIRST — the composed verdict line renders from the frozen templates `{K} item(s) need attention` / `nothing is broken` / `{N} optional recommendation(s), apply any you want` / `optimality NOT attested — {M} probe check(s) skipped`. Then OFFER the consent route: the user picks items in plain language; surface each picked item's posture note and get the explicit confirm; run its lane's rendered lines — chat: the one-liner; harness: the check line, then on the yes to its result the apply line; user: the user's own step — per the full consent route in `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`. Pinned order on this exit: Recommendations block → optional applies → report footer → the commit ask (the advisor/apply lane never lands after the commit ask).
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// included, kept current by the one rule. Each family file is surveyed by proof before any write:
|
|
3
3
|
// absent, current, prior (a body SCRIPT_PRIORS catalogs for its name) or edited. On every plain run a
|
|
4
4
|
// prior is refreshed, an edited one replaced in place and an absent one placed create-only, with no
|
|
5
|
-
// question and no copy kept; a current one is left. The installer set is written first;
|
|
6
|
-
//
|
|
7
|
-
// or ensure-configs.mjs: the CLI composes this op from the module's index, and
|
|
8
|
-
// its channel from there.
|
|
5
|
+
// question and no copy kept; a current one is left. The installer set is written first; after the last
|
|
6
|
+
// write the project's own rotator brings the ADR store current (`--ensure-current`). It never imports
|
|
7
|
+
// ensure-specs.mjs or ensure-configs.mjs: the CLI composes this op from the module's index, and
|
|
8
|
+
// ensure-specs.mjs takes its channel from there.
|
|
9
9
|
//
|
|
10
|
-
// Dependency-free, Node >= 22. Every fs primitive
|
|
10
|
+
// Dependency-free, Node >= 22. Every fs primitive and the spawn are injectable (deps.*). No side effects on import.
|
|
11
11
|
|
|
12
|
+
import { spawnSync } from 'node:child_process';
|
|
12
13
|
import { lstatSync, readFileSync } from 'node:fs';
|
|
13
14
|
import { join } from 'node:path';
|
|
14
15
|
import { lstatNoFollow, writeContainedFileAtomic, writeProjectFileCreateOnly } from '../atomic-write.mjs';
|
|
15
16
|
import { composeFailure, composeOutcome, nodeEvidenceRefusal, probeSeedTarget, tmpNote } from '../ensure-ops.mjs';
|
|
16
|
-
import { surveyAdrLayoutStrict } from '../family-registry.mjs';
|
|
17
17
|
import { BUNDLED_SCRIPT_NAMES } from '../node-evidence.mjs';
|
|
18
18
|
import { CHECKER_PAIR, INSTALLER_SET, READER_PAIR, SCRIPT_PRIORS, classifyDeployedScript } from '../script-priors.mjs';
|
|
19
19
|
|
|
@@ -23,11 +23,9 @@ const BUNDLED = ['references', 'scripts'];
|
|
|
23
23
|
// Where an edit meant to last goes: the installer's in the local hook file, every other file's beside it.
|
|
24
24
|
export const SCRIPT_CHANNEL = 'a script or suite of your own under its own name in scripts/, or a config the script reads';
|
|
25
25
|
export const LOCAL_HOOK_CHANNEL = 'the local hook file scripts/pre-commit.local, which the commit hook runs first';
|
|
26
|
-
// The family files whose bytes import or read archive-decisions.mjs, plus that file (the suite derives it).
|
|
27
|
-
export const DECISIONS_GROUP = Object.freeze(['archive-decisions.mjs', 'archive-decisions.test.mjs', 'archiver-structure.test.mjs']);
|
|
28
26
|
// The family files memory copies on Node evidence alone, accepted or not (the suite derives them).
|
|
29
27
|
export const SEED_NAMES = Object.freeze(['_expect-shim.mjs', 'archive-decisions.mjs', 'archive-decisions.test.mjs', 'markdown-blocks.mjs']);
|
|
30
|
-
const
|
|
28
|
+
const ROTATOR = 'archive-decisions.mjs';
|
|
31
29
|
const PAIRS = new Set([...READER_PAIR, ...CHECKER_PAIR]);
|
|
32
30
|
// The family in write order: the installer set, then every other bundled name in code-unit order.
|
|
33
31
|
const FAMILY = Object.freeze([...INSTALLER_SET, ...BUNDLED_SCRIPT_NAMES.filter((name) => !PAIRS.has(name) && !INSTALLER_SET.includes(name)).sort()]);
|
|
@@ -48,8 +46,8 @@ const seedClosure = (standing, bundleOf) => {
|
|
|
48
46
|
return reached;
|
|
49
47
|
};
|
|
50
48
|
|
|
51
|
-
// → { refusal } | { notPlaced } | { files, accepted
|
|
52
|
-
//
|
|
49
|
+
// → { refusal } | { notPlaced } | { files, accepted }. A family path of another node kind is judged
|
|
50
|
+
// before the component, so a linked family file never reads as not-placed.
|
|
53
51
|
const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
54
52
|
const dir = lstatNoFollow(join(cwd, SCRIPTS_DIR), lstat);
|
|
55
53
|
if (dir === null) return { notPlaced: true };
|
|
@@ -72,11 +70,7 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
|
72
70
|
const bytes = probe.present ? read(join(cwd, rel)) : undefined;
|
|
73
71
|
return { name, rel, bundle: bundles.get(name), state: probe.present ? classifyDeployedScript(bytes, name, bundles.get(name), deps.priors ?? SCRIPT_PRIORS) : 'absent' };
|
|
74
72
|
});
|
|
75
|
-
|
|
76
|
-
return { files, accepted, layout: surveyAdrLayoutStrict(cwd, deps) };
|
|
77
|
-
} catch (err) {
|
|
78
|
-
return { files, accepted, layoutError: causeOf(err) };
|
|
79
|
-
}
|
|
73
|
+
return { files, accepted };
|
|
80
74
|
};
|
|
81
75
|
|
|
82
76
|
// ── the lines (composed from what HAPPENED: each file's state and the fate of its write) ─────────
|
|
@@ -91,7 +85,6 @@ const fileLine = (f, fate, dryRun) => {
|
|
|
91
85
|
const tail = fate === 'written' ? done : dryRun ? `would be ${done}` : `not ${verb}; ${fate === 'refused' ? 'its write was refused (above)' : 'the run stopped before it'}`;
|
|
92
86
|
return `${f.rel}: ${HEADS[f.state]} — ${tail}${f.state === 'custom' ? `; an edit meant to last goes in ${f.name === INSTALLER_SET[0] ? LOCAL_HOOK_CHANNEL : SCRIPT_CHANNEL}` : ''}`;
|
|
93
87
|
};
|
|
94
|
-
const heldLine = (layout) => `${SCRIPTS_DIR}/: ${DECISIONS_GROUP.slice(0, -1).join(', ')} and ${DECISIONS_GROUP.at(-1)} are held back while this project is on the older ADR layout (${layout}) — run the opt-in /agent-workflow-kit migrate-adr-store (it previews, and never commits); the next upgrade judges them`;
|
|
95
88
|
const NOT_ACCEPTED = `${SCRIPTS_DIR}/: the enforcement scripts were not accepted in this project, so no other kit script is placed`;
|
|
96
89
|
// The hook-run line, once after the file lines of a run that wrote (or, dry, would write) a file.
|
|
97
90
|
const hookLine = (accepted, dryRun) => (accepted
|
|
@@ -138,6 +131,24 @@ const writeRun = ({ cwd, files, accepted, dryRun, deps, read }) => {
|
|
|
138
131
|
return { due, fates, failure, written, lines: due.map((f) => fileLine(f, fates.get(f.rel), dryRun)), tail: [...hook, ...notes, ...(failure ? partialNote(written.length) : [])] };
|
|
139
132
|
};
|
|
140
133
|
|
|
134
|
+
// ── the ADR store, after the writes ───────────────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
// The rotator the run just left on the bundled body brings the store current; its output is relayed
|
|
137
|
+
// keyed on its contracted summary, the last standard output line.
|
|
138
|
+
const STORE = 'ADR store: ';
|
|
139
|
+
const ENSURE = `${SCRIPTS_DIR}/${ROTATOR} --ensure-current`;
|
|
140
|
+
const WOULD_STORE = `${STORE}${ENSURE} would run after the writes, bringing the store current or writing nothing when it already is`;
|
|
141
|
+
const outputLines = (text) => String(text ?? '').split(/\r?\n/).filter((line) => line !== '');
|
|
142
|
+
// → { brought, lines, failure? }
|
|
143
|
+
const runStore = (cwd, deps) => {
|
|
144
|
+
const r = (deps.spawnSync ?? spawnSync)(process.execPath, [join(cwd, SCRIPTS_DIR, ROTATOR), '--ensure-current'], { cwd, encoding: 'utf8' });
|
|
145
|
+
const [out, err] = [outputLines(r.stdout), outputLines(r.stderr)];
|
|
146
|
+
const ended = r.error ? `ended with an error (${causeOf(r.error)})` : r.signal ? `was killed by signal ${r.signal}` : r.status !== 0 ? `exited with code ${r.status}` : null;
|
|
147
|
+
if (ended) return { failure: `${ENSURE} ${ended} — the ADR store is not current`, lines: [...err, ...out].map((line) => STORE + line) };
|
|
148
|
+
const brought = (out.at(-1) ?? '').startsWith('brought-current:');
|
|
149
|
+
return { brought, lines: [...(brought ? out : []), ...err].map((line) => STORE + line) };
|
|
150
|
+
};
|
|
151
|
+
|
|
141
152
|
// ── the op ────────────────────────────────────────────────────────────────────────────────────────
|
|
142
153
|
|
|
143
154
|
export const ensureScripts = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
@@ -149,26 +160,15 @@ export const ensureScripts = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
149
160
|
if (found.refusal) return found.refusal;
|
|
150
161
|
if (found.notPlaced) return composeOutcome(OP, 'not-placed', [`${SCRIPTS_DIR}/: no kit script stands in it, so none is placed`], false);
|
|
151
162
|
const { files, accepted } = found;
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (found.layoutError !== undefined) {
|
|
156
|
-
const layoutLine = `${SCRIPTS_DIR}/: the ADR-store layout could not be read (${found.layoutError}), so the other kit scripts wait for the layout`;
|
|
157
|
-
const set = accepted ? files.filter((f) => INSTALLER_SET.includes(f.name)) : [];
|
|
158
|
-
const r = writeRun({ cwd, files: set, accepted, dryRun, deps, read });
|
|
159
|
-
if (r.failure) return composeFailure(OP, r.failure[0], r.failure[1], ...r.lines, layoutLine, ...r.tail);
|
|
160
|
-
return composeFailure(OP, 'adr-layout-unverifiable', layoutLine, ...r.lines, ...r.tail);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const held = OLD_ADR_LAYOUTS.has(found.layout);
|
|
164
|
-
const live = files.filter((f) => !(held && DECISIONS_GROUP.includes(f.name)));
|
|
165
|
-
const current = live.filter((f) => f.state === 'current').length;
|
|
166
|
-
const r = writeRun({ cwd, files: live, accepted, dryRun, deps, read });
|
|
167
|
-
const body = [...r.lines, ...(current > 0 ? [`${SCRIPTS_DIR}/: ${current} other kit scripts are already the bundled body — nothing written`] : []), ...(held ? [heldLine(found.layout)] : []), ...declined];
|
|
163
|
+
const current = files.filter((f) => f.state === 'current').length;
|
|
164
|
+
const r = writeRun({ cwd, files, accepted, dryRun, deps, read });
|
|
165
|
+
const body = [...r.lines, ...(current > 0 ? [`${SCRIPTS_DIR}/: ${current} other kit scripts are already the bundled body — nothing written`] : []), ...(accepted ? [] : [NOT_ACCEPTED])];
|
|
168
166
|
if (r.failure) return composeFailure(OP, r.failure[0], r.failure[1], ...body, ...r.tail);
|
|
167
|
+
const rotator = files.some((f) => f.name === ROTATOR);
|
|
168
|
+
const store = !rotator ? { lines: [] } : dryRun ? { lines: [WOULD_STORE] } : runStore(cwd, deps);
|
|
169
|
+
if (store.failure) return composeFailure(OP, 'adr-store-not-current', store.failure, ...body, ...r.tail, ...store.lines);
|
|
169
170
|
const landed = (state) => (dryRun ? r.due : r.written).some((f) => f.state === state);
|
|
170
|
-
const token =
|
|
171
|
-
: landed('
|
|
172
|
-
|
|
173
|
-
return composeOutcome(OP, token, [...body, ...r.tail], false);
|
|
171
|
+
const token = landed('absent') ? (dryRun ? 'would-seed' : 'seeded')
|
|
172
|
+
: landed('prior') || landed('custom') || store.brought ? (dryRun ? 'would-refresh' : 'refreshed') : 'already-present';
|
|
173
|
+
return composeOutcome(OP, token, [...body, ...r.tail, ...store.lines], false);
|
|
174
174
|
};
|
package/tools/ensure-configs.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// executor .claude/agents/executor.md judged against docs/ai/vehicles.json, never written: a differing body is pending
|
|
9
9
|
// scripts scripts/<every kit script> once a kit script outside the seed names stands there, every file not current
|
|
10
10
|
// + the installer set written with no question and no copy kept; installer set first; on a
|
|
11
|
-
// declined offer only the standing seed files and the modules they import
|
|
11
|
+
// declined offer only the standing seed files and the modules they import;
|
|
12
|
+
// then the project's rotator brings the ADR store current (--ensure-current)
|
|
12
13
|
// specs scripts/<spec layer> reader + checker pairs seeded when absent, refreshed only on
|
|
13
14
|
// + docs/ai/specs/index.md a shipped prior body, an edited one replaced only on the
|
|
14
15
|
// user's yes; store root seeded behind a current checker
|
|
@@ -110,8 +111,8 @@ ensure writes every kit script that is not the bundled body, the hook installer
|
|
|
110
111
|
first, with no question and no copy kept: a body a release shipped is refreshed, an edited one replaced
|
|
111
112
|
(its line names where an edit meant to last goes) and an absent one placed; on a project that
|
|
112
113
|
declined the enforcement offer, its standing seed files are kept current the same way, with an
|
|
113
|
-
absent module they import placed, and no other kit script is placed;
|
|
114
|
-
|
|
114
|
+
absent module they import placed, and no other kit script is placed; after the writes the project's
|
|
115
|
+
scripts/archive-decisions.mjs --ensure-current brings the ADR store current, an older layout moved.
|
|
115
116
|
|
|
116
117
|
Exit codes: 0 every op fine; 1 an op failed (its line says so) or there is no deployment here; 2 usage.`;
|
|
117
118
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// `specs` sits after `scripts` (its reader pair is a scripts/ seed too) and BEFORE `index`: the store
|
|
12
12
|
// root it seeds is a docs/ai file the navigator must count. `specs` alone owns the replace run: its
|
|
13
13
|
// edited files are written only on the user's yes, while `scripts` writes every kit script with no
|
|
14
|
-
// question.
|
|
14
|
+
// question and then runs the project's rotator (`--ensure-current`), which brings the ADR store current.
|
|
15
15
|
// `executor` follows `vehicles`: its body is derived from the settings file that op seeds.
|
|
16
16
|
// `rules` follows `specs` and precedes `index`: the rules files it lays are docs/ai files the navigator counts.
|
|
17
17
|
export const ENSURE_OPS = Object.freeze(['orchestration', 'gates', 'autonomy', 'vehicles', 'executor', 'scripts', 'specs', 'rules', 'index']);
|
|
@@ -20,7 +20,7 @@ export const ENSURE_OPS = Object.freeze(['orchestration', 'gates', 'autonomy', '
|
|
|
20
20
|
// walks this set), and each has exactly one `would-` counterpart below. `refreshed` is the spec-layer
|
|
21
21
|
// ensure's pair refresh (reader or checker) or the scripts ensure's write of a kit script — a deployed
|
|
22
22
|
// script on a body a release shipped, or an edited one, rewritten to the bundled one on a plain run, an
|
|
23
|
-
// absent kit script placed (`seeded`); an edited spec-layer file is replaced only by the replace run the
|
|
23
|
+
// absent kit script placed (`seeded`), or the ADR store the rotator brought current; an edited spec-layer file is replaced only by the replace run the
|
|
24
24
|
// user's yes starts (--replace-custom, over the spec layer).
|
|
25
25
|
export const WRITE_TOKENS = Object.freeze(['seeded', 'note-refreshed', 'refreshed', 'regenerated']);
|
|
26
26
|
export const DRY_RUN_TOKENS = Object.freeze(['would-seed', 'would-refresh-note', 'would-refresh', 'would-regenerate']);
|
|
@@ -40,7 +40,6 @@ export const ENSURE_TOKENS = Object.freeze([
|
|
|
40
40
|
'customized-preserved',
|
|
41
41
|
'malformed-preserved',
|
|
42
42
|
'skipped-no-node-evidence',
|
|
43
|
-
'old-adr-layout-migration-instructed',
|
|
44
43
|
'failed',
|
|
45
44
|
]);
|
|
46
45
|
|
|
@@ -51,7 +50,8 @@ export const FAILURE_CAUSES = Object.freeze([
|
|
|
51
50
|
'race-unresolved',
|
|
52
51
|
'template-unreadable',
|
|
53
52
|
'bundle-unreadable',
|
|
54
|
-
'
|
|
53
|
+
// The scripts op's store run: the rotator ended with an error, a signal or a non-zero exit.
|
|
54
|
+
'adr-store-not-current',
|
|
55
55
|
// A Node probe (package.json, a kit-seeded script) failed with anything but ENOENT: whether Node runs
|
|
56
56
|
// here is unproven, so the ensures that place Node scripts write nothing (contract: kit/node-evidence).
|
|
57
57
|
'node-evidence-unverifiable',
|
|
@@ -91,6 +91,5 @@ export const RELAYED_ENSURE_TOKENS = Object.freeze([
|
|
|
91
91
|
'already-present',
|
|
92
92
|
'not-placed',
|
|
93
93
|
'skipped-no-node-evidence',
|
|
94
|
-
'old-adr-layout-migration-instructed',
|
|
95
94
|
'failed',
|
|
96
95
|
]);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// migrate-adr-store.mjs — the consent-gated, opt-in migration of an EXISTING consumer's docs/ai from
|
|
3
3
|
// the retired 3-tier ADR cascade (HOT decisions.md → WARM/COLD monoliths) to the one-file-per-ADR
|
|
4
4
|
// store (HOT decisions.md + docs/ai/adr/AD-NNN-slug.md records + the docs/ai/adr/log.md navigator).
|
|
5
|
-
// Reached
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// Reached through the opt-in `migrate-adr-store` mode (SKILL.md): the upgrade moves an older layout
|
|
6
|
+
// itself wherever scripts/ holds the kit's rotator, so after a full upgrade this mode does nothing; it
|
|
7
|
+
// stays for a project whose scripts/ holds no kit script.
|
|
8
8
|
//
|
|
9
9
|
// What it does (in order, on --apply):
|
|
10
10
|
// 1. GATE — docs/ai must be deployed, and the tree must be on the OLD layout. That is TWO shapes:
|