Skip to content

refactor(cli): convert session subcommands to effectCmd#25483

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

refactor(cli): convert session subcommands to effectCmd#25483
kitlangton merged 1 commit intodevfrom
kit/cli-effectify-session

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Convert `session list` and `session delete` from `cmd()` + `bootstrap()` to `effectCmd` + `Effect.ensuring(store.dispose(ctx))`.
  • `Session.Service` yielded directly (drops `AppRuntime.runPromise` wrappers).
  • `try/catch` around `Session.get` becomes `Effect.catchCause(() => fail(...))` (`Session.get` surfaces `NotFoundError` as a defect, not a typed E).
  • Pager spawn stays inside `Effect.promise`.
  • The parent `SessionCommand` stays on `cmd()` — group dispatcher only.

Behavioral notes

Subagent purity audit: MOSTLY PURE WITH NOTES.

  • One strict improvement: on `session delete `, dispose now runs before exit (legacy `process.exit(1)` bypassed bootstrap's finally). Same stderr text + exit code 1.
  • No other diffs across either subcommand.

`db.ts` was considered next but skipped — none of its subcommands use bootstrap or any services (just spawns `sqlite3`, runs JSON migration). Converting would add an unnecessary instance load.

Test plan

  • `bun run typecheck`
  • `bun run test test/cli/` — 137 pass
  • Smoke: `session list --max-count 3` prints sessions table
  • Smoke: `session delete bogus-id` → `Error: Session not found: bogus-id` (matches legacy)

Convert session list + session delete from cmd() + bootstrap() to
effectCmd + Effect.ensuring(store.dispose(ctx)). Session.Service yielded
directly. The legacy try/catch around Session.get becomes
Effect.catchCause + fail() (Session.get surfaces NotFoundError as a
defect, not a typed E). Pager spawn stays inside Effect.promise.

The parent SessionCommand stays on cmd() — group dispatcher only.
@kitlangton kitlangton merged commit 1986a6e into dev May 2, 2026
13 checks passed
@kitlangton kitlangton deleted the kit/cli-effectify-session branch May 2, 2026 22:15
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