toolcraft-openapi
v0.0.20
Published
tools for agents and humans
Readme
toolcraft-openapi
tools for agents and humans
Scaffold for OpenAPI-driven toolcraft clients.
Usage
import { bearerTokenAuth, requestJson } from "toolcraft-openapi";
const auth = bearerTokenAuth({
serviceName: "internal-agent",
envVar: "INTERNAL_AGENT_TOKEN",
whoamiPath: "/whoami"
});Generator CLI
toolcraft-openapi-generate reads an OpenAPI document from disk or a URL, writes generated
command files, and stores the current spec hash in openapi.lock.
--input <path-or-url>— OpenAPI document to read. Defaults toopenapi.json.--output <dir>— directory for generated files. Defaults tosrc/generated.--lock <path>— lock file path. Defaults toopenapi.lock.--check— exits non-zero when generated files oropenapi.lockwould change.
CI drift check
toolcraft-openapi-generate --checkExports
bearerTokenAuth(opts)requestJson(options)HttpErrorTokenSourceCommandContributorAuthProvider
Environment variables
<envVar passed to bearerTokenAuth>— bearer token override; wins over stored credentials.AUTH_BACKEND— forwarded toauth-storeto selectfileorkeychainstorage.
Configuration
bearerTokenAuth(opts)
serviceName: string— auth-store service name and file-store key.envVar: string— environment variable checked before stored credentials.whoamiPath?: string— optional authenticated endpoint used byloginandstatus.commandPrefix?: string— CLI auth group name. Defaults toauth.
Auth commands
bearerTokenAuth() contributes a CLI-only <commandPrefix> group with:
loginlogoutstatus
