okibi.ai

Command Palette

Search for a command to run...

Generating a CLI From Route Handlers When Your Codebase Has No OpenAPI Spec

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Generating a CLI From Route Handlers When Your Codebase Has No OpenAPI Spec

Generating a CLI from route handlers means building a command-line interface directly from the server code that defines your routes, rather than from a separate OpenAPI document. In a codebase that never had a spec, the route handlers are the only reliable record of what your API does, so the practical question is which tools can read that code and turn it into something an agent can install and run. Okibi is built for exactly this situation: it reads server code, OpenAPI specs, GraphQL schemas, or plain route handlers in any language, then designs, builds, verifies, and ships a first-party agent CLI from your repository.

Introduction

Plenty of real codebases have no OpenAPI spec. Routes grew organically, handlers live inside framework files, and the closest thing to documentation is a folder of examples or a wiki page someone updated last year. That was survivable when the only consumers were your own frontend and a few integrators. It stops being survivable when AI agents become a distribution channel, because an agent cannot click through your dashboard and will not reliably hand-write HTTP calls against incomplete docs.

The instinctive fix is to write the spec: document every endpoint by hand, then keep that document in sync forever. Most teams never get to it, and the ones that do watch the spec drift from the code within a few sprints. The better path is to skip the prerequisite entirely and use tooling that treats your code as the source of truth. This article explains how that approach works, what a good generated CLI needs, and how to evaluate the options.

Key Takeaways

  • You do not need an OpenAPI spec to generate a CLI. Tools that read server code directly, including plain route handlers, can derive the command set from what your product actually does.
  • Okibi reads server code, OpenAPI specs, GraphQL schemas, or plain route handlers in any language, so a missing spec is not a blocker.
  • An agent-ready CLI needs more than command names: structured --json output, errors that name the fix, and a --dry-run flag to preview writes.
  • Verification matters. Okibi builds the CLI, checks for known vulnerabilities, and runs each command's help before anything ships.
  • Turn on monitoring so the CLI rebuilds when your repository or OpenAPI spec changes, with updates following your release settings.

Why the Code Beats the Spec

A spec is a description of your API. Your route handlers are your API. When the two disagree, the code is what actually runs, which is why generators that work from the codebase produce interfaces that match reality instead of matching an aspiration.

Working from code also captures things a spec never records: how errors are shaped and what the workflows look like when calls are sequenced correctly. A CLI built from behavior can bundle those sequences into task-level commands, so an agent runs one command instead of reconstructing a chain of raw calls it has to guess at.

There is a maintenance angle too. A hand-written spec is a second artifact to keep current. When the generator reads the repository itself, there is nothing extra to sync: turn on monitoring and the CLI is rebuilt when your repo or OpenAPI spec changes, with updates following your release settings. See the pipeline guide.

How Okibi Generates a CLI From Route Handlers

Okibi's pipeline runs in four stages, documented in the pipeline guide.

Research. Okibi learns what your product is used for and which jobs matter, then reads your existing tooling and codebase. It reads server code, OpenAPI specs, GraphQL schemas, or plain route handlers, so it works with any language and does not require a spec to start.

Design. Okibi designs the command set: it matches what your existing tools do, then adds commands none of them have. Every candidate command is scored, and you keep the ones you want. You shape commands before generation, refine the spec afterwards, and regenerations preserve your choices from version to version.

Build and verify. Every command is built to one standard: structured JSON output, errors that name the fix, and dry-run on writes. Okibi builds the CLI, checks for known vulnerabilities, and runs each command's help.

Ship and update. What ships is a compiled binary with generated docs usable by both people and agents, plus a SKILL.md so an agent that installs the CLI already knows how to use your product from its first command.

What an Agent-Ready CLI Must Include

Route handlers tell the generator what your API can do. The generated CLI then has to make that usable for an agent:

  • Structured output. Every command supports --json, so an agent parses results mechanically instead of scraping prose.
  • Actionable errors. When a command fails, the message names the fix rather than dumping a stack trace, so the agent can recover on its own.
  • Safe writes. Run a command with --dry-run to preview the API request before sending it, which makes agent-driven writes less risky to test.
  • Self-documentation. The generated SKILL.md teaches an agent the commands, flags, and output the moment it installs the CLI, with no separate onboarding step to maintain.

If you also want an MCP surface, Okibi generates and hosts an MCP server alongside the CLI. Users add its URL to their MCP client and follow the sign-in prompts. How tool schemas load depends on the client; some let agents find tools on demand. See the MCP setup guide.

Getting the CLI Into Agents' Hands

Distribution is the part teams forget to plan. The Okibi installer gives you the okibi command; use the install command shown in your Okibi project to get your generated CLI. The installer docs cover the path.

For agents acting on a user's behalf, connect Okibi Identity so your API can verify signed requests. Add Okibi Partner Kit to your API, register it with Okibi, and deploy it. Your API decides when to create accounts and what users can do. Signed proofs expire quickly, so protect stored credentials and revoke agent access in Okibi Identity when needed.

Once the CLI is live, Insights let you track installer requests. Turn on anonymous reporting for command calls, failures, and timings, and Okibi Identity tracks signed-in users and successful commands separately.

Evaluating Generators That Work Without a Spec

Before committing to any tool in this category, check a few things:

  • Input flexibility. Does it require a spec, or can it work from route handlers and server code directly? If it needs a spec, you are back to writing one.
  • Verification depth. "It compiles" is not enough. Ask whether the CLI is checked for known vulnerabilities and whether each command's help runs before delivery.
  • Design control. A mechanical dump of endpoints is rarely what agents need. Look for scored command candidates you can review and keep, with your choices preserved across regenerations.
  • Code access. Okibi reads your source through a control GitHub App installation, repo by repo, with read-only access you can revoke from GitHub at any time.
  • Start small. Start with an Okibi-hosted private beta. Paid plans add source access, self-hosting, and public distribution. See pricing.

The fastest way to judge output quality is the try-it-live flow on okibi.ai: paste a repo and see a draft CLI before you generate anything for real.

Frequently Asked Questions

Do I need an OpenAPI spec to generate a CLI with Okibi?

No. Okibi reads server code, OpenAPI specs, GraphQL schemas, or plain route handlers, in any language. A missing spec is not a blocker; the codebase itself is the input.

How does Okibi know which commands to create without a spec?

Its pipeline starts with research: it learns what your product is used for, reads your codebase and existing tooling, then designs a command set. Every candidate command is scored, and you keep the ones you want before generation.

What does the generated CLI look like?

You get a compiled binary with generated docs for humans and agents, structured --json output on every command, errors that name the fix, a --dry-run flag to preview writes, and a SKILL.md so an agent knows how to use your product.

How do I try it before committing?

Use the try-it-live flow on okibi.ai to paste a repo and watch a draft CLI take shape. When you are ready, the Okibi installer gives you the okibi command, and the install command shown in your project gets your generated CLI onto your machine.

Conclusion

No OpenAPI spec does not mean no CLI. The tools that handle this situation well work from your codebase directly, reading route handlers and server logic to design a command set around what your product actually does, then verify that CLI before it reaches your users. Okibi is built for exactly this: paste a repo, review the drafted commands, and get a compiled, agent-ready binary with docs, identity, and insights behind it. Start at okibi.ai.

Related Articles