@kjanat/dreamcli 4.0.0-rc.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/dist/{runtime/adapter.d.mts → adapter-D0hbBNVB.d.mts} +5 -7
- package/dist/completion-D4mz6axB.mjs +6 -0
- package/dist/completion.d.mts +90 -0
- package/dist/completion.mjs +1 -0
- package/dist/config-B9ddC-Kb.mjs +1 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +1 -0
- package/dist/core-Cp2w8vRq.mjs +17 -0
- package/dist/index-BziI2aKc.d.mts +5440 -0
- package/dist/index-DOfClfYR.d.mts +370 -0
- package/dist/index-DWsnGZlx.d.mts +831 -0
- package/dist/{core/cli/index.d.mts → index-DXROeDPC.d.mts} +149 -25
- package/dist/index-DndPmT8J.d.mts +275 -0
- package/dist/{core/json-schema/index.d.mts → index-DyoaS234.d.mts} +54 -45
- package/dist/index.d.mts +190 -41
- package/dist/index.mjs +1 -26
- package/dist/json-schema-C9SzZ7jY.mjs +52 -0
- package/dist/json-schema.d.mts +2 -0
- package/dist/json-schema.mjs +1 -0
- package/dist/package-json-BgE9YjjQ.mjs +3 -0
- package/dist/prompt.d.mts +48 -0
- package/dist/prompt.mjs +1 -0
- package/dist/rolldown-runtime-G4Kt5YOX.mjs +1 -0
- package/dist/runtime.d.mts +2 -6
- package/dist/runtime.mjs +1 -6
- package/dist/terminal-C8KTXjv5.mjs +6 -0
- package/dist/test-prompter-v__jT2yG.mjs +1 -0
- package/dist/testkit.d.mts +54 -6
- package/dist/testkit.mjs +1 -5
- package/dist/version.d.mts +16 -4
- package/dist/version.mjs +1 -7
- package/dreamcli.schema.json +697 -538
- package/package.json +37 -12
- package/skills/cli-creation/SKILL.md +16 -11
- package/CHANGELOG.md +0 -2453
- package/dist/core/cli/builtins.d.mts +0 -47
- package/dist/core/cli/builtins.mjs +0 -135
- package/dist/core/cli/compiled.d.mts +0 -29
- package/dist/core/cli/compiled.mjs +0 -76
- package/dist/core/cli/dispatch.d.mts +0 -38
- package/dist/core/cli/dispatch.mjs +0 -205
- package/dist/core/cli/help-links.d.mts +0 -15
- package/dist/core/cli/help-links.mjs +0 -41
- package/dist/core/cli/index.mjs +0 -1265
- package/dist/core/cli/planner.d.mts +0 -96
- package/dist/core/cli/planner.mjs +0 -323
- package/dist/core/cli/plugin.d.mts +0 -94
- package/dist/core/cli/plugin.mjs +0 -41
- package/dist/core/cli/propagate.d.mts +0 -39
- package/dist/core/cli/propagate.mjs +0 -57
- package/dist/core/cli/reserved-flags.d.mts +0 -1
- package/dist/core/cli/reserved-flags.mjs +0 -158
- package/dist/core/cli/root-help.d.mts +0 -1
- package/dist/core/cli/root-help.mjs +0 -221
- package/dist/core/cli/root-output-flags.d.mts +0 -1
- package/dist/core/cli/root-output-flags.mjs +0 -169
- package/dist/core/cli/root-surface.d.mts +0 -1
- package/dist/core/cli/root-surface.mjs +0 -28
- package/dist/core/cli/runtime-preflight.d.mts +0 -1
- package/dist/core/cli/runtime-preflight.mjs +0 -221
- package/dist/core/completion/index.d.mts +0 -76
- package/dist/core/completion/index.mjs +0 -90
- package/dist/core/completion/shells/bash.d.mts +0 -22
- package/dist/core/completion/shells/bash.mjs +0 -309
- package/dist/core/completion/shells/fish.d.mts +0 -18
- package/dist/core/completion/shells/fish.mjs +0 -163
- package/dist/core/completion/shells/powershell.d.mts +0 -12
- package/dist/core/completion/shells/powershell.mjs +0 -359
- package/dist/core/completion/shells/shared.d.mts +0 -49
- package/dist/core/completion/shells/shared.mjs +0 -147
- package/dist/core/completion/shells/zsh.d.mts +0 -22
- package/dist/core/completion/shells/zsh.mjs +0 -252
- package/dist/core/config/index.d.mts +0 -191
- package/dist/core/config/index.mjs +0 -285
- package/dist/core/config/package-json.d.mts +0 -179
- package/dist/core/config/package-json.mjs +0 -353
- package/dist/core/errors/index.d.mts +0 -126
- package/dist/core/errors/index.mjs +0 -87
- package/dist/core/execution/index.d.mts +0 -1
- package/dist/core/execution/index.mjs +0 -220
- package/dist/core/help/ansi.d.mts +0 -73
- package/dist/core/help/ansi.mjs +0 -121
- package/dist/core/help/index.d.mts +0 -110
- package/dist/core/help/index.mjs +0 -414
- package/dist/core/help/theme.d.mts +0 -48
- package/dist/core/help/theme.mjs +0 -46
- package/dist/core/json-schema/index.mjs +0 -1007
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +0 -274
- package/dist/core/json-schema/meta-descriptions.generated.mjs +0 -136
- package/dist/core/output/activity.d.mts +0 -1
- package/dist/core/output/activity.mjs +0 -452
- package/dist/core/output/bind.d.mts +0 -1
- package/dist/core/output/bind.mjs +0 -56
- package/dist/core/output/contracts.d.mts +0 -81
- package/dist/core/output/contracts.mjs +0 -57
- package/dist/core/output/display-value.d.mts +0 -1
- package/dist/core/output/display-value.mjs +0 -32
- package/dist/core/output/index.d.mts +0 -160
- package/dist/core/output/index.mjs +0 -512
- package/dist/core/output/renderers.d.mts +0 -1
- package/dist/core/output/renderers.mjs +0 -46
- package/dist/core/output/writer.d.mts +0 -39
- package/dist/core/output/writer.mjs +0 -12
- package/dist/core/parse/index.d.mts +0 -178
- package/dist/core/parse/index.mjs +0 -850
- package/dist/core/parse/occurrences.d.mts +0 -89
- package/dist/core/parse/occurrences.mjs +0 -114
- package/dist/core/prompt/index.d.mts +0 -213
- package/dist/core/prompt/index.mjs +0 -348
- package/dist/core/read-flags/index.d.mts +0 -150
- package/dist/core/read-flags/index.mjs +0 -217
- package/dist/core/resolve/args.d.mts +0 -39
- package/dist/core/resolve/args.mjs +0 -182
- package/dist/core/resolve/coerce.d.mts +0 -79
- package/dist/core/resolve/coerce.mjs +0 -900
- package/dist/core/resolve/config.d.mts +0 -1
- package/dist/core/resolve/config.mjs +0 -19
- package/dist/core/resolve/contracts.d.mts +0 -145
- package/dist/core/resolve/errors.d.mts +0 -10
- package/dist/core/resolve/errors.mjs +0 -148
- package/dist/core/resolve/flags.d.mts +0 -47
- package/dist/core/resolve/flags.mjs +0 -246
- package/dist/core/resolve/index.d.mts +0 -44
- package/dist/core/resolve/index.mjs +0 -123
- package/dist/core/resolve/path-checks.d.mts +0 -47
- package/dist/core/resolve/path-checks.mjs +0 -102
- package/dist/core/resolve/redaction.d.mts +0 -12
- package/dist/core/resolve/redaction.mjs +0 -14
- package/dist/core/resolve/stages.d.mts +0 -85
- package/dist/core/resolve/stages.mjs +0 -170
- package/dist/core/resolve/standard.d.mts +0 -1
- package/dist/core/resolve/standard.mjs +0 -212
- package/dist/core/schema/activity.d.mts +0 -189
- package/dist/core/schema/arg.d.mts +0 -1451
- package/dist/core/schema/arg.mjs +0 -1139
- package/dist/core/schema/brand.d.mts +0 -17
- package/dist/core/schema/cardinality.d.mts +0 -301
- package/dist/core/schema/cardinality.mjs +0 -514
- package/dist/core/schema/command.d.mts +0 -1086
- package/dist/core/schema/command.mjs +0 -999
- package/dist/core/schema/flag.d.mts +0 -1487
- package/dist/core/schema/flag.mjs +0 -1207
- package/dist/core/schema/index.d.mts +0 -15
- package/dist/core/schema/index.mjs +0 -10
- package/dist/core/schema/middleware.d.mts +0 -126
- package/dist/core/schema/middleware.mjs +0 -41
- package/dist/core/schema/number-constraints.d.mts +0 -96
- package/dist/core/schema/number-constraints.mjs +0 -60
- package/dist/core/schema/prompt.d.mts +0 -135
- package/dist/core/schema/provenance.d.mts +0 -99
- package/dist/core/schema/provenance.mjs +0 -28
- package/dist/core/schema/run.d.mts +0 -161
- package/dist/core/schema/source.d.mts +0 -179
- package/dist/core/schema/source.mjs +0 -206
- package/dist/core/schema/standard.d.mts +0 -93
- package/dist/core/schema/standard.mjs +0 -15
- package/dist/core/schema/stdin.d.mts +0 -87
- package/dist/core/schema/stdin.mjs +0 -91
- package/dist/core/schema/string-constraints.d.mts +0 -108
- package/dist/core/schema/string-constraints.mjs +0 -86
- package/dist/core/schema/value-parsers.d.mts +0 -150
- package/dist/core/schema/value-parsers.mjs +0 -160
- package/dist/core/schema/value.d.mts +0 -242
- package/dist/core/schema/value.mjs +0 -573
- package/dist/core/testkit/index.d.mts +0 -56
- package/dist/core/testkit/index.mjs +0 -102
- package/dist/runtime/adapter.mjs +0 -92
- package/dist/runtime/auto.d.mts +0 -25
- package/dist/runtime/auto.mjs +0 -45
- package/dist/runtime/deno.d.mts +0 -99
- package/dist/runtime/deno.mjs +0 -265
- package/dist/runtime/detect.d.mts +0 -86
- package/dist/runtime/detect.mjs +0 -45
- package/dist/runtime/index.d.mts +0 -6
- package/dist/runtime/node.d.mts +0 -71
- package/dist/runtime/node.mjs +0 -228
- package/dist/runtime/paths.d.mts +0 -1
- package/dist/runtime/paths.mjs +0 -48
- package/dist/strings.d.mts +0 -12
- package/dist/strings.mjs +0 -22
- package/examples/basic.ts +0 -37
- package/examples/flag-types.ts +0 -79
- package/examples/gh/node_modules/typescript/LICENSE +0 -55
- package/examples/gh/node_modules/typescript/NOTICE.txt +0 -436
- package/examples/gh/node_modules/typescript/README.md +0 -49
- package/examples/gh/node_modules/typescript/bin/tsc +0 -2
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts +0 -529
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/async/api.js +0 -1657
- package/examples/gh/node_modules/typescript/dist/api/async/api.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts +0 -39
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/async/client.js +0 -211
- package/examples/gh/node_modules/typescript/dist/api/async/client.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts +0 -310
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/async/types.js +0 -2
- package/examples/gh/node_modules/typescript/dist/api/async/types.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts +0 -109
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js +0 -2
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts +0 -23
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/fs.js +0 -109
- package/examples/gh/node_modules/typescript/dist/api/fs.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts +0 -15
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts +0 -5
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js +0 -74
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js +0 -287
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts +0 -32
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js +0 -213
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts +0 -76
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts +0 -182
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js +0 -835
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts +0 -62
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js +0 -122
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/node.js +0 -298
- package/examples/gh/node_modules/typescript/dist/api/node/node.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts +0 -29
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts +0 -4
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js +0 -241
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js +0 -30
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts +0 -6
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js +0 -61
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts +0 -32
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/options.js +0 -11
- package/examples/gh/node_modules/typescript/dist/api/options.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts +0 -110
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/path.js +0 -508
- package/examples/gh/node_modules/typescript/dist/api/path.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts +0 -239
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/proto.js +0 -37
- package/examples/gh/node_modules/typescript/dist/api/proto.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts +0 -79
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js +0 -169
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts +0 -529
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js +0 -1665
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts +0 -30
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js +0 -124
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts +0 -310
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js +0 -2
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts +0 -114
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js +0 -508
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts +0 -175
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/api/timing.js +0 -149
- package/examples/gh/node_modules/typescript/dist/api/timing.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts +0 -100
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts +0 -1161
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js +0 -4
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/ast.js +0 -7
- package/examples/gh/node_modules/typescript/dist/ast/ast.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts +0 -19
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js +0 -596
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts +0 -16
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/clone.js +0 -104
- package/examples/gh/node_modules/typescript/dist/ast/clone.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts +0 -520
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js +0 -3057
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts +0 -20
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/index.js +0 -20
- package/examples/gh/node_modules/typescript/dist/ast/index.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts +0 -35
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts +0 -329
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js +0 -1103
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/is.js +0 -233
- package/examples/gh/node_modules/typescript/dist/ast/is.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts +0 -11
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js +0 -202
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts +0 -97
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js +0 -2230
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts +0 -17
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/utils.js +0 -67
- package/examples/gh/node_modules/typescript/dist/ast/utils.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts +0 -14
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts +0 -50
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js +0 -978
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js +0 -47
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts +0 -129
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js +0 -132
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js +0 -130
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts +0 -5
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js +0 -6
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js +0 -6
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts +0 -28
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js +0 -30
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js +0 -30
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts +0 -7
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts +0 -12
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js +0 -14
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js +0 -14
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts +0 -23
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js +0 -25
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js +0 -25
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js +0 -11
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js +0 -11
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts +0 -5
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js +0 -6
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js +0 -6
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts +0 -42
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js +0 -44
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js +0 -44
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts +0 -7
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts +0 -17
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js +0 -19
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js +0 -19
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js +0 -11
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js +0 -11
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts +0 -6
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js +0 -8
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js +0 -8
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts +0 -36
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js +0 -38
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js +0 -38
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts +0 -44
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js +0 -46
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js +0 -46
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts +0 -50
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js +0 -52
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js +0 -52
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts +0 -16
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js +0 -18
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js +0 -18
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts +0 -13
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js +0 -14
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js +0 -14
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts +0 -11
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js +0 -12
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js +0 -12
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts +0 -17
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js +0 -18
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js +0 -18
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts +0 -15
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js +0 -17
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js +0 -17
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts +0 -5
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js +0 -7
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js +0 -7
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts +0 -71
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js +0 -73
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js +0 -73
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts +0 -389
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js +0 -391
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js +0 -391
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts +0 -30
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js +0 -32
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js +0 -32
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts +0 -76
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js +0 -78
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js +0 -78
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts +0 -2
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts +0 -7
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js +0 -9
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js.map +0 -1
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts +0 -23
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts.map +0 -1
- package/examples/gh/node_modules/typescript/dist/internal/utils.js +0 -25
- package/examples/gh/node_modules/typescript/dist/internal/utils.js.map +0 -1
- package/examples/gh/node_modules/typescript/lib/getExePath.d.ts +0 -2
- package/examples/gh/node_modules/typescript/lib/getExePath.js +0 -70
- package/examples/gh/node_modules/typescript/lib/tsc.js +0 -28
- package/examples/gh/node_modules/typescript/lib/version.cjs +0 -3
- package/examples/gh/node_modules/typescript/lib/version.d.cts +0 -2
- package/examples/gh/node_modules/typescript/package.json +0 -87
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/License.txt +0 -11
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/README.md +0 -54
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.d.ts +0 -17
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.js +0 -83
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +0 -22
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.js +0 -210
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.d.ts +0 -14
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.js +0 -87
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +0 -32
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.js +0 -132
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.d.ts +0 -367
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.js +0 -1271
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +0 -9
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.js +0 -16
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +0 -52
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.js +0 -70
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.d.ts +0 -39
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.js +0 -135
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.d.ts +0 -7
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.js +0 -34
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +0 -55
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.js +0 -412
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +0 -18
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +0 -155
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +0 -77
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.js +0 -246
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +0 -60
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.js +0 -157
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.d.ts +0 -369
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.js +0 -436
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.d.ts +0 -74
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.js +0 -23
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +0 -10
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.js +0 -74
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +0 -15
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +0 -77
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.d.ts +0 -58
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.js +0 -289
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.d.ts +0 -12
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.js +0 -163
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/package.json +0 -54
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/typings/thenable.d.ts +0 -5
- package/examples/gh/package.json +0 -45
- package/examples/gh/src/commands/auth.ts +0 -66
- package/examples/gh/src/commands/issue.ts +0 -120
- package/examples/gh/src/commands/pr.ts +0 -125
- package/examples/gh/src/data/issues.yaml +0 -5
- package/examples/gh/src/data/issues.yaml.d.ts +0 -17
- package/examples/gh/src/data/pull-requests.yaml +0 -7
- package/examples/gh/src/data/pull-requests.yaml.d.ts +0 -18
- package/examples/gh/src/docs.ts +0 -11
- package/examples/gh/src/lib/auth.ts +0 -37
- package/examples/gh/src/lib/utils.ts +0 -17
- package/examples/gh/src/main.test.ts +0 -307
- package/examples/gh/src/main.ts +0 -46
- package/examples/help-config.ts +0 -43
- package/examples/interactive.ts +0 -67
- package/examples/json-mode.ts +0 -95
- package/examples/middleware.ts +0 -71
- package/examples/multi-command.ts +0 -66
- package/examples/output-extras.ts +0 -46
- package/examples/parser-control.ts +0 -40
- package/examples/pwsh-demo/README.md +0 -40
- package/examples/pwsh-demo/package.json +0 -41
- package/examples/pwsh-demo/pwsh-demo.cmd +0 -3
- package/examples/pwsh-demo/smoke-powershell.ps1 +0 -218
- package/examples/pwsh-demo/src/main.test.ts +0 -45
- package/examples/pwsh-demo/src/main.ts +0 -140
- package/examples/spinner-progress.ts +0 -49
- package/examples/standard-schema.ts +0 -45
- package/examples/testing.ts +0 -147
- package/examples/transport-launcher.ts +0 -85
|
@@ -1,999 +0,0 @@
|
|
|
1
|
-
import { CLIError } from "../errors/index.mjs";
|
|
2
|
-
import { createFlagSchema, getFlagNegatedName } from "./flag.mjs";
|
|
3
|
-
import { createArgSchema } from "./arg.mjs";
|
|
4
|
-
import { stdinConsumerReference, stdinConsumers } from "./source.mjs";
|
|
5
|
-
//#region src/core/schema/command.ts
|
|
6
|
-
/** Resolve an {@link ExampleCommand} to its string form for the given meta. */
|
|
7
|
-
function resolveExampleCommand(command, meta) {
|
|
8
|
-
return typeof command === "function" ? command(meta) : command;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Reject a flag name a plain record cannot carry.
|
|
12
|
-
*
|
|
13
|
-
* Assigning `__proto__` on an object literal sets the prototype instead of an
|
|
14
|
-
* entry, so both construction paths refuse the key rather than let the flag
|
|
15
|
-
* vanish.
|
|
16
|
-
*
|
|
17
|
-
* @param commandName - Command the flag was declared on, for the error details.
|
|
18
|
-
* @param name - Proposed flag name.
|
|
19
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when the name is `__proto__`.
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
function assertUsableFlagKey(commandName, name) {
|
|
24
|
-
if (name !== "__proto__") return;
|
|
25
|
-
throw new CLIError("Flag name '__proto__' is not usable as a flag", {
|
|
26
|
-
code: "INVALID_SCHEMA",
|
|
27
|
-
details: {
|
|
28
|
-
command: commandName,
|
|
29
|
-
flag: "__proto__"
|
|
30
|
-
},
|
|
31
|
-
suggest: "Rename the flag, for example to \"proto\""
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Reject a flag record whose entries a name check cannot reach.
|
|
36
|
-
*
|
|
37
|
-
* Only own enumerable keys are read. An object literal routes a bare
|
|
38
|
-
* `__proto__` key to the prototype setter, and a record built over another
|
|
39
|
-
* object hides its inherited entries, so in both cases a declared flag is
|
|
40
|
-
* already gone by the time {@link assertUsableFlagKey} sees a name. The
|
|
41
|
-
* replaced prototype is the evidence common to both. `Object.prototype` and
|
|
42
|
-
* `null` (an `Object.create(null)` record) carry no entries of their own and
|
|
43
|
-
* pass.
|
|
44
|
-
*
|
|
45
|
-
* @param commandName - Command the flags were declared on, for the error details.
|
|
46
|
-
* @param flags - Flag record as the caller supplied it.
|
|
47
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when the record's prototype is
|
|
48
|
-
* replaced.
|
|
49
|
-
*
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
function assertUsableFlagRecord(commandName, flags) {
|
|
53
|
-
const prototype = Object.getPrototypeOf(flags);
|
|
54
|
-
if (prototype === Object.prototype || prototype === null) return;
|
|
55
|
-
throw new CLIError(`Command '${commandName}' flag record has a replaced prototype. A '__proto__' key sets the prototype instead of adding a flag, and an inherited flag is never read`, {
|
|
56
|
-
code: "INVALID_SCHEMA",
|
|
57
|
-
details: { command: commandName },
|
|
58
|
-
suggest: "Pass a plain object with no '__proto__' key, or a record built with Object.create(null)"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Reject an arg name a plain record cannot carry.
|
|
63
|
-
*
|
|
64
|
-
* Resolved args reach the handler as a record keyed by arg name, and the parser
|
|
65
|
-
* accumulates positionals into one, so `__proto__` would swallow the value the
|
|
66
|
-
* user typed and hand the handler the prototype instead.
|
|
67
|
-
*
|
|
68
|
-
* @param commandName - Command the arg was declared on, for the error details.
|
|
69
|
-
* @param name - Proposed arg name.
|
|
70
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when the name is `__proto__`.
|
|
71
|
-
*
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
function assertUsableArgKey(commandName, name) {
|
|
75
|
-
if (name !== "__proto__") return;
|
|
76
|
-
throw new CLIError(`Argument name '${name}' is not usable as an argument`, {
|
|
77
|
-
code: "INVALID_SCHEMA",
|
|
78
|
-
details: {
|
|
79
|
-
command: commandName,
|
|
80
|
-
arg: name
|
|
81
|
-
},
|
|
82
|
-
suggest: "Rename the argument, for example to \"proto\""
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Merge definition fields onto the {@link CommandSchema} defaults, recursively.
|
|
87
|
-
*
|
|
88
|
-
* @param definition - Command definition to normalize.
|
|
89
|
-
* @returns A fully populated {@link CommandSchema}.
|
|
90
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when a name at any depth is empty
|
|
91
|
-
* or contains whitespace, a flag or arg is named `__proto__` at any depth,
|
|
92
|
-
* or a flag record at any depth has a replaced prototype.
|
|
93
|
-
* @throws {@link CLIError} `INVALID_BUILDER_STATE` or `DUPLICATE_STDIN_INPUT` when
|
|
94
|
-
* an input breaks the positional-order or stdin invariants.
|
|
95
|
-
*
|
|
96
|
-
* @internal
|
|
97
|
-
*/
|
|
98
|
-
function buildCommandSchema(definition) {
|
|
99
|
-
if (definition.name === "" || /\s/u.test(definition.name)) throw new CLIError("Command schema requires a non-empty name without whitespace", {
|
|
100
|
-
code: "INVALID_SCHEMA",
|
|
101
|
-
details: { name: definition.name },
|
|
102
|
-
suggest: "Pass a dispatch name such as { name: \"deploy\" }"
|
|
103
|
-
});
|
|
104
|
-
const flagDefinitions = definition.flags ?? {};
|
|
105
|
-
assertUsableFlagRecord(definition.name, flagDefinitions);
|
|
106
|
-
const flags = {};
|
|
107
|
-
for (const [name, value] of Object.entries(flagDefinitions)) {
|
|
108
|
-
assertUsableFlagKey(definition.name, name);
|
|
109
|
-
const flagSchema = createFlagSchema(value);
|
|
110
|
-
validateFlagStdinEntry(definition.name, name, flagSchema, flags, []);
|
|
111
|
-
flags[name] = flagSchema;
|
|
112
|
-
}
|
|
113
|
-
const args = [];
|
|
114
|
-
for (const entry of definition.args ?? []) {
|
|
115
|
-
const schema = createArgSchema(entry.schema);
|
|
116
|
-
validateArgEntry(definition.name, entry.name, schema, flags, args);
|
|
117
|
-
args.push({
|
|
118
|
-
name: entry.name,
|
|
119
|
-
schema
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
name: definition.name,
|
|
124
|
-
description: definition.description,
|
|
125
|
-
aliases: definition.aliases ?? [],
|
|
126
|
-
hidden: definition.hidden ?? false,
|
|
127
|
-
examples: definition.examples ?? [],
|
|
128
|
-
flags,
|
|
129
|
-
args,
|
|
130
|
-
hasAction: definition.hasAction ?? false,
|
|
131
|
-
interactive: definition.interactive,
|
|
132
|
-
commands: (definition.commands ?? []).map((child) => buildCommandSchema(child))
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Create a {@link CommandSchema} from a plain definition object.
|
|
137
|
-
*
|
|
138
|
-
* Most consumers should prefer {@link command | command()}, which returns a
|
|
139
|
-
* {@link CommandBuilder} with type inference. `createCommandSchema()` is the
|
|
140
|
-
* low-level escape hatch for tooling that composes schemas as data.
|
|
141
|
-
*
|
|
142
|
-
* Flags, args, and subcommands are normalized recursively, so an already-built
|
|
143
|
-
* schema fed back in produces a deep-equal schema.
|
|
144
|
-
*
|
|
145
|
-
* Flag spellings are checked across the whole tree, so a definition whose names,
|
|
146
|
-
* aliases, or negated spellings collide with each other or with a propagated
|
|
147
|
-
* ancestor flag is rejected here. Both flags still parse under their canonical
|
|
148
|
-
* names, so what a collision costs is the shared spelling. Help advertises it on
|
|
149
|
-
* both flags and the parser answers it with one of them.
|
|
150
|
-
* Args go through the same invariants {@link CommandBuilder.arg} enforces.
|
|
151
|
-
* These are the checks the {@link CommandBuilder} applies as flags, args, and
|
|
152
|
-
* subcommands are registered.
|
|
153
|
-
*
|
|
154
|
-
* @param definition - Command name plus optional flags, args, and subcommands.
|
|
155
|
-
* @returns A fully populated {@link CommandSchema}.
|
|
156
|
-
* @throws {CLIError} With code `'INVALID_SCHEMA'` when a name at any depth is
|
|
157
|
-
* empty or contains whitespace, a flag or arg at any depth is named
|
|
158
|
-
* `__proto__`, which JavaScript cannot carry as a plain record key, or a flag
|
|
159
|
-
* record at any depth has a
|
|
160
|
-
* replaced prototype, which hides the entries a name check would read.
|
|
161
|
-
* @throws {CLIError} With code `'FLAG_NAME_COLLISION'` when two flags on one
|
|
162
|
-
* command share a spelling.
|
|
163
|
-
* @throws {CLIError} With code `'PROPAGATED_FLAG_COLLISION'` when a flag shadows
|
|
164
|
-
* a spelling propagated from an ancestor command.
|
|
165
|
-
* @throws {CLIError} With code `'INVALID_BUILDER_STATE'` when a positional comes
|
|
166
|
-
* after a variadic one, or `'DUPLICATE_STDIN_INPUT'` when two inputs on one
|
|
167
|
-
* command consume stdin and either is exclusive.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```ts
|
|
171
|
-
* const schema = createCommandSchema({
|
|
172
|
-
* name: 'deploy',
|
|
173
|
-
* description: 'Ship the build',
|
|
174
|
-
* flags: { force: { kind: 'boolean' } },
|
|
175
|
-
* args: [{ name: 'target', schema: { kind: 'string' } }],
|
|
176
|
-
* });
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
function createCommandSchema(definition) {
|
|
180
|
-
const schema = buildCommandSchema(definition);
|
|
181
|
-
validateCommandFlagTree(schema);
|
|
182
|
-
return schema;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Validate a new arg entry against invariants before adding it to the command.
|
|
186
|
-
*
|
|
187
|
-
* @param commandName - Command the arg was declared on. A definition tree reaches
|
|
188
|
-
* here at any depth, so every error carries it in `details`.
|
|
189
|
-
* @param name - Arg name being registered.
|
|
190
|
-
* @param schema - Runtime descriptor of the arg.
|
|
191
|
-
* @param flags - Already-registered flag schemas on this command.
|
|
192
|
-
* @param args - Already-registered arg entries on this command.
|
|
193
|
-
*
|
|
194
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` if the name is `__proto__`.
|
|
195
|
-
* @throws {@link CLIError} `INVALID_BUILDER_STATE` if an earlier arg is variadic.
|
|
196
|
-
* @throws {@link CLIError} `DUPLICATE_STDIN_INPUT` if another input already consumes stdin exclusively.
|
|
197
|
-
*
|
|
198
|
-
* @internal
|
|
199
|
-
*/
|
|
200
|
-
function validateArgEntry(commandName, name, schema, flags, args) {
|
|
201
|
-
assertUsableArgKey(commandName, name);
|
|
202
|
-
assertVariadicIsLast(commandName, name, args);
|
|
203
|
-
assertStdinExclusivity(commandName, {
|
|
204
|
-
kind: "arg",
|
|
205
|
-
name,
|
|
206
|
-
stdin: schema.stdin
|
|
207
|
-
}, flags, args);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Reject a positional declared after one that consumes the whole tail.
|
|
211
|
-
*
|
|
212
|
-
* A variadic arg takes every remaining positional, so anything registered after
|
|
213
|
-
* it can never be filled, and a second variadic arg has nothing left to collect.
|
|
214
|
-
*
|
|
215
|
-
* @param commandName - Command the arg was declared on.
|
|
216
|
-
* @param name - Arg name being registered.
|
|
217
|
-
* @param args - Already-registered arg entries on this command.
|
|
218
|
-
* @throws {@link CLIError} `INVALID_BUILDER_STATE` when an earlier arg is variadic.
|
|
219
|
-
*
|
|
220
|
-
* @internal
|
|
221
|
-
*/
|
|
222
|
-
function assertVariadicIsLast(commandName, name, args) {
|
|
223
|
-
const greedy = args.find((entry) => entry.schema.variadic);
|
|
224
|
-
if (greedy === void 0) return;
|
|
225
|
-
throw new CLIError(`Argument <${name}> comes after variadic argument <${greedy.name}>, which consumes every remaining positional`, {
|
|
226
|
-
code: "INVALID_BUILDER_STATE",
|
|
227
|
-
details: {
|
|
228
|
-
command: commandName,
|
|
229
|
-
arg: name,
|
|
230
|
-
variadicArg: greedy.name
|
|
231
|
-
},
|
|
232
|
-
suggest: `Declare <${name}> before <${greedy.name}>, or drop .variadic() from <${greedy.name}>`
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Reject a second stdin consumer when either it or an existing one is exclusive.
|
|
237
|
-
*
|
|
238
|
-
* One command reads stdin once, so an exclusive consumer must be the only one.
|
|
239
|
-
* Several `{ consume: 'broadcast' }` inputs coexist and all receive the same
|
|
240
|
-
* buffer. The rule spans both surfaces, so a flag and an arg conflict with each
|
|
241
|
-
* other exactly as two args do.
|
|
242
|
-
*
|
|
243
|
-
* @param commandName - Command the input was declared on.
|
|
244
|
-
* @param candidate - The input being registered.
|
|
245
|
-
* @param flags - Already-registered flag schemas on this command.
|
|
246
|
-
* @param args - Already-registered arg entries on this command.
|
|
247
|
-
* @throws {@link CLIError} `DUPLICATE_STDIN_INPUT` on a conflict.
|
|
248
|
-
*
|
|
249
|
-
* @internal
|
|
250
|
-
*/
|
|
251
|
-
function assertStdinExclusivity(commandName, candidate, flags, args) {
|
|
252
|
-
const stdin = candidate.stdin;
|
|
253
|
-
if (stdin === void 0) return;
|
|
254
|
-
for (const existing of stdinConsumers(flags, args)) {
|
|
255
|
-
if (existing.kind === candidate.kind && existing.name === candidate.name) continue;
|
|
256
|
-
if (stdin.consume === "broadcast" && existing.stdin.consume === "broadcast") continue;
|
|
257
|
-
throw new CLIError(`Only one input may consume stdin exclusively; ${stdinConsumerReference(existing)} already consumes stdin`, {
|
|
258
|
-
code: "DUPLICATE_STDIN_INPUT",
|
|
259
|
-
details: {
|
|
260
|
-
command: commandName,
|
|
261
|
-
...candidate.kind === "flag" ? { flag: candidate.name } : { arg: candidate.name },
|
|
262
|
-
...existing.kind === "flag" ? { existingFlag: existing.name } : { existingArg: existing.name }
|
|
263
|
-
},
|
|
264
|
-
suggest: "Keep .stdin() on a single input per command, or declare every stdin input with { consume: 'broadcast' }"
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Validate a new flag against the stdin invariants before adding it.
|
|
270
|
-
*
|
|
271
|
-
* @param commandName - Command the flag was declared on.
|
|
272
|
-
* @param name - Flag name being registered.
|
|
273
|
-
* @param schema - Runtime descriptor of the flag.
|
|
274
|
-
* @param flags - Already-registered flag schemas on this command.
|
|
275
|
-
* @param args - Already-registered arg entries on this command.
|
|
276
|
-
* @throws {@link CLIError} `DUPLICATE_STDIN_INPUT` when another input already
|
|
277
|
-
* consumes stdin exclusively.
|
|
278
|
-
*
|
|
279
|
-
* @internal
|
|
280
|
-
*/
|
|
281
|
-
function validateFlagStdinEntry(commandName, name, schema, flags, args) {
|
|
282
|
-
assertStdinExclusivity(commandName, {
|
|
283
|
-
kind: "flag",
|
|
284
|
-
name,
|
|
285
|
-
stdin: schema.stdin
|
|
286
|
-
}, flags, args);
|
|
287
|
-
}
|
|
288
|
-
function formatFlagToken(name, kind) {
|
|
289
|
-
return kind === "alias" && name.length === 1 ? `-${name}` : `--${name}`;
|
|
290
|
-
}
|
|
291
|
-
function describeFlagForm(form) {
|
|
292
|
-
if (form.kind === "canonical") return `canonical flag ${formatFlagToken(form.name, form.kind)}`;
|
|
293
|
-
if (form.kind === "negation") return `${form.hidden ? "hidden " : ""}negated spelling ${formatFlagToken(form.name, form.kind)}`;
|
|
294
|
-
const aliasType = form.name.length === 1 ? "short alias" : "long alias";
|
|
295
|
-
return `${form.hidden ? "hidden " : ""}${aliasType} ${formatFlagToken(form.name, form.kind)}`;
|
|
296
|
-
}
|
|
297
|
-
function listFlagForms(name, schema) {
|
|
298
|
-
const negatedName = getFlagNegatedName(name, schema);
|
|
299
|
-
return [
|
|
300
|
-
{
|
|
301
|
-
owner: name,
|
|
302
|
-
name,
|
|
303
|
-
kind: "canonical",
|
|
304
|
-
hidden: false
|
|
305
|
-
},
|
|
306
|
-
...schema.aliases.map((alias) => ({
|
|
307
|
-
owner: name,
|
|
308
|
-
name: alias.name,
|
|
309
|
-
kind: "alias",
|
|
310
|
-
hidden: alias.hidden
|
|
311
|
-
})),
|
|
312
|
-
...negatedName !== void 0 && schema.negation !== void 0 ? [{
|
|
313
|
-
owner: name,
|
|
314
|
-
name: negatedName,
|
|
315
|
-
kind: "negation",
|
|
316
|
-
hidden: schema.negation.hidden
|
|
317
|
-
}] : []
|
|
318
|
-
];
|
|
319
|
-
}
|
|
320
|
-
function throwFlagCollisionError(commandName, form, existing, options) {
|
|
321
|
-
const inherited = options?.inherited ?? false;
|
|
322
|
-
const existingOwner = `flag ${formatFlagToken(existing.owner, "canonical")}`;
|
|
323
|
-
const subject = `Command '${commandName}' ${existingOwner}`;
|
|
324
|
-
throw new CLIError(inherited ? `${subject} propagates ${describeFlagForm(existing)}, which collides with ${describeFlagForm(form)} on flag ${formatFlagToken(form.owner, "canonical")}` : `Command '${commandName}' flag ${formatFlagToken(form.owner, "canonical")} ${describeFlagForm(form)} collides with ${describeFlagForm(existing)} on ${existingOwner}`, {
|
|
325
|
-
code: inherited ? "PROPAGATED_FLAG_COLLISION" : "FLAG_NAME_COLLISION",
|
|
326
|
-
details: {
|
|
327
|
-
command: commandName,
|
|
328
|
-
flag: form.owner,
|
|
329
|
-
surface: form.name,
|
|
330
|
-
surfaceKind: form.kind,
|
|
331
|
-
hidden: form.hidden,
|
|
332
|
-
existingFlag: existing.owner,
|
|
333
|
-
existingSurface: existing.name,
|
|
334
|
-
existingSurfaceKind: existing.kind,
|
|
335
|
-
existingHidden: existing.hidden,
|
|
336
|
-
inherited
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
function validateLocalFlagCollisions(commandName, flags) {
|
|
341
|
-
const seen = /* @__PURE__ */ new Map();
|
|
342
|
-
for (const [name, schema] of Object.entries(flags)) for (const form of listFlagForms(name, schema)) {
|
|
343
|
-
const existing = seen.get(form.name);
|
|
344
|
-
if (existing !== void 0) throwFlagCollisionError(commandName, form, existing);
|
|
345
|
-
seen.set(form.name, form);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
function validateInheritedFlagCollisions(commandName, inherited, local) {
|
|
349
|
-
const inheritedForms = /* @__PURE__ */ new Map();
|
|
350
|
-
for (const [name, schema] of Object.entries(inherited)) for (const form of listFlagForms(name, schema)) inheritedForms.set(form.name, form);
|
|
351
|
-
for (const [name, schema] of Object.entries(local)) for (const form of listFlagForms(name, schema)) {
|
|
352
|
-
const existing = inheritedForms.get(form.name);
|
|
353
|
-
if (existing !== void 0) throwFlagCollisionError(commandName, form, existing, { inherited: true });
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function buildInheritedFlagsForChildren(inherited, local) {
|
|
357
|
-
const next = { ...inherited };
|
|
358
|
-
for (const name of Object.keys(local)) delete next[name];
|
|
359
|
-
for (const [name, schema] of Object.entries(local)) if (schema.propagate) next[name] = schema;
|
|
360
|
-
return next;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Reject a command whose flags collide on any spelling, walking subcommands.
|
|
364
|
-
*
|
|
365
|
-
* @param command - Command schema to validate.
|
|
366
|
-
* @param inheritedFlags - Propagated ancestor flags visible at this level.
|
|
367
|
-
* @throws {@link CLIError} `FLAG_NAME_COLLISION` or `PROPAGATED_FLAG_COLLISION`.
|
|
368
|
-
*
|
|
369
|
-
* @internal
|
|
370
|
-
*/
|
|
371
|
-
function validateCommandFlagTree(command, inheritedFlags = {}) {
|
|
372
|
-
validateLocalFlagCollisions(command.name, command.flags);
|
|
373
|
-
const visibleInherited = { ...inheritedFlags };
|
|
374
|
-
for (const name of Object.keys(command.flags)) delete visibleInherited[name];
|
|
375
|
-
validateInheritedFlagCollisions(command.name, visibleInherited, command.flags);
|
|
376
|
-
const effectiveFlags = {
|
|
377
|
-
...visibleInherited,
|
|
378
|
-
...command.flags
|
|
379
|
-
};
|
|
380
|
-
for (const [name, schema] of Object.entries(effectiveFlags)) validateFlagStdinEntry(command.name, name, schema, effectiveFlags, command.args);
|
|
381
|
-
const inheritedForChildren = buildInheritedFlagsForChildren(inheritedFlags, command.flags);
|
|
382
|
-
for (const child of command.commands) validateCommandFlagTree(child, inheritedForChildren);
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Erase a typed `CommandBuilder<F, A, C>` to `AnyCommandBuilder` for
|
|
386
|
-
* heterogeneous storage. Centralises the `as unknown as` double-cast
|
|
387
|
-
* required at the type-erasure boundary.
|
|
388
|
-
*
|
|
389
|
-
* @internal
|
|
390
|
-
*/
|
|
391
|
-
function eraseBuilder(builder) {
|
|
392
|
-
return builder;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Immutable command schema builder.
|
|
396
|
-
*
|
|
397
|
-
* The type parameters `F` (flags), `A` (args), and `C` (context) are
|
|
398
|
-
* phantom types that accumulate builder types as `.flag()`, `.arg()`,
|
|
399
|
-
* `.derive()`, and `.middleware()` are chained. The `.action()` handler receives
|
|
400
|
-
* fully typed `ActionParams<F, A, C>`.
|
|
401
|
-
*
|
|
402
|
-
* `C` defaults to `Record<string, never>`, making `ctx` property
|
|
403
|
-
* access a type error until derive or middleware extends it.
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
* ```ts
|
|
407
|
-
* const deploy = command('deploy')
|
|
408
|
-
* .description('Deploy to an environment')
|
|
409
|
-
* .arg('target', arg.string().describe('Deploy target'))
|
|
410
|
-
* .flag('force', flag.boolean().alias('f'))
|
|
411
|
-
* .flag('region', flag.enum(['us', 'eu', 'ap']))
|
|
412
|
-
* .action(async ({ args, flags, out }) => {
|
|
413
|
-
* // args.target: string
|
|
414
|
-
* // flags.force: boolean
|
|
415
|
-
* // flags.region: 'us' | 'eu' | 'ap' | undefined
|
|
416
|
-
* out.log(`Deploying ${args.target}...`);
|
|
417
|
-
* });
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
var CommandBuilder = class CommandBuilder {
|
|
421
|
-
/** @internal Runtime schema descriptor. */
|
|
422
|
-
schema;
|
|
423
|
-
/** @internal The action handler, if registered (type-erased for covariance). */
|
|
424
|
-
handler;
|
|
425
|
-
/**
|
|
426
|
-
* @internal Nested sub-command builders (type-erased for heterogeneous storage).
|
|
427
|
-
*
|
|
428
|
-
* Stored separately from `schema.commands` because builders carry action
|
|
429
|
-
* handlers and phantom types needed by `compileCommand()` in the CLI layer.
|
|
430
|
-
* `schema.commands` holds pure `CommandSchema[]` for help/completion.
|
|
431
|
-
*/
|
|
432
|
-
_subcommands;
|
|
433
|
-
/**
|
|
434
|
-
* @internal Derive and middleware steps in registration order.
|
|
435
|
-
*
|
|
436
|
-
* The executor builds the handler chain from this list.
|
|
437
|
-
*/
|
|
438
|
-
_executionSteps;
|
|
439
|
-
/**
|
|
440
|
-
* Create a command builder from a pre-built schema descriptor.
|
|
441
|
-
*
|
|
442
|
-
* @param schema - Runtime command descriptor.
|
|
443
|
-
* @param handler - Action handler, if registered.
|
|
444
|
-
* @param subcommands - Nested sub-command builders (type-erased).
|
|
445
|
-
* @param executionSteps - Derive/middleware steps in registration order.
|
|
446
|
-
*/
|
|
447
|
-
constructor(schema, handler, subcommands, executionSteps) {
|
|
448
|
-
this.schema = schema;
|
|
449
|
-
this.handler = handler;
|
|
450
|
-
this._subcommands = subcommands ?? [];
|
|
451
|
-
this._executionSteps = executionSteps ?? [];
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Register a command-level interactive resolver for schema-driven prompts.
|
|
455
|
-
*
|
|
456
|
-
* The resolver is called after CLI/env/config resolution with partially
|
|
457
|
-
* resolved flag values. It returns a prompt schema for flags that need
|
|
458
|
-
* interactive input based on the current state.
|
|
459
|
-
*
|
|
460
|
-
* For flags the resolver returns a {@linkcode PromptConfig}, that config is used
|
|
461
|
-
* instead of any per-flag `.prompt()` config. For flags returned as falsy
|
|
462
|
-
* (or not mentioned), per-flag `.prompt()` configs are used as fallback.
|
|
463
|
-
*
|
|
464
|
-
* Commands without `.interactive()` use per-flag prompt configs directly.
|
|
465
|
-
*
|
|
466
|
-
* @example
|
|
467
|
-
* ```ts
|
|
468
|
-
* const deploy = command('deploy')
|
|
469
|
-
* .flag('region', flag.enum(['us', 'eu', 'ap']))
|
|
470
|
-
* .flag('force', flag.boolean())
|
|
471
|
-
* .interactive(({ flags }) => ({
|
|
472
|
-
* region: !flags.region && {
|
|
473
|
-
* kind: 'select',
|
|
474
|
-
* message: 'Select region',
|
|
475
|
-
* },
|
|
476
|
-
* }))
|
|
477
|
-
* .action(({ flags }) => { ... });
|
|
478
|
-
* ```
|
|
479
|
-
*
|
|
480
|
-
* @param resolver - Function receiving partially resolved flags and returning prompt configs.
|
|
481
|
-
* @returns The builder (for chaining).
|
|
482
|
-
*/
|
|
483
|
-
interactive(resolver) {
|
|
484
|
-
const erased = resolver;
|
|
485
|
-
return new CommandBuilder({
|
|
486
|
-
...this.schema,
|
|
487
|
-
interactive: erased
|
|
488
|
-
}, this.handler, this._subcommands, this._executionSteps);
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Register a command-scoped typed pre-action handler.
|
|
492
|
-
*
|
|
493
|
-
* Derive runs after full resolution and before the action handler.
|
|
494
|
-
* It receives typed `{ args, flags, ctx, out, meta }` and may either:
|
|
495
|
-
*
|
|
496
|
-
* - return nothing (or `undefined`) for validation-only behavior
|
|
497
|
-
* - return an object to merge additional properties into `ctx`
|
|
498
|
-
*
|
|
499
|
-
* Handlers may be async — the runtime awaits them before continuing.
|
|
500
|
-
*
|
|
501
|
-
* Unlike middleware, derive cannot wrap downstream execution and does not
|
|
502
|
-
* use `next()`. Use {@linkcode middleware} for timing, logging, retries, cleanup,
|
|
503
|
-
* or error-boundary patterns.
|
|
504
|
-
*
|
|
505
|
-
* Adding derive drops the current handler (like `.flag()`, `.arg()`, and
|
|
506
|
-
* `.middleware()`) because the action handler's `ctx` type may change.
|
|
507
|
-
*
|
|
508
|
-
* @example
|
|
509
|
-
* ```ts
|
|
510
|
-
* command('deploy')
|
|
511
|
-
* .flag('token', flag.string().env('AUTH_TOKEN'))
|
|
512
|
-
* .derive(({ flags }) => {
|
|
513
|
-
* if (!flags.token) {
|
|
514
|
-
* throw new CLIError('Not authenticated', {
|
|
515
|
-
* code: 'AUTH_REQUIRED',
|
|
516
|
-
* suggest: 'Run `mycli login` or set AUTH_TOKEN',
|
|
517
|
-
* });
|
|
518
|
-
* }
|
|
519
|
-
* return { token: flags.token };
|
|
520
|
-
* })
|
|
521
|
-
* .action(({ ctx }) => {
|
|
522
|
-
* ctx.token; // string
|
|
523
|
-
* });
|
|
524
|
-
* ```
|
|
525
|
-
*
|
|
526
|
-
* @param handler - Derive function receiving typed args/flags/ctx.
|
|
527
|
-
* @returns The builder (for chaining).
|
|
528
|
-
*/
|
|
529
|
-
derive(handler) {
|
|
530
|
-
const erased = handler;
|
|
531
|
-
return new CommandBuilder({
|
|
532
|
-
...this.schema,
|
|
533
|
-
hasAction: false
|
|
534
|
-
}, void 0, this._subcommands, [...this._executionSteps, {
|
|
535
|
-
kind: "derive",
|
|
536
|
-
handler: erased
|
|
537
|
-
}]);
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Register middleware to run before the action handler.
|
|
541
|
-
*
|
|
542
|
-
* Middleware executes in registration order. Each middleware receives
|
|
543
|
-
* `{ args, flags, ctx, out, meta, next }` and must call `next(additions)`
|
|
544
|
-
* to continue the chain. Context additions are merged and become
|
|
545
|
-
* typed downstream.
|
|
546
|
-
*
|
|
547
|
-
* Adding middleware widens `C` via intersection and drops the current
|
|
548
|
-
* handler (like `.flag()` / `.arg()` — the handler's type signature
|
|
549
|
-
* changes when context changes).
|
|
550
|
-
*
|
|
551
|
-
* @example
|
|
552
|
-
* ```ts
|
|
553
|
-
* import { CLIError, command, middleware } from '@kjanat/dreamcli';
|
|
554
|
-
*
|
|
555
|
-
* interface User {
|
|
556
|
-
* id: string;
|
|
557
|
-
* email: string;
|
|
558
|
-
* }
|
|
559
|
-
*
|
|
560
|
-
* async function getCurrentUser(): Promise<User | null> {
|
|
561
|
-
* return { id: 'u_123', email: 'dev@example.com' };
|
|
562
|
-
* }
|
|
563
|
-
*
|
|
564
|
-
* function startTrace(name: string): string {
|
|
565
|
-
* return `trace:${name}`;
|
|
566
|
-
* }
|
|
567
|
-
*
|
|
568
|
-
* // Resolve the current user and expose it as `ctx.user` downstream.
|
|
569
|
-
* const auth = middleware<{ user: User }>(async ({ next }) => {
|
|
570
|
-
* const user = await getCurrentUser();
|
|
571
|
-
* if (!user) {
|
|
572
|
-
* throw new CLIError('Not authenticated', { code: 'AUTH_REQUIRED' });
|
|
573
|
-
* }
|
|
574
|
-
* await next({ user });
|
|
575
|
-
* });
|
|
576
|
-
*
|
|
577
|
-
* // Create a trace id for this command run and expose it as `ctx.traceId`.
|
|
578
|
-
* const telemetry = middleware<{ traceId: string }>(async ({ meta, next }) => {
|
|
579
|
-
* const traceId = startTrace(`${meta.name}.${meta.command}`);
|
|
580
|
-
* await next({ traceId });
|
|
581
|
-
* });
|
|
582
|
-
*
|
|
583
|
-
* command('deploy')
|
|
584
|
-
* .middleware(auth) // C becomes { user: User }
|
|
585
|
-
* .middleware(telemetry) // C becomes { user: User } & { traceId: string }
|
|
586
|
-
* .action(({ ctx }) => {
|
|
587
|
-
* ctx.user; // User — typed
|
|
588
|
-
* ctx.traceId; // string — typed
|
|
589
|
-
* });
|
|
590
|
-
* ```
|
|
591
|
-
*
|
|
592
|
-
* @param m - {@link Middleware} instance created via {@linkcode middleware | middleware()}.
|
|
593
|
-
* Middleware handlers receive `{ args, flags, ctx, out, meta, next }`.
|
|
594
|
-
* @returns The builder (for chaining).
|
|
595
|
-
*/
|
|
596
|
-
middleware(m) {
|
|
597
|
-
return new CommandBuilder({
|
|
598
|
-
...this.schema,
|
|
599
|
-
hasAction: false
|
|
600
|
-
}, void 0, this._subcommands, [...this._executionSteps, {
|
|
601
|
-
kind: "middleware",
|
|
602
|
-
handler: m._handler
|
|
603
|
-
}]);
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Set the command's description for help text.
|
|
607
|
-
*
|
|
608
|
-
* Displayed below the usage line in `--help` output and next to the
|
|
609
|
-
* command name in parent command/group help listings.
|
|
610
|
-
*
|
|
611
|
-
* @param text - One-line description of what the command does.
|
|
612
|
-
*
|
|
613
|
-
* @example
|
|
614
|
-
* ```ts
|
|
615
|
-
* command('deploy')
|
|
616
|
-
* .description('Deploy the application to a target environment')
|
|
617
|
-
* .action(({ out }) => { out.log('deploying...'); });
|
|
618
|
-
*
|
|
619
|
-
* // $ mycli deploy --help
|
|
620
|
-
* // Usage: deploy [flags]
|
|
621
|
-
* //
|
|
622
|
-
* // Deploy the application to a target environment
|
|
623
|
-
* ```
|
|
624
|
-
*
|
|
625
|
-
* @returns The builder (for chaining).
|
|
626
|
-
*/
|
|
627
|
-
description(text) {
|
|
628
|
-
return new CommandBuilder({
|
|
629
|
-
...this.schema,
|
|
630
|
-
description: text
|
|
631
|
-
}, this.handler, this._subcommands, this._executionSteps);
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Add an alternative name for this command.
|
|
635
|
-
*
|
|
636
|
-
* Aliases are accepted during dispatch alongside the primary name.
|
|
637
|
-
* Multiple aliases can be chained. Aliases are shown in help output.
|
|
638
|
-
*
|
|
639
|
-
* @param name - Alternative command name (e.g. `'d'` for `deploy`).
|
|
640
|
-
*
|
|
641
|
-
* @example
|
|
642
|
-
* ```ts
|
|
643
|
-
* command('deploy')
|
|
644
|
-
* .alias('d')
|
|
645
|
-
* .alias('push')
|
|
646
|
-
* .action(({ out }) => { out.log('deploying...'); });
|
|
647
|
-
*
|
|
648
|
-
* // All equivalent:
|
|
649
|
-
* // $ mycli deploy
|
|
650
|
-
* // $ mycli d
|
|
651
|
-
* // $ mycli push
|
|
652
|
-
* ```
|
|
653
|
-
*
|
|
654
|
-
* @returns The builder (for chaining).
|
|
655
|
-
*/
|
|
656
|
-
alias(name) {
|
|
657
|
-
return new CommandBuilder({
|
|
658
|
-
...this.schema,
|
|
659
|
-
aliases: [...this.schema.aliases, name]
|
|
660
|
-
}, this.handler, this._subcommands, this._executionSteps);
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Hide this command from help listings.
|
|
664
|
-
*
|
|
665
|
-
* The command remains fully functional and dispatchable — it just
|
|
666
|
-
* won't appear in `--help` output or shell completions. Useful for
|
|
667
|
-
* internal/debug commands.
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* ```ts
|
|
671
|
-
* command('debug-dump')
|
|
672
|
-
* .hidden()
|
|
673
|
-
* .action(({ out }) => { out.log(JSON.stringify(internalState)); });
|
|
674
|
-
*
|
|
675
|
-
* // $ mycli --help → 'debug-dump' is not listed
|
|
676
|
-
* // $ mycli debug-dump → still works
|
|
677
|
-
* ```
|
|
678
|
-
*
|
|
679
|
-
* @returns The builder (for chaining).
|
|
680
|
-
*/
|
|
681
|
-
hidden() {
|
|
682
|
-
return new CommandBuilder({
|
|
683
|
-
...this.schema,
|
|
684
|
-
hidden: true
|
|
685
|
-
}, this.handler, this._subcommands, this._executionSteps);
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Add a usage example to help text.
|
|
689
|
-
*
|
|
690
|
-
* Examples are rendered in the "Examples:" section of `--help` output.
|
|
691
|
-
* Call multiple times to add several examples. Each example shows a
|
|
692
|
-
* shell invocation, optionally with a description.
|
|
693
|
-
*
|
|
694
|
-
* `cmd` may be a literal string or a function receiving the program
|
|
695
|
-
* {@link ExampleMeta} (`name`, `version`), resolved at render time. Use the
|
|
696
|
-
* function form to reference the invoked program name instead of hardcoding
|
|
697
|
-
* it, so examples stay truthful under symlinks, `inheritName`, and
|
|
698
|
-
* `npx x` vs a global install.
|
|
699
|
-
*
|
|
700
|
-
* @param cmd - The example command line, or a `(meta) => string` builder.
|
|
701
|
-
* @param description - Optional one-line explanation of what the example does.
|
|
702
|
-
*
|
|
703
|
-
* @example
|
|
704
|
-
* ```ts
|
|
705
|
-
* command('deploy')
|
|
706
|
-
* .arg('target', arg.string())
|
|
707
|
-
* .flag('force', flag.boolean().alias('f'))
|
|
708
|
-
* .example('deploy production', 'Deploy to production')
|
|
709
|
-
* .example((m) => `${m.name} deploy staging -f`, 'Force deploy to staging')
|
|
710
|
-
* .action(({ args, flags }) => { ... });
|
|
711
|
-
*
|
|
712
|
-
* // $ mycli deploy --help
|
|
713
|
-
* // ...
|
|
714
|
-
* // Examples:
|
|
715
|
-
* // deploy production Deploy to production
|
|
716
|
-
* // mycli deploy staging -f Force deploy to staging
|
|
717
|
-
* ```
|
|
718
|
-
*
|
|
719
|
-
* @returns The builder (for chaining).
|
|
720
|
-
*/
|
|
721
|
-
example(cmd, description) {
|
|
722
|
-
const entry = description !== void 0 ? {
|
|
723
|
-
command: cmd,
|
|
724
|
-
description
|
|
725
|
-
} : { command: cmd };
|
|
726
|
-
return new CommandBuilder({
|
|
727
|
-
...this.schema,
|
|
728
|
-
examples: [...this.schema.examples, entry]
|
|
729
|
-
}, this.handler, this._subcommands, this._executionSteps);
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Register a named flag on this command.
|
|
733
|
-
*
|
|
734
|
-
* The flag name is added to the type-level `F` map. Duplicate flag names
|
|
735
|
-
* are prevented at the type level via the `Exclude` constraint.
|
|
736
|
-
*
|
|
737
|
-
* The builder controls the flag's type, presence, aliases, env/config
|
|
738
|
-
* bindings, and description. See {@link FlagBuilder} for available modifiers.
|
|
739
|
-
*
|
|
740
|
-
* @param name - Flag name: the `--name` CLI token and the matching key on `flags`
|
|
741
|
-
* in the handler. The name is preserved as-is (no camelCasing); read non-identifier
|
|
742
|
-
* names such as `'dry-run'` with bracket access (`flags['dry-run']`).
|
|
743
|
-
* @param builder - Configured {@linkcode FlagBuilder} from {@linkcode flag | flag.string()},
|
|
744
|
-
* `flag.boolean()`, `flag.number()`, `flag.enum()`, `flag.array()`, or `flag.custom()`.
|
|
745
|
-
*
|
|
746
|
-
* @example
|
|
747
|
-
* ```ts
|
|
748
|
-
* command('serve')
|
|
749
|
-
* .flag('port', flag.number()
|
|
750
|
-
* .alias('p')
|
|
751
|
-
* .env('PORT')
|
|
752
|
-
* .default(3000)
|
|
753
|
-
* .describe('Port to listen on'))
|
|
754
|
-
* .flag('host', flag.string()
|
|
755
|
-
* .env('HOST')
|
|
756
|
-
* .default('localhost')
|
|
757
|
-
* .describe('Bind address'))
|
|
758
|
-
* .flag('verbose', flag.boolean()
|
|
759
|
-
* .alias('v')
|
|
760
|
-
* .describe('Enable verbose logging'))
|
|
761
|
-
* .action(({ flags, out }) => {
|
|
762
|
-
* flags.port; // number
|
|
763
|
-
* flags.host; // string
|
|
764
|
-
* flags.verbose; // boolean
|
|
765
|
-
* out.log(`Listening on ${flags.host}:${flags.port}`);
|
|
766
|
-
* });
|
|
767
|
-
*
|
|
768
|
-
* // $ mycli serve --port 8080 -v
|
|
769
|
-
* // $ PORT=9090 mycli serve
|
|
770
|
-
* ```
|
|
771
|
-
*
|
|
772
|
-
* @returns The builder (for chaining).
|
|
773
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when the name is `__proto__`,
|
|
774
|
-
* which a plain record cannot carry.
|
|
775
|
-
* @throws {@link CLIError} `FLAG_NAME_COLLISION` when the command already
|
|
776
|
-
* declares this name, or the new flag's spellings collide with another
|
|
777
|
-
* flag's.
|
|
778
|
-
* @throws {@link CLIError} `PROPAGATED_FLAG_COLLISION` when a spelling
|
|
779
|
-
* collides with one propagated to a registered subcommand.
|
|
780
|
-
*/
|
|
781
|
-
flag(name, builder) {
|
|
782
|
-
assertUsableFlagKey(this.schema.name, name);
|
|
783
|
-
if (Object.hasOwn(this.schema.flags, name)) throw new CLIError(`Command '${this.schema.name}' already defines flag --${name}`, {
|
|
784
|
-
code: "FLAG_NAME_COLLISION",
|
|
785
|
-
details: {
|
|
786
|
-
command: this.schema.name,
|
|
787
|
-
flag: name,
|
|
788
|
-
surface: name,
|
|
789
|
-
surfaceKind: "canonical"
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
validateFlagStdinEntry(this.schema.name, name, builder.schema, this.schema.flags, this.schema.args);
|
|
793
|
-
const nextFlags = {
|
|
794
|
-
...this.schema.flags,
|
|
795
|
-
[name]: builder.schema
|
|
796
|
-
};
|
|
797
|
-
const nextSchema = {
|
|
798
|
-
...this.schema,
|
|
799
|
-
flags: nextFlags,
|
|
800
|
-
hasAction: false
|
|
801
|
-
};
|
|
802
|
-
validateCommandFlagTree(nextSchema);
|
|
803
|
-
return new CommandBuilder(nextSchema, void 0, this._subcommands, this._executionSteps);
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Register a named positional argument on this command.
|
|
807
|
-
*
|
|
808
|
-
* Args are ordered by registration — position on the CLI matches the
|
|
809
|
-
* order of `.arg()` calls. The arg name is added to the type-level `A`
|
|
810
|
-
* map. Duplicate arg names are prevented at the type level via the
|
|
811
|
-
* `Exclude` constraint.
|
|
812
|
-
*
|
|
813
|
-
* The builder controls the arg's type, presence, env binding, and
|
|
814
|
-
* description. See {@link ArgBuilder} for available modifiers.
|
|
815
|
-
*
|
|
816
|
-
* @param name - Positional arg name (used in help text and `args.*`).
|
|
817
|
-
* @param builder - Configured {@linkcode ArgBuilder} from `arg.string()`, `arg.number()`,
|
|
818
|
-
* or `arg.custom()`.
|
|
819
|
-
*
|
|
820
|
-
* @example
|
|
821
|
-
* ```ts
|
|
822
|
-
* command('deploy')
|
|
823
|
-
* // Required string arg — first positional
|
|
824
|
-
* .arg('target', arg.string()
|
|
825
|
-
* .env('DEPLOY_TARGET')
|
|
826
|
-
* .describe('Deploy target'))
|
|
827
|
-
* // Optional number arg — second positional
|
|
828
|
-
* .arg('port', arg.number()
|
|
829
|
-
* .env('PORT')
|
|
830
|
-
* .default(3000)
|
|
831
|
-
* .describe('Port number'))
|
|
832
|
-
* .action(({ args }) => {
|
|
833
|
-
* args.target; // string
|
|
834
|
-
* args.port; // number
|
|
835
|
-
* });
|
|
836
|
-
*
|
|
837
|
-
* // Usage: deploy [flags] <target> [port]
|
|
838
|
-
* // $ mycli deploy production 8080
|
|
839
|
-
* // $ DEPLOY_TARGET=staging mycli deploy
|
|
840
|
-
* ```
|
|
841
|
-
*
|
|
842
|
-
* @returns The builder (for chaining).
|
|
843
|
-
* @throws {@link CLIError} `INVALID_SCHEMA` when the name is `__proto__`,
|
|
844
|
-
* which a plain record cannot carry.
|
|
845
|
-
* @throws {@link CLIError} `INVALID_BUILDER_STATE` when an earlier arg on this
|
|
846
|
-
* command is variadic, so this one could never be filled.
|
|
847
|
-
* @throws {@link CLIError} `DUPLICATE_STDIN_INPUT` when another input on this
|
|
848
|
-
* command already consumes stdin exclusively.
|
|
849
|
-
*/
|
|
850
|
-
arg(name, builder) {
|
|
851
|
-
validateArgEntry(this.schema.name, name, builder.schema, this.schema.flags, this.schema.args);
|
|
852
|
-
const entry = {
|
|
853
|
-
name,
|
|
854
|
-
schema: builder.schema
|
|
855
|
-
};
|
|
856
|
-
const nextArgs = [...this.schema.args, entry];
|
|
857
|
-
return new CommandBuilder({
|
|
858
|
-
...this.schema,
|
|
859
|
-
args: nextArgs,
|
|
860
|
-
hasAction: false
|
|
861
|
-
}, void 0, this._subcommands, this._executionSteps);
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Register a nested subcommand on this command.
|
|
865
|
-
*
|
|
866
|
-
* The subcommand's builder is stored in `_subcommands` for the CLI layer's
|
|
867
|
-
* `compileCommand()` to traverse when building the execution graph. The
|
|
868
|
-
* subcommand's `CommandSchema` is also appended to `schema.commands` for
|
|
869
|
-
* help rendering and completion generation.
|
|
870
|
-
*
|
|
871
|
-
* Does not change `F`, `A`, or `C` — subcommands are type-erased at the
|
|
872
|
-
* parent level (same semantics as `CLIBuilder.command()`). The handler is
|
|
873
|
-
* preserved.
|
|
874
|
-
*
|
|
875
|
-
* @example
|
|
876
|
-
* ```ts
|
|
877
|
-
* const db = group('db')
|
|
878
|
-
* .description('Database operations')
|
|
879
|
-
* .command(migrateCmd)
|
|
880
|
-
* .command(seedCmd);
|
|
881
|
-
* ```
|
|
882
|
-
*
|
|
883
|
-
* @param sub - Child {@link CommandBuilder} to nest under this command.
|
|
884
|
-
* @returns The builder (for chaining).
|
|
885
|
-
* @throws {@link CLIError} `PROPAGATED_FLAG_COLLISION` when a spelling this
|
|
886
|
-
* command propagates collides with one the subcommand, or any of its own
|
|
887
|
-
* descendants, declares.
|
|
888
|
-
*/
|
|
889
|
-
command(sub) {
|
|
890
|
-
const nextSchema = {
|
|
891
|
-
...this.schema,
|
|
892
|
-
commands: [...this.schema.commands, sub.schema]
|
|
893
|
-
};
|
|
894
|
-
validateCommandFlagTree(nextSchema);
|
|
895
|
-
return new CommandBuilder(nextSchema, this.handler, [...this._subcommands, eraseBuilder(sub)], this._executionSteps);
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* Register the action handler for this command.
|
|
899
|
-
*
|
|
900
|
-
* The handler receives fully typed `{ args, flags, ctx, out, meta }` derived
|
|
901
|
-
* from the accumulated `.flag()`, `.arg()`, `.derive()`, and `.middleware()`
|
|
902
|
-
* definitions.
|
|
903
|
-
*
|
|
904
|
-
* May be synchronous or async. Return values are ignored; command handlers
|
|
905
|
-
* communicate through `out`, thrown errors, and side effects.
|
|
906
|
-
*
|
|
907
|
-
* @param handler - Function receiving `ActionParams<F, A, C>`.
|
|
908
|
-
*
|
|
909
|
-
* @example
|
|
910
|
-
* ```ts
|
|
911
|
-
* // Minimal
|
|
912
|
-
* command('greet')
|
|
913
|
-
* .arg('name', arg.string())
|
|
914
|
-
* .action(({ args, out }) => {
|
|
915
|
-
* out.log(`Hello, ${args.name}!`);
|
|
916
|
-
* });
|
|
917
|
-
* ```
|
|
918
|
-
*
|
|
919
|
-
* @example
|
|
920
|
-
* ```ts
|
|
921
|
-
* // Full params — flags, args, context, output, metadata
|
|
922
|
-
* command('deploy')
|
|
923
|
-
* .arg('target', arg.string().env('DEPLOY_TARGET'))
|
|
924
|
-
* .flag('force', flag.boolean().alias('f'))
|
|
925
|
-
* .flag('region', flag.enum(['us', 'eu', 'ap']).env('REGION'))
|
|
926
|
-
* .middleware(auth)
|
|
927
|
-
* .action(async ({ args, flags, ctx, out, meta }) => {
|
|
928
|
-
* args.target; // string
|
|
929
|
-
* flags.force; // boolean
|
|
930
|
-
* flags.region; // 'us' | 'eu' | 'ap' | undefined
|
|
931
|
-
* ctx.user; // User (from auth middleware)
|
|
932
|
-
* meta.command; // string
|
|
933
|
-
*
|
|
934
|
-
* const spinner = out.spinner('Deploying...');
|
|
935
|
-
* await deploy(args.target, { force: flags.force });
|
|
936
|
-
* spinner.stop();
|
|
937
|
-
* out.log('Done');
|
|
938
|
-
* });
|
|
939
|
-
* ```
|
|
940
|
-
*
|
|
941
|
-
* @returns The builder (for chaining).
|
|
942
|
-
*/
|
|
943
|
-
action(handler) {
|
|
944
|
-
return new CommandBuilder({
|
|
945
|
-
...this.schema,
|
|
946
|
-
hasAction: true
|
|
947
|
-
}, handler, this._subcommands, this._executionSteps);
|
|
948
|
-
}
|
|
949
|
-
};
|
|
950
|
-
/**
|
|
951
|
-
* Create a new command builder.
|
|
952
|
-
*
|
|
953
|
-
* @param name - The command name used for dispatch (e.g. `'deploy'`).
|
|
954
|
-
*
|
|
955
|
-
* @example
|
|
956
|
-
* ```ts
|
|
957
|
-
* import { arg, command, flag } from '@kjanat/dreamcli';
|
|
958
|
-
*
|
|
959
|
-
* const greet = command('greet')
|
|
960
|
-
* .arg('name', arg.string())
|
|
961
|
-
* .flag('loud', flag.boolean())
|
|
962
|
-
* .action(({ args, flags, out }) => {
|
|
963
|
-
* const msg = `Hello, ${args.name}!`;
|
|
964
|
-
* out.log(flags.loud ? msg.toUpperCase() : msg);
|
|
965
|
-
* });
|
|
966
|
-
* ```
|
|
967
|
-
*
|
|
968
|
-
* @returns A fresh {@link CommandBuilder} with empty flags, args, and context.
|
|
969
|
-
*/
|
|
970
|
-
function command(name) {
|
|
971
|
-
return new CommandBuilder(createCommandSchema({ name }));
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Create a command builder intended for use as a command group.
|
|
975
|
-
*
|
|
976
|
-
* Semantically identical to {@linkcode command | command()} — a group is simply a command that
|
|
977
|
-
* has subcommands registered via `.command()`. The separate factory
|
|
978
|
-
* communicates intent: groups organise subcommands, leaf commands have actions.
|
|
979
|
-
*
|
|
980
|
-
* A group may also have its own `.action()` (e.g. `git remote` lists remotes
|
|
981
|
-
* when invoked without a subcommand, but dispatches to `git remote add`, etc.).
|
|
982
|
-
*
|
|
983
|
-
* @param name - The group name used for dispatch (e.g. `'db'`).
|
|
984
|
-
*
|
|
985
|
-
* @example
|
|
986
|
-
* ```ts
|
|
987
|
-
* const db = group('db')
|
|
988
|
-
* .description('Database operations')
|
|
989
|
-
* .command(migrateCmd)
|
|
990
|
-
* .command(seedCmd);
|
|
991
|
-
* ```
|
|
992
|
-
*
|
|
993
|
-
* @returns A fresh {@link CommandBuilder} with empty flags, args, and context.
|
|
994
|
-
*/
|
|
995
|
-
function group(name) {
|
|
996
|
-
return command(name);
|
|
997
|
-
}
|
|
998
|
-
//#endregion
|
|
999
|
-
export { CommandBuilder, command, createCommandSchema, group, resolveExampleCommand };
|