specli 0.0.20 → 0.0.21
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/dist/ai/tools.d.ts +1 -1
- package/dist/cli/compile.js +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/{capabilities.d.ts → model/capabilities.d.ts} +3 -3
- package/dist/cli/{command-id.js → model/command-id.js} +1 -1
- package/dist/cli/{command-model.d.ts → model/command-model.d.ts} +9 -8
- package/dist/cli/{command-model.js → model/command-model.js} +4 -4
- package/dist/cli/{naming.d.ts → model/naming.d.ts} +1 -1
- package/dist/cli/{naming.js → model/naming.js} +2 -2
- package/dist/cli/{schema.d.ts → model/schema.d.ts} +6 -5
- package/dist/cli/{auth-schemes.d.ts → parse/auth-schemes.d.ts} +1 -1
- package/dist/cli/{auth-schemes.js → parse/auth-schemes.js} +1 -1
- package/dist/cli/{operations.d.ts → parse/operations.d.ts} +1 -1
- package/dist/cli/{params.d.ts → parse/params.d.ts} +4 -3
- package/dist/cli/{params.js → parse/params.js} +1 -1
- package/dist/cli/{positional.d.ts → parse/positional.d.ts} +3 -3
- package/dist/cli/{request-body.d.ts → parse/request-body.d.ts} +3 -2
- package/dist/cli/{request-body.js → parse/request-body.js} +1 -1
- package/dist/cli/{server.d.ts → parse/servers.d.ts} +1 -1
- package/dist/cli/{server.test.js → parse/servers.test.js} +1 -1
- package/dist/cli/runtime/auth/resolve.d.ts +3 -2
- package/dist/cli/runtime/context.d.ts +9 -9
- package/dist/cli/runtime/context.js +9 -9
- package/dist/cli/runtime/execute.d.ts +7 -5
- package/dist/cli/runtime/execute.js +1 -1
- package/dist/cli/runtime/generated.d.ts +3 -3
- package/dist/cli/runtime/request.d.ts +4 -3
- package/dist/cli/runtime/server-url.d.ts +1 -1
- package/dist/cli/runtime/validate/coerce.d.ts +1 -1
- package/dist/cli/runtime/validate/schema.d.ts +2 -2
- package/dist/cli/{spec-id.d.ts → spec/id.d.ts} +1 -1
- package/dist/cli/{spec-id.js → spec/id.js} +1 -1
- package/dist/cli/{spec-loader.d.ts → spec/loader.d.ts} +1 -1
- package/dist/cli/{spec-loader.js → spec/loader.js} +4 -4
- package/package.json +1 -1
- package/dist/compiled.d.ts +0 -2
- package/dist/compiled.js +0 -21
- package/dist/macros/env.d.ts +0 -10
- package/dist/macros/env.js +0 -22
- package/dist/macros/spec.d.ts +0 -5
- package/dist/macros/spec.js +0 -16
- package/dist/macros/version.d.ts +0 -4
- package/dist/macros/version.js +0 -13
- /package/dist/cli/{crypto.d.ts → core/crypto.d.ts} +0 -0
- /package/dist/cli/{crypto.js → core/crypto.js} +0 -0
- /package/dist/cli/{pluralize.d.ts → core/pluralize.d.ts} +0 -0
- /package/dist/cli/{pluralize.js → core/pluralize.js} +0 -0
- /package/dist/cli/{stable-json.d.ts → core/stable-json.d.ts} +0 -0
- /package/dist/cli/{stable-json.js → core/stable-json.js} +0 -0
- /package/dist/cli/{strings.d.ts → core/strings.d.ts} +0 -0
- /package/dist/cli/{strings.js → core/strings.js} +0 -0
- /package/dist/cli/{types.d.ts → core/types.d.ts} +0 -0
- /package/dist/cli/{types.js → core/types.js} +0 -0
- /package/dist/cli/{capabilities.js → model/capabilities.js} +0 -0
- /package/dist/cli/{capabilities.test.d.ts → model/capabilities.test.d.ts} +0 -0
- /package/dist/cli/{capabilities.test.js → model/capabilities.test.js} +0 -0
- /package/dist/cli/{command-id.d.ts → model/command-id.d.ts} +0 -0
- /package/dist/cli/{command-id.test.d.ts → model/command-id.test.d.ts} +0 -0
- /package/dist/cli/{command-id.test.js → model/command-id.test.js} +0 -0
- /package/dist/cli/{command-index.d.ts → model/command-index.d.ts} +0 -0
- /package/dist/cli/{command-index.js → model/command-index.js} +0 -0
- /package/dist/cli/{command-model.test.d.ts → model/command-model.test.d.ts} +0 -0
- /package/dist/cli/{command-model.test.js → model/command-model.test.js} +0 -0
- /package/dist/cli/{naming.test.d.ts → model/naming.test.d.ts} +0 -0
- /package/dist/cli/{naming.test.js → model/naming.test.js} +0 -0
- /package/dist/cli/{schema.js → model/schema.js} +0 -0
- /package/dist/cli/{auth-requirements.d.ts → parse/auth-requirements.d.ts} +0 -0
- /package/dist/cli/{auth-requirements.js → parse/auth-requirements.js} +0 -0
- /package/dist/cli/{auth-requirements.test.d.ts → parse/auth-requirements.test.d.ts} +0 -0
- /package/dist/cli/{auth-requirements.test.js → parse/auth-requirements.test.js} +0 -0
- /package/dist/cli/{auth-schemes.test.d.ts → parse/auth-schemes.test.d.ts} +0 -0
- /package/dist/cli/{auth-schemes.test.js → parse/auth-schemes.test.js} +0 -0
- /package/dist/cli/{operations.js → parse/operations.js} +0 -0
- /package/dist/cli/{operations.test.d.ts → parse/operations.test.d.ts} +0 -0
- /package/dist/cli/{operations.test.js → parse/operations.test.js} +0 -0
- /package/dist/cli/{params.test.d.ts → parse/params.test.d.ts} +0 -0
- /package/dist/cli/{params.test.js → parse/params.test.js} +0 -0
- /package/dist/cli/{positional.js → parse/positional.js} +0 -0
- /package/dist/cli/{positional.test.d.ts → parse/positional.test.d.ts} +0 -0
- /package/dist/cli/{positional.test.js → parse/positional.test.js} +0 -0
- /package/dist/cli/{request-body.test.d.ts → parse/request-body.test.d.ts} +0 -0
- /package/dist/cli/{request-body.test.js → parse/request-body.test.js} +0 -0
- /package/dist/cli/{schema-shape.d.ts → parse/schema-shape.d.ts} +0 -0
- /package/dist/cli/{schema-shape.js → parse/schema-shape.js} +0 -0
- /package/dist/cli/{server.js → parse/servers.js} +0 -0
- /package/dist/cli/{server.test.d.ts → parse/servers.test.d.ts} +0 -0
- /package/dist/cli/{derive-name.d.ts → spec/derive-name.d.ts} +0 -0
- /package/dist/cli/{derive-name.js → spec/derive-name.js} +0 -0
package/dist/ai/tools.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare function specli(options: SpecliToolOptions): Promise<import("ai")
|
|
|
111
111
|
}[];
|
|
112
112
|
flags: {
|
|
113
113
|
name: string;
|
|
114
|
-
type: import("../cli/schema-shape.js").ParamType;
|
|
114
|
+
type: import("../cli/parse/schema-shape.js").ParamType;
|
|
115
115
|
required: boolean;
|
|
116
116
|
description: string | undefined;
|
|
117
117
|
}[];
|
package/dist/cli/compile.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { deriveBinaryName } from "./derive-name.js";
|
|
5
|
+
import { deriveBinaryName } from "./spec/derive-name.js";
|
|
6
6
|
// Resolve the package root directory (at runtime this file is at dist/cli/compile.js)
|
|
7
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
const packageRoot = path.resolve(__dirname, "../..");
|
package/dist/cli/main.js
CHANGED
|
@@ -19,13 +19,13 @@ function getPackageVersion() {
|
|
|
19
19
|
return "0.0.0";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
import { stableStringify } from "./core/stable-json.js";
|
|
23
|
+
import { toMinimalSchemaOutput } from "./model/schema.js";
|
|
22
24
|
import { readStdinText } from "./runtime/compat.js";
|
|
23
25
|
import { buildRuntimeContext } from "./runtime/context.js";
|
|
24
26
|
import { addGeneratedCommands } from "./runtime/generated.js";
|
|
25
27
|
import { deleteToken, getToken, setToken } from "./runtime/profile/secrets.js";
|
|
26
28
|
import { readProfiles, upsertProfile, writeProfiles, } from "./runtime/profile/store.js";
|
|
27
|
-
import { toMinimalSchemaOutput } from "./schema.js";
|
|
28
|
-
import { stableStringify } from "./stable-json.js";
|
|
29
29
|
export async function main(argv, options = {}) {
|
|
30
30
|
const program = new Command();
|
|
31
31
|
// Get version - use embedded version if available, otherwise read from package.json
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NormalizedOperation, OpenApiDoc } from "../core/types.js";
|
|
2
|
+
import type { AuthScheme, AuthSchemeKind } from "../parse/auth-schemes.js";
|
|
3
|
+
import type { ServerInfo } from "../parse/servers.js";
|
|
2
4
|
import type { CommandModel } from "./command-model.js";
|
|
3
|
-
import type { ServerInfo } from "./server.js";
|
|
4
|
-
import type { NormalizedOperation, OpenApiDoc } from "./types.js";
|
|
5
5
|
export type Capabilities = {
|
|
6
6
|
servers: {
|
|
7
7
|
count: number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
1
|
+
import type { JsonSchema, SecurityRequirement } from "../core/types.js";
|
|
2
|
+
import { type AuthSummary } from "../parse/auth-requirements.js";
|
|
3
|
+
import type { AuthScheme } from "../parse/auth-schemes.js";
|
|
4
|
+
import { type ParamSpec } from "../parse/params.js";
|
|
5
|
+
import { type PositionalArg } from "../parse/positional.js";
|
|
6
|
+
import { type RequestBodyInfo } from "../parse/request-body.js";
|
|
3
7
|
import type { PlannedOperation } from "./naming.js";
|
|
4
|
-
import type { ParamSpec } from "./params.js";
|
|
5
|
-
import type { RequestBodyInfo } from "./request-body.js";
|
|
6
|
-
import type { SecurityRequirement } from "./types.js";
|
|
7
8
|
export type CommandAction = {
|
|
8
9
|
id: string;
|
|
9
10
|
key: string;
|
|
@@ -17,12 +18,12 @@ export type CommandAction = {
|
|
|
17
18
|
description?: string;
|
|
18
19
|
deprecated?: boolean;
|
|
19
20
|
style: PlannedOperation["style"];
|
|
20
|
-
positionals:
|
|
21
|
-
flags: Array<Pick<
|
|
21
|
+
positionals: PositionalArg[];
|
|
22
|
+
flags: Array<Pick<ParamSpec, "in" | "name" | "flag" | "required" | "description" | "type" | "format" | "enum" | "itemType" | "itemFormat" | "itemEnum">>;
|
|
22
23
|
params: ParamSpec[];
|
|
23
24
|
auth: AuthSummary;
|
|
24
25
|
requestBody?: RequestBodyInfo;
|
|
25
|
-
requestBodySchema?:
|
|
26
|
+
requestBodySchema?: JsonSchema;
|
|
26
27
|
};
|
|
27
28
|
export type CommandResource = {
|
|
28
29
|
resource: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { summarizeAuth } from "
|
|
1
|
+
import { summarizeAuth } from "../parse/auth-requirements.js";
|
|
2
|
+
import { deriveParamSpecs } from "../parse/params.js";
|
|
3
|
+
import { deriveFlags, derivePositionals, } from "../parse/positional.js";
|
|
4
|
+
import { deriveRequestBodyInfo, } from "../parse/request-body.js";
|
|
2
5
|
import { buildCommandId } from "./command-id.js";
|
|
3
|
-
import { deriveParamSpecs } from "./params.js";
|
|
4
|
-
import { deriveFlags, derivePositionals } from "./positional.js";
|
|
5
|
-
import { deriveRequestBodyInfo } from "./request-body.js";
|
|
6
6
|
export function buildCommandModel(planned, options) {
|
|
7
7
|
const byResource = new Map();
|
|
8
8
|
for (const op of planned) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { pluralize } from "
|
|
2
|
-
import { kebabCase } from "
|
|
1
|
+
import { pluralize } from "../core/pluralize.js";
|
|
2
|
+
import { kebabCase } from "../core/strings.js";
|
|
3
3
|
const GENERIC_TAGS = new Set(["default", "defaults", "api"]);
|
|
4
4
|
function getPathSegments(path) {
|
|
5
5
|
return path
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoadedSpec, NormalizedOperation } from "../core/types.js";
|
|
2
|
+
import type { AuthScheme } from "../parse/auth-schemes.js";
|
|
3
|
+
import type { ServerInfo } from "../parse/servers.js";
|
|
2
4
|
import type { Capabilities } from "./capabilities.js";
|
|
5
|
+
import type { CommandsIndex } from "./command-index.js";
|
|
3
6
|
import type { CommandModel } from "./command-model.js";
|
|
4
7
|
import type { PlannedOperation } from "./naming.js";
|
|
5
|
-
import type { ServerInfo } from "./server.js";
|
|
6
|
-
import type { LoadedSpec, NormalizedOperation } from "./types.js";
|
|
7
8
|
export type SchemaOutput = {
|
|
8
9
|
schemaVersion: 1;
|
|
9
10
|
openapi: {
|
|
@@ -22,8 +23,8 @@ export type SchemaOutput = {
|
|
|
22
23
|
operations: NormalizedOperation[];
|
|
23
24
|
planned?: PlannedOperation[];
|
|
24
25
|
commands?: CommandModel;
|
|
25
|
-
commandsIndex?:
|
|
26
|
+
commandsIndex?: CommandsIndex;
|
|
26
27
|
};
|
|
27
28
|
export type MinimalSchemaOutput = Pick<SchemaOutput, "schemaVersion" | "openapi" | "spec" | "capabilities" | "commands">;
|
|
28
|
-
export declare function buildSchemaOutput(loaded: LoadedSpec, operations: NormalizedOperation[], planned: PlannedOperation[] | undefined, servers: ServerInfo[], authSchemes: AuthScheme[], commands: CommandModel | undefined, commandsIndex:
|
|
29
|
+
export declare function buildSchemaOutput(loaded: LoadedSpec, operations: NormalizedOperation[], planned: PlannedOperation[] | undefined, servers: ServerInfo[], authSchemes: AuthScheme[], commands: CommandModel | undefined, commandsIndex: CommandsIndex | undefined, capabilities: Capabilities): SchemaOutput;
|
|
29
30
|
export declare function toMinimalSchemaOutput(output: SchemaOutput): MinimalSchemaOutput;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { NormalizedOperation, OpenApiDoc } from "
|
|
1
|
+
import type { NormalizedOperation, OpenApiDoc } from "../core/types.js";
|
|
2
2
|
export declare function indexOperations(doc: OpenApiDoc): NormalizedOperation[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { NormalizedOperation, NormalizedParameter } from "
|
|
2
|
-
|
|
1
|
+
import type { JsonSchema, NormalizedOperation, NormalizedParameter } from "../core/types.js";
|
|
2
|
+
import { type ParamType } from "./schema-shape.js";
|
|
3
|
+
export type { ParamType };
|
|
3
4
|
export type ParamSpec = {
|
|
4
5
|
kind: "positional" | "flag";
|
|
5
6
|
in: NormalizedParameter["in"];
|
|
@@ -13,6 +14,6 @@ export type ParamSpec = {
|
|
|
13
14
|
itemType?: ParamType;
|
|
14
15
|
itemFormat?: string;
|
|
15
16
|
itemEnum?: string[];
|
|
16
|
-
schema?:
|
|
17
|
+
schema?: JsonSchema;
|
|
17
18
|
};
|
|
18
19
|
export declare function deriveParamSpecs(op: NormalizedOperation): ParamSpec[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { kebabCase } from "../core/strings.js";
|
|
1
2
|
import { getSchemaEnumStrings, getSchemaFormat, getSchemaType, } from "./schema-shape.js";
|
|
2
|
-
import { kebabCase } from "./strings.js";
|
|
3
3
|
export function deriveParamSpecs(op) {
|
|
4
4
|
const out = [];
|
|
5
5
|
for (const p of op.parameters) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParamSpec } from "./params.js";
|
|
1
|
+
import type { ParamSpec, ParamType } from "./params.js";
|
|
2
2
|
export type ActionShapeForCli = {
|
|
3
3
|
pathArgs: string[];
|
|
4
4
|
params: ParamSpec[];
|
|
@@ -7,12 +7,12 @@ export type PositionalArg = {
|
|
|
7
7
|
name: string;
|
|
8
8
|
required: boolean;
|
|
9
9
|
description?: string;
|
|
10
|
-
type:
|
|
10
|
+
type: ParamType;
|
|
11
11
|
format?: string;
|
|
12
12
|
enum?: string[];
|
|
13
13
|
};
|
|
14
14
|
export type FlagsIndex = {
|
|
15
|
-
flags: Array<Pick<
|
|
15
|
+
flags: Array<Pick<ParamSpec, "in" | "name" | "flag" | "required" | "description" | "type" | "format" | "enum" | "itemType" | "itemFormat" | "itemEnum">>;
|
|
16
16
|
};
|
|
17
17
|
export declare function derivePositionals(action: ActionShapeForCli): PositionalArg[];
|
|
18
18
|
export declare function deriveFlags(action: ActionShapeForCli): FlagsIndex;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { JsonSchema, NormalizedOperation } from "
|
|
1
|
+
import type { JsonSchema, NormalizedOperation } from "../core/types.js";
|
|
2
|
+
import { type ParamType } from "./schema-shape.js";
|
|
2
3
|
export type RequestBodyContent = {
|
|
3
4
|
contentType: string;
|
|
4
5
|
required: boolean;
|
|
5
|
-
schemaType:
|
|
6
|
+
schemaType: ParamType;
|
|
6
7
|
schemaFormat?: string;
|
|
7
8
|
schemaEnum?: string[];
|
|
8
9
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthSummary } from "../../parse/auth-requirements.js";
|
|
2
|
+
import type { AuthScheme } from "../../parse/auth-schemes.js";
|
|
2
3
|
export type AuthInputs = {
|
|
3
4
|
flagAuthScheme?: string;
|
|
4
5
|
profileAuthScheme?: string;
|
|
5
6
|
embeddedAuthScheme?: string;
|
|
6
7
|
hasStoredToken?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare function resolveAuthScheme(authSchemes: AuthScheme[], required:
|
|
9
|
+
export declare function resolveAuthScheme(authSchemes: AuthScheme[], required: AuthSummary, inputs: AuthInputs): string | undefined;
|
|
@@ -3,13 +3,13 @@ export type BuildRuntimeContextOptions = {
|
|
|
3
3
|
embeddedSpecText?: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function buildRuntimeContext(options: BuildRuntimeContextOptions): Promise<{
|
|
6
|
-
loaded: import("../types.js").LoadedSpec;
|
|
7
|
-
operations: import("../types.js").NormalizedOperation[];
|
|
8
|
-
servers: import("../
|
|
9
|
-
authSchemes: import("../auth-schemes.js").AuthScheme[];
|
|
10
|
-
planned: import("../naming.js").PlannedOperation[];
|
|
11
|
-
commands: import("../command-model.js").CommandModel;
|
|
12
|
-
commandsIndex: import("../command-index.js").CommandsIndex;
|
|
13
|
-
capabilities: import("../capabilities.js").Capabilities;
|
|
14
|
-
schema: import("../schema.js").SchemaOutput;
|
|
6
|
+
loaded: import("../core/types.js").LoadedSpec;
|
|
7
|
+
operations: import("../core/types.js").NormalizedOperation[];
|
|
8
|
+
servers: import("../parse/servers.js").ServerInfo[];
|
|
9
|
+
authSchemes: import("../parse/auth-schemes.js").AuthScheme[];
|
|
10
|
+
planned: import("../model/naming.js").PlannedOperation[];
|
|
11
|
+
commands: import("../model/command-model.js").CommandModel;
|
|
12
|
+
commandsIndex: import("../model/command-index.js").CommandsIndex;
|
|
13
|
+
capabilities: import("../model/capabilities.js").Capabilities;
|
|
14
|
+
schema: import("../model/schema.js").SchemaOutput;
|
|
15
15
|
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { listServers } from "../
|
|
9
|
-
import { loadSpec } from "../spec
|
|
1
|
+
import { deriveCapabilities } from "../model/capabilities.js";
|
|
2
|
+
import { buildCommandsIndex } from "../model/command-index.js";
|
|
3
|
+
import { buildCommandModel } from "../model/command-model.js";
|
|
4
|
+
import { planOperations } from "../model/naming.js";
|
|
5
|
+
import { buildSchemaOutput } from "../model/schema.js";
|
|
6
|
+
import { listAuthSchemes } from "../parse/auth-schemes.js";
|
|
7
|
+
import { indexOperations } from "../parse/operations.js";
|
|
8
|
+
import { listServers } from "../parse/servers.js";
|
|
9
|
+
import { loadSpec } from "../spec/loader.js";
|
|
10
10
|
export async function buildRuntimeContext(options) {
|
|
11
11
|
const loaded = await loadSpec({
|
|
12
12
|
spec: options.spec,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { CommandAction } from "../command-model.js";
|
|
1
|
+
import type { CommandAction } from "../model/command-model.js";
|
|
2
|
+
import type { AuthScheme } from "../parse/auth-schemes.js";
|
|
3
|
+
import type { ServerInfo } from "../parse/servers.js";
|
|
2
4
|
import type { BodyFlagDef } from "./body-flags.js";
|
|
3
|
-
import { type EmbeddedDefaults } from "./request.js";
|
|
5
|
+
import { type EmbeddedDefaults, type RuntimeGlobals } from "./request.js";
|
|
4
6
|
export type ExecuteInput = {
|
|
5
7
|
action: CommandAction;
|
|
6
8
|
positionalValues: string[];
|
|
7
9
|
flagValues: Record<string, unknown>;
|
|
8
|
-
globals:
|
|
9
|
-
servers:
|
|
10
|
-
authSchemes:
|
|
10
|
+
globals: RuntimeGlobals;
|
|
11
|
+
servers: ServerInfo[];
|
|
12
|
+
authSchemes: AuthScheme[];
|
|
11
13
|
specId: string;
|
|
12
14
|
embeddedDefaults?: EmbeddedDefaults;
|
|
13
15
|
bodyFlagDefs?: BodyFlagDef[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { ServerInfo } from "../
|
|
2
|
+
import type { CommandModel } from "../model/command-model.js";
|
|
3
|
+
import type { AuthScheme } from "../parse/auth-schemes.js";
|
|
4
|
+
import type { ServerInfo } from "../parse/servers.js";
|
|
5
5
|
import type { EmbeddedDefaults } from "./request.js";
|
|
6
6
|
export type GeneratedCliContext = {
|
|
7
7
|
servers: ServerInfo[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CommandAction } from "../model/command-model.js";
|
|
2
|
+
import type { AuthScheme } from "../parse/auth-schemes.js";
|
|
3
|
+
import type { ServerInfo } from "../parse/servers.js";
|
|
3
4
|
export type RuntimeGlobals = {
|
|
4
5
|
spec?: string;
|
|
5
6
|
server?: string;
|
|
@@ -24,7 +25,7 @@ export type BuildRequestInput = {
|
|
|
24
25
|
positionalValues: string[];
|
|
25
26
|
flagValues: Record<string, unknown>;
|
|
26
27
|
globals: RuntimeGlobals;
|
|
27
|
-
servers:
|
|
28
|
+
servers: ServerInfo[];
|
|
28
29
|
authSchemes: AuthScheme[];
|
|
29
30
|
embeddedDefaults?: EmbeddedDefaults;
|
|
30
31
|
bodyFlagDefs?: import("./body-flags.js").BodyFlagDef[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ParamType } from "../../schema-shape.js";
|
|
1
|
+
import type { ParamType } from "../../parse/schema-shape.js";
|
|
2
2
|
export declare function coerceValue(raw: string, type: ParamType): unknown;
|
|
3
3
|
export declare function coerceArrayInput(raw: string, itemType: ParamType): unknown[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { JsonSchema } from "../../core/types.js";
|
|
2
|
+
import type { CommandAction } from "../../model/command-model.js";
|
|
3
3
|
export type ValidationSchemas = {
|
|
4
4
|
querySchema?: JsonSchema;
|
|
5
5
|
headerSchema?: JsonSchema;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { LoadedSpec } from "
|
|
1
|
+
import type { LoadedSpec } from "../core/types.js";
|
|
2
2
|
export declare function getSpecId(loaded: Pick<LoadedSpec, "doc" | "fingerprint">): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
|
-
import { sha256Hex } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { sha256Hex } from "../core/crypto.js";
|
|
3
|
+
import { stableStringify } from "../core/stable-json.js";
|
|
4
|
+
import { parseYamlContent } from "../runtime/compat.js";
|
|
5
|
+
import { getSpecId } from "./id.js";
|
|
6
6
|
function isProbablyUrl(input) {
|
|
7
7
|
return /^https?:\/\//i.test(input);
|
|
8
8
|
}
|
package/package.json
CHANGED
package/dist/compiled.d.ts
DELETED
package/dist/compiled.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import { main } from "./cli/main.js";
|
|
3
|
-
import { env, envRequired } from "./macros/env.js" with { type: "macro" };
|
|
4
|
-
import { loadSpec } from "./macros/spec.js" with { type: "macro" };
|
|
5
|
-
import { version } from "./macros/version.js" with { type: "macro" };
|
|
6
|
-
// This entrypoint is intended to be compiled.
|
|
7
|
-
// All values are embedded via Bun macros at bundle-time.
|
|
8
|
-
const embeddedSpecText = await loadSpec(envRequired("SPECLI_SPEC"));
|
|
9
|
-
const cliName = env("SPECLI_NAME");
|
|
10
|
-
const server = env("SPECLI_SERVER");
|
|
11
|
-
const serverVars = env("SPECLI_SERVER_VARS");
|
|
12
|
-
const auth = env("SPECLI_AUTH");
|
|
13
|
-
const embeddedVersion = version();
|
|
14
|
-
await main(process.argv, {
|
|
15
|
-
embeddedSpecText,
|
|
16
|
-
cliName,
|
|
17
|
-
server,
|
|
18
|
-
serverVars: serverVars ? serverVars.split(",") : undefined,
|
|
19
|
-
auth,
|
|
20
|
-
version: embeddedVersion,
|
|
21
|
-
});
|
package/dist/macros/env.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bun macro: reads an environment variable at bundle-time.
|
|
3
|
-
* Returns undefined if the env var is not set.
|
|
4
|
-
*/
|
|
5
|
-
export declare function env(name: string): string | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Bun macro: reads a required environment variable at bundle-time.
|
|
8
|
-
* Throws if the env var is not set.
|
|
9
|
-
*/
|
|
10
|
-
export declare function envRequired(name: string): string;
|
package/dist/macros/env.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bun macro: reads an environment variable at bundle-time.
|
|
3
|
-
* Returns undefined if the env var is not set.
|
|
4
|
-
*/
|
|
5
|
-
export function env(name) {
|
|
6
|
-
if (!name)
|
|
7
|
-
throw new Error("env macro: missing variable name");
|
|
8
|
-
return process.env[name];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Bun macro: reads a required environment variable at bundle-time.
|
|
12
|
-
* Throws if the env var is not set.
|
|
13
|
-
*/
|
|
14
|
-
export function envRequired(name) {
|
|
15
|
-
if (!name)
|
|
16
|
-
throw new Error("envRequired macro: missing variable name");
|
|
17
|
-
const value = process.env[name];
|
|
18
|
-
if (value === undefined) {
|
|
19
|
-
throw new Error(`Missing required env var: ${name}`);
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
package/dist/macros/spec.d.ts
DELETED
package/dist/macros/spec.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bun macro: loads an OpenAPI spec from a URL or file path at bundle-time.
|
|
3
|
-
* The spec text is inlined into the bundle.
|
|
4
|
-
*/
|
|
5
|
-
export async function loadSpec(spec) {
|
|
6
|
-
if (!spec)
|
|
7
|
-
throw new Error("loadSpec macro: missing spec path/URL");
|
|
8
|
-
if (/^https?:\/\//i.test(spec)) {
|
|
9
|
-
const res = await fetch(spec);
|
|
10
|
-
if (!res.ok) {
|
|
11
|
-
throw new Error(`Failed to fetch spec: ${res.status} ${res.statusText}`);
|
|
12
|
-
}
|
|
13
|
-
return await res.text();
|
|
14
|
-
}
|
|
15
|
-
return await Bun.file(spec).text();
|
|
16
|
-
}
|
package/dist/macros/version.d.ts
DELETED
package/dist/macros/version.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
/**
|
|
5
|
-
* Bun macro: reads the version from package.json at bundle-time.
|
|
6
|
-
*/
|
|
7
|
-
export function version() {
|
|
8
|
-
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const packageJsonPath = join(currentDir, "../../package.json");
|
|
10
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
11
|
-
const packageJson = JSON.parse(content);
|
|
12
|
-
return packageJson.version;
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|