@kjanat/dreamcli 3.0.0-rc.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +271 -1
- package/README.md +30 -13
- package/dist/core/cli/dispatch.mjs +0 -11
- package/dist/core/cli/index.d.mts +133 -9
- package/dist/core/cli/index.mjs +119 -27
- package/dist/core/cli/planner.mjs +7 -1
- package/dist/core/cli/root-help.mjs +5 -0
- package/dist/core/cli/runtime-preflight.d.mts +4 -0
- package/dist/core/cli/runtime-preflight.mjs +5 -3
- package/dist/core/completion/shells/shared.mjs +1 -0
- package/dist/core/config/index.d.mts +43 -12
- package/dist/core/config/index.mjs +55 -16
- package/dist/core/config/package-json.d.mts +1 -0
- package/dist/core/errors/index.d.mts +2 -2
- package/dist/core/execution/index.mjs +13 -1
- package/dist/core/help/ansi.d.mts +11 -5
- package/dist/core/help/ansi.mjs +14 -16
- package/dist/core/help/index.d.mts +22 -0
- package/dist/core/help/index.mjs +75 -25
- package/dist/core/json-schema/index.d.mts +20 -8
- package/dist/core/json-schema/index.mjs +285 -87
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +40 -40
- package/dist/core/output/contracts.d.mts +5 -5
- package/dist/core/output/contracts.mjs +1 -1
- package/dist/core/output/index.d.mts +38 -1
- package/dist/core/output/index.mjs +37 -2
- package/dist/core/parse/index.mjs +9 -6
- package/dist/core/resolve/contracts.d.mts +7 -2
- package/dist/core/resolve/flags.d.mts +3 -1
- package/dist/core/resolve/flags.mjs +29 -12
- package/dist/core/resolve/index.mjs +6 -1
- package/dist/core/resolve/property.d.mts +1 -1
- package/dist/core/resolve/standard.d.mts +24 -0
- package/dist/core/resolve/standard.mjs +114 -0
- package/dist/core/schema/arg.d.mts +37 -2
- package/dist/core/schema/arg.mjs +5 -2
- package/dist/core/schema/command.d.mts +49 -7
- package/dist/core/schema/command.mjs +15 -5
- package/dist/core/schema/flag.d.mts +124 -19
- package/dist/core/schema/flag.mjs +7 -3
- package/dist/core/schema/index.d.mts +3 -2
- package/dist/core/schema/prompt.d.mts +1 -1
- package/dist/core/schema/run.d.mts +7 -0
- package/dist/core/schema/standard.d.mts +100 -0
- package/dist/core/schema/standard.mjs +15 -0
- package/dist/core/testkit/index.d.mts +7 -5
- package/dist/core/testkit/index.mjs +12 -7
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +5 -5
- package/dist/runtime/adapter.d.mts +33 -0
- package/dist/runtime/adapter.mjs +6 -1
- package/dist/runtime/deno.d.mts +4 -0
- package/dist/runtime/deno.mjs +4 -1
- package/dist/runtime/node.mjs +9 -1
- package/dist/version.mjs +2 -2
- package/dreamcli.schema.json +83 -1
- package/examples/basic.ts +2 -2
- package/examples/flag-types.ts +79 -0
- package/examples/gh/node_modules/typescript/LICENSE +55 -0
- package/examples/gh/node_modules/typescript/NOTICE.txt +436 -0
- package/examples/gh/node_modules/typescript/README.md +49 -0
- package/examples/gh/node_modules/typescript/bin/tsc +2 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts +529 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.js +1657 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts +39 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.js +211 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts +310 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts +109 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.js +109 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts +15 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js +74 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js +287 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts +32 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js +213 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts +76 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts +182 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js +835 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts +62 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js +122 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.js +298 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts +29 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts +4 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js +241 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js +30 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts +6 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js +61 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts +32 -0
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/options.js +11 -0
- package/examples/gh/node_modules/typescript/dist/api/options.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts +110 -0
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/path.js +508 -0
- package/examples/gh/node_modules/typescript/dist/api/path.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts +239 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.js +37 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts +79 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js +169 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts +529 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js +1665 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts +30 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js +124 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts +310 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts +114 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js +508 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts +175 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.js +149 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts +100 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts +1161 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js +4 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.js +7 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts +19 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js +596 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts +16 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.js +104 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts +520 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js +3057 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts +20 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.js +20 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts +35 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts +329 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js +1103 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.js +233 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts +11 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js +202 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts +97 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js +2230 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.js +67 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts +14 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts +50 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js +978 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js +47 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts +129 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js +132 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js +130 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts +28 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js +25 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js +25 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts +42 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js +19 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js +19 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js +8 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js +8 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts +36 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js +38 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js +38 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js +46 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js +46 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts +50 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js +52 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js +52 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts +16 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts +13 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts +15 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts +71 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js +73 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js +73 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts +389 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js +391 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js +391 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js +32 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js +32 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts +76 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js +78 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js +78 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.js +25 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.js.map +1 -0
- package/examples/gh/node_modules/typescript/lib/getExePath.d.ts +2 -0
- package/examples/gh/node_modules/typescript/lib/getExePath.js +70 -0
- package/examples/gh/node_modules/typescript/lib/tsc.js +28 -0
- package/examples/gh/node_modules/typescript/lib/version.cjs +3 -0
- package/examples/gh/node_modules/typescript/lib/version.d.cts +2 -0
- package/examples/gh/node_modules/typescript/package.json +87 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/License.txt +11 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/README.md +54 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.d.ts +17 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.js +83 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +22 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.js +210 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.d.ts +14 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.js +87 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +32 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.js +132 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.d.ts +367 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.js +1271 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +9 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.js +16 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +52 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.js +70 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.d.ts +39 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.js +135 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.d.ts +7 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.js +34 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +55 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.js +412 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +18 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +155 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +77 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.js +246 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +60 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.js +157 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.d.ts +369 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.js +436 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.d.ts +74 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.js +23 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +10 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.js +74 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +15 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +77 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.d.ts +58 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.js +289 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.d.ts +12 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.js +163 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/package.json +54 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/typings/thenable.d.ts +5 -0
- package/examples/gh/package.json +11 -5
- package/examples/gh/src/main.ts +10 -4
- package/examples/help-config.ts +43 -0
- package/examples/json-mode.ts +8 -4
- package/examples/middleware.ts +1 -1
- package/examples/output-extras.ts +46 -0
- package/examples/parser-control.ts +40 -0
- package/examples/pwsh-demo/package.json +1 -1
- package/examples/pwsh-demo/src/main.ts +1 -1
- package/examples/standard-schema.ts +45 -0
- package/examples/transport-launcher.ts +10 -10
- package/package.json +25 -31
- package/dist/core/schema-dsl/runtime.d.mts +0 -144
- package/dist/core/schema-dsl/runtime.mjs +0 -271
- package/dist/core/schema-dsl/to-json-schema.d.mts +0 -29
- package/dist/core/schema-dsl/to-json-schema.mjs +0 -74
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { NumberConstraints } from "./number-constraints.mjs";
|
|
2
|
+
import { InferStandardOutput, StandardSchemaV1 } from "./standard.mjs";
|
|
2
3
|
import { ConfirmPromptConfig, InputPromptConfig, MultiselectPromptConfig, PROMPT_KINDS, PromptConfig, PromptConfigBase, PromptKind, PromptResult, SelectChoice, SelectPromptConfig } from "./prompt.mjs";
|
|
3
4
|
import { StringConstraintViolation, StringConstraints } from "./string-constraints.mjs";
|
|
4
5
|
import { DateFlagOptions, UrlFlagOptions } from "./value-parsers.mjs";
|
|
5
6
|
//#region src/core/schema/flag.d.ts
|
|
6
7
|
/** All flag presence states as a runtime array. */
|
|
7
|
-
declare const FLAG_PRESENCES: readonly [
|
|
8
|
+
declare const FLAG_PRESENCES: readonly ["optional", "required", "defaulted"];
|
|
8
9
|
/**
|
|
9
10
|
* Presence describes whether a flag value is guaranteed to exist when the
|
|
10
11
|
* action handler runs:
|
|
@@ -37,6 +38,16 @@ interface FlagConfig {
|
|
|
37
38
|
readonly optionalFallback: OptionalFallback;
|
|
38
39
|
/** The runtime kind discriminator, mirroring {@link FlagKind}. */
|
|
39
40
|
readonly flagKind: FlagKind;
|
|
41
|
+
/**
|
|
42
|
+
* Whether this builder may still be passed to `flag.array()` as the
|
|
43
|
+
* element schema.
|
|
44
|
+
*
|
|
45
|
+
* Factories producing element-meaningful kinds start `true`. Flag-level
|
|
46
|
+
* modifiers (`.alias()`, `.env()`, `.prompt()`, `.default()`, …) flip it
|
|
47
|
+
* to `false` — those settings describe the *flag*, are never read from an
|
|
48
|
+
* element schema, and would otherwise be silently ignored.
|
|
49
|
+
*/
|
|
50
|
+
readonly elementEligible: boolean;
|
|
40
51
|
}
|
|
41
52
|
/**
|
|
42
53
|
* Advanced type helper used by {@linkcode FlagBuilder} modifiers to replace presence.
|
|
@@ -47,6 +58,18 @@ type WithPresence<C extends FlagConfig, P extends FlagPresence> = {
|
|
|
47
58
|
readonly presence: P;
|
|
48
59
|
readonly optionalFallback: C['optionalFallback'];
|
|
49
60
|
readonly flagKind: C['flagKind'];
|
|
61
|
+
readonly elementEligible: false;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Advanced type helper: marks a builder as no longer usable as an array
|
|
65
|
+
* element (returned by flag-level modifiers whose settings elements ignore).
|
|
66
|
+
*/
|
|
67
|
+
type WithoutElementEligibility<C extends FlagConfig> = {
|
|
68
|
+
readonly valueType: C['valueType'];
|
|
69
|
+
readonly presence: C['presence'];
|
|
70
|
+
readonly optionalFallback: C['optionalFallback'];
|
|
71
|
+
readonly flagKind: C['flagKind'];
|
|
72
|
+
readonly elementEligible: false;
|
|
50
73
|
};
|
|
51
74
|
/**
|
|
52
75
|
* Compute the final value type from config — this is what handlers receive.
|
|
@@ -87,9 +110,10 @@ type PromptConfigByFlagKind = {
|
|
|
87
110
|
readonly count: never;
|
|
88
111
|
readonly keyValue: never;
|
|
89
112
|
};
|
|
113
|
+
/** Prompt configuration compatible with the kind carried by a {@link FlagConfig}. */
|
|
90
114
|
type AllowedPromptConfig<C extends FlagConfig> = PromptConfigByFlagKind[C['flagKind']];
|
|
91
115
|
/** All flag kind discriminators as a runtime array. */
|
|
92
|
-
declare const FLAG_KINDS: readonly [
|
|
116
|
+
declare const FLAG_KINDS: readonly ["string", "number", "boolean", "enum", "array", "custom", "count", "keyValue"];
|
|
93
117
|
/** Discriminator for the kind of value a flag accepts. */
|
|
94
118
|
type FlagKind = (typeof FLAG_KINDS)[number];
|
|
95
119
|
/**
|
|
@@ -99,19 +123,45 @@ type FlagKind = (typeof FLAG_KINDS)[number];
|
|
|
99
123
|
* value from config files. Narrow inside the function as needed.
|
|
100
124
|
*/
|
|
101
125
|
type FlagParseFn<T> = (raw: unknown) => T;
|
|
102
|
-
/** Options accepted by `flag.path()
|
|
103
|
-
interface
|
|
126
|
+
/** Options accepted by `flag.path()` for any-kind or file paths. */
|
|
127
|
+
interface FilePathFlagOptions {
|
|
104
128
|
/**
|
|
105
129
|
* Reject the value if nothing exists at the path.
|
|
106
130
|
* @defaultValue `false` (`true` when `type` is set)
|
|
107
131
|
*/
|
|
108
132
|
readonly mustExist?: boolean;
|
|
109
133
|
/**
|
|
110
|
-
* Require the path to be a file or a directory. Implies existence
|
|
134
|
+
* Require the path to be a file or a directory. Implies existence
|
|
135
|
+
* unless `mustExist` is explicitly `false`, in which case a missing
|
|
136
|
+
* path passes and only an existing path is type-checked.
|
|
111
137
|
* @defaultValue `undefined` (any kind)
|
|
112
138
|
*/
|
|
113
|
-
readonly type?: 'file'
|
|
139
|
+
readonly type?: 'file';
|
|
140
|
+
/** Directory creation is only available with `type: 'directory'`. */
|
|
141
|
+
readonly create?: never;
|
|
114
142
|
}
|
|
143
|
+
/** Options accepted by `flag.path()` for directory paths. */
|
|
144
|
+
interface DirectoryPathFlagOptions {
|
|
145
|
+
/**
|
|
146
|
+
* Reject the value if nothing exists at the path.
|
|
147
|
+
* @defaultValue `false` (`true` when `type` is set)
|
|
148
|
+
*/
|
|
149
|
+
readonly mustExist?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Require the path to be a directory. Implies existence unless
|
|
152
|
+
* `mustExist` is explicitly `false`, in which case a missing path
|
|
153
|
+
* passes and only an existing path is type-checked.
|
|
154
|
+
*/
|
|
155
|
+
readonly type: 'directory';
|
|
156
|
+
/**
|
|
157
|
+
* Create the directory (recursively) when nothing exists at the path.
|
|
158
|
+
* An existing non-directory path still fails the type check.
|
|
159
|
+
* @defaultValue `false`
|
|
160
|
+
*/
|
|
161
|
+
readonly create?: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** Options accepted by `flag.path()`. */
|
|
164
|
+
type PathFlagOptions = FilePathFlagOptions | DirectoryPathFlagOptions;
|
|
115
165
|
/**
|
|
116
166
|
* Filesystem expectations attached by `flag.path()`.
|
|
117
167
|
*
|
|
@@ -124,9 +174,11 @@ interface PathChecks {
|
|
|
124
174
|
readonly mustExist: boolean;
|
|
125
175
|
/**
|
|
126
176
|
* Require the existing path to be a file or a directory. Implies
|
|
127
|
-
* existence when set
|
|
177
|
+
* existence when set, unless `mustExist` is `false`.
|
|
128
178
|
*/
|
|
129
179
|
readonly type: 'file' | 'directory' | undefined;
|
|
180
|
+
/** Create the directory (recursively) when nothing exists at the path. */
|
|
181
|
+
readonly create: boolean;
|
|
130
182
|
}
|
|
131
183
|
/** Runtime descriptor for a flag alias. */
|
|
132
184
|
interface FlagAlias {
|
|
@@ -238,6 +290,15 @@ interface FlagSchema {
|
|
|
238
290
|
readonly prompt: PromptConfig | undefined;
|
|
239
291
|
/** Custom parse function (only when `kind === 'custom'`). */
|
|
240
292
|
readonly parseFn: FlagParseFn<unknown> | undefined;
|
|
293
|
+
/**
|
|
294
|
+
* Standard Schema v1 validator applied to the resolved value.
|
|
295
|
+
*
|
|
296
|
+
* When set, the value from any source (CLI, env, config, prompt, default)
|
|
297
|
+
* is validated after resolution via `~standard.validate`. Sync and async
|
|
298
|
+
* validators are both awaited; issues surface as a `CONSTRAINT_VIOLATED`
|
|
299
|
+
* {@link ValidationError}. Only meaningful when `kind === 'custom'`.
|
|
300
|
+
*/
|
|
301
|
+
readonly standard: StandardSchemaV1 | undefined;
|
|
241
302
|
/**
|
|
242
303
|
* Deprecation marker.
|
|
243
304
|
*
|
|
@@ -427,7 +488,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
427
488
|
*/
|
|
428
489
|
alias(name: string, options?: {
|
|
429
490
|
hidden?: boolean;
|
|
430
|
-
}): FlagBuilder<C
|
|
491
|
+
}): FlagBuilder<WithoutElementEligibility<C>>;
|
|
431
492
|
/**
|
|
432
493
|
* Bind to an environment variable (resolved in v0.2+).
|
|
433
494
|
*
|
|
@@ -442,7 +503,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
442
503
|
* // $ mycli request --api-key sk-456 → apiKey = 'sk-456' (CLI wins)
|
|
443
504
|
* ```
|
|
444
505
|
*/
|
|
445
|
-
env(varName: string): FlagBuilder<C
|
|
506
|
+
env(varName: string): FlagBuilder<WithoutElementEligibility<C>>;
|
|
446
507
|
/**
|
|
447
508
|
* Bind to a dotted config path (resolved in v0.2+).
|
|
448
509
|
*
|
|
@@ -459,14 +520,14 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
459
520
|
* // # → CLI flag wins
|
|
460
521
|
* ```
|
|
461
522
|
*/
|
|
462
|
-
config(path: string): FlagBuilder<C
|
|
523
|
+
config(path: string): FlagBuilder<WithoutElementEligibility<C>>;
|
|
463
524
|
/**
|
|
464
525
|
* Human-readable description shown in help output.
|
|
465
526
|
*
|
|
466
527
|
* @param description - Text displayed next to the flag in `--help`.
|
|
467
528
|
* @returns The builder (for chaining).
|
|
468
529
|
*/
|
|
469
|
-
describe(description: string): FlagBuilder<C
|
|
530
|
+
describe(description: string): FlagBuilder<WithoutElementEligibility<C>>;
|
|
470
531
|
/**
|
|
471
532
|
* Attach interactive prompt configuration for v0.3+ resolution.
|
|
472
533
|
*
|
|
@@ -486,7 +547,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
486
547
|
* // $ mycli init --name foo → skips prompt, uses CLI value
|
|
487
548
|
* ```
|
|
488
549
|
*/
|
|
489
|
-
prompt(config: AllowedPromptConfig<C>): FlagBuilder<C
|
|
550
|
+
prompt(config: AllowedPromptConfig<C>): FlagBuilder<WithoutElementEligibility<C>>;
|
|
490
551
|
/**
|
|
491
552
|
* Mark this flag as deprecated.
|
|
492
553
|
*
|
|
@@ -506,7 +567,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
506
567
|
* // ⚠ --dest is deprecated: Use --target instead
|
|
507
568
|
* ```
|
|
508
569
|
*/
|
|
509
|
-
deprecated(message?: string): FlagBuilder<C
|
|
570
|
+
deprecated(message?: string): FlagBuilder<WithoutElementEligibility<C>>;
|
|
510
571
|
/**
|
|
511
572
|
* Mark this flag as propagated to subcommands.
|
|
512
573
|
*
|
|
@@ -528,7 +589,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
528
589
|
* // # → same, inherited from parent
|
|
529
590
|
* ```
|
|
530
591
|
*/
|
|
531
|
-
propagate(): FlagBuilder<C
|
|
592
|
+
propagate(): FlagBuilder<WithoutElementEligibility<C>>;
|
|
532
593
|
/**
|
|
533
594
|
* Require an integer value. Composes with other numeric constraints.
|
|
534
595
|
*
|
|
@@ -716,7 +777,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
716
777
|
}>, options?: {
|
|
717
778
|
alias?: string;
|
|
718
779
|
hidden?: boolean;
|
|
719
|
-
}): FlagBuilder<C
|
|
780
|
+
}): FlagBuilder<WithoutElementEligibility<C>>;
|
|
720
781
|
/**
|
|
721
782
|
* Set how repeated CLI occurrences of this flag combine.
|
|
722
783
|
*
|
|
@@ -737,7 +798,7 @@ declare class FlagBuilder<C extends FlagConfig> {
|
|
|
737
798
|
*/
|
|
738
799
|
duplicates(this: FlagBuilder<C & {
|
|
739
800
|
readonly flagKind: 'boolean' | 'string' | 'number' | 'enum' | 'custom';
|
|
740
|
-
}>, policy: DuplicatePolicy): FlagBuilder<C
|
|
801
|
+
}>, policy: DuplicatePolicy): FlagBuilder<WithoutElementEligibility<C>>;
|
|
741
802
|
}
|
|
742
803
|
/**
|
|
743
804
|
* Factory that creates {@link FlagBuilder} instances seeded with the correct
|
|
@@ -768,6 +829,7 @@ interface FlagFactory {
|
|
|
768
829
|
readonly presence: 'optional';
|
|
769
830
|
readonly optionalFallback: 'undefined';
|
|
770
831
|
readonly flagKind: 'string';
|
|
832
|
+
readonly elementEligible: true;
|
|
771
833
|
}>;
|
|
772
834
|
/**
|
|
773
835
|
* Number-valued flag, with optional numeric constraints.
|
|
@@ -796,6 +858,7 @@ interface FlagFactory {
|
|
|
796
858
|
readonly presence: 'optional';
|
|
797
859
|
readonly optionalFallback: 'undefined';
|
|
798
860
|
readonly flagKind: 'number';
|
|
861
|
+
readonly elementEligible: true;
|
|
799
862
|
}>;
|
|
800
863
|
/**
|
|
801
864
|
* Boolean flag. Implicitly defaults to `false` — the only flag kind where
|
|
@@ -808,6 +871,7 @@ interface FlagFactory {
|
|
|
808
871
|
readonly presence: 'defaulted';
|
|
809
872
|
readonly optionalFallback: 'undefined';
|
|
810
873
|
readonly flagKind: 'boolean';
|
|
874
|
+
readonly elementEligible: true;
|
|
811
875
|
}>;
|
|
812
876
|
/**
|
|
813
877
|
* Enum flag with literal type inference.
|
|
@@ -829,6 +893,7 @@ interface FlagFactory {
|
|
|
829
893
|
readonly presence: 'optional';
|
|
830
894
|
readonly optionalFallback: 'undefined';
|
|
831
895
|
readonly flagKind: 'enum';
|
|
896
|
+
readonly elementEligible: true;
|
|
832
897
|
}>;
|
|
833
898
|
/**
|
|
834
899
|
* Array flag — collects multiple values of the same element type.
|
|
@@ -842,11 +907,39 @@ interface FlagFactory {
|
|
|
842
907
|
* @param element - {@link FlagBuilder} describing the element type.
|
|
843
908
|
* @returns A {@link FlagBuilder} for arrays of the element type.
|
|
844
909
|
*/
|
|
845
|
-
array<E extends FlagConfig
|
|
910
|
+
array<E extends FlagConfig & {
|
|
911
|
+
readonly elementEligible: true;
|
|
912
|
+
}>(element: FlagBuilder<E>): FlagBuilder<{
|
|
846
913
|
readonly valueType: E['valueType'][];
|
|
847
914
|
readonly presence: 'optional';
|
|
848
915
|
readonly optionalFallback: 'empty-array';
|
|
849
916
|
readonly flagKind: 'array';
|
|
917
|
+
readonly elementEligible: false;
|
|
918
|
+
}>;
|
|
919
|
+
/**
|
|
920
|
+
* Custom flag validated by a Standard Schema v1 validator (zod, valibot,
|
|
921
|
+
* arktype, …). The resolved value from any source is validated after
|
|
922
|
+
* resolution; the flag's value type is the validator's output type.
|
|
923
|
+
*
|
|
924
|
+
* Sync and async validators are both supported. Validation issues surface
|
|
925
|
+
* as a `CONSTRAINT_VIOLATED` error naming the flag.
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* ```ts
|
|
929
|
+
* import { z } from 'zod';
|
|
930
|
+
* flag.custom(z.string().url())
|
|
931
|
+
* // inferred type: string | undefined
|
|
932
|
+
* ```
|
|
933
|
+
*
|
|
934
|
+
* @param schema - A Standard Schema v1 validator.
|
|
935
|
+
* @returns A {@link FlagBuilder} whose value type is the validator's output.
|
|
936
|
+
*/
|
|
937
|
+
custom<S extends StandardSchemaV1>(schema: S): FlagBuilder<{
|
|
938
|
+
readonly valueType: InferStandardOutput<S>;
|
|
939
|
+
readonly presence: 'optional';
|
|
940
|
+
readonly optionalFallback: 'undefined';
|
|
941
|
+
readonly flagKind: 'custom';
|
|
942
|
+
readonly elementEligible: true;
|
|
850
943
|
}>;
|
|
851
944
|
/**
|
|
852
945
|
* Custom-parsed flag. The parse function receives the raw value and must
|
|
@@ -882,6 +975,7 @@ interface FlagFactory {
|
|
|
882
975
|
readonly presence: 'optional';
|
|
883
976
|
readonly optionalFallback: 'undefined';
|
|
884
977
|
readonly flagKind: 'custom';
|
|
978
|
+
readonly elementEligible: true;
|
|
885
979
|
}>;
|
|
886
980
|
/**
|
|
887
981
|
* URL-valued flag. Parses into a `URL`; invalid URLs are rejected with an
|
|
@@ -901,6 +995,7 @@ interface FlagFactory {
|
|
|
901
995
|
readonly presence: 'optional';
|
|
902
996
|
readonly optionalFallback: 'undefined';
|
|
903
997
|
readonly flagKind: 'custom';
|
|
998
|
+
readonly elementEligible: true;
|
|
904
999
|
}>;
|
|
905
1000
|
/**
|
|
906
1001
|
* Path-valued flag. The value stays a `string`; optional filesystem
|
|
@@ -908,7 +1003,7 @@ interface FlagFactory {
|
|
|
908
1003
|
* env, and config values are validated identically.
|
|
909
1004
|
*
|
|
910
1005
|
* @param options - Optional existence/type checks. `type` implies
|
|
911
|
-
* existence
|
|
1006
|
+
* existence unless `mustExist` is explicitly `false`.
|
|
912
1007
|
* @returns A {@link FlagBuilder} for path strings.
|
|
913
1008
|
*
|
|
914
1009
|
* @example
|
|
@@ -916,6 +1011,10 @@ interface FlagFactory {
|
|
|
916
1011
|
* flag.path() // any string, help shows <path>
|
|
917
1012
|
* flag.path({ mustExist: true }) // rejects missing paths
|
|
918
1013
|
* flag.path({ type: 'directory' }) // must exist and be a directory
|
|
1014
|
+
* flag.path({ type: 'directory', mustExist: false })
|
|
1015
|
+
* // missing passes; existing must be a directory
|
|
1016
|
+
* flag.path({ type: 'directory', create: true })
|
|
1017
|
+
* // created recursively when missing
|
|
919
1018
|
* ```
|
|
920
1019
|
*/
|
|
921
1020
|
path(options?: PathFlagOptions): FlagBuilder<{
|
|
@@ -923,6 +1022,7 @@ interface FlagFactory {
|
|
|
923
1022
|
readonly presence: 'optional';
|
|
924
1023
|
readonly optionalFallback: 'undefined';
|
|
925
1024
|
readonly flagKind: 'string';
|
|
1025
|
+
readonly elementEligible: false;
|
|
926
1026
|
}>;
|
|
927
1027
|
/**
|
|
928
1028
|
* Date-valued flag. Accepts strict ISO-8601 (`2026-07-10`,
|
|
@@ -948,6 +1048,7 @@ interface FlagFactory {
|
|
|
948
1048
|
readonly presence: 'optional';
|
|
949
1049
|
readonly optionalFallback: 'undefined';
|
|
950
1050
|
readonly flagKind: 'custom';
|
|
1051
|
+
readonly elementEligible: true;
|
|
951
1052
|
}>;
|
|
952
1053
|
/**
|
|
953
1054
|
* Duration flag. Accepts `'30s'`, `'5m'`, `'1.5h'`, `'250ms'`, `'2d'`,
|
|
@@ -966,6 +1067,7 @@ interface FlagFactory {
|
|
|
966
1067
|
readonly presence: 'optional';
|
|
967
1068
|
readonly optionalFallback: 'undefined';
|
|
968
1069
|
readonly flagKind: 'custom';
|
|
1070
|
+
readonly elementEligible: true;
|
|
969
1071
|
}>;
|
|
970
1072
|
/**
|
|
971
1073
|
* Byte-size flag. Accepts `'512mb'`, `'1.5gb'`, `'64kb'`, `'100b'` or a
|
|
@@ -984,6 +1086,7 @@ interface FlagFactory {
|
|
|
984
1086
|
readonly presence: 'optional';
|
|
985
1087
|
readonly optionalFallback: 'undefined';
|
|
986
1088
|
readonly flagKind: 'custom';
|
|
1089
|
+
readonly elementEligible: true;
|
|
987
1090
|
}>;
|
|
988
1091
|
/**
|
|
989
1092
|
* Count flag — resolves to how many times the flag appears. `-vvv`,
|
|
@@ -1006,6 +1109,7 @@ interface FlagFactory {
|
|
|
1006
1109
|
readonly presence: 'defaulted';
|
|
1007
1110
|
readonly optionalFallback: 'undefined';
|
|
1008
1111
|
readonly flagKind: 'count';
|
|
1112
|
+
readonly elementEligible: false;
|
|
1009
1113
|
}>;
|
|
1010
1114
|
/**
|
|
1011
1115
|
* Key-value flag — repeated `KEY=VALUE` occurrences merge into a
|
|
@@ -1029,6 +1133,7 @@ interface FlagFactory {
|
|
|
1029
1133
|
readonly presence: 'optional';
|
|
1030
1134
|
readonly optionalFallback: 'empty-object';
|
|
1031
1135
|
readonly flagKind: 'keyValue';
|
|
1136
|
+
readonly elementEligible: false;
|
|
1032
1137
|
}>;
|
|
1033
1138
|
}
|
|
1034
1139
|
/**
|
|
@@ -1037,4 +1142,4 @@ interface FlagFactory {
|
|
|
1037
1142
|
*/
|
|
1038
1143
|
declare const flag: FlagFactory;
|
|
1039
1144
|
//#endregion
|
|
1040
|
-
export { type AllowedPromptConfig, type ConfirmPromptConfig, type DateFlagOptions, type DuplicatePolicy, FLAG_KINDS, FLAG_PRESENCES, type FlagAlias, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FlagSchemaOverrides, type InferFlag, type InferFlags, type InputPromptConfig, type MultiselectPromptConfig, type OptionalFallback, PROMPT_KINDS, type PathChecks, type PathFlagOptions, type PromptConfig, type PromptConfigBase, type PromptKind, type PromptResult, type ResolvedValue, type SelectChoice, type SelectPromptConfig, type StringConstraintViolation, type StringConstraints, type UrlFlagOptions, type WithPresence, createSchema, flag, getFlagAliasNames, getFlagNegatedName, normalizeFlagAlias, normalizeFlagAliases };
|
|
1145
|
+
export { type AllowedPromptConfig, type ConfirmPromptConfig, type DateFlagOptions, type DuplicatePolicy, FLAG_KINDS, FLAG_PRESENCES, type FlagAlias, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FlagSchemaOverrides, type InferFlag, type InferFlags, type InputPromptConfig, type MultiselectPromptConfig, type OptionalFallback, PROMPT_KINDS, type PathChecks, type PathFlagOptions, type PromptConfig, type PromptConfigBase, type PromptConfigByFlagKind, type PromptKind, type PromptResult, type ResolvedValue, type SelectChoice, type SelectPromptConfig, type StringConstraintViolation, type StringConstraints, type UrlFlagOptions, type WithPresence, type WithoutElementEligibility, createSchema, flag, getFlagAliasNames, getFlagNegatedName, normalizeFlagAlias, normalizeFlagAliases };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertNumberConstraints } from "./number-constraints.mjs";
|
|
2
|
+
import { isStandardSchemaV1 } from "./standard.mjs";
|
|
2
3
|
import { assertStringConstraints } from "./string-constraints.mjs";
|
|
3
4
|
import { parseBytesValue, parseDateValue, parseDurationValue, parseUrlValue } from "./value-parsers.mjs";
|
|
4
5
|
//#region src/core/schema/flag.ts
|
|
@@ -112,6 +113,7 @@ function createSchema(kind, overrides) {
|
|
|
112
113
|
valueHint: void 0,
|
|
113
114
|
prompt: void 0,
|
|
114
115
|
parseFn: void 0,
|
|
116
|
+
standard: void 0,
|
|
115
117
|
deprecated: void 0,
|
|
116
118
|
propagate: false,
|
|
117
119
|
negation: void 0,
|
|
@@ -655,8 +657,9 @@ const flag = {
|
|
|
655
657
|
array(element) {
|
|
656
658
|
return new FlagBuilder(createSchema("array", { elementSchema: element.schema }));
|
|
657
659
|
},
|
|
658
|
-
custom(
|
|
659
|
-
return new FlagBuilder(createSchema("custom", {
|
|
660
|
+
custom(parseFnOrSchema) {
|
|
661
|
+
if (isStandardSchemaV1(parseFnOrSchema)) return new FlagBuilder(createSchema("custom", { standard: parseFnOrSchema }));
|
|
662
|
+
return new FlagBuilder(createSchema("custom", { parseFn: parseFnOrSchema }));
|
|
660
663
|
},
|
|
661
664
|
url(options) {
|
|
662
665
|
return new FlagBuilder(createSchema("custom", {
|
|
@@ -668,7 +671,8 @@ const flag = {
|
|
|
668
671
|
return new FlagBuilder(createSchema("string", {
|
|
669
672
|
pathChecks: options?.mustExist === true || options?.type !== void 0 ? {
|
|
670
673
|
mustExist: options.mustExist ?? true,
|
|
671
|
-
type: options.type
|
|
674
|
+
type: options.type,
|
|
675
|
+
create: options.type === "directory" && options.create === true
|
|
672
676
|
} : void 0,
|
|
673
677
|
valueHint: "path"
|
|
674
678
|
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActivityEvent, Fallback, ProgressHandle, ProgressOptions, SpinnerHandle, SpinnerOptions, TableColumn, TableFormat, TableOptions, TableStream } from "./activity.mjs";
|
|
2
2
|
import { NumberConstraintViolation, NumberConstraints, describeNumberConstraintViolation, validateNumberConstraints } from "./number-constraints.mjs";
|
|
3
|
+
import { InferStandardInput, InferStandardOutput, StandardSchemaV1, StandardSchemaV1FailureResult, StandardSchemaV1Issue, StandardSchemaV1Options, StandardSchemaV1PathSegment, StandardSchemaV1Props, StandardSchemaV1Result, StandardSchemaV1SuccessResult, StandardSchemaV1Types } from "./standard.mjs";
|
|
3
4
|
import { ARG_KINDS, ARG_PRESENCES, ArgBuilder, ArgConfig, ArgFactory, ArgKind, ArgParseFn, ArgPresence, ArgSchema, InferArg, InferArgs, ResolvedArgValue, WithArgPresence, WithVariadic, arg, createArgSchema } from "./arg.mjs";
|
|
4
5
|
import { ConfirmPromptConfig, InputPromptConfig, MultiselectPromptConfig, PROMPT_KINDS, PromptConfig, PromptConfigBase, PromptKind, PromptResult, SelectChoice, SelectPromptConfig } from "./prompt.mjs";
|
|
5
6
|
import { StringConstraintViolation, StringConstraints, describeStringConstraintViolation, validateStringConstraints } from "./string-constraints.mjs";
|
|
@@ -7,5 +8,5 @@ import { DateFlagOptions, UrlFlagOptions } from "./value-parsers.mjs";
|
|
|
7
8
|
import { DuplicatePolicy, FLAG_KINDS, FLAG_PRESENCES, FlagAlias, FlagBuilder, FlagConfig, FlagFactory, FlagKind, FlagNegation, FlagParseFn, FlagPresence, FlagSchema, FlagSchemaOverrides, InferFlag, InferFlags, PathChecks, PathFlagOptions, ResolvedValue, WithPresence, createSchema, flag, getFlagNegatedName } from "./flag.mjs";
|
|
8
9
|
import { ErasedMiddlewareHandler, Middleware, MiddlewareHandler, MiddlewareParams, middleware } from "./middleware.mjs";
|
|
9
10
|
import { RunOptions, RunResult } from "./run.mjs";
|
|
10
|
-
import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, ErasedCommand, ErasedDeriveHandler, ErasedInteractiveResolver, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group } from "./command.mjs";
|
|
11
|
-
export { ARG_KINDS, ARG_PRESENCES, type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type ConfirmPromptConfig, type DateFlagOptions, type DeriveHandler, type DeriveParams, type DuplicatePolicy, type ErasedCommand, type ErasedDeriveHandler, type ErasedInteractiveResolver, type ErasedMiddlewareHandler, FLAG_KINDS, FLAG_PRESENCES, type Fallback, type FlagAlias, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FlagSchemaOverrides, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, PROMPT_KINDS, type PathChecks, type PathFlagOptions, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptKind, type PromptResult, type ResolvedArgValue, type ResolvedValue, type RunOptions, type RunResult, type SelectChoice, type SelectPromptConfig, type SpinnerHandle, type SpinnerOptions, type StringConstraintViolation, type StringConstraints, type TableColumn, type TableFormat, type TableOptions, type TableStream, type UrlFlagOptions, type WithArgPresence, type WithPresence, type WithVariadic, arg, command, createArgSchema, createSchema, describeNumberConstraintViolation, describeStringConstraintViolation, flag, getFlagNegatedName, group, middleware, validateNumberConstraints, validateStringConstraints };
|
|
11
|
+
import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, ErasedCommand, ErasedDeriveHandler, ErasedInteractiveResolver, ExampleCommand, ExampleMeta, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group, resolveExampleCommand } from "./command.mjs";
|
|
12
|
+
export { ARG_KINDS, ARG_PRESENCES, type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type ConfirmPromptConfig, type DateFlagOptions, type DeriveHandler, type DeriveParams, type DuplicatePolicy, type ErasedCommand, type ErasedDeriveHandler, type ErasedInteractiveResolver, type ErasedMiddlewareHandler, type ExampleCommand, type ExampleMeta, FLAG_KINDS, FLAG_PRESENCES, type Fallback, type FlagAlias, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FlagSchemaOverrides, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferStandardInput, type InferStandardOutput, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, PROMPT_KINDS, type PathChecks, type PathFlagOptions, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptKind, type PromptResult, type ResolvedArgValue, type ResolvedValue, type RunOptions, type RunResult, type SelectChoice, type SelectPromptConfig, type SpinnerHandle, type SpinnerOptions, type StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, type StringConstraintViolation, type StringConstraints, type TableColumn, type TableFormat, type TableOptions, type TableStream, type UrlFlagOptions, type WithArgPresence, type WithPresence, type WithVariadic, arg, command, createArgSchema, createSchema, describeNumberConstraintViolation, describeStringConstraintViolation, flag, getFlagNegatedName, group, middleware, resolveExampleCommand, validateNumberConstraints, validateStringConstraints };
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module dreamcli/core/schema/prompt
|
|
11
11
|
*/
|
|
12
12
|
/** All prompt kind discriminators as a runtime array. */
|
|
13
|
-
declare const PROMPT_KINDS: readonly [
|
|
13
|
+
declare const PROMPT_KINDS: readonly ["confirm", "input", "select", "multiselect"];
|
|
14
14
|
/**
|
|
15
15
|
* The kind of interactive prompt to present.
|
|
16
16
|
*
|
|
@@ -68,6 +68,13 @@ interface RunOptions {
|
|
|
68
68
|
* override), path checks are skipped.
|
|
69
69
|
*/
|
|
70
70
|
readonly stat?: (path: string) => Promise<'file' | 'directory' | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Recursive directory creation for `flag.path()` `create` checks.
|
|
73
|
+
*
|
|
74
|
+
* `CLIBuilder.run()` supplies the runtime adapter's implementation
|
|
75
|
+
* automatically. When absent, missing paths are not created.
|
|
76
|
+
*/
|
|
77
|
+
readonly mkdir?: (path: string) => Promise<void>;
|
|
71
78
|
/**
|
|
72
79
|
* Verbosity level for the output channel.
|
|
73
80
|
* @defaultValue `'normal'`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/core/schema/standard.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The Standard Schema v1 interface, vendored as types only.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the specification at https://standardschema.dev so validators from
|
|
6
|
+
* zod, valibot, arktype, and any other conforming library can be passed to
|
|
7
|
+
* `flag.custom()` / `arg.custom()` without adding a runtime dependency.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/** A schema that conforms to the Standard Schema v1 specification. */
|
|
12
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
13
|
+
/** The Standard Schema properties, namespaced under a well-known key. */
|
|
14
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
15
|
+
}
|
|
16
|
+
/** Types copied from the Standard Schema v1 specification. */
|
|
17
|
+
declare namespace StandardSchemaV1 {
|
|
18
|
+
/** The properties exposed under a validator's `~standard` key. */
|
|
19
|
+
interface Props<Input = unknown, Output = Input> {
|
|
20
|
+
/** The version number of the specification. */
|
|
21
|
+
readonly version: 1;
|
|
22
|
+
/** The vendor name of the schema library. */
|
|
23
|
+
readonly vendor: string;
|
|
24
|
+
/** Validate an unknown value, returning its output or the issues found. */
|
|
25
|
+
readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
26
|
+
/** Inferred input and output types, present only at the type level. */
|
|
27
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** Optional parameters passed to a validator. */
|
|
30
|
+
interface Options {
|
|
31
|
+
/** Explicit support for vendor-specific validation parameters. */
|
|
32
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** The result of validating a value: either its output or a list of issues. */
|
|
35
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
36
|
+
/** A successful validation carrying the parsed output value. */
|
|
37
|
+
interface SuccessResult<Output> {
|
|
38
|
+
/** The validated (and possibly transformed) value. */
|
|
39
|
+
readonly value: Output;
|
|
40
|
+
/** Absent on success. */
|
|
41
|
+
readonly issues?: undefined;
|
|
42
|
+
}
|
|
43
|
+
/** A failed validation carrying validation issues. */
|
|
44
|
+
interface FailureResult {
|
|
45
|
+
/** The issues that caused validation to fail. */
|
|
46
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
47
|
+
}
|
|
48
|
+
/** A single validation issue. */
|
|
49
|
+
interface Issue {
|
|
50
|
+
/** The human-readable error message. */
|
|
51
|
+
readonly message: string;
|
|
52
|
+
/** The path to the offending value, when the validator reports one. */
|
|
53
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** One segment of an issue path. */
|
|
56
|
+
interface PathSegment {
|
|
57
|
+
/** The key of this path segment. */
|
|
58
|
+
readonly key: PropertyKey;
|
|
59
|
+
}
|
|
60
|
+
/** The type-level input and output carried by a validator. */
|
|
61
|
+
interface Types<Input = unknown, Output = Input> {
|
|
62
|
+
/** The input type accepted by the validator. */
|
|
63
|
+
readonly input: Input;
|
|
64
|
+
/** The output type produced by the validator. */
|
|
65
|
+
readonly output: Output;
|
|
66
|
+
}
|
|
67
|
+
/** Infer the input type of a Standard Schema validator. */
|
|
68
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
69
|
+
/** Infer the output type of a Standard Schema validator. */
|
|
70
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
71
|
+
}
|
|
72
|
+
/** Backward-compatible flat alias for {@link StandardSchemaV1.Props}. */
|
|
73
|
+
type StandardSchemaV1Props<Input = unknown, Output = Input> = StandardSchemaV1.Props<Input, Output>;
|
|
74
|
+
/** Flat alias for {@link StandardSchemaV1.Options}. */
|
|
75
|
+
type StandardSchemaV1Options = StandardSchemaV1.Options;
|
|
76
|
+
/** Flat alias for {@link StandardSchemaV1.Result}. */
|
|
77
|
+
type StandardSchemaV1Result<Output> = StandardSchemaV1.Result<Output>;
|
|
78
|
+
/** Flat alias for {@link StandardSchemaV1.SuccessResult}. */
|
|
79
|
+
type StandardSchemaV1SuccessResult<Output> = StandardSchemaV1.SuccessResult<Output>;
|
|
80
|
+
/** Flat alias for {@link StandardSchemaV1.FailureResult}. */
|
|
81
|
+
type StandardSchemaV1FailureResult = StandardSchemaV1.FailureResult;
|
|
82
|
+
/** Flat alias for {@link StandardSchemaV1.Issue}. */
|
|
83
|
+
type StandardSchemaV1Issue = StandardSchemaV1.Issue;
|
|
84
|
+
/** Flat alias for {@link StandardSchemaV1.PathSegment}. */
|
|
85
|
+
type StandardSchemaV1PathSegment = StandardSchemaV1.PathSegment;
|
|
86
|
+
/** Backward-compatible flat alias for {@link StandardSchemaV1.Types}. */
|
|
87
|
+
type StandardSchemaV1Types<Input = unknown, Output = Input> = StandardSchemaV1.Types<Input, Output>;
|
|
88
|
+
/** Flat alias for {@link StandardSchemaV1.InferInput}. */
|
|
89
|
+
type InferStandardInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>;
|
|
90
|
+
/** Flat alias for {@link StandardSchemaV1.InferOutput}. */
|
|
91
|
+
type InferStandardOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
|
|
92
|
+
/**
|
|
93
|
+
* Detect a Standard Schema validator without assuming validators are plain
|
|
94
|
+
* objects. Some conforming libraries expose callable schema values.
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
declare function isStandardSchemaV1(value: unknown): value is StandardSchemaV1;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { InferStandardInput, InferStandardOutput, StandardSchemaV1, StandardSchemaV1FailureResult, StandardSchemaV1Issue, StandardSchemaV1Options, StandardSchemaV1PathSegment, StandardSchemaV1Props, StandardSchemaV1Result, StandardSchemaV1SuccessResult, StandardSchemaV1Types, isStandardSchemaV1 };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/core/schema/standard.ts
|
|
2
|
+
/**
|
|
3
|
+
* Detect a Standard Schema validator without assuming validators are plain
|
|
4
|
+
* objects. Some conforming libraries expose callable schema values.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function isStandardSchemaV1(value) {
|
|
9
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
10
|
+
if (!("~standard" in value)) return false;
|
|
11
|
+
const properties = value["~standard"];
|
|
12
|
+
return properties !== null && typeof properties === "object" && "version" in properties && properties.version === 1 && "validate" in properties && typeof properties.validate === "function";
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isStandardSchemaV1 };
|
|
@@ -5,7 +5,8 @@ import { RunnableCommand } from "../schema/command.mjs";
|
|
|
5
5
|
* Run a command builder against the given argv with injected options.
|
|
6
6
|
*
|
|
7
7
|
* This is the testkit wrapper around the shared executor:
|
|
8
|
-
* 1. Apply the CLI root-flag layer (detect/strip `--json`) so
|
|
8
|
+
* 1. Apply the CLI root-flag layer (detect/strip `--json` and `--quiet`/`-q`) so
|
|
9
|
+
* copied real argv works
|
|
9
10
|
* 2. Create or reuse capture output
|
|
10
11
|
* 3. Build standalone schema/meta defaults when CLI dispatch did not
|
|
11
12
|
* 4. Delegate parse -> resolve -> execute to the shared executor
|
|
@@ -15,10 +16,11 @@ import { RunnableCommand } from "../schema/command.mjs";
|
|
|
15
16
|
* with appropriate exit codes. The function never throws.
|
|
16
17
|
*
|
|
17
18
|
* @param cmd - The command builder (must have an action handler)
|
|
18
|
-
* @param argv - Raw argv strings (NOT including the command name itself).
|
|
19
|
-
* CLI-level `--json` before the `--` separator
|
|
20
|
-
* just like the real CLI root — so `['--json']` enables
|
|
21
|
-
*
|
|
19
|
+
* @param argv - Raw argv strings (NOT including the command name itself).
|
|
20
|
+
* CLI-level `--json` and `--quiet`/`-q` before the `--` separator are honored
|
|
21
|
+
* and stripped here, just like the real CLI root — so `['--json']` enables
|
|
22
|
+
* JSON mode and `['--quiet']` sets quiet verbosity rather than failing as
|
|
23
|
+
* unknown flags. Equivalent to `{ jsonMode: true }` / `{ verbosity: 'quiet' }`.
|
|
22
24
|
* @param options - Injectable runtime state
|
|
23
25
|
* @returns Structured run result with exit code and captured output
|
|
24
26
|
*/
|
|
@@ -21,7 +21,8 @@ import { buildRunResult, executeCommand } from "../execution/index.mjs";
|
|
|
21
21
|
* Run a command builder against the given argv with injected options.
|
|
22
22
|
*
|
|
23
23
|
* This is the testkit wrapper around the shared executor:
|
|
24
|
-
* 1. Apply the CLI root-flag layer (detect/strip `--json`) so
|
|
24
|
+
* 1. Apply the CLI root-flag layer (detect/strip `--json` and `--quiet`/`-q`) so
|
|
25
|
+
* copied real argv works
|
|
25
26
|
* 2. Create or reuse capture output
|
|
26
27
|
* 3. Build standalone schema/meta defaults when CLI dispatch did not
|
|
27
28
|
* 4. Delegate parse -> resolve -> execute to the shared executor
|
|
@@ -31,17 +32,21 @@ import { buildRunResult, executeCommand } from "../execution/index.mjs";
|
|
|
31
32
|
* with appropriate exit codes. The function never throws.
|
|
32
33
|
*
|
|
33
34
|
* @param cmd - The command builder (must have an action handler)
|
|
34
|
-
* @param argv - Raw argv strings (NOT including the command name itself).
|
|
35
|
-
* CLI-level `--json` before the `--` separator
|
|
36
|
-
* just like the real CLI root — so `['--json']` enables
|
|
37
|
-
*
|
|
35
|
+
* @param argv - Raw argv strings (NOT including the command name itself).
|
|
36
|
+
* CLI-level `--json` and `--quiet`/`-q` before the `--` separator are honored
|
|
37
|
+
* and stripped here, just like the real CLI root — so `['--json']` enables
|
|
38
|
+
* JSON mode and `['--quiet']` sets quiet verbosity rather than failing as
|
|
39
|
+
* unknown flags. Equivalent to `{ jsonMode: true }` / `{ verbosity: 'quiet' }`.
|
|
38
40
|
* @param options - Injectable runtime state
|
|
39
41
|
* @returns Structured run result with exit code and captured output
|
|
40
42
|
*/
|
|
41
43
|
async function runCommand(cmd, argv, options) {
|
|
42
44
|
const hasJsonFlag = includesBeforeSeparator(argv, "--json");
|
|
43
45
|
const jsonMode = hasJsonFlag || options?.jsonMode === true;
|
|
44
|
-
const
|
|
46
|
+
const hasQuietFlag = includesBeforeSeparator(argv, "--quiet") || includesBeforeSeparator(argv, "-q");
|
|
47
|
+
const verbosity = hasQuietFlag ? "quiet" : options?.verbosity;
|
|
48
|
+
let effectiveArgv = hasJsonFlag ? stripBeforeSeparator(argv, "--json") : argv;
|
|
49
|
+
if (hasQuietFlag) effectiveArgv = stripBeforeSeparator(stripBeforeSeparator(effectiveArgv, "--quiet"), "-q");
|
|
45
50
|
let out;
|
|
46
51
|
let captured;
|
|
47
52
|
if (options?.out !== void 0) {
|
|
@@ -53,7 +58,7 @@ async function runCommand(cmd, argv, options) {
|
|
|
53
58
|
};
|
|
54
59
|
} else {
|
|
55
60
|
const captureOptions = {
|
|
56
|
-
...
|
|
61
|
+
...verbosity !== void 0 ? { verbosity } : {},
|
|
57
62
|
...jsonMode ? { jsonMode } : {},
|
|
58
63
|
...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {}
|
|
59
64
|
};
|