@prisma-next/cli 0.3.0-dev.4 → 0.3.0-dev.5

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 (65) hide show
  1. package/dist/cli.d.ts +2 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/commands/contract-emit.d.ts +2 -4
  4. package/dist/commands/contract-emit.d.ts.map +1 -0
  5. package/dist/commands/db-init.d.ts +2 -4
  6. package/dist/commands/db-init.d.ts.map +1 -0
  7. package/dist/commands/db-introspect.d.ts +2 -4
  8. package/dist/commands/db-introspect.d.ts.map +1 -0
  9. package/dist/commands/db-schema-verify.d.ts +2 -4
  10. package/dist/commands/db-schema-verify.d.ts.map +1 -0
  11. package/dist/commands/db-sign.d.ts +2 -4
  12. package/dist/commands/db-sign.d.ts.map +1 -0
  13. package/dist/commands/db-verify.d.ts +2 -4
  14. package/dist/commands/db-verify.d.ts.map +1 -0
  15. package/dist/config-loader.d.ts +3 -5
  16. package/dist/config-loader.d.ts.map +1 -0
  17. package/dist/exports/config-types.d.ts +3 -0
  18. package/dist/exports/config-types.d.ts.map +1 -0
  19. package/dist/exports/config-types.js.map +1 -0
  20. package/dist/exports/index.d.ts +4 -0
  21. package/dist/exports/index.d.ts.map +1 -0
  22. package/dist/{index.js → exports/index.js} +3 -3
  23. package/dist/exports/index.js.map +1 -0
  24. package/dist/{index.d.ts → load-ts-contract.d.ts} +4 -8
  25. package/dist/load-ts-contract.d.ts.map +1 -0
  26. package/dist/utils/action.d.ts +16 -0
  27. package/dist/utils/action.d.ts.map +1 -0
  28. package/dist/utils/cli-errors.d.ts +7 -0
  29. package/dist/utils/cli-errors.d.ts.map +1 -0
  30. package/dist/utils/command-helpers.d.ts +12 -0
  31. package/dist/utils/command-helpers.d.ts.map +1 -0
  32. package/dist/utils/framework-components.d.ts +81 -0
  33. package/dist/utils/framework-components.d.ts.map +1 -0
  34. package/dist/utils/global-flags.d.ts +25 -0
  35. package/dist/utils/global-flags.d.ts.map +1 -0
  36. package/dist/utils/output.d.ts +142 -0
  37. package/dist/utils/output.d.ts.map +1 -0
  38. package/dist/utils/result-handler.d.ts +15 -0
  39. package/dist/utils/result-handler.d.ts.map +1 -0
  40. package/dist/utils/spinner.d.ts +29 -0
  41. package/dist/utils/spinner.d.ts.map +1 -0
  42. package/package.json +17 -16
  43. package/src/cli.ts +260 -0
  44. package/src/commands/contract-emit.ts +189 -0
  45. package/src/commands/db-init.ts +456 -0
  46. package/src/commands/db-introspect.ts +260 -0
  47. package/src/commands/db-schema-verify.ts +236 -0
  48. package/src/commands/db-sign.ts +277 -0
  49. package/src/commands/db-verify.ts +233 -0
  50. package/src/config-loader.ts +76 -0
  51. package/src/exports/config-types.ts +6 -0
  52. package/src/exports/index.ts +4 -0
  53. package/src/load-ts-contract.ts +217 -0
  54. package/src/utils/action.ts +43 -0
  55. package/src/utils/cli-errors.ts +26 -0
  56. package/src/utils/command-helpers.ts +26 -0
  57. package/src/utils/framework-components.ts +196 -0
  58. package/src/utils/global-flags.ts +75 -0
  59. package/src/utils/output.ts +1471 -0
  60. package/src/utils/result-handler.ts +44 -0
  61. package/src/utils/spinner.ts +67 -0
  62. package/dist/config-types.d.ts +0 -1
  63. package/dist/config-types.js.map +0 -1
  64. package/dist/index.js.map +0 -1
  65. /package/dist/{config-types.js → exports/config-types.js} +0 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createContractEmitCommand(): Command;
4
-
5
- export { createContractEmitCommand };
2
+ export declare function createContractEmitCommand(): Command;
3
+ //# sourceMappingURL=contract-emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-emit.d.ts","sourceRoot":"","sources":["../../src/commands/contract-emit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,yBAAyB,IAAI,OAAO,CA4JnD"}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createDbInitCommand(): Command;
4
-
5
- export { createDbInitCommand };
2
+ export declare function createDbInitCommand(): Command;
3
+ //# sourceMappingURL=db-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-init.d.ts","sourceRoot":"","sources":["../../src/commands/db-init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+CpC,wBAAgB,mBAAmB,IAAI,OAAO,CA+Y7C"}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createDbIntrospectCommand(): Command;
4
-
5
- export { createDbIntrospectCommand };
2
+ export declare function createDbIntrospectCommand(): Command;
3
+ //# sourceMappingURL=db-introspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-introspect.d.ts","sourceRoot":"","sources":["../../src/commands/db-introspect.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,wBAAgB,yBAAyB,IAAI,OAAO,CA2NnD"}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createDbSchemaVerifyCommand(): Command;
4
-
5
- export { createDbSchemaVerifyCommand };
2
+ export declare function createDbSchemaVerifyCommand(): Command;
3
+ //# sourceMappingURL=db-schema-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-schema-verify.d.ts","sourceRoot":"","sources":["../../src/commands/db-schema-verify.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCpC,wBAAgB,2BAA2B,IAAI,OAAO,CA8LrD"}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createDbSignCommand(): Command;
4
-
5
- export { createDbSignCommand };
2
+ export declare function createDbSignCommand(): Command;
3
+ //# sourceMappingURL=db-sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-sign.d.ts","sourceRoot":"","sources":["../../src/commands/db-sign.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,wBAAgB,mBAAmB,IAAI,OAAO,CAoO7C"}
@@ -1,5 +1,3 @@
1
1
  import { Command } from 'commander';
2
-
3
- declare function createDbVerifyCommand(): Command;
4
-
5
- export { createDbVerifyCommand };
2
+ export declare function createDbVerifyCommand(): Command;
3
+ //# sourceMappingURL=db-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-verify.d.ts","sourceRoot":"","sources":["../../src/commands/db-verify.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,wBAAgB,qBAAqB,IAAI,OAAO,CA4L/C"}
@@ -1,5 +1,4 @@
1
- import { PrismaNextConfig } from '@prisma-next/core-control-plane/config-types';
2
-
1
+ import type { PrismaNextConfig } from '@prisma-next/core-control-plane/config-types';
3
2
  /**
4
3
  * Loads the Prisma Next config from a TypeScript file.
5
4
  * Supports both default export and named export.
@@ -9,6 +8,5 @@ import { PrismaNextConfig } from '@prisma-next/core-control-plane/config-types';
9
8
  * @returns The loaded config object.
10
9
  * @throws Error if config file doesn't exist or is invalid.
11
10
  */
12
- declare function loadConfig(configPath?: string): Promise<PrismaNextConfig>;
13
-
14
- export { loadConfig };
11
+ export declare function loadConfig(configPath?: string): Promise<PrismaNextConfig>;
12
+ //# sourceMappingURL=config-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAKrF;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4D/E"}
@@ -0,0 +1,3 @@
1
+ export type { ContractConfig, PrismaNextConfig, } from '@prisma-next/core-control-plane/config-types';
2
+ export { defineConfig } from '@prisma-next/core-control-plane/config-types';
3
+ //# sourceMappingURL=config-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../src/exports/config-types.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/config-types.ts"],"sourcesContent":["// Re-export core-control-plane config types for convenience\nexport type {\n ContractConfig,\n PrismaNextConfig,\n} from '@prisma-next/core-control-plane/config-types';\nexport { defineConfig } from '@prisma-next/core-control-plane/config-types';\n"],"mappings":";AAKA,SAAS,oBAAoB;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { createContractEmitCommand } from '../commands/contract-emit';
2
+ export type { LoadTsContractOptions } from '../load-ts-contract';
3
+ export { loadContractFromTs } from '../load-ts-contract';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createContractEmitCommand
3
- } from "./chunk-464LNZCE.js";
4
- import "./chunk-BZMBKEEQ.js";
5
- import "./chunk-HWYQOCAJ.js";
3
+ } from "../chunk-464LNZCE.js";
4
+ import "../chunk-BZMBKEEQ.js";
5
+ import "../chunk-HWYQOCAJ.js";
6
6
 
7
7
  // src/load-ts-contract.ts
8
8
  import { existsSync, unlinkSync, writeFileSync } from "fs";
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/load-ts-contract.ts"],"sourcesContent":["import { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport type { ContractIR } from '@prisma-next/contract/ir';\nimport type { Plugin } from 'esbuild';\nimport { build } from 'esbuild';\n\nexport interface LoadTsContractOptions {\n readonly allowlist?: ReadonlyArray<string>;\n}\n\nconst DEFAULT_ALLOWLIST = ['@prisma-next/*'];\n\nfunction isAllowedImport(importPath: string, allowlist: ReadonlyArray<string>): boolean {\n for (const pattern of allowlist) {\n if (pattern.endsWith('/*')) {\n const prefix = pattern.slice(0, -2);\n if (importPath === prefix || importPath.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (importPath === pattern) {\n return true;\n }\n }\n return false;\n}\n\nfunction validatePurity(value: unknown): void {\n if (typeof value !== 'object' || value === null) {\n return;\n }\n\n const seen = new WeakSet();\n function check(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n return;\n }\n\n if (seen.has(value)) {\n throw new Error('Contract export contains circular references');\n }\n seen.add(value);\n\n for (const key in value) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor && (descriptor.get || descriptor.set)) {\n throw new Error(`Contract export contains getter/setter at key \"${key}\"`);\n }\n if (descriptor && typeof descriptor.value === 'function') {\n throw new Error(`Contract export contains function at key \"${key}\"`);\n }\n check((value as Record<string, unknown>)[key]);\n }\n }\n\n try {\n check(value);\n JSON.stringify(value);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('getter') || error.message.includes('circular')) {\n throw error;\n }\n throw new Error(`Contract export is not JSON-serializable: ${error.message}`);\n }\n throw new Error('Contract export is not JSON-serializable');\n }\n}\n\nfunction createImportAllowlistPlugin(allowlist: ReadonlyArray<string>, entryPath: string): Plugin {\n return {\n name: 'import-allowlist',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (args.kind === 'entry-point') {\n return undefined;\n }\n if (args.path.startsWith('.') || args.path.startsWith('/')) {\n return undefined;\n }\n const isFromEntryPoint = args.importer === entryPath || args.importer === '<stdin>';\n if (isFromEntryPoint && !isAllowedImport(args.path, allowlist)) {\n return {\n path: args.path,\n external: true,\n };\n }\n return undefined;\n });\n },\n };\n}\n\n/**\n * Loads a contract from a TypeScript file and returns it as ContractIR.\n *\n * **Responsibility: Parsing Only**\n * This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n * The contract should already be normalized if it was built using the contract builder.\n *\n * Normalization must happen in the contract builder when the contract is created.\n * This function only validates that the contract is JSON-serializable and returns it as-is.\n *\n * @param entryPath - Path to the TypeScript contract file\n * @param options - Optional configuration (import allowlist)\n * @returns The contract as ContractIR (should already be normalized)\n * @throws Error if the contract cannot be loaded or is not JSON-serializable\n */\nexport async function loadContractFromTs(\n entryPath: string,\n options?: LoadTsContractOptions,\n): Promise<ContractIR> {\n const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\n if (!existsSync(entryPath)) {\n throw new Error(`Contract file not found: ${entryPath}`);\n }\n\n const tempFile = join(\n tmpdir(),\n `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`,\n );\n\n try {\n const result = await build({\n entryPoints: [entryPath],\n bundle: true,\n format: 'esm',\n platform: 'node',\n target: 'es2022',\n outfile: tempFile,\n write: false,\n metafile: true,\n plugins: [createImportAllowlistPlugin(allowlist, entryPath)],\n logLevel: 'error',\n });\n\n if (result.errors.length > 0) {\n const errorMessages = result.errors.map((e: { text: string }) => e.text).join('\\n');\n throw new Error(`Failed to bundle contract file: ${errorMessages}`);\n }\n\n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated from bundling');\n }\n\n const disallowedImports: string[] = [];\n if (result.metafile) {\n const inputs = result.metafile.inputs;\n for (const [, inputData] of Object.entries(inputs)) {\n const imports =\n (inputData as { imports?: Array<{ path: string; external?: boolean }> }).imports || [];\n for (const imp of imports) {\n if (\n imp.external &&\n !imp.path.startsWith('.') &&\n !imp.path.startsWith('/') &&\n !isAllowedImport(imp.path, allowlist)\n ) {\n disallowedImports.push(imp.path);\n }\n }\n }\n }\n\n if (disallowedImports.length > 0) {\n throw new Error(\n `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(', ')}\\n Disallowed imports: ${disallowedImports.join(', ')}\\n\\nOnly @prisma-next/* packages are allowed in contract files.`,\n );\n }\n\n const bundleContent = result.outputFiles[0]?.text;\n if (bundleContent === undefined) {\n throw new Error('Bundle content is undefined');\n }\n writeFileSync(tempFile, bundleContent, 'utf-8');\n\n const module = (await import(`file://${tempFile}`)) as {\n default?: unknown;\n contract?: unknown;\n };\n unlinkSync(tempFile);\n\n let contract: unknown;\n\n if (module.default !== undefined) {\n contract = module.default;\n } else if (module.contract !== undefined) {\n contract = module.contract;\n } else {\n throw new Error(\n `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module as Record<string, unknown>).join(', ') || 'none'}`,\n );\n }\n\n if (typeof contract !== 'object' || contract === null) {\n throw new Error(`Contract export must be an object, got ${typeof contract}`);\n }\n\n validatePurity(contract);\n\n return contract as ContractIR;\n } catch (error) {\n try {\n if (tempFile) {\n unlinkSync(tempFile);\n }\n } catch {\n // Ignore cleanup errors\n }\n\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(`Failed to load contract from ${entryPath}: ${String(error)}`);\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY,YAAY,qBAAqB;AACtD,SAAS,cAAc;AACvB,SAAS,YAAY;AAGrB,SAAS,aAAa;AAMtB,IAAM,oBAAoB,CAAC,gBAAgB;AAE3C,SAAS,gBAAgB,YAAoB,WAA2C;AACtF,aAAW,WAAW,WAAW;AAC/B,QAAI,QAAQ,SAA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A0C,OAAO,QAAQ,EAAE;AAAA,IAC7E;AAEA,mBAAe,QAAQ;AAEvB,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAI;AACF,UAAI,UAAU;AACZ,mBAAW,QAAQ;AAAA,MACrB;AAAA,IACF,QAAQ;AAAA,IAER;AAEA,QAAI,iBAAiB,OAAO;AAC1B,YAAM;AAAA,IACR;AACA,UAAM,IAAI,MAAM,gCAAgC,SAAS,KAAK,OAAO,KAAK,CAAC,EAAE;AAAA,EAC/E;AACF;","names":["value","build"]}
@@ -1,8 +1,5 @@
1
- export { createContractEmitCommand } from './commands/contract-emit.js';
2
- import { ContractIR } from '@prisma-next/contract/ir';
3
- import 'commander';
4
-
5
- interface LoadTsContractOptions {
1
+ import type { ContractIR } from '@prisma-next/contract/ir';
2
+ export interface LoadTsContractOptions {
6
3
  readonly allowlist?: ReadonlyArray<string>;
7
4
  }
8
5
  /**
@@ -20,6 +17,5 @@ interface LoadTsContractOptions {
20
17
  * @returns The contract as ContractIR (should already be normalized)
21
18
  * @throws Error if the contract cannot be loaded or is not JSON-serializable
22
19
  */
23
- declare function loadContractFromTs(entryPath: string, options?: LoadTsContractOptions): Promise<ContractIR>;
24
-
25
- export { type LoadTsContractOptions, loadContractFromTs };
20
+ export declare function loadContractFromTs(entryPath: string, options?: LoadTsContractOptions): Promise<ContractIR>;
21
+ //# sourceMappingURL=load-ts-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-ts-contract.d.ts","sourceRoot":"","sources":["../src/load-ts-contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAI3D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C;AAoFD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAyGrB"}
@@ -0,0 +1,16 @@
1
+ import type { Result } from '@prisma-next/utils/result';
2
+ import { CliStructuredError } from './cli-errors';
3
+ export type CliResult<T> = Result<T, CliStructuredError>;
4
+ /**
5
+ * Performs an async action and catches structured errors, returning a Result.
6
+ * Only catches CliStructuredError instances - other errors are allowed to propagate (fail fast).
7
+ * If the function throws a CliStructuredError, it's caught and converted to a NotOk result.
8
+ */
9
+ export declare function performAction<T>(fn: () => Promise<T>): Promise<CliResult<T>>;
10
+ /**
11
+ * Wraps a synchronous function to catch structured errors and return a Result.
12
+ * Only catches CliStructuredError instances - other errors are allowed to propagate (fail fast).
13
+ * If the function throws a CliStructuredError, it's caught and converted to a NotOk result.
14
+ */
15
+ export declare function wrapSync<T>(fn: () => T): CliResult<T>;
16
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/utils/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAYlF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAYrD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Re-export all domain error factories from core-control-plane for convenience.
3
+ * CLI-specific errors (e.g., Commander.js argument validation) can be added here if needed.
4
+ */
5
+ export type { CliErrorConflict, CliErrorEnvelope } from '@prisma-next/core-control-plane/errors';
6
+ export { CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseUrlRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected, } from '@prisma-next/core-control-plane/errors';
7
+ //# sourceMappingURL=cli-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-errors.d.ts","sourceRoot":"","sources":["../../src/utils/cli-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,kCAAkC,EAClC,6BAA6B,EAC7B,wBAAwB,EACxB,mBAAmB,EACnB,gCAAgC,EAChC,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,YAAY,EACZ,gCAAgC,EAChC,mBAAmB,EACnB,eAAe,GAChB,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Sets both short and long descriptions for a command.
4
+ * The short description is used in command trees and headers.
5
+ * The long description is shown at the bottom of help output.
6
+ */
7
+ export declare function setCommandDescriptions(command: Command, shortDescription: string, longDescription?: string): Command;
8
+ /**
9
+ * Gets the long description from a command if it was set via setCommandDescriptions.
10
+ */
11
+ export declare function getLongDescription(command: Command): string | undefined;
12
+ //# sourceMappingURL=command-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/command-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,EACxB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEvE"}
@@ -0,0 +1,81 @@
1
+ import { type TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
2
+ import type { ContractIR } from '@prisma-next/contract/ir';
3
+ import type { ControlAdapterDescriptor, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlTargetDescriptor } from '@prisma-next/core-control-plane/types';
4
+ /**
5
+ * Asserts that all framework components are compatible with the expected family and target.
6
+ *
7
+ * This function validates that each component in the framework components array:
8
+ * - Has kind 'target', 'adapter', 'extension', or 'driver'
9
+ * - Has familyId matching expectedFamilyId
10
+ * - Has targetId matching expectedTargetId
11
+ *
12
+ * This validation happens at the CLI composition boundary, before passing components
13
+ * to typed planner/runner instances. It fills the gap between runtime validation
14
+ * (via `validateConfig()`) and compile-time type enforcement.
15
+ *
16
+ * @param expectedFamilyId - The expected family ID (e.g., 'sql')
17
+ * @param expectedTargetId - The expected target ID (e.g., 'postgres')
18
+ * @param frameworkComponents - Array of framework components to validate
19
+ * @returns The same array typed as TargetBoundComponentDescriptor
20
+ * @throws CliStructuredError if any component is incompatible
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const config = await loadConfig();
25
+ * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];
26
+ *
27
+ * // Validate and type-narrow components before passing to planner
28
+ * const typedComponents = assertFrameworkComponentsCompatible(
29
+ * config.family.familyId,
30
+ * config.target.targetId,
31
+ * frameworkComponents
32
+ * );
33
+ *
34
+ * const planner = target.migrations.createPlanner(familyInstance);
35
+ * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });
36
+ * ```
37
+ */
38
+ export declare function assertFrameworkComponentsCompatible<TFamilyId extends string, TTargetId extends string>(expectedFamilyId: TFamilyId, expectedTargetId: TTargetId, frameworkComponents: ReadonlyArray<unknown>): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
39
+ /**
40
+ * Validates that a contract is compatible with the configured family, target, adapter,
41
+ * and extension packs. Throws on family/target mismatches or missing extension packs.
42
+ *
43
+ * This check ensures the emitted contract matches the CLI config before running
44
+ * commands that depend on the contract (e.g., db verify, db sign).
45
+ *
46
+ * @param contract - The contract IR to validate (must include targetFamily, target, extensionPacks).
47
+ * @param family - The configured family descriptor.
48
+ * @param target - The configured target descriptor.
49
+ * @param adapter - The configured adapter descriptor.
50
+ * @param extensionPacks - Optional array of extension descriptors provided by the config.
51
+ *
52
+ * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target
53
+ * doesn't match the configured family/target.
54
+ * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires
55
+ * extension packs that are not provided in the config (includes all missing packs in error.meta).
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { assertContractRequirementsSatisfied } from './framework-components';
60
+ *
61
+ * const config = await loadConfig();
62
+ * const contractIR = await loadContractJson(config.contract.output);
63
+ *
64
+ * // Throws if contract is incompatible with config
65
+ * assertContractRequirementsSatisfied({
66
+ * contract: contractIR,
67
+ * family: config.family,
68
+ * target: config.target,
69
+ * adapter: config.adapter,
70
+ * extensionPacks: config.extensionPacks,
71
+ * });
72
+ * ```
73
+ */
74
+ export declare function assertContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({ contract, family, target, adapter, extensionPacks, }: {
75
+ readonly contract: Pick<ContractIR, 'targetFamily' | 'target' | 'extensionPacks'>;
76
+ readonly family: ControlFamilyDescriptor<TFamilyId>;
77
+ readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
78
+ readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
79
+ readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[] | undefined;
80
+ }): void;
81
+ //# sourceMappingURL=framework-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../../src/utils/framework-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,EAExB,gBAAgB,EAAE,SAAS,EAC3B,gBAAgB,EAAE,SAAS,EAC3B,mBAAmB,EAAE,aAAa,CAAC,OAAO,CAAC,GAC1C,aAAa,CAAC,8BAA8B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CA0DrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,EACxB,EACA,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,GAAG,QAAQ,GAAG,gBAAgB,CAAC,CAAC;IAClF,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACjE,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC;CACnG,GAAG,IAAI,CA+BP"}
@@ -0,0 +1,25 @@
1
+ export interface GlobalFlags {
2
+ readonly json?: 'object' | 'ndjson';
3
+ readonly quiet?: boolean;
4
+ readonly verbose?: number;
5
+ readonly timestamps?: boolean;
6
+ readonly color?: boolean;
7
+ }
8
+ export interface CliOptions {
9
+ readonly json?: string | boolean;
10
+ readonly quiet?: boolean;
11
+ readonly q?: boolean;
12
+ readonly verbose?: boolean;
13
+ readonly v?: boolean;
14
+ readonly vv?: boolean;
15
+ readonly trace?: boolean;
16
+ readonly timestamps?: boolean;
17
+ readonly color?: boolean;
18
+ readonly 'no-color'?: boolean;
19
+ }
20
+ /**
21
+ * Parses global flags from CLI options.
22
+ * Handles verbosity flags (-v, -vv, --trace), JSON output, quiet mode, timestamps, and color.
23
+ */
24
+ export declare function parseGlobalFlags(options: CliOptions): GlobalFlags;
25
+ //# sourceMappingURL=global-flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-flags.d.ts","sourceRoot":"","sources":["../../src/utils/global-flags.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,CAiDjE"}
@@ -0,0 +1,142 @@
1
+ import type { Command } from 'commander';
2
+ export interface EmitContractResult {
3
+ readonly coreHash: string;
4
+ readonly profileHash: string;
5
+ readonly outDir: string;
6
+ readonly files: {
7
+ readonly json: string;
8
+ readonly dts: string;
9
+ };
10
+ readonly timings: {
11
+ readonly total: number;
12
+ };
13
+ }
14
+ import type { CoreSchemaView } from '@prisma-next/core-control-plane/schema-view';
15
+ import type { IntrospectSchemaResult, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from '@prisma-next/core-control-plane/types';
16
+ import type { CliErrorEnvelope } from './cli-errors';
17
+ import type { GlobalFlags } from './global-flags';
18
+ /**
19
+ * Formats human-readable output for contract emit.
20
+ */
21
+ export declare function formatEmitOutput(result: EmitContractResult, flags: GlobalFlags): string;
22
+ /**
23
+ * Formats JSON output for contract emit.
24
+ */
25
+ export declare function formatEmitJson(result: EmitContractResult): string;
26
+ /**
27
+ * Formats error output for human-readable display.
28
+ */
29
+ export declare function formatErrorOutput(error: CliErrorEnvelope, flags: GlobalFlags): string;
30
+ /**
31
+ * Formats error output as JSON.
32
+ */
33
+ export declare function formatErrorJson(error: CliErrorEnvelope): string;
34
+ /**
35
+ * Formats human-readable output for database verify.
36
+ */
37
+ export declare function formatVerifyOutput(result: VerifyDatabaseResult, flags: GlobalFlags): string;
38
+ /**
39
+ * Formats JSON output for database verify.
40
+ */
41
+ export declare function formatVerifyJson(result: VerifyDatabaseResult): string;
42
+ /**
43
+ * Formats JSON output for database introspection.
44
+ */
45
+ export declare function formatIntrospectJson(result: IntrospectSchemaResult<unknown>): string;
46
+ /**
47
+ * Formats human-readable output for database introspection.
48
+ */
49
+ export declare function formatIntrospectOutput(result: IntrospectSchemaResult<unknown>, schemaView: CoreSchemaView | undefined, flags: GlobalFlags): string;
50
+ /**
51
+ * Formats human-readable output for database schema verification.
52
+ */
53
+ export declare function formatSchemaVerifyOutput(result: VerifyDatabaseSchemaResult, flags: GlobalFlags): string;
54
+ /**
55
+ * Formats JSON output for database schema verification.
56
+ */
57
+ export declare function formatSchemaVerifyJson(result: VerifyDatabaseSchemaResult): string;
58
+ /**
59
+ * Formats human-readable output for database sign.
60
+ */
61
+ export declare function formatSignOutput(result: SignDatabaseResult, flags: GlobalFlags): string;
62
+ /**
63
+ * Formats JSON output for database sign.
64
+ */
65
+ export declare function formatSignJson(result: SignDatabaseResult): string;
66
+ /**
67
+ * Result type for db init command.
68
+ */
69
+ export interface DbInitResult {
70
+ readonly ok: boolean;
71
+ readonly mode: 'plan' | 'apply';
72
+ readonly plan?: {
73
+ readonly targetId: string;
74
+ readonly destination: {
75
+ readonly coreHash: string;
76
+ readonly profileHash?: string;
77
+ };
78
+ readonly operations: readonly {
79
+ readonly id: string;
80
+ readonly label: string;
81
+ readonly operationClass: string;
82
+ }[];
83
+ };
84
+ readonly execution?: {
85
+ readonly operationsPlanned: number;
86
+ readonly operationsExecuted: number;
87
+ };
88
+ readonly marker?: {
89
+ readonly coreHash: string;
90
+ readonly profileHash?: string;
91
+ };
92
+ readonly summary: string;
93
+ readonly timings: {
94
+ readonly total: number;
95
+ };
96
+ }
97
+ /**
98
+ * Formats human-readable output for db init plan mode.
99
+ */
100
+ export declare function formatDbInitPlanOutput(result: DbInitResult, flags: GlobalFlags): string;
101
+ /**
102
+ * Formats human-readable output for db init apply mode.
103
+ */
104
+ export declare function formatDbInitApplyOutput(result: DbInitResult, flags: GlobalFlags): string;
105
+ /**
106
+ * Formats JSON output for db init command.
107
+ */
108
+ export declare function formatDbInitJson(result: DbInitResult): string;
109
+ /**
110
+ * Formats the header in the new experimental visual style.
111
+ * This header appears at the start of command output, showing the operation,
112
+ * intent, documentation link, and parameters.
113
+ */
114
+ export declare function formatStyledHeader(options: {
115
+ readonly command: string;
116
+ readonly description: string;
117
+ readonly url?: string;
118
+ readonly details: ReadonlyArray<{
119
+ readonly label: string;
120
+ readonly value: string;
121
+ }>;
122
+ readonly flags: GlobalFlags;
123
+ }): string;
124
+ /**
125
+ * Formats a success message in the styled output format.
126
+ */
127
+ export declare function formatSuccessMessage(flags: GlobalFlags): string;
128
+ /**
129
+ * Formats help output for a command using the styled format.
130
+ */
131
+ export declare function formatCommandHelp(options: {
132
+ readonly command: Command;
133
+ readonly flags: GlobalFlags;
134
+ }): string;
135
+ /**
136
+ * Formats help output for the root program using the styled format.
137
+ */
138
+ export declare function formatRootHelp(options: {
139
+ readonly program: Command;
140
+ readonly flags: GlobalFlags;
141
+ }): string;
142
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE;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AC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CA+CvF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CA+BxF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE7D;AAgPD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpF,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,GAAG,MAAM,CAsCT;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAI/D;AA8BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,GAAG,MAAM,CAyGT;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,GAAG,MAAM,CA2FT"}
@@ -0,0 +1,15 @@
1
+ import type { Result } from '@prisma-next/utils/result';
2
+ import type { CliStructuredError } from './cli-errors';
3
+ import type { GlobalFlags } from './global-flags';
4
+ /**
5
+ * Processes a CLI command result, handling both success and error cases.
6
+ * Formats output appropriately and returns the exit code.
7
+ * Never throws - returns exit code for commands to use with process.exit().
8
+ *
9
+ * @param result - The result from a CLI command
10
+ * @param flags - Global flags for output formatting
11
+ * @param onSuccess - Optional callback for successful results (for custom success output)
12
+ * @returns The exit code that should be used (0 for success, non-zero for errors)
13
+ */
14
+ export declare function handleResult<T>(result: Result<T, CliStructuredError>, flags: GlobalFlags, onSuccess?: (value: T) => void): number;
15
+ //# sourceMappingURL=result-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-handler.d.ts","sourceRoot":"","sources":["../../src/utils/result-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,kBAAkB,CAAC,EACrC,KAAK,EAAE,WAAW,EAClB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAC7B,MAAM,CAwBR"}
@@ -0,0 +1,29 @@
1
+ import type { GlobalFlags } from './global-flags';
2
+ /**
3
+ * Options for the withSpinner helper function.
4
+ */
5
+ interface WithSpinnerOptions {
6
+ /**
7
+ * The message to display in the spinner.
8
+ */
9
+ readonly message: string;
10
+ /**
11
+ * Global flags that control spinner behavior (quiet, json, color).
12
+ */
13
+ readonly flags: GlobalFlags;
14
+ }
15
+ /**
16
+ * Wraps an async operation with a spinner.
17
+ *
18
+ * The spinner respects:
19
+ * - `flags.quiet`: No spinner if quiet mode is enabled
20
+ * - `flags.json === 'object'`: No spinner if JSON output is enabled
21
+ * - Non-TTY environments: No spinner if stdout is not a TTY
22
+ *
23
+ * @param operation - The async operation to execute
24
+ * @param options - Spinner configuration options
25
+ * @returns The result of the operation
26
+ */
27
+ export declare function withSpinner<T>(operation: () => Promise<T>, options: WithSpinnerOptions): Promise<T>;
28
+ export {};
29
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/utils/spinner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAkCZ"}