Revision: 1 Last modified: 2026-12-04T19:00:00Z
migrate.sh migrates a consumer project onto the current constitution, and records the outcome as one
machine-readable record.
Its most important property is that a dry run is not a migration outcome. Without --apply the script
runs the preflight only, never writes to the consumer's checkout ($WORKDIR), still writes the --out
record with outcome DRY-RUN, and exits 1. That exit is deliberate: audit.py summary never counts
a dry run, so a caller cannot mistake "I looked at it" for "it is migrated".
--out holds exactly one record per project. Several records for the same project are a defect the
caller is warned about upstream (T177 Round 5), which is why the tool writes one and not one-per-run.
sh,python3.- A fastcycle config (
--config). --workdirpointing at a real consumer checkout.- An explicit scope decision (
--scope-decision) when the change is out of the default scope. - No environment variables are read.
# preflight only — writes the DRY-RUN record, never touches $WORKDIR, exits 1
sh scripts/fastcycle/consumers/migrate.sh \
--config fastcycle.yaml \
--project org/repo \
--workdir /abs/path/to/consumer \
--out migration.json
# apply the migration
sh scripts/fastcycle/consumers/migrate.sh \
--config fastcycle.yaml --project org/repo \
--workdir /abs/path/to/consumer --out migration.json --apply
# attach the review reference the migration should cite
sh scripts/fastcycle/consumers/migrate.sh \
--config fastcycle.yaml --project org/repo --workdir /abs/path/to/consumer \
--out migration.json --apply --review-ref review/round-3.json
# out-of-scope change: record the operator decision explicitly
sh scripts/fastcycle/consumers/migrate.sh \
--config fastcycle.yaml --project org/repo --workdir /abs/path/to/consumer \
--out migration.json --scope-decision scope_decision.json| Flag | Meaning |
|---|---|
--config |
The fastcycle config. |
--project |
org/repo of the consumer. |
--workdir |
The consumer checkout directory. |
--out |
The migration record destination (one record per project). |
--apply |
Actually migrate. Absent ⇒ preflight only. |
--review-ref |
Path to the review reference the record should cite. |
--operator-blocked |
Record the consumer as operator-blocked rather than migrated. |
--scope-decision |
The recorded scope decision, required for an out-of-scope change. |
| Code | Meaning |
|---|---|
0 |
MIGRATED. |
1 |
NOT-MIGRATED — the reason is in the JSON body, and this is not a crash. Also the exit for a DRY-RUN preflight. |
2 |
Usage/config error (bad or missing flags, unreadable config). |
4 |
BLIND — the consumer's state could not be established honestly. |
Exit 1 carries the diagnosis. A caller should read the record's reason field rather than treating 1 as
a tool failure; the distinction that matters is 0 (migrated) versus everything else.
- No
--apply. Preflight only:$WORKDIRis untouched,--outrecordsDRY-RUN, exit1. This is the intended way to inspect a migration safely. --operator-blocked. Records the block instead of attempting the migration — the honest outcome when the operator must act first (§11.4.21).- An out-of-scope change without
--scope-decision. Refused; the decision must be recorded, not assumed. - A consumer already migrated. The single-record-per-project rule means the record is updated rather than duplicated.
- A
--workdirthat is not a checkout. Cannot establish state honestly → BLIND (4). - Two records for one project. Not produced by this tool; if present in
--out,audit.py summaryhas a defined resolution order and the duplication is a finding.
- Parses flags;
exit 2on usage problems. - Validates the config, the project identity and the workdir.
- Resolves scope: the default scope, or the change named by
--scope-decision. - Without
--apply: performs the preflight (what would change, any blocker), writes theDRY-RUNrecord to--out, and exits1without touching$WORKDIR. - With
--apply: performs the migration in$WORKDIR, then writes the singleMIGRATEDorNOT-MIGRATEDrecord with its reason. - Exits
0onMIGRATED,1onNOT-MIGRATED/DRY-RUN,4when the state is unknowable.
Contract: specs/004-fast-dev-cycles/contracts/consumer-audit-and-migration.md CA-019..CA-028.
Guarded by scripts/fastcycle/tests/test_consumer_migrate_red.sh (T168).
Related in the same family: scripts/fastcycle/consumers/enumerate.sh (CA-001..CA-005) discovers the
consumers this tool migrates; scripts/fastcycle/consumers/audit.py summarises the records.
See also docs/scripts/enumerate.sh.md and docs/scripts/audit.py.md.
2026-12-04 — bash -n scripts/fastcycle/consumers/migrate.sh → exit 0. sh scripts/fastcycle/consumers/migrate.sh with no arguments exits 2 with a usage message (required flags
absent).