Plugin overview
Expose application operations as native crtr commands with a typed HTTP plugin.
Authoring crtr HTTP plugins
@north-light/crouter-plugin turns one TypeScript command tree into both a Fetch handler and the archive accepted by crtr pkg plugin install --endpoint. Use it when an application should expose typed operations as native crtr commands without maintaining commands.json or a separate HTTP route definition.
Start with the package README for a complete plugin that a developer can paste into an empty file. Then read the page that matches the work at hand:
- Getting started — the deployment and install sequence.
- Commands — command trees and descriptions that let an agent choose a command.
- Parameters and handler input — every
param.*builder and the inferred handler input type. - Output — every
field.*builder and handler result validation. - Errors and streaming —
LeafError, HTTP errors, and NDJSON streaming leaves. - Deployment — Fetch frameworks, mount paths, proxies, authentication, and archive compression.
- Bundles and memory docs — generating an archive and shipping memory docs.
The package exports only LeafError, ManifestInvalidError, PluginDefinitionError, buildBundle, buildCommandManifest, createFetchHandler, defineBranch, defineLeaf, definePlugin, defineStreamingLeaf, field, kebab, and param. Those are the complete authoring surface.