Try three refactoring approaches in parallel, keep the best
何时使用: You have 3 different ideas for a refactor and want to see all of them run/pass tests before picking one.
前置条件
- Server/skill installed and authenticated — See repo README
步骤
-
Spin up three isolated envsCreate three container-use environments named refactor-a/b/c, all on this repo at HEAD.✓ 已复制→ Three env_ids printed
-
Apply each approach in its own envIn refactor-a do the strategy-pattern version; in -b inline everything; in -c extract a service object. Run the full test suite in each. Report pass/fail and diff size.✓ 已复制→ Per-env test summary and diff stats
-
Pick the winner and mergeApply the diff from refactor-b to my working copy. Discard the other two environments.✓ 已复制→ Patch applied locally
结果: Three real experiments evaluated side-by-side without ever breaking your host repo.
注意事项
- Forgetting to discard old envs leaks disk — Forgetting to discard old envs leaks disk —
cu environment listthencu environment discard <id>periodically.