{"_id":"@ahmedrowaihi/fn-schema-cli","_rev":"3-688a1169185f26a3a191a468601458b3","name":"@ahmedrowaihi/fn-schema-cli","dist-tags":{"latest":"0.3.0"},"versions":{"0.2.0":{"name":"@ahmedrowaihi/fn-schema-cli","version":"0.2.0","keywords":["json-schema","function-signature","cli","codegen"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/fn-schema-cli@0.2.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/fn-schema/cli","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"bin":{"fn-schema":"dist/bin.js"},"dist":{"shasum":"5ed0a1bff8a2bd84604e5f8446f0d0ec16e7e7ac","tarball":"https://registry.npmjs.org/@ahmedrowaihi/fn-schema-cli/-/fn-schema-cli-0.2.0.tgz","fileCount":19,"integrity":"sha512-Giur9RgMRDbynapJb7EbkcDCgTe1+E9cp+mK9vYHbmwf8NXE5lvOrBM5stsKKkcqSjNBANHCpAf06p+ZWaiCCg==","signatures":[{"sig":"MEYCIQD+DoC/djBrxp4LxgtGt3BoEyEffq4e7lWSfUbb5vKe/QIhAJQDd/q9UhVJ3qKSL6oNDLq3wTr1gm2RN9Xz1HaiBgf4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2ffn-schema-cli@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":32911},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-fn-schema-cli-0.2.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/1f403f7946c8584dd6d10cc72922126c/ahmedrowaihi-fn-schema-cli-0.2.0.tgz","_integrity":"sha512-Giur9RgMRDbynapJb7EbkcDCgTe1+E9cp+mK9vYHbmwf8NXE5lvOrBM5stsKKkcqSjNBANHCpAf06p+ZWaiCCg==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/fn-schema/cli"},"_npmVersion":"10.8.2","description":"CLI wrapper for fn-schema. Thin orchestrator over @ahmedrowaihi/fn-schema-core with the TypeScript extractor pre-registered. Loads optional fn-schema.config.{ts,js,json} via c12.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"c12":"^3.3.4","citty":"^0.2.2","consola":"^3.4.2","chokidar":"^4.0.3","fast-glob":"^3.3.3","@ahmedrowaihi/fn-schema-core":"0.2.0","@ahmedrowaihi/fn-schema-typescript":"0.2.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@ahmedrowaihi/tsconfig":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fn-schema-cli_0.2.0_1777918212974_0.8374731926509138","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/fn-schema-cli. See https://github.com/ir-kit/ir-kit for migration."},"0.3.0":{"name":"@ahmedrowaihi/fn-schema-cli","version":"0.3.0","keywords":["json-schema","function-signature","cli","codegen"],"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","_id":"@ahmedrowaihi/fn-schema-cli@0.3.0","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/fn-schema/cli","bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"bin":{"fn-schema":"dist/bin.js"},"dist":{"shasum":"74f89535eb8ba4fcb19d128cdc8bfafa2c074e82","tarball":"https://registry.npmjs.org/@ahmedrowaihi/fn-schema-cli/-/fn-schema-cli-0.3.0.tgz","fileCount":43,"integrity":"sha512-tjkd3CUzom0xDwbPilHajdjYaLtnXFThfWeL+mEnHrxb72E1pdTsqkbX4II3L+h3R342Xq23g+AR7ZtdvdoJTw==","signatures":[{"sig":"MEUCIQD+kLeQmxUwscZV72quPL+CqZzDDN++d/c8s1g9SQ3W8wIgSujwHSio4RZnImDo7mARfAEL4BEimeLEFuOnUaTHybo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmedrowaihi%2ffn-schema-cli@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":96972},"main":"./dist/index.js","type":"module","_from":"file:ahmedrowaihi-fn-schema-cli-0.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"_resolved":"/tmp/dc0c7c1070f1f0ec9bc87304554ba62b/ahmedrowaihi-fn-schema-cli-0.3.0.tgz","_integrity":"sha512-tjkd3CUzom0xDwbPilHajdjYaLtnXFThfWeL+mEnHrxb72E1pdTsqkbX4II3L+h3R342Xq23g+AR7ZtdvdoJTw==","repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/fn-schema/cli"},"_npmVersion":"10.8.2","description":"CLI wrapper for fn-schema. Thin orchestrator over @ahmedrowaihi/fn-schema-core with the TypeScript extractor pre-registered. Loads optional fn-schema.config.{ts,js,json} via c12.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"c12":"^3.3.4","citty":"^0.2.2","consola":"^3.4.2","chokidar":"^4.0.3","fast-glob":"^3.3.3","@clack/prompts":"^1.3.0","@ahmedrowaihi/fn-schema-core":"0.3.0","@ahmedrowaihi/fn-schema-typescript":"0.2.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.0","@types/node":"^22","@ahmedrowaihi/tsconfig":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fn-schema-cli_0.3.0_1777978693882_0.6938951036056444","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ir-kit/fn-schema-cli. See https://github.com/ir-kit/ir-kit for migration."}},"time":{"created":"2026-05-04T18:10:12.865Z","modified":"2026-05-21T09:19:19.538Z","0.2.0":"2026-05-04T18:10:13.154Z","0.3.0":"2026-05-05T10:58:14.023Z"},"bugs":{"url":"https://github.com/ahmedrowaihi/contract-kit/issues"},"author":{"name":"Ahmed Rowaihi","email":"ahmedrowaihi@gmail.com"},"license":"MIT","homepage":"https://github.com/ahmedrowaihi/contract-kit/tree/main/packages/fn-schema/cli","keywords":["json-schema","function-signature","cli","codegen"],"repository":{"url":"git+https://github.com/ahmedrowaihi/contract-kit.git","type":"git","directory":"packages/fn-schema/cli"},"description":"CLI wrapper for fn-schema. Thin orchestrator over @ahmedrowaihi/fn-schema-core with the TypeScript extractor pre-registered. Loads optional fn-schema.config.{ts,js,json} via c12.","maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"readme":"# @ahmedrowaihi/fn-schema-cli\n\nCommand-line wrapper around the fn-schema extractor.\n\nThe CLI is a thin frontend over [`@ahmedrowaihi/fn-schema-typescript`](../typescript/README.md)'s `extract()` and [`@ahmedrowaihi/fn-schema-core`](../core/README.md)'s emitters. Every flag maps 1:1 to a programmatic option. Use whichever fits your build chain — the CLI for ad-hoc / package.json scripts, the programmatic API when you want to integrate with another tool.\n\n## Install\n\n```bash\npnpm add -D @ahmedrowaihi/fn-schema-cli\n# or: npm i -D @ahmedrowaihi/fn-schema-cli\n# or: yarn add -D @ahmedrowaihi/fn-schema-cli\n```\n\nThe bin is `fn-schema`. Run via `npx fn-schema ...`, or wire a `package.json` script:\n\n```jsonc\n{\n  \"scripts\": {\n    \"schemas\": \"fn-schema extract 'src/api/**/*.ts' --bundle generated/schemas.json --bundle-types --pretty\",\n  },\n}\n```\n\n## Quick start\n\n```bash\n# per-signature JSON files\nnpx fn-schema extract 'src/**/*.ts' --out generated --pretty\n\n# single bundled JSON\nnpx fn-schema extract 'src/**/*.ts' --bundle generated/schemas.json --pretty\n\n# bundle + typed TS wrapper for the loader package\nnpx fn-schema extract 'src/**/*.ts' --bundle generated/schemas.json --bundle-types --pretty\n\n# OpenAPI 3.1 components doc\nnpx fn-schema extract 'src/**/*.ts' --openapi generated/openapi.json --pretty\n```\n\n## Watch mode\n\n```bash\nnpx fn-schema extract 'src/api/**/*.ts' --bundle generated/schemas.json --bundle-types --watch\n```\n\nKeeps a warm `Project` between rebuilds, so changes after the first run land in tens of milliseconds.\n\n## Discovery & diff commands\n\n```bash\n# list every function the extractor would see (no schema generation)\nnpx fn-schema scan 'src/**/*.ts'\n\n# resolved input/output schema for a single function\nnpx fn-schema inspect createUser 'src/api/**/*.ts'\n\n# interactive picker — discover, multi-select, then print/bundle/files/openapi\nnpx fn-schema browse 'src/**/*.ts'\n\n# bundle-vs-bundle diff (CI-friendly: --breaking-only exits 1 only on removed/changed)\nnpx fn-schema diff old/schemas.json new/schemas.json --breaking-only\n```\n\n| Command   | Purpose                                                                                                     |\n| --------- | ----------------------------------------------------------------------------------------------------------- |\n| `scan`    | Read-only function listing — fast, no schemas. Pipe `--json` to other tools or eyeball filter regexes.      |\n| `inspect` | Resolved input/output for one function. Verify mappings without writing the bundle.                         |\n| `browse`  | Interactive (clack) picker. Pick functions, then choose an action: print, bundle, per-file, or OpenAPI doc. |\n| `diff`    | Compare two emitted bundles. `--breaking-only` for CI gates that fail only on removed or changed shapes.    |\n\n## Vendor-extension keywords\n\n```bash\nnpx fn-schema extract 'src/**/*.ts' --bundle generated/schemas.json \\\n  --identity x-fn-schema-ts \\\n  --transport x-fn-schema-transport \\\n  --source-locations x-fn-schema-source\n```\n\nEach takes a keyword name. Off by default. Pass `\"\"` or `false` to explicitly disable when a config file would otherwise enable it.\n\n| Flag                 | Attached to                 | Use                                    |\n| -------------------- | --------------------------- | -------------------------------------- |\n| `--identity`         | mapped + named-type schemas | nominal-type matching across functions |\n| `--transport`        | binary-shaped schemas       | frontend picks `multipart` vs `base64` |\n| `--source-locations` | named definitions           | navigation + drift detection           |\n\n## All flags\n\nRun `npx fn-schema --help` for the full list. Highlights:\n\n- `--out, -o <dir>` — per-signature files\n- `--bundle <path>` — single JSON bundle\n- `--bundle-types` — emit sibling `.ts` wrapper alongside `--bundle`\n- `--openapi <path>` — OpenAPI 3.1 components doc\n- `--watch` — regenerate on file change\n- `--tsconfig <path>` — override tsconfig (default: nearest from cwd)\n- `--include-tag <name>` — only fns with this JSDoc tag\n- `--exclude-name <regex>` — exclude fns matching name\n- `--params array|first-only|object` — parameter layout\n- `--naming function-name|file-function|jsdoc-tag` — id strategy\n- `--dialect draft-07|draft-2020-12|openapi-3.1`\n- `--pretty`, `--quiet`, `--cwd <dir>`\n\n## Config file\n\nOptional `fn-schema.config.{ts,js,json,mjs,cjs}` at the project root, loaded via [c12](https://github.com/unjs/c12):\n\n```ts\n// fn-schema.config.ts\nimport type { FnSchemaConfig } from \"@ahmedrowaihi/fn-schema-cli\";\n\nexport default {\n  files: \"src/api/**/*.ts\",\n  out: \"generated\",\n  signature: { parameters: \"first-only\" },\n  schema: {\n    identity: \"x-fn-schema-ts\",\n    typeMappers: { MyBrand: { type: \"string\", format: \"uuid\" } },\n  },\n} satisfies FnSchemaConfig;\n```\n\nCLI flags override config values. Both fall back to core defaults.\n\n## Doing it programmatically instead\n\nAnything the CLI does, you can do from a Node script:\n\n```ts\nimport { writeFile } from \"node:fs/promises\";\nimport { extract } from \"@ahmedrowaihi/fn-schema-typescript\";\nimport { emit } from \"@ahmedrowaihi/fn-schema-core\";\n\nconst result = await extract({\n  files: [\"src/api/**/*.ts\"],\n  signature: { parameters: \"first-only\" },\n  schema: { identity: \"x-fn-schema-ts\" },\n});\n\nawait writeFile(\n  \"generated/schemas.json\",\n  emit.toBundle(result, { pretty: true }),\n);\n```\n\nFor long-lived processes (servers, watchers), use [`createProject`](../core/README.md) instead of `extract` to keep the ts-morph project warm between calls.\n\n## Exit codes\n\n`0` on success. `1` when any error-severity diagnostic was emitted, or when no source patterns were supplied.\n","readmeFilename":"README.md"}