CLI

Overview

Install and use the Accorudo CLI.

The CLI covers init, scaffolding, import, export, and sync.

TaskCommandDocs
Scaffold config and an empty bundleaccorudo initbelow
Add a model typeaccorudo model addScaffolding
Add a route and register itaccorudo route addScaffolding
OpenAPI → Accorudoaccorudo importImport
Accorudo → OpenAPIaccorudo exportExport
Import or export from configaccorudo syncbelow

Run via pnpm exec or add scripts to your package.json:

{
  "scripts": {
    "accorudo:import": "accorudo import openapi/main.yaml --out contracts/main",
    "accorudo:export": "accorudo export contracts/main --out openapi/main.yaml"
  }
}

Init

Scaffold config and an empty bundle directory:

accorudo init

Creates:

accorudo.config.ts
contracts/main/
openapi/main.yaml    # placeholder path: point at your real spec

Commands

accorudo import <spec>

Generate a complete contract set from an OpenAPI file. See Import.

accorudo import ./openapi/main.yaml --out ./contracts/main
FlagDescription
-o, --out <dir>Output directory (required)
-n, --name <name>Bundle name for config entries (default: derived from spec info.title)
--only <tags>Limit to comma-separated OpenAPI tags (e.g. widget,admin)
--dry-runPrint planned files without writing

accorudo export <contracts>

Generate an OpenAPI spec from an Accorudo contract bundle. See Export.

accorudo export ./contracts/main --out ./openapi/main.yaml
FlagDescription
-o, --out <file>Output path: .yaml, .yml, or .json (required)
--title <title>Override info.title in the generated spec
--dry-runPrint spec to stdout instead of writing

accorudo sync [bundle]

Run import or export for bundles defined in accorudo.config.ts.

accorudo sync                  # import all bundles (openapi → contracts)
accorudo sync main             # import one bundle
accorudo sync main --reverse   # export one bundle (contracts → openapi)
accorudo sync --reverse        # export all bundles
FlagDescription
--reverseExport contracts to OpenAPI instead of importing
--dry-runPreview changes without writing

accorudo model add <name>

Append a model type to models/<domain>.ts. See Scaffolding.

accorudo route add <key>

Append a route, update routes/<tag>.ts, and register it in api.ts. See Scaffolding.

Configuration

accorudo.config.ts pairs each bundle with its spec:

import { defineConfig } from "accorudo/cli";

export default defineConfig({
  bundles: {
    main: {
      contracts: "./contracts/main",
      openapi: "./openapi/main.yaml",
    },
    payments: {
      contracts: "./contracts/payments",
      openapi: "./openapi/payments.yaml",
    },
  },
});

After init, accorudo sync main replaces a long import command. Add bundles as your API surface grows.

Typical workflow

# 1. Bootstrap from backend spec
accorudo import ./openapi/main.yaml --out ./contracts/main

# 2. Review generated files, hand-edit where needed
# 3. Use accorudo/client in your app

# 4. Later: re-import to pick up new endpoints
accorudo sync main

# 5. Or push contract changes back to a shared spec
accorudo sync main --reverse

Use --dry-run before overwriting hand-edited files. The CLI prints a summary of files to create, update, or skip.

Copyright © 2026