@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ValidationError } from "../errors/index.mjs";
|
|
2
|
+
//#region src/core/resolve/standard.ts
|
|
3
|
+
/**
|
|
4
|
+
* Standard Schema v1 validation pass.
|
|
5
|
+
*
|
|
6
|
+
* Runs after CLI/env/config/prompt/default resolution so a validator attached
|
|
7
|
+
* via `flag.custom()` / `arg.custom()` sees the final value regardless of its
|
|
8
|
+
* source. `~standard.validate` may be sync or async; both are awaited here.
|
|
9
|
+
* Issues become `CONSTRAINT_VIOLATED` validation errors; a successful result
|
|
10
|
+
* replaces the value with the validator's (possibly transformed) output.
|
|
11
|
+
*
|
|
12
|
+
* @module dreamcli/core/resolve/standard
|
|
13
|
+
*/
|
|
14
|
+
/** Render an issue path (e.g. `['a', 0]` → `a.0`), or `undefined` when empty. */
|
|
15
|
+
function formatIssuePath(path) {
|
|
16
|
+
if (path === void 0 || path.length === 0) return;
|
|
17
|
+
return path.map((segment) => {
|
|
18
|
+
const key = typeof segment === "object" ? segment.key : segment;
|
|
19
|
+
return typeof key === "symbol" ? key.toString() : String(key);
|
|
20
|
+
}).join(".");
|
|
21
|
+
}
|
|
22
|
+
/** Build a `CONSTRAINT_VIOLATED` message from a validator's issues. */
|
|
23
|
+
function issuesMessage(label, issues) {
|
|
24
|
+
return `${label} failed validation: ${issues.map((issue) => {
|
|
25
|
+
const path = formatIssuePath(issue.path);
|
|
26
|
+
return path === void 0 ? issue.message : `${path}: ${issue.message}`;
|
|
27
|
+
}).join("; ")}`;
|
|
28
|
+
}
|
|
29
|
+
/** Await a validator against a single value, mapping failure to a typed error. */
|
|
30
|
+
async function validateValue(label, value, validator) {
|
|
31
|
+
const result = await validator["~standard"].validate(value);
|
|
32
|
+
if (result.issues !== void 0) return {
|
|
33
|
+
ok: false,
|
|
34
|
+
error: new ValidationError(issuesMessage(label, result.issues), {
|
|
35
|
+
code: "CONSTRAINT_VIOLATED",
|
|
36
|
+
details: {
|
|
37
|
+
value,
|
|
38
|
+
issues: result.issues.map((issue) => issue.message)
|
|
39
|
+
},
|
|
40
|
+
suggest: `Provide a value for ${label} that satisfies its validator`
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
ok: true,
|
|
45
|
+
value: result.value
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validate resolved flag and arg values against any attached Standard Schema
|
|
50
|
+
* validators. Values without a validator, or resolved to `undefined`, pass
|
|
51
|
+
* through untouched.
|
|
52
|
+
*
|
|
53
|
+
* @param schema - The command schema carrying per-flag/arg validators.
|
|
54
|
+
* @param flags - Resolved flag values, keyed by flag name.
|
|
55
|
+
* @param args - Resolved arg values, keyed by arg name.
|
|
56
|
+
* @returns The (possibly transformed) values and any constraint violations.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
async function applyStandardValidators(schema, flags, args) {
|
|
60
|
+
const errors = [];
|
|
61
|
+
const nextFlags = { ...flags };
|
|
62
|
+
for (const [name, flagSchema] of Object.entries(schema.flags)) {
|
|
63
|
+
const value = flags[name];
|
|
64
|
+
if (value === void 0) continue;
|
|
65
|
+
const elementValidator = flagSchema.kind === "array" ? flagSchema.elementSchema?.standard : void 0;
|
|
66
|
+
if (elementValidator !== void 0 && Array.isArray(value)) {
|
|
67
|
+
const nextValue = [];
|
|
68
|
+
for (const [index, element] of value.entries()) {
|
|
69
|
+
const result = await validateValue(`--${name}[${index}]`, element, elementValidator);
|
|
70
|
+
if (result.ok) nextValue.push(result.value);
|
|
71
|
+
else {
|
|
72
|
+
nextValue.push(element);
|
|
73
|
+
errors.push(result.error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
nextFlags[name] = nextValue;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const validator = flagSchema.standard;
|
|
80
|
+
if (validator === void 0) continue;
|
|
81
|
+
const result = await validateValue(`--${name}`, value, validator);
|
|
82
|
+
if (result.ok) nextFlags[name] = result.value;
|
|
83
|
+
else errors.push(result.error);
|
|
84
|
+
}
|
|
85
|
+
const nextArgs = { ...args };
|
|
86
|
+
for (const entry of schema.args) {
|
|
87
|
+
const validator = entry.schema.standard;
|
|
88
|
+
const value = args[entry.name];
|
|
89
|
+
if (validator === void 0 || value === void 0) continue;
|
|
90
|
+
if (entry.schema.variadic && Array.isArray(value)) {
|
|
91
|
+
const nextValue = [];
|
|
92
|
+
for (const [index, element] of value.entries()) {
|
|
93
|
+
const result = await validateValue(`<${entry.name}>[${index}]`, element, validator);
|
|
94
|
+
if (result.ok) nextValue.push(result.value);
|
|
95
|
+
else {
|
|
96
|
+
nextValue.push(element);
|
|
97
|
+
errors.push(result.error);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
nextArgs[entry.name] = nextValue;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const result = await validateValue(`<${entry.name}>`, value, validator);
|
|
104
|
+
if (result.ok) nextArgs[entry.name] = result.value;
|
|
105
|
+
else errors.push(result.error);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
flags: nextFlags,
|
|
109
|
+
args: nextArgs,
|
|
110
|
+
errors
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { applyStandardValidators };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NumberConstraints } from "./number-constraints.mjs";
|
|
2
|
+
import { InferStandardOutput, StandardSchemaV1 } from "./standard.mjs";
|
|
2
3
|
//#region src/core/schema/arg.d.ts
|
|
3
4
|
/** All arg presence states as a runtime array. */
|
|
4
|
-
declare const ARG_PRESENCES: readonly [
|
|
5
|
+
declare const ARG_PRESENCES: readonly ["required", "optional", "defaulted"];
|
|
5
6
|
/**
|
|
6
7
|
* Presence describes whether a positional arg is guaranteed to exist when the
|
|
7
8
|
* action handler runs:
|
|
@@ -61,7 +62,7 @@ type InferArg<B> = B extends ArgBuilder<infer C extends ArgConfig> ? ResolvedArg
|
|
|
61
62
|
/** Extract resolved value types from a record of builders. */
|
|
62
63
|
type InferArgs<T extends Record<string, ArgBuilder<ArgConfig>>> = { [K in keyof T]: InferArg<T[K]>; };
|
|
63
64
|
/** All arg kind discriminators as a runtime array. */
|
|
64
|
-
declare const ARG_KINDS: readonly [
|
|
65
|
+
declare const ARG_KINDS: readonly ["string", "number", "enum", "custom"];
|
|
65
66
|
/** Discriminator for the kind of value an arg accepts. */
|
|
66
67
|
type ArgKind = (typeof ARG_KINDS)[number];
|
|
67
68
|
/** Custom parse function for `arg.custom()`. */
|
|
@@ -107,6 +108,15 @@ interface ArgSchema {
|
|
|
107
108
|
readonly numberConstraints: NumberConstraints | undefined;
|
|
108
109
|
/** Custom parse function (only when `kind === 'custom'`). */
|
|
109
110
|
readonly parseFn: ArgParseFn<unknown> | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Standard Schema v1 validator applied to the resolved value.
|
|
113
|
+
*
|
|
114
|
+
* When set, the value from any source (CLI, env, stdin, default) is
|
|
115
|
+
* validated after resolution via `~standard.validate`. Sync and async
|
|
116
|
+
* validators are both awaited; issues surface as a `CONSTRAINT_VIOLATED`
|
|
117
|
+
* {@link ValidationError}. Only meaningful when `kind === 'custom'`.
|
|
118
|
+
*/
|
|
119
|
+
readonly standard: StandardSchemaV1 | undefined;
|
|
110
120
|
/**
|
|
111
121
|
* Deprecation marker.
|
|
112
122
|
*
|
|
@@ -573,6 +583,31 @@ interface ArgFactory {
|
|
|
573
583
|
readonly variadic: false;
|
|
574
584
|
readonly argKind: 'enum';
|
|
575
585
|
}>;
|
|
586
|
+
/**
|
|
587
|
+
* Custom positional argument validated by a Standard Schema v1 validator
|
|
588
|
+
* (zod, valibot, arktype, …). The resolved value from any source is
|
|
589
|
+
* validated after resolution; the arg's value type is the validator's
|
|
590
|
+
* output type.
|
|
591
|
+
*
|
|
592
|
+
* Sync and async validators are both supported. Validation issues surface
|
|
593
|
+
* as a `CONSTRAINT_VIOLATED` error naming the argument.
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```ts
|
|
597
|
+
* import { z } from 'zod';
|
|
598
|
+
* arg.custom(z.string().uuid())
|
|
599
|
+
* // inferred type: string
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* @param schema - A Standard Schema v1 validator.
|
|
603
|
+
* @returns A required custom {@link ArgBuilder} typed to the validator's output.
|
|
604
|
+
*/
|
|
605
|
+
custom<S extends StandardSchemaV1>(schema: S): ArgBuilder<{
|
|
606
|
+
readonly valueType: InferStandardOutput<S>;
|
|
607
|
+
readonly presence: 'required';
|
|
608
|
+
readonly variadic: false;
|
|
609
|
+
readonly argKind: 'custom';
|
|
610
|
+
}>;
|
|
576
611
|
/**
|
|
577
612
|
* Custom-parsed positional argument. Required by default.
|
|
578
613
|
*
|
package/dist/core/schema/arg.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertNumberConstraints } from "./number-constraints.mjs";
|
|
2
|
+
import { isStandardSchemaV1 } from "./standard.mjs";
|
|
2
3
|
//#region src/core/schema/arg.ts
|
|
3
4
|
/**
|
|
4
5
|
* Positional argument schema builder with full type inference.
|
|
@@ -45,6 +46,7 @@ function createArgSchema(kind, overrides) {
|
|
|
45
46
|
enumValues: void 0,
|
|
46
47
|
numberConstraints: void 0,
|
|
47
48
|
parseFn: void 0,
|
|
49
|
+
standard: void 0,
|
|
48
50
|
deprecated: void 0,
|
|
49
51
|
...overrides
|
|
50
52
|
};
|
|
@@ -455,8 +457,9 @@ const arg = {
|
|
|
455
457
|
enum(values) {
|
|
456
458
|
return new ArgBuilder(createArgSchema("enum", { enumValues: values }));
|
|
457
459
|
},
|
|
458
|
-
custom(
|
|
459
|
-
return new ArgBuilder(createArgSchema("custom", {
|
|
460
|
+
custom(parseFnOrSchema) {
|
|
461
|
+
if (isStandardSchemaV1(parseFnOrSchema)) return new ArgBuilder(createArgSchema("custom", { standard: parseFnOrSchema }));
|
|
462
|
+
return new ArgBuilder(createArgSchema("custom", { parseFn: parseFnOrSchema }));
|
|
460
463
|
}
|
|
461
464
|
};
|
|
462
465
|
//#endregion
|
|
@@ -112,6 +112,13 @@ interface Out {
|
|
|
112
112
|
log(message: string): void;
|
|
113
113
|
/** Informational (may be suppressed in quiet mode). */
|
|
114
114
|
info(message: string): void;
|
|
115
|
+
/**
|
|
116
|
+
* Status line to stderr, suppressed in quiet mode.
|
|
117
|
+
*
|
|
118
|
+
* Keeps stdout clean for piping; for success and progress notes like
|
|
119
|
+
* `Wrote <path>` that scripts silence with `--quiet`.
|
|
120
|
+
*/
|
|
121
|
+
status(message: string): void;
|
|
115
122
|
/** Warning to stderr. */
|
|
116
123
|
warn(message: string): void;
|
|
117
124
|
/** Error to stderr. */
|
|
@@ -169,6 +176,15 @@ interface Out {
|
|
|
169
176
|
* ```
|
|
170
177
|
*/
|
|
171
178
|
readonly color: Colors;
|
|
179
|
+
/**
|
|
180
|
+
* Whether OSC 8 terminal hyperlinks should be emitted.
|
|
181
|
+
*
|
|
182
|
+
* Honors `NO_HYPERLINKS`/`FORCE_HYPERLINKS` and the
|
|
183
|
+
* `--no-hyperlinks`/`--hyperlinks` argv flags, falling back to `isTTY`.
|
|
184
|
+
* Handlers rendering their own `out.color.link(...)` output can gate on
|
|
185
|
+
* this to keep OSC 8 escapes out of piped or opted-out contexts.
|
|
186
|
+
*/
|
|
187
|
+
readonly isHyperlinkSupported: boolean;
|
|
172
188
|
/**
|
|
173
189
|
* Render tabular data.
|
|
174
190
|
*
|
|
@@ -362,13 +378,33 @@ type ExecutionStep = {
|
|
|
362
378
|
readonly kind: 'middleware';
|
|
363
379
|
readonly handler: ErasedMiddlewareHandler;
|
|
364
380
|
};
|
|
381
|
+
/**
|
|
382
|
+
* Program metadata passed to a function-form example, resolved at render time.
|
|
383
|
+
*
|
|
384
|
+
* `name` is the actually-invoked program name (`options.help.binName`, falling
|
|
385
|
+
* back to the command name) so examples stay truthful under symlinks,
|
|
386
|
+
* `inheritName`, and `npx x` vs a global install. `version` is the program
|
|
387
|
+
* version, or `undefined` when none is configured.
|
|
388
|
+
*/
|
|
389
|
+
interface ExampleMeta {
|
|
390
|
+
readonly name: string;
|
|
391
|
+
readonly version: string | undefined;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* An example command line: a literal string, or a function resolved at render
|
|
395
|
+
* time with the program {@link ExampleMeta} (so the program name need not be
|
|
396
|
+
* hardcoded).
|
|
397
|
+
*/
|
|
398
|
+
type ExampleCommand = string | ((meta: ExampleMeta) => string);
|
|
365
399
|
/** A single usage example shown in help text. */
|
|
366
400
|
interface CommandExample {
|
|
367
401
|
/** The command invocation (e.g. `'deploy production --force'`). */
|
|
368
|
-
readonly command:
|
|
402
|
+
readonly command: ExampleCommand;
|
|
369
403
|
/** Optional description of what this example does. */
|
|
370
404
|
readonly description?: string;
|
|
371
405
|
}
|
|
406
|
+
/** Resolve an {@link ExampleCommand} to its string form for the given meta. */
|
|
407
|
+
declare function resolveExampleCommand(command: ExampleCommand, meta: ExampleMeta): string;
|
|
372
408
|
/**
|
|
373
409
|
* Runtime descriptor produced by {@link CommandBuilder}.
|
|
374
410
|
*
|
|
@@ -764,7 +800,13 @@ declare class CommandBuilder<F extends Record<string, FlagBuilder<FlagConfig>> =
|
|
|
764
800
|
* Call multiple times to add several examples. Each example shows a
|
|
765
801
|
* shell invocation, optionally with a description.
|
|
766
802
|
*
|
|
767
|
-
*
|
|
803
|
+
* `cmd` may be a literal string or a function receiving the program
|
|
804
|
+
* {@link ExampleMeta} (`name`, `version`), resolved at render time. Use the
|
|
805
|
+
* function form to reference the invoked program name instead of hardcoding
|
|
806
|
+
* it, so examples stay truthful under symlinks, `inheritName`, and
|
|
807
|
+
* `npx x` vs a global install.
|
|
808
|
+
*
|
|
809
|
+
* @param cmd - The example command line, or a `(meta) => string` builder.
|
|
768
810
|
* @param description - Optional one-line explanation of what the example does.
|
|
769
811
|
*
|
|
770
812
|
* @example
|
|
@@ -773,19 +815,19 @@ declare class CommandBuilder<F extends Record<string, FlagBuilder<FlagConfig>> =
|
|
|
773
815
|
* .arg('target', arg.string())
|
|
774
816
|
* .flag('force', flag.boolean().alias('f'))
|
|
775
817
|
* .example('deploy production', 'Deploy to production')
|
|
776
|
-
* .example(
|
|
818
|
+
* .example((m) => `${m.name} deploy staging -f`, 'Force deploy to staging')
|
|
777
819
|
* .action(({ args, flags }) => { ... });
|
|
778
820
|
*
|
|
779
821
|
* // $ mycli deploy --help
|
|
780
822
|
* // ...
|
|
781
823
|
* // Examples:
|
|
782
|
-
* // deploy production
|
|
783
|
-
* // deploy staging -f
|
|
824
|
+
* // deploy production Deploy to production
|
|
825
|
+
* // mycli deploy staging -f Force deploy to staging
|
|
784
826
|
* ```
|
|
785
827
|
*
|
|
786
828
|
* @returns The builder (for chaining).
|
|
787
829
|
*/
|
|
788
|
-
example(cmd:
|
|
830
|
+
example(cmd: ExampleCommand, description?: string): CommandBuilder<F, A, C>;
|
|
789
831
|
/**
|
|
790
832
|
* Register a named flag on this command.
|
|
791
833
|
*
|
|
@@ -987,4 +1029,4 @@ declare function command(name: string): CommandBuilder;
|
|
|
987
1029
|
*/
|
|
988
1030
|
declare function group(name: string): CommandBuilder;
|
|
989
1031
|
//#endregion
|
|
990
|
-
export { type ActionHandler, type ActionParams, type AnyCommandBuilder, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type DeriveHandler, type DeriveParams, type ErasedActionHandler, type ErasedCommand, type ErasedDeriveHandler, type ErasedInteractiveResolver, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Out, type RunnableCommand, type WidenContext, type WidenDerivedContext, command, group };
|
|
1032
|
+
export { type ActionHandler, type ActionParams, type AnyCommandBuilder, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type DeriveHandler, type DeriveParams, type ErasedActionHandler, type ErasedCommand, type ErasedDeriveHandler, type ErasedInteractiveResolver, type ExampleCommand, type ExampleMeta, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Out, type RunnableCommand, type WidenContext, type WidenDerivedContext, command, group, resolveExampleCommand };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CLIError } from "../errors/index.mjs";
|
|
2
2
|
import { getFlagNegatedName } from "./flag.mjs";
|
|
3
3
|
//#region src/core/schema/command.ts
|
|
4
|
+
/** Resolve an {@link ExampleCommand} to its string form for the given meta. */
|
|
5
|
+
function resolveExampleCommand(command, meta) {
|
|
6
|
+
return typeof command === "function" ? command(meta) : command;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Validate a new arg entry against invariants before adding it to the command.
|
|
6
10
|
*
|
|
@@ -430,7 +434,13 @@ var CommandBuilder = class CommandBuilder {
|
|
|
430
434
|
* Call multiple times to add several examples. Each example shows a
|
|
431
435
|
* shell invocation, optionally with a description.
|
|
432
436
|
*
|
|
433
|
-
*
|
|
437
|
+
* `cmd` may be a literal string or a function receiving the program
|
|
438
|
+
* {@link ExampleMeta} (`name`, `version`), resolved at render time. Use the
|
|
439
|
+
* function form to reference the invoked program name instead of hardcoding
|
|
440
|
+
* it, so examples stay truthful under symlinks, `inheritName`, and
|
|
441
|
+
* `npx x` vs a global install.
|
|
442
|
+
*
|
|
443
|
+
* @param cmd - The example command line, or a `(meta) => string` builder.
|
|
434
444
|
* @param description - Optional one-line explanation of what the example does.
|
|
435
445
|
*
|
|
436
446
|
* @example
|
|
@@ -439,14 +449,14 @@ var CommandBuilder = class CommandBuilder {
|
|
|
439
449
|
* .arg('target', arg.string())
|
|
440
450
|
* .flag('force', flag.boolean().alias('f'))
|
|
441
451
|
* .example('deploy production', 'Deploy to production')
|
|
442
|
-
* .example(
|
|
452
|
+
* .example((m) => `${m.name} deploy staging -f`, 'Force deploy to staging')
|
|
443
453
|
* .action(({ args, flags }) => { ... });
|
|
444
454
|
*
|
|
445
455
|
* // $ mycli deploy --help
|
|
446
456
|
* // ...
|
|
447
457
|
* // Examples:
|
|
448
|
-
* // deploy production
|
|
449
|
-
* // deploy staging -f
|
|
458
|
+
* // deploy production Deploy to production
|
|
459
|
+
* // mycli deploy staging -f Force deploy to staging
|
|
450
460
|
* ```
|
|
451
461
|
*
|
|
452
462
|
* @returns The builder (for chaining).
|
|
@@ -723,4 +733,4 @@ function group(name) {
|
|
|
723
733
|
return command(name);
|
|
724
734
|
}
|
|
725
735
|
//#endregion
|
|
726
|
-
export { CommandBuilder, command, group };
|
|
736
|
+
export { CommandBuilder, command, group, resolveExampleCommand };
|