Northlight
Plugin

Plugin overview

Expose application operations as native crtr commands with a typed HTTP plugin.

@north-light/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 documents — generating an archive and shipping agent-facing documents.

The primary authoring surface is LeafError, ManifestInvalidError, PluginDefinitionError, buildBundle, buildCommandManifest, createFetchHandler, createNodeHandler, defineBranch, defineLeaf, definePlugin, defineStreamingLeaf, field, kebab, and param. The package also exports compareManifests, createCallerVerifier, postReceipt, ReceiptPostError and the structural types createNodeHandler takes.