@kjanat/dreamcli 3.0.0-rc.9 → 3.0.1
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 +262 -1
- package/README.md +32 -13
- package/dist/core/cli/dispatch.mjs +0 -11
- package/dist/core/cli/index.d.mts +133 -9
- package/dist/core/cli/index.mjs +108 -21
- 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 +6 -2
- 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 +7 -8
- package/dist/core/json-schema/index.mjs +271 -88
- 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 +77 -9
- 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 +5 -4
- package/dist/index.mjs +4 -4
- 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 +82 -0
- 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 +26 -31
- package/skills/cli-creation/SKILL.md +140 -0
- package/skills/cli-creation/agents/openai.yaml +4 -0
- package/skills/cli-creation/assets/templates/multi-command.bun-test.ts.tpl +20 -0
- package/skills/cli-creation/assets/templates/multi-command.test.ts.tpl +20 -0
- package/skills/cli-creation/assets/templates/multi-command.ts.tpl +89 -0
- package/skills/cli-creation/assets/templates/single-command.bun-test.ts.tpl +29 -0
- package/skills/cli-creation/assets/templates/single-command.test.ts.tpl +29 -0
- package/skills/cli-creation/assets/templates/single-command.ts.tpl +47 -0
- package/skills/cli-creation/references/consumer-workflow.md +65 -0
- package/skills/cli-creation/references/pattern-cookbook.md +293 -0
- package/skills/cli-creation/references/runtime-notes.md +29 -0
- package/skills/cli-creation/scripts/scaffold_cli.py +360 -0
- 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,20 @@
|
|
|
1
|
+
import { partyStart } from '__ENTRY_FILE__';
|
|
2
|
+
import { runCommand } from '@kjanat/dreamcli/testkit';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
describe('party start command', () => {
|
|
6
|
+
it('applies sparkle middleware when --sparkle is set', async () => {
|
|
7
|
+
const result = await runCommand(partyStart, ['--theme', 'midnight', '--sparkle']);
|
|
8
|
+
|
|
9
|
+
expect(result.exitCode).toBe(0);
|
|
10
|
+
expect(result.stdout).toEqual(['✨ Party started with midnight theme! ✨\n']);
|
|
11
|
+
expect(result.stderr).toEqual([]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders help text', async () => {
|
|
15
|
+
const result = await runCommand(partyStart, ['--help']);
|
|
16
|
+
|
|
17
|
+
expect(result.exitCode).toBe(0);
|
|
18
|
+
expect(result.stdout.join('')).toContain('Start the pony party');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* __CLI_NAME__ - multi-command DreamCLI starter (pony party edition).
|
|
4
|
+
*
|
|
5
|
+
* Bun:
|
|
6
|
+
* bun __CLI_NAME__.ts snack cupcake --count 3
|
|
7
|
+
* bun __CLI_NAME__.ts story "rainbow heist" --mood legendary --sparkle
|
|
8
|
+
* bun __CLI_NAME__.ts party start --theme midnight
|
|
9
|
+
* bun __CLI_NAME__.ts --help
|
|
10
|
+
*
|
|
11
|
+
* npm/tsx:
|
|
12
|
+
* npx tsx __CLI_NAME__.ts party playlist --genre chaos
|
|
13
|
+
*
|
|
14
|
+
* Deno:
|
|
15
|
+
* deno run -A __CLI_NAME__.ts snack donut --count 2
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { arg, cli, command, flag, group, middleware } from '@kjanat/dreamcli';
|
|
19
|
+
|
|
20
|
+
const sparkle = middleware<{ sparkle: (message: string) => string }>(async ({ flags, next }) => {
|
|
21
|
+
const sparkleEnabled = flags.sparkle === true;
|
|
22
|
+
return next({
|
|
23
|
+
sparkle: (message: string) => (sparkleEnabled ? `✨ ${message} ✨` : message),
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const sparkleFlag = () => flag.boolean().alias('s').env('SPARKLE').describe('Add extra sparkle');
|
|
28
|
+
|
|
29
|
+
export const snack = command('snack')
|
|
30
|
+
.description('Serve snacks to the crew')
|
|
31
|
+
.arg('treat', arg.string().default('cupcake').describe('Snack to serve'))
|
|
32
|
+
.flag('count', flag.number().default(1).alias('c').describe('How many snacks'))
|
|
33
|
+
.flag('sparkle', sparkleFlag())
|
|
34
|
+
.middleware(sparkle)
|
|
35
|
+
.action(({ args, flags, ctx, out }) => {
|
|
36
|
+
const { treat } = args;
|
|
37
|
+
const { count } = flags;
|
|
38
|
+
out.log(ctx.sparkle(`Serving ${count} ${treat}(s)!`));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const story = command('story')
|
|
42
|
+
.description('Tell a dramatic story')
|
|
43
|
+
.arg('topic', arg.string().default('the great cupcake rescue').describe('Story topic'))
|
|
44
|
+
.flag('mood', flag.enum(['calm', 'chaos', 'legendary'])
|
|
45
|
+
.prompt({ kind: 'select', message: 'Set the mood!' })
|
|
46
|
+
.default('calm').describe('Story mood'))
|
|
47
|
+
.flag('sparkle', sparkleFlag())
|
|
48
|
+
.middleware(sparkle)
|
|
49
|
+
.action(({ args, flags, ctx, out }) => {
|
|
50
|
+
const { topic } = args;
|
|
51
|
+
const { mood } = flags;
|
|
52
|
+
out.log(ctx.sparkle(`Story time: ${topic} (${mood})`));
|
|
53
|
+
out.log(ctx.sparkle('Dramatic glitter intensifies'));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const partyStart = command('start')
|
|
57
|
+
.description('Start the pony party')
|
|
58
|
+
.flag('theme', flag.enum(['rainbow', 'midnight', 'glitter']).default('rainbow').describe('Party theme'))
|
|
59
|
+
.flag('sparkle', sparkleFlag())
|
|
60
|
+
.middleware(sparkle)
|
|
61
|
+
.action(({ flags, ctx, out }) => {
|
|
62
|
+
out.log(ctx.sparkle(`Party started with ${flags.theme} theme!`));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const partyPlaylist = command('playlist')
|
|
66
|
+
.description('Pick a party playlist vibe')
|
|
67
|
+
.flag('genre', flag.enum(['pop', 'ballad', 'chaos']).default('pop').describe('Playlist genre'))
|
|
68
|
+
.flag('sparkle', sparkleFlag())
|
|
69
|
+
.middleware(sparkle)
|
|
70
|
+
.action(({ flags, ctx, out }) => {
|
|
71
|
+
out.log(ctx.sparkle(`Now playing: ${flags.genre}`));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const party = group('party')
|
|
75
|
+
.description('Party controls')
|
|
76
|
+
.command(partyStart)
|
|
77
|
+
.command(partyPlaylist);
|
|
78
|
+
|
|
79
|
+
export const app = cli('__CLI_NAME__')
|
|
80
|
+
.version('0.1.0')
|
|
81
|
+
.description('Fun DreamCLI starter app')
|
|
82
|
+
.command(snack)
|
|
83
|
+
.command(story)
|
|
84
|
+
.command(party)
|
|
85
|
+
.completions();
|
|
86
|
+
|
|
87
|
+
if (import.meta.main) {
|
|
88
|
+
app.run();
|
|
89
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { hello } from '__ENTRY_FILE__';
|
|
2
|
+
import { runCommand } from '@kjanat/dreamcli/testkit';
|
|
3
|
+
import { describe, expect, it } from 'bun:test';
|
|
4
|
+
|
|
5
|
+
describe('hello command', () => {
|
|
6
|
+
it('prints sparkly greeting when --sparkle is set', async () => {
|
|
7
|
+
const result = await runCommand(hello, ['Twilight', '--sparkle', '--times', '2']);
|
|
8
|
+
|
|
9
|
+
expect(result.exitCode).toBe(0);
|
|
10
|
+
expect(result.stdout).toEqual(['✨ Hello, Twilight! ✨\n', '✨ Hello, Twilight! ✨\n']);
|
|
11
|
+
// out.status() writes to stderr so stdout stays pipe-clean.
|
|
12
|
+
expect(result.stderr).toEqual(['Greeted Twilight 2 time(s)\n']);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('suppresses status output with --quiet', async () => {
|
|
16
|
+
const result = await runCommand(hello, ['Twilight', '--quiet']);
|
|
17
|
+
|
|
18
|
+
expect(result.exitCode).toBe(0);
|
|
19
|
+
expect(result.stdout).toEqual(['Hello, Twilight!\n']);
|
|
20
|
+
expect(result.stderr).toEqual([]);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders help text', async () => {
|
|
24
|
+
const result = await runCommand(hello, ['--help']);
|
|
25
|
+
|
|
26
|
+
expect(result.exitCode).toBe(0);
|
|
27
|
+
expect(result.stdout.join('')).toContain('Say hello with optional sparkle');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { hello } from '__ENTRY_FILE__';
|
|
2
|
+
import { runCommand } from '@kjanat/dreamcli/testkit';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
describe('hello command', () => {
|
|
6
|
+
it('prints sparkly greeting when --sparkle is set', async () => {
|
|
7
|
+
const result = await runCommand(hello, ['Twilight', '--sparkle', '--times', '2']);
|
|
8
|
+
|
|
9
|
+
expect(result.exitCode).toBe(0);
|
|
10
|
+
expect(result.stdout).toEqual(['✨ Hello, Twilight! ✨\n', '✨ Hello, Twilight! ✨\n']);
|
|
11
|
+
// out.status() writes to stderr so stdout stays pipe-clean.
|
|
12
|
+
expect(result.stderr).toEqual(['Greeted Twilight 2 time(s)\n']);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('suppresses status output with --quiet', async () => {
|
|
16
|
+
const result = await runCommand(hello, ['Twilight', '--quiet']);
|
|
17
|
+
|
|
18
|
+
expect(result.exitCode).toBe(0);
|
|
19
|
+
expect(result.stdout).toEqual(['Hello, Twilight!\n']);
|
|
20
|
+
expect(result.stderr).toEqual([]);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders help text', async () => {
|
|
24
|
+
const result = await runCommand(hello, ['--help']);
|
|
25
|
+
|
|
26
|
+
expect(result.exitCode).toBe(0);
|
|
27
|
+
expect(result.stdout.join('')).toContain('Say hello with optional sparkle');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* __CLI_NAME__ - hello-world DreamCLI starter.
|
|
4
|
+
*
|
|
5
|
+
* Bun:
|
|
6
|
+
* bun __CLI_NAME__.ts
|
|
7
|
+
* bun __CLI_NAME__.ts Twilight --sparkle --times 2
|
|
8
|
+
* bun __CLI_NAME__.ts --help
|
|
9
|
+
*
|
|
10
|
+
* npm/tsx:
|
|
11
|
+
* npx tsx __CLI_NAME__.ts Twilight --sparkle --times 2
|
|
12
|
+
*
|
|
13
|
+
* Deno:
|
|
14
|
+
* deno run -A __CLI_NAME__.ts Twilight --sparkle --times 2
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { arg, cli, command, flag, middleware } from '@kjanat/dreamcli';
|
|
18
|
+
|
|
19
|
+
const sparkle = middleware<{ sparkle: (message: string) => string }>(async ({ flags, next }) => {
|
|
20
|
+
const sparkleEnabled = flags.sparkle === true;
|
|
21
|
+
return next({
|
|
22
|
+
sparkle: (message: string) => (sparkleEnabled ? `✨ ${message} ✨` : message),
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const hello = command('hello')
|
|
27
|
+
.description('Say hello with optional sparkle')
|
|
28
|
+
.example(({ name }) => `${name} Twilight --sparkle --times 2`, 'Sparkly double greeting')
|
|
29
|
+
.arg('name', arg.string().default('World').describe('Who to greet'))
|
|
30
|
+
.flag('sparkle', flag.boolean().alias('s').env('SPARKLE').describe('Add sparkles'))
|
|
31
|
+
// Constraints are enforced at every source, so the action needs no clamping.
|
|
32
|
+
.flag('times', flag.number({ int: true, min: 0, max: 100 }).default(1).alias('n').describe('Repeat count'))
|
|
33
|
+
.middleware(sparkle)
|
|
34
|
+
.action(({ args, flags, ctx, out }) => {
|
|
35
|
+
for (let i = 0; i < flags.times; i++) {
|
|
36
|
+
out.log(ctx.sparkle(`Hello, ${args.name}!`));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// stderr, and silenced by --quiet: keeps stdout pipe-clean.
|
|
40
|
+
out.status(`Greeted ${args.name} ${flags.times} time(s)`);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const app = cli('__CLI_NAME__').default(hello);
|
|
44
|
+
|
|
45
|
+
if (import.meta.main) {
|
|
46
|
+
app.run();
|
|
47
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Consumer Workflow
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Build a consumer-facing CLI app with DreamCLI 3.x, starting from a working
|
|
6
|
+
template and ending with validated behavior.
|
|
7
|
+
|
|
8
|
+
## Inputs to confirm
|
|
9
|
+
|
|
10
|
+
- CLI name (`--name`).
|
|
11
|
+
- Surface shape (`single` or `multi`).
|
|
12
|
+
- Whether tests should be skipped (`--no-test`).
|
|
13
|
+
- Runtime the user runs on (Bun, npm/tsx, Deno).
|
|
14
|
+
- Whether the CLI needs machine-readable output, config files, or prompts —
|
|
15
|
+
each adds declarations to the schema rather than code to the action.
|
|
16
|
+
|
|
17
|
+
## Implementation flow
|
|
18
|
+
|
|
19
|
+
1. Scaffold starter files.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python scripts/scaffold_cli.py --name mycli --mode single --out .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The scaffolder detects the package manager and Vitest usage to choose either
|
|
26
|
+
a `bun:test` or Vitest starter test template.
|
|
27
|
+
|
|
28
|
+
2. Shape the command surface.
|
|
29
|
+
|
|
30
|
+
- `.description(...)` on every command; it is what `--help` shows.
|
|
31
|
+
- Function-form `.example()` so examples print the real program name.
|
|
32
|
+
- Typed `.arg(...)` and `.flag(...)` declarations before any logic.
|
|
33
|
+
- A single root command belongs in `.default(cmd)`; add `{ route: true }`
|
|
34
|
+
only if `mycli <name>` should also work.
|
|
35
|
+
|
|
36
|
+
3. Declare where values come from.
|
|
37
|
+
|
|
38
|
+
- `.env('...')`, `.config('...')`, `.prompt(...)`, `.default(...)`.
|
|
39
|
+
- Constraints (`{ int: true, min: 1 }`, `{ nonEmpty: true }`) or a Standard
|
|
40
|
+
Schema in `flag.custom(...)` instead of validation code in the action.
|
|
41
|
+
- Cross-flag rules go in `.derive()`, not the action.
|
|
42
|
+
|
|
43
|
+
4. Choose output behavior deliberately.
|
|
44
|
+
|
|
45
|
+
- `out.log()` for the result a user pipes.
|
|
46
|
+
- `out.status()` for progress notes — stderr, silenced by `--quiet`.
|
|
47
|
+
- `out.table()` for list-shaped data.
|
|
48
|
+
- `out.json(data)` behind `if (out.jsonMode)`, never mixed with prose.
|
|
49
|
+
- `out.setExitCode(code)` for check/status commands that must still print.
|
|
50
|
+
|
|
51
|
+
5. Validate behavior.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bun ./mycli.ts --help
|
|
55
|
+
bun ./mycli.ts --json | jq . # stdout must parse
|
|
56
|
+
bun test ./mycli.test.ts
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Done criteria
|
|
60
|
+
|
|
61
|
+
- `--help` renders expected command, flag, and example text.
|
|
62
|
+
- Happy-path execution exits `0`; failure paths exit non-zero with a `suggest`.
|
|
63
|
+
- `--json` stdout parses on its own — no human text, no progress lines.
|
|
64
|
+
- `--quiet` silences status output without hiding warnings or errors.
|
|
65
|
+
- Generated or custom tests pass, including trailing-newline assertions.
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Pattern Cookbook
|
|
2
|
+
|
|
3
|
+
Copy-ready snippets for DreamCLI 3.x. Every snippet type-checks against the
|
|
4
|
+
published types.
|
|
5
|
+
|
|
6
|
+
## Values
|
|
7
|
+
|
|
8
|
+
### Flag precedence chain
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
flag
|
|
12
|
+
.enum(['us', 'eu', 'ap'])
|
|
13
|
+
.env('DEPLOY_REGION')
|
|
14
|
+
.config('deploy.region')
|
|
15
|
+
.prompt({ kind: 'select', message: 'Which region?' })
|
|
16
|
+
.default('us');
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Resolution order is fixed: CLI argv, env, config, prompt, default. Declare the
|
|
20
|
+
sources a value may come from; never merge them by hand in the action.
|
|
21
|
+
|
|
22
|
+
### Rich flag types
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
flag.url({ protocols: ['https'] }); // URL
|
|
26
|
+
flag.path({ type: 'directory', create: true }); // string, mkdir -p when missing
|
|
27
|
+
flag.date({ min: new Date('2020-01-01') }); // Date, strict ISO-8601
|
|
28
|
+
flag.duration(); // number (ms) — '30s', '1h30m', '250ms'
|
|
29
|
+
flag.bytes(); // number — '512mb', '1.5gb'
|
|
30
|
+
flag.count().alias('v'); // number — -vvv is 3
|
|
31
|
+
flag.keyValue(); // Record<string, string> — repeated KEY=VALUE
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Prefer these over `flag.string()` plus hand-rolled parsing: they validate at
|
|
35
|
+
every source, feed help placeholders, and land in the exported JSON Schema.
|
|
36
|
+
|
|
37
|
+
`flag.path()` checks run through the runtime adapter after resolution. In
|
|
38
|
+
process-free execution pass `stat` (and `mkdir` for `create`) via run options,
|
|
39
|
+
or the checks are skipped.
|
|
40
|
+
|
|
41
|
+
### Constraints instead of hand-written validation
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
flag.number({ int: true, min: 1, max: 65535 }); // port
|
|
45
|
+
flag.string({ nonEmpty: true, pattern: /^[a-z][a-z0-9-]*$/ }); // slug
|
|
46
|
+
flag.number().finite(false); // opt back into Infinity
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Constraints are enforced on CLI parse (`INVALID_VALUE`) and on env/config/prompt
|
|
50
|
+
resolution (`CONSTRAINT_VIOLATED`), both exit code 2. `finite` defaults to
|
|
51
|
+
`true`, so `Infinity` is rejected unless you opt out.
|
|
52
|
+
|
|
53
|
+
### Standard Schema validation
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { z } from 'zod';
|
|
57
|
+
|
|
58
|
+
flag.custom(z.coerce.number().int().positive());
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Any Standard Schema v1 validator works (Zod, Valibot, ArkType) with the output
|
|
62
|
+
type inferred. Validation runs after source resolution, so every source is
|
|
63
|
+
checked identically; array flags validate per element.
|
|
64
|
+
|
|
65
|
+
### Array flags
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
flag
|
|
69
|
+
.array(flag.enum(['us', 'eu', 'ap']))
|
|
70
|
+
.separator(',')
|
|
71
|
+
.unique();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`--region us,eu --region ap` and repetition both work. Put flag-level modifiers
|
|
75
|
+
(`.env()`, `.default()`, …) on the array, never on the element — that is a
|
|
76
|
+
compile error.
|
|
77
|
+
|
|
78
|
+
## Parser behavior
|
|
79
|
+
|
|
80
|
+
### Negatable booleans
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
flag.boolean().default(true).negatable(); // --sandbox / --no-sandbox
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
One logical flag with two spellings; help renders `--[no-]sandbox`. The negated
|
|
87
|
+
spelling is presence-only (`--no-sandbox=false` errors).
|
|
88
|
+
|
|
89
|
+
### Duplicate policy
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
flag.enum(['session', 'worktree']).duplicates('error');
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Config-style flags should reject repeats rather than silently taking the last
|
|
96
|
+
value. `'error'` throws `ParseError` code `DUPLICATE_FLAG`; `'first'` keeps the
|
|
97
|
+
first. Counted per logical flag, including aliases and negated spellings.
|
|
98
|
+
|
|
99
|
+
### Cross-flag rules
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
command('serve')
|
|
103
|
+
.flag('port', flag.number({ int: true }))
|
|
104
|
+
.flag('socket', flag.string())
|
|
105
|
+
.derive(({ flags }) => {
|
|
106
|
+
if (flags.port !== undefined && flags.socket !== undefined) {
|
|
107
|
+
throw new CLIError('--port and --socket are mutually exclusive', {
|
|
108
|
+
code: 'INVALID_FLAG_COMBINATION',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return { mode: flags.socket !== undefined ? 'socket' : 'tcp' } as const;
|
|
112
|
+
})
|
|
113
|
+
.action(({ ctx }) => {
|
|
114
|
+
ctx.mode; // typed, available to the action
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`.derive()` runs after resolution and before the action. It is the home for
|
|
119
|
+
rules DreamCLI cannot express declaratively, and its return value widens `ctx`.
|
|
120
|
+
|
|
121
|
+
## Output
|
|
122
|
+
|
|
123
|
+
### Channels
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
.action(({ out }) => {
|
|
127
|
+
out.log('primary result'); // stdout (stderr in --json)
|
|
128
|
+
out.status('working on it'); // stderr, hidden by --quiet
|
|
129
|
+
out.warn('deprecated flag used');// stderr, always shown
|
|
130
|
+
out.error('could not reach api');// stderr, always shown
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Keep stdout free of progress chatter so pipes stay clean. `--quiet`/`-q` is a
|
|
135
|
+
global flag; it silences `status` and `info` but never warnings or errors.
|
|
136
|
+
|
|
137
|
+
### JSON mode branching
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
.action(({ out }) => {
|
|
141
|
+
const data = { service: 'api', healthy: true };
|
|
142
|
+
|
|
143
|
+
if (out.jsonMode) {
|
|
144
|
+
out.json(data);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
out.log('Service api is healthy');
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Never mix human text into stdout in the same branch as `out.json()`.
|
|
153
|
+
|
|
154
|
+
### Tables
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
out.table(rows, [
|
|
158
|
+
{ key: 'name', header: 'Service' },
|
|
159
|
+
{ key: 'status', header: 'Status' },
|
|
160
|
+
]);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Text table for humans, array for `--json`. Columns are optional
|
|
164
|
+
(`out.table(rows)` infers them); pass `{ format: 'text', stream: 'stderr' }` to
|
|
165
|
+
force a human table alongside JSON stdout.
|
|
166
|
+
|
|
167
|
+
### Colors and hyperlinks
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
.action(({ out }) => {
|
|
171
|
+
out.log(out.color.green('✔ done'));
|
|
172
|
+
if (out.isHyperlinkSupported) out.log(osc8('https://example.com', 'docs'));
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Every `out.color` formatter is an identity function when color is off (piped,
|
|
177
|
+
`NO_COLOR`, `--json`), so no branching is needed. Hyperlinks garble piped
|
|
178
|
+
output, so gate them on `out.isHyperlinkSupported`.
|
|
179
|
+
|
|
180
|
+
### Exit code without an error
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
.action(({ out }) => {
|
|
184
|
+
out.log('3 of 5 checks failed');
|
|
185
|
+
out.setExitCode(1);
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
For check/status commands: keeps normal output, avoids an error payload in
|
|
190
|
+
`--json`, still signals scripts.
|
|
191
|
+
|
|
192
|
+
### Structured errors
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
throw new CLIError('Deployment target not found', {
|
|
196
|
+
code: 'NOT_FOUND',
|
|
197
|
+
exitCode: 1,
|
|
198
|
+
suggest: 'Run: mycli deploy --help',
|
|
199
|
+
details: { requested: name },
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Serializes cleanly in `--json` mode and prints a suggestion line otherwise.
|
|
204
|
+
|
|
205
|
+
## Surface
|
|
206
|
+
|
|
207
|
+
### Help configuration
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
cli('mycli').help({
|
|
211
|
+
flagOrder: 'declaration', // or a sortFlags comparator
|
|
212
|
+
theme: (c) => ({ sectionTitle: c.magenta }),
|
|
213
|
+
footer: false,
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The theme factory receives the gated palette and never runs when color is off,
|
|
218
|
+
so a custom theme cannot leak escapes into piped output.
|
|
219
|
+
|
|
220
|
+
### Examples that know the program name
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
command('deploy').example(({ name }) => `${name} deploy production --force`, 'Force a deploy');
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The builder form resolves at render time, so examples stay truthful under
|
|
227
|
+
symlinks, `inheritName`, and `npx` versus a global install.
|
|
228
|
+
|
|
229
|
+
### Default command
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
cli('mycli').default(serve); // root surface only: `mycli --port 80`
|
|
233
|
+
cli('mycli').default(serve, { route: true }); // also `mycli serve`
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
A plain `.default()` is the root surface and is not routable by name; the token
|
|
237
|
+
would be read as its first positional.
|
|
238
|
+
|
|
239
|
+
### Completions
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
cli('mycli').completions(); // mycli completions <shell>
|
|
243
|
+
cli('mycli').completions({ as: 'flag' }); // mycli --completions (shell auto-detected)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Config discovery
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
cli('mycli')
|
|
250
|
+
.config('mycli')
|
|
251
|
+
.configLoader(configFormat(['yaml', 'yml'], parseYaml));
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Discovery probes project scope (cwd and every ancestor: `.mycli.json`,
|
|
255
|
+
`mycli.config.json`, `.config/mycli.json`), then user scope (XDG/AppData, plus
|
|
256
|
+
`~/Library/Application Support` on macOS), then `/etc`. First match wins; files
|
|
257
|
+
are never merged. `--config <path>` overrides everything.
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
### In-process command test
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import { runCommand } from '@kjanat/dreamcli/testkit';
|
|
265
|
+
|
|
266
|
+
const result = await runCommand(deploy, ['production', '--force']);
|
|
267
|
+
expect(result.exitCode).toBe(0);
|
|
268
|
+
expect(result.stdout).toEqual(['Deploying production to us\n']);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Prefer `runCommand()` over subprocess tests: faster, deterministic, and it
|
|
272
|
+
captures stdout/stderr as arrays of written chunks — assert trailing newlines.
|
|
273
|
+
|
|
274
|
+
### Injecting the environment
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
await runCommand(deploy, ['--json'], {
|
|
278
|
+
env: { DEPLOY_REGION: 'eu' },
|
|
279
|
+
config: { deploy: { region: 'ap' } },
|
|
280
|
+
answers: ['production'], // queued prompt answers
|
|
281
|
+
stat: async (p) => (p === '/data' ? 'directory' : null),
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Prompts are skipped in non-interactive contexts, so queue `answers` when a test
|
|
286
|
+
exercises one. Without `stat`, `flag.path()` checks are skipped entirely.
|
|
287
|
+
|
|
288
|
+
### Asserting JSON output
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
const result = await runCommand(status, ['--json']);
|
|
292
|
+
expect(JSON.parse(result.stdout.join(''))).toEqual({ healthy: true });
|
|
293
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Runtime Notes
|
|
2
|
+
|
|
3
|
+
## Bun-first commands
|
|
4
|
+
|
|
5
|
+
- Run CLI entrypoint: `bun mycli.ts --help`
|
|
6
|
+
- Run tests: `bun test mycli.test.ts`
|
|
7
|
+
|
|
8
|
+
The scaffolder prints path-aware run commands; use those exact printed paths when `--out` is not `.`.
|
|
9
|
+
The scaffolder auto-detects test style:
|
|
10
|
+
|
|
11
|
+
- Bun project + no detected Vitest usage: generate `bun:test` template.
|
|
12
|
+
- Otherwise: generate Vitest template.
|
|
13
|
+
- Package manager detection checks lockfiles (including `pnpm-*.yaml/.yml`) and manifest `packageManager` entries in `package.json`, `package.json5`, and `package.yaml/.yml`.
|
|
14
|
+
|
|
15
|
+
If Vitest template is generated inside a Bun project, `bun test` still runs those tests in this workflow.
|
|
16
|
+
|
|
17
|
+
## npm/Node alternative
|
|
18
|
+
|
|
19
|
+
- Run CLI entrypoint: `npx tsx mycli.ts --help`
|
|
20
|
+
- Run tests: `npx vitest run mycli.test.ts`
|
|
21
|
+
|
|
22
|
+
## Deno alternative
|
|
23
|
+
|
|
24
|
+
- Run CLI entrypoint: `deno run -A mycli.ts --help`
|
|
25
|
+
- Run tests: use Bun/Node test tooling unless the project already has Deno test wiring.
|
|
26
|
+
|
|
27
|
+
## Prompt behavior
|
|
28
|
+
|
|
29
|
+
DreamCLI skips prompts in non-interactive contexts (CI/piped input). When tests depend on prompts, inject answers with `runCommand(..., { answers: [...] })`.
|