Skip to content

v0.1.0 — Initial release

Choose a tag to compare

@beogip beogip released this 07 Jun 23:50
7ef0a4e

Initial release of @code-first-agents/tool — the TypeScript implementation of the Code-First Agents pattern. It provides the Tool base class for building deterministic CLI tools that LLM agents can discover, validate, and invoke with zero guesswork.

Features

  • Tool base class — register subcommands (.subcommand()) with Zod input/output schemas, then dispatch from the CLI via .run(argv) — which always exits 0 — or call .invoke(name, args) for in-process use, which returns the result envelope without exiting.
  • Typed output levels (L1/L2/L3)l1Output (raw data fields), l2Output (requires a classification enum), and l3Output (adds a required instructions string) helpers, each baking the { ok, message } envelope for the output spectrum.
  • Self-describing introspection — auto-registered schema (JSON Schema for every subcommand) and help builtins; neither is user-overridable.
  • Always-exit-0 semantics — every path, including errors, exits 0 and reports status via an ok: false JSON envelope (unknown_subcommand, input_validation_error, schema_violation, non_object_return, unexpected_error); handlers throw ToolError for domain-specific codes.
  • Zod v4 schema validation — input/output validated on every call; .strict() input schemas reject unknown flags. Requires the zod@^4 peer dependency; developed and tested on Bun >= 1.2.

📦 npm: @code-first-agents/tool · 📖 Pattern spec