@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.
Files changed (629) hide show
  1. package/README.md +5 -7
  2. package/dist/{runtime/adapter.d.mts → adapter-D0hbBNVB.d.mts} +5 -7
  3. package/dist/completion-D4mz6axB.mjs +6 -0
  4. package/dist/completion.d.mts +90 -0
  5. package/dist/completion.mjs +1 -0
  6. package/dist/config-B9ddC-Kb.mjs +1 -0
  7. package/dist/config.d.mts +2 -0
  8. package/dist/config.mjs +1 -0
  9. package/dist/core-Cp2w8vRq.mjs +17 -0
  10. package/dist/index-BziI2aKc.d.mts +5440 -0
  11. package/dist/index-DOfClfYR.d.mts +370 -0
  12. package/dist/index-DWsnGZlx.d.mts +831 -0
  13. package/dist/{core/cli/index.d.mts → index-DXROeDPC.d.mts} +149 -25
  14. package/dist/index-DndPmT8J.d.mts +275 -0
  15. package/dist/{core/json-schema/index.d.mts → index-DyoaS234.d.mts} +54 -45
  16. package/dist/index.d.mts +190 -41
  17. package/dist/index.mjs +1 -26
  18. package/dist/json-schema-C9SzZ7jY.mjs +52 -0
  19. package/dist/json-schema.d.mts +2 -0
  20. package/dist/json-schema.mjs +1 -0
  21. package/dist/package-json-BgE9YjjQ.mjs +3 -0
  22. package/dist/prompt.d.mts +48 -0
  23. package/dist/prompt.mjs +1 -0
  24. package/dist/rolldown-runtime-G4Kt5YOX.mjs +1 -0
  25. package/dist/runtime.d.mts +2 -6
  26. package/dist/runtime.mjs +1 -6
  27. package/dist/terminal-C8KTXjv5.mjs +6 -0
  28. package/dist/test-prompter-v__jT2yG.mjs +1 -0
  29. package/dist/testkit.d.mts +54 -6
  30. package/dist/testkit.mjs +1 -5
  31. package/dist/version.d.mts +16 -4
  32. package/dist/version.mjs +1 -7
  33. package/dreamcli.schema.json +697 -538
  34. package/package.json +37 -12
  35. package/skills/cli-creation/SKILL.md +16 -11
  36. package/CHANGELOG.md +0 -2453
  37. package/dist/core/cli/builtins.d.mts +0 -47
  38. package/dist/core/cli/builtins.mjs +0 -135
  39. package/dist/core/cli/compiled.d.mts +0 -29
  40. package/dist/core/cli/compiled.mjs +0 -76
  41. package/dist/core/cli/dispatch.d.mts +0 -38
  42. package/dist/core/cli/dispatch.mjs +0 -205
  43. package/dist/core/cli/help-links.d.mts +0 -15
  44. package/dist/core/cli/help-links.mjs +0 -41
  45. package/dist/core/cli/index.mjs +0 -1265
  46. package/dist/core/cli/planner.d.mts +0 -96
  47. package/dist/core/cli/planner.mjs +0 -323
  48. package/dist/core/cli/plugin.d.mts +0 -94
  49. package/dist/core/cli/plugin.mjs +0 -41
  50. package/dist/core/cli/propagate.d.mts +0 -39
  51. package/dist/core/cli/propagate.mjs +0 -57
  52. package/dist/core/cli/reserved-flags.d.mts +0 -1
  53. package/dist/core/cli/reserved-flags.mjs +0 -158
  54. package/dist/core/cli/root-help.d.mts +0 -1
  55. package/dist/core/cli/root-help.mjs +0 -221
  56. package/dist/core/cli/root-output-flags.d.mts +0 -1
  57. package/dist/core/cli/root-output-flags.mjs +0 -169
  58. package/dist/core/cli/root-surface.d.mts +0 -1
  59. package/dist/core/cli/root-surface.mjs +0 -28
  60. package/dist/core/cli/runtime-preflight.d.mts +0 -1
  61. package/dist/core/cli/runtime-preflight.mjs +0 -221
  62. package/dist/core/completion/index.d.mts +0 -76
  63. package/dist/core/completion/index.mjs +0 -90
  64. package/dist/core/completion/shells/bash.d.mts +0 -22
  65. package/dist/core/completion/shells/bash.mjs +0 -309
  66. package/dist/core/completion/shells/fish.d.mts +0 -18
  67. package/dist/core/completion/shells/fish.mjs +0 -163
  68. package/dist/core/completion/shells/powershell.d.mts +0 -12
  69. package/dist/core/completion/shells/powershell.mjs +0 -359
  70. package/dist/core/completion/shells/shared.d.mts +0 -49
  71. package/dist/core/completion/shells/shared.mjs +0 -147
  72. package/dist/core/completion/shells/zsh.d.mts +0 -22
  73. package/dist/core/completion/shells/zsh.mjs +0 -252
  74. package/dist/core/config/index.d.mts +0 -191
  75. package/dist/core/config/index.mjs +0 -285
  76. package/dist/core/config/package-json.d.mts +0 -179
  77. package/dist/core/config/package-json.mjs +0 -353
  78. package/dist/core/errors/index.d.mts +0 -126
  79. package/dist/core/errors/index.mjs +0 -87
  80. package/dist/core/execution/index.d.mts +0 -1
  81. package/dist/core/execution/index.mjs +0 -220
  82. package/dist/core/help/ansi.d.mts +0 -73
  83. package/dist/core/help/ansi.mjs +0 -121
  84. package/dist/core/help/index.d.mts +0 -110
  85. package/dist/core/help/index.mjs +0 -414
  86. package/dist/core/help/theme.d.mts +0 -48
  87. package/dist/core/help/theme.mjs +0 -46
  88. package/dist/core/json-schema/index.mjs +0 -1007
  89. package/dist/core/json-schema/meta-descriptions.generated.d.mts +0 -274
  90. package/dist/core/json-schema/meta-descriptions.generated.mjs +0 -136
  91. package/dist/core/output/activity.d.mts +0 -1
  92. package/dist/core/output/activity.mjs +0 -452
  93. package/dist/core/output/bind.d.mts +0 -1
  94. package/dist/core/output/bind.mjs +0 -56
  95. package/dist/core/output/contracts.d.mts +0 -81
  96. package/dist/core/output/contracts.mjs +0 -57
  97. package/dist/core/output/display-value.d.mts +0 -1
  98. package/dist/core/output/display-value.mjs +0 -32
  99. package/dist/core/output/index.d.mts +0 -160
  100. package/dist/core/output/index.mjs +0 -512
  101. package/dist/core/output/renderers.d.mts +0 -1
  102. package/dist/core/output/renderers.mjs +0 -46
  103. package/dist/core/output/writer.d.mts +0 -39
  104. package/dist/core/output/writer.mjs +0 -12
  105. package/dist/core/parse/index.d.mts +0 -178
  106. package/dist/core/parse/index.mjs +0 -850
  107. package/dist/core/parse/occurrences.d.mts +0 -89
  108. package/dist/core/parse/occurrences.mjs +0 -114
  109. package/dist/core/prompt/index.d.mts +0 -213
  110. package/dist/core/prompt/index.mjs +0 -348
  111. package/dist/core/read-flags/index.d.mts +0 -150
  112. package/dist/core/read-flags/index.mjs +0 -217
  113. package/dist/core/resolve/args.d.mts +0 -39
  114. package/dist/core/resolve/args.mjs +0 -182
  115. package/dist/core/resolve/coerce.d.mts +0 -79
  116. package/dist/core/resolve/coerce.mjs +0 -900
  117. package/dist/core/resolve/config.d.mts +0 -1
  118. package/dist/core/resolve/config.mjs +0 -19
  119. package/dist/core/resolve/contracts.d.mts +0 -145
  120. package/dist/core/resolve/errors.d.mts +0 -10
  121. package/dist/core/resolve/errors.mjs +0 -148
  122. package/dist/core/resolve/flags.d.mts +0 -47
  123. package/dist/core/resolve/flags.mjs +0 -246
  124. package/dist/core/resolve/index.d.mts +0 -44
  125. package/dist/core/resolve/index.mjs +0 -123
  126. package/dist/core/resolve/path-checks.d.mts +0 -47
  127. package/dist/core/resolve/path-checks.mjs +0 -102
  128. package/dist/core/resolve/redaction.d.mts +0 -12
  129. package/dist/core/resolve/redaction.mjs +0 -14
  130. package/dist/core/resolve/stages.d.mts +0 -85
  131. package/dist/core/resolve/stages.mjs +0 -170
  132. package/dist/core/resolve/standard.d.mts +0 -1
  133. package/dist/core/resolve/standard.mjs +0 -212
  134. package/dist/core/schema/activity.d.mts +0 -189
  135. package/dist/core/schema/arg.d.mts +0 -1451
  136. package/dist/core/schema/arg.mjs +0 -1139
  137. package/dist/core/schema/brand.d.mts +0 -17
  138. package/dist/core/schema/cardinality.d.mts +0 -301
  139. package/dist/core/schema/cardinality.mjs +0 -514
  140. package/dist/core/schema/command.d.mts +0 -1086
  141. package/dist/core/schema/command.mjs +0 -999
  142. package/dist/core/schema/flag.d.mts +0 -1487
  143. package/dist/core/schema/flag.mjs +0 -1207
  144. package/dist/core/schema/index.d.mts +0 -15
  145. package/dist/core/schema/index.mjs +0 -10
  146. package/dist/core/schema/middleware.d.mts +0 -126
  147. package/dist/core/schema/middleware.mjs +0 -41
  148. package/dist/core/schema/number-constraints.d.mts +0 -96
  149. package/dist/core/schema/number-constraints.mjs +0 -60
  150. package/dist/core/schema/prompt.d.mts +0 -135
  151. package/dist/core/schema/provenance.d.mts +0 -99
  152. package/dist/core/schema/provenance.mjs +0 -28
  153. package/dist/core/schema/run.d.mts +0 -161
  154. package/dist/core/schema/source.d.mts +0 -179
  155. package/dist/core/schema/source.mjs +0 -206
  156. package/dist/core/schema/standard.d.mts +0 -93
  157. package/dist/core/schema/standard.mjs +0 -15
  158. package/dist/core/schema/stdin.d.mts +0 -87
  159. package/dist/core/schema/stdin.mjs +0 -91
  160. package/dist/core/schema/string-constraints.d.mts +0 -108
  161. package/dist/core/schema/string-constraints.mjs +0 -86
  162. package/dist/core/schema/value-parsers.d.mts +0 -150
  163. package/dist/core/schema/value-parsers.mjs +0 -160
  164. package/dist/core/schema/value.d.mts +0 -242
  165. package/dist/core/schema/value.mjs +0 -573
  166. package/dist/core/testkit/index.d.mts +0 -56
  167. package/dist/core/testkit/index.mjs +0 -102
  168. package/dist/runtime/adapter.mjs +0 -92
  169. package/dist/runtime/auto.d.mts +0 -25
  170. package/dist/runtime/auto.mjs +0 -45
  171. package/dist/runtime/deno.d.mts +0 -99
  172. package/dist/runtime/deno.mjs +0 -265
  173. package/dist/runtime/detect.d.mts +0 -86
  174. package/dist/runtime/detect.mjs +0 -45
  175. package/dist/runtime/index.d.mts +0 -6
  176. package/dist/runtime/node.d.mts +0 -71
  177. package/dist/runtime/node.mjs +0 -228
  178. package/dist/runtime/paths.d.mts +0 -1
  179. package/dist/runtime/paths.mjs +0 -48
  180. package/dist/strings.d.mts +0 -12
  181. package/dist/strings.mjs +0 -22
  182. package/examples/basic.ts +0 -37
  183. package/examples/flag-types.ts +0 -79
  184. package/examples/gh/node_modules/typescript/LICENSE +0 -55
  185. package/examples/gh/node_modules/typescript/NOTICE.txt +0 -436
  186. package/examples/gh/node_modules/typescript/README.md +0 -49
  187. package/examples/gh/node_modules/typescript/bin/tsc +0 -2
  188. package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts +0 -529
  189. package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts.map +0 -1
  190. package/examples/gh/node_modules/typescript/dist/api/async/api.js +0 -1657
  191. package/examples/gh/node_modules/typescript/dist/api/async/api.js.map +0 -1
  192. package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts +0 -39
  193. package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts.map +0 -1
  194. package/examples/gh/node_modules/typescript/dist/api/async/client.js +0 -211
  195. package/examples/gh/node_modules/typescript/dist/api/async/client.js.map +0 -1
  196. package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts +0 -310
  197. package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts.map +0 -1
  198. package/examples/gh/node_modules/typescript/dist/api/async/types.js +0 -2
  199. package/examples/gh/node_modules/typescript/dist/api/async/types.js.map +0 -1
  200. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts +0 -109
  201. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts.map +0 -1
  202. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js +0 -2
  203. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js.map +0 -1
  204. package/examples/gh/node_modules/typescript/dist/api/fs.d.ts +0 -23
  205. package/examples/gh/node_modules/typescript/dist/api/fs.d.ts.map +0 -1
  206. package/examples/gh/node_modules/typescript/dist/api/fs.js +0 -109
  207. package/examples/gh/node_modules/typescript/dist/api/fs.js.map +0 -1
  208. package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts +0 -15
  209. package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts.map +0 -1
  210. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts +0 -5
  211. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts.map +0 -1
  212. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js +0 -74
  213. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js.map +0 -1
  214. package/examples/gh/node_modules/typescript/dist/api/node/encoder.js +0 -287
  215. package/examples/gh/node_modules/typescript/dist/api/node/encoder.js.map +0 -1
  216. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts +0 -32
  217. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts.map +0 -1
  218. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js +0 -213
  219. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js.map +0 -1
  220. package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts +0 -76
  221. package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts.map +0 -1
  222. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts +0 -182
  223. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts.map +0 -1
  224. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js +0 -835
  225. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js.map +0 -1
  226. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts +0 -62
  227. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts.map +0 -1
  228. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js +0 -122
  229. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js.map +0 -1
  230. package/examples/gh/node_modules/typescript/dist/api/node/node.js +0 -298
  231. package/examples/gh/node_modules/typescript/dist/api/node/node.js.map +0 -1
  232. package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts +0 -29
  233. package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts.map +0 -1
  234. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts +0 -4
  235. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts.map +0 -1
  236. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js +0 -241
  237. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js.map +0 -1
  238. package/examples/gh/node_modules/typescript/dist/api/node/protocol.js +0 -30
  239. package/examples/gh/node_modules/typescript/dist/api/node/protocol.js.map +0 -1
  240. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts +0 -6
  241. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts.map +0 -1
  242. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js +0 -61
  243. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js.map +0 -1
  244. package/examples/gh/node_modules/typescript/dist/api/options.d.ts +0 -32
  245. package/examples/gh/node_modules/typescript/dist/api/options.d.ts.map +0 -1
  246. package/examples/gh/node_modules/typescript/dist/api/options.js +0 -11
  247. package/examples/gh/node_modules/typescript/dist/api/options.js.map +0 -1
  248. package/examples/gh/node_modules/typescript/dist/api/path.d.ts +0 -110
  249. package/examples/gh/node_modules/typescript/dist/api/path.d.ts.map +0 -1
  250. package/examples/gh/node_modules/typescript/dist/api/path.js +0 -508
  251. package/examples/gh/node_modules/typescript/dist/api/path.js.map +0 -1
  252. package/examples/gh/node_modules/typescript/dist/api/proto.d.ts +0 -239
  253. package/examples/gh/node_modules/typescript/dist/api/proto.d.ts.map +0 -1
  254. package/examples/gh/node_modules/typescript/dist/api/proto.js +0 -37
  255. package/examples/gh/node_modules/typescript/dist/api/proto.js.map +0 -1
  256. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts +0 -79
  257. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts.map +0 -1
  258. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js +0 -169
  259. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js.map +0 -1
  260. package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts +0 -529
  261. package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts.map +0 -1
  262. package/examples/gh/node_modules/typescript/dist/api/sync/api.js +0 -1665
  263. package/examples/gh/node_modules/typescript/dist/api/sync/api.js.map +0 -1
  264. package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts +0 -30
  265. package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts.map +0 -1
  266. package/examples/gh/node_modules/typescript/dist/api/sync/client.js +0 -124
  267. package/examples/gh/node_modules/typescript/dist/api/sync/client.js.map +0 -1
  268. package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts +0 -310
  269. package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts.map +0 -1
  270. package/examples/gh/node_modules/typescript/dist/api/sync/types.js +0 -2
  271. package/examples/gh/node_modules/typescript/dist/api/sync/types.js.map +0 -1
  272. package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts +0 -114
  273. package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts.map +0 -1
  274. package/examples/gh/node_modules/typescript/dist/api/syncChannel.js +0 -508
  275. package/examples/gh/node_modules/typescript/dist/api/syncChannel.js.map +0 -1
  276. package/examples/gh/node_modules/typescript/dist/api/timing.d.ts +0 -175
  277. package/examples/gh/node_modules/typescript/dist/api/timing.d.ts.map +0 -1
  278. package/examples/gh/node_modules/typescript/dist/api/timing.js +0 -149
  279. package/examples/gh/node_modules/typescript/dist/api/timing.js.map +0 -1
  280. package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts +0 -100
  281. package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts.map +0 -1
  282. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts +0 -1161
  283. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts.map +0 -1
  284. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js +0 -4
  285. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js.map +0 -1
  286. package/examples/gh/node_modules/typescript/dist/ast/ast.js +0 -7
  287. package/examples/gh/node_modules/typescript/dist/ast/ast.js.map +0 -1
  288. package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts +0 -19
  289. package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts.map +0 -1
  290. package/examples/gh/node_modules/typescript/dist/ast/astnav.js +0 -596
  291. package/examples/gh/node_modules/typescript/dist/ast/astnav.js.map +0 -1
  292. package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts +0 -16
  293. package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts.map +0 -1
  294. package/examples/gh/node_modules/typescript/dist/ast/clone.js +0 -104
  295. package/examples/gh/node_modules/typescript/dist/ast/clone.js.map +0 -1
  296. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts +0 -520
  297. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts.map +0 -1
  298. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js +0 -3057
  299. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js.map +0 -1
  300. package/examples/gh/node_modules/typescript/dist/ast/index.d.ts +0 -20
  301. package/examples/gh/node_modules/typescript/dist/ast/index.d.ts.map +0 -1
  302. package/examples/gh/node_modules/typescript/dist/ast/index.js +0 -20
  303. package/examples/gh/node_modules/typescript/dist/ast/index.js.map +0 -1
  304. package/examples/gh/node_modules/typescript/dist/ast/is.d.ts +0 -35
  305. package/examples/gh/node_modules/typescript/dist/ast/is.d.ts.map +0 -1
  306. package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts +0 -329
  307. package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts.map +0 -1
  308. package/examples/gh/node_modules/typescript/dist/ast/is.generated.js +0 -1103
  309. package/examples/gh/node_modules/typescript/dist/ast/is.generated.js.map +0 -1
  310. package/examples/gh/node_modules/typescript/dist/ast/is.js +0 -233
  311. package/examples/gh/node_modules/typescript/dist/ast/is.js.map +0 -1
  312. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts +0 -11
  313. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts.map +0 -1
  314. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js +0 -202
  315. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js.map +0 -1
  316. package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts +0 -97
  317. package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts.map +0 -1
  318. package/examples/gh/node_modules/typescript/dist/ast/scanner.js +0 -2230
  319. package/examples/gh/node_modules/typescript/dist/ast/scanner.js.map +0 -1
  320. package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts +0 -17
  321. package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts.map +0 -1
  322. package/examples/gh/node_modules/typescript/dist/ast/utils.js +0 -67
  323. package/examples/gh/node_modules/typescript/dist/ast/utils.js.map +0 -1
  324. package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts +0 -14
  325. package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts.map +0 -1
  326. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts +0 -50
  327. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts.map +0 -1
  328. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js +0 -978
  329. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js.map +0 -1
  330. package/examples/gh/node_modules/typescript/dist/ast/visitor.js +0 -47
  331. package/examples/gh/node_modules/typescript/dist/ast/visitor.js.map +0 -1
  332. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts +0 -2
  333. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts.map +0 -1
  334. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts +0 -129
  335. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts.map +0 -1
  336. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js +0 -132
  337. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js.map +0 -1
  338. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js +0 -130
  339. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js.map +0 -1
  340. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts +0 -2
  341. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts.map +0 -1
  342. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts +0 -5
  343. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts.map +0 -1
  344. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js +0 -6
  345. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js.map +0 -1
  346. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js +0 -6
  347. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js.map +0 -1
  348. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts +0 -2
  349. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts.map +0 -1
  350. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts +0 -28
  351. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts.map +0 -1
  352. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js +0 -30
  353. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js.map +0 -1
  354. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js +0 -30
  355. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js.map +0 -1
  356. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts +0 -2
  357. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts.map +0 -1
  358. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts +0 -7
  359. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts.map +0 -1
  360. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js +0 -9
  361. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js.map +0 -1
  362. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js +0 -9
  363. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js.map +0 -1
  364. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts +0 -2
  365. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts.map +0 -1
  366. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts +0 -12
  367. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts.map +0 -1
  368. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js +0 -14
  369. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js.map +0 -1
  370. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js +0 -14
  371. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js.map +0 -1
  372. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts +0 -2
  373. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts.map +0 -1
  374. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts +0 -23
  375. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts.map +0 -1
  376. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js +0 -25
  377. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js.map +0 -1
  378. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js +0 -25
  379. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js.map +0 -1
  380. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts +0 -2
  381. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts.map +0 -1
  382. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts +0 -9
  383. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts.map +0 -1
  384. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js +0 -11
  385. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js.map +0 -1
  386. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js +0 -11
  387. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js.map +0 -1
  388. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts +0 -2
  389. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts.map +0 -1
  390. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts +0 -5
  391. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts.map +0 -1
  392. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js +0 -6
  393. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js.map +0 -1
  394. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js +0 -6
  395. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js.map +0 -1
  396. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts +0 -2
  397. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts.map +0 -1
  398. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts +0 -42
  399. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts.map +0 -1
  400. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js +0 -44
  401. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js.map +0 -1
  402. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js +0 -44
  403. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js.map +0 -1
  404. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts +0 -2
  405. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts.map +0 -1
  406. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts +0 -7
  407. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts.map +0 -1
  408. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js +0 -9
  409. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js.map +0 -1
  410. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js +0 -9
  411. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js.map +0 -1
  412. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts +0 -2
  413. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts.map +0 -1
  414. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts +0 -17
  415. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts.map +0 -1
  416. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js +0 -19
  417. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js.map +0 -1
  418. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js +0 -19
  419. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js.map +0 -1
  420. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts +0 -2
  421. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts.map +0 -1
  422. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts +0 -9
  423. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts.map +0 -1
  424. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js +0 -11
  425. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js.map +0 -1
  426. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js +0 -11
  427. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js.map +0 -1
  428. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts +0 -2
  429. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts.map +0 -1
  430. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts +0 -6
  431. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts.map +0 -1
  432. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js +0 -8
  433. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js.map +0 -1
  434. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js +0 -8
  435. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js.map +0 -1
  436. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts +0 -2
  437. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts.map +0 -1
  438. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts +0 -36
  439. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts.map +0 -1
  440. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js +0 -38
  441. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js.map +0 -1
  442. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js +0 -38
  443. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js.map +0 -1
  444. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts +0 -2
  445. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts.map +0 -1
  446. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts +0 -44
  447. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts.map +0 -1
  448. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js +0 -46
  449. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js.map +0 -1
  450. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js +0 -46
  451. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js.map +0 -1
  452. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts +0 -2
  453. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts.map +0 -1
  454. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts +0 -50
  455. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts.map +0 -1
  456. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js +0 -52
  457. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js.map +0 -1
  458. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js +0 -52
  459. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js.map +0 -1
  460. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts +0 -2
  461. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts.map +0 -1
  462. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts +0 -16
  463. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts.map +0 -1
  464. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js +0 -18
  465. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js.map +0 -1
  466. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js +0 -18
  467. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js.map +0 -1
  468. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts +0 -2
  469. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts.map +0 -1
  470. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts +0 -13
  471. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts.map +0 -1
  472. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js +0 -14
  473. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js.map +0 -1
  474. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js +0 -14
  475. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js.map +0 -1
  476. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts +0 -2
  477. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts.map +0 -1
  478. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts +0 -11
  479. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts.map +0 -1
  480. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js +0 -12
  481. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js.map +0 -1
  482. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js +0 -12
  483. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js.map +0 -1
  484. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts +0 -2
  485. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts.map +0 -1
  486. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts +0 -17
  487. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts.map +0 -1
  488. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js +0 -18
  489. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js.map +0 -1
  490. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js +0 -18
  491. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js.map +0 -1
  492. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts +0 -2
  493. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts.map +0 -1
  494. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts +0 -15
  495. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts.map +0 -1
  496. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js +0 -17
  497. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js.map +0 -1
  498. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js +0 -17
  499. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js.map +0 -1
  500. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts +0 -2
  501. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts.map +0 -1
  502. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts +0 -5
  503. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts.map +0 -1
  504. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js +0 -7
  505. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js.map +0 -1
  506. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js +0 -7
  507. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js.map +0 -1
  508. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts +0 -2
  509. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts.map +0 -1
  510. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts +0 -71
  511. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts.map +0 -1
  512. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js +0 -73
  513. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js.map +0 -1
  514. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js +0 -73
  515. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js.map +0 -1
  516. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts +0 -2
  517. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts.map +0 -1
  518. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts +0 -389
  519. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts.map +0 -1
  520. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js +0 -391
  521. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js.map +0 -1
  522. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js +0 -391
  523. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js.map +0 -1
  524. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts +0 -2
  525. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts.map +0 -1
  526. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts +0 -30
  527. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts.map +0 -1
  528. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js +0 -32
  529. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js.map +0 -1
  530. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js +0 -32
  531. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js.map +0 -1
  532. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts +0 -2
  533. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts.map +0 -1
  534. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts +0 -76
  535. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts.map +0 -1
  536. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js +0 -78
  537. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js.map +0 -1
  538. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js +0 -78
  539. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js.map +0 -1
  540. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts +0 -2
  541. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts.map +0 -1
  542. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts +0 -7
  543. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts.map +0 -1
  544. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js +0 -9
  545. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js.map +0 -1
  546. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js +0 -9
  547. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js.map +0 -1
  548. package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts +0 -23
  549. package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts.map +0 -1
  550. package/examples/gh/node_modules/typescript/dist/internal/utils.js +0 -25
  551. package/examples/gh/node_modules/typescript/dist/internal/utils.js.map +0 -1
  552. package/examples/gh/node_modules/typescript/lib/getExePath.d.ts +0 -2
  553. package/examples/gh/node_modules/typescript/lib/getExePath.js +0 -70
  554. package/examples/gh/node_modules/typescript/lib/tsc.js +0 -28
  555. package/examples/gh/node_modules/typescript/lib/version.cjs +0 -3
  556. package/examples/gh/node_modules/typescript/lib/version.d.cts +0 -2
  557. package/examples/gh/node_modules/typescript/package.json +0 -87
  558. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/License.txt +0 -11
  559. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/README.md +0 -54
  560. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.d.ts +0 -17
  561. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.js +0 -83
  562. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +0 -22
  563. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.js +0 -210
  564. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.d.ts +0 -14
  565. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.js +0 -87
  566. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +0 -32
  567. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.js +0 -132
  568. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.d.ts +0 -367
  569. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.js +0 -1271
  570. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +0 -9
  571. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.js +0 -16
  572. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +0 -52
  573. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.js +0 -70
  574. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.d.ts +0 -39
  575. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.js +0 -135
  576. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.d.ts +0 -7
  577. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.js +0 -34
  578. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +0 -55
  579. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.js +0 -412
  580. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +0 -18
  581. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +0 -155
  582. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +0 -77
  583. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.js +0 -246
  584. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +0 -60
  585. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.js +0 -157
  586. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.d.ts +0 -369
  587. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.js +0 -436
  588. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.d.ts +0 -74
  589. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.js +0 -23
  590. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +0 -10
  591. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.js +0 -74
  592. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +0 -15
  593. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +0 -77
  594. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.d.ts +0 -58
  595. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.js +0 -289
  596. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.d.ts +0 -12
  597. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.js +0 -163
  598. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/package.json +0 -54
  599. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/typings/thenable.d.ts +0 -5
  600. package/examples/gh/package.json +0 -45
  601. package/examples/gh/src/commands/auth.ts +0 -66
  602. package/examples/gh/src/commands/issue.ts +0 -120
  603. package/examples/gh/src/commands/pr.ts +0 -125
  604. package/examples/gh/src/data/issues.yaml +0 -5
  605. package/examples/gh/src/data/issues.yaml.d.ts +0 -17
  606. package/examples/gh/src/data/pull-requests.yaml +0 -7
  607. package/examples/gh/src/data/pull-requests.yaml.d.ts +0 -18
  608. package/examples/gh/src/docs.ts +0 -11
  609. package/examples/gh/src/lib/auth.ts +0 -37
  610. package/examples/gh/src/lib/utils.ts +0 -17
  611. package/examples/gh/src/main.test.ts +0 -307
  612. package/examples/gh/src/main.ts +0 -46
  613. package/examples/help-config.ts +0 -43
  614. package/examples/interactive.ts +0 -67
  615. package/examples/json-mode.ts +0 -95
  616. package/examples/middleware.ts +0 -71
  617. package/examples/multi-command.ts +0 -66
  618. package/examples/output-extras.ts +0 -46
  619. package/examples/parser-control.ts +0 -40
  620. package/examples/pwsh-demo/README.md +0 -40
  621. package/examples/pwsh-demo/package.json +0 -41
  622. package/examples/pwsh-demo/pwsh-demo.cmd +0 -3
  623. package/examples/pwsh-demo/smoke-powershell.ps1 +0 -218
  624. package/examples/pwsh-demo/src/main.test.ts +0 -45
  625. package/examples/pwsh-demo/src/main.ts +0 -140
  626. package/examples/spinner-progress.ts +0 -49
  627. package/examples/standard-schema.ts +0 -45
  628. package/examples/testing.ts +0 -147
  629. package/examples/transport-launcher.ts +0 -85
@@ -1,1265 +0,0 @@
1
- import { CLIError } from "../errors/index.mjs";
2
- import { getFlagAliasNames, getFlagNegatedName } from "../schema/flag.mjs";
3
- import { arg } from "../schema/arg.mjs";
4
- import { command, createCommandSchema } from "../schema/command.mjs";
5
- import { normalizeBuiltins } from "./builtins.mjs";
6
- import { SHELLS, detectShell, generateCompletion, normalizeShell } from "../completion/index.mjs";
7
- import { formatHelp } from "../help/index.mjs";
8
- import { generateCommandSchema, generateSchema } from "../json-schema/index.mjs";
9
- import { clearRequestedExitCode, createCaptureOutput, createOutput, resolveHyperlinkOverride } from "../output/index.mjs";
10
- import { buildRunResult, executeCommand } from "../execution/index.mjs";
11
- import { stripTrailing } from "../../strings.mjs";
12
- import { createAdapter } from "../../runtime/auto.mjs";
13
- import { assertNoSiblingRouteConflict, commandRoutes, compileCommand } from "./compiled.mjs";
14
- import { deriveHelpLinks } from "./help-links.mjs";
15
- import { readRootOutputFlags, resolveRootJsonMode, resolveRootVerbosity } from "./root-output-flags.mjs";
16
- import { planInvocation } from "./planner.mjs";
17
- import { plugin } from "./plugin.mjs";
18
- import { assertNoReservedFlagCollisions } from "./reserved-flags.mjs";
19
- import { formatRootHelp } from "./root-help.mjs";
20
- import { prepareRuntimePreflight } from "./runtime-preflight.mjs";
21
- //#region src/core/cli/index.ts
22
- /** Long-flag name reserved by `.completions({ as: 'flag' })`; the planner intercepts it before dispatch. */
23
- const COMPLETIONS_FLAG_NAME = "completions";
24
- /**
25
- * Whether a command — or any of its nested subcommands — declares a flag that
26
- * collides with the eager `--completions` flag, by canonical name, long alias,
27
- * or negated spelling.
28
- *
29
- * @internal
30
- */
31
- function commandReservesCompletionsFlag(schema) {
32
- if (Object.hasOwn(schema.flags, COMPLETIONS_FLAG_NAME)) return true;
33
- for (const [flagName, flagSchema] of Object.entries(schema.flags)) {
34
- if (getFlagAliasNames(flagSchema, {
35
- kind: "long",
36
- includeHidden: true
37
- }).includes(COMPLETIONS_FLAG_NAME)) return true;
38
- if (getFlagNegatedName(flagName, flagSchema) === COMPLETIONS_FLAG_NAME) return true;
39
- }
40
- return schema.commands.some(commandReservesCompletionsFlag);
41
- }
42
- /**
43
- * Reject a command whose flags would be shadowed by the eager `--completions`
44
- * flag once `.completions({ as: 'flag' })` is active. Because the planner
45
- * intercepts `--completions` before dispatch, such a flag could never be reached.
46
- *
47
- * @internal
48
- */
49
- function assertNoCompletionsFlagCollision(schema) {
50
- if (commandReservesCompletionsFlag(schema)) throw new CLIError(`Command '${schema.name}' defines a '--${COMPLETIONS_FLAG_NAME}' flag, which is reserved by .completions({ as: 'flag' })`, {
51
- code: "RESERVED_FLAG",
52
- suggest: `Rename the flag, or register completions as a subcommand with .completions() instead of { as: 'flag' }`
53
- });
54
- }
55
- function assertNoTopLevelRouteConflict(commands, incoming, defaultCommand) {
56
- const routeOwners = /* @__PURE__ */ new Map();
57
- const existing = defaultCommand !== void 0 ? [...commands, defaultCommand] : commands;
58
- for (const registered of existing) for (const route of commandRoutes(registered)) assertNoSiblingRouteConflict("root", routeOwners, route, registered.name);
59
- for (const route of commandRoutes(incoming)) {
60
- const owner = routeOwners.get(route);
61
- if (owner !== void 0) throw new CLIError(`Command route '${route}' is already registered by '${owner}'`, {
62
- code: "DUPLICATE_COMMAND",
63
- suggest: owner === incoming.name ? `Ensure command '${incoming.name}' does not reuse route '${route}'` : `Rename '${incoming.name}' or remove route '${route}' from '${owner}'`
64
- });
65
- routeOwners.set(route, incoming.name);
66
- }
67
- }
68
- /**
69
- * Compiled execution graph per builder instance.
70
- *
71
- * Keyed weakly so handlers and execution steps stay off the public schema and
72
- * out of the emitted declarations.
73
- *
74
- * @internal
75
- */
76
- const compiledStates = /* @__PURE__ */ new WeakMap();
77
- /**
78
- * Read the compiled state seeded by {@linkcode CLIBuilder._from}.
79
- *
80
- * @param builder - Builder to look up.
81
- * @returns Its compiled execution graph.
82
- * @throws {@linkcode CLIError} `INVALID_BUILDER_STATE` when the builder was not created by `cli()`.
83
- *
84
- * @internal
85
- */
86
- function compiledStateOf(builder) {
87
- const compiled = compiledStates.get(builder);
88
- if (compiled === void 0) throw new CLIError("CLI builder carries no compiled command graph", {
89
- code: "INVALID_BUILDER_STATE",
90
- suggest: "Create CLI builders with cli()"
91
- });
92
- return compiled;
93
- }
94
- /**
95
- * Build the next builder in a chain, carrying the current compiled state.
96
- *
97
- * @param builder - Builder the chained call was made on.
98
- * @param schema - Schema for the new builder.
99
- * @returns The new builder.
100
- *
101
- * @internal
102
- */
103
- function rebuild(builder, schema) {
104
- return CLIBuilder._from(schema, compiledStateOf(builder));
105
- }
106
- /**
107
- * Apply the type-only seal to a fully populated CLI schema draft.
108
- *
109
- * The brand has no runtime value, so this is the single construction path for
110
- * {@link CLISchema}, {@link ConfigSettings}, and {@link Builtins} values in
111
- * this module.
112
- *
113
- * @param draft - Draft carrying every schema field.
114
- * @returns The sealed schema.
115
- *
116
- * @internal
117
- */
118
- function sealCLISchema(draft) {
119
- return draft;
120
- }
121
- /**
122
- * Merge definition fields onto the {@link CLISchema} defaults.
123
- *
124
- * @param definition - CLI definition with the name already validated.
125
- * @returns A fully populated {@link CLISchema}.
126
- *
127
- * @internal
128
- */
129
- function buildCLISchema(definition) {
130
- const configSettings = definition.configSettings;
131
- return sealCLISchema({
132
- name: definition.name,
133
- inheritName: definition.inheritName ?? false,
134
- version: definition.version,
135
- description: definition.description,
136
- commands: (definition.commands ?? []).map((child) => createCommandSchema(child)),
137
- defaultCommand: definition.defaultCommand !== void 0 ? createCommandSchema(definition.defaultCommand) : void 0,
138
- defaultCommandRouted: definition.defaultCommandRouted ?? false,
139
- configSettings: configSettings !== void 0 ? {
140
- appName: configSettings.appName,
141
- loaders: configSettings.loaders
142
- } : void 0,
143
- packageJsonSettings: definition.packageJsonSettings,
144
- helpLinks: definition.helpLinks,
145
- hasBuiltInCompletions: definition.hasBuiltInCompletions ?? false,
146
- completionsFlag: definition.completionsFlag,
147
- helpConfig: definition.helpConfig,
148
- flagSettings: definition.flagSettings,
149
- builtins: normalizeBuiltins(definition.builtins)
150
- });
151
- }
152
- /**
153
- * Create a {@link CLISchema} from a plain definition object.
154
- *
155
- * Most consumers should prefer {@link cli | cli()}, which returns a
156
- * {@link CLIBuilder} carrying the execution graph. `createCLISchema()` builds a
157
- * description only: it normalizes commands recursively through
158
- * {@link createCommandSchema}, so handlers and execution steps are not part of
159
- * the result and the schema cannot be executed.
160
- *
161
- * Feeding a built schema back in produces a deep-equal schema.
162
- *
163
- * @param definition - Program name plus optional metadata and commands.
164
- * @returns A fully populated {@link CLISchema}.
165
- * @throws {CLIError} With code `'INVALID_SCHEMA'` when the program name is
166
- * empty, a `builtins` entry is neither `'on'` nor `'off'`, a command name at
167
- * any depth is empty, a flag or arg at any depth is named `__proto__`, or a
168
- * flag record at any depth has a replaced prototype.
169
- * @throws {CLIError} With code `'FLAG_NAME_COLLISION'` when two flags on one
170
- * command share a spelling, at any depth of the command tree.
171
- * @throws {CLIError} With code `'PROPAGATED_FLAG_COLLISION'` when a command flag
172
- * shadows a spelling propagated from an ancestor command.
173
- * @throws {CLIError} With code `'INVALID_BUILDER_STATE'` when a positional comes
174
- * after a variadic one, or `'DUPLICATE_STDIN_INPUT'` when two inputs on one
175
- * command consume stdin and either is exclusive.
176
- * @throws {CLIError} With code `'RESERVED_FLAG'` when a command spells a flag
177
- * the same way as a root-owned flag (`--json`, `--quiet`/`-q`, `--help`/`-h`,
178
- * `--version`/`-V` once `version` is set, and `--completions` once
179
- * `completionsFlag` is set), by name, alias, or negated spelling. A built-in
180
- * set to `'off'` in `builtins` is not reserved.
181
- *
182
- * @example
183
- * ```ts
184
- * const schema = createCLISchema({
185
- * name: 'mycli',
186
- * version: '1.0.0',
187
- * commands: [{ name: 'deploy', flags: { force: { kind: 'boolean' } } }],
188
- * });
189
- * ```
190
- */
191
- function createCLISchema(definition) {
192
- if (definition.name === "") throw new CLIError("CLI schema requires a non-empty name", {
193
- code: "INVALID_SCHEMA",
194
- details: { name: definition.name },
195
- suggest: "Pass a program name such as { name: \"mycli\" }"
196
- });
197
- const schema = buildCLISchema(definition);
198
- const registered = [];
199
- for (const commandSchema of schema.commands) {
200
- assertNoTopLevelRouteConflict(registered, commandSchema);
201
- registered.push(commandSchema);
202
- }
203
- const defaultIsRegisteredCommand = definition.defaultCommand !== void 0 && definition.commands?.includes(definition.defaultCommand) === true;
204
- if (schema.defaultCommand !== void 0 && !defaultIsRegisteredCommand) assertNoTopLevelRouteConflict(registered, schema.defaultCommand);
205
- const allCommands = [schema.defaultCommand, ...schema.commands];
206
- assertNoReservedFlagCollisions(schema.version, allCommands, schema.builtins);
207
- if (schema.completionsFlag !== void 0) {
208
- for (const cmd of allCommands) if (cmd !== void 0) assertNoCompletionsFlagCollision(cmd);
209
- }
210
- return schema;
211
- }
212
- /**
213
- * Concrete {@linkcode RenderContext} carrying the resolved output decisions.
214
- *
215
- * @internal
216
- */
217
- var ResolvedRenderContext = class {
218
- jsonMode;
219
- verbosity;
220
- isTTY;
221
- color;
222
- isHyperlinkSupported;
223
- constructor(out) {
224
- this.jsonMode = out.jsonMode;
225
- this.verbosity = out.verbosity;
226
- this.isTTY = out.isTTY;
227
- this.color = out.color;
228
- this.isHyperlinkSupported = out.isHyperlinkSupported;
229
- }
230
- };
231
- /**
232
- * Resolve the render context for content built before `.run()`.
233
- *
234
- * Content styled ahead of execution — hand-rendered banners, custom help, or
235
- * anything else emitted outside an action handler — has no `out` to consult,
236
- * which pushes consumers into re-deriving the framework's decisions from raw
237
- * argv (`argv.includes('--json')` misreads a post-`--` literal). This probe
238
- * runs the same composition `.execute()`/`.run()` feed into the output
239
- * channel — `--`-aware `--json` detection, the color gate, and the hyperlink
240
- * override — so pre-run styling matches the channel that will render.
241
- *
242
- * @param argv - Raw argv tokens (NOT including the binary/script path,
243
- * i.e. equivalent to `process.argv.slice(2)`).
244
- * @param options - Host facts and overrides.
245
- * @returns The resolved output decisions.
246
- *
247
- * @example
248
- * ```ts
249
- * const ctx = resolveRenderContext(process.argv.slice(2), {
250
- * isTTY: process.stdout.isTTY === true,
251
- * env: process.env,
252
- * });
253
- * const banner = ctx.color.bold('mycli');
254
- * ```
255
- */
256
- function resolveRenderContext(argv, options) {
257
- const rootOutputFlags = readRootOutputFlags(argv, options?.builtins);
258
- const jsonMode = resolveRootJsonMode(rootOutputFlags, options?.jsonMode);
259
- const verbosity = resolveRootVerbosity(rootOutputFlags, options?.verbosity) ?? "normal";
260
- return new ResolvedRenderContext(createOutput({
261
- jsonMode,
262
- isTTY: options?.isTTY ?? false,
263
- verbosity,
264
- ...options?.color !== void 0 ? { color: options.color } : {},
265
- ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
266
- }));
267
- }
268
- /**
269
- * Conditional-spread wrapper for the output channel's `hyperlinks` option:
270
- * omit the key entirely when there is no override so `exactOptionalPropertyTypes`
271
- * stays happy and the channel falls back to `isTTY`.
272
- *
273
- * @internal
274
- */
275
- function hyperlinksOption(override) {
276
- return override !== void 0 ? { hyperlinks: override } : {};
277
- }
278
- /**
279
- * Build {@linkcode RunOptions} from {@linkcode CLIExecuteOptions}, conditionally spreading each
280
- * field to satisfy `exactOptionalPropertyTypes`.
281
- *
282
- * @param options - CLI-level run options (may be `undefined` for defaults).
283
- * @param helpOptions - Help formatting options forwarded to commands.
284
- * @param meta - Optional command metadata (omitted for root-level dispatch).
285
- * @returns Options record ready for the shared executor.
286
- *
287
- * @internal
288
- */
289
- function buildCommandRunOptions(options, helpOptions, meta) {
290
- return {
291
- help: helpOptions,
292
- ...meta !== void 0 ? { meta } : {},
293
- ...options?.plugins !== void 0 ? { plugins: options.plugins } : {},
294
- ...options?.builtins !== void 0 ? { builtins: options.builtins } : {},
295
- ...options?.env !== void 0 ? { env: options.env } : {},
296
- ...options?.config !== void 0 ? { config: options.config } : {},
297
- ...options?.stdinData !== void 0 ? { stdinData: options.stdinData } : {},
298
- ...options?.prompter !== void 0 ? { prompter: options.prompter } : {},
299
- ...options?.answers !== void 0 ? { answers: options.answers } : {},
300
- ...options?.stat !== void 0 ? { stat: options.stat } : {},
301
- ...options?.mkdir !== void 0 ? { mkdir: options.mkdir } : {},
302
- ...options?.verbosity !== void 0 ? { verbosity: options.verbosity } : {},
303
- ...options?.jsonMode !== void 0 ? { jsonMode: options.jsonMode } : {},
304
- ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {},
305
- ...options?.out !== void 0 ? { out: options.out } : {},
306
- ...options?.captured !== void 0 ? { captured: options.captured } : {},
307
- ...options?.flags !== void 0 ? { flags: options.flags } : {}
308
- };
309
- }
310
- /**
311
- * Immutable CLI program builder.
312
- *
313
- * Registers commands, handles root-level `--help`/`--version`, and
314
- * dispatches to the matched command based on argv.
315
- *
316
- * Two execution paths:
317
- * - `.execute(argv, options?)` — testable, returns {@linkcode RunResult}
318
- * - `.run(options?)` — production entry, reads `process.argv`, exits process
319
- *
320
- * @example
321
- * ```ts
322
- * import { cli, command, flag, arg } from '@kjanat/dreamcli';
323
- *
324
- * const deploy = command('deploy')
325
- * .arg('target', arg.string())
326
- * .flag('force', flag.boolean().alias('f'))
327
- * .action(({ args, flags, out }) => {
328
- * out.log(`Deploying ${args.target}...`);
329
- * });
330
- *
331
- * cli('mycli')
332
- * .version('1.0.0')
333
- * .command(deploy)
334
- * .run();
335
- * ```
336
- */
337
- var CLIBuilder = class CLIBuilder {
338
- /** @internal Runtime schema descriptor. */
339
- schema;
340
- constructor(schema) {
341
- this.schema = schema;
342
- }
343
- /**
344
- * Build a CLI builder around a schema and its compiled execution graph.
345
- *
346
- * @param schema - Runtime schema descriptor.
347
- * @param compiled - Compiled commands, default command, and plugins.
348
- * @returns The builder, with its compiled state registered.
349
- *
350
- * @internal
351
- */
352
- static _from(schema, compiled) {
353
- const builder = new CLIBuilder(schema);
354
- compiledStates.set(builder, compiled);
355
- return builder;
356
- }
357
- /**
358
- * Set the program version (shown by `--version`).
359
- *
360
- * Declaring a version also reserves `--version`/`-V` on every registered
361
- * command, so this rejects a command that already declares either spelling.
362
- *
363
- * @param v - Semantic version string.
364
- * @returns The builder (for chaining).
365
- * @throws {@link CLIError} `RESERVED_FLAG` when a registered command spells
366
- * `--version` or `-V` as a flag name, an alias, or a negated spelling.
367
- */
368
- version(v) {
369
- assertNoReservedFlagCollisions(v, [this.schema.defaultCommand, ...this.schema.commands], this.schema.builtins);
370
- return rebuild(this, {
371
- ...this.schema,
372
- version: v
373
- });
374
- }
375
- /**
376
- * Choose which built-in flags the root keeps.
377
- *
378
- * `--help`/`-h`, `--json`, and `--quiet`/`-q` are root-owned by default and
379
- * never reach a command handler. Setting one to `'off'` releases every
380
- * spelling it answers to: the root stops reading it out of argv, root help
381
- * stops advertising it under `Global options:`, and a command may declare it
382
- * as an ordinary flag. `RunOptions.jsonMode` and `RunOptions.verbosity`
383
- * keep working either way, since only argv-driven activation is disabled.
384
- *
385
- * `version` and `completions` are absent by design, since `.version()` and
386
- * `.completions()` are opt-in and a CLI declines those by omission.
387
- *
388
- * Call multiple times to set built-ins incrementally; the last mode given for
389
- * a built-in wins. Turning one back `'on'` re-checks every registered command
390
- * for a collision. Call this **before** registering the commands that declare
391
- * a released flag, since `.command()` rejects the flag while the root still
392
- * owns the token.
393
- *
394
- * @param config - Built-in modes to apply over the current state.
395
- * @returns The builder (for chaining).
396
- * @throws {@link CLIError} `INVALID_SCHEMA` when a value is neither `'on'` nor `'off'`.
397
- * @throws {@link CLIError} `RESERVED_FLAG` when a registered command already
398
- * declares a flag spelled like a built-in this call keeps or restores.
399
- * @see {@link BuiltinsConfig} for the accepted keys and modes.
400
- * @see https://dreamcli.kjanat.dev/guide/output#taking-a-built-in-over
401
- *
402
- * @example
403
- * ```ts
404
- * // `--json` names the document the command validates.
405
- * cli('schematool')
406
- * .builtins({ json: 'off' })
407
- * .default(
408
- * command('validate')
409
- * .flag('json', flag.string().describe('Document to validate'))
410
- * .action(({ flags, out }) => out.log(flags.json)),
411
- * )
412
- * .run();
413
- * ```
414
- */
415
- builtins(config) {
416
- const definedConfig = {
417
- ...config.help !== void 0 ? { help: config.help } : {},
418
- ...config.json !== void 0 ? { json: config.json } : {},
419
- ...config.quiet !== void 0 ? { quiet: config.quiet } : {}
420
- };
421
- const builtins = normalizeBuiltins({
422
- ...this.schema.builtins,
423
- ...definedConfig
424
- });
425
- assertNoReservedFlagCollisions(this.schema.version, [this.schema.defaultCommand, ...this.schema.commands], builtins);
426
- return rebuild(this, sealCLISchema({
427
- ...this.schema,
428
- builtins
429
- }));
430
- }
431
- /**
432
- * Set the program description (shown in root help).
433
- *
434
- * @param text - Short description displayed in root help output.
435
- * @returns The builder (for chaining).
436
- */
437
- description(text) {
438
- return rebuild(this, {
439
- ...this.schema,
440
- description: text
441
- });
442
- }
443
- /**
444
- * Make the root-help header clickable with OSC 8 hyperlinks.
445
- *
446
- * Links the program name and version on the first line of root `--help`
447
- * output in terminals that support
448
- * [OSC 8 hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
449
- * The escapes are only emitted when stdout is a TTY (overridable via
450
- * `options.help.hyperlinks`), and only in the header — usage lines, the
451
- * `--help` hint, the commands table, and completion scripts stay plain.
452
- *
453
- * URLs not provided here are derived from manifest metadata when
454
- * `.manifest()` is active (works with both filesystem discovery and
455
- * pre-loaded data):
456
- * - **name** → normalized `repository` URL, falling back to `homepage`
457
- * - **version** → forge release tag (`{repo}/releases/tag/v{version}` on
458
- * GitHub, `{repo}/-/releases/v{version}` on GitLab)
459
- *
460
- * @param links - Explicit URLs; omit to derive everything from the manifest.
461
- * @returns The builder (for chaining).
462
- *
463
- * @example
464
- * ```ts
465
- * // Derive both links from the manifest repository/homepage:
466
- * cli('mycli')
467
- * .manifest()
468
- * .links()
469
- * .run();
470
- *
471
- * // Explicit URLs (no package.json required):
472
- * cli('mycli')
473
- * .version('1.0.0')
474
- * .links({
475
- * name: 'https://github.com/me/mycli',
476
- * version: 'https://github.com/me/mycli/releases/tag/v1.0.0',
477
- * })
478
- * .run();
479
- * ```
480
- */
481
- links(links) {
482
- return rebuild(this, {
483
- ...this.schema,
484
- helpLinks: {
485
- name: toUrlString(links?.name),
486
- version: toUrlString(links?.version)
487
- }
488
- });
489
- }
490
- /**
491
- * Configure root-help rendering defaults.
492
- *
493
- * Stored on the schema and merged **under** any runtime `options.help`
494
- * (runtime wins). Call multiple times to set fields incrementally.
495
- *
496
- * @param config - Help rendering options (see {@link HelpConfig}).
497
- * @returns The builder (for chaining).
498
- *
499
- * @example
500
- * ```ts
501
- * // Echo the default command under Commands and never show the footer:
502
- * cli('mycli')
503
- * .help({ showDefaultInCommands: true, footer: false })
504
- * .default(serve)
505
- * .run();
506
- * ```
507
- */
508
- help(config) {
509
- return rebuild(this, {
510
- ...this.schema,
511
- helpConfig: {
512
- ...this.schema.helpConfig,
513
- ...config
514
- }
515
- });
516
- }
517
- /**
518
- * Enable automatic config file discovery.
519
- *
520
- * When enabled, `.run()` probes standard paths before dispatching,
521
- * first match wins, no merging:
522
- * 1. Project scope — for `$CWD` and each ancestor directory up to the
523
- * filesystem root, nearest first:
524
- * `.{appName}.json`, `{appName}.config.json`, `.config/{appName}.json`
525
- * 2. User scope — `{dir}/{appName}/config.json` for each user config
526
- * root (`$XDG_CONFIG_HOME` / `~/.config` on Unix, plus
527
- * `~/Library/Application Support` on macOS,
528
- * `%APPDATA%` / `%USERPROFILE%\\AppData\\Roaming` on Windows)
529
- * 3. System scope — `/etc/{appName}/config.json` on Linux and macOS
530
- *
531
- * The user can override the path via `--config <path>` or `--config=<path>`.
532
- *
533
- * Loaded config feeds into the resolution chain
534
- * (CLI → env → **config** → prompt → default) for flags that
535
- * declare `.config('dotted.path')`.
536
- *
537
- * Has no effect in `.execute()` (which receives config via
538
- * `options.config` directly).
539
- *
540
- * @param appName - Name used to build search paths.
541
- * @param loaders - Additional {@link FormatLoader}s (JSON is built-in).
542
- * @returns The builder (for chaining).
543
- */
544
- config(appName, loaders) {
545
- return rebuild(this, sealCLISchema({
546
- ...this.schema,
547
- configSettings: {
548
- appName,
549
- loaders
550
- }
551
- }));
552
- }
553
- /**
554
- * Register a custom config format loader.
555
- *
556
- * Adds a {@link FormatLoader} incrementally — call multiple times to
557
- * register multiple formats. Loaders registered later for the same
558
- * extension override earlier ones.
559
- *
560
- * Requires `.config()` to have been called first (sets the app name).
561
- *
562
- * @param loader - Format loader (or extensions + parse function).
563
- * @returns The builder (for chaining).
564
- *
565
- * @example Bun built-in parsers
566
- * ```ts
567
- * import { configFormat } from '@kjanat/dreamcli';
568
- *
569
- * cli('myapp')
570
- * .config('myapp')
571
- * .configLoader(configFormat(['yaml', 'yml'], Bun.YAML.parse))
572
- * .configLoader(configFormat(['toml'], Bun.TOML.parse))
573
- * .run();
574
- * ```
575
- *
576
- * @example npm package parsers
577
- * ```ts
578
- * import { configFormat } from '@kjanat/dreamcli';
579
- * import { parse as parseYaml } from 'yaml';
580
- * import { parse as parseTOML } from '@iarna/toml';
581
- *
582
- * cli('myapp')
583
- * .config('myapp')
584
- * .configLoader(configFormat(['yaml', 'yml'], parseYaml))
585
- * .configLoader(configFormat(['toml'], parseTOML))
586
- * .run();
587
- * ```
588
- */
589
- configLoader(loader) {
590
- if (this.schema.configSettings === void 0) throw new CLIError(".configLoader() requires .config() to be called first", {
591
- code: "INVALID_BUILDER_STATE",
592
- suggest: "Call .config(appName) before .configLoader()"
593
- });
594
- const existing = this.schema.configSettings.loaders ?? [];
595
- return rebuild(this, sealCLISchema({
596
- ...this.schema,
597
- configSettings: {
598
- ...this.schema.configSettings,
599
- loaders: [...existing, loader]
600
- }
601
- }));
602
- }
603
- manifest(input) {
604
- const next = buildManifestSchema(this.schema, input, DEFAULT_MANIFEST_FILES);
605
- assertNoReservedFlagCollisions(next.version, [next.defaultCommand, ...next.commands], next.builtins);
606
- return rebuild(this, next);
607
- }
608
- /**
609
- * Register a command with the CLI program.
610
- *
611
- * The command's schema joins {@link CLISchema.commands}; its handler and
612
- * subcommand tree are compiled into the builder's execution graph.
613
- *
614
- * @param cmd - {@link CommandBuilder} to register.
615
- * @returns The builder (for chaining).
616
- * @throws {@link CLIError} `RESERVED_FLAG` when the command, or one of its
617
- * nested subcommands, spells a root-owned flag (`--json`, `--quiet`/`-q`,
618
- * `--help`/`-h`, and `--version`/`-V` once
619
- * {@link CLIBuilder.version | .version()} is set) as a flag name, an alias,
620
- * or a negated spelling. A built-in released through
621
- * {@link CLIBuilder.builtins | .builtins()} is not reserved.
622
- */
623
- command(cmd) {
624
- assertNoTopLevelRouteConflict(this.schema.commands, cmd.schema, this.schema.defaultCommand);
625
- assertNoReservedFlagCollisions(this.schema.version, [cmd.schema], this.schema.builtins);
626
- if (this.schema.completionsFlag !== void 0) assertNoCompletionsFlagCollision(cmd.schema);
627
- const compiled = compiledStateOf(this);
628
- return CLIBuilder._from({
629
- ...this.schema,
630
- commands: [...this.schema.commands, cmd.schema]
631
- }, {
632
- ...compiled,
633
- commands: [...compiled.commands, compileCommand(cmd)]
634
- });
635
- }
636
- /**
637
- * Register a command as the default — dispatched when no subcommand is given.
638
- *
639
- * The CLI root behaves like a hybrid command group: named subcommands
640
- * dispatch normally, but empty argv or flags-only argv falls through to
641
- * this command instead of showing root help.
642
- *
643
- * The default command is the CLI's root *surface*: its flags and arguments
644
- * are rendered inline in root help. By default it is **not** a named
645
- * subcommand — it cannot be invoked by its own name (`mycli mycmd` does not
646
- * route to it) and it is omitted from the root `Commands:` list (re-enable
647
- * listing with `.help({ showDefaultInCommands: true })`). Only one default is
648
- * allowed.
649
- *
650
- * Pass `{ route: true }` to *also* expose the command under its own name as a
651
- * routable top-level command: `mycli` and `mycli <name>` then run the same
652
- * command object, and it is listed in `Commands:` beside its siblings. This
653
- * avoids duplicating the command just to keep both forms equivalent during a
654
- * v3 migration.
655
- *
656
- * @example
657
- * ```ts
658
- * // Single-command CLI — no subcommand name needed:
659
- * // mytool --force production
660
- * cli('mytool')
661
- * .default(deploy)
662
- * .run();
663
- *
664
- * // Multi-command CLI with a default:
665
- * // mytool production → runs deploy
666
- * // mytool status → runs status
667
- * cli('mytool')
668
- * .default(deploy)
669
- * .command(status)
670
- * .run();
671
- *
672
- * // Default that is also a named route — `mytool` and `mytool status` are
673
- * // the same surface, and `status` is listed beside `logs`:
674
- * cli('mytool')
675
- * .default(status, { route: true })
676
- * .command(logs)
677
- * .run();
678
- * ```
679
- *
680
- * @param cmd - {@link CommandBuilder} to register as the default.
681
- * @param options - Default-command options. `{ route: true }` also exposes
682
- * the command under its own name (see {@link DefaultCommandOptions}).
683
- * @returns The builder (for chaining).
684
- * @throws {@link CLIError} `RESERVED_FLAG` when the command, or one of its
685
- * nested subcommands, spells a root-owned flag (`--json`, `--quiet`/`-q`,
686
- * `--help`/`-h`, and `--version`/`-V` once
687
- * {@link CLIBuilder.version | .version()} is set) as a flag name, an alias,
688
- * or a negated spelling. A built-in released through
689
- * {@link CLIBuilder.builtins | .builtins()} is not reserved.
690
- */
691
- default(cmd, options) {
692
- if (this.schema.defaultCommand !== void 0) throw new CLIError("Only one default command is allowed", {
693
- code: "DUPLICATE_DEFAULT",
694
- suggest: "Call .default() only once when building the CLI"
695
- });
696
- assertNoTopLevelRouteConflict(this.schema.commands, cmd.schema);
697
- assertNoReservedFlagCollisions(this.schema.version, [cmd.schema], this.schema.builtins);
698
- if (this.schema.completionsFlag !== void 0) assertNoCompletionsFlagCollision(cmd.schema);
699
- const compiled = compiledStateOf(this);
700
- return CLIBuilder._from({
701
- ...this.schema,
702
- defaultCommand: cmd.schema,
703
- defaultCommandRouted: options?.route ?? false
704
- }, {
705
- ...compiled,
706
- defaultCommand: compileCommand(cmd)
707
- });
708
- }
709
- /**
710
- * Register a CLI plugin.
711
- *
712
- * Plugins run in registration order. At each lifecycle stage, all hooks for
713
- * the first plugin run before hooks for the second plugin, and so on.
714
- *
715
- * @param definition - A frozen {@link CLIPlugin} created by {@link plugin}.
716
- * @returns The builder (for chaining).
717
- * @see {@link plugin} to construct plugin definitions.
718
- */
719
- plugin(definition) {
720
- const compiled = compiledStateOf(this);
721
- return CLIBuilder._from(this.schema, {
722
- ...compiled,
723
- plugins: [...compiled.plugins, definition]
724
- });
725
- }
726
- /**
727
- * Register built-in shell completion.
728
- *
729
- * By default (`{ as: 'command' }`) this registers a `completions` subcommand
730
- * that accepts a `shell` argument and writes the script to stdout. With
731
- * `{ as: 'flag' }` it instead exposes an eager `--completions <shell>` flag on
732
- * the CLI root — no subcommand is registered, so a default command stays the
733
- * lone root surface. The flag may be given without a value to auto-detect the
734
- * shell from `$SHELL` / `$PSModulePath`.
735
- *
736
- * In subcommand mode, call this **after** registering all other commands so
737
- * the completion script includes the full command set: that path snapshots the
738
- * schema (and completion options) at call time, so commands registered
739
- * afterwards will not appear in that subcommand's generated script. In flag
740
- * mode, generation runs at execution time from the final builder schema, so
741
- * registration order does not matter.
742
- *
743
- * @example
744
- * ```ts
745
- * // Subcommand form (default):
746
- * cli('mycli')
747
- * .version('1.0.0')
748
- * .command(deploy)
749
- * .completions({ rootMode: 'surface' })
750
- * .run();
751
- *
752
- * // Eager-flag form, ideal for single-command CLIs:
753
- * cli('mycli')
754
- * .completions({ as: 'flag' })
755
- * .default(serve)
756
- * .run();
757
- * ```
758
- */
759
- completions(options) {
760
- if (this.schema.hasBuiltInCompletions) throw new CLIError(".completions() has already been called", {
761
- code: "DUPLICATE_COMMAND",
762
- suggest: "Call .completions() only once when building the CLI"
763
- });
764
- if (options?.as === "flag") {
765
- if (this.schema.defaultCommand !== void 0) assertNoCompletionsFlagCollision(this.schema.defaultCommand);
766
- for (const registered of this.schema.commands) assertNoCompletionsFlagCollision(registered);
767
- return rebuild(this, {
768
- ...this.schema,
769
- hasBuiltInCompletions: true,
770
- completionsFlag: {
771
- shells: SHELLS,
772
- options
773
- }
774
- });
775
- }
776
- const cliSchema = this.schema;
777
- const completionOptions = options;
778
- const cmd = command("completions").alias("completion").description("Generate shell completion script").arg("shell", arg.custom((raw) => {
779
- const shell = normalizeShell(raw);
780
- if (shell === void 0) throw new Error(`Unknown shell '${raw}'. Valid shells: ${SHELLS.join(", ")}`);
781
- return shell;
782
- }).env("SHELL").describe(`Target shell (${SHELLS.join(", ")})`)).action(({ args, meta, out }) => {
783
- const completionSchema = meta.bin === cliSchema.name ? cliSchema : {
784
- ...cliSchema,
785
- name: meta.bin
786
- };
787
- const script = generateCompletion(completionSchema, args.shell, completionOptions);
788
- if (out.jsonMode) out.json({
789
- shell: args.shell,
790
- script
791
- });
792
- else out.log(script);
793
- });
794
- const withCompletions = this.command(cmd);
795
- return rebuild(withCompletions, {
796
- ...withCompletions.schema,
797
- hasBuiltInCompletions: true
798
- });
799
- }
800
- /**
801
- * Execute the CLI program against explicit argv.
802
- *
803
- * This is the testable execution path — no process state is touched.
804
- * Returns a structured {@linkcode RunResult} with exit code and captured output.
805
- *
806
- * @param argv - Raw argv tokens (NOT including the binary/script path,
807
- * i.e. equivalent to `process.argv.slice(2)`).
808
- * @param options - Injectable runtime state.
809
- * @returns Structured result with exit code and captured output.
810
- */
811
- async execute(argv, options) {
812
- return executeCLI(this, argv, options);
813
- }
814
- /**
815
- * Run the CLI program as a production entry point.
816
- *
817
- * Reads argv from the runtime adapter, dispatches to the matched
818
- * command, writes output to real streams, and exits the process.
819
- *
820
- * This is the **only** place that touches process state (via the
821
- * adapter). For testing, use `.execute()` instead — or provide a
822
- * test adapter via `options.adapter`.
823
- *
824
- * Defaults to {@linkcode createAdapter | createAdapter()} when no adapter is provided,
825
- * which auto-detects the runtime (Node.js, Bun) and creates
826
- * the appropriate adapter.
827
- *
828
- * @param options - Optional runtime configuration including adapter.
829
- */
830
- async run(options) {
831
- const adapter = options?.adapter ?? createAdapter();
832
- const inheritedName = this.schema.inheritName ? inferInvocationName(adapter.argv) : void 0;
833
- const compiled = compiledStateOf(this);
834
- const preflight = await prepareRuntimePreflight({
835
- schema: this.schema,
836
- compiled,
837
- adapter,
838
- options,
839
- inheritedName
840
- });
841
- if (preflight.kind === "startup-error") {
842
- if (preflight.jsonMode) adapter.stdout(`${JSON.stringify({ error: preflight.error.toJSON() })}\n`);
843
- else {
844
- adapter.stderr(`Error: ${preflight.error.message}\n`);
845
- if (preflight.error.suggest !== void 0) adapter.stderr(`Suggestion: ${preflight.error.suggest}\n`);
846
- }
847
- return adapter.exit(preflight.error.exitCode);
848
- }
849
- const effectiveBuilder = preflight.schema === this.schema ? this : rebuild(this, sealCLISchema({
850
- ...this.schema,
851
- ...preflight.schema
852
- }));
853
- const terminalSize = adapter.getTerminalSize();
854
- const runtimeHelpWidth = options?.help?.width === void 0 && preflight.schema.helpConfig?.width === void 0 ? terminalSize?.columns : void 0;
855
- const runtimeHelpOptions = runtimeHelpWidth !== void 0 ? {
856
- ...options?.help,
857
- width: runtimeHelpWidth
858
- } : options?.help;
859
- const executeOptions = {
860
- ...options,
861
- ...preflight.inputs,
862
- ...runtimeHelpOptions !== void 0 ? { help: runtimeHelpOptions } : {},
863
- out: createOutput({
864
- stdout: adapter.stdout,
865
- stderr: adapter.stderr,
866
- jsonMode: preflight.inputs.jsonMode,
867
- isTTY: preflight.inputs.isTTY,
868
- ...preflight.inputs.verbosity !== "normal" ? { verbosity: preflight.inputs.verbosity } : {},
869
- ...hyperlinksOption(resolveHyperlinkOverride(adapter.env, adapter.argv))
870
- })
871
- };
872
- const result = await executeCLI(effectiveBuilder, preflight.filteredArgv, executeOptions);
873
- for (const line of result.stdout) adapter.stdout(line);
874
- for (const line of result.stderr) adapter.stderr(line);
875
- return adapter.exit(result.exitCode);
876
- }
877
- };
878
- /**
879
- * Execution body shared by {@linkcode CLIBuilder.execute} and {@linkcode CLIBuilder.run},
880
- * accepting the framework-populated output channel and plugin fields.
881
- *
882
- * @param builder - Builder supplying the schema and compiled command graph.
883
- * @param argv - Raw argv tokens (NOT including the binary/script path).
884
- * @param options - Injectable runtime state plus framework-populated fields.
885
- * @returns Structured result with exit code and captured output.
886
- *
887
- * @internal
888
- */
889
- async function executeCLI(builder, argv, options) {
890
- const rootOutputFlags = readRootOutputFlags(argv, builder.schema.builtins);
891
- const jsonMode = resolveRootJsonMode(rootOutputFlags, options?.jsonMode);
892
- const verbosity = resolveRootVerbosity(rootOutputFlags, options?.verbosity);
893
- const captureOptions = {
894
- ...verbosity !== void 0 ? { verbosity } : {},
895
- ...jsonMode ? { jsonMode } : {},
896
- ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {},
897
- ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
898
- };
899
- let out;
900
- let captured;
901
- if (options?.out !== void 0) {
902
- out = options.out;
903
- captured = options.captured ?? {
904
- stdout: [],
905
- stderr: [],
906
- activity: []
907
- };
908
- } else [out, captured] = createCaptureOutput(Object.keys(captureOptions).length > 0 ? captureOptions : void 0);
909
- clearRequestedExitCode(out);
910
- const resolvedVersion = options?.help?.version ?? builder.schema.version;
911
- const helpOptions = {
912
- ...builder.schema.helpConfig,
913
- ...options?.help,
914
- binName: options?.help?.binName ?? builder.schema.name,
915
- hyperlinks: options?.help?.hyperlinks ?? builder.schema.helpConfig?.hyperlinks ?? out.isHyperlinkSupported,
916
- colors: options?.help?.colors ?? out.color,
917
- ...resolvedVersion !== void 0 ? { version: resolvedVersion } : {}
918
- };
919
- const compiled = compiledStateOf(builder);
920
- const flagSettings = options?.flags ?? builder.schema.flagSettings;
921
- const effectiveOptions = {
922
- ...options,
923
- plugins: compiled.plugins,
924
- builtins: builder.schema.builtins,
925
- ...jsonMode ? { jsonMode } : {},
926
- ...verbosity !== void 0 ? { verbosity } : {},
927
- ...flagSettings !== void 0 ? { flags: flagSettings } : {}
928
- };
929
- const output = {
930
- jsonMode,
931
- isTTY: out.isTTY,
932
- verbosity: verbosity ?? "normal"
933
- };
934
- const planSchema = options?.flags !== void 0 ? {
935
- ...builder.schema,
936
- flagSettings
937
- } : builder.schema;
938
- const planned = planInvocation({
939
- schema: planSchema,
940
- compiled,
941
- argv,
942
- help: helpOptions,
943
- output
944
- });
945
- switch (planned.kind) {
946
- case "root-version":
947
- out.log(planned.version);
948
- return buildRunResult({
949
- exitCode: 0,
950
- error: void 0
951
- }, captured);
952
- case "root-completions": {
953
- const shell = planned.shell ?? detectShell(options?.env ?? {});
954
- if (shell === void 0) {
955
- const error = new CLIError("Could not detect shell", {
956
- code: "MISSING_VALUE",
957
- suggest: `Pass one explicitly, e.g. '${helpOptions.binName} --completions zsh'`
958
- });
959
- if (jsonMode) out.json({ error: error.toJSON() });
960
- else {
961
- out.error(error.message);
962
- out.error(`Suggestion: ${error.suggest}`);
963
- }
964
- return buildRunResult({
965
- exitCode: error.exitCode,
966
- error
967
- }, captured);
968
- }
969
- const completionSchema = helpOptions.binName === void 0 || helpOptions.binName === builder.schema.name ? builder.schema : {
970
- ...builder.schema,
971
- name: helpOptions.binName
972
- };
973
- const script = generateCompletion(completionSchema, shell, planned.options);
974
- if (jsonMode) out.json({
975
- shell,
976
- script
977
- });
978
- else out.log(script);
979
- return buildRunResult({
980
- exitCode: 0,
981
- error: void 0
982
- }, captured);
983
- }
984
- case "root-help":
985
- if (jsonMode) out.json(generateSchema(builder.schema, void 0, {
986
- name: planned.help.binName ?? builder.schema.name,
987
- version: planned.help.version ?? builder.schema.version
988
- }));
989
- else {
990
- const helpText = formatRootHelp(resolveHelpLinksSchema(builder.schema), planned.help);
991
- out.log(helpText);
992
- }
993
- return buildRunResult({
994
- exitCode: 0,
995
- error: void 0
996
- }, captured);
997
- case "dispatch-error":
998
- if (jsonMode) out.json({ error: planned.error.toJSON() });
999
- else {
1000
- out.error(planned.error.message);
1001
- if (planned.error.suggest !== void 0 && planned.error.code !== "NO_ACTION") out.error(`Suggestion: ${planned.error.suggest}`);
1002
- }
1003
- return buildRunResult({
1004
- exitCode: planned.error.exitCode,
1005
- error: planned.error
1006
- }, captured);
1007
- case "needs-subcommand":
1008
- if (jsonMode) out.json(generateCommandSchema(planned.command.schema, void 0, {
1009
- name: planned.help.binName ?? planned.command.schema.name,
1010
- version: planned.help.version
1011
- }));
1012
- else {
1013
- const helpText = formatHelp(planned.command.schema, planned.help);
1014
- out.log(helpText);
1015
- }
1016
- return buildRunResult({
1017
- exitCode: 0,
1018
- error: void 0
1019
- }, captured);
1020
- case "match": {
1021
- const commandRunOptions = buildCommandRunOptions(effectiveOptions, planned.plan.help ?? helpOptions, planned.plan.meta);
1022
- const result = await executeCommand({
1023
- command: {
1024
- handler: planned.plan.command.handler,
1025
- steps: planned.plan.command.steps
1026
- },
1027
- argv: planned.plan.argv,
1028
- out,
1029
- schema: planned.plan.mergedSchema,
1030
- meta: planned.plan.meta,
1031
- options: commandRunOptions
1032
- });
1033
- return buildRunResult(result, captured);
1034
- }
1035
- }
1036
- }
1037
- const RUNTIME_BINARIES = /* @__PURE__ */ new Set([
1038
- "bun",
1039
- "deno",
1040
- "node",
1041
- "tsx"
1042
- ]);
1043
- /**
1044
- * Extract the final path segment from a path-like or URL-like string.
1045
- *
1046
- * @param input - Forward- or backslash-delimited path.
1047
- * @returns Trailing segment, or `undefined` when the input is empty or slash-only.
1048
- *
1049
- * @internal
1050
- */
1051
- function basename(input) {
1052
- const trimmed = stripTrailing(input, [47, 92]);
1053
- if (trimmed.length === 0) return void 0;
1054
- const slashIdx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
1055
- const name = slashIdx >= 0 ? trimmed.slice(slashIdx + 1) : trimmed;
1056
- return name.length > 0 ? name : void 0;
1057
- }
1058
- /**
1059
- * Detect known interpreter/runtime binary names (node, bun, deno, tsx).
1060
- *
1061
- * @param input - Candidate binary name, with or without `.exe` suffix.
1062
- * @returns `true` when `input` matches a known runtime after normalization.
1063
- *
1064
- * @internal
1065
- */
1066
- function isRuntimeBinaryName(input) {
1067
- const normalized = input.toLowerCase().replace(/\.exe$/i, "");
1068
- return RUNTIME_BINARIES.has(normalized);
1069
- }
1070
- /**
1071
- * Infer the displayed CLI name from the current runtime invocation.
1072
- *
1073
- * Resolution order:
1074
- * 1. Node/Bun/tsx-style interpreters → script/entry argument basename
1075
- * 2. Standalone executable invocations → argv[0] basename
1076
- * 3. `undefined` when no stable entrypoint can be inferred (e.g. Deno synthetic argv)
1077
- *
1078
- * @param argv - Full process argv (typically `process.argv` or adapter equivalent).
1079
- * @returns Inferred program name, or `undefined` when inference is ambiguous.
1080
- *
1081
- * @internal
1082
- */
1083
- function inferInvocationName(argv) {
1084
- const argv0 = argv[0];
1085
- const argv1 = argv[1];
1086
- const runtimeName = argv0 !== void 0 ? basename(argv0) : void 0;
1087
- if (runtimeName !== void 0 && isRuntimeBinaryName(runtimeName)) {
1088
- if (runtimeName === "bun" && argv1 === "run") {
1089
- const entryArg = argv[2];
1090
- if (entryArg === void 0 || entryArg.startsWith("-")) return void 0;
1091
- return basename(entryArg);
1092
- }
1093
- if (runtimeName === "deno" && argv1 === "run") return void 0;
1094
- if (argv1 === void 0 || argv1.startsWith("-")) return void 0;
1095
- return basename(argv1);
1096
- }
1097
- return argv0 !== void 0 ? basename(argv0) : void 0;
1098
- }
1099
- /** Coerce a `string | URL` link input to its string form. @internal */
1100
- function toUrlString(value) {
1101
- if (value === void 0) return void 0;
1102
- return value instanceof URL ? value.href : value;
1103
- }
1104
- /**
1105
- * Resolve derived help links against pre-loaded manifest data.
1106
- *
1107
- * `.run()` resolves links during runtime preflight (where discovered manifest
1108
- * metadata lives); this covers the filesystem-free `.execute()` path, where
1109
- * only the `.manifest(data)` overload can contribute. Idempotent —
1110
- * already-resolved fields pass through unchanged.
1111
- *
1112
- * @internal
1113
- */
1114
- function resolveHelpLinksSchema(schema) {
1115
- if (schema.helpLinks === void 0) return schema;
1116
- return {
1117
- ...schema,
1118
- helpLinks: deriveHelpLinks(schema.helpLinks, schema.packageJsonSettings?.data, schema.version)
1119
- };
1120
- }
1121
- /** Default manifest filenames for `.manifest()`. @internal */
1122
- const DEFAULT_MANIFEST_FILES = ["package.json"];
1123
- /**
1124
- * Normalise an {@link InferNameOption} into the flat `{ inferName, stripScope }`
1125
- * pair stored in {@link ResolvedManifestSettings}.
1126
- *
1127
- * @internal
1128
- */
1129
- function normalizeInferName(option) {
1130
- if (option === void 0 || option === false) return {
1131
- inferName: false,
1132
- stripScope: true
1133
- };
1134
- if (option === true) return {
1135
- inferName: true,
1136
- stripScope: true
1137
- };
1138
- return {
1139
- inferName: true,
1140
- stripScope: option.scope !== "keep"
1141
- };
1142
- }
1143
- /**
1144
- * Build the next {@link CLISchema} for {@link CLIBuilder.manifest}.
1145
- *
1146
- * The data overload (detected via field shape) merges `version`/`description`
1147
- * immediately so `.execute()` sees them; the settings overload stores discovery
1148
- * config for runtime preflight.
1149
- *
1150
- * @internal
1151
- */
1152
- function buildManifestSchema(schema, input, defaultFiles) {
1153
- if (isPackageJsonData(input)) return {
1154
- ...schema,
1155
- ...schema.version === void 0 && input.version !== void 0 ? { version: input.version } : {},
1156
- ...schema.description === void 0 && input.description !== void 0 ? { description: input.description } : {},
1157
- packageJsonSettings: {
1158
- inferName: false,
1159
- stripScope: true,
1160
- from: void 0,
1161
- files: defaultFiles,
1162
- data: input
1163
- }
1164
- };
1165
- const { inferName, stripScope } = normalizeInferName(input?.inferName);
1166
- const files = input?.files ?? defaultFiles;
1167
- return {
1168
- ...schema,
1169
- packageJsonSettings: {
1170
- inferName,
1171
- stripScope,
1172
- from: normalizeFromSetting(input?.from),
1173
- files,
1174
- data: void 0
1175
- }
1176
- };
1177
- }
1178
- /**
1179
- * Coerce a {@link ResolvedManifestSettings.from | `manifest.from`} input
1180
- * (string path, `file:` URL string, {@link URL} instance, or `import.meta`) to
1181
- * a plain filesystem path string. `undefined` passes through unchanged.
1182
- *
1183
- * Runtime-agnostic by design — relies only on the `URL` global (available in
1184
- * every JS runtime) rather than `node:url`, keeping core free of Node
1185
- * built-ins. Non-`file:` inputs are returned unchanged as paths.
1186
- *
1187
- * @internal
1188
- */
1189
- function normalizeFromSetting(from) {
1190
- if (from === void 0) return void 0;
1191
- const source = typeof from === "object" && !(from instanceof URL) ? from.url : from;
1192
- if (source instanceof URL) {
1193
- if (source.protocol !== "file:") return source.href;
1194
- } else if (!source.startsWith("file:")) return source;
1195
- const decoded = decodeURIComponent(new URL(source).pathname);
1196
- if (/^\/[A-Za-z]:/.test(decoded)) return decoded.slice(1).replace(/\//g, "\\");
1197
- return decoded;
1198
- }
1199
- /**
1200
- * Predicate distinguishing the {@link PackageJsonData | data} overload of
1201
- * `.manifest()` from the settings overload at runtime.
1202
- *
1203
- * A value is treated as `PackageJsonData` when it's a plain object that
1204
- * carries at least one recognised field (`name`, `version`, `description`,
1205
- * `bin`, `homepage`, or `repository`). An empty `{}` or a settings-shaped
1206
- * object (`inferName` / `from`) falls through to the settings overload.
1207
- *
1208
- * npm's `files` field (publish globs) is intentionally NOT recognised here, so
1209
- * an object whose only key is `files` routes to the settings overload — where
1210
- * `files` means candidate manifest filenames, never publish globs. Manifests
1211
- * that publish a CLI carry `name`/`version`, so those route to the data overload
1212
- * as expected.
1213
- *
1214
- * Edge case: a metadata-less manifest (e.g. a versionless private-root
1215
- * `package.json` carrying only `files`/`private`) routes to settings, so its
1216
- * `files` would be read as candidate filenames and the object is not stored as
1217
- * data. This is harmless in practice — a metadata-less manifest contributes no
1218
- * `version`/`description` either way — but it means a pre-loaded object must
1219
- * carry real metadata to be honoured as data.
1220
- *
1221
- * @internal
1222
- */
1223
- function isPackageJsonData(value) {
1224
- if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
1225
- return "name" in value || "version" in value || "description" in value || "bin" in value || "homepage" in value || "repository" in value;
1226
- }
1227
- function cli(nameOrOptions, extraOptions) {
1228
- const options = typeof nameOrOptions === "string" ? {
1229
- name: nameOrOptions,
1230
- ...extraOptions
1231
- } : nameOrOptions;
1232
- const name = options.name ?? "cli";
1233
- const inheritName = options.inherit ?? false;
1234
- return CLIBuilder._from(createCLISchema({
1235
- name,
1236
- inheritName,
1237
- flagSettings: options.flags
1238
- }), {
1239
- commands: [],
1240
- defaultCommand: void 0,
1241
- plugins: []
1242
- });
1243
- }
1244
- /**
1245
- * Report whether the calling module is the process entrypoint, cross-runtime.
1246
- *
1247
- * Node, Bun, and Deno set `import.meta.main` on the module invoked directly;
1248
- * projects with the runtime's ambient types can read that property directly.
1249
- * This helper is a compatibility form for projects whose `tsconfig.json` `lib`
1250
- * override drops those `ImportMeta` extras: passing `import.meta` whole avoids
1251
- * a direct `.main` access without requiring global augmentation.
1252
- *
1253
- * @param meta - The calling module's `import.meta`.
1254
- * @returns `true` when the module was run as the entrypoint.
1255
- *
1256
- * @example
1257
- * ```ts
1258
- * if (isMainModule(import.meta)) cli('mycli').command(deploy).run();
1259
- * ```
1260
- */
1261
- function isMainModule(meta) {
1262
- return meta.main === true;
1263
- }
1264
- //#endregion
1265
- export { CLIBuilder, cli, compiledStateOf, createCLISchema, executeCLI, isMainModule, plugin, resolveRenderContext };