Files
ruflo/.github
ruv 42bda4874a feat(metaharness): npx ruflo eject — Phase-2 differentiator (iter 4–5)
ADR-150 Phase 2 lands the eject path. Users can now lift a ruflo
project into a renamed standalone harness with a single command:

  npx ruflo eject --name my-harness                    # dry-run plan
  npx ruflo eject --name my-harness --confirm          # actually eject
  npx ruflo eject --name foo --target /abs --confirm   # custom target

The eject delegates to upstream `metaharness --from-existing` which
walks the source tree, rewrites every `ruflo`/`claude-flow` reference,
and preserves attribution via the `<!-- ruflo-attribution-block -->`
convention. Output lands in a fresh directory the user can then `cd`
into and `npx harness doctor`.

SAFETY GATES (load-bearing)
  1. Dry-run by default — `--confirm` required for any disk write.
  2. `--target` refused if it resolves inside the calling repo
     (exit 2 with `target-inside-repo` error code). Default is
     /tmp/ruflo-eject-<ts>-<name>/ — outside the source tree.
  3. Refuses existing target dirs (no silent overwrites).
  4. Subprocess + 10-minute hard timeout.
  5. Zero static `@metaharness/*` import — the command file invokes
     `npx metaharness` via spawnSync. ADR-150 architectural
     constraint preserved.

GRACEFUL DEGRADATION
  When the metaharness binary is unavailable (offline, no network),
  the command exits 0 with a structured "feature not available"
  message instead of throwing. Ruflo continues to function — rule #3.

WIRED
- v3/@claude-flow/cli/src/commands/eject.ts (185 LOC)
- Registered in commands/index.ts loader table
- Smoke step 17: invariants for command file, name field, --from-existing
  flag use, both safety refusals (in-repo + already-exists), dry-run
  default, --confirm flag, graceful degradation, loader registration

CI INTEGRATION
- metaharness-ci.yml gains `eject-dryrun` job (3 min timeout):
  * Builds the CLI dist
  * Runs `ruflo eject --name my-test-harness --format json` and
    asserts dryRun:true + name field in output
  * Runs `ruflo eject --target $PWD/eject-test --confirm` and asserts
    the safety gate fires (refuses in-repo target)
  * The actual eject (writing files) is NEVER executed in CI

Smoke: 16 → 17. Fleet: 33/33. tsc clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 13:43:56 -04:00
..