Mirror — continuous cross-language sync

Mirror keeps a migrated target project synchronized with an evolving source project. After Transmute produces a first target, link the pair and sync incrementally instead of remigrating the whole repository.

TypeScript changes
        ↓
semantic diff vs baseline PUIR
        ↓
regenerate affected regions
        ↓
build + differential tests
        ↓
Rust (or other target) updated

First supported path

SourceTargetTier
TypeScript / JavaScriptRustTier 1 (weather-api demo)
PythonRustTier 2 (planning / partial)
Rust → TypeScriptExperimental (reverse sync gated)

Tiers reflect implemented conformance, not marketing claims.

Workflow

# One-time: migrate, then link
plx migrate ./examples/weather-api --to rust -o ./examples/weather-api-rust --require-build --require-tests
plx link ./examples/weather-api ./examples/weather-api-rust

# Ongoing
# edit TypeScript…
plx sync
plx sync --check    # CI / no writes
plx status          # drift summary
plx ci              # sync --check + target verify

Link metadata lives under the target:

.parallax-link/
├── link.json
├── source-index.bin
├── semantic-map.bin
├── dependency-map.json
├── manual-regions.json
├── ownership.json
├── baselines/
└── history/

Default policy: source-authoritative.

Commands

CommandPurpose
plx link <src> <tgt>Create Mirror link
plx syncIncremental translate + verify
plx sync --checkFreshness only (fails if stale)
plx sync --reverseTarget→source when node is ExactYes (else Unsupported)
plx sync --patchPreview regenerate without writing
plx status / --jsonDrift / machine-readable status
plx cisync --check + differential verify
plx historySync history
plx rollbackRestore last pre-sync target snapshot
plx explain <file:line> -C <tgt>Source-map explanation
plx why <file> -C <tgt>Why a target file changed
plx verifyRun differential / property notes

What sync does (and does not)

Does

  • Semantic diff of PUIR (not text-only)
  • Stable semantic IDs (plx:function:…)
  • Regenerate affected modules transactionally (snapshot → apply → build/test → commit or restore)
  • Preserve files marked with manual BEHAVIOR_CHANGE ownership
  • Report testing confidence (migrated suite), never claim formal proof

Does not (yet / honest limits)

  • Full bidirectional live migration without review gates
  • Property-based equivalence as a complete fuzzer (--property notes only)
  • plx watch daemon (not shipped)
  • Guaranteed idiom preservation for every manual refactor
  • All language pairs as Tier 1

Manual edits

Ownership metadata is stored in .parallax-link/ownership.json and manual-regions.json (sidecar preferred over invasive markers). Behavior-changing target edits block overwrite under source-authoritative policy until you choose preserve / overwrite / inspect.

CI

- run: plx sync --check
- run: plx ci

Fails when the link is stale, the target fails build/tests, or verification mismatches.