Skip to main content

Crate smix_migrate

Crate smix_migrate 

Source
Expand description

smix-migrate — static maestro→smix YAML codemod.

§Why this crate exists

smix run already accepts maestro-flavored yaml directly (smix is a superset of maestro). Migration is not required for correctness. But when a consumer commits their yaml flows for long-term maintenance, they want:

  1. Canonical verb names — grep for - tap: finds every tap, not a mix of - tapOn: (maestro) / - tap: (smix). Better code review, better tooling.
  2. smix-native argument shapes — e.g. extendedWaitUntil.timeout becomes expect.timeoutMs, aligning with smix’s expect verb family.
  3. Deprecated-verb removal — maestro-only forms flagged (WARN: to stderr) so consumers can decide whether to hand-edit.

§Scope

  • Top-20 verb transforms (list below in Migrator::default)
  • Comment preservation — line-based rewriter keeps copyright headers, audit-trail comments, and blank lines byte-identical.
  • Unrecognized verbs preserved verbatim — e.g. runScript, evalScript — a WARN: per unknown verb, one line to stderr.
  • Library + CLI — this crate exposes Migrator + MigrateReport; smix migrate in the CLI is a thin wrapper.

§Design decisions

The codemod operates on serde_norway::Value (loose YAML AST) for a syntactic sanity check, then applies changes with a line-based rewriter to preserve comments. We do NOT deserialize into a strongly-typed maestro schema because:

  • Preserving unknown / smix-native verbs verbatim is required
  • We only touch the specific keys we care about (whitelist approach)
  • Round-tripping through a typed schema would drop any field we don’t know about, breaking already-smix-native yamls

§Anti-goals

  • Not a linter (no correctness checks; malformed yaml surfaces as a parse error)
  • Not a formatter (indentation / trailing spaces preserved verbatim)

Structs§

MigrateReport
Result of migrating one flow file.
Migrator
The migrator. Stateless by design — run is a pure fn of input.
Rename
One verb rename recorded during a migration pass.

Enums§

MigrateError