@iceinvein/agent-skills 0.1.40 → 0.3.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 (141) hide show
  1. package/README.md +18 -2
  2. package/dist/cli/index.js +115 -34
  3. package/package.json +1 -1
  4. package/skills/index.json +14 -2
  5. package/skills/magpie/SKILL.md +118 -40
  6. package/skills/magpie/bin/magpie.ts +43 -0
  7. package/skills/magpie/fixtures/fake-gh-nodiff.sh +38 -0
  8. package/skills/magpie/package.json +1 -1
  9. package/skills/magpie/references/peer-review.md +7 -2
  10. package/skills/magpie/references/specialists.md +38 -7
  11. package/skills/magpie/scripts/__tests__/cli.test.ts +101 -1
  12. package/skills/magpie/scripts/__tests__/dedupe-cmd.test.ts +187 -0
  13. package/skills/magpie/scripts/__tests__/diff-chunks.test.ts +51 -0
  14. package/skills/magpie/scripts/__tests__/filter-diff-preservation.test.ts +54 -0
  15. package/skills/magpie/scripts/__tests__/findings-files.test.ts +35 -0
  16. package/skills/magpie/scripts/__tests__/gh.test.ts +69 -0
  17. package/skills/magpie/scripts/__tests__/git-diff.test.ts +83 -0
  18. package/skills/magpie/scripts/__tests__/helpers/git-fixture.ts +47 -0
  19. package/skills/magpie/scripts/__tests__/path-filter.test.ts +27 -0
  20. package/skills/magpie/scripts/__tests__/render-cmd.test.ts +95 -0
  21. package/skills/magpie/scripts/__tests__/render-findings.test.ts +33 -0
  22. package/skills/magpie/scripts/__tests__/render-progress.test.ts +42 -0
  23. package/skills/magpie/scripts/__tests__/setup-cmd.test.ts +83 -1
  24. package/skills/magpie/scripts/__tests__/shard.test.ts +165 -0
  25. package/skills/magpie/scripts/__tests__/skill-lint.test.ts +96 -1
  26. package/skills/magpie/scripts/dedupe-cmd.ts +58 -3
  27. package/skills/magpie/scripts/diff-chunks.ts +28 -0
  28. package/skills/magpie/scripts/findings-files.ts +32 -0
  29. package/skills/magpie/scripts/gh.ts +64 -13
  30. package/skills/magpie/scripts/git-diff.ts +111 -0
  31. package/skills/magpie/scripts/path-filter.ts +9 -5
  32. package/skills/magpie/scripts/refresh.ts +8 -0
  33. package/skills/magpie/scripts/render-cmd.ts +28 -9
  34. package/skills/magpie/scripts/render-findings.ts +11 -1
  35. package/skills/magpie/scripts/render-progress.ts +6 -1
  36. package/skills/magpie/scripts/setup-cmd.ts +38 -1
  37. package/skills/magpie/scripts/shard.ts +171 -0
  38. package/skills/magpie/scripts/status-cmd.ts +4 -1
  39. package/skills/magpie/skill.json +2 -2
  40. package/skills/magpie/templates/styles.css +5 -0
  41. package/skills/migrate/README.md +194 -0
  42. package/skills/migrate/SKILL.md +197 -0
  43. package/skills/migrate/bin/migrate +15 -0
  44. package/skills/migrate/bin/migrate.ts +309 -0
  45. package/skills/migrate/biome.json +35 -0
  46. package/skills/migrate/bun.lock +24 -0
  47. package/skills/migrate/docs/architecture.md +294 -0
  48. package/skills/migrate/docs/reference.md +590 -0
  49. package/skills/migrate/fixtures/tiny-express/GROUND-TRUTH.md +39 -0
  50. package/skills/migrate/fixtures/tiny-express/app.js +29 -0
  51. package/skills/migrate/fixtures/tiny-express/cron.js +6 -0
  52. package/skills/migrate/fixtures/tiny-express/reports/daily-users.json +6 -0
  53. package/skills/migrate/fixtures/tiny-express/schema.sql +12 -0
  54. package/skills/migrate/fixtures/tiny-express/settings.json +4 -0
  55. package/skills/migrate/fixtures/tiny-express/views/users.html +9 -0
  56. package/skills/migrate/fixtures/tiny-webforms/Controllers/UsersController.cs +68 -0
  57. package/skills/migrate/fixtures/tiny-webforms/Default.aspx +7 -0
  58. package/skills/migrate/fixtures/tiny-webforms/Default.aspx.cs +14 -0
  59. package/skills/migrate/fixtures/tiny-webforms/GROUND-TRUTH.md +50 -0
  60. package/skills/migrate/fixtures/tiny-webforms/Integrations/BillingClient.cs +16 -0
  61. package/skills/migrate/fixtures/tiny-webforms/Jobs/NightlyDigestJob.cs +33 -0
  62. package/skills/migrate/fixtures/tiny-webforms/Reports/DailyUsers.rdl +11 -0
  63. package/skills/migrate/fixtures/tiny-webforms/Schema.sql +12 -0
  64. package/skills/migrate/fixtures/tiny-webforms/Site.master +16 -0
  65. package/skills/migrate/fixtures/tiny-webforms/Users.aspx +8 -0
  66. package/skills/migrate/fixtures/tiny-webforms/Users.aspx.cs +14 -0
  67. package/skills/migrate/fixtures/tiny-webforms/web.config +10 -0
  68. package/skills/migrate/install.sh +68 -0
  69. package/skills/migrate/package.json +17 -0
  70. package/skills/migrate/references/phases/enumerate.md +291 -0
  71. package/skills/migrate/references/phases/extract.md +652 -0
  72. package/skills/migrate/references/phases/parity.md +275 -0
  73. package/skills/migrate/references/phases/probe.md +135 -0
  74. package/skills/migrate/references/phases/queue.md +242 -0
  75. package/skills/migrate/references/phases/seam.md +416 -0
  76. package/skills/migrate/references/recipes/README.md +116 -0
  77. package/skills/migrate/references/recipes/aspnet.md +287 -0
  78. package/skills/migrate/references/run-ops.md +280 -0
  79. package/skills/migrate/scripts/__tests__/census.test.ts +775 -0
  80. package/skills/migrate/scripts/__tests__/check.test.ts +458 -0
  81. package/skills/migrate/scripts/__tests__/citations.test.ts +156 -0
  82. package/skills/migrate/scripts/__tests__/cli.test.ts +183 -0
  83. package/skills/migrate/scripts/__tests__/concurrency.test.ts +164 -0
  84. package/skills/migrate/scripts/__tests__/config.test.ts +112 -0
  85. package/skills/migrate/scripts/__tests__/e2e-express.test.ts +1093 -0
  86. package/skills/migrate/scripts/__tests__/e2e-webforms.test.ts +1276 -0
  87. package/skills/migrate/scripts/__tests__/e2e.test.ts +320 -0
  88. package/skills/migrate/scripts/__tests__/ids.test.ts +38 -0
  89. package/skills/migrate/scripts/__tests__/import.test.ts +155 -0
  90. package/skills/migrate/scripts/__tests__/init.test.ts +192 -0
  91. package/skills/migrate/scripts/__tests__/leaks.test.ts +176 -0
  92. package/skills/migrate/scripts/__tests__/lock.test.ts +183 -0
  93. package/skills/migrate/scripts/__tests__/paths.test.ts +129 -0
  94. package/skills/migrate/scripts/__tests__/phase-cmd.test.ts +151 -0
  95. package/skills/migrate/scripts/__tests__/phases.test.ts +70 -0
  96. package/skills/migrate/scripts/__tests__/queue.test.ts +475 -0
  97. package/skills/migrate/scripts/__tests__/report.test.ts +150 -0
  98. package/skills/migrate/scripts/__tests__/run-state.test.ts +136 -0
  99. package/skills/migrate/scripts/__tests__/status-reset.test.ts +318 -0
  100. package/skills/migrate/scripts/__tests__/store.test.ts +132 -0
  101. package/skills/migrate/scripts/__tests__/validate.test.ts +54 -0
  102. package/skills/migrate/scripts/census-cmd.ts +109 -0
  103. package/skills/migrate/scripts/census.ts +342 -0
  104. package/skills/migrate/scripts/check-cmd.ts +24 -0
  105. package/skills/migrate/scripts/check.ts +376 -0
  106. package/skills/migrate/scripts/citations.ts +92 -0
  107. package/skills/migrate/scripts/config.ts +237 -0
  108. package/skills/migrate/scripts/ids.ts +31 -0
  109. package/skills/migrate/scripts/import-cmd.ts +141 -0
  110. package/skills/migrate/scripts/init-cmd.ts +118 -0
  111. package/skills/migrate/scripts/leaks.ts +184 -0
  112. package/skills/migrate/scripts/lock.ts +188 -0
  113. package/skills/migrate/scripts/paths.ts +103 -0
  114. package/skills/migrate/scripts/phase-cmd.ts +63 -0
  115. package/skills/migrate/scripts/phases.ts +113 -0
  116. package/skills/migrate/scripts/queue-cmd.ts +98 -0
  117. package/skills/migrate/scripts/queue.ts +258 -0
  118. package/skills/migrate/scripts/report-cmd.ts +47 -0
  119. package/skills/migrate/scripts/report.ts +131 -0
  120. package/skills/migrate/scripts/reset-cmd.ts +120 -0
  121. package/skills/migrate/scripts/status-cmd.ts +52 -0
  122. package/skills/migrate/scripts/store.ts +159 -0
  123. package/skills/migrate/scripts/types.ts +137 -0
  124. package/skills/migrate/scripts/validate.ts +221 -0
  125. package/skills/migrate/skill.json +33 -0
  126. package/skills/migrate/templates/config.toml +27 -0
  127. package/skills/migrate/templates/queue-item.md +17 -0
  128. package/skills/migrate/tsconfig.json +18 -0
  129. package/skills/migrate/uninstall.sh +31 -0
  130. package/skills/sluice/SKILL.md +95 -0
  131. package/skills/sluice/references/deep-channel.md +114 -0
  132. package/skills/sluice/references/finish.md +37 -0
  133. package/skills/sluice/references/intent.md +29 -0
  134. package/skills/sluice/references/meter.md +38 -0
  135. package/skills/sluice/references/review.md +42 -0
  136. package/skills/sluice/references/root-cause.md +38 -0
  137. package/skills/sluice/references/show-or-say.md +36 -0
  138. package/skills/sluice/references/test-first.md +35 -0
  139. package/skills/sluice/references/verify.md +26 -0
  140. package/skills/sluice/scripts/run-stats.sh +236 -0
  141. package/skills/sluice/skill.json +33 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magpie",
3
- "version": "0.9.0",
4
- "description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request.",
3
+ "version": "0.10.0",
4
+ "description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request. Splits oversized diffs into budgeted shards and rebuilds the diff from the local clone when gh pr diff refuses it.",
5
5
  "author": "iceinvein",
6
6
  "type": "prompt",
7
7
  "tools": [
@@ -183,6 +183,11 @@ button {
183
183
  color: var(--ink);
184
184
  }
185
185
 
186
+ .diff-source {
187
+ font-size: 0.78rem;
188
+ opacity: 0.7;
189
+ }
190
+
186
191
  .header-spacer {
187
192
  flex: 1;
188
193
  }
@@ -0,0 +1,194 @@
1
+ # migrate
2
+
3
+ Source-agnostic legacy migration mapping. `migrate` walks a legacy codebase
4
+ through probe, enumerate, seam, extract, parity, and queue, building an
5
+ auditable requirements ledger with mandatory citations instead of a
6
+ self-reported one. It enumerates the legacy surface from two independent
7
+ directions per lens, derives a capability seam empirically rather than by
8
+ guesswork, extracts cited functional requirements, plans parity against the
9
+ source, and routes every ambiguity to a batch decision queue for a human to
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.
14
+
15
+ ## Using it
16
+
17
+ Invoke `/migrate` in a target repo that is a git working copy, pointed at a
18
+ read-only checkout of the legacy source. The skill (`SKILL.md`) is the
19
+ walkthrough: it names, phase by phase, what to read, what to dispatch, and
20
+ what `migrate` command closes that phase out. Each phase's manual under
21
+ `references/phases/` carries the actual judgment calls, loaded only when
22
+ that phase is current so a run never pays for prose it does not need yet.
23
+
24
+ ### The phases
25
+
26
+ | # | Phase | Manual | What it produces |
27
+ |---|---|---|---|
28
+ | 0 | Probe | `references/phases/probe.md` | `.migrate/config.toml` (detected source stack, basis, target profile) and `.migrate/parity-basis.md` (the detection evidence, hand-written) |
29
+ | 1 | Enumerate | `references/phases/enumerate.md` | `elements.jsonl` and a lens census record per surface |
30
+ | 2 | Seam | `references/phases/seam.md` | `capabilities.jsonl`, `seam.json`, `seam.md`: the capability partition and its evidence |
31
+ | 3 | Extract | `references/phases/extract.md` | `requirements.jsonl`, attribute/rule-sweep/closer census records, terminal element dispositions |
32
+ | 4 | Parity | `references/phases/parity.md` | `deltas.jsonl` and a parity plan on every non-queued requirement |
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
42
+ rather than any one of them: subagent dispatch, the batch-checkpoint
43
+ discipline, and what happens when two agents contend for the store lock.
44
+
45
+ ### Recipes
46
+
47
+ Enumerate reads the source stack `probe` detected and looks for a matching
48
+ file in `references/recipes/`, one file per stack family
49
+ (`references/recipes/aspnet.md` covers `aspnet-webforms`, `aspnet-mvc`, and
50
+ `aspnet-webapi`). A recipe answers one narrow question: for each declared
51
+ surface type, at least two independent directions for enumerating it and the
52
+ probe command that realises each one. Nothing else; the lens contract itself
53
+ lives once in `enumerate.md`, and a recipe does not restate it, carry
54
+ classification rules, or gate anything.
55
+
56
+ If no file matches the detected stack, that is contract-only mode: a
57
+ supported path, not a degraded one. The enumerating agent derives its own two
58
+ directions per surface, and the census gates them exactly as it would a
59
+ recipe's.
60
+
61
+ **Adding a stack is one new file in `references/recipes/` and no edit
62
+ anywhere else.** `SKILL.md`, the phase manuals, and the CLI never name an
63
+ individual stack; they only read `[source].stack` and look in that
64
+ directory. See `references/recipes/README.md` for the exact file shape.
65
+
66
+ ## Checking as you go
67
+
68
+ ```
69
+ migrate check --phase <current-phase>
70
+ ```
71
+
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.
76
+
77
+ ## Fixtures
78
+
79
+ Two fixtures, each with a committed `GROUND-TRUTH.md`, drive the skill end to
80
+ end:
81
+
82
+ - **`fixtures/tiny-express/`**: a small Express/Node app, twelve elements
83
+ across all eight default surfaces. Its stack (`express`) matches no file
84
+ in `references/recipes/`, so it proves the contract-only path: enumerate
85
+ deriving its own two directions per surface with no recipe to lean on, and
86
+ the census gating them exactly the same as it would a recipe's.
87
+ - **`fixtures/tiny-webforms/`**: a small ASP.NET Web Forms app, sixteen
88
+ elements across the same eight surfaces. Its stack (`aspnet-webforms`)
89
+ matches `references/recipes/aspnet.md`, so it is that recipe's first run
90
+ against committed code, not just the throwaway trees it was written
91
+ against.
92
+
93
+ `scripts/__tests__/e2e-express.test.ts` and
94
+ `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.
101
+
102
+ Both show gates in both directions. Failing before they pass: the mid-run check
103
+ after enumerate names the three closer records extract has not written yet, and
104
+ the `deltas` gate names the sanctioned difference each run files unsigned
105
+ before an owner signs it. Failing after they pass: each run closes green, then
106
+ mutates the store (nulling every parity plan, then removing an element row) and
107
+ asserts the gate that should catch it does.
108
+
109
+ ## Documentation
110
+
111
+ - **[docs/reference.md](docs/reference.md)** is what you need to drive the CLI:
112
+ 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
114
+ convention. Ships with the installed skill.
115
+ - **[docs/architecture.md](docs/architecture.md)** is for working on the skill
116
+ itself: the module map, the rule that decides what belongs in the CLI rather
117
+ than the prompt, how to add a gate or a surface type, the testing
118
+ conventions, and the known limits.
119
+
120
+ ## Store layout
121
+
122
+ The store lives at `.migrate/` in the target repo and is committed.
123
+
124
+ | Path | Shape | Holds |
125
+ |---|---|---|
126
+ | `.migrate/config.toml` | declarative | source pointer and scope, detected source stack, target profile, surface-type set, closer set, handoff adapter |
127
+ | `.migrate/elements.jsonl` | rows | surface ledger |
128
+ | `.migrate/requirements.jsonl` | rows | functional requirements and their dispositions |
129
+ | `.migrate/capabilities.jsonl` | rows | the seam partition |
130
+ | `.migrate/seam.json` | object | run-level seam metadata: validators run, modularity, status |
131
+ | `.migrate/deltas.jsonl` | rows | sanctioned delta catalog |
132
+ | `.migrate/census.jsonl` | rows | one accounting record per lens run |
133
+ | `.migrate/phases.json` | object | per-phase status, batches, resume pointers |
134
+ | `.migrate/seam.md` | prose | validator scripts and their raw output |
135
+ | `.migrate/parity-basis.md` | prose | runnable-versus-source-only detection evidence |
136
+ | `.migrate/queue/q-<slug>.md` | prose | evidence, options, recommendation |
137
+ | `.migrate/.env` | secrets | runtime-lens credentials, gitignored |
138
+ | `docs/migrate/*.md` | generated | human-readable views, written by `migrate report` |
139
+
140
+ ## CLI
141
+
142
+ | Command | Does |
143
+ |---|---|
144
+ | `migrate init --source <path> --scope <text> --name <target>` | Writes `.migrate/config.toml` |
145
+ | `migrate import <elements\|reqs\|deltas> <batch.json>` | Validated bulk append to the store |
146
+ | `migrate census <record.json>` | Records a lens accounting record |
147
+ | `migrate phase [<name>] [--status <s>]` | Prints phase state, or sets one phase's status to any value you name |
148
+ | `migrate queue add <file.md>` | Adds a queue item |
149
+ | `migrate queue list [--open]` | Lists queue items, severity first |
150
+ | `migrate queue show <id>` | Prints one queue item |
151
+ | `migrate check [--phase <p>] [--no-citations] [--leaks]` | Runs the gates |
152
+ | `migrate status` | Phase state, counts, resume pointer |
153
+ | `migrate reset --phase <phase>` | Clears one phase's derived rows and returns it to `pending` |
154
+ | `migrate report [--out <dir>]` | Renders markdown views |
155
+
156
+ Run `migrate --help` for the same list from the CLI itself.
157
+
158
+ **Four commands write a phase's status, each to a different extent.** `phase
159
+ --status <s>` is the only one that writes any value you ask for, and the only
160
+ one whose whole purpose is that write. `reset --phase <p>` also writes it
161
+ directly, but only ever to `pending`, and it empties that phase's `batches`
162
+ list at the same time. `import` and `census` touch `phases.json` incidentally,
163
+ each moving a phase to `running` (unless it is already `done`) when they record
164
+ a batch. Nothing else writes it at all.
165
+
166
+ A lock failure on `import`, `census`, `phase --status`, or `reset` exits `3`;
167
+ pass `--force-unlock` once you have confirmed no other agent is actually
168
+ writing.
169
+
170
+ ## Install
171
+
172
+ ```
173
+ bunx @iceinvein/agent-skills install migrate -g
174
+ ```
175
+
176
+ This skill ships in two parts: the prompt (`SKILL.md`) and a companion Bun
177
+ CLI (`bin` + `scripts`). The agent-skills installer writes both into
178
+ `~/.claude/skills/migrate/` and then runs the bundled `install.sh` as a
179
+ postinstall step, which symlinks `bin/migrate` onto your PATH (preferring
180
+ `/usr/local/bin`, falling back to `~/.local/bin`). Removing the skill with
181
+ `agent-skills remove migrate -g` runs `uninstall.sh` first to undo the PATH
182
+ symlink.
183
+
184
+ If you cloned this repo and want to run from source, you can also invoke
185
+ `./install.sh` directly: it does the PATH-link step against the local source
186
+ tree.
187
+
188
+ ## Development
189
+
190
+ ```
191
+ bun test # Run all tests
192
+ bun run lint # Biome check
193
+ bun run typecheck # tsc --noEmit
194
+ ```
@@ -0,0 +1,197 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # migrate
7
+
8
+ ## Prerequisites
9
+
10
+ - `migrate` on `PATH`, put there by this skill's `install.sh`.
11
+ - A read-only checkout of the legacy source. `migrate check`'s `citations` and
12
+ `source` gates read it; nothing here writes to it, and every writer in the CLI
13
+ refuses a path that resolves inside it.
14
+ - A target repo that is a git working copy. The store lives inside it and
15
+ commits alongside your own work; there is no separate run directory.
16
+
17
+ ## Phase walkthrough
18
+
19
+ Work phases 0 through 7 in order. Do not skip ahead: the run-state gate fails a
20
+ phase marked `done` while its predecessor is still `pending`, so working out of
21
+ order just produces a violation you undo later.
22
+
23
+ ### 0. Probe
24
+
25
+ Produces `.migrate/config.toml` (detected source stack, `runnable` or
26
+ `source-only` basis, the target profile), written by `migrate init`, plus
27
+ `.migrate/parity-basis.md`: hand-written prose carrying the detection
28
+ evidence, since no command writes it either.
29
+
30
+ Read `references/phases/probe.md` before dispatching anything.
31
+
32
+ ```
33
+ migrate init --source <path> --scope "<text>" --name <target> \
34
+ [--source-stack <s>] [--target-stack <s>] [--basis <runnable|source-only>]
35
+ migrate phase probe --status done
36
+ ```
37
+
38
+ ### 1. Enumerate
39
+
40
+ Produces `elements.jsonl`, every row `unaccounted`, and one `lens` census
41
+ record per declared surface type.
42
+
43
+ Read `references/phases/enumerate.md` before dispatching anything.
44
+
45
+ Fanout unit: one agent per (surface, lens) pair.
46
+
47
+ ```
48
+ migrate import elements <batch.json>
49
+ migrate census <lens-record.json>
50
+ migrate phase enumerate --status done
51
+ ```
52
+
53
+ ### 2. Seam
54
+
55
+ Produces `capabilities.jsonl` (the seam partition), `seam.json` (run-level
56
+ seam metadata), and `seam.md` (the validators' raw evidence). All three are
57
+ hand-written: there is no `seam` verb, so nothing in the CLI authors their
58
+ content. (`migrate reset --phase seam` does write to these paths, clearing
59
+ `capabilities.jsonl` and deleting the other two, but that undoes the phase
60
+ rather than authoring it.)
61
+
62
+ Read `references/phases/seam.md` before dispatching anything.
63
+
64
+ ```
65
+ migrate phase seam --status done
66
+ ```
67
+
68
+ ### 3. Extract
69
+
70
+ Produces `requirements.jsonl`, the attribute/rule-sweep/closer census records,
71
+ and a terminal disposition on every element.
72
+
73
+ Read `references/phases/extract.md` before dispatching anything.
74
+
75
+ Fanout unit: one agent per capability.
76
+
77
+ ```
78
+ migrate import reqs <batch.json>
79
+ migrate import elements <batch.json>
80
+ migrate census <record.json>
81
+ migrate queue add <item.md>
82
+ migrate phase extract --status done
83
+ ```
84
+
85
+ `queue add` is not optional here. An `out-of-scope` disposition's queue id
86
+ and a `queued` confidence's queue id are both checked by the `refs` gate, and
87
+ a queue id with no file behind it is a violation the moment anything checks,
88
+ not a future one. File each item in the same pass that names it.
89
+
90
+ The second import carries the resolved `disposition` (`mapped` or
91
+ `out-of-scope`); it is the only writer of a *resolved* value there, so this
92
+ line is the ledger write-back itself, not something the phase-status flip
93
+ does for you. `migrate reset --phase extract` also writes this field, but
94
+ only back to `unaccounted`; it clears, it does not resolve.
95
+
96
+ ### 4. Parity
97
+
98
+ Produces `deltas.jsonl` and a parity plan on every requirement whose
99
+ confidence is not `queued`.
100
+
101
+ Read `references/phases/parity.md` before dispatching anything.
102
+
103
+ ```
104
+ migrate import deltas <batch.json>
105
+ migrate import reqs <batch.json>
106
+ migrate queue add <item.md>
107
+ migrate phase parity --status done
108
+ ```
109
+
110
+ Same rule as phase 3: a `rubric` plan below `high` must carry a queue id, and
111
+ the `refs` gate checks it resolves, so file the item in this pass.
112
+
113
+ The second import carries the resolved `parity` value; as in extract, it is
114
+ the only writer of a *resolved* value, and this line is the write-back
115
+ itself. `migrate reset --phase parity` also writes this field, but only
116
+ back to `null`; it clears, it does not resolve.
117
+
118
+ ### 5. Queue
119
+
120
+ Produces the queue items carrying forward anything ambiguous: evidence,
121
+ options, and a recommendation, filed for an owner to adjudicate.
122
+
123
+ Read `references/phases/queue.md` before dispatching anything.
124
+
125
+ ```
126
+ migrate queue add <item.md>
127
+ migrate phase queue --status done
128
+ ```
129
+
130
+ ### 6. Adjudicate
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.
136
+
137
+ ### 7. Handoff
138
+
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.
142
+
143
+ ## Checking as you go
144
+
145
+ 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`.
149
+
150
+ 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.
155
+
156
+ ```
157
+ migrate check --phase queue
158
+ migrate check
159
+ ```
160
+
161
+ ## Resuming a crashed run
162
+
163
+ ```
164
+ migrate status
165
+ migrate phase
166
+ ```
167
+
168
+ `migrate status` prints the last committed batch and the outstanding work;
169
+ `migrate phase` (no name) prints every phase's status and batch count, one
170
+ line each, so you can see exactly where the run stopped. To re-enter one
171
+ phase, clear its derived rows and re-run it:
172
+
173
+ ```
174
+ migrate reset --phase <phase>
175
+ ```
176
+
177
+ Re-importing a batch upserts rows by id rather than duplicating them, so
178
+ progress from before the crash is not lost by retrying it.
179
+
180
+ ## Aborting
181
+
182
+ There is no run directory to delete: the store lives at `.migrate/` inside the
183
+ target repo. `references/run-ops.md` holds the batch-checkpoint discipline (a
184
+ git commit after every `migrate import`); if it was followed, an aborted run
185
+ leaves behind exactly whatever the last commit captured. Leave `.migrate/` in
186
+ place either way. Discard only uncommitted scratch files, such as a
187
+ `batch.json` you built but never imported. `.migrate/.env`, if a runtime lens
188
+ created one, must never be committed regardless of how the run ends. `init`
189
+ takes care of the ignore entry in all three cases, and says on stdout when it
190
+ changed something: `init: created <path> with .migrate/.env` when the target
191
+ had no `.gitignore`, `init: appended .migrate/.env to <path>` when it had one
192
+ without the entry, and **nothing at all** when the entry was already there,
193
+ since there was nothing to change. Silence from `init` on this is the
194
+ already-correct case, not a skipped one. If you edited `.gitignore` after
195
+ `init` ran, check the entry is still there before committing anything, because
196
+ nothing re-checks it: the `leaks` gate that would catch a committed value is
197
+ opt-in (`migrate check --leaks`).
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bash
2
+ # Resolve symlinks so we find the real migrate.ts even when invoked via
3
+ # a /usr/local/bin or ~/.local/bin symlink.
4
+ SCRIPT="${BASH_SOURCE[0]}"
5
+ while [ -L "$SCRIPT" ]; do
6
+ DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
7
+ TARGET="$(readlink "$SCRIPT")"
8
+ if [[ "$TARGET" = /* ]]; then
9
+ SCRIPT="$TARGET"
10
+ else
11
+ SCRIPT="$DIR/$TARGET"
12
+ fi
13
+ done
14
+ DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
15
+ exec bun "$DIR/migrate.ts" "$@"