@kjanat/dreamcli 3.0.0-rc.2 → 3.0.0-rc.20
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 +374 -1
- package/README.md +3 -3
- package/dist/core/cli/dispatch.d.mts +6 -5
- package/dist/core/cli/dispatch.mjs +7 -16
- package/dist/core/cli/help-links.d.mts +0 -1
- package/dist/core/cli/index.d.mts +213 -16
- package/dist/core/cli/index.mjs +174 -43
- package/dist/core/cli/planner.d.mts +5 -1
- package/dist/core/cli/planner.mjs +19 -13
- package/dist/core/cli/plugin.d.mts +1 -1
- package/dist/core/cli/propagate.d.mts +1 -1
- package/dist/core/cli/root-help.d.mts +2 -1
- package/dist/core/cli/root-help.mjs +45 -22
- package/dist/core/cli/root-surface.d.mts +12 -1
- package/dist/core/cli/root-surface.mjs +2 -1
- package/dist/core/cli/runtime-preflight.d.mts +18 -2
- package/dist/core/cli/runtime-preflight.mjs +10 -7
- package/dist/core/completion/index.d.mts +0 -1
- package/dist/core/completion/index.mjs +1 -1
- package/dist/core/completion/shells/bash.d.mts +0 -1
- package/dist/core/completion/shells/bash.mjs +8 -4
- package/dist/core/completion/shells/fish.d.mts +0 -1
- package/dist/core/completion/shells/fish.mjs +6 -3
- package/dist/core/completion/shells/powershell.d.mts +0 -1
- package/dist/core/completion/shells/powershell.mjs +10 -5
- package/dist/core/completion/shells/shared.d.mts +13 -2
- package/dist/core/completion/shells/shared.mjs +25 -2
- package/dist/core/completion/shells/zsh.d.mts +0 -1
- package/dist/core/completion/shells/zsh.mjs +11 -4
- package/dist/core/config/index.d.mts +44 -14
- package/dist/core/config/index.mjs +57 -18
- package/dist/core/config/package-json.d.mts +28 -4
- package/dist/core/config/package-json.mjs +20 -19
- package/dist/core/errors/index.d.mts +3 -3
- package/dist/core/execution/index.d.mts +0 -1
- package/dist/core/execution/index.mjs +20 -4
- package/dist/core/help/ansi.d.mts +11 -5
- package/dist/core/help/ansi.mjs +15 -16
- package/dist/core/help/index.d.mts +44 -3
- package/dist/core/help/index.mjs +130 -68
- package/dist/core/help/theme.d.mts +68 -0
- package/dist/core/help/theme.mjs +46 -0
- package/dist/core/json-schema/index.d.mts +21 -9
- package/dist/core/json-schema/index.mjs +316 -87
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +55 -38
- package/dist/core/json-schema/meta-descriptions.generated.mjs +14 -5
- package/dist/core/output/activity.d.mts +0 -1
- package/dist/core/output/contracts.d.mts +5 -6
- package/dist/core/output/contracts.mjs +2 -2
- package/dist/core/output/index.d.mts +38 -2
- package/dist/core/output/index.mjs +37 -2
- package/dist/core/output/renderers.d.mts +0 -1
- package/dist/core/parse/index.d.mts +40 -7
- package/dist/core/parse/index.mjs +212 -40
- package/dist/core/prompt/index.d.mts +1 -0
- package/dist/core/resolve/args.d.mts +1 -1
- package/dist/core/resolve/coerce.d.mts +1 -1
- package/dist/core/resolve/coerce.mjs +71 -14
- package/dist/core/resolve/contracts.d.mts +14 -4
- package/dist/core/resolve/errors.d.mts +0 -1
- package/dist/core/resolve/flags.d.mts +9 -2
- package/dist/core/resolve/flags.mjs +78 -6
- package/dist/core/resolve/index.d.mts +2 -2
- package/dist/core/resolve/index.mjs +6 -1
- package/dist/core/resolve/property.d.mts +4 -1
- package/dist/core/resolve/property.mjs +11 -3
- package/dist/core/resolve/standard.d.mts +24 -0
- package/dist/core/resolve/standard.mjs +114 -0
- package/dist/core/schema/activity.d.mts +31 -11
- package/dist/core/schema/arg.d.mts +38 -4
- package/dist/core/schema/arg.mjs +5 -2
- package/dist/core/schema/command.d.mts +57 -13
- package/dist/core/schema/command.mjs +41 -17
- package/dist/core/schema/flag.d.mts +553 -19
- package/dist/core/schema/flag.mjs +261 -5
- package/dist/core/schema/index.d.mts +6 -3
- package/dist/core/schema/middleware.d.mts +4 -3
- package/dist/core/schema/prompt.d.mts +6 -3
- package/dist/core/schema/run.d.mts +27 -1
- package/dist/core/schema/standard.d.mts +100 -0
- package/dist/core/schema/standard.mjs +15 -0
- package/dist/core/schema/string-constraints.d.mts +97 -0
- package/dist/core/schema/string-constraints.mjs +69 -0
- package/dist/core/schema/value-parsers.d.mts +78 -0
- package/dist/core/schema/value-parsers.mjs +142 -0
- package/dist/core/testkit/index.d.mts +0 -31
- package/dist/core/testkit/index.mjs +1 -1
- package/dist/index.d.mts +12 -7
- package/dist/index.mjs +9 -9
- package/dist/runtime/adapter.d.mts +71 -2
- package/dist/runtime/adapter.mjs +11 -1
- package/dist/runtime/auto.d.mts +2 -3
- package/dist/runtime/auto.mjs +4 -5
- package/dist/runtime/deno.d.mts +28 -5
- package/dist/runtime/deno.mjs +49 -1
- package/dist/runtime/index.d.mts +3 -4
- package/dist/runtime/node.d.mts +8 -2
- package/dist/runtime/node.mjs +60 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +2 -3
- package/dist/testkit.d.mts +1 -0
- package/dist/version.d.mts +7 -3
- package/dist/version.mjs +2 -2
- package/dreamcli.schema.json +118 -7
- 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/pwsh-demo/package.json +1 -1
- package/examples/pwsh-demo/src/main.ts +1 -1
- package/package.json +45 -41
- 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 -30
- package/dist/core/schema-dsl/to-json-schema.mjs +0 -74
- package/dist/runtime/bun.d.mts +0 -28
- package/dist/runtime/bun.mjs +0 -28
package/dist/core/help/index.mjs
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { getFlagAliasNames } from "../schema/flag.mjs";
|
|
2
|
+
import { resolveExampleCommand } from "../schema/command.mjs";
|
|
2
3
|
import { formatDisplayValue } from "../output/display-value.mjs";
|
|
3
|
-
import { padEnd, wrapText } from "./ansi.mjs";
|
|
4
|
+
import { osc8, padEnd, visibleWidth, wrapText } from "./ansi.mjs";
|
|
5
|
+
import { resolveHelpTheme } from "./theme.mjs";
|
|
4
6
|
//#region src/core/help/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* Auto-generated help text from command schemas.
|
|
7
|
-
*
|
|
8
|
-
* Renders usage line, description, positional args, flags table, and
|
|
9
|
-
* examples from a {@linkcode CommandSchema}. Designed for TTY output with
|
|
10
|
-
* configurable width.
|
|
11
|
-
*
|
|
12
|
-
* @module dreamcli/core/help
|
|
13
|
-
*/
|
|
14
7
|
const DEFAULT_WIDTH = 80;
|
|
15
8
|
/**
|
|
16
9
|
* Apply defaults to optional {@link HelpOptions}.
|
|
@@ -22,7 +15,11 @@ function resolveOptions(options) {
|
|
|
22
15
|
return {
|
|
23
16
|
width: options?.width ?? DEFAULT_WIDTH,
|
|
24
17
|
binName: options?.binName,
|
|
25
|
-
|
|
18
|
+
version: options?.version,
|
|
19
|
+
flagOrder: options?.flagOrder ?? "alphabetical",
|
|
20
|
+
sortFlags: options?.sortFlags,
|
|
21
|
+
isDefaultHelp: options?.isDefaultHelp ?? false,
|
|
22
|
+
theme: resolveHelpTheme(options?.colors, options?.theme)
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
25
|
/**
|
|
@@ -45,78 +42,103 @@ function formatHelpDefaultValue(value) {
|
|
|
45
42
|
*
|
|
46
43
|
* @param name - Long flag name (without `--` prefix).
|
|
47
44
|
* @param schema - The {@link FlagSchema} describing the flag.
|
|
45
|
+
* @param theme - Theme applied to the flag forms and value hint.
|
|
48
46
|
* @returns Formatted left-column string for the flags table.
|
|
49
47
|
*/
|
|
50
|
-
function formatFlagLeft(name, schema) {
|
|
48
|
+
function formatFlagLeft(name, schema, theme) {
|
|
51
49
|
const visibleShortAliases = getFlagAliasNames(schema, { kind: "short" });
|
|
52
50
|
const visibleLongAliases = getFlagAliasNames(schema, { kind: "long" });
|
|
51
|
+
const negation = schema.negation !== void 0 && !schema.negation.hidden ? schema.negation : void 0;
|
|
52
|
+
const canonicalForm = negation !== void 0 && negation.alias === void 0 ? `--[no-]${name}` : `--${name}`;
|
|
53
53
|
const forms = [
|
|
54
54
|
...visibleShortAliases.map((alias) => `-${alias}`),
|
|
55
|
-
|
|
56
|
-
...visibleLongAliases.map((alias) => `--${alias}`)
|
|
55
|
+
canonicalForm,
|
|
56
|
+
...visibleLongAliases.map((alias) => `--${alias}`),
|
|
57
|
+
...negation?.alias !== void 0 ? [`--${negation.alias}`] : []
|
|
57
58
|
];
|
|
58
|
-
if (schema.kind !== "boolean") return `${forms.join(", ")} ${formatValueHint(schema)}`;
|
|
59
|
-
return forms.join(", ");
|
|
59
|
+
if (schema.kind !== "boolean" && schema.kind !== "count") return `${theme.flag(forms.join(", "))} ${theme.placeholder(formatValueHint(schema))}`;
|
|
60
|
+
return theme.flag(forms.join(", "));
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Produce a type hint like `<string>`, `<number>`, `<us|eu|ap>`.
|
|
63
64
|
*
|
|
65
|
+
* A schema-level `valueHint` (set by sugar factories like `flag.url()`)
|
|
66
|
+
* overrides the kind-derived hint.
|
|
67
|
+
*
|
|
64
68
|
* @param schema - The {@link FlagSchema} whose value type determines the hint.
|
|
65
|
-
* @returns Angle-bracketed hint string, or empty string for
|
|
69
|
+
* @returns Angle-bracketed hint string, or empty string for no-value kinds.
|
|
66
70
|
*/
|
|
67
71
|
function formatValueHint(schema) {
|
|
72
|
+
if (schema.valueHint !== void 0) return `<${schema.valueHint}>`;
|
|
68
73
|
switch (schema.kind) {
|
|
69
74
|
case "string": return "<string>";
|
|
70
75
|
case "number": return "<number>";
|
|
71
76
|
case "enum": return `<${(schema.enumValues ?? []).join("|")}>`;
|
|
72
77
|
case "array": return `<${schema.elementSchema !== void 0 ? formatValueHint(schema.elementSchema).slice(1, -1) : "value"}>...`;
|
|
73
|
-
case "boolean":
|
|
78
|
+
case "boolean":
|
|
79
|
+
case "count": return "";
|
|
74
80
|
case "custom": return "<value>";
|
|
81
|
+
case "keyValue": return "<key=value>";
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
/**
|
|
78
85
|
* Build description with env/config/prompt/default/required/deprecated annotations.
|
|
79
86
|
*
|
|
80
87
|
* @param schema - The {@link FlagSchema} to describe.
|
|
88
|
+
* @param theme - Theme applied to the metadata annotations (description stays plain).
|
|
81
89
|
* @returns Concatenated description string with metadata annotations.
|
|
82
90
|
*/
|
|
83
|
-
function formatFlagDescription(schema) {
|
|
91
|
+
function formatFlagDescription(schema, theme) {
|
|
84
92
|
const parts = [];
|
|
85
93
|
if (schema.description !== void 0) parts.push(schema.description);
|
|
86
|
-
if (schema.deprecated !== void 0) parts.push(formatDeprecated(schema.deprecated));
|
|
87
|
-
if (schema.envVar !== void 0) parts.push(`[env: ${schema.envVar}]`);
|
|
88
|
-
if (schema.configPath !== void 0) parts.push(`[config: ${schema.configPath}]`);
|
|
89
|
-
if (schema.prompt !== void 0) parts.push("[prompt]");
|
|
90
|
-
if (schema.presence === "required") parts.push("[required]");
|
|
91
|
-
else if (schema.presence === "defaulted" && schema.kind !== "boolean") parts.push(`(default: ${formatHelpDefaultValue(schema.defaultValue)})`);
|
|
94
|
+
if (schema.deprecated !== void 0) parts.push(theme.deprecated(formatDeprecated(schema.deprecated)));
|
|
95
|
+
if (schema.envVar !== void 0) parts.push(theme.annotation(`[env: ${schema.envVar}]`));
|
|
96
|
+
if (schema.configPath !== void 0) parts.push(theme.annotation(`[config: ${schema.configPath}]`));
|
|
97
|
+
if (schema.prompt !== void 0) parts.push(theme.annotation("[prompt]"));
|
|
98
|
+
if (schema.presence === "required") parts.push(theme.annotation("[required]"));
|
|
99
|
+
else if (schema.presence === "defaulted" && schema.kind !== "boolean" && schema.kind !== "count") parts.push(theme.defaultValue(`(default: ${formatHelpDefaultValue(schema.defaultValue)})`));
|
|
92
100
|
return parts.join(" ");
|
|
93
101
|
}
|
|
94
102
|
/**
|
|
95
|
-
*
|
|
103
|
+
* Default flag order: short-aliased flags first, then alphabetical by name.
|
|
104
|
+
*/
|
|
105
|
+
function defaultFlagOrder(a, b, flags) {
|
|
106
|
+
const aSchema = flags[a];
|
|
107
|
+
const bSchema = flags[b];
|
|
108
|
+
if (aSchema === void 0 || bSchema === void 0) return 0;
|
|
109
|
+
const aHasShort = getFlagAliasNames(aSchema, { kind: "short" }).length > 0;
|
|
110
|
+
const bHasShort = getFlagAliasNames(bSchema, { kind: "short" }).length > 0;
|
|
111
|
+
if (aHasShort && !bHasShort) return -1;
|
|
112
|
+
if (!aHasShort && bHasShort) return 1;
|
|
113
|
+
return a.localeCompare(b);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Order flag names for the table: an explicit `sortFlags` comparator wins,
|
|
117
|
+
* then `'declaration'` preserves `.flag()` call order, otherwise the default
|
|
118
|
+
* short-first alphabetical order.
|
|
119
|
+
*/
|
|
120
|
+
function orderFlagNames(names, flags, opts) {
|
|
121
|
+
if (opts.sortFlags !== void 0) return [...names].sort(opts.sortFlags);
|
|
122
|
+
if (opts.flagOrder === "declaration") return names;
|
|
123
|
+
return [...names].sort((a, b) => defaultFlagOrder(a, b, flags));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Build the flag entries in the configured order.
|
|
96
127
|
*
|
|
97
128
|
* @param flags - Map of flag names to {@link FlagSchema} definitions.
|
|
98
|
-
* @
|
|
129
|
+
* @param opts - Resolved help options (theme + flag ordering).
|
|
130
|
+
* @returns Array of {@link FlagEntry} objects for the flags table.
|
|
99
131
|
*/
|
|
100
|
-
function buildFlagEntries(flags) {
|
|
132
|
+
function buildFlagEntries(flags, opts) {
|
|
101
133
|
const names = Object.keys(flags);
|
|
102
134
|
if (names.length === 0) return [];
|
|
103
|
-
const sorted = [...names].sort((a, b) => {
|
|
104
|
-
const aSchema = flags[a];
|
|
105
|
-
const bSchema = flags[b];
|
|
106
|
-
if (aSchema === void 0 || bSchema === void 0) return 0;
|
|
107
|
-
const aHasShort = getFlagAliasNames(aSchema, { kind: "short" }).length > 0;
|
|
108
|
-
const bHasShort = getFlagAliasNames(bSchema, { kind: "short" }).length > 0;
|
|
109
|
-
if (aHasShort && !bHasShort) return -1;
|
|
110
|
-
if (!aHasShort && bHasShort) return 1;
|
|
111
|
-
return a.localeCompare(b);
|
|
112
|
-
});
|
|
113
135
|
const entries = [];
|
|
114
|
-
for (const name of
|
|
136
|
+
for (const name of orderFlagNames(names, flags, opts)) {
|
|
115
137
|
const schema = flags[name];
|
|
116
138
|
if (schema === void 0) continue;
|
|
117
139
|
entries.push({
|
|
118
|
-
left: formatFlagLeft(name, schema),
|
|
119
|
-
description: formatFlagDescription(schema)
|
|
140
|
+
left: formatFlagLeft(name, schema, opts.theme),
|
|
141
|
+
description: formatFlagDescription(schema, opts.theme)
|
|
120
142
|
});
|
|
121
143
|
}
|
|
122
144
|
return entries;
|
|
@@ -138,14 +160,15 @@ function formatArgUsage(entry) {
|
|
|
138
160
|
* Format arg description with annotations.
|
|
139
161
|
*
|
|
140
162
|
* @param schema - The {@link ArgSchema} to describe.
|
|
163
|
+
* @param theme - Theme applied to the metadata annotations (description stays plain).
|
|
141
164
|
* @returns Concatenated description string with metadata annotations.
|
|
142
165
|
*/
|
|
143
|
-
function formatArgDescription(schema) {
|
|
166
|
+
function formatArgDescription(schema, theme) {
|
|
144
167
|
const parts = [];
|
|
145
168
|
if (schema.description !== void 0) parts.push(schema.description);
|
|
146
|
-
if (schema.deprecated !== void 0) parts.push(formatDeprecated(schema.deprecated));
|
|
147
|
-
if (schema.envVar !== void 0) parts.push(`[env: ${schema.envVar}]`);
|
|
148
|
-
if (schema.presence === "defaulted") parts.push(`(default: ${formatHelpDefaultValue(schema.defaultValue)})`);
|
|
169
|
+
if (schema.deprecated !== void 0) parts.push(theme.deprecated(formatDeprecated(schema.deprecated)));
|
|
170
|
+
if (schema.envVar !== void 0) parts.push(theme.annotation(`[env: ${schema.envVar}]`));
|
|
171
|
+
if (schema.presence === "defaulted") parts.push(theme.defaultValue(`(default: ${formatHelpDefaultValue(schema.defaultValue)})`));
|
|
149
172
|
return parts.join(" ");
|
|
150
173
|
}
|
|
151
174
|
/**
|
|
@@ -165,7 +188,13 @@ function formatHelpSections(schema, options) {
|
|
|
165
188
|
if (visibleCommands.length > 0) sections.push(formatCommandsSection(visibleCommands, opts));
|
|
166
189
|
if (schema.args.length > 0) sections.push(formatArgsSection(schema.args, opts));
|
|
167
190
|
if (Object.keys(schema.flags).length > 0) sections.push(formatFlagsSection(schema.flags, opts));
|
|
168
|
-
if (schema.examples.length > 0)
|
|
191
|
+
if (schema.examples.length > 0) {
|
|
192
|
+
const meta = {
|
|
193
|
+
name: opts.binName ?? schema.name,
|
|
194
|
+
version: opts.version
|
|
195
|
+
};
|
|
196
|
+
sections.push(formatExamplesSection(schema.examples, opts.theme, meta));
|
|
197
|
+
}
|
|
169
198
|
return sections;
|
|
170
199
|
}
|
|
171
200
|
/**
|
|
@@ -204,12 +233,13 @@ function formatHelp(schema, options) {
|
|
|
204
233
|
* @returns Single-line usage string, e.g. `Usage: mycli deploy [flags] <env>`.
|
|
205
234
|
*/
|
|
206
235
|
function formatUsageLine(schema, opts) {
|
|
207
|
-
const
|
|
236
|
+
const { theme } = opts;
|
|
237
|
+
const parts = [theme.sectionTitle("Usage:")];
|
|
208
238
|
const cmdName = opts.binName === void 0 ? schema.name : opts.isDefaultHelp ? opts.binName : `${opts.binName} ${schema.name}`;
|
|
209
|
-
parts.push(cmdName);
|
|
210
|
-
if (schema.commands.length > 0) parts.push("<command>");
|
|
211
|
-
if (Object.keys(schema.flags).length > 0) parts.push("[flags]");
|
|
212
|
-
for (const entry of schema.args) parts.push(formatArgUsage(entry));
|
|
239
|
+
parts.push(theme.usageBin(cmdName));
|
|
240
|
+
if (schema.commands.length > 0) parts.push(theme.placeholder("<command>"));
|
|
241
|
+
if (Object.keys(schema.flags).length > 0) parts.push(theme.placeholder("[flags]"));
|
|
242
|
+
for (const entry of schema.args) parts.push(theme.arg(formatArgUsage(entry)));
|
|
213
243
|
return parts.join(" ");
|
|
214
244
|
}
|
|
215
245
|
/**
|
|
@@ -220,18 +250,20 @@ function formatUsageLine(schema, opts) {
|
|
|
220
250
|
* @returns Multi-line arguments section string.
|
|
221
251
|
*/
|
|
222
252
|
function formatArgsSection(args, opts) {
|
|
223
|
-
const
|
|
253
|
+
const { theme } = opts;
|
|
254
|
+
const lines = [theme.sectionTitle("Arguments:")];
|
|
224
255
|
const GAP = 2;
|
|
225
256
|
let maxLeft = 0;
|
|
226
257
|
const entries = [];
|
|
227
258
|
for (const entry of args) {
|
|
228
|
-
const left = ` ${formatArgUsage(entry)}`;
|
|
229
|
-
const desc = formatArgDescription(entry.schema);
|
|
259
|
+
const left = ` ${theme.arg(formatArgUsage(entry))}`;
|
|
260
|
+
const desc = formatArgDescription(entry.schema, theme);
|
|
230
261
|
entries.push({
|
|
231
262
|
left,
|
|
232
263
|
desc
|
|
233
264
|
});
|
|
234
|
-
|
|
265
|
+
const leftWidth = visibleWidth(left);
|
|
266
|
+
if (leftWidth > maxLeft) maxLeft = leftWidth;
|
|
235
267
|
}
|
|
236
268
|
const descCol = maxLeft + GAP;
|
|
237
269
|
for (const { left, desc } of entries) if (desc.length === 0) lines.push(left);
|
|
@@ -250,7 +282,7 @@ function formatArgsSection(args, opts) {
|
|
|
250
282
|
* @returns Multi-line flags section string.
|
|
251
283
|
*/
|
|
252
284
|
function formatFlagsSection(flags, opts) {
|
|
253
|
-
return formatFlagEntriesBlock("Flags:", buildFlagEntries(flags), opts.width);
|
|
285
|
+
return formatFlagEntriesBlock(opts.theme.sectionTitle("Flags:"), buildFlagEntries(flags, opts), opts.width);
|
|
254
286
|
}
|
|
255
287
|
/**
|
|
256
288
|
* Render a titled two-column flag block from pre-built {@link FlagEntry} rows.
|
|
@@ -259,7 +291,7 @@ function formatFlagsSection(flags, opts) {
|
|
|
259
291
|
* block (built-in flags), so column alignment and description wrapping stay
|
|
260
292
|
* identical across both. Returns `''` when there are no entries.
|
|
261
293
|
*
|
|
262
|
-
* @param title - Section heading (e.g. `'Flags:'`, `'Global options:'`).
|
|
294
|
+
* @param title - Section heading (e.g. `'Flags:'`, `'Global options:'`), pre-styled by the caller.
|
|
263
295
|
* @param entries - Formatted left/description rows.
|
|
264
296
|
* @param width - Terminal width for description wrapping.
|
|
265
297
|
* @returns Multi-line block string, or `''` when `entries` is empty.
|
|
@@ -271,8 +303,8 @@ function formatFlagEntriesBlock(title, entries, width) {
|
|
|
271
303
|
const GAP = 2;
|
|
272
304
|
let maxLeft = 0;
|
|
273
305
|
for (const entry of entries) {
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
306
|
+
const indentedWidth = visibleWidth(entry.left) + 2;
|
|
307
|
+
if (indentedWidth > maxLeft) maxLeft = indentedWidth;
|
|
276
308
|
}
|
|
277
309
|
const descCol = maxLeft + GAP;
|
|
278
310
|
for (const entry of entries) {
|
|
@@ -294,13 +326,14 @@ function formatFlagEntriesBlock(title, entries, width) {
|
|
|
294
326
|
* @returns Multi-line commands section string.
|
|
295
327
|
*/
|
|
296
328
|
function formatCommandsSection(commands, opts) {
|
|
297
|
-
const
|
|
329
|
+
const { theme } = opts;
|
|
330
|
+
const lines = [theme.sectionTitle("Commands:")];
|
|
298
331
|
const GAP = 2;
|
|
299
332
|
let maxNameLen = 0;
|
|
300
333
|
for (const cmd of commands) if (cmd.name.length > maxNameLen) maxNameLen = cmd.name.length;
|
|
301
334
|
const descCol = 2 + maxNameLen + GAP;
|
|
302
335
|
for (const cmd of commands) {
|
|
303
|
-
const left = ` ${cmd.name}`;
|
|
336
|
+
const left = ` ${theme.command(cmd.name)}`;
|
|
304
337
|
const desc = cmd.description ?? "";
|
|
305
338
|
if (desc.length === 0) lines.push(left);
|
|
306
339
|
else {
|
|
@@ -312,18 +345,47 @@ function formatCommandsSection(commands, opts) {
|
|
|
312
345
|
return lines.join("\n");
|
|
313
346
|
}
|
|
314
347
|
/**
|
|
348
|
+
* One shell token: a single- or double-quoted span (kept whole so internal
|
|
349
|
+
* spaces don't split it) or a run of non-whitespace characters.
|
|
350
|
+
*/
|
|
351
|
+
const EXAMPLE_TOKEN = /(?:'[^']*'|"[^"]*"|\S)+/g;
|
|
352
|
+
/**
|
|
353
|
+
* Highlight an example command per token: the leading binary via `usageBin`,
|
|
354
|
+
* flag tokens (`-x`, `--long`) via `flag`, everything else plain.
|
|
355
|
+
*
|
|
356
|
+
* Uses `replace` so only the token spans are wrapped and the whitespace
|
|
357
|
+
* between them is preserved verbatim — with the color gate off (identity
|
|
358
|
+
* formatters) the result equals `command`, so `stripAnsi(highlighted)` stays
|
|
359
|
+
* equal to the plain rendering.
|
|
360
|
+
*/
|
|
361
|
+
function highlightExampleCommand(command, theme) {
|
|
362
|
+
let index = 0;
|
|
363
|
+
return command.replace(EXAMPLE_TOKEN, (token) => {
|
|
364
|
+
const styled = index === 0 ? theme.usageBin(token) : token.startsWith("-") ? theme.flag(token) : token;
|
|
365
|
+
index += 1;
|
|
366
|
+
return styled;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
315
370
|
* Render the `Examples:` help section.
|
|
316
371
|
*
|
|
317
372
|
* @param examples - Array of {@link CommandExample} entries.
|
|
373
|
+
* @param theme - Theme applied to the section title, `$` prompt marker, and
|
|
374
|
+
* per-token command highlighting.
|
|
375
|
+
* @param meta - Program name/version passed to function-form example commands.
|
|
318
376
|
* @returns Multi-line examples section string.
|
|
319
377
|
*/
|
|
320
|
-
function formatExamplesSection(examples) {
|
|
321
|
-
const lines = ["Examples:"];
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
378
|
+
function formatExamplesSection(examples, theme, meta) {
|
|
379
|
+
const lines = [theme.sectionTitle("Examples:")];
|
|
380
|
+
const prompt = theme.examplePrompt("$");
|
|
381
|
+
for (const example of examples) {
|
|
382
|
+
const command = highlightExampleCommand(resolveExampleCommand(example.command, meta), theme);
|
|
383
|
+
if (example.description !== void 0) {
|
|
384
|
+
lines.push(` ${example.description}:`);
|
|
385
|
+
lines.push(` ${prompt} ${command}`);
|
|
386
|
+
} else lines.push(` ${prompt} ${command}`);
|
|
387
|
+
}
|
|
326
388
|
return lines.join("\n");
|
|
327
389
|
}
|
|
328
390
|
//#endregion
|
|
329
|
-
export { formatFlagEntriesBlock, formatHelp, formatHelpSections };
|
|
391
|
+
export { formatFlagEntriesBlock, formatHelp, formatHelpSections, osc8, visibleWidth };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Colors, Formatter } from "ansispeck";
|
|
2
|
+
//#region src/core/help/theme.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Semantic styling roles for help output.
|
|
5
|
+
*
|
|
6
|
+
* Roles that appear inside wrap-eligible description text (`defaultValue`,
|
|
7
|
+
* `annotation`, `deprecated`) should stick to foreground colors and `dim` —
|
|
8
|
+
* a styled span may cross a soft-wrap boundary, and while color/dim carry
|
|
9
|
+
* invisibly across the continuation indent, `underline`/`inverse`/background
|
|
10
|
+
* styles would visibly paint it.
|
|
11
|
+
*/
|
|
12
|
+
interface HelpTheme {
|
|
13
|
+
/** Section headings: `Usage:`, `Arguments:`, `Flags:`, `Commands:`, `Examples:`, `Global options:`. */
|
|
14
|
+
readonly sectionTitle: Formatter;
|
|
15
|
+
/** Binary / command path in the usage line. */
|
|
16
|
+
readonly usageBin: Formatter;
|
|
17
|
+
/** Flag forms in the flags table: `-f, --force`. */
|
|
18
|
+
readonly flag: Formatter;
|
|
19
|
+
/** Grammar tokens: `<string>`, `<command>`, `[flags]`, value hints. */
|
|
20
|
+
readonly placeholder: Formatter;
|
|
21
|
+
/** Command names in `Commands:` tables. */
|
|
22
|
+
readonly command: Formatter;
|
|
23
|
+
/** Positional arg tokens: `<file>`, `[out]...`. */
|
|
24
|
+
readonly arg: Formatter;
|
|
25
|
+
/** Default-value annotations: `(default: 8080)`. */
|
|
26
|
+
readonly defaultValue: Formatter;
|
|
27
|
+
/** Metadata annotations: `[env: X]`, `[config: a.b]`, `[prompt]`, `[required]`, ` (default)`. */
|
|
28
|
+
readonly annotation: Formatter;
|
|
29
|
+
/** Deprecation labels: `[deprecated]`, `[deprecated: use --x]`. */
|
|
30
|
+
readonly deprecated: Formatter;
|
|
31
|
+
/** Program name in the root-help header. */
|
|
32
|
+
readonly headerName: Formatter;
|
|
33
|
+
/** Version (`vX.Y.Z`) in the root-help header. */
|
|
34
|
+
readonly headerVersion: Formatter;
|
|
35
|
+
/** The `$` prompt marker in `Examples:`. */
|
|
36
|
+
readonly examplePrompt: Formatter;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* User theme customization: receives the gated palette and returns role
|
|
40
|
+
* overrides merged over the default theme.
|
|
41
|
+
*
|
|
42
|
+
* The palette formatters are identity functions when color is disabled, and
|
|
43
|
+
* the factory itself is only invoked when color is enabled — style
|
|
44
|
+
* unconditionally, gating is the framework's job.
|
|
45
|
+
*/
|
|
46
|
+
type HelpThemeFactory = (colors: Colors) => Partial<HelpTheme>;
|
|
47
|
+
/**
|
|
48
|
+
* The built-in help theme (clap/cargo conventions).
|
|
49
|
+
*
|
|
50
|
+
* @param c - Palette to build formatters from (typically the gated `out.color`).
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
declare function defaultHelpTheme(c: Colors): HelpTheme;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the effective help theme from a palette and optional user factory.
|
|
56
|
+
*
|
|
57
|
+
* When the palette renders no styling (color disabled — its formatters are
|
|
58
|
+
* identity functions), the user factory is **never invoked**: even a factory
|
|
59
|
+
* that emits raw escapes cannot leak them into color-off output. When color
|
|
60
|
+
* is enabled, factory overrides merge over {@linkcode defaultHelpTheme}.
|
|
61
|
+
*
|
|
62
|
+
* @param colors - Gated palette, or `undefined` for a color-off theme.
|
|
63
|
+
* @param theme - Optional user overrides factory.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
declare function resolveHelpTheme(colors: Colors | undefined, theme: HelpThemeFactory | undefined): HelpTheme;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { type HelpTheme, type HelpThemeFactory, defaultHelpTheme, resolveHelpTheme };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createColors } from "ansispeck";
|
|
2
|
+
//#region src/core/help/theme.ts
|
|
3
|
+
/**
|
|
4
|
+
* The built-in help theme (clap/cargo conventions).
|
|
5
|
+
*
|
|
6
|
+
* @param c - Palette to build formatters from (typically the gated `out.color`).
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function defaultHelpTheme(c) {
|
|
10
|
+
return {
|
|
11
|
+
sectionTitle: (input) => c.bold(c.underline(input)),
|
|
12
|
+
usageBin: c.bold,
|
|
13
|
+
flag: c.cyan,
|
|
14
|
+
placeholder: c.dim,
|
|
15
|
+
command: c.cyan,
|
|
16
|
+
arg: c.cyan,
|
|
17
|
+
defaultValue: c.dim,
|
|
18
|
+
annotation: c.dim,
|
|
19
|
+
deprecated: c.yellow,
|
|
20
|
+
headerName: c.bold,
|
|
21
|
+
headerVersion: c.dim,
|
|
22
|
+
examplePrompt: c.dim
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the effective help theme from a palette and optional user factory.
|
|
27
|
+
*
|
|
28
|
+
* When the palette renders no styling (color disabled — its formatters are
|
|
29
|
+
* identity functions), the user factory is **never invoked**: even a factory
|
|
30
|
+
* that emits raw escapes cannot leak them into color-off output. When color
|
|
31
|
+
* is enabled, factory overrides merge over {@linkcode defaultHelpTheme}.
|
|
32
|
+
*
|
|
33
|
+
* @param colors - Gated palette, or `undefined` for a color-off theme.
|
|
34
|
+
* @param theme - Optional user overrides factory.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
function resolveHelpTheme(colors, theme) {
|
|
38
|
+
const palette = colors ?? createColors(false);
|
|
39
|
+
if (!(palette.bold("x") !== "x") || theme === void 0) return defaultHelpTheme(palette);
|
|
40
|
+
return {
|
|
41
|
+
...defaultHelpTheme(palette),
|
|
42
|
+
...theme(palette)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { defaultHelpTheme, resolveHelpTheme };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommandSchema } from "../schema/command.mjs";
|
|
1
|
+
import { CommandSchema, ExampleMeta } from "../schema/command.mjs";
|
|
2
|
+
import "../schema/index.mjs";
|
|
2
3
|
import { CLISchema } from "../cli/index.mjs";
|
|
3
|
-
|
|
4
4
|
//#region src/core/json-schema/index.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Options for JSON Schema generation.
|
|
@@ -43,6 +43,8 @@ interface JsonSchemaOptions {
|
|
|
43
43
|
*
|
|
44
44
|
* @param schema - The CLI schema from `CLIBuilder.schema`.
|
|
45
45
|
* @param options - Generation options.
|
|
46
|
+
* @param meta - Program name/version for function-form examples; defaults to
|
|
47
|
+
* the CLI schema's own `name`/`version`.
|
|
46
48
|
* @returns A plain object suitable for `JSON.stringify()`.
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
@@ -52,7 +54,22 @@ interface JsonSchemaOptions {
|
|
|
52
54
|
* writeFileSync('cli-schema.json', JSON.stringify(definition, null, 2));
|
|
53
55
|
* ```
|
|
54
56
|
*/
|
|
55
|
-
declare function generateSchema(schema: CLISchema, options?: JsonSchemaOptions): Record<string, unknown>;
|
|
57
|
+
declare function generateSchema(schema: CLISchema, options?: JsonSchemaOptions, meta?: ExampleMeta): Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Generate the definition metadata document for a single command.
|
|
60
|
+
*
|
|
61
|
+
* The per-command counterpart of {@link generateSchema}: the same
|
|
62
|
+
* JSON-serializable shape as one entry of its `commands` array (flags, args,
|
|
63
|
+
* subcommands, examples). Powers `--help` in `--json` mode and is useful for
|
|
64
|
+
* embedding one command's definition into custom tooling.
|
|
65
|
+
*
|
|
66
|
+
* @param schema - The command schema to serialize.
|
|
67
|
+
* @param options - Generation options.
|
|
68
|
+
* @param meta - Program name/version for function-form examples; defaults to
|
|
69
|
+
* the command's own name with no version.
|
|
70
|
+
* @returns A plain object suitable for `JSON.stringify()`.
|
|
71
|
+
*/
|
|
72
|
+
declare function generateCommandSchema(schema: CommandSchema, options?: JsonSchemaOptions, meta?: ExampleMeta): Record<string, unknown>;
|
|
56
73
|
/**
|
|
57
74
|
* Generate a JSON Schema (draft 2020-12) for validating CLI input as JSON.
|
|
58
75
|
*
|
|
@@ -85,11 +102,6 @@ declare function generateInputSchema(schema: CLISchema | CommandSchema, options?
|
|
|
85
102
|
/**
|
|
86
103
|
* JSON Schema (draft 2020-12) that validates the output of {@link generateSchema}.
|
|
87
104
|
*
|
|
88
|
-
* Each `$defs` entry is defined once as a schema DSL string — the DSL
|
|
89
|
-
* parser produces a runtime AST, and {@link nodeToJsonSchema} converts
|
|
90
|
-
* that AST to a JSON Schema fragment. No probe fixtures, no override
|
|
91
|
-
* maps, no manually maintained type definitions.
|
|
92
|
-
*
|
|
93
105
|
* Hosted at {@link DEFINITION_SCHEMA_URL} for `$schema` resolution. Also
|
|
94
106
|
* exported so tooling can validate definition documents without a network
|
|
95
107
|
* round-trip.
|
|
@@ -106,4 +118,4 @@ declare function generateInputSchema(schema: CLISchema | CommandSchema, options?
|
|
|
106
118
|
*/
|
|
107
119
|
declare const definitionMetaSchema: Record<string, unknown>;
|
|
108
120
|
//#endregion
|
|
109
|
-
export { type JsonSchemaOptions, definitionMetaSchema, generateInputSchema, generateSchema };
|
|
121
|
+
export { type JsonSchemaOptions, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema };
|