Skip to content

refactor(server): share worktree create/list commands#892

Closed
boudra wants to merge 2 commits into
refactor-worktree-commandsfrom
refactor-worktree-create-list-commands
Closed

refactor(server): share worktree create/list commands#892
boudra wants to merge 2 commits into
refactor-worktree-commandsfrom
refactor-worktree-create-list-commands

Conversation

@boudra
Copy link
Copy Markdown
Collaborator

@boudra boudra commented May 10, 2026

Summary

  • Add shared worktree create/list commands to packages/server/src/server/worktree/commands.ts.
  • Route Session worktree list/create handlers through the shared command surface while keeping WS response/update shaping in worktree-session.ts.
  • Route MCP list_worktrees / create_worktree through the same command surface while keeping MCP target parsing and structuredContent shaping in mcp-server.ts.

Risk / coverage notes

  • Session list branch: covered by packages/server/src/server/worktree-session.test.ts (handlePaseoWorktreeListRequest > lists worktrees through the workspace git service). This caught and fixed an exact call-shape drift during the refactor.
  • Session create success, workspace update, setup continuation, git warmup, and error-code branches: covered by packages/server/src/server/worktree-session.test.ts create/workflow tests.
  • MCP create target validation and create/list tool behavior: covered by packages/server/src/server/agent/mcp-server.test.ts.
  • Lower-level registered worktree side effects remain covered by packages/server/src/server/paseo-worktree-service.test.ts; this PR does not move that service behavior.
  • MCP real worktree create/list remains indirectly covered by packages/server/src/server/agent/mcp-parity.e2e.test.ts, not rerun locally per targeted-test rule.

Verification

  • npx vitest run packages/server/src/server/worktree-session.test.ts --bail=1 (pre-refactor: green; post-refactor: one call-shape drift found, fixed; rerun green)
  • npx vitest run packages/server/src/server/agent/mcp-server.test.ts --bail=1 (pre-refactor green; post-refactor green)
  • npm run format
  • npm run typecheck
  • npm run lint

Unslop check

  • Kept transport-specific response/error payload shaping in Session and MCP.
  • Removed the MCP-only create wrapper instead of adding another coordinator.
  • Command deletion test: deleting the new create/list command paths makes direct listWorktrees, runSetup: false, paseoHome forwarding, and worktree error conversion reappear in both Session and MCP.

@boudra
Copy link
Copy Markdown
Collaborator Author

boudra commented May 10, 2026

Closing in favor of the single integration PR #893, which contains the full Session/MCP command-boundary stack and is being held until after the stable release.

@boudra boudra closed this May 10, 2026
@boudra boudra deleted the refactor-worktree-create-list-commands branch May 10, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant