refactor(harness): extract MCP-config registry to internal/harness (phase 1) #15

Merged
pti merged 1 commit from feat-harness-registry-p1 into main 2026-07-07 16:24:30 +02:00
Owner

Phase 1 of design/harness-descriptor.md — the behaviour-preserving extraction.

What

  • New internal/harness: Params + Descriptor{Name, Render} + Registry (agy/claude/cursor/opencode/gemini/roo/windsurf), plus Names/Expand/Write and the merge/writer helpers — moved verbatim from init.go.
  • cmd/init.go is now a thin CLI over the package (cobra command + runInit loop). All generators, mergeJSONConfig, appendCWD, mustJSON, writeConfig, expandHarnesses moved out.
  • Tests move to the harness package; added coverage pinning the per-harness URL-key variance (url/serverUrl/httpUrl, mcpServers vs mcp) and merge-preserving writes.

No behaviour change

wraptool init emits identical output — verified end-to-end (claude → .mcp.json type:sse+cwd; opencode → opencode.json mcp/type:remote/enabled). Params already carries Token/CWD so phase 2 (replace the claude-only writeMCPConfig, add AuthMode) won't reshape descriptors. writeMCPConfig/connect.sh untouched here.

Full go test ./... + golangci-lint clean.

🤖 Generated with Claude Code

Phase 1 of `design/harness-descriptor.md` — the behaviour-preserving extraction. ## What - New **`internal/harness`**: `Params` + `Descriptor{Name, Render}` + `Registry` (agy/claude/cursor/opencode/gemini/roo/windsurf), plus `Names`/`Expand`/`Write` and the merge/writer helpers — moved verbatim from `init.go`. - **`cmd/init.go`** is now a thin CLI over the package (cobra command + `runInit` loop). All generators, `mergeJSONConfig`, `appendCWD`, `mustJSON`, `writeConfig`, `expandHarnesses` moved out. - Tests move to the harness package; added coverage pinning the per-harness **URL-key variance** (`url`/`serverUrl`/`httpUrl`, `mcpServers` vs `mcp`) and **merge-preserving** writes. ## No behaviour change `wraptool init` emits identical output — verified end-to-end (claude → `.mcp.json` `type:sse`+cwd; opencode → `opencode.json` `mcp`/`type:remote`/`enabled`). `Params` already carries `Token`/`CWD` so phase 2 (replace the claude-only `writeMCPConfig`, add `AuthMode`) won't reshape descriptors. `writeMCPConfig`/`connect.sh` untouched here. Full `go test ./...` + golangci-lint clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(harness): extract MCP-config registry to internal/harness (phase 1)
All checks were successful
Lint / lint (pull_request) Successful in 1m0s
2efeb0b651
Phase 1 of design/harness-descriptor.md: move init.go's per-harness MCP-config
generators into a shared internal/harness package (Params + Descriptor{Name,
Render} + Registry, plus Names/Expand/Write and the merge/writer helpers).
cmd/init.go becomes a thin CLI over the package. Behaviour-preserving — no CLI
or output change; verified `wraptool init` still emits the correct per-harness
formats (claude .mcp.json type:sse, opencode opencode.json mcp/type:remote, …).

Params already carries Token/CWD so the container callers (phase 2, replacing
the claude-only writeMCPConfig) and per-harness AuthMode won't reshape the
descriptors again. Tests move to the harness package and pin the URL-key
variance (url/serverUrl/httpUrl) + merge-preserving behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pti merged commit b6ab45bfec into main 2026-07-07 16:24:30 +02:00
pti deleted branch feat-harness-registry-p1 2026-07-07 16:24:30 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pti/wraptool!15
No description provided.