Skip to content

Declared operations, first slice: one declaration generates the route, client hook, command and tool definition #571

Open

Description

@dmealing

Fold into #10 (declared API), with tool output under #18 and schemas from #8.

The ruling on #367 was that generated CRUD routes should not grow more options, and that declared operations with hand-written bodies are the answer. This is evidence for a first slice, from an application with 142 hand-written routes.

Almost every one of those routes has the same outer shape: a strict body, an authorisation class, a call to a domain function, a response of a known type and often an audit record. Only the domain function differs. The same shape is repeated by hand in a typed client hook, in a command-line command that calls the route, and in a tool definition that lets a language model call it. A second application by the same team has the same pattern: every write is a hand-written endpoint, and its command-line tool is one route call per command.

A first slice could be small. An operation node names an input value object, an output value object or projection, whether it reads or writes, and a handler binding. The body stays hand-written. From that declaration, reference generators emit the route, the client hook, a command and a strict tool definition. template.toolcall exists as vocabulary today and no generator reads it, so this would be its first consumer.

A prototype emitted a tool manifest (name, description, strict parameter schema, result fields) from marks on existing objects. A consumer in another language builds its tools from that file with one small loader.

  • Operation vocabulary: input reference, output reference, read or write, handler binding
  • Route generator for operations, with a strict body and a typed response
  • Client hook generator for operations. The stock hooks generator currently emits mutation hooks for routes an adopter has chosen not to expose.
  • Tool-definition generator that reads template.toolcall and the strict JSON Schema profile
  • A language-neutral tool manifest for consumers that are not TypeScript
  • Command generator: one command per operation marked for it
  • Requirement coverage counts operations, not only entities
  • Leave approval tiers and authorisation to providers, as the route guard recipe already says

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions