Skip to content

refactor(cli): convert import command to effectCmd#25467

Merged
kitlangton merged 2 commits intodevfrom
kit/cli-effectify-import
May 2, 2026
Merged

refactor(cli): convert import command to effectCmd#25467
kitlangton merged 2 commits intodevfrom
kit/cli-effectify-import

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Convert `cli/cmd/import.ts` from `cmd()` + `bootstrap()` to `effectCmd`.
  • `ShareNext.Service` yielded directly (no `AppRuntime.runPromise` wrappers).
  • `InstanceRef` provides `ctx.project.id` (replacing `Instance.project.id`).
  • Body extracted to `runImport` so the legacy `bootstrap()` finally-disposal matches via `Effect.ensuring(store.dispose(ctx))` — strict superset of try/finally (covers success, typed failure, defect, interruption).

Test plan

  • `bun run typecheck`
  • `bun run test test/cli/` — 137 pass
  • Smoke: `import /tmp/nonexistent.json` → `File not found: ...` (matches legacy)
  • Subagent purity audit: PURE — disposal matches legacy semantics, no new behavioral diffs from extraction

Independent of #25465 (pr command conversion).

Drop bootstrap()/Instance.provide ceremony in favor of effectCmd's auto-
provided InstanceRef. ShareNext.Service is yielded directly instead of
through AppRuntime.runPromise wrappers. Body extracted to runImport so
the legacy bootstrap-finally disposal can be matched via Effect.ensuring
without re-indenting the entire body.

Behavior preserved: dispose still runs on success / typed failure /
defect / interruption (Effect.ensuring is a strict superset of the old
try/finally).
- Use Effect.tryPromise + CliError for fetch and response.json so
  network/parse failures surface as clean one-liners instead of
  FiberFailure stack traces.
- Make the InstanceRef invariant explicit: Effect.die instead of a
  silent early return when (impossibly) absent.
- Reword the legacy-bootstrap comment to describe Effect.ensuring's
  exit-path coverage directly.
@kitlangton kitlangton enabled auto-merge (squash) May 2, 2026 21:48
@kitlangton kitlangton merged commit 79b6ce5 into dev May 2, 2026
10 checks passed
@kitlangton kitlangton deleted the kit/cli-effectify-import branch May 2, 2026 21:56
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