Extending the Runtime
Most feature work follows the same package boundaries already present in the repo.
Adding a new config field
Touch at least these places:
pkg/config/types.gofor the public typepkg/config/cli.schema.jsonfor validationpkg/config/load.gofor merge behaviorpkg/config/config_test.gofor merge/validation coverage- relevant docs under
website/docs/configuration/
Adding a new source type
You will usually need:
- schema enum update in
pkg/config/cli.schema.json - config type support in
pkg/config/types.go - discovery implementation in
pkg/discovery/or an adjacent package - catalog integration in
pkg/catalog/build.go - tests covering direct use and catalog build integration
Adding a new runtime endpoint
The runtime HTTP surface lives in internal/runtime/server.go.
Typical steps:
- add the route in
Handler() - add request/response structs if needed
- implement the handler
- add tests in
internal/runtime/server_test.go - document the endpoint in
website/docs/runtime/http-api.md
Adding a new auth or secret mechanism
Depending on which part changes:
- auth extraction shape:
pkg/catalog/build.go - secret resolution:
internal/runtime/server.go - request application:
pkg/exec/exec.go - policy gate for secret sources:
pkg/config/*pluspkg/policy/if needed
Be explicit about whether the new behavior is catalog metadata only or actively applied during execution.
Adding a new CLI metadata extension
If you introduce a new x-cli-* extension:
- parse it in
pkg/catalog/build.go - store it in
pkg/catalog/types.goif it needs a public normalized field - expose it through
tool schema/catalog list - add catalog tests showing how overlays or OpenAPI set it
- document it in
website/docs/discovery-catalog/normalized-tool-catalog.md
Observability integrations
If you want tracing/export hooks, build them behind pkg/obs.Observer and pass them into runtime/cache constructors. The current code already uses that interface consistently.
Documentation updates that should ship with feature work
When behavior changes, update docs in the same change:
- user-facing CLI/runtime/config changes belong under the matching section in
website/docs/ - repo front door or contributor workflow changes usually belong in
README.mdandwebsite/docs/development/ - docs navigation or site-wide metadata changes live in
website/sidebars.tsandwebsite/docusaurus.config.ts - verify docs with
cd website && npm ci && npm run build
Guardrails for contributors
- keep policy enforcement inside the runtime, not just the CLI
- keep config loading/merge behavior in
pkg/config - keep reusable discovery/catalog logic out of
cmd/ - update docs when behavior changes, especially for quirks and unsupported cases