oct.migrate.oct_migrate module#
Purpose#
FS-539 — oct migrate option-c relocates a legacy Option C project
into the canonical .option_c/ dotdir layout introduced in v0.19.0.
The command copies (never moves) each artefact so in-flight work on
the legacy layout is not broken mid-release. Legacy files stay in place
for one release; oct audit warns about the duplication and a future
release will offer removal.
Responsibilities#
Detect migratable artefacts:
.octrc.json, debug config (in eitheroc_diagnostics/ordiagnostics/),logs/.In
--dry-runmode, describe the plan without touching the disk.Copy each artefact to
.option_c/with.bkbackup when a destination already exists and differs.Write
oc_status.jsonrecording the migration stage and source paths.
Diagnostics#
Domain: MIGRATE Levels:
L2 — lifecycle: start / end L3 — per-artefact decisions
Contracts#
Copies (never moves) — legacy files remain in place for one release.
--dry-runperforms no filesystem writes.A pre-existing destination that differs is backed up to
.bkbefore overwrite.
Dependencies#
oct.core.diagnostics (_dbg structured logger)
oct.core.option_c_dir (OcStatus, write_oc_status, option_c_dir)
oct.core.project_root (project root detection)
click (CLI framework)
- class oct.migrate.oct_migrate.MigrationResult(copied: list[tuple[str, ~pathlib.Path, ~pathlib.Path]]=<factory>, skipped: list[tuple[str, str]]=<factory>, backed_up: list[Path] = <factory>, messages: list[str] = <factory>, stage: str = 'bootstrap')[source]#
Bases:
objectStructured output from
run_migrate_option_c().- backed_up: list[Path]#
- copied: list[tuple[str, Path, Path]]#
- messages: list[str]#
- skipped: list[tuple[str, str]]#
- stage: str = 'bootstrap'#
- oct.migrate.oct_migrate.run_migrate_option_c(project_root: Path, *, dry_run: bool = False, no_backup: bool = False) MigrationResult[source]#
Migrate a legacy Option C project into the
.option_c/layout.Returns a
MigrationResultdescribing what was copied, skipped, or backed up. The caller renders the result.