@iceinvein/agent-skills 0.2.0 → 0.4.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.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/index.js +14 -10
  3. package/package.json +1 -1
  4. package/skills/index.json +4 -4
  5. package/skills/migrate/README.md +35 -23
  6. package/skills/migrate/SKILL.md +75 -15
  7. package/skills/migrate/bin/migrate.ts +90 -0
  8. package/skills/migrate/docs/architecture.md +61 -26
  9. package/skills/migrate/docs/reference.md +53 -8
  10. package/skills/migrate/fixtures/fake-gh.ts +113 -0
  11. package/skills/migrate/fixtures/flow-target/docs/WORK.md +12 -0
  12. package/skills/migrate/fixtures/flow-target/docs/modernisation/capability-map/.gitkeep +0 -0
  13. package/skills/migrate/fixtures/flow-target/tools/flow/src/cli.ts +156 -0
  14. package/skills/migrate/package.json +1 -1
  15. package/skills/migrate/references/phases/adjudicate.md +161 -0
  16. package/skills/migrate/references/phases/handoff.md +220 -0
  17. package/skills/migrate/references/phases/probe.md +2 -2
  18. package/skills/migrate/references/phases/queue.md +21 -14
  19. package/skills/migrate/references/run-ops.md +17 -13
  20. package/skills/migrate/scripts/__tests__/adapter-flow.test.ts +290 -0
  21. package/skills/migrate/scripts/__tests__/adapter-github.test.ts +232 -0
  22. package/skills/migrate/scripts/__tests__/adapter-markdown.test.ts +183 -0
  23. package/skills/migrate/scripts/__tests__/adjudicate.test.ts +332 -0
  24. package/skills/migrate/scripts/__tests__/assumptions.test.ts +179 -0
  25. package/skills/migrate/scripts/__tests__/coverage.test.ts +192 -0
  26. package/skills/migrate/scripts/__tests__/e2e-express.test.ts +167 -7
  27. package/skills/migrate/scripts/__tests__/e2e-webforms.test.ts +9 -4
  28. package/skills/migrate/scripts/__tests__/forecast.test.ts +280 -0
  29. package/skills/migrate/scripts/__tests__/gates-handoff.test.ts +309 -0
  30. package/skills/migrate/scripts/__tests__/handoff-cmd.test.ts +308 -0
  31. package/skills/migrate/scripts/__tests__/handoff-order.test.ts +156 -0
  32. package/skills/migrate/scripts/adapters/flow.ts +280 -0
  33. package/skills/migrate/scripts/adapters/github.ts +260 -0
  34. package/skills/migrate/scripts/adapters/markdown.ts +175 -0
  35. package/skills/migrate/scripts/adjudicate-cmd.ts +243 -0
  36. package/skills/migrate/scripts/assumptions.ts +188 -0
  37. package/skills/migrate/scripts/check.ts +119 -320
  38. package/skills/migrate/scripts/coverage-cmd.ts +86 -0
  39. package/skills/migrate/scripts/coverage.ts +151 -0
  40. package/skills/migrate/scripts/dates.ts +17 -0
  41. package/skills/migrate/scripts/forecast-cmd.ts +124 -0
  42. package/skills/migrate/scripts/forecast.ts +264 -0
  43. package/skills/migrate/scripts/gates/adjudication.ts +30 -0
  44. package/skills/migrate/scripts/gates/census.ts +107 -0
  45. package/skills/migrate/scripts/gates/citations.ts +11 -0
  46. package/skills/migrate/scripts/gates/context.ts +76 -0
  47. package/skills/migrate/scripts/gates/coverage.ts +22 -0
  48. package/skills/migrate/scripts/gates/deltas.ts +15 -0
  49. package/skills/migrate/scripts/gates/handoff.ts +145 -0
  50. package/skills/migrate/scripts/gates/leaks.ts +11 -0
  51. package/skills/migrate/scripts/gates/parity.ts +15 -0
  52. package/skills/migrate/scripts/gates/queue.ts +9 -0
  53. package/skills/migrate/scripts/gates/refs.ts +97 -0
  54. package/skills/migrate/scripts/gates/run-state.ts +67 -0
  55. package/skills/migrate/scripts/gates/source.ts +28 -0
  56. package/skills/migrate/scripts/handoff-cmd.ts +186 -0
  57. package/skills/migrate/scripts/handoff.ts +330 -0
  58. package/skills/migrate/scripts/paths.ts +4 -0
  59. package/skills/migrate/scripts/types.ts +43 -0
  60. package/skills/migrate/scripts/validate.ts +12 -0
  61. package/skills/migrate/skill.json +2 -2
  62. package/skills/migrate/templates/forecast-assumptions.md +59 -0
  63. package/skills/sluice/SKILL.md +20 -7
  64. package/skills/sluice/references/deep-channel.md +20 -0
  65. package/skills/sluice/references/finish.md +4 -2
  66. package/skills/sluice/references/meter.md +38 -0
  67. package/skills/sluice/scripts/run-stats.sh +236 -0
  68. package/skills/sluice/skill.json +4 -3
package/README.md CHANGED
@@ -28,7 +28,7 @@ Auto-detects Claude Code, Cursor, Codex, or Gemini CLI. Use `--tool claude` to t
28
28
 
29
29
  | Skill | What it does |
30
30
  |-------|--------------|
31
- | **migrate** | Walks a legacy codebase through probe, enumerate, seam, extract, parity, and queue: measured surface coverage, an empirically derived capability seam, cited requirements, a parity plan, and a batch decision queue. Bundles a Bun CLI that enforces the coverage arithmetic and phase ordering instead of trusting it. |
31
+ | **migrate** | Walks a legacy codebase through probe, enumerate, seam, extract, parity, queue, adjudicate and handoff: measured surface coverage, an empirically derived capability seam, cited requirements, a parity plan, a batch decision queue, and work items emitted to markdown, GitHub or a flow target with coverage and forecast read back. Bundles a Bun CLI that enforces the coverage arithmetic and phase ordering instead of trusting it. |
32
32
 
33
33
  ### Code Architecture
34
34
 
@@ -103,7 +103,7 @@ Skills that shape how work gets done rather than analyzing code.
103
103
 
104
104
  | Skill | What it does |
105
105
  |-------|--------------|
106
- | **sluice** | Routes work by change shape into four channels (`bypass`, `fast`, `main`, `deep`) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Six rules live as one-liners in the router; the full treatment sits in references read only on friction. Claude Code only. Conflicts with the superpowers plugin, which requires its own fixed pipeline up front for anything that adds to or changes what the software does, not just code edits; disable superpowers before installing. |
106
+ | **sluice** | Routes work by change shape into four channels (`bypass`, `fast`, `main`, `deep`) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Seven rules live as one-liners in the router; the full treatment sits in references read only on friction. Each run closes with a ledger read out of the session transcript: elapsed, tools, tokens, and what every dispatched agent cost. Claude Code only. Conflicts with the superpowers plugin, which requires its own fixed pipeline up front for anything that adds to or changes what the software does, not just code edits; disable superpowers before installing. |
107
107
 
108
108
  ### Orchestration
109
109
 
package/dist/cli/index.js CHANGED
@@ -402,7 +402,7 @@ function resolveBundlePaths(entries, bundle) {
402
402
  }
403
403
 
404
404
  // src/cli/adapters/claude.ts
405
- import { chmodSync, existsSync as existsSync2, mkdirSync, rmSync, statSync, unlinkSync } from "node:fs";
405
+ import { chmodSync, existsSync as existsSync2, mkdirSync, rmSync, rmdirSync, statSync, unlinkSync } from "node:fs";
406
406
  import { dirname, join as join2 } from "node:path";
407
407
  function shouldBeExecutable(relPath, content) {
408
408
  if (relPath.endsWith(".sh"))
@@ -569,7 +569,7 @@ var claudeAdapter = {
569
569
  const stopAt = config.bundleRoot ? join2(cwd, config.bundleRoot, "..") : cwd;
570
570
  while (dir !== stopAt && dir !== "/" && dir.startsWith(cwd)) {
571
571
  try {
572
- rmSync(dir, { recursive: false });
572
+ rmdirSync(dir);
573
573
  } catch {
574
574
  break;
575
575
  }
@@ -598,7 +598,7 @@ var claudeAdapter = {
598
598
  };
599
599
 
600
600
  // src/cli/adapters/cursor.ts
601
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, rmSync as rmSync2 } from "node:fs";
601
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, rmdirSync as rmdirSync2 } from "node:fs";
602
602
  import { dirname as dirname2, join as join3 } from "node:path";
603
603
  var cursorAdapter = {
604
604
  name: "cursor",
@@ -651,7 +651,7 @@ var cursorAdapter = {
651
651
  if (existsSync3(fullPath)) {
652
652
  unlinkSync2(fullPath);
653
653
  try {
654
- rmSync2(dirname2(fullPath), { recursive: false });
654
+ rmdirSync2(dirname2(fullPath));
655
655
  } catch {}
656
656
  }
657
657
  }
@@ -728,7 +728,7 @@ var codexAdapter = {
728
728
  };
729
729
 
730
730
  // src/cli/adapters/gemini.ts
731
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, unlinkSync as unlinkSync3, rmSync as rmSync3 } from "node:fs";
731
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, unlinkSync as unlinkSync3, rmdirSync as rmdirSync3 } from "node:fs";
732
732
  import { dirname as dirname3, join as join5 } from "node:path";
733
733
  var geminiAdapter = {
734
734
  name: "gemini",
@@ -781,7 +781,7 @@ var geminiAdapter = {
781
781
  if (existsSync5(fullPath)) {
782
782
  unlinkSync3(fullPath);
783
783
  try {
784
- rmSync3(dirname3(fullPath), { recursive: false });
784
+ rmdirSync3(dirname3(fullPath));
785
785
  } catch {}
786
786
  }
787
787
  }
@@ -868,7 +868,7 @@ async function installSkill(cwd, manifest, files, targetTools, activation) {
868
868
  }
869
869
 
870
870
  // src/cli/commands/remove.ts
871
- import { existsSync as existsSync6, statSync as statSync2, unlinkSync as unlinkSync4, rmSync as rmSync4 } from "node:fs";
871
+ import { existsSync as existsSync6, statSync as statSync2, unlinkSync as unlinkSync4, rmSync as rmSync2 } from "node:fs";
872
872
  import { basename, join as join7 } from "node:path";
873
873
 
874
874
  // src/cli/github.ts
@@ -992,7 +992,7 @@ function isSharedConfigFile(relPath) {
992
992
  function removeFileOrDir(fullPath) {
993
993
  const stat = statSync2(fullPath);
994
994
  if (stat.isDirectory()) {
995
- rmSync4(fullPath, { recursive: true, force: true });
995
+ rmSync2(fullPath, { recursive: true, force: true });
996
996
  } else {
997
997
  unlinkSync4(fullPath);
998
998
  }
@@ -1015,6 +1015,8 @@ async function removeSkill(cwd, skillName) {
1015
1015
  return true;
1016
1016
  if (config.supporting && Object.values(config.supporting).includes(f))
1017
1017
  return true;
1018
+ if (config.bundleRoot && f.startsWith(`${config.bundleRoot}/`) && !isSharedConfigFile(f))
1019
+ return true;
1018
1020
  if (config.mcpServers && (f.includes(".claude/settings") || f.includes(".cursor/mcp") || f.includes(".gemini/settings")))
1019
1021
  return true;
1020
1022
  return false;
@@ -1064,7 +1066,7 @@ async function infoSkill(skillName) {
1064
1066
  }
1065
1067
 
1066
1068
  // src/cli/commands/remove.ts
1067
- import { existsSync as existsSync7, statSync as statSync3, unlinkSync as unlinkSync5, rmSync as rmSync5 } from "node:fs";
1069
+ import { existsSync as existsSync7, statSync as statSync3, unlinkSync as unlinkSync5, rmSync as rmSync3 } from "node:fs";
1068
1070
  import { basename as basename2, join as join8 } from "node:path";
1069
1071
  var SHARED_CONFIG_FILES2 = new Set([
1070
1072
  ".claude/settings.json",
@@ -1083,7 +1085,7 @@ function isSharedConfigFile2(relPath) {
1083
1085
  function removeFileOrDir2(fullPath) {
1084
1086
  const stat = statSync3(fullPath);
1085
1087
  if (stat.isDirectory()) {
1086
- rmSync5(fullPath, { recursive: true, force: true });
1088
+ rmSync3(fullPath, { recursive: true, force: true });
1087
1089
  } else {
1088
1090
  unlinkSync5(fullPath);
1089
1091
  }
@@ -1106,6 +1108,8 @@ async function removeSkill2(cwd, skillName) {
1106
1108
  return true;
1107
1109
  if (config.supporting && Object.values(config.supporting).includes(f))
1108
1110
  return true;
1111
+ if (config.bundleRoot && f.startsWith(`${config.bundleRoot}/`) && !isSharedConfigFile2(f))
1112
+ return true;
1109
1113
  if (config.mcpServers && (f.includes(".claude/settings") || f.includes(".cursor/mcp") || f.includes(".gemini/settings")))
1110
1114
  return true;
1111
1115
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iceinvein/agent-skills",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Install agent skills into AI coding tools",
5
5
  "author": "iceinvein",
6
6
  "license": "MIT",
package/skills/index.json CHANGED
@@ -225,9 +225,9 @@
225
225
  },
226
226
  {
227
227
  "name": "migrate",
228
- "description": "Source-agnostic legacy migration mapping. Walks a legacy codebase through probe, enumerate, seam, extract, parity, and queue, building an auditable requirements ledger with mandatory citations and a `migrate check` gate in place of self-reported completeness. Use when the user asks to migrate, re-specify, replatform, or map a legacy system onto a new stack, or to resume, check, or report on a mapping run already under way.",
228
+ "description": "Source-agnostic legacy migration mapping. Walks a legacy codebase through probe, enumerate, seam, extract, parity, queue, adjudicate and handoff, building an auditable requirements ledger with mandatory citations and a `migrate check` gate in place of self-reported completeness. Use when the user asks to migrate, re-specify, replatform, or map a legacy system onto a new stack, to hand mapped requirements to a delivery team, or to resume, check, report, or forecast a mapping run already under way.",
229
229
  "type": "prompt",
230
- "version": "0.2.0"
230
+ "version": "0.3.0"
231
231
  },
232
232
  {
233
233
  "name": "module-secret-auditor",
@@ -281,9 +281,9 @@
281
281
  },
282
282
  {
283
283
  "name": "sluice",
284
- "description": "Routes work by change shape into four channels (bypass, fast, main, deep) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Carries six rules as one-liners in the router and the full treatment in references read only on friction. Claude Code only; conflicts with the superpowers plugin.",
284
+ "description": "Routes work by change shape into four channels (bypass, fast, main, deep) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Carries seven rules as one-liners in the router and the full treatment in references read only on friction, and closes each run with a ledger read out of the session transcript: elapsed, tools, tokens, and what every dispatched agent cost. Claude Code only; conflicts with the superpowers plugin.",
285
285
  "type": "prompt",
286
- "version": "1.0.0"
286
+ "version": "0.1.1"
287
287
  },
288
288
  {
289
289
  "name": "temporal-coupling-detector",
@@ -8,9 +8,9 @@ directions per lens, derives a capability seam empirically rather than by
8
8
  guesswork, extracts cited functional requirements, plans parity against the
9
9
  source, and routes every ambiguity to a batch decision queue for a human to
10
10
  adjudicate. The coverage arithmetic, citation resolution, and phase ordering
11
- are enforced by a bundled Bun CLI instead of being self-reported. Two more
12
- phases, adjudicate and handoff, complete the walkthrough but ship no CLI verb
13
- yet; see the phases table below.
11
+ are enforced by a bundled Bun CLI instead of being self-reported. Adjudicate
12
+ and handoff complete the walkthrough, and `migrate coverage` and `migrate
13
+ forecast` read delivery back through the medium handoff emitted into.
14
14
 
15
15
  ## Using it
16
16
 
@@ -31,14 +31,16 @@ that phase is current so a run never pays for prose it does not need yet.
31
31
  | 3 | Extract | `references/phases/extract.md` | `requirements.jsonl`, attribute/rule-sweep/closer census records, terminal element dispositions |
32
32
  | 4 | Parity | `references/phases/parity.md` | `deltas.jsonl` and a parity plan on every non-queued requirement |
33
33
  | 5 | Queue | `references/phases/queue.md` | Queue items carrying evidence, options and a recommendation for anything ambiguous |
34
- | 6 | Adjudicate | none yet | No verb ships in this version; `migrate status` and `migrate queue list` are the terminus |
35
- | 7 | Handoff | none yet | Same as adjudicate: no verb yet |
36
-
37
- A run in this version stops at the queue. `adjudicate` and `handoff` have no
38
- CLI verbs to complete them, so `migrate check --phase queue` is the
39
- practical terminus: its exit 0 is what "done, for now" means. Plain `migrate
40
- check` gates every phase through `handoff` and cannot pass yet for the same
41
- reason. `references/run-ops.md` covers what applies across every phase
34
+ | 6 | Adjudicate | `references/phases/adjudicate.md` | A ruling on every queue item, recorded in its own frontmatter |
35
+ | 7 | Handoff | `references/phases/handoff.md` | Work items in a delivery medium, plus `handoff.json` recording what was emitted |
36
+
37
+ A run goes probe through handoff, and plain `migrate check`, with no
38
+ `--phase`, gates every one of them: its exit 0 is what "the migration is
39
+ mapped" means. `migrate check --phase <p>` is the mid-run form, and the two
40
+ gates that describe phases 6 and 7 are phase-scoped so they stay silent
41
+ until the checked terminus reaches them. Once handoff has run, `migrate
42
+ coverage` and `migrate forecast` read delivery back through the same adapter
43
+ that emitted the work. `references/run-ops.md` covers what applies across every phase
42
44
  rather than any one of them: subagent dispatch, the batch-checkpoint
43
45
  discipline, and what happens when two agents contend for the store lock.
44
46
 
@@ -69,10 +71,11 @@ directory. See `references/recipes/README.md` for the exact file shape.
69
71
  migrate check --phase <current-phase>
70
72
  ```
71
73
 
72
- bounds the run-state gate at that phase; the other nine gates always read
73
- the whole store, so a coverage or census gap past your current phase still
74
- fails on its own gate regardless of `--phase`. Citations are checked by
75
- default; pass `--no-citations` to skip that gate.
74
+ bounds the run-state gate at that phase, and skips the two gates that
75
+ describe phases the terminus has not reached (`adjudication` and `handoff`).
76
+ The remaining nine always read the whole store, so a coverage or census gap
77
+ past your current phase still fails on its own gate regardless of `--phase`.
78
+ Citations are checked by default; pass `--no-citations` to skip that gate.
76
79
 
77
80
  ## Fixtures
78
81
 
@@ -92,12 +95,14 @@ end:
92
95
 
93
96
  `scripts/__tests__/e2e-express.test.ts` and
94
97
  `scripts/__tests__/e2e-webforms.test.ts` copy the respective fixture to a
95
- temp directory and drive the real CLI as a subprocess, probe through queue,
96
- through `init`, `import`, `census`, `phase`, `queue add`, `queue list`, and
97
- `check`, reconciling every row against the fixture's ground truth. Both end at
98
- `migrate check --phase queue` on exit 0, and then show plain `migrate check`
99
- failing on exactly `adjudicate` and `handoff`, the two phases with no verb in
100
- this version.
98
+ temp directory and drive the real CLI as a subprocess through `init`,
99
+ `import`, `census`, `phase`, `queue add`, `queue list`, and `check`,
100
+ reconciling every row against the fixture's ground truth.
101
+ `e2e-webforms.test.ts` runs probe through queue against the `aspnet` recipe.
102
+ `e2e-express.test.ts` carries on past it, through `adjudicate`, `handoff`,
103
+ `coverage` and `forecast`, and closes on plain `migrate check` at exit 0:
104
+ the whole point of the unbounded gate is that some real run has to be able
105
+ to reach it.
101
106
 
102
107
  Both show gates in both directions. Failing before they pass: the mid-run check
103
108
  after enumerate names the three closer records extract has not written yet, and
@@ -110,7 +115,7 @@ asserts the gate that should catch it does.
110
115
 
111
116
  - **[docs/reference.md](docs/reference.md)** is what you need to drive the CLI:
112
117
  the batch-file and census formats with worked examples, the row schemas and
113
- their grammars, what each of the ten gates enforces, and the exit-code
118
+ their grammars, what each of the twelve gates enforces, and the exit-code
114
119
  convention. Ships with the installed skill.
115
120
  - **[docs/architecture.md](docs/architecture.md)** is for working on the skill
116
121
  itself: the module map, the rule that decides what belongs in the CLI rather
@@ -133,6 +138,8 @@ The store lives at `.migrate/` in the target repo and is committed.
133
138
  | `.migrate/phases.json` | object | per-phase status, batches, resume pointers |
134
139
  | `.migrate/seam.md` | prose | validator scripts and their raw output |
135
140
  | `.migrate/parity-basis.md` | prose | runnable-versus-source-only detection evidence |
141
+ | `.migrate/handoff.json` | What handoff emitted, the refs that make a re-run idempotent, and the forecast basis |
142
+ | `.migrate/forecast-assumptions.md` | Owner-attested forecast inputs; `migrate forecast` refuses without it |
136
143
  | `.migrate/queue/q-<slug>.md` | prose | evidence, options, recommendation |
137
144
  | `.migrate/.env` | secrets | runtime-lens credentials, gitignored |
138
145
  | `docs/migrate/*.md` | generated | human-readable views, written by `migrate report` |
@@ -151,6 +158,10 @@ The store lives at `.migrate/` in the target repo and is committed.
151
158
  | `migrate check [--phase <p>] [--no-citations] [--leaks]` | Runs the gates |
152
159
  | `migrate status` | Phase state, counts, resume pointer |
153
160
  | `migrate reset --phase <phase>` | Clears one phase's derived rows and returns it to `pending` |
161
+ | `migrate adjudicate [<id>] [--ruling <text>] [--force]` | Prints the review sheet, or records one ruling |
162
+ | `migrate handoff [--adapter <name>] [--dry-run]` | Emits the requirements as work items |
163
+ | `migrate coverage [--adapter <name>]` | Built versus confirmed, read back through the adapter |
164
+ | `migrate forecast [--adapter <name>]` | Projects remaining work from measured throughput |
154
165
  | `migrate report [--out <dir>]` | Renders markdown views |
155
166
 
156
167
  Run `migrate --help` for the same list from the CLI itself.
@@ -163,7 +174,8 @@ list at the same time. `import` and `census` touch `phases.json` incidentally,
163
174
  each moving a phase to `running` (unless it is already `done`) when they record
164
175
  a batch. Nothing else writes it at all.
165
176
 
166
- A lock failure on `import`, `census`, `phase --status`, or `reset` exits `3`;
177
+ A lock failure on `import`, `census`, `phase --status`, `reset`, `adjudicate`
178
+ or `handoff` exits `3`;
167
179
  pass `--force-unlock` once you have confirmed no other agent is actually
168
180
  writing.
169
181
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: migrate
3
- description: Source-agnostic legacy migration mapping. Walks a legacy codebase through probe, enumerate, seam, extract, parity, and queue, building an auditable requirements ledger with mandatory citations and a `migrate check` gate in place of self-reported completeness. Use when the user asks to migrate, re-specify, replatform, or map a legacy system onto a new stack, or to resume, check, or report on a mapping run already under way.
3
+ description: Source-agnostic legacy migration mapping. Walks a legacy codebase through probe, enumerate, seam, extract, parity, queue, adjudicate and handoff, building an auditable requirements ledger with mandatory citations and a `migrate check` gate in place of self-reported completeness. Use when the user asks to migrate, re-specify, replatform, or map a legacy system onto a new stack, to hand mapped requirements to a delivery team, or to resume, check, report, or forecast a mapping run already under way.
4
4
  ---
5
5
 
6
6
  # migrate
@@ -129,29 +129,89 @@ migrate phase queue --status done
129
129
 
130
130
  ### 6. Adjudicate
131
131
 
132
- A run stops at the queue in this version of the tool: `adjudicate` has no verb
133
- yet, so nothing here can move a queue item's status past `open`. `migrate
134
- status` and `migrate queue list` are the terminus; adjudication arrives with
135
- its verb in the next milestone.
132
+ Produces a ruling on every queue item: `status: adjudicated` plus a `ruling`
133
+ line, written into the item's own frontmatter.
134
+
135
+ Read `references/phases/adjudicate.md` before dispatching anything.
136
+
137
+ ```
138
+ migrate adjudicate
139
+ migrate adjudicate <id> --ruling "<text>"
140
+ migrate import <elements|reqs|deltas> <batch.json>
141
+ migrate phase adjudicate --status done
142
+ ```
143
+
144
+ Run `migrate adjudicate` with no arguments first: it prints the review sheet,
145
+ severity first, each item carrying the first line of its recommendation, which
146
+ is what makes one pass over the whole queue possible.
147
+
148
+ The verb writes queue frontmatter and nothing else. A ruling's consequence in
149
+ the store (an element's disposition, a requirement's confidence or parity) goes
150
+ through `migrate import`, exactly as in phases 3 and 4, so the row files keep
151
+ one writer and one validation path. The command prints that next step on every
152
+ success because it is easy to believe the ruling did it for you.
136
153
 
137
154
  ### 7. Handoff
138
155
 
139
- `handoff` has no verb yet either, for the same reason. `migrate status` and
140
- `migrate queue list` remain the terminus; handoff arrives with its verb in the
141
- next milestone.
156
+ Produces the requirements as work items in whatever the delivery team uses,
157
+ one work item per capability in dependency order, plus `.migrate/handoff.json`
158
+ recording what was emitted and the forecast basis.
159
+
160
+ Read `references/phases/handoff.md` before dispatching anything.
161
+
162
+ ```
163
+ migrate handoff --dry-run
164
+ migrate handoff [--adapter <markdown|github|flow>]
165
+ migrate phase handoff --status done
166
+ ```
167
+
168
+ Three adapters: `markdown` (the default, a roadmap plus a file per capability),
169
+ `github` (a milestone per capability, an issue per requirement), and `flow`
170
+ (a Nexus `stack` target's capability map, and `docs/WORK.md` where it exists).
171
+
172
+ Handoff refuses while anything is unresolved and names every blocker at once:
173
+ the gate with citations and leaks both on, any queue item still open, and any
174
+ requirement blocked by one. Blocked means a `queued` confidence or a sub-high
175
+ `rubric` parity whose queue item is **still open**; once that item is
176
+ adjudicated the requirement stops blocking, even though its confidence field
177
+ still reads `queued`.
178
+
179
+ `--dry-run` writes nothing at all, `handoff.json` included, so it is safe to
180
+ run against a store you are still working on.
181
+
182
+ ## Reading progress back
183
+
184
+ Once handoff has run, these two re-read delivery through the same adapter that
185
+ emitted the work. They are the only part of this tool meant to be run
186
+ repeatedly after the mapping run ends.
187
+
188
+ ```
189
+ migrate coverage
190
+ migrate forecast
191
+ ```
192
+
193
+ `coverage` divides built by **confirmed** requirements, reports the
194
+ non-confirmed exclusions separately, and names the evidence it read. `forecast`
195
+ needs an owner-attested `.migrate/forecast-assumptions.md`, copied from
196
+ `templates/forecast-assumptions.md`, and refuses without one; it labels every
197
+ scenario as measured or as an owner target so an aspiration never reads as a
198
+ fact.
142
199
 
143
200
  ## Checking as you go
144
201
 
145
202
  Run `migrate check --phase <current>` after every batch. It bounds the
146
- run-state gate at that phase; the other nine gates always read the whole
147
- store, so a coverage or census gap past your current phase still fails on its
148
- own gate regardless of `--phase`.
203
+ run-state gate at that phase; the nine gates that are neither run-state nor
204
+ phase-scoped always read the whole store, so a coverage or census gap past
205
+ your current phase still fails on its own gate regardless of `--phase`.
149
206
 
150
207
  Run plain `migrate check` only when claiming the whole migration is complete:
151
- with no `--phase`, it gates every phase through `handoff`. In this version
152
- that cannot pass, because `adjudicate` and `handoff` have no verbs to complete
153
- them. `migrate check --phase queue` is the practical terminus for this
154
- milestone; its exit 0 is what "done, for now" means.
208
+ with no `--phase`, it gates every phase through `handoff`, and its exit 0 is
209
+ what "the migration is mapped" means.
210
+
211
+ Two of the twelve gates are phase-scoped. `adjudication` and `handoff` describe
212
+ phases 6 and 7, so they stay silent until the checked terminus reaches them;
213
+ that is what keeps `migrate check --phase queue` usable for a whole mid-run
214
+ campaign instead of red from the first batch.
155
215
 
156
216
  ```
157
217
  migrate check --phase queue
@@ -18,12 +18,20 @@ Subcommands:
18
18
  queue add <file.md> Add a queue item
19
19
  queue list [--open] List queue items, severity first
20
20
  queue show <id> Print one queue item
21
+ adjudicate [<id>] [--ruling <text>] [--force] [--force-unlock]
22
+ Print the review sheet, or record one ruling
21
23
  check [--phase <p>] [--no-citations] [--leaks]
22
24
  Run the gates; without --phase, exit 0 means
23
25
  the whole migration is complete
24
26
  status Phase state, counts, resume pointer
25
27
  reset --phase <phase> [--force-unlock]
26
28
  Clear one phase's derived rows
29
+ handoff [--adapter <name>] [--dry-run] [--force-unlock]
30
+ Emit the ratified requirements as work items
31
+ coverage [--adapter <name>] Built versus confirmed, read back through
32
+ the adapter that emitted the work
33
+ forecast [--adapter <name>] Project remaining work from measured
34
+ throughput and attested assumptions
27
35
  report [--out <dir>] Render markdown views
28
36
  --version Print the migrate version
29
37
  --help Show this message`
@@ -166,6 +174,38 @@ const HANDLERS: Record<string, Handler> = {
166
174
  const { runQueue } = await import('../scripts/queue-cmd.ts')
167
175
  return runQueue({ root, args })
168
176
  },
177
+ adjudicate: async (args) => {
178
+ const ruling = readFlag(args, '--ruling')
179
+ if (ruling.error) {
180
+ process.stderr.write(`adjudicate: ${ruling.error}\n`)
181
+ return 2
182
+ }
183
+ // Same rule as `phase`: a flag sitting in the first positional slot leaves
184
+ // the id undefined, which would silently downgrade a write to a listing
185
+ // nobody asked for. Any write-intent flag with no id to apply it to is
186
+ // that mistake, so it is refused rather than serviced.
187
+ const id = args[0]?.startsWith('--') ? undefined : args[0]
188
+ if (!id && (ruling.value !== undefined || args.includes('--force'))) {
189
+ process.stderr.write(
190
+ 'adjudicate: want <id> before --ruling/--force, as in `adjudicate q-x --ruling "..."`\n',
191
+ )
192
+ return 2
193
+ }
194
+ const { findStoreRoot } = await import('../scripts/paths.ts')
195
+ const root = await findStoreRoot(process.cwd())
196
+ if (!root) {
197
+ process.stderr.write('adjudicate: no .migrate store found above the cwd\n')
198
+ return 2
199
+ }
200
+ const { runAdjudicate } = await import('../scripts/adjudicate-cmd.ts')
201
+ return runAdjudicate({
202
+ root,
203
+ ...(id ? { id } : {}),
204
+ ...(ruling.value !== undefined ? { ruling: ruling.value } : {}),
205
+ ...(args.includes('--force') ? { force: true } : {}),
206
+ ...(args.includes('--force-unlock') ? { forceUnlock: true } : {}),
207
+ })
208
+ },
169
209
  check: async (args) => {
170
210
  const phase = readFlag(args, '--phase')
171
211
  if (phase.error) {
@@ -227,6 +267,56 @@ const HANDLERS: Record<string, Handler> = {
227
267
  const { runReset } = await import('../scripts/reset-cmd.ts')
228
268
  return runReset({ root, phase, ...(forceUnlock ? { forceUnlock: true } : {}) })
229
269
  },
270
+ handoff: async (args) => {
271
+ const adapter = readFlag(args, '--adapter')
272
+ if (adapter.error) {
273
+ process.stderr.write(`handoff: ${adapter.error}\n`)
274
+ return 2
275
+ }
276
+ const { findStoreRoot } = await import('../scripts/paths.ts')
277
+ const root = await findStoreRoot(process.cwd())
278
+ if (!root) {
279
+ process.stderr.write('handoff: no .migrate store found above the cwd\n')
280
+ return 2
281
+ }
282
+ const { runHandoff } = await import('../scripts/handoff-cmd.ts')
283
+ return runHandoff({
284
+ root,
285
+ ...(adapter.value ? { adapter: adapter.value } : {}),
286
+ ...(args.includes('--dry-run') ? { dryRun: true } : {}),
287
+ ...(args.includes('--force-unlock') ? { forceUnlock: true } : {}),
288
+ })
289
+ },
290
+ coverage: async (args) => {
291
+ const adapter = readFlag(args, '--adapter')
292
+ if (adapter.error) {
293
+ process.stderr.write(`coverage: ${adapter.error}\n`)
294
+ return 2
295
+ }
296
+ const { findStoreRoot } = await import('../scripts/paths.ts')
297
+ const root = await findStoreRoot(process.cwd())
298
+ if (!root) {
299
+ process.stderr.write('coverage: no .migrate store found above the cwd\n')
300
+ return 2
301
+ }
302
+ const { runCoverage } = await import('../scripts/coverage-cmd.ts')
303
+ return runCoverage({ root, ...(adapter.value ? { adapter: adapter.value } : {}) })
304
+ },
305
+ forecast: async (args) => {
306
+ const adapter = readFlag(args, '--adapter')
307
+ if (adapter.error) {
308
+ process.stderr.write(`forecast: ${adapter.error}\n`)
309
+ return 2
310
+ }
311
+ const { findStoreRoot } = await import('../scripts/paths.ts')
312
+ const root = await findStoreRoot(process.cwd())
313
+ if (!root) {
314
+ process.stderr.write('forecast: no .migrate store found above the cwd\n')
315
+ return 2
316
+ }
317
+ const { runForecast } = await import('../scripts/forecast-cmd.ts')
318
+ return runForecast({ root, ...(adapter.value ? { adapter: adapter.value } : {}) })
319
+ },
230
320
  report: async (args) => {
231
321
  const result = readFlag(args, '--out')
232
322
  if (result.error) {