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.
Files changed (88) hide show
  1. package/dist/ai/tools.d.ts +1 -1
  2. package/dist/cli/compile.js +1 -1
  3. package/dist/cli/main.js +2 -2
  4. package/dist/cli/{capabilities.d.ts → model/capabilities.d.ts} +3 -3
  5. package/dist/cli/{command-id.js → model/command-id.js} +1 -1
  6. package/dist/cli/{command-model.d.ts → model/command-model.d.ts} +9 -8
  7. package/dist/cli/{command-model.js → model/command-model.js} +4 -4
  8. package/dist/cli/{naming.d.ts → model/naming.d.ts} +1 -1
  9. package/dist/cli/{naming.js → model/naming.js} +2 -2
  10. package/dist/cli/{schema.d.ts → model/schema.d.ts} +6 -5
  11. package/dist/cli/{auth-schemes.d.ts → parse/auth-schemes.d.ts} +1 -1
  12. package/dist/cli/{auth-schemes.js → parse/auth-schemes.js} +1 -1
  13. package/dist/cli/{operations.d.ts → parse/operations.d.ts} +1 -1
  14. package/dist/cli/{params.d.ts → parse/params.d.ts} +4 -3
  15. package/dist/cli/{params.js → parse/params.js} +1 -1
  16. package/dist/cli/{positional.d.ts → parse/positional.d.ts} +3 -3
  17. package/dist/cli/{request-body.d.ts → parse/request-body.d.ts} +3 -2
  18. package/dist/cli/{request-body.js → parse/request-body.js} +1 -1
  19. package/dist/cli/{server.d.ts → parse/servers.d.ts} +1 -1
  20. package/dist/cli/{server.test.js → parse/servers.test.js} +1 -1
  21. package/dist/cli/runtime/auth/resolve.d.ts +3 -2
  22. package/dist/cli/runtime/context.d.ts +9 -9
  23. package/dist/cli/runtime/context.js +9 -9
  24. package/dist/cli/runtime/execute.d.ts +7 -5
  25. package/dist/cli/runtime/execute.js +1 -1
  26. package/dist/cli/runtime/generated.d.ts +3 -3
  27. package/dist/cli/runtime/request.d.ts +4 -3
  28. package/dist/cli/runtime/server-url.d.ts +1 -1
  29. package/dist/cli/runtime/validate/coerce.d.ts +1 -1
  30. package/dist/cli/runtime/validate/schema.d.ts +2 -2
  31. package/dist/cli/{spec-id.d.ts → spec/id.d.ts} +1 -1
  32. package/dist/cli/{spec-id.js → spec/id.js} +1 -1
  33. package/dist/cli/{spec-loader.d.ts → spec/loader.d.ts} +1 -1
  34. package/dist/cli/{spec-loader.js → spec/loader.js} +4 -4
  35. package/package.json +1 -1
  36. package/dist/compiled.d.ts +0 -2
  37. package/dist/compiled.js +0 -21
  38. package/dist/macros/env.d.ts +0 -10
  39. package/dist/macros/env.js +0 -22
  40. package/dist/macros/spec.d.ts +0 -5
  41. package/dist/macros/spec.js +0 -16
  42. package/dist/macros/version.d.ts +0 -4
  43. package/dist/macros/version.js +0 -13
  44. /package/dist/cli/{crypto.d.ts → core/crypto.d.ts} +0 -0
  45. /package/dist/cli/{crypto.js → core/crypto.js} +0 -0
  46. /package/dist/cli/{pluralize.d.ts → core/pluralize.d.ts} +0 -0
  47. /package/dist/cli/{pluralize.js → core/pluralize.js} +0 -0
  48. /package/dist/cli/{stable-json.d.ts → core/stable-json.d.ts} +0 -0
  49. /package/dist/cli/{stable-json.js → core/stable-json.js} +0 -0
  50. /package/dist/cli/{strings.d.ts → core/strings.d.ts} +0 -0
  51. /package/dist/cli/{strings.js → core/strings.js} +0 -0
  52. /package/dist/cli/{types.d.ts → core/types.d.ts} +0 -0
  53. /package/dist/cli/{types.js → core/types.js} +0 -0
  54. /package/dist/cli/{capabilities.js → model/capabilities.js} +0 -0
  55. /package/dist/cli/{capabilities.test.d.ts → model/capabilities.test.d.ts} +0 -0
  56. /package/dist/cli/{capabilities.test.js → model/capabilities.test.js} +0 -0
  57. /package/dist/cli/{command-id.d.ts → model/command-id.d.ts} +0 -0
  58. /package/dist/cli/{command-id.test.d.ts → model/command-id.test.d.ts} +0 -0
  59. /package/dist/cli/{command-id.test.js → model/command-id.test.js} +0 -0
  60. /package/dist/cli/{command-index.d.ts → model/command-index.d.ts} +0 -0
  61. /package/dist/cli/{command-index.js → model/command-index.js} +0 -0
  62. /package/dist/cli/{command-model.test.d.ts → model/command-model.test.d.ts} +0 -0
  63. /package/dist/cli/{command-model.test.js → model/command-model.test.js} +0 -0
  64. /package/dist/cli/{naming.test.d.ts → model/naming.test.d.ts} +0 -0
  65. /package/dist/cli/{naming.test.js → model/naming.test.js} +0 -0
  66. /package/dist/cli/{schema.js → model/schema.js} +0 -0
  67. /package/dist/cli/{auth-requirements.d.ts → parse/auth-requirements.d.ts} +0 -0
  68. /package/dist/cli/{auth-requirements.js → parse/auth-requirements.js} +0 -0
  69. /package/dist/cli/{auth-requirements.test.d.ts → parse/auth-requirements.test.d.ts} +0 -0
  70. /package/dist/cli/{auth-requirements.test.js → parse/auth-requirements.test.js} +0 -0
  71. /package/dist/cli/{auth-schemes.test.d.ts → parse/auth-schemes.test.d.ts} +0 -0
  72. /package/dist/cli/{auth-schemes.test.js → parse/auth-schemes.test.js} +0 -0
  73. /package/dist/cli/{operations.js → parse/operations.js} +0 -0
  74. /package/dist/cli/{operations.test.d.ts → parse/operations.test.d.ts} +0 -0
  75. /package/dist/cli/{operations.test.js → parse/operations.test.js} +0 -0
  76. /package/dist/cli/{params.test.d.ts → parse/params.test.d.ts} +0 -0
  77. /package/dist/cli/{params.test.js → parse/params.test.js} +0 -0
  78. /package/dist/cli/{positional.js → parse/positional.js} +0 -0
  79. /package/dist/cli/{positional.test.d.ts → parse/positional.test.d.ts} +0 -0
  80. /package/dist/cli/{positional.test.js → parse/positional.test.js} +0 -0
  81. /package/dist/cli/{request-body.test.d.ts → parse/request-body.test.d.ts} +0 -0
  82. /package/dist/cli/{request-body.test.js → parse/request-body.test.js} +0 -0
  83. /package/dist/cli/{schema-shape.d.ts → parse/schema-shape.d.ts} +0 -0
  84. /package/dist/cli/{schema-shape.js → parse/schema-shape.js} +0 -0
  85. /package/dist/cli/{server.js → parse/servers.js} +0 -0
  86. /package/dist/cli/{server.test.d.ts → parse/servers.test.d.ts} +0 -0
  87. /package/dist/cli/{derive-name.d.ts → spec/derive-name.d.ts} +0 -0
  88. /package/dist/cli/{derive-name.js → spec/derive-name.js} +0 -0
@@ -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
  }[];
@@ -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 { AuthScheme, AuthSchemeKind } from "./auth-schemes.js";
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,4 +1,4 @@
1
- import { kebabCase } from "./strings.js";
1
+ import { kebabCase } from "../core/strings.js";
2
2
  export function buildCommandId(parts) {
3
3
  // operationKey is the ultimate disambiguator, but we keep the id readable.
4
4
  // Example:
@@ -1,9 +1,10 @@
1
- import type { AuthSummary } from "./auth-requirements.js";
2
- import type { AuthScheme } from "./auth-schemes.js";
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: Array<import("./positional.js").PositionalArg>;
21
- flags: Array<Pick<import("./params.js").ParamSpec, "in" | "name" | "flag" | "required" | "description" | "type" | "format" | "enum" | "itemType" | "itemFormat" | "itemEnum">>;
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?: import("./types.js").JsonSchema;
26
+ requestBodySchema?: JsonSchema;
26
27
  };
27
28
  export type CommandResource = {
28
29
  resource: string;
@@ -1,8 +1,8 @@
1
- import { summarizeAuth } from "./auth-requirements.js";
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,4 +1,4 @@
1
- import type { NormalizedOperation } from "./types.js";
1
+ import type { NormalizedOperation } from "../core/types.js";
2
2
  export type PlannedOperation = NormalizedOperation & {
3
3
  resource: string;
4
4
  action: string;
@@ -1,5 +1,5 @@
1
- import { pluralize } from "./pluralize.js";
2
- import { kebabCase } from "./strings.js";
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 { AuthScheme } from "./auth-schemes.js";
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?: import("./command-index.js").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: import("./command-index.js").CommandsIndex | undefined, capabilities: Capabilities): SchemaOutput;
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,4 +1,4 @@
1
- import type { OpenApiDoc } from "./types.js";
1
+ import type { OpenApiDoc } from "../core/types.js";
2
2
  export type AuthSchemeKind = "http-bearer" | "http-basic" | "api-key" | "oauth2" | "openIdConnect" | "unknown";
3
3
  export type AuthScheme = {
4
4
  key: string;
@@ -1,4 +1,4 @@
1
- import { kebabCase } from "./strings.js";
1
+ import { kebabCase } from "../core/strings.js";
2
2
  function parseOAuthFlow(flow) {
3
3
  if (!flow)
4
4
  return undefined;
@@ -1,2 +1,2 @@
1
- import type { NormalizedOperation, OpenApiDoc } from "./types.js";
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 "./types.js";
2
- export type ParamType = import("./schema-shape.js").ParamType;
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?: import("./types.js").JsonSchema;
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: import("./schema-shape.js").ParamType;
10
+ type: ParamType;
11
11
  format?: string;
12
12
  enum?: string[];
13
13
  };
14
14
  export type FlagsIndex = {
15
- flags: Array<Pick<import("./params.js").ParamSpec, "in" | "name" | "flag" | "required" | "description" | "type" | "format" | "enum" | "itemType" | "itemFormat" | "itemEnum">>;
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 "./types.js";
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: import("./schema-shape.js").ParamType;
6
+ schemaType: ParamType;
6
7
  schemaFormat?: string;
7
8
  schemaEnum?: string[];
8
9
  };
@@ -1,5 +1,5 @@
1
+ import { isJsonSchema } from "../core/types.js";
1
2
  import { getSchemaEnumStrings, getSchemaFormat, getSchemaType, } from "./schema-shape.js";
2
- import { isJsonSchema } from "./types.js";
3
3
  function getRequestBody(op) {
4
4
  return op.requestBody;
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { OpenApiDoc } from "./types.js";
1
+ import type { OpenApiDoc } from "../core/types.js";
2
2
  export type ServerVariable = {
3
3
  name: string;
4
4
  default?: string;
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { listServers } from "./server.js";
2
+ import { listServers } from "./servers.js";
3
3
  describe("listServers", () => {
4
4
  test("extracts server variables from template", () => {
5
5
  const doc = {
@@ -1,8 +1,9 @@
1
- import type { AuthScheme } from "../../auth-schemes.js";
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: import("../../auth-requirements.js").AuthSummary, inputs: AuthInputs): string | undefined;
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("../server.js").ServerInfo[];
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 { listAuthSchemes } from "../auth-schemes.js";
2
- import { deriveCapabilities } from "../capabilities.js";
3
- import { buildCommandsIndex } from "../command-index.js";
4
- import { buildCommandModel } from "../command-model.js";
5
- import { planOperations } from "../naming.js";
6
- import { indexOperations } from "../operations.js";
7
- import { buildSchemaOutput } from "../schema.js";
8
- import { listServers } from "../server.js";
9
- import { loadSpec } from "../spec-loader.js";
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: import("./request.js").RuntimeGlobals;
9
- servers: import("../server.js").ServerInfo[];
10
- authSchemes: import("../auth-schemes.js").AuthScheme[];
10
+ globals: RuntimeGlobals;
11
+ servers: ServerInfo[];
12
+ authSchemes: AuthScheme[];
11
13
  specId: string;
12
14
  embeddedDefaults?: EmbeddedDefaults;
13
15
  bodyFlagDefs?: BodyFlagDef[];
@@ -1,4 +1,4 @@
1
- import { buildRequest } from "./request.js";
1
+ import { buildRequest, } from "./request.js";
2
2
  /**
3
3
  * Format an error message with a help hint.
4
4
  */
@@ -1,7 +1,7 @@
1
1
  import { Command } from "commander";
2
- import type { AuthScheme } from "../auth-schemes.js";
3
- import type { CommandModel } from "../command-model.js";
4
- import type { ServerInfo } from "../server.js";
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 { AuthScheme } from "../auth-schemes.js";
2
- 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";
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: import("../server.js").ServerInfo[];
28
+ servers: ServerInfo[];
28
29
  authSchemes: AuthScheme[];
29
30
  embeddedDefaults?: EmbeddedDefaults;
30
31
  bodyFlagDefs?: import("./body-flags.js").BodyFlagDef[];
@@ -1,4 +1,4 @@
1
- import type { ServerInfo } from "../server.js";
1
+ import type { ServerInfo } from "../parse/servers.js";
2
2
  export type ResolveServerInput = {
3
3
  serverOverride?: string;
4
4
  servers: ServerInfo[];
@@ -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 { CommandAction } from "../../command-model.js";
2
- import type { JsonSchema } from "../../types.js";
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 "./types.js";
1
+ import type { LoadedSpec } from "../core/types.js";
2
2
  export declare function getSpecId(loaded: Pick<LoadedSpec, "doc" | "fingerprint">): string;
@@ -1,4 +1,4 @@
1
- import { kebabCase } from "./strings.js";
1
+ import { kebabCase } from "../core/strings.js";
2
2
  export function getSpecId(loaded) {
3
3
  const title = loaded.doc.info?.title;
4
4
  const fromTitle = title ? kebabCase(title) : "";
@@ -1,4 +1,4 @@
1
- import type { LoadedSpec } from "./types.js";
1
+ import type { LoadedSpec } from "../core/types.js";
2
2
  export type LoadSpecOptions = {
3
3
  spec?: string;
4
4
  embeddedSpecText?: string;
@@ -1,8 +1,8 @@
1
1
  import SwaggerParser from "@apidevtools/swagger-parser";
2
- import { sha256Hex } from "./crypto.js";
3
- import { parseYamlContent } from "./runtime/compat.js";
4
- import { getSpecId } from "./spec-id.js";
5
- import { stableStringify } from "./stable-json.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specli",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
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
- });
@@ -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;
@@ -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
- }
@@ -1,5 +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 declare function loadSpec(spec: string): Promise<string>;
@@ -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
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Bun macro: reads the version from package.json at bundle-time.
3
- */
4
- export declare function version(): string;
@@ -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