refactor: split phase3.go + extract MCP tool registry (R4)
internal/httpapi/phase3.go (2627 lines, 12+ resource domains) split into 15 per-resource files: - actuator.go: SSH execution machinery (initSSH, sshExec, resolveRunTarget, executeApprovedAction, jsonErr, gatewayPreflightPassed, resolveTemplate) - checks.go, classifications.go, executions.go, approvals.go, patterns.go, skills.go, approval_rules.go, autonomy.go, risk_classes.go, relationships.go, entity_types.go, metrics.go, agent_activity.go, helpers.go — one file per resource domain, each with its own imports. internal/mcp/server.go: newServer (708 lines, 33 inline tool registrations) refactored to a registry pattern: - internal/mcp/tools.go (new): toolReg struct + allTools() returning all 33 tool definitions. Handler logic moved verbatim — no changes to tool names, descriptions, schemas, or behavior. - server.go: newServer is now 9 lines (iterate registry, AddTool each). -699 lines. No function logic, names, or signatures changed. go vet, build, and all tests pass (httpapi, mcp, db, policy).
This commit is contained in:
@@ -388,14 +388,20 @@ qualified as `archive/knowledge/` history.
|
||||
installing golangci-lint + staticcheck + govulncheck** in CI (none are
|
||||
installed locally; CI config at `.gitea/workflows/ci.yml` should be checked).
|
||||
|
||||
### E.2 Desktop version hardcode — NOT fixed (behavior change)
|
||||
### E.2 Desktop version hardcode — fixed in R6
|
||||
|
||||
`cmd/desktop/main.go:39` `version = "0.1.0"` while repo is `0.7.6`. Per
|
||||
`CONTRIBUTING.md:54`, the auto-update feature compares against this const —
|
||||
so every release tag > 0.1.0 triggers a spurious update prompt, or the
|
||||
comparison is meaningless. **Fix: inject from `VERSION` at link time** (e.g.
|
||||
`-ldflags "-X main.version=$(cat VERSION)"`). Deferred — touches auto-update
|
||||
behavior; tracked as R6.
|
||||
`cmd/desktop/main.go:39` had `version = "0.1.0"` as a const while the repo is at `0.7.8`. Per
|
||||
`CONTRIBUTING.md:54`, the auto-update feature compares against this value — so every release tag >
|
||||
0.1.0 triggered a spurious update prompt. **Fixed:** `version` is now a `var` (default
|
||||
`"0.1.0-dev"` fallback for bare `go build`), injected from the `VERSION` file at link time via
|
||||
`make desktop` (`-ldflags "-X main.version=$(cat VERSION)"`). `CONTRIBUTING.md` updated to match.
|
||||
|
||||
### E.3 `Makefile` `BINARY` collision — fixed in R6
|
||||
|
||||
`BINARY := oikos` wrote to `./oikos`, which collided with the `oikos/` directory (Go's `-o oikos`
|
||||
into a directory named `oikos` created `oikos/oikos`). **Fixed:** `BINARY := bin/oikos` (matches
|
||||
the gitignore comment); `build` target ensures `bin/` exists; `clean` removes `bin/`. Stale
|
||||
`oikos/` cruft directory removed.
|
||||
|
||||
## F. Recommendations (actionable, ordered)
|
||||
|
||||
@@ -404,9 +410,9 @@ behavior; tracked as R6.
|
||||
| R1 | Delete dead Go: `notifier.VerifyApprovalToken`, `httpapi/stubs.go`; unexport 4 `checkdefaults` symbols | S | Low | ✅ done (c3973e7) |
|
||||
| R2 | Delete dead web: 21-file tool-renderer registry, 5 dead components, 2 dead store exports, 2 dead npm deps | S | Low | ✅ done (c3973e7+1) |
|
||||
| R3 | Decide sqlc vs raw SQL: delete 17 dead queries OR migrate inline SQL to use them | M | Medium | ✅ done (hybrid: 8 deleted, 9 migrated) |
|
||||
| R4 | Split `phase3.go` (2627 lines) into per-resource files; refactor `newServer` (708 lines) to a tool registry | M | Medium |
|
||||
| R4 | Split `phase3.go` (2627 lines) into per-resource files; refactor `newServer` (708 lines) to a tool registry | M | Medium | ✅ done |
|
||||
| R5 | Rewrite `.agents/domains/knowledge/schema.md` + `.agents/shared/llm-wiki.md` for the DB-native model; delete/deprecate root `inventory.yaml` | M | Low | ✅ done |
|
||||
| R6 | Inject desktop `version` from `VERSION` via ldflags; fix `Makefile` `BINARY` colliding with `oikos/` dir | S | Low |
|
||||
| R6 | Inject desktop `version` from `VERSION` via ldflags; fix `Makefile` `BINARY` colliding with `oikos/` dir | S | Low | ✅ done |
|
||||
| R7 | Add tests for `learning` (80% gate), `actuator`, `scheduler`, `domain`, `notifier`, `knowledge` | L | Low |
|
||||
| R8 | Add `eslint`+`prettier`+`vitest` to `web/`; wire `svelte-check`+`tsc` into CI; add `web/` CI job | M | Low |
|
||||
| R9 | Define `OikosEvent` discriminated union; eliminate ~15 `any` sites in web | S | Low |
|
||||
|
||||
Reference in New Issue
Block a user