@ir-kit/cli 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +81 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +42 -0
- package/dist/bin.js.map +1 -0
- package/dist/command-spec.d.ts +11 -0
- package/dist/command-spec.d.ts.map +1 -0
- package/dist/command-spec.js +2 -0
- package/dist/command-spec.js.map +1 -0
- package/dist/commands/_load-openapi.d.ts +7 -0
- package/dist/commands/_load-openapi.d.ts.map +1 -0
- package/dist/commands/_load-openapi.js +15 -0
- package/dist/commands/_load-openapi.js.map +1 -0
- package/dist/commands/docs.d.ts +10 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +55 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/fn-schema-diff.d.ts +10 -0
- package/dist/commands/fn-schema-diff.d.ts.map +1 -0
- package/dist/commands/fn-schema-diff.js +46 -0
- package/dist/commands/fn-schema-diff.js.map +1 -0
- package/dist/commands/fn-schema-extract.d.ts +25 -0
- package/dist/commands/fn-schema-extract.d.ts.map +1 -0
- package/dist/commands/fn-schema-extract.js +189 -0
- package/dist/commands/fn-schema-extract.js.map +1 -0
- package/dist/commands/fn-schema-inspect.d.ts +16 -0
- package/dist/commands/fn-schema-inspect.d.ts.map +1 -0
- package/dist/commands/fn-schema-inspect.js +118 -0
- package/dist/commands/fn-schema-inspect.js.map +1 -0
- package/dist/commands/fn-schema-scan.d.ts +13 -0
- package/dist/commands/fn-schema-scan.d.ts.map +1 -0
- package/dist/commands/fn-schema-scan.js +92 -0
- package/dist/commands/fn-schema-scan.js.map +1 -0
- package/dist/commands/k6-bundle.d.ts +10 -0
- package/dist/commands/k6-bundle.d.ts.map +1 -0
- package/dist/commands/k6-bundle.js +38 -0
- package/dist/commands/k6-bundle.js.map +1 -0
- package/dist/commands/k6-sync.d.ts +14 -0
- package/dist/commands/k6-sync.d.ts.map +1 -0
- package/dist/commands/k6-sync.js +61 -0
- package/dist/commands/k6-sync.js.map +1 -0
- package/dist/commands/recon.d.ts +13 -0
- package/dist/commands/recon.d.ts.map +1 -0
- package/dist/commands/recon.js +62 -0
- package/dist/commands/recon.js.map +1 -0
- package/dist/commands/sdk-all.d.ts +11 -0
- package/dist/commands/sdk-all.d.ts.map +1 -0
- package/dist/commands/sdk-all.js +82 -0
- package/dist/commands/sdk-all.js.map +1 -0
- package/dist/commands/sdk-go.d.ts +13 -0
- package/dist/commands/sdk-go.d.ts.map +1 -0
- package/dist/commands/sdk-go.js +53 -0
- package/dist/commands/sdk-go.js.map +1 -0
- package/dist/commands/sdk-k6.d.ts +11 -0
- package/dist/commands/sdk-k6.d.ts.map +1 -0
- package/dist/commands/sdk-k6.js +40 -0
- package/dist/commands/sdk-k6.js.map +1 -0
- package/dist/commands/sdk-kotlin.d.ts +13 -0
- package/dist/commands/sdk-kotlin.d.ts.map +1 -0
- package/dist/commands/sdk-kotlin.js +54 -0
- package/dist/commands/sdk-kotlin.js.map +1 -0
- package/dist/commands/sdk-swift.d.ts +12 -0
- package/dist/commands/sdk-swift.d.ts.map +1 -0
- package/dist/commands/sdk-swift.js +49 -0
- package/dist/commands/sdk-swift.js.map +1 -0
- package/dist/commands/sdk-typescript.d.ts +9 -0
- package/dist/commands/sdk-typescript.d.ts.map +1 -0
- package/dist/commands/sdk-typescript.js +29 -0
- package/dist/commands/sdk-typescript.js.map +1 -0
- package/dist/commands/spec-convert.d.ts +11 -0
- package/dist/commands/spec-convert.d.ts.map +1 -0
- package/dist/commands/spec-convert.js +69 -0
- package/dist/commands/spec-convert.js.map +1 -0
- package/dist/commands/spec-diff.d.ts +10 -0
- package/dist/commands/spec-diff.d.ts.map +1 -0
- package/dist/commands/spec-diff.js +53 -0
- package/dist/commands/spec-diff.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +78 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema-args.d.ts +24 -0
- package/dist/schema-args.d.ts.map +1 -0
- package/dist/schema-args.js +130 -0
- package/dist/schema-args.js.map +1 -0
- package/package.json +84 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ahmed Rowaihi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# `@ir-kit/cli`
|
|
2
|
+
|
|
3
|
+
The unified `ir` CLI — one entry point for every ir-kit operation across every supported API standard. Commands are JSON-Schema-defined; the runtime auto-derives flags, prompts, help, and validation from the schema.
|
|
4
|
+
|
|
5
|
+
Part of [ir-kit](https://github.com/ir-kit/ir-kit).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g @ir-kit/cli
|
|
11
|
+
# or run ad-hoc:
|
|
12
|
+
npx @ir-kit/cli <command>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
ir
|
|
19
|
+
├── spec
|
|
20
|
+
│ ├── convert Convert between OpenAPI 3 / AsyncAPI 3 / TypeSpec / Protobuf / Postman / JSON Schema
|
|
21
|
+
│ └── diff Cross-family diff with breaking / non-breaking classification
|
|
22
|
+
├── docs Render any spec as standalone HTML via Scalar API Reference
|
|
23
|
+
├── sdk
|
|
24
|
+
│ ├── go Generate a Go SDK
|
|
25
|
+
│ ├── kotlin Generate a Kotlin (OkHttp + coroutines) SDK
|
|
26
|
+
│ ├── swift Generate a Swift (URLSession + Codable) SDK
|
|
27
|
+
│ ├── typescript Generate a TypeScript SDK via @hey-api/openapi-ts
|
|
28
|
+
│ ├── k6 Generate a typed k6 load-test client
|
|
29
|
+
│ └── all Run every SDK generator in one pass
|
|
30
|
+
├── recon Reverse-engineer OpenAPI 3.1 from a HAR capture
|
|
31
|
+
├── fn-schema
|
|
32
|
+
│ ├── extract Extract JSON Schemas from TS function signatures
|
|
33
|
+
│ ├── scan Walk the project; report what extractors found
|
|
34
|
+
│ ├── inspect Resolve a single function/identifier and dump its schema
|
|
35
|
+
│ └── diff Compare two extracted bundles
|
|
36
|
+
└── k6
|
|
37
|
+
├── sync Regenerate a typed k6 client from an OpenAPI spec
|
|
38
|
+
└── bundle Bundle a k6 loadtest entry into a single .js file
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Every command supports `--help` for full flag detail.
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# Convert between any pair of supported formats — direct or graph-routed.
|
|
47
|
+
ir spec convert ./api.proto --to openapi3
|
|
48
|
+
ir spec convert ./collection.postman_collection.json --to typespec
|
|
49
|
+
|
|
50
|
+
# Standalone HTML docs from any input
|
|
51
|
+
ir docs ./api.yaml --out docs.html --theme moon
|
|
52
|
+
|
|
53
|
+
# Cross-family diff — breaking-change detection in CI
|
|
54
|
+
ir spec diff ./prod.yaml --after ./staging.proto --failOnBreaking
|
|
55
|
+
|
|
56
|
+
# Generate every native SDK in one shot
|
|
57
|
+
ir sdk all --input ./petstore.yaml --output ./sdks
|
|
58
|
+
|
|
59
|
+
# Sync a k6 client and bundle the loadtest
|
|
60
|
+
ir k6 sync && ir k6 bundle ./loadtest.ts --out dist/loadtest.js
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## How it works
|
|
64
|
+
|
|
65
|
+
Each command is a thin schema-driven wrapper around a programmatic `runX()` API exposed by the underlying engine package (`@ir-kit/spec-convert`, `@ir-kit/spec-docs`, `@ir-kit/spec-diff`, `@ir-kit/openapi-{go,kotlin,swift,typescript}`, `@ir-kit/k6-toolkit`, `@ir-kit/fn-schema-core`, `@ir-kit/openapi-recon`). All orchestration lives in those engines — the CLI exists to expose them under one entry point with consistent flag UX.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
// Every command follows the same shape:
|
|
69
|
+
export const myCommand: CommandSpec<Input, void> = {
|
|
70
|
+
path: ["spec", "convert"],
|
|
71
|
+
description: "...",
|
|
72
|
+
args: {
|
|
73
|
+
/* JSON Schema */
|
|
74
|
+
},
|
|
75
|
+
handler: async (input) => {
|
|
76
|
+
/* call the engine */
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Programmatic access: import the engine package directly, skip the CLI.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { docsCommand } from "./commands/docs.js";
|
|
3
|
+
import { fnSchemaDiffCommand } from "./commands/fn-schema-diff.js";
|
|
4
|
+
import { fnSchemaExtractCommand } from "./commands/fn-schema-extract.js";
|
|
5
|
+
import { fnSchemaInspectCommand } from "./commands/fn-schema-inspect.js";
|
|
6
|
+
import { fnSchemaScanCommand } from "./commands/fn-schema-scan.js";
|
|
7
|
+
import { k6BundleCommand } from "./commands/k6-bundle.js";
|
|
8
|
+
import { k6SyncCommand } from "./commands/k6-sync.js";
|
|
9
|
+
import { reconCommand } from "./commands/recon.js";
|
|
10
|
+
import { sdkAllCommand } from "./commands/sdk-all.js";
|
|
11
|
+
import { sdkGoCommand } from "./commands/sdk-go.js";
|
|
12
|
+
import { sdkK6Command } from "./commands/sdk-k6.js";
|
|
13
|
+
import { sdkKotlinCommand } from "./commands/sdk-kotlin.js";
|
|
14
|
+
import { sdkSwiftCommand } from "./commands/sdk-swift.js";
|
|
15
|
+
import { sdkTypescriptCommand } from "./commands/sdk-typescript.js";
|
|
16
|
+
import { specConvertCommand } from "./commands/spec-convert.js";
|
|
17
|
+
import { specDiffCommand } from "./commands/spec-diff.js";
|
|
18
|
+
import { runCli } from "./runtime.js";
|
|
19
|
+
await runCli({
|
|
20
|
+
name: "ir",
|
|
21
|
+
version: "0.1.0",
|
|
22
|
+
description: "Universal API toolkit — load, convert, generate across every spec standard.",
|
|
23
|
+
commands: [
|
|
24
|
+
specConvertCommand,
|
|
25
|
+
specDiffCommand,
|
|
26
|
+
docsCommand,
|
|
27
|
+
sdkGoCommand,
|
|
28
|
+
sdkKotlinCommand,
|
|
29
|
+
sdkSwiftCommand,
|
|
30
|
+
sdkTypescriptCommand,
|
|
31
|
+
sdkK6Command,
|
|
32
|
+
sdkAllCommand,
|
|
33
|
+
reconCommand,
|
|
34
|
+
fnSchemaExtractCommand,
|
|
35
|
+
fnSchemaScanCommand,
|
|
36
|
+
fnSchemaInspectCommand,
|
|
37
|
+
fnSchemaDiffCommand,
|
|
38
|
+
k6SyncCommand,
|
|
39
|
+
k6BundleCommand,
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,MAAM,CAAC;IACX,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,6EAA6E;IAC/E,QAAQ,EAAE;QACR,kBAAkB;QAClB,eAAe;QACf,WAAW;QACX,YAAY;QACZ,gBAAgB;QAChB,eAAe;QACf,oBAAoB;QACpB,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,sBAAsB;QACtB,mBAAmB;QACnB,sBAAsB;QACtB,mBAAmB;QACnB,aAAa;QACb,eAAe;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Schema } from "@ir-kit/schema";
|
|
2
|
+
export type OutputFormat = "none" | "json" | "yaml" | "table";
|
|
3
|
+
export interface CommandSpec<TInput, TOutput> {
|
|
4
|
+
path: ReadonlyArray<string>;
|
|
5
|
+
description: string;
|
|
6
|
+
args: Schema;
|
|
7
|
+
output?: Schema;
|
|
8
|
+
handler: (input: TInput) => Promise<TOutput>;
|
|
9
|
+
}
|
|
10
|
+
export type AnyCommandSpec = CommandSpec<any, any>;
|
|
11
|
+
//# sourceMappingURL=command-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-spec.d.ts","sourceRoot":"","sources":["../src/command-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,WAAW,CAAC,MAAM,EAAE,OAAO;IAC1C,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-spec.js","sourceRoot":"","sources":["../src/command-spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load any input (file path, URL, .tsp file, pre-parsed object) and
|
|
3
|
+
* return an OpenAPI document. Throws when the detected kind is
|
|
4
|
+
* incompatible with the calling SDK target.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadOpenAPIForSdk(input: string): Promise<Record<string, unknown>>;
|
|
7
|
+
//# sourceMappingURL=_load-openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_load-openapi.d.ts","sourceRoot":"","sources":["../../src/commands/_load-openapi.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CASlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { loadSpec } from "@ir-kit/spec-loader";
|
|
2
|
+
/**
|
|
3
|
+
* Load any input (file path, URL, .tsp file, pre-parsed object) and
|
|
4
|
+
* return an OpenAPI document. Throws when the detected kind is
|
|
5
|
+
* incompatible with the calling SDK target.
|
|
6
|
+
*/
|
|
7
|
+
export async function loadOpenAPIForSdk(input) {
|
|
8
|
+
const loaded = await loadSpec({ input });
|
|
9
|
+
if (loaded.kind !== "openapi") {
|
|
10
|
+
throw new Error(`SDK generation expects OpenAPI input; got ${loaded.kind}. ` +
|
|
11
|
+
`Convert first with: ir spec convert <input> --to openapi3`);
|
|
12
|
+
}
|
|
13
|
+
return loaded.document;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=_load-openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_load-openapi.js","sourceRoot":"","sources":["../../src/commands/_load-openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAa;IAEb,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,6CAA6C,MAAM,CAAC,IAAI,IAAI;YAC1D,2DAA2D,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAqCD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CAkBhD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { renderDocs } from "@ir-kit/spec-docs";
|
|
3
|
+
const themes = [
|
|
4
|
+
"default",
|
|
5
|
+
"alternate",
|
|
6
|
+
"moon",
|
|
7
|
+
"purple",
|
|
8
|
+
"solarized",
|
|
9
|
+
"bluePlanet",
|
|
10
|
+
"saturn",
|
|
11
|
+
"kepler",
|
|
12
|
+
"mars",
|
|
13
|
+
"deepSpace",
|
|
14
|
+
"none",
|
|
15
|
+
];
|
|
16
|
+
const args = {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
input: { type: "string", description: "Spec file path or URL" },
|
|
20
|
+
out: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Output HTML path (stdout if omitted)",
|
|
23
|
+
},
|
|
24
|
+
theme: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Scalar theme",
|
|
27
|
+
enum: themes,
|
|
28
|
+
},
|
|
29
|
+
from: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Source format (auto-detected if omitted)",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ["input"],
|
|
35
|
+
};
|
|
36
|
+
export const docsCommand = {
|
|
37
|
+
path: ["docs"],
|
|
38
|
+
description: "Render any spec as standalone HTML docs via Scalar (converts to OpenAPI 3 first)",
|
|
39
|
+
args,
|
|
40
|
+
handler: async (input) => {
|
|
41
|
+
const { html } = await renderDocs({
|
|
42
|
+
input: input.input,
|
|
43
|
+
from: input.from,
|
|
44
|
+
theme: input.theme,
|
|
45
|
+
});
|
|
46
|
+
if (input.out) {
|
|
47
|
+
await writeFile(input.out, html);
|
|
48
|
+
process.stdout.write(`Wrote ${input.out}\n`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
process.stdout.write(html);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAW/C,MAAM,MAAM,GAAG;IACb,SAAS;IACT,WAAW;IACX,MAAM;IACN,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,WAAW;IAC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5
|
+
json?: boolean;
|
|
6
|
+
breakingOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const fnSchemaDiffCommand: CommandSpec<Input, void>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=fn-schema-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fn-schema-diff.d.ts","sourceRoot":"","sources":["../../src/commands/fn-schema-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAsBD,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CA6BxD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { runDiff } from "@ir-kit/fn-schema-core";
|
|
2
|
+
import consola from "consola";
|
|
3
|
+
const args = {
|
|
4
|
+
type: "object",
|
|
5
|
+
properties: {
|
|
6
|
+
from: { type: "string", description: "Baseline bundle (JSON path)" },
|
|
7
|
+
to: { type: "string", description: "New bundle (JSON path)" },
|
|
8
|
+
json: {
|
|
9
|
+
type: "boolean",
|
|
10
|
+
description: "Emit machine-readable JSON",
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
breakingOnly: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
description: "Exit non-zero only when changes are breaking (removed signatures, changed input/output shape)",
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ["from", "to"],
|
|
20
|
+
};
|
|
21
|
+
export const fnSchemaDiffCommand = {
|
|
22
|
+
path: ["fn-schema", "diff"],
|
|
23
|
+
description: "Compare two fn-schema bundles. Reports added/removed/changed signatures and definitions",
|
|
24
|
+
args,
|
|
25
|
+
handler: async (input) => {
|
|
26
|
+
const out = await runDiff(input.from, input.to);
|
|
27
|
+
if (input.json) {
|
|
28
|
+
process.stdout.write(`${JSON.stringify(out, null, 2)}\n`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
for (const c of out.changes) {
|
|
32
|
+
const marker = c.kind === "added" ? "+" : c.kind === "removed" ? "-" : "~";
|
|
33
|
+
process.stdout.write(`${marker} ${c.id} (${c.kind})\n`);
|
|
34
|
+
}
|
|
35
|
+
for (const d of out.definitionChanges) {
|
|
36
|
+
const marker = d.kind === "added" ? "+" : d.kind === "removed" ? "-" : "~";
|
|
37
|
+
process.stdout.write(`${marker} def ${d.name} (${d.kind})\n`);
|
|
38
|
+
}
|
|
39
|
+
consola.box(`${out.changes.length} signature change(s), ${out.definitionChanges.length} definition change(s) — ${out.breaking} breaking, ${out.additive} additive`);
|
|
40
|
+
}
|
|
41
|
+
const fail = input.breakingOnly ? out.breaking > 0 : out.changes.length > 0;
|
|
42
|
+
if (fail)
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=fn-schema-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fn-schema-diff.js","sourceRoot":"","sources":["../../src/commands/fn-schema-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,OAAO,MAAM,SAAS,CAAC;AAW9B,MAAM,IAAI,GAAW;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;QACpE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QAC7D,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,4BAA4B;YACzC,OAAO,EA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C,CAAC,CAAC,GAAG,CAAC;gBAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,GAAG,CACT,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,yBAAyB,GAAG,CAAC,iBAAiB,CAAC,MAAM,2BAA2B,GAAG,CAAC,QAAQ,cAAc,GAAG,CAAC,QAAQ,WAAW,CACvJ,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5E,IAAI,IAAI;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CommandSpec } from "../command-spec.js";
|
|
2
|
+
interface Input {
|
|
3
|
+
patterns?: string;
|
|
4
|
+
out?: string;
|
|
5
|
+
bundle?: string;
|
|
6
|
+
bundleTypes?: boolean;
|
|
7
|
+
watch?: boolean;
|
|
8
|
+
openapi?: string;
|
|
9
|
+
tsconfig?: string;
|
|
10
|
+
includeTag?: string;
|
|
11
|
+
excludeName?: string;
|
|
12
|
+
params?: string;
|
|
13
|
+
unwrapPromise?: boolean;
|
|
14
|
+
naming?: string;
|
|
15
|
+
dialect?: string;
|
|
16
|
+
identity?: string;
|
|
17
|
+
transport?: string;
|
|
18
|
+
sourceLocations?: string;
|
|
19
|
+
pretty?: boolean;
|
|
20
|
+
quiet?: boolean;
|
|
21
|
+
cwd?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const fnSchemaExtractCommand: CommandSpec<Input, void>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=fn-schema-extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fn-schema-extract.d.ts","sourceRoot":"","sources":["../../src/commands/fn-schema-extract.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAqFD,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CAiF3D,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { runExtract, } from "@ir-kit/fn-schema-core";
|
|
3
|
+
import { typescript } from "@ir-kit/fn-schema-typescript";
|
|
4
|
+
import chokidar from "chokidar";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
const args = {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
patterns: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Glob pattern(s) for source files",
|
|
12
|
+
},
|
|
13
|
+
out: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Output directory (per-signature files)",
|
|
16
|
+
},
|
|
17
|
+
bundle: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Write a single bundled JSON file at this path",
|
|
20
|
+
},
|
|
21
|
+
bundleTypes: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
description: "When --bundle is set, also emit a sibling .ts wrapper",
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
type: "boolean",
|
|
28
|
+
description: "Re-extract on file change",
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
openapi: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Write OpenAPI 3.1 components-only document at this path",
|
|
34
|
+
},
|
|
35
|
+
tsconfig: { type: "string", description: "Path to tsconfig.json" },
|
|
36
|
+
includeTag: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Only include functions carrying this JSDoc tag",
|
|
39
|
+
},
|
|
40
|
+
excludeName: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Exclude functions whose name matches this regex",
|
|
43
|
+
},
|
|
44
|
+
params: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "Parameter rendering",
|
|
47
|
+
enum: ["array", "first-only", "object"],
|
|
48
|
+
},
|
|
49
|
+
unwrapPromise: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Unwrap Promise<T> in return types",
|
|
52
|
+
},
|
|
53
|
+
naming: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Naming strategy",
|
|
56
|
+
enum: ["function-name", "file-function", "jsdoc-tag"],
|
|
57
|
+
},
|
|
58
|
+
dialect: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description: "JSON Schema dialect",
|
|
61
|
+
enum: ["draft-07", "draft-2020-12", "openapi-3.1"],
|
|
62
|
+
},
|
|
63
|
+
identity: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Vendor keyword for originating TS type",
|
|
66
|
+
},
|
|
67
|
+
transport: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Vendor keyword for binary transport hints",
|
|
70
|
+
},
|
|
71
|
+
sourceLocations: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Vendor keyword for file:line:col source locations",
|
|
74
|
+
},
|
|
75
|
+
pretty: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Pretty-print JSON output",
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
80
|
+
quiet: {
|
|
81
|
+
type: "boolean",
|
|
82
|
+
description: "Suppress non-error logs",
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
cwd: { type: "string", description: "Working directory" },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const fnSchemaExtractCommand = {
|
|
89
|
+
path: ["fn-schema", "extract"],
|
|
90
|
+
description: "Extract JSON Schemas from TypeScript function signatures via ts-morph",
|
|
91
|
+
args,
|
|
92
|
+
handler: async (input) => {
|
|
93
|
+
if (input.quiet)
|
|
94
|
+
consola.level = 1;
|
|
95
|
+
const opts = mapInput(input);
|
|
96
|
+
const once = async () => {
|
|
97
|
+
consola.start("Extracting...");
|
|
98
|
+
const out = await runExtract(opts);
|
|
99
|
+
if (!out.ok) {
|
|
100
|
+
consola.warn("No files matched.");
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
for (const d of out.diagnostics) {
|
|
104
|
+
const msg = d.function ? `[${d.function}] ${d.message}` : d.message;
|
|
105
|
+
if (d.severity === "error")
|
|
106
|
+
consola.error(msg);
|
|
107
|
+
else if (d.severity === "warning")
|
|
108
|
+
consola.warn(msg);
|
|
109
|
+
else
|
|
110
|
+
consola.info(msg);
|
|
111
|
+
}
|
|
112
|
+
for (const w of out.written)
|
|
113
|
+
consola.success(`Wrote ${w}`);
|
|
114
|
+
consola.box(`Found ${out.result.signatures.length} signature(s) in ${out.durationMs}ms` +
|
|
115
|
+
(out.errors > 0 ? ` — ${out.errors} error(s)` : ""));
|
|
116
|
+
return out.errors;
|
|
117
|
+
};
|
|
118
|
+
if (!input.watch) {
|
|
119
|
+
const errors = await once();
|
|
120
|
+
if (errors > 0)
|
|
121
|
+
process.exitCode = 1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const cwd = path.resolve(input.cwd ?? process.cwd());
|
|
125
|
+
await once();
|
|
126
|
+
consola.info("Watching for changes...");
|
|
127
|
+
const patterns = typeof opts.patterns === "string"
|
|
128
|
+
? [opts.patterns]
|
|
129
|
+
: Array.isArray(opts.patterns)
|
|
130
|
+
? [...opts.patterns]
|
|
131
|
+
: [];
|
|
132
|
+
let pending = null;
|
|
133
|
+
let queued = false;
|
|
134
|
+
const trigger = () => {
|
|
135
|
+
if (pending) {
|
|
136
|
+
queued = true;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
pending = (async () => {
|
|
140
|
+
try {
|
|
141
|
+
return await once();
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
pending = null;
|
|
145
|
+
if (queued) {
|
|
146
|
+
queued = false;
|
|
147
|
+
trigger();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
void pending;
|
|
152
|
+
};
|
|
153
|
+
const watcher = chokidar.watch(patterns.length > 0 ? patterns : ["**/*.ts"], {
|
|
154
|
+
cwd,
|
|
155
|
+
ignoreInitial: true,
|
|
156
|
+
ignored: ["**/node_modules/**", "**/__fn_schema_virtual__/**"],
|
|
157
|
+
});
|
|
158
|
+
watcher.on("change", () => trigger());
|
|
159
|
+
watcher.on("add", () => trigger());
|
|
160
|
+
watcher.on("unlink", () => trigger());
|
|
161
|
+
process.on("SIGINT", () => {
|
|
162
|
+
void watcher.close();
|
|
163
|
+
process.exit(0);
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
function mapInput(input) {
|
|
168
|
+
return {
|
|
169
|
+
cwd: input.cwd,
|
|
170
|
+
patterns: input.patterns,
|
|
171
|
+
tsconfig: input.tsconfig,
|
|
172
|
+
includeTag: input.includeTag,
|
|
173
|
+
excludeName: input.excludeName,
|
|
174
|
+
params: input.params,
|
|
175
|
+
unwrapPromise: input.unwrapPromise,
|
|
176
|
+
naming: input.naming,
|
|
177
|
+
dialect: input.dialect,
|
|
178
|
+
identity: input.identity,
|
|
179
|
+
transport: input.transport,
|
|
180
|
+
sourceLocations: input.sourceLocations,
|
|
181
|
+
outDir: input.out,
|
|
182
|
+
bundlePath: input.bundle,
|
|
183
|
+
bundleTypes: input.bundleTypes,
|
|
184
|
+
openapiPath: input.openapi,
|
|
185
|
+
pretty: input.pretty,
|
|
186
|
+
extractors: [typescript()],
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=fn-schema-extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fn-schema-extract.js","sourceRoot":"","sources":["../../src/commands/fn-schema-extract.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAIL,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,OAAO,MAAM,SAAS,CAAC;AA0B9B,MAAM,IAAI,GAAW;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kCAAkC;SAChD;QACD,GAAG,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wCAAwC;SACtD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+CAA+C;SAC7D;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf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KAAK,CAAC,UAAU;QAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,MAAM,EAAE,KAAK,CAAC,MAA4B;QAC1C,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,MAAM,EAAE,KAAK,CAAC,MAA4B;QAC1C,OAAO,EAAE,KAAK,CAAC,OAA8B;QAC7C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,MAAM,EAAE,KAAK,CAAC,GAAG;QACjB,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,KAAK,CAAC,OAAO;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,CAAC,UAAU,EAAE,CAAC;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CommandSpec } from "../command-spec.js";
|
|
2
|
+
interface Input {
|
|
3
|
+
name: string;
|
|
4
|
+
patterns?: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
tsconfig?: string;
|
|
7
|
+
params?: string;
|
|
8
|
+
unwrapPromise?: boolean;
|
|
9
|
+
identity?: string;
|
|
10
|
+
transport?: string;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
quiet?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const fnSchemaInspectCommand: CommandSpec<Input, void>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=fn-schema-inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fn-schema-inspect.d.ts","sourceRoot":"","sources":["../../src/commands/fn-schema-inspect.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA2CD,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CA0D3D,CAAC"}
|