Skip to content

v0.6.0 — capability registry as single source of truth

Pre-release
Pre-release

Choose a tag to compare

@cabroe cabroe released this 25 Jul 18:19

The capability registry is now the actual single source of truth, and the discovery facade (automad_discover) scales with it. Same tool surface as v0.5.x — 8 tools, 4 resources, 5 prompts — but one declaration per tool instead of five places that had to agree.

What changed

src/capabilities/registry.ts declares each tool once (title, summary, description, runtime requirement, actions with readOnly/destructive/internal flags). Everything else is derived from it:

Previously hand-maintained Now
WriteAction union (41 literals in write-guard.ts) type-level derivation from the registry
READ_ACTIONS / DESTRUCTIVE_ACTIONS actionsWhere(a => a.readOnly / a.destructive)
a z.enum([...]) per tool in schemas.ts actionEnum("automad_pages")
eight registerTool(...) blocks in server.ts one loop over TOOL_BINDINGS
EXPECTED_ACTIONS, WRITE_ACTION_PREFIX removed — duplicated data the registry already carries
INTERNAL_ACTIONS allowlist in the drift test internal(...) in the registry

New wiring layer src/capabilities/tools.ts: one bind(name, schema, handler) per tool, keyed by a record total over ToolName, with the runtime gate (requires: live | themes | none) taken from the registry. server.ts no longer knows any individual tool.

Scaling pattern

  • New action — one line in the registry. tsc then fails in the domain router's Record<Action, WriteAction> map and its non-exhaustive switch, and nowhere else. Zod enum, write-guard, automad_discover and the generated README table follow automatically.
  • New tool — registry entry + schema in TOOL_INPUT_SCHEMAS + domain router + one bind(...). Both records are total over ToolName, so a missing piece is a compile error.

Fixed

  • automad_discover can describe itself. describe with tool: "automad_discover" returned NOT_FOUND — the schema map had forgotten the tool it belongs to. It now reads TOOL_INPUT_SCHEMAS, the same schemas the server registers from.

Discovery output (additive)

list and describe now also report writeAction (the guard action, e.g. pages.delete) and requires (live / themes / none); describe additionally returns the tool's title and summary alongside the full description. Existing fields are unchanged.

Tests

321 tests (up from 303). The drift tests changed role: instead of comparing two hand-maintained lists — impossible to drift now — they pin the runtime derivations TypeScript can't see: actual Zod enum values, actual guard sets, internal actions hidden from every advertised surface, and real WriteGuard behavior in each write mode. New tests/unit/capabilities-tools.test.ts covers the binding layer's gates.

Generated docs unchanged: 8 tools / 21 read actions / 11 destructive actions.

Full changelog: CHANGELOG.md

Beta: functional and live-verified; not yet published to npm.