Skip to content

refactor(cli): convert export command to effectCmd#25471

Merged
kitlangton merged 1 commit intodevfrom
kit/cli-effectify-export
May 2, 2026
Merged

refactor(cli): convert export command to effectCmd#25471
kitlangton merged 1 commit intodevfrom
kit/cli-effectify-export

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Convert `cli/cmd/export.ts` from `cmd()` + `bootstrap()` to `effectCmd`.
  • `Session.Service` yielded directly (drops three `AppRuntime.runPromise` wrappers).
  • Body extracted to `run()` so the legacy `bootstrap()` finally-disposal matches via `Effect.ensuring(store.dispose(ctx))`.
  • `try/catch` around session lookup → `Effect.catchCause(() => fail(...))` because `Session.get` surfaces `NotFoundError` as a defect (not a typed E).

Behavioral notes

  • Subagent purity audit: PURE.
  • One strict improvement: disposal now also runs on the `Session not found` error path (legacy `process.exit(1)` synchronously killed the process before bootstrap's finally could dispose). All other paths and error-formatting are identical.

Test plan

  • `bun run typecheck`
  • `bun run test test/cli/` — 137 pass
  • Smoke `export --help` — yargs help intact
  • Smoke `export bogus-session-id` — prints `Error: Session not found: bogus-session-id` (matches legacy)

Independent of #25465 / #25467.

bootstrap() → effectCmd + Effect.ensuring(store.dispose(ctx)) for
disposal parity. Session.Service yielded directly (drops three
AppRuntime.runPromise wrappers). UI.CancelledError still propagates as a
defect; the try/catch around session lookup becomes Effect.catchCause to
match legacy semantics (Session.get surfaces NotFoundError as a defect,
not a typed failure).
@kitlangton kitlangton merged commit e318e17 into dev May 2, 2026
13 checks passed
@kitlangton kitlangton deleted the kit/cli-effectify-export branch May 2, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant