Option C Tools
Loading...
Searching...
No Matches
oct.migrate.oct_migrate Namespace Reference

Classes

class  MigrationResult

Functions

MigrationResult run_migrate_option_c (Path project_root, *, bool dry_run=False, bool no_backup=False)
Path|None _find_source (Path project_root, list[str] candidates)
bool _content_matches (Path src, Path dest, str kind)
 migrate (ctx)
 migrate_option_c_cmd (ctx, bool dry_run, bool no_backup)

Detailed Description

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 either
  ``oc_diagnostics/`` or ``diagnostics/``), ``logs/``.
- In ``--dry-run`` mode, describe the plan without touching the disk.
- Copy each artefact to ``.option_c/`` with ``.bk`` backup when a
  destination already exists and differs.
- Write ``oc_status.json`` recording 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-run`` performs no filesystem writes.
- A pre-existing destination that differs is backed up to ``.bk`` before 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)

Function Documentation

◆ _content_matches()

bool oct.migrate.oct_migrate._content_matches ( Path src,
Path dest,
str kind )
protected

Definition at line 240 of file oct_migrate.py.

Here is the caller graph for this function:

◆ _find_source()

Path | None oct.migrate.oct_migrate._find_source ( Path project_root,
list[str] candidates )
protected

Definition at line 232 of file oct_migrate.py.

Here is the caller graph for this function:

◆ migrate()

oct.migrate.oct_migrate.migrate ( ctx)
Migrate project layout to a newer Option C structure.

Definition at line 255 of file oct_migrate.py.

◆ migrate_option_c_cmd()

oct.migrate.oct_migrate.migrate_option_c_cmd ( ctx,
bool dry_run,
bool no_backup )
Migrate to the canonical .option_c/ dotdir layout (FS-539).

Definition at line 267 of file oct_migrate.py.

Here is the call graph for this function:

◆ run_migrate_option_c()

MigrationResult oct.migrate.oct_migrate.run_migrate_option_c ( Path project_root,
* ,
bool dry_run = False,
bool no_backup = False )
Migrate a legacy Option C project into the ``.option_c/`` layout.

Returns a :class:`MigrationResult` describing what was copied,
skipped, or backed up. The caller renders the result.

Definition at line 89 of file oct_migrate.py.

Here is the call graph for this function:
Here is the caller graph for this function: