@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,850 +0,0 @@
|
|
|
1
|
-
import { ParseError } from "../errors/index.mjs";
|
|
2
|
-
import { describeNumberConstraintViolation } from "../schema/number-constraints.mjs";
|
|
3
|
-
import { describeStringConstraintViolation, stringConstraintDetails } from "../schema/string-constraints.mjs";
|
|
4
|
-
import { argValueSchema, decodeValue, flagValueSchema } from "../schema/value.mjs";
|
|
5
|
-
import { argCardinality, flagCardinality, isCollection, splitEntryPair } from "../schema/cardinality.mjs";
|
|
6
|
-
import { stdinReadsOnDash } from "../schema/stdin.mjs";
|
|
7
|
-
import { getFlagAliasNames, getFlagNegatedName } from "../schema/flag.mjs";
|
|
8
|
-
import "../schema/index.mjs";
|
|
9
|
-
import { INCREMENT_OCCURRENCE, NEGATED_OCCURRENCE, STDIN_OCCURRENCE, occurrenceValue, projectOccurrences } from "./occurrences.mjs";
|
|
10
|
-
//#region src/core/parse/index.ts
|
|
11
|
-
/**
|
|
12
|
-
* Argv tokenization and parsing against command schemas.
|
|
13
|
-
*
|
|
14
|
-
* Two-phase design:
|
|
15
|
-
*
|
|
16
|
-
* 1. **Tokenize** — split raw argv into structured tokens (long flags, short
|
|
17
|
-
* flags, positionals, separator). Schema-agnostic.
|
|
18
|
-
*
|
|
19
|
-
* 2. **Parse** — walk tokens against a {@linkcode CommandSchema} to produce typed raw
|
|
20
|
-
* values. Emits {@linkcode ParseError} for unknown flags, type mismatches, missing
|
|
21
|
-
* values.
|
|
22
|
-
*
|
|
23
|
-
* @module dreamcli/core/parse
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Tokenize raw argv into structured tokens.
|
|
27
|
-
*
|
|
28
|
-
* Low-level utility: most apps should use {@link parse}, `cli().run()`, or
|
|
29
|
-
* `runCommand()` instead of tokenizing manually. Reach for `tokenize()` when
|
|
30
|
-
* building custom tooling such as debuggers, inspectors, or parser tests.
|
|
31
|
-
*
|
|
32
|
-
* Rules:
|
|
33
|
-
* - `--` → separator (everything after is positional)
|
|
34
|
-
* - `--flag` → long flag, no inline value
|
|
35
|
-
* - `--flag=v` → long flag with inline value
|
|
36
|
-
* - `-abc` → short flags (expanded individually by parser)
|
|
37
|
-
* - `-` → positional (convention: stdin placeholder)
|
|
38
|
-
* - everything else → positional
|
|
39
|
-
*
|
|
40
|
-
* @param argv - Raw argument strings to tokenize
|
|
41
|
-
* @returns Ordered token array ready for {@link parse}
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* tokenize(['deploy', '--force', '--region=eu', '-v']);
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
function tokenize(argv) {
|
|
49
|
-
const tokens = [];
|
|
50
|
-
let pastSeparator = false;
|
|
51
|
-
for (const raw of argv) {
|
|
52
|
-
if (pastSeparator) {
|
|
53
|
-
tokens.push({
|
|
54
|
-
kind: "positional",
|
|
55
|
-
value: raw
|
|
56
|
-
});
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (raw === "--") {
|
|
60
|
-
tokens.push({ kind: "separator" });
|
|
61
|
-
pastSeparator = true;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (raw.startsWith("--")) {
|
|
65
|
-
const eqIdx = raw.indexOf("=");
|
|
66
|
-
if (eqIdx !== -1) tokens.push({
|
|
67
|
-
kind: "long-flag",
|
|
68
|
-
name: raw.slice(2, eqIdx),
|
|
69
|
-
value: raw.slice(eqIdx + 1)
|
|
70
|
-
});
|
|
71
|
-
else tokens.push({
|
|
72
|
-
kind: "long-flag",
|
|
73
|
-
name: raw.slice(2),
|
|
74
|
-
value: void 0
|
|
75
|
-
});
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (raw.startsWith("-") && raw.length > 1) {
|
|
79
|
-
tokens.push({
|
|
80
|
-
kind: "short-flags",
|
|
81
|
-
chars: raw.slice(1)
|
|
82
|
-
});
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
tokens.push({
|
|
86
|
-
kind: "positional",
|
|
87
|
-
value: raw
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return tokens;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Whether `token` appears in argv before the `--` end-of-options separator.
|
|
94
|
-
*
|
|
95
|
-
* Everything at or after the first `--` is a literal positional, so root-level
|
|
96
|
-
* flag interception (`--help` / `--version` / `--json`) must use this instead of
|
|
97
|
-
* a naive `Array.includes()` — otherwise a post-separator literal (`-- --json`)
|
|
98
|
-
* is wrongly treated as the flag.
|
|
99
|
-
*
|
|
100
|
-
* @param argv - Raw argument strings.
|
|
101
|
-
* @param token - Exact flag token to look for (e.g. `--version`).
|
|
102
|
-
* @returns `true` if `token` occurs before any `--` separator.
|
|
103
|
-
*/
|
|
104
|
-
function includesBeforeSeparator(argv, token) {
|
|
105
|
-
for (const arg of argv) {
|
|
106
|
-
if (arg === "--") return false;
|
|
107
|
-
if (arg === token) return true;
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Whether argv asks for help before the `--` end-of-options separator.
|
|
113
|
-
*
|
|
114
|
-
* Help renders ahead of flag validation everywhere: a command short-circuits to
|
|
115
|
-
* its help text before `parse()` runs, and the root does the same before
|
|
116
|
-
* dispatch, so a malformed flag value never hides the text explaining the flags.
|
|
117
|
-
*
|
|
118
|
-
* @param argv - Raw argument strings.
|
|
119
|
-
* @returns `true` if `--help` or `-h` occurs before any `--` separator.
|
|
120
|
-
*/
|
|
121
|
-
function requestsHelp(argv) {
|
|
122
|
-
return includesBeforeSeparator(argv, "--help") || includesBeforeSeparator(argv, "-h");
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Remove every occurrence of `token` that appears before the `--` end-of-options
|
|
126
|
-
* separator, leaving post-separator literals untouched.
|
|
127
|
-
*
|
|
128
|
-
* The strip counterpart to {@linkcode includesBeforeSeparator}: root-level flags
|
|
129
|
-
* (`--json`) are stripped before dispatch/parse so the command schema never sees
|
|
130
|
-
* them, but a literal after `--` (`-- --json`) must reach the command unchanged.
|
|
131
|
-
*
|
|
132
|
-
* @param argv - Raw argument strings.
|
|
133
|
-
* @param token - Exact flag token to strip (e.g. `--json`).
|
|
134
|
-
* @returns A new argv with pre-separator occurrences of `token` removed, or the
|
|
135
|
-
* original reference when `token` does not occur before the separator.
|
|
136
|
-
*/
|
|
137
|
-
function stripBeforeSeparator(argv, token) {
|
|
138
|
-
const separatorIndex = argv.indexOf("--");
|
|
139
|
-
const head = separatorIndex === -1 ? argv : argv.slice(0, separatorIndex);
|
|
140
|
-
if (!head.includes(token)) return argv;
|
|
141
|
-
const filteredHead = head.filter((arg) => arg !== token);
|
|
142
|
-
return separatorIndex === -1 ? filteredHead : [...filteredHead, ...argv.slice(separatorIndex)];
|
|
143
|
-
}
|
|
144
|
-
/** `do-this` → `doThis`. Returns the input unchanged when nothing converts. */
|
|
145
|
-
function kebabToCamel(name) {
|
|
146
|
-
return name.replace(/-+([a-z0-9])/g, (_match, char) => char.toUpperCase());
|
|
147
|
-
}
|
|
148
|
-
/** `doThis` → `do-this`. Returns the input unchanged when nothing converts. */
|
|
149
|
-
function camelToKebab(name) {
|
|
150
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* The kebab↔camel counterpart spelling of a flag name, or `undefined` when
|
|
154
|
-
* the name has none (single-char aliases, single lowercase words).
|
|
155
|
-
*/
|
|
156
|
-
function counterpartSpelling(name) {
|
|
157
|
-
if (name.length < 2) return void 0;
|
|
158
|
-
if (name.includes("-")) {
|
|
159
|
-
const camel = kebabToCamel(name);
|
|
160
|
-
return camel !== name ? camel : void 0;
|
|
161
|
-
}
|
|
162
|
-
const kebab = camelToKebab(name);
|
|
163
|
-
return kebab !== name ? kebab : void 0;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Build a map from flag spelling → {@link FlagLookupEntry}.
|
|
167
|
-
*
|
|
168
|
-
* Covers canonical names, aliases (long + single-char), negated spellings of
|
|
169
|
-
* `.negatable()` booleans, and — unless `caseParity` is `false` — the
|
|
170
|
-
* kebab↔camel counterpart of every declared spelling. Counterparts never
|
|
171
|
-
* override declared spellings: when a command defines both `do-this` and
|
|
172
|
-
* `doThis` explicitly, each spelling exact-matches its own flag and no
|
|
173
|
-
* parity entries are added for the pair.
|
|
174
|
-
*
|
|
175
|
-
* @param flags - Flag schemas keyed by canonical name
|
|
176
|
-
* @param options - Parity toggle (see {@link ParseOptions})
|
|
177
|
-
* @returns Lookup map covering all resolvable spellings
|
|
178
|
-
*/
|
|
179
|
-
function buildFlagLookup(flags, options) {
|
|
180
|
-
const lookup = /* @__PURE__ */ new Map();
|
|
181
|
-
for (const [name, schema] of Object.entries(flags)) {
|
|
182
|
-
lookup.set(name, {
|
|
183
|
-
name,
|
|
184
|
-
schema,
|
|
185
|
-
negated: false,
|
|
186
|
-
parity: false
|
|
187
|
-
});
|
|
188
|
-
for (const alias of getFlagAliasNames(schema, { includeHidden: true })) lookup.set(alias, {
|
|
189
|
-
name,
|
|
190
|
-
schema,
|
|
191
|
-
negated: false,
|
|
192
|
-
parity: false
|
|
193
|
-
});
|
|
194
|
-
const negatedName = getFlagNegatedName(name, schema);
|
|
195
|
-
if (negatedName !== void 0) lookup.set(negatedName, {
|
|
196
|
-
name,
|
|
197
|
-
schema,
|
|
198
|
-
negated: true,
|
|
199
|
-
parity: false
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (options?.caseParity !== false) {
|
|
203
|
-
const declared = [...lookup];
|
|
204
|
-
for (const [spelling, entry] of declared) {
|
|
205
|
-
const counterpart = counterpartSpelling(spelling);
|
|
206
|
-
if (counterpart !== void 0 && !lookup.has(counterpart)) lookup.set(counterpart, {
|
|
207
|
-
...entry,
|
|
208
|
-
parity: true
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return lookup;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* The occurrence list of one logical flag, started on its first occurrence.
|
|
216
|
-
*
|
|
217
|
-
* @param occurrences - Per-parse accumulator keyed by canonical name
|
|
218
|
-
* @param name - Canonical flag name
|
|
219
|
-
* @param schema - Flag schema the occurrences belong to
|
|
220
|
-
* @returns The flag's list
|
|
221
|
-
*/
|
|
222
|
-
function occurrencesOf(occurrences, name, schema) {
|
|
223
|
-
const existing = occurrences.get(name);
|
|
224
|
-
if (existing !== void 0) return existing;
|
|
225
|
-
const started = {
|
|
226
|
-
schema,
|
|
227
|
-
occurrences: [],
|
|
228
|
-
counted: 0
|
|
229
|
-
};
|
|
230
|
-
occurrences.set(name, started);
|
|
231
|
-
return started;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Record one CLI occurrence of a logical flag and enforce its duplicate
|
|
235
|
-
* policy.
|
|
236
|
-
*
|
|
237
|
-
* @param occurrences - Per-parse accumulator keyed by canonical name
|
|
238
|
-
* @param name - Canonical flag name
|
|
239
|
-
* @param schema - Flag schema (read for {@link FlagSchema.duplicates})
|
|
240
|
-
* @param reported - The occurrence's raw value (or the boolean it implies)
|
|
241
|
-
* @param displayName - User-facing spelling for error messages
|
|
242
|
-
* @param items - Lazily builds what the occurrence contributes when policy
|
|
243
|
-
* keeps it
|
|
244
|
-
* @throws ParseError `DUPLICATE_FLAG` on a repeat under the `'error'` policy
|
|
245
|
-
*/
|
|
246
|
-
function recordFlagOccurrence(occurrences, name, schema, reported, displayName, items) {
|
|
247
|
-
const record = occurrencesOf(occurrences, name, schema);
|
|
248
|
-
record.counted += 1;
|
|
249
|
-
if (record.counted > 1 && schema.duplicates === "error") throw new ParseError(`Flag --${name} may only be specified once`, {
|
|
250
|
-
code: "DUPLICATE_FLAG",
|
|
251
|
-
details: {
|
|
252
|
-
flag: name,
|
|
253
|
-
input: displayName,
|
|
254
|
-
count: record.counted,
|
|
255
|
-
values: [...record.occurrences.filter((entry) => entry.policed).map((entry) => entry.reported), reported]
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
if (record.counted > 1 && schema.duplicates === "first") return;
|
|
259
|
-
record.occurrences.push({
|
|
260
|
-
policed: true,
|
|
261
|
-
reported,
|
|
262
|
-
items: items()
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Record one bare occurrence of a count flag.
|
|
267
|
-
*
|
|
268
|
-
* A bare `-v` raises the count rather than supplying a value, and the duplicate
|
|
269
|
-
* policy governs supplied values, so the increment stays outside it.
|
|
270
|
-
*
|
|
271
|
-
* @param occurrences - Per-parse accumulator keyed by canonical name
|
|
272
|
-
* @param name - Canonical flag name
|
|
273
|
-
* @param schema - Flag schema the occurrence belongs to
|
|
274
|
-
*/
|
|
275
|
-
function recordCountIncrement(occurrences, name, schema) {
|
|
276
|
-
occurrencesOf(occurrences, name, schema).occurrences.push({
|
|
277
|
-
policed: false,
|
|
278
|
-
reported: void 0,
|
|
279
|
-
items: [INCREMENT_OCCURRENCE]
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Project every flag's occurrences onto the values a parse result carries.
|
|
284
|
-
*
|
|
285
|
-
* @param occurrences - Per-parse accumulator keyed by canonical name
|
|
286
|
-
* @returns Flag values keyed by canonical name, in first-occurrence order
|
|
287
|
-
*/
|
|
288
|
-
function projectFlags(occurrences) {
|
|
289
|
-
const flags = {};
|
|
290
|
-
for (const [name, record] of occurrences) flags[name] = projectOccurrences(flagCardinality(record.schema), record.occurrences.flatMap((occurrence) => occurrence.items));
|
|
291
|
-
return flags;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Whether a flag kind expects a value argument (vs. being a bare boolean).
|
|
295
|
-
*
|
|
296
|
-
* @param schema - Flag schema to check
|
|
297
|
-
* @returns `true` if the flag expects a value token after it
|
|
298
|
-
*/
|
|
299
|
-
function flagExpectsValue(schema) {
|
|
300
|
-
return schema.kind !== "boolean" && schema.kind !== "count";
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Whether a token is the stdin sentinel for an input that reads on `-`.
|
|
304
|
-
*
|
|
305
|
-
* The sentinel names the source, not the value, so it passes through the parse
|
|
306
|
-
* boundary untouched and the resolver reads the buffer in its place. Without
|
|
307
|
-
* this a `-` handed to `flag.number().stdin()` would be rejected here as a
|
|
308
|
-
* malformed number before resolution ever saw it.
|
|
309
|
-
*
|
|
310
|
-
* @param raw - Raw token from argv.
|
|
311
|
-
* @param stdin - The input's stdin axis.
|
|
312
|
-
* @returns `true` when the token selects stdin.
|
|
313
|
-
*/
|
|
314
|
-
function isStdinSentinel(raw, stdin) {
|
|
315
|
-
return raw === "-" && stdin !== void 0 && stdinReadsOnDash(stdin);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Coerce one raw CLI token to what the flag's value axis declares.
|
|
319
|
-
*
|
|
320
|
-
* @param flagName - Canonical flag name (for error messages)
|
|
321
|
-
* @param raw - Raw string value from argv
|
|
322
|
-
* @param schema - {@link FlagSchema} declaring the expected kind
|
|
323
|
-
* @param displayName - Spelling the user typed
|
|
324
|
-
* @returns The coerced token: a value, an element, or a `[key, value]` pair
|
|
325
|
-
* @throws ParseError on type mismatch
|
|
326
|
-
*/
|
|
327
|
-
function coerceFlagValue(flagName, raw, schema, displayName = `--${flagName}`) {
|
|
328
|
-
return occurrenceValue(flagTokenOccurrence(flagName, raw, schema, displayName));
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Read one raw CLI token of a flag as the occurrence it contributes.
|
|
332
|
-
*
|
|
333
|
-
* The cardinality axis decides what a token IS: one value, one element of a
|
|
334
|
-
* collection, one entry of a record, or an explicit count. The value axis then
|
|
335
|
-
* decides what that token means. A `-` names the stdin source, so it holds its
|
|
336
|
-
* position without being decoded.
|
|
337
|
-
*
|
|
338
|
-
* @param flagName - Canonical flag name (for error messages)
|
|
339
|
-
* @param raw - Raw string value from argv
|
|
340
|
-
* @param schema - {@link FlagSchema} declaring the expected kind
|
|
341
|
-
* @param displayName - Spelling the user typed
|
|
342
|
-
* @returns The occurrence the token contributes
|
|
343
|
-
* @throws ParseError on type mismatch
|
|
344
|
-
*/
|
|
345
|
-
function flagTokenOccurrence(flagName, raw, schema, displayName) {
|
|
346
|
-
if (isStdinSentinel(raw, schema.stdin)) return STDIN_OCCURRENCE;
|
|
347
|
-
const cardinality = flagCardinality(schema);
|
|
348
|
-
if (cardinality.kind === "count") return {
|
|
349
|
-
kind: "value",
|
|
350
|
-
value: coerceCountToken(flagName, raw, displayName)
|
|
351
|
-
};
|
|
352
|
-
if (cardinality.kind === "entries") {
|
|
353
|
-
const [key, value] = coerceEntryToken(flagName, raw, schema, displayName);
|
|
354
|
-
return {
|
|
355
|
-
kind: "entry",
|
|
356
|
-
key,
|
|
357
|
-
value
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
return {
|
|
361
|
-
kind: "value",
|
|
362
|
-
value: coerceElementToken(flagName, raw, schema, displayName)
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
/** Decode one token through the flag's element value axis. */
|
|
366
|
-
function coerceElementToken(flagName, raw, schema, displayName) {
|
|
367
|
-
const decoded = decodeValue(flagValueSchema(schema), raw, "token");
|
|
368
|
-
if (decoded.ok) return decoded.value;
|
|
369
|
-
throw flagValueError(flagName, displayName, raw, decoded.failure);
|
|
370
|
-
}
|
|
371
|
-
/** Read an explicit count token such as `--verbose=2`. */
|
|
372
|
-
function coerceCountToken(flagName, raw, displayName) {
|
|
373
|
-
const count = raw.trim() === "" ? NaN : Number(raw);
|
|
374
|
-
if (!Number.isInteger(count) || count < 0) throw new ParseError(`Invalid count value '${raw}' for flag ${displayName}. Use a non-negative integer`, {
|
|
375
|
-
code: "INVALID_VALUE",
|
|
376
|
-
details: {
|
|
377
|
-
flag: flagName,
|
|
378
|
-
input: displayName,
|
|
379
|
-
value: raw,
|
|
380
|
-
expected: "count"
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
return count;
|
|
384
|
-
}
|
|
385
|
-
/** Read one `KEY=VALUE` token and decode its value through the element value axis. */
|
|
386
|
-
function coerceEntryToken(flagName, raw, schema, displayName) {
|
|
387
|
-
const pair = splitEntryPair(raw);
|
|
388
|
-
if (pair === void 0) throw new ParseError(`Invalid value '${raw}' for flag ${displayName}. Use KEY=VALUE`, {
|
|
389
|
-
code: "INVALID_VALUE",
|
|
390
|
-
details: {
|
|
391
|
-
flag: flagName,
|
|
392
|
-
input: displayName,
|
|
393
|
-
value: raw,
|
|
394
|
-
expected: "key=value"
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
return [pair[0], coerceElementToken(flagName, pair[1], schema, displayName)];
|
|
398
|
-
}
|
|
399
|
-
/** Map a shared value-layer failure to a subject-specific parse error. @internal */
|
|
400
|
-
function valueParseError(subject, raw, failure) {
|
|
401
|
-
const details = {
|
|
402
|
-
...subject.details,
|
|
403
|
-
value: raw
|
|
404
|
-
};
|
|
405
|
-
switch (failure.kind) {
|
|
406
|
-
case "type":
|
|
407
|
-
if (failure.expected === "number") return new ParseError(`Invalid number value '${raw}' for ${subject.label}`, {
|
|
408
|
-
code: "INVALID_VALUE",
|
|
409
|
-
details: {
|
|
410
|
-
...details,
|
|
411
|
-
expected: "number"
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
if (failure.expected === "boolean") return new ParseError(`Invalid boolean value '${raw}' for ${subject.label}. Use true/false or 1/0`, {
|
|
415
|
-
code: "INVALID_VALUE",
|
|
416
|
-
details: {
|
|
417
|
-
...details,
|
|
418
|
-
expected: "boolean"
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
return new ParseError(`Invalid value '${raw}' for ${subject.label}`, {
|
|
422
|
-
code: "INVALID_VALUE",
|
|
423
|
-
details: {
|
|
424
|
-
...details,
|
|
425
|
-
expected: "string"
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
case "enum": {
|
|
429
|
-
const allowed = failure.enumValues;
|
|
430
|
-
if (allowed === void 0) return new ParseError(`${subject.enumLabel} is misconfigured: no allowed values declared`, {
|
|
431
|
-
code: "INVALID_SCHEMA",
|
|
432
|
-
details: subject.enumDetails
|
|
433
|
-
});
|
|
434
|
-
return new ParseError(`Invalid value '${raw}' for ${subject.label}. Allowed: ${allowed.join(", ")}`, {
|
|
435
|
-
code: "INVALID_VALUE",
|
|
436
|
-
details: {
|
|
437
|
-
...details,
|
|
438
|
-
allowed
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
case "string-constraint": return new ParseError(`Invalid value '${raw}' for ${subject.label}: ${describeStringConstraintViolation(failure.violation)}`, {
|
|
443
|
-
code: "INVALID_VALUE",
|
|
444
|
-
details: {
|
|
445
|
-
...details,
|
|
446
|
-
expected: "string",
|
|
447
|
-
...stringConstraintDetails(failure.violation)
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
case "number-constraint": return new ParseError(`Invalid number value '${raw}' for ${subject.label}: ${describeNumberConstraintViolation(failure.violation)}`, {
|
|
451
|
-
code: "INVALID_VALUE",
|
|
452
|
-
details: {
|
|
453
|
-
...details,
|
|
454
|
-
expected: "number",
|
|
455
|
-
constraint: failure.violation.kind,
|
|
456
|
-
..."bound" in failure.violation ? { bound: failure.violation.bound } : {}
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
case "thrown": {
|
|
460
|
-
if (failure.error instanceof ParseError) return failure.error;
|
|
461
|
-
const message = failure.error instanceof Error ? failure.error.message : String(failure.error);
|
|
462
|
-
return new ParseError(`Failed to parse ${subject.label}: ${message}`, {
|
|
463
|
-
code: "INVALID_VALUE",
|
|
464
|
-
details,
|
|
465
|
-
cause: failure.error
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
/** Name the flag a rejected value belonged to. */
|
|
471
|
-
function flagValueError(flagName, displayName, raw, failure) {
|
|
472
|
-
return valueParseError({
|
|
473
|
-
details: {
|
|
474
|
-
flag: flagName,
|
|
475
|
-
input: displayName
|
|
476
|
-
},
|
|
477
|
-
label: `flag ${displayName}`,
|
|
478
|
-
enumDetails: {
|
|
479
|
-
flag: flagName,
|
|
480
|
-
kind: "enum",
|
|
481
|
-
missing: "enumValues"
|
|
482
|
-
},
|
|
483
|
-
enumLabel: `Enum flag --${flagName}`
|
|
484
|
-
}, raw, failure);
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Read one raw positional token as the occurrence it contributes.
|
|
488
|
-
*
|
|
489
|
-
* A `-` names the stdin source, so it holds its position without being decoded.
|
|
490
|
-
*
|
|
491
|
-
* @param argName - Positional arg name (for error messages)
|
|
492
|
-
* @param raw - Raw string value from argv
|
|
493
|
-
* @param schema - {@link ArgSchema} declaring the expected kind
|
|
494
|
-
* @returns The occurrence the token contributes
|
|
495
|
-
* @throws ParseError on type mismatch or custom parse failure
|
|
496
|
-
*/
|
|
497
|
-
function argTokenOccurrence(argName, raw, schema) {
|
|
498
|
-
if (isStdinSentinel(raw, schema.stdin)) return STDIN_OCCURRENCE;
|
|
499
|
-
if (argCardinality(schema).kind === "entries") {
|
|
500
|
-
const pair = splitEntryPair(raw);
|
|
501
|
-
if (pair === void 0) throw new ParseError(`Invalid value '${raw}' for argument <${argName}>. Use KEY=VALUE`, {
|
|
502
|
-
code: "INVALID_VALUE",
|
|
503
|
-
details: {
|
|
504
|
-
arg: argName,
|
|
505
|
-
value: raw,
|
|
506
|
-
expected: "key=value"
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
return {
|
|
510
|
-
kind: "entry",
|
|
511
|
-
key: pair[0],
|
|
512
|
-
value: decodeArgToken(argName, pair[1], schema)
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
return {
|
|
516
|
-
kind: "value",
|
|
517
|
-
value: decodeArgToken(argName, raw, schema)
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
/** Decode one token through the arg's element value axis. */
|
|
521
|
-
function decodeArgToken(argName, raw, schema) {
|
|
522
|
-
const decoded = decodeValue(argValueSchema(schema), raw, "token");
|
|
523
|
-
if (decoded.ok) return decoded.value;
|
|
524
|
-
throw argValueError(argName, raw, decoded.failure);
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Name the positional argument a rejected value belonged to.
|
|
528
|
-
*
|
|
529
|
-
* @param argName - Positional arg name.
|
|
530
|
-
* @param raw - Raw string value from argv.
|
|
531
|
-
* @param failure - What the value layer rejected.
|
|
532
|
-
* @returns The error to throw.
|
|
533
|
-
*/
|
|
534
|
-
function argValueError(argName, raw, failure) {
|
|
535
|
-
return valueParseError({
|
|
536
|
-
details: { arg: argName },
|
|
537
|
-
label: `argument <${argName}>`,
|
|
538
|
-
enumDetails: {
|
|
539
|
-
arg: argName,
|
|
540
|
-
kind: "enum",
|
|
541
|
-
missing: "enumValues"
|
|
542
|
-
},
|
|
543
|
-
enumLabel: `Enum argument <${argName}>`
|
|
544
|
-
}, raw, failure);
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* Parse tokenized argv against a command schema.
|
|
548
|
-
*
|
|
549
|
-
* Low-level API: most apps should let `cli()` or `runCommand()` handle parsing
|
|
550
|
-
* automatically. Call `parse()` directly when you need raw parsed values before
|
|
551
|
-
* env/config/default resolution or when writing custom tooling around schemas.
|
|
552
|
-
*
|
|
553
|
-
* @param schema - The command schema to parse against
|
|
554
|
-
* @param argv - Raw argv strings (NOT including the command name itself)
|
|
555
|
-
* @param options - Parser behavior toggles (see {@link ParseOptions})
|
|
556
|
-
* @returns Parsed flag and arg values
|
|
557
|
-
* @throws ParseError for unknown flags, missing values, type mismatches
|
|
558
|
-
*
|
|
559
|
-
* @example
|
|
560
|
-
* ```ts
|
|
561
|
-
* const parsed = parse(deploy.schema, ['production', '--force']);
|
|
562
|
-
* // => { args: { target: 'production' }, flags: { force: true } }
|
|
563
|
-
* ```
|
|
564
|
-
*/
|
|
565
|
-
function parse(schema, argv, options) {
|
|
566
|
-
const tokens = tokenize(argv);
|
|
567
|
-
const flagLookup = buildFlagLookup(schema.flags, options);
|
|
568
|
-
const positionals = [];
|
|
569
|
-
const occurrences = /* @__PURE__ */ new Map();
|
|
570
|
-
let i = 0;
|
|
571
|
-
while (i < tokens.length) {
|
|
572
|
-
const token = tokens[i];
|
|
573
|
-
if (token === void 0) break;
|
|
574
|
-
if (token.kind === "separator") {
|
|
575
|
-
i++;
|
|
576
|
-
continue;
|
|
577
|
-
}
|
|
578
|
-
if (token.kind === "positional") {
|
|
579
|
-
positionals.push(token.value);
|
|
580
|
-
i++;
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (token.kind === "long-flag") {
|
|
584
|
-
i = parseLongFlag(token, tokens, i, flagLookup, occurrences);
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
i = parseShortFlags(token, tokens, i, flagLookup, occurrences);
|
|
588
|
-
}
|
|
589
|
-
const args = mapPositionals(schema.args, positionals);
|
|
590
|
-
return {
|
|
591
|
-
flags: projectFlags(occurrences),
|
|
592
|
-
args
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Parse a long flag token, consuming a value from the next token if needed.
|
|
597
|
-
*
|
|
598
|
-
* @param token - Long-flag token to process
|
|
599
|
-
* @param tokens - Full token array (for lookahead)
|
|
600
|
-
* @param startIdx - Current index of `token` in the array
|
|
601
|
-
* @param flagLookup - Spelling → {@link FlagLookupEntry} map from {@link buildFlagLookup}
|
|
602
|
-
* @param occurrences - Per-parse occurrence accumulator
|
|
603
|
-
* @returns Next index to continue parsing from
|
|
604
|
-
*/
|
|
605
|
-
function parseLongFlag(token, tokens, startIdx, flagLookup, occurrences) {
|
|
606
|
-
const entry = flagLookup.get(token.name);
|
|
607
|
-
if (!entry) {
|
|
608
|
-
const suggestion = suggestFlag(token.name, flagLookup);
|
|
609
|
-
throw new ParseError(`Unknown flag --${token.name}${suggestion ? `. Did you mean --${suggestion}?` : ""}`, {
|
|
610
|
-
code: "UNKNOWN_FLAG",
|
|
611
|
-
details: {
|
|
612
|
-
flag: token.name,
|
|
613
|
-
...suggestion ? { suggestion } : {}
|
|
614
|
-
},
|
|
615
|
-
...suggestion ? { suggest: `--${suggestion}` } : {}
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
const { name: canonicalName, schema: flagSchema, negated } = entry;
|
|
619
|
-
const displayName = `--${token.name}`;
|
|
620
|
-
if (negated) {
|
|
621
|
-
if (token.value !== void 0) throw new ParseError(`Flag ${displayName} does not take a value`, {
|
|
622
|
-
code: "INVALID_VALUE",
|
|
623
|
-
details: {
|
|
624
|
-
flag: canonicalName,
|
|
625
|
-
input: token.name,
|
|
626
|
-
value: token.value
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, false, displayName, () => [NEGATED_OCCURRENCE]);
|
|
630
|
-
return startIdx + 1;
|
|
631
|
-
}
|
|
632
|
-
if (!flagExpectsValue(flagSchema)) {
|
|
633
|
-
if (token.value !== void 0) {
|
|
634
|
-
const item = flagTokenOccurrence(canonicalName, token.value, flagSchema, displayName);
|
|
635
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, occurrenceValue(item), displayName, () => [item]);
|
|
636
|
-
} else if (flagSchema.kind === "count") recordCountIncrement(occurrences, canonicalName, flagSchema);
|
|
637
|
-
else recordFlagOccurrence(occurrences, canonicalName, flagSchema, true, displayName, () => [{
|
|
638
|
-
kind: "value",
|
|
639
|
-
value: true
|
|
640
|
-
}]);
|
|
641
|
-
return startIdx + 1;
|
|
642
|
-
}
|
|
643
|
-
if (token.value !== void 0) {
|
|
644
|
-
const inlineValue = token.value;
|
|
645
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, inlineValue, displayName, () => flagTokenOccurrences(canonicalName, flagSchema, inlineValue, displayName));
|
|
646
|
-
return startIdx + 1;
|
|
647
|
-
}
|
|
648
|
-
const nextToken = tokens[startIdx + 1];
|
|
649
|
-
if (nextToken?.kind !== "positional") throw new ParseError(`Flag ${displayName} requires a value`, {
|
|
650
|
-
code: "MISSING_VALUE",
|
|
651
|
-
details: {
|
|
652
|
-
flag: canonicalName,
|
|
653
|
-
input: token.name,
|
|
654
|
-
kind: flagSchema.kind
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, nextToken.value, displayName, () => flagTokenOccurrences(canonicalName, flagSchema, nextToken.value, displayName));
|
|
658
|
-
return startIdx + 2;
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Parse combined short flags, expanding -abc into individual flags.
|
|
662
|
-
*
|
|
663
|
-
* @param token - Short-flags token to expand
|
|
664
|
-
* @param tokens - Full token array (for lookahead)
|
|
665
|
-
* @param startIdx - Current index of `token` in the array
|
|
666
|
-
* @param flagLookup - Spelling → {@link FlagLookupEntry} map from {@link buildFlagLookup}
|
|
667
|
-
* @param occurrences - Per-parse occurrence accumulator
|
|
668
|
-
* @returns Next index to continue parsing from
|
|
669
|
-
*/
|
|
670
|
-
function parseShortFlags(token, tokens, startIdx, flagLookup, occurrences) {
|
|
671
|
-
const { chars } = token;
|
|
672
|
-
let nextIdx = startIdx + 1;
|
|
673
|
-
for (let ci = 0; ci < chars.length; ci++) {
|
|
674
|
-
const ch = chars.charAt(ci);
|
|
675
|
-
const entry = flagLookup.get(ch);
|
|
676
|
-
if (!entry) throw new ParseError(`Unknown flag -${ch}`, {
|
|
677
|
-
code: "UNKNOWN_FLAG",
|
|
678
|
-
details: { flag: ch }
|
|
679
|
-
});
|
|
680
|
-
const { name: canonicalName, schema: flagSchema } = entry;
|
|
681
|
-
const displayName = `-${ch}`;
|
|
682
|
-
if (!flagExpectsValue(flagSchema)) {
|
|
683
|
-
if (flagSchema.kind === "count") recordCountIncrement(occurrences, canonicalName, flagSchema);
|
|
684
|
-
else recordFlagOccurrence(occurrences, canonicalName, flagSchema, true, displayName, () => [{
|
|
685
|
-
kind: "value",
|
|
686
|
-
value: true
|
|
687
|
-
}]);
|
|
688
|
-
continue;
|
|
689
|
-
}
|
|
690
|
-
if (ci < chars.length - 1) {
|
|
691
|
-
const inlineValue = chars.slice(ci + 1);
|
|
692
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, inlineValue, displayName, () => flagTokenOccurrences(canonicalName, flagSchema, inlineValue, displayName));
|
|
693
|
-
break;
|
|
694
|
-
}
|
|
695
|
-
const nextToken = tokens[nextIdx];
|
|
696
|
-
if (nextToken?.kind !== "positional") throw new ParseError(`Flag -${ch} requires a value`, {
|
|
697
|
-
code: "MISSING_VALUE",
|
|
698
|
-
details: {
|
|
699
|
-
flag: canonicalName,
|
|
700
|
-
input: ch,
|
|
701
|
-
kind: flagSchema.kind
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
recordFlagOccurrence(occurrences, canonicalName, flagSchema, nextToken.value, displayName, () => flagTokenOccurrences(canonicalName, flagSchema, nextToken.value, displayName));
|
|
705
|
-
nextIdx++;
|
|
706
|
-
}
|
|
707
|
-
return nextIdx;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Read one value token of a flag as the occurrences it contributes.
|
|
711
|
-
*
|
|
712
|
-
* A collection keeps its CLI occurrences in the order they were typed, elements
|
|
713
|
-
* for `many` and `[key, value]` pairs for `entries`. Aggregation happens during
|
|
714
|
-
* resolution, where the stdin buffer an occurrence of `-` stands for is spliced
|
|
715
|
-
* into that order.
|
|
716
|
-
*
|
|
717
|
-
* @param name - Canonical flag name
|
|
718
|
-
* @param schema - {@link FlagSchema} declaring the expected kind
|
|
719
|
-
* @param rawValue - Raw string value from argv
|
|
720
|
-
* @param displayName - Spelling the user typed
|
|
721
|
-
* @returns The occurrences the token contributes, in order
|
|
722
|
-
*/
|
|
723
|
-
function flagTokenOccurrences(name, schema, rawValue, displayName = `--${name}`) {
|
|
724
|
-
const cardinality = flagCardinality(schema);
|
|
725
|
-
if (!isCollection(cardinality)) return [flagTokenOccurrence(name, rawValue, schema, displayName)];
|
|
726
|
-
return splitCliToken(cardinality.cliSplit, rawValue, schema).map((part) => flagTokenOccurrence(name, part, schema, displayName));
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Split one CLI token into the elements it carries.
|
|
730
|
-
*
|
|
731
|
-
* The stdin sentinel names a source rather than a value, so it stays one
|
|
732
|
-
* element whatever the split policy says.
|
|
733
|
-
*
|
|
734
|
-
* @param policy - The CLI split policy.
|
|
735
|
-
* @param raw - The raw token.
|
|
736
|
-
* @param schema - The input's schema, read for its stdin axis.
|
|
737
|
-
* @returns The token's elements.
|
|
738
|
-
*/
|
|
739
|
-
function splitCliToken(policy, raw, schema) {
|
|
740
|
-
if (isStdinSentinel(raw, schema.stdin)) return [raw];
|
|
741
|
-
if (policy.format === "delimiter") return raw.split(policy.delimiter).filter((part) => part.length > 0);
|
|
742
|
-
return [raw];
|
|
743
|
-
}
|
|
744
|
-
/** The CLI policy a single-value positional splits under: none at all. */
|
|
745
|
-
const WHOLE_TOKEN = { format: "whole" };
|
|
746
|
-
/**
|
|
747
|
-
* The CLI split policy a cardinality carries.
|
|
748
|
-
*
|
|
749
|
-
* A scalar and a count have no elements to split into, so their tokens stay
|
|
750
|
-
* whole.
|
|
751
|
-
*
|
|
752
|
-
* @param cardinality - How the input's values combine.
|
|
753
|
-
* @returns The policy each of its CLI tokens splits under.
|
|
754
|
-
*/
|
|
755
|
-
function cliSplitOf(cardinality) {
|
|
756
|
-
return cardinality.kind === "many" || cardinality.kind === "entries" ? cardinality.cliSplit : WHOLE_TOKEN;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Map positional values to named args based on schema ordering.
|
|
760
|
-
*
|
|
761
|
-
* @param argEntries - Ordered arg schemas from the command
|
|
762
|
-
* @param positionals - Positional values collected during tokenization
|
|
763
|
-
* @returns Named arg values keyed by arg name
|
|
764
|
-
* @throws ParseError if too many positionals and no variadic arg absorbs them
|
|
765
|
-
*/
|
|
766
|
-
function mapPositionals(argEntries, positionals) {
|
|
767
|
-
const args = {};
|
|
768
|
-
let posIdx = 0;
|
|
769
|
-
for (const entry of argEntries) {
|
|
770
|
-
const cardinality = argCardinality(entry.schema);
|
|
771
|
-
const policy = cliSplitOf(cardinality);
|
|
772
|
-
if (entry.schema.variadic) {
|
|
773
|
-
const occurrences = positionals.slice(posIdx).flatMap((raw) => splitCliToken(policy, raw, { stdin: entry.schema.stdin }).map((part) => argTokenOccurrence(entry.name, part, entry.schema)));
|
|
774
|
-
args[entry.name] = projectOccurrences(cardinality, occurrences);
|
|
775
|
-
posIdx = positionals.length;
|
|
776
|
-
break;
|
|
777
|
-
}
|
|
778
|
-
const rawPositional = positionals[posIdx];
|
|
779
|
-
if (rawPositional !== void 0) {
|
|
780
|
-
const occurrences = splitCliToken(policy, rawPositional, { stdin: entry.schema.stdin }).map((part) => argTokenOccurrence(entry.name, part, entry.schema));
|
|
781
|
-
args[entry.name] = projectOccurrences(cardinality, occurrences);
|
|
782
|
-
posIdx++;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
if (posIdx < positionals.length) {
|
|
786
|
-
const excess = positionals.slice(posIdx);
|
|
787
|
-
throw new ParseError(`Unexpected positional argument${excess.length > 1 ? "s" : ""}: ${excess.join(", ")}`, {
|
|
788
|
-
code: "UNEXPECTED_POSITIONAL",
|
|
789
|
-
details: {
|
|
790
|
-
excess,
|
|
791
|
-
expected: argEntries.length
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
return args;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Suggest the closest flag name if the edit distance is small enough.
|
|
799
|
-
*
|
|
800
|
-
* @param input - Misspelled flag name from the user
|
|
801
|
-
* @param lookup - Flag lookup map from {@link buildFlagLookup}
|
|
802
|
-
* @returns Closest flag name, or `undefined` if no close match exists
|
|
803
|
-
*/
|
|
804
|
-
function suggestFlag(input, lookup) {
|
|
805
|
-
let bestName;
|
|
806
|
-
let bestDist = Number.POSITIVE_INFINITY;
|
|
807
|
-
const threshold = Math.max(2, Math.floor(input.length / 2));
|
|
808
|
-
for (const [key, entry] of lookup) {
|
|
809
|
-
if (key.length < 2 || entry.parity) continue;
|
|
810
|
-
if (entry.negated && entry.schema.negation?.hidden === true) continue;
|
|
811
|
-
const alias = entry.schema.aliases.find((candidate) => candidate.name === key);
|
|
812
|
-
if (key !== entry.name && !entry.negated && alias?.hidden) continue;
|
|
813
|
-
const dist = levenshtein(input, key);
|
|
814
|
-
if (dist < bestDist && dist <= threshold) {
|
|
815
|
-
bestDist = dist;
|
|
816
|
-
bestName = key;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return bestName;
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Classic Levenshtein distance using a single-row DP approach.
|
|
823
|
-
*
|
|
824
|
-
* @param a - First string
|
|
825
|
-
* @param b - Second string
|
|
826
|
-
* @returns Edit distance between `a` and `b`
|
|
827
|
-
*/
|
|
828
|
-
function levenshtein(a, b) {
|
|
829
|
-
if (a === b) return 0;
|
|
830
|
-
if (a.length === 0) return b.length;
|
|
831
|
-
if (b.length === 0) return a.length;
|
|
832
|
-
const short = a.length <= b.length ? a : b;
|
|
833
|
-
const long = a.length <= b.length ? b : a;
|
|
834
|
-
const aLen = short.length;
|
|
835
|
-
const bLen = long.length;
|
|
836
|
-
const row = Array.from({ length: aLen + 1 }, (_, i) => i);
|
|
837
|
-
for (let j = 1; j <= bLen; j++) {
|
|
838
|
-
let prev = row[0] ?? 0;
|
|
839
|
-
row[0] = j;
|
|
840
|
-
for (let k = 1; k <= aLen; k++) {
|
|
841
|
-
const cost = short.charAt(k - 1) === long.charAt(j - 1) ? 0 : 1;
|
|
842
|
-
const current = Math.min((row[k] ?? 0) + 1, (row[k - 1] ?? 0) + 1, prev + cost);
|
|
843
|
-
prev = row[k] ?? 0;
|
|
844
|
-
row[k] = current;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return row[aLen] ?? 0;
|
|
848
|
-
}
|
|
849
|
-
//#endregion
|
|
850
|
-
export { buildFlagLookup, camelToKebab, coerceFlagValue, flagExpectsValue, includesBeforeSeparator, kebabToCamel, parse, requestsHelp, stripBeforeSeparator, tokenize };
|