Skip to content

refactor(cli): convert mcp list, auth, auth list, logout to effectCmd#25521

Merged
kitlangton merged 4 commits into
devfrom
kit/mcp-effectcmd-batch-1
May 3, 2026
Merged

refactor(cli): convert mcp list, auth, auth list, logout to effectCmd#25521
kitlangton merged 4 commits into
devfrom
kit/mcp-effectcmd-batch-1

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented May 3, 2026

Summary

Four of the six mcp subcommands migrated to effectCmd. Same mechanical conversion: handler body becomes Effect.fn("Cli.mcp.<name>") with native yield* for service calls.

Also drops the AppRuntime.runPromise wrappers from the helper functions listState() and authState() — they now return Effects directly. No leftover await AppRuntime.runPromise(...) shims.

Commits

  1. refactor(cli): convert mcp list to effectCmd — also converts listState() from async-runPromise wrapper to plain Effect.
  2. refactor(cli): convert mcp auth list to effectCmd — converts authState() similarly.
  3. refactor(cli): convert mcp logout to effectCmd — drops AppRuntime.runPromise for McpAuth.Service.use and MCP.Service.use calls.
  4. refactor(cli): convert mcp auth to effectCmd — biggest of the four; preserves the try/finally around the bus unsubscribe inside the Effect.gen body.

Effect on WithInstance.provide

Four callers gone from mcp.ts. Two remain (McpAddCommand, McpDebugCommand) — saved for the next batch since they're the bigger handlers.

Test plan

  • bun run typecheck clean

@kitlangton kitlangton changed the title refactor(cli): convert mcp list, auth list, logout to effectCmd refactor(cli): convert mcp list, auth, auth list, logout to effectCmd May 3, 2026
@kitlangton kitlangton force-pushed the kit/mcp-effectcmd-batch-1 branch from 0d503bf to cc4e88b Compare May 3, 2026 02:55
@kitlangton kitlangton enabled auto-merge (squash) May 3, 2026 02:55
@kitlangton kitlangton merged commit db24f89 into dev May 3, 2026
10 checks passed
@kitlangton kitlangton deleted the kit/mcp-effectcmd-batch-1 branch May 3, 2026 03:03
kitlangton added a commit that referenced this pull request May 3, 2026
Three commands that used cmd() + WithInstance.provide — missed in the
earlier conversion arc. Now on effectCmd:

- agent.ts: AgentCreateCommand. AgentListCommand was already converted.
  Instance.project / Instance.worktree → ctx.* via InstanceRef.
- providers.ts: 3 subcommands.
  - list: instance: false (only reads global Auth + ModelsDev).
  - login: instance: true (reads Plugin + Config — both project-scoped).
  - logout: instance: false (only Auth).
- mcp.ts: 2 remaining subcommands (add + debug). Other 4 (list, auth,
  auth list, logout) already converted in #25521 to Stage 4 directly.
  - add: Instance.project / Instance.worktree → ctx.*.
  - debug: no Instance reads.

All bodies wrapped in Effect.promise(async () => {...}) for byte-equivalent
behavior. Internal AppRuntime.runPromise(...) calls preserved as-is —
Stage 4 cleanup is optional follow-up.

Drops imports: WithInstance, Instance.
kitlangton added a commit that referenced this pull request May 3, 2026
Three commands that used cmd() + WithInstance.provide — missed in the
earlier conversion arc. Now on effectCmd:

- agent.ts: AgentCreateCommand. AgentListCommand was already converted.
  Instance.project / Instance.worktree → ctx.* via InstanceRef.
- providers.ts: 3 subcommands.
  - list: instance: false (only reads global Auth + ModelsDev).
  - login: instance: true (reads Plugin + Config — both project-scoped).
  - logout: instance: false (only Auth).
- mcp.ts: 2 remaining subcommands (add + debug). Other 4 (list, auth,
  auth list, logout) already converted in #25521 to Stage 4 directly.
  - add: Instance.project / Instance.worktree → ctx.*.
  - debug: no Instance reads.

All bodies wrapped in Effect.promise(async () => {...}) for byte-equivalent
behavior. Internal AppRuntime.runPromise(...) calls preserved as-is —
Stage 4 cleanup is optional follow-up.

Drops imports: WithInstance, Instance.
oleksii-honchar pushed a commit to oleksii-honchar/better-opencode that referenced this pull request May 6, 2026
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