{"_id":"@accorudo/cli","name":"@accorudo/cli","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@accorudo/cli","type":"module","version":"0.0.1","description":"Import, export, and sync Accorudo contracts and OpenAPI specs.","bin":{"accorudo":"dist/bin.js"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./bin":{"default":"./dist/bin.js"},"./dist":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"types":"./dist/index.d.ts","sideEffects":false,"keywords":["typescript","api","openapi","cli","codegen","accorudo"],"author":{"name":"Stavros Tsioulis"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/stavros-tsioulis/accorudo.git","directory":"packages/cli"},"bugs":{"url":"https://github.com/stavros-tsioulis/accorudo/issues"},"homepage":"https://accorudo.stavrostsioulis.com","publishConfig":{"access":"public"},"engines":{"node":">=20"},"dependencies":{"commander":"^13.1.0","@accorudo/openapi":"0.0.1"},"devDependencies":{"@types/node":"^26.4.1","typescript":"^7.0.2","vitest":"^5.0.0","@accorudo/core":"0.0.1","@accorudo/client":"0.0.1"},"scripts":{"build":"tsc && node -e \"require('fs').chmodSync('dist/bin.js', 0o755)\"","test":"vitest run"},"_id":"@accorudo/cli@0.0.1","_integrity":"sha512-7efqo+k0AE5pIGGsEVYc22oq+pm2zZ1DVernlQtQmONosi+Y8gucH942NM3sOtEaWiakhqeNkOoyl9FaB9JPQA==","_resolved":"/private/var/folders/3p/1h2y67gj1010wcdssdw5pb0r0000gn/T/e0e6667db5a54da231dda7d5d193e4aa/accorudo-cli-0.0.1.tgz","_from":"file:accorudo-cli-0.0.1.tgz","_nodeVersion":"24.5.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-7efqo+k0AE5pIGGsEVYc22oq+pm2zZ1DVernlQtQmONosi+Y8gucH942NM3sOtEaWiakhqeNkOoyl9FaB9JPQA==","shasum":"ae712b9eb0a866e76a2c8970700fe985769cd7f5","tarball":"https://registry.npmjs.org/@accorudo/cli/-/cli-0.0.1.tgz","fileCount":41,"unpackedSize":120663,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEcOC4Zlz9lqFAMXBs13eowJ9e4fv8xGC4OKKSQ/U9cdAiAYu3ysHe4+v/CVLlOk1t0yZDV67yV6JAZJsN5PgevaAg=="}]},"_npmUser":{"name":"stavros-tsioulis","email":"contact@stavrostsioulis.com"},"directories":{},"maintainers":[{"name":"stavros-tsioulis","email":"contact@stavrostsioulis.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cli_0.0.1_1788611389563_0.6973729102215369"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-05T12:29:49.439Z","0.0.1":"2026-09-05T12:29:49.719Z","modified":"2026-09-05T12:29:49.933Z"},"maintainers":[{"name":"stavros-tsioulis","email":"contact@stavrostsioulis.com"}],"description":"Import, export, and sync Accorudo contracts and OpenAPI specs.","homepage":"https://accorudo.stavrostsioulis.com","keywords":["typescript","api","openapi","cli","codegen","accorudo"],"repository":{"type":"git","url":"git+https://github.com/stavros-tsioulis/accorudo.git","directory":"packages/cli"},"author":{"name":"Stavros Tsioulis"},"bugs":{"url":"https://github.com/stavros-tsioulis/accorudo/issues"},"license":"MIT","readme":"# @accorudo/cli\n\nThe `accorudo` command line: scaffold, import, export, and sync [Accorudo](https://accorudo.stavrostsioulis.com) contract bundles against OpenAPI specs. It's a thin wrapper over `[@accorudo/openapi](../openapi)` — `import`/`export` call straight through to `parseOpenApi`/`generateContracts` and `extractBundle`/`emitOpenApi`; this package only adds argument parsing, config loading, and filesystem dry-run diffing.\n\n## Install\n\n```bash\npnpm add -D @accorudo/cli\n```\n\nRun via `pnpm exec` or add scripts to your `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"accorudo:import\": \"accorudo import openapi/main.yaml --out contracts/main\",\n    \"accorudo:export\": \"accorudo export contracts/main --out openapi/main.yaml\"\n  }\n}\n```\n\nRequires Node 22.18+ or 23.6+ (24+ recommended) — see [Config loading](#config-loading) for why.\n\n## Commands\n\n\n\n### `accorudo init`\n\nScaffolds `accorudo.config.ts`, an empty `contracts/main/`, and a placeholder `openapi/main.yaml`. Won't overwrite an existing `accorudo.config.ts`.\n\n### `accorudo import <spec> --out <dir>`\n\nGenerates a full contract bundle from an OpenAPI 3.x file — `api.ts`, `routes/<tag>.ts` per tag, `models/<tag or common>.ts`.\n\n\n| Flag                | Description                                                                             |\n| ------------------- | --------------------------------------------------------------------------------------- |\n| `-o, --out <dir>`   | Output directory (required)                                                             |\n| `-n, --name <name>` | Bundle name for the registry/`Api` type names (default: derived from spec `info.title`) |\n| `--only <tags>`     | Limit to comma-separated OpenAPI tags                                                   |\n| `--dry-run`         | Print the planned create/update/skip summary without writing                            |\n\n\nA file is skipped when the freshly generated content is byte-identical to what's already on disk, so hand-edited routes survive a re-import when the underlying OpenAPI operation hasn't changed. Generated code is a starting point, not a lock-in — see `@accorudo/openapi`['s known limitations](../openapi/README.md#known-limitations-of-parseopenapi--generatecontracts) (mechanical naming, model-file grouping, `allOf` flattening, etc.) before committing it as-is.\n\n### `accorudo export <contracts> [--out <file>]`\n\nGenerates an OpenAPI 3.1 spec from a contract bundle. `--out`'s extension (`.yaml`, `.yml`, or `.json`) picks the output format.\n\n\n| Flag               | Description                                                                    |\n| ------------------ | ------------------------------------------------------------------------------ |\n| `-o, --out <file>` | Output path — required unless `--dry-run`                                      |\n| `--title <title>`  | Override `info.title` in the generated spec                                    |\n| `--dry-run`        | Print the spec to stdout (yaml by default) instead of writing — pipe to `diff` |\n\n\n\n\n### `accorudo sync [bundle] [--reverse] [--dry-run]`\n\nRuns `import` (default) or `export` (`--reverse`) for one or all bundles listed in `accorudo.config.ts`.\n\n```bash\naccorudo sync                  # import every bundle (openapi -> contracts)\naccorudo sync main             # import just \"main\"\naccorudo sync main --reverse   # export \"main\" (contracts -> openapi)\n```\n\n\n\n## Configuration\n\n`defineConfig` is both a small runtime identity function and the type your `accorudo.config.ts` is checked against:\n\n```ts\nimport { defineConfig } from \"@accorudo/cli\";\n\nexport default defineConfig({\n  bundles: {\n    main: {\n      contracts: \"./contracts/main\",\n      openapi: \"./openapi/main.yaml\",\n    },\n  },\n});\n```\n\n\n\n### Config loading\n\n`accorudo.config.ts` is loaded with Node's built-in TypeScript support — no bundler, no `typescript` dependency at runtime. Two consequences worth knowing:\n\n- It needs Node 22.18+ or 23.6+ (stable/default-on there); older Node builds don't strip types without an explicit flag and will fail to load the config.\n- The file is only ever read for its erasable syntax (imports, type annotations, a function call) — enums, namespaces, and other constructs that need real transformation aren't supported inside it.\n\n\n\n## Development\n\n```bash\npnpm --filter @accorudo/cli test   # vitest\npnpm --filter @accorudo/cli build  # tsc -> dist/, then chmod +x dist/bin.js\n```\n\nCommand logic lives in `src/commands/*.ts` as plain functions (`runInit`, `runImport`, `runExport`, `runSync`) taking resolved option objects — `src/bin.ts` is only commander wiring on top, so tests call the command functions directly rather than spawning a subprocess.","readmeFilename":"README.md","_rev":"1-793b9c86e5845f6e1d24036659c934d6"}