Wrap an existing standalone script or replay flow into a typed app adapter/orchestrator with minimal drift. Use when a repo already has working legacy automation that must be integrated into a new architecture without rewriting the old script first.
Wrap an existing standalone script or replay flow into a typed app adapter/orchestrator with minimal drift. Use when a repo already has working legacy automation that must be integrated into a new architecture without rewriting the old script first.
build a tiny compatibility config object in the new layer
avoid depending on the legacy script's full argparse/AppConfig constructor unless field shapes are known stable
Reason:
legacy CLI/config objects often drift faster than runtime call signatures
thin wrappers should depend on the narrowest stable surface
Config compatibility pattern
If the legacy runtime only needs attribute access, use a tiny compatibility object in the new layer instead of constructing the legacy dataclass wholesale.
Examples: types.SimpleNamespace, a small local dataclass, or a minimal config class.
Use this when:
the legacy AppConfig constructor has many fields
field names have already drifted from what the new layer guessed
only a subset is actually needed by WindsurfClient or provider factory helpers
This avoids accidental coupling to unrelated legacy options while still letting the thin bridge call real runtime objects.
Proven pattern from use: register replay bridge
In the same repo, the safe follow-up move was:
keep windsurf_auth_replay.py unchanged
add WindsurfReplayRegisterAdapter that creates a session, WindsurfClient, and mail provider at runtime
delegate actual registration mapping to the narrower WindsurfRpcRegisterAdapter
use a local compatibility config object rather than constructing legacy AppConfig directly after constructor drift was observed
wire stub vs windsurf_replay selection in bootstrap/CLI only after adapter tests passed
verify explicit adapter injection still overrides backend selection
This preserved low drift while allowing old replay logic to participate in the new architecture.