@kjanat/dreamcli 3.0.0-rc.8 → 3.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 (490) hide show
  1. package/CHANGELOG.md +271 -1
  2. package/README.md +30 -13
  3. package/dist/core/cli/dispatch.mjs +0 -11
  4. package/dist/core/cli/index.d.mts +133 -9
  5. package/dist/core/cli/index.mjs +119 -27
  6. package/dist/core/cli/planner.mjs +7 -1
  7. package/dist/core/cli/root-help.mjs +5 -0
  8. package/dist/core/cli/runtime-preflight.d.mts +4 -0
  9. package/dist/core/cli/runtime-preflight.mjs +5 -3
  10. package/dist/core/completion/shells/shared.mjs +1 -0
  11. package/dist/core/config/index.d.mts +43 -12
  12. package/dist/core/config/index.mjs +55 -16
  13. package/dist/core/config/package-json.d.mts +1 -0
  14. package/dist/core/errors/index.d.mts +2 -2
  15. package/dist/core/execution/index.mjs +13 -1
  16. package/dist/core/help/ansi.d.mts +11 -5
  17. package/dist/core/help/ansi.mjs +14 -16
  18. package/dist/core/help/index.d.mts +22 -0
  19. package/dist/core/help/index.mjs +75 -25
  20. package/dist/core/json-schema/index.d.mts +20 -8
  21. package/dist/core/json-schema/index.mjs +285 -87
  22. package/dist/core/json-schema/meta-descriptions.generated.d.mts +40 -40
  23. package/dist/core/output/contracts.d.mts +5 -5
  24. package/dist/core/output/contracts.mjs +1 -1
  25. package/dist/core/output/index.d.mts +38 -1
  26. package/dist/core/output/index.mjs +37 -2
  27. package/dist/core/parse/index.mjs +9 -6
  28. package/dist/core/resolve/contracts.d.mts +7 -2
  29. package/dist/core/resolve/flags.d.mts +3 -1
  30. package/dist/core/resolve/flags.mjs +29 -12
  31. package/dist/core/resolve/index.mjs +6 -1
  32. package/dist/core/resolve/property.d.mts +1 -1
  33. package/dist/core/resolve/standard.d.mts +24 -0
  34. package/dist/core/resolve/standard.mjs +114 -0
  35. package/dist/core/schema/arg.d.mts +37 -2
  36. package/dist/core/schema/arg.mjs +5 -2
  37. package/dist/core/schema/command.d.mts +49 -7
  38. package/dist/core/schema/command.mjs +15 -5
  39. package/dist/core/schema/flag.d.mts +124 -19
  40. package/dist/core/schema/flag.mjs +7 -3
  41. package/dist/core/schema/index.d.mts +3 -2
  42. package/dist/core/schema/prompt.d.mts +1 -1
  43. package/dist/core/schema/run.d.mts +7 -0
  44. package/dist/core/schema/standard.d.mts +100 -0
  45. package/dist/core/schema/standard.mjs +15 -0
  46. package/dist/core/testkit/index.d.mts +7 -5
  47. package/dist/core/testkit/index.mjs +12 -7
  48. package/dist/index.d.mts +6 -5
  49. package/dist/index.mjs +5 -5
  50. package/dist/runtime/adapter.d.mts +33 -0
  51. package/dist/runtime/adapter.mjs +6 -1
  52. package/dist/runtime/deno.d.mts +4 -0
  53. package/dist/runtime/deno.mjs +4 -1
  54. package/dist/runtime/node.mjs +9 -1
  55. package/dist/version.mjs +2 -2
  56. package/dreamcli.schema.json +83 -1
  57. package/examples/basic.ts +2 -2
  58. package/examples/flag-types.ts +79 -0
  59. package/examples/gh/node_modules/typescript/LICENSE +55 -0
  60. package/examples/gh/node_modules/typescript/NOTICE.txt +436 -0
  61. package/examples/gh/node_modules/typescript/README.md +49 -0
  62. package/examples/gh/node_modules/typescript/bin/tsc +2 -0
  63. package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts +529 -0
  64. package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts.map +1 -0
  65. package/examples/gh/node_modules/typescript/dist/api/async/api.js +1657 -0
  66. package/examples/gh/node_modules/typescript/dist/api/async/api.js.map +1 -0
  67. package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts +39 -0
  68. package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts.map +1 -0
  69. package/examples/gh/node_modules/typescript/dist/api/async/client.js +211 -0
  70. package/examples/gh/node_modules/typescript/dist/api/async/client.js.map +1 -0
  71. package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts +310 -0
  72. package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts.map +1 -0
  73. package/examples/gh/node_modules/typescript/dist/api/async/types.js +2 -0
  74. package/examples/gh/node_modules/typescript/dist/api/async/types.js.map +1 -0
  75. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts +109 -0
  76. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts.map +1 -0
  77. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js +2 -0
  78. package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js.map +1 -0
  79. package/examples/gh/node_modules/typescript/dist/api/fs.d.ts +23 -0
  80. package/examples/gh/node_modules/typescript/dist/api/fs.d.ts.map +1 -0
  81. package/examples/gh/node_modules/typescript/dist/api/fs.js +109 -0
  82. package/examples/gh/node_modules/typescript/dist/api/fs.js.map +1 -0
  83. package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts +15 -0
  84. package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts.map +1 -0
  85. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts +5 -0
  86. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts.map +1 -0
  87. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js +74 -0
  88. package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js.map +1 -0
  89. package/examples/gh/node_modules/typescript/dist/api/node/encoder.js +287 -0
  90. package/examples/gh/node_modules/typescript/dist/api/node/encoder.js.map +1 -0
  91. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts +32 -0
  92. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts.map +1 -0
  93. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js +213 -0
  94. package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js.map +1 -0
  95. package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts +76 -0
  96. package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts.map +1 -0
  97. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts +182 -0
  98. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts.map +1 -0
  99. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js +835 -0
  100. package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js.map +1 -0
  101. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts +62 -0
  102. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts.map +1 -0
  103. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js +122 -0
  104. package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js.map +1 -0
  105. package/examples/gh/node_modules/typescript/dist/api/node/node.js +298 -0
  106. package/examples/gh/node_modules/typescript/dist/api/node/node.js.map +1 -0
  107. package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts +29 -0
  108. package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts.map +1 -0
  109. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts +4 -0
  110. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts.map +1 -0
  111. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js +241 -0
  112. package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js.map +1 -0
  113. package/examples/gh/node_modules/typescript/dist/api/node/protocol.js +30 -0
  114. package/examples/gh/node_modules/typescript/dist/api/node/protocol.js.map +1 -0
  115. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts +6 -0
  116. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts.map +1 -0
  117. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js +61 -0
  118. package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js.map +1 -0
  119. package/examples/gh/node_modules/typescript/dist/api/options.d.ts +32 -0
  120. package/examples/gh/node_modules/typescript/dist/api/options.d.ts.map +1 -0
  121. package/examples/gh/node_modules/typescript/dist/api/options.js +11 -0
  122. package/examples/gh/node_modules/typescript/dist/api/options.js.map +1 -0
  123. package/examples/gh/node_modules/typescript/dist/api/path.d.ts +110 -0
  124. package/examples/gh/node_modules/typescript/dist/api/path.d.ts.map +1 -0
  125. package/examples/gh/node_modules/typescript/dist/api/path.js +508 -0
  126. package/examples/gh/node_modules/typescript/dist/api/path.js.map +1 -0
  127. package/examples/gh/node_modules/typescript/dist/api/proto.d.ts +239 -0
  128. package/examples/gh/node_modules/typescript/dist/api/proto.d.ts.map +1 -0
  129. package/examples/gh/node_modules/typescript/dist/api/proto.js +37 -0
  130. package/examples/gh/node_modules/typescript/dist/api/proto.js.map +1 -0
  131. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts +79 -0
  132. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts.map +1 -0
  133. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js +169 -0
  134. package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js.map +1 -0
  135. package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts +529 -0
  136. package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts.map +1 -0
  137. package/examples/gh/node_modules/typescript/dist/api/sync/api.js +1665 -0
  138. package/examples/gh/node_modules/typescript/dist/api/sync/api.js.map +1 -0
  139. package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts +30 -0
  140. package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts.map +1 -0
  141. package/examples/gh/node_modules/typescript/dist/api/sync/client.js +124 -0
  142. package/examples/gh/node_modules/typescript/dist/api/sync/client.js.map +1 -0
  143. package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts +310 -0
  144. package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts.map +1 -0
  145. package/examples/gh/node_modules/typescript/dist/api/sync/types.js +2 -0
  146. package/examples/gh/node_modules/typescript/dist/api/sync/types.js.map +1 -0
  147. package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts +114 -0
  148. package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts.map +1 -0
  149. package/examples/gh/node_modules/typescript/dist/api/syncChannel.js +508 -0
  150. package/examples/gh/node_modules/typescript/dist/api/syncChannel.js.map +1 -0
  151. package/examples/gh/node_modules/typescript/dist/api/timing.d.ts +175 -0
  152. package/examples/gh/node_modules/typescript/dist/api/timing.d.ts.map +1 -0
  153. package/examples/gh/node_modules/typescript/dist/api/timing.js +149 -0
  154. package/examples/gh/node_modules/typescript/dist/api/timing.js.map +1 -0
  155. package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts +100 -0
  156. package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts.map +1 -0
  157. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts +1161 -0
  158. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts.map +1 -0
  159. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js +4 -0
  160. package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js.map +1 -0
  161. package/examples/gh/node_modules/typescript/dist/ast/ast.js +7 -0
  162. package/examples/gh/node_modules/typescript/dist/ast/ast.js.map +1 -0
  163. package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts +19 -0
  164. package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts.map +1 -0
  165. package/examples/gh/node_modules/typescript/dist/ast/astnav.js +596 -0
  166. package/examples/gh/node_modules/typescript/dist/ast/astnav.js.map +1 -0
  167. package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts +16 -0
  168. package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts.map +1 -0
  169. package/examples/gh/node_modules/typescript/dist/ast/clone.js +104 -0
  170. package/examples/gh/node_modules/typescript/dist/ast/clone.js.map +1 -0
  171. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts +520 -0
  172. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts.map +1 -0
  173. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js +3057 -0
  174. package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js.map +1 -0
  175. package/examples/gh/node_modules/typescript/dist/ast/index.d.ts +20 -0
  176. package/examples/gh/node_modules/typescript/dist/ast/index.d.ts.map +1 -0
  177. package/examples/gh/node_modules/typescript/dist/ast/index.js +20 -0
  178. package/examples/gh/node_modules/typescript/dist/ast/index.js.map +1 -0
  179. package/examples/gh/node_modules/typescript/dist/ast/is.d.ts +35 -0
  180. package/examples/gh/node_modules/typescript/dist/ast/is.d.ts.map +1 -0
  181. package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts +329 -0
  182. package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts.map +1 -0
  183. package/examples/gh/node_modules/typescript/dist/ast/is.generated.js +1103 -0
  184. package/examples/gh/node_modules/typescript/dist/ast/is.generated.js.map +1 -0
  185. package/examples/gh/node_modules/typescript/dist/ast/is.js +233 -0
  186. package/examples/gh/node_modules/typescript/dist/ast/is.js.map +1 -0
  187. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts +11 -0
  188. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts.map +1 -0
  189. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js +202 -0
  190. package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js.map +1 -0
  191. package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts +97 -0
  192. package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts.map +1 -0
  193. package/examples/gh/node_modules/typescript/dist/ast/scanner.js +2230 -0
  194. package/examples/gh/node_modules/typescript/dist/ast/scanner.js.map +1 -0
  195. package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts +17 -0
  196. package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts.map +1 -0
  197. package/examples/gh/node_modules/typescript/dist/ast/utils.js +67 -0
  198. package/examples/gh/node_modules/typescript/dist/ast/utils.js.map +1 -0
  199. package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts +14 -0
  200. package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts.map +1 -0
  201. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts +50 -0
  202. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts.map +1 -0
  203. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js +978 -0
  204. package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js.map +1 -0
  205. package/examples/gh/node_modules/typescript/dist/ast/visitor.js +47 -0
  206. package/examples/gh/node_modules/typescript/dist/ast/visitor.js.map +1 -0
  207. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts +2 -0
  208. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts.map +1 -0
  209. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts +129 -0
  210. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts.map +1 -0
  211. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js +132 -0
  212. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js.map +1 -0
  213. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js +130 -0
  214. package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js.map +1 -0
  215. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts +2 -0
  216. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts.map +1 -0
  217. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts +5 -0
  218. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts.map +1 -0
  219. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js +6 -0
  220. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js.map +1 -0
  221. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js +6 -0
  222. package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js.map +1 -0
  223. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts +2 -0
  224. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts.map +1 -0
  225. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts +28 -0
  226. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts.map +1 -0
  227. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js +30 -0
  228. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js.map +1 -0
  229. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js +30 -0
  230. package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js.map +1 -0
  231. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts +2 -0
  232. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts.map +1 -0
  233. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts +7 -0
  234. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts.map +1 -0
  235. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js +9 -0
  236. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js.map +1 -0
  237. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js +9 -0
  238. package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js.map +1 -0
  239. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts +2 -0
  240. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts.map +1 -0
  241. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts +12 -0
  242. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts.map +1 -0
  243. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js +14 -0
  244. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js.map +1 -0
  245. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js +14 -0
  246. package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js.map +1 -0
  247. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts +2 -0
  248. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts.map +1 -0
  249. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts +23 -0
  250. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts.map +1 -0
  251. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js +25 -0
  252. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js.map +1 -0
  253. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js +25 -0
  254. package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js.map +1 -0
  255. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts +2 -0
  256. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts.map +1 -0
  257. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts +9 -0
  258. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts.map +1 -0
  259. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js +11 -0
  260. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js.map +1 -0
  261. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js +11 -0
  262. package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js.map +1 -0
  263. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts +2 -0
  264. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts.map +1 -0
  265. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts +5 -0
  266. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts.map +1 -0
  267. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js +6 -0
  268. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js.map +1 -0
  269. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js +6 -0
  270. package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js.map +1 -0
  271. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts +2 -0
  272. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts.map +1 -0
  273. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts +42 -0
  274. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts.map +1 -0
  275. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js +44 -0
  276. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js.map +1 -0
  277. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js +44 -0
  278. package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js.map +1 -0
  279. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts +2 -0
  280. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts.map +1 -0
  281. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts +7 -0
  282. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts.map +1 -0
  283. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js +9 -0
  284. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js.map +1 -0
  285. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js +9 -0
  286. package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js.map +1 -0
  287. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts +2 -0
  288. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts.map +1 -0
  289. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts +17 -0
  290. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts.map +1 -0
  291. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js +19 -0
  292. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js.map +1 -0
  293. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js +19 -0
  294. package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js.map +1 -0
  295. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts +2 -0
  296. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts.map +1 -0
  297. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts +9 -0
  298. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts.map +1 -0
  299. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js +11 -0
  300. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js.map +1 -0
  301. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js +11 -0
  302. package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js.map +1 -0
  303. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts +2 -0
  304. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts.map +1 -0
  305. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts +6 -0
  306. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts.map +1 -0
  307. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js +8 -0
  308. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js.map +1 -0
  309. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js +8 -0
  310. package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js.map +1 -0
  311. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts +2 -0
  312. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts.map +1 -0
  313. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts +36 -0
  314. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts.map +1 -0
  315. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js +38 -0
  316. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js.map +1 -0
  317. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js +38 -0
  318. package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js.map +1 -0
  319. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts +2 -0
  320. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts.map +1 -0
  321. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts +44 -0
  322. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts.map +1 -0
  323. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js +46 -0
  324. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js.map +1 -0
  325. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js +46 -0
  326. package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js.map +1 -0
  327. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts +2 -0
  328. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts.map +1 -0
  329. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts +50 -0
  330. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts.map +1 -0
  331. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js +52 -0
  332. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js.map +1 -0
  333. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js +52 -0
  334. package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js.map +1 -0
  335. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts +2 -0
  336. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts.map +1 -0
  337. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts +16 -0
  338. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -0
  339. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js +18 -0
  340. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js.map +1 -0
  341. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js +18 -0
  342. package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js.map +1 -0
  343. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts +2 -0
  344. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts.map +1 -0
  345. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts +13 -0
  346. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts.map +1 -0
  347. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js +14 -0
  348. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js.map +1 -0
  349. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js +14 -0
  350. package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js.map +1 -0
  351. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts +2 -0
  352. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts.map +1 -0
  353. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts +11 -0
  354. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts.map +1 -0
  355. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js +12 -0
  356. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js.map +1 -0
  357. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js +12 -0
  358. package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js.map +1 -0
  359. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts +2 -0
  360. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts.map +1 -0
  361. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts +17 -0
  362. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts.map +1 -0
  363. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js +18 -0
  364. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js.map +1 -0
  365. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js +18 -0
  366. package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js.map +1 -0
  367. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts +2 -0
  368. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts.map +1 -0
  369. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts +15 -0
  370. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts.map +1 -0
  371. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js +17 -0
  372. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js.map +1 -0
  373. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js +17 -0
  374. package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js.map +1 -0
  375. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts +2 -0
  376. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts.map +1 -0
  377. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts +5 -0
  378. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts.map +1 -0
  379. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js +7 -0
  380. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js.map +1 -0
  381. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js +7 -0
  382. package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js.map +1 -0
  383. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts +2 -0
  384. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts.map +1 -0
  385. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts +71 -0
  386. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts.map +1 -0
  387. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js +73 -0
  388. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js.map +1 -0
  389. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js +73 -0
  390. package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js.map +1 -0
  391. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts +2 -0
  392. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts.map +1 -0
  393. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts +389 -0
  394. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts.map +1 -0
  395. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js +391 -0
  396. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js.map +1 -0
  397. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js +391 -0
  398. package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js.map +1 -0
  399. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts +2 -0
  400. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts.map +1 -0
  401. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts +30 -0
  402. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts.map +1 -0
  403. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js +32 -0
  404. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js.map +1 -0
  405. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js +32 -0
  406. package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js.map +1 -0
  407. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts +2 -0
  408. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts.map +1 -0
  409. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts +76 -0
  410. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts.map +1 -0
  411. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js +78 -0
  412. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js.map +1 -0
  413. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js +78 -0
  414. package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js.map +1 -0
  415. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts +2 -0
  416. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts.map +1 -0
  417. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts +7 -0
  418. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts.map +1 -0
  419. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js +9 -0
  420. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js.map +1 -0
  421. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js +9 -0
  422. package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js.map +1 -0
  423. package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts +23 -0
  424. package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts.map +1 -0
  425. package/examples/gh/node_modules/typescript/dist/internal/utils.js +25 -0
  426. package/examples/gh/node_modules/typescript/dist/internal/utils.js.map +1 -0
  427. package/examples/gh/node_modules/typescript/lib/getExePath.d.ts +2 -0
  428. package/examples/gh/node_modules/typescript/lib/getExePath.js +70 -0
  429. package/examples/gh/node_modules/typescript/lib/tsc.js +28 -0
  430. package/examples/gh/node_modules/typescript/lib/version.cjs +3 -0
  431. package/examples/gh/node_modules/typescript/lib/version.d.cts +2 -0
  432. package/examples/gh/node_modules/typescript/package.json +87 -0
  433. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/License.txt +11 -0
  434. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/README.md +54 -0
  435. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.d.ts +17 -0
  436. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.js +83 -0
  437. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +22 -0
  438. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.js +210 -0
  439. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.d.ts +14 -0
  440. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.js +87 -0
  441. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +32 -0
  442. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.js +132 -0
  443. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.d.ts +367 -0
  444. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.js +1271 -0
  445. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +9 -0
  446. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.js +16 -0
  447. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +52 -0
  448. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.js +70 -0
  449. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.d.ts +39 -0
  450. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.js +135 -0
  451. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.d.ts +7 -0
  452. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.js +34 -0
  453. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +55 -0
  454. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.js +412 -0
  455. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +18 -0
  456. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +155 -0
  457. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +77 -0
  458. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.js +246 -0
  459. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +60 -0
  460. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.js +157 -0
  461. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.d.ts +369 -0
  462. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.js +436 -0
  463. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.d.ts +74 -0
  464. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.js +23 -0
  465. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +10 -0
  466. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.js +74 -0
  467. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +15 -0
  468. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +77 -0
  469. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.d.ts +58 -0
  470. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.js +289 -0
  471. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.d.ts +12 -0
  472. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.js +163 -0
  473. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/package.json +54 -0
  474. package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/typings/thenable.d.ts +5 -0
  475. package/examples/gh/package.json +11 -5
  476. package/examples/gh/src/main.ts +10 -4
  477. package/examples/help-config.ts +43 -0
  478. package/examples/json-mode.ts +8 -4
  479. package/examples/middleware.ts +1 -1
  480. package/examples/output-extras.ts +46 -0
  481. package/examples/parser-control.ts +40 -0
  482. package/examples/pwsh-demo/package.json +1 -1
  483. package/examples/pwsh-demo/src/main.ts +1 -1
  484. package/examples/standard-schema.ts +45 -0
  485. package/examples/transport-launcher.ts +10 -10
  486. package/package.json +25 -31
  487. package/dist/core/schema-dsl/runtime.d.mts +0 -144
  488. package/dist/core/schema-dsl/runtime.mjs +0 -271
  489. package/dist/core/schema-dsl/to-json-schema.d.mts +0 -29
  490. package/dist/core/schema-dsl/to-json-schema.mjs +0 -74
@@ -5,7 +5,8 @@ import { command } from "../schema/command.mjs";
5
5
  import { includesBeforeSeparator } from "../parse/index.mjs";
6
6
  import { SHELLS, detectShell, generateCompletion, normalizeShell } from "../completion/index.mjs";
7
7
  import { formatHelp } from "../help/index.mjs";
8
- import { clearRequestedExitCode, createCaptureOutput, createOutput } from "../output/index.mjs";
8
+ import { generateCommandSchema, generateSchema } from "../json-schema/index.mjs";
9
+ import { clearRequestedExitCode, createCaptureOutput, createOutput, resolveHyperlinkOverride } from "../output/index.mjs";
9
10
  import { buildRunResult, executeCommand } from "../execution/index.mjs";
10
11
  import { runCommand } from "../testkit/index.mjs";
11
12
  import { stripTrailing } from "../../strings.mjs";
@@ -99,6 +100,55 @@ function eraseCommand(cmd) {
99
100
  };
100
101
  }
101
102
  /**
103
+ * Resolve the render context for content built before `.run()`.
104
+ *
105
+ * Content styled ahead of execution — hand-rendered banners, custom help, or
106
+ * anything else emitted outside an action handler — has no `out` to consult,
107
+ * which pushes consumers into re-deriving the framework's decisions from raw
108
+ * argv (`argv.includes('--json')` misreads a post-`--` literal). This probe
109
+ * runs the same composition `.execute()`/`.run()` feed into the output
110
+ * channel — `--`-aware `--json` detection, the color gate, and the hyperlink
111
+ * override — so pre-run styling matches the channel that will render.
112
+ *
113
+ * @param argv - Raw argv tokens (NOT including the binary/script path,
114
+ * i.e. equivalent to `process.argv.slice(2)`).
115
+ * @param options - Host facts and overrides.
116
+ * @returns The resolved output decisions.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const ctx = resolveRenderContext(process.argv.slice(2), {
121
+ * isTTY: process.stdout.isTTY === true,
122
+ * env: process.env,
123
+ * });
124
+ * const banner = ctx.color.bold('mycli');
125
+ * ```
126
+ */
127
+ function resolveRenderContext(argv, options) {
128
+ const out = createOutput({
129
+ jsonMode: includesBeforeSeparator(argv, "--json") || options?.jsonMode === true,
130
+ isTTY: options?.isTTY ?? false,
131
+ ...options?.color !== void 0 ? { color: options.color } : {},
132
+ ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
133
+ });
134
+ return {
135
+ jsonMode: out.jsonMode,
136
+ isTTY: out.isTTY,
137
+ color: out.color,
138
+ isHyperlinkSupported: out.isHyperlinkSupported
139
+ };
140
+ }
141
+ /**
142
+ * Conditional-spread wrapper for the output channel's `hyperlinks` option:
143
+ * omit the key entirely when there is no override so `exactOptionalPropertyTypes`
144
+ * stays happy and the channel falls back to `isTTY`.
145
+ *
146
+ * @internal
147
+ */
148
+ function hyperlinksOption(override) {
149
+ return override !== void 0 ? { hyperlinks: override } : {};
150
+ }
151
+ /**
102
152
  * Build {@linkcode RunOptions} from {@linkcode CLIRunOptions}, conditionally spreading each
103
153
  * field to satisfy `exactOptionalPropertyTypes`.
104
154
  *
@@ -120,6 +170,7 @@ function buildCommandRunOptions(options, helpOptions, meta) {
120
170
  ...options?.prompter !== void 0 ? { prompter: options.prompter } : {},
121
171
  ...options?.answers !== void 0 ? { answers: options.answers } : {},
122
172
  ...options?.stat !== void 0 ? { stat: options.stat } : {},
173
+ ...options?.mkdir !== void 0 ? { mkdir: options.mkdir } : {},
123
174
  ...options?.verbosity !== void 0 ? { verbosity: options.verbosity } : {},
124
175
  ...options?.jsonMode !== void 0 ? { jsonMode: options.jsonMode } : {},
125
176
  ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {},
@@ -263,12 +314,16 @@ var CLIBuilder = class CLIBuilder {
263
314
  /**
264
315
  * Enable automatic config file discovery.
265
316
  *
266
- * When enabled, `.run()` probes standard paths before dispatching:
267
- * 1. `$CWD/.{appName}.json`
268
- * 2. `$CWD/{appName}.config.json`
269
- * 3. `$CONFIG_DIR/{appName}/config.json`
270
- * (`$XDG_CONFIG_HOME` / `~/.config` on Unix,
317
+ * When enabled, `.run()` probes standard paths before dispatching,
318
+ * first match wins, no merging:
319
+ * 1. Project scope — for `$CWD` and each ancestor directory up to the
320
+ * filesystem root, nearest first:
321
+ * `.{appName}.json`, `{appName}.config.json`, `.config/{appName}.json`
322
+ * 2. User scope — `{dir}/{appName}/config.json` for each user config
323
+ * root (`$XDG_CONFIG_HOME` / `~/.config` on Unix, plus
324
+ * `~/Library/Application Support` on macOS,
271
325
  * `%APPDATA%` / `%USERPROFILE%\\AppData\\Roaming` on Windows)
326
+ * 3. System scope — `/etc/{appName}/config.json` on Linux and macOS
272
327
  *
273
328
  * The user can override the path via `--config <path>` or `--config=<path>`.
274
329
  *
@@ -534,10 +589,12 @@ var CLIBuilder = class CLIBuilder {
534
589
  */
535
590
  async execute(argv, options) {
536
591
  const jsonMode = includesBeforeSeparator(argv, "--json") || options?.jsonMode === true;
592
+ const verbosity = includesBeforeSeparator(argv, "--quiet") || includesBeforeSeparator(argv, "-q") ? "quiet" : options?.verbosity;
537
593
  const captureOptions = {
538
- ...options?.verbosity !== void 0 ? { verbosity: options.verbosity } : {},
594
+ ...verbosity !== void 0 ? { verbosity } : {},
539
595
  ...jsonMode ? { jsonMode } : {},
540
- ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {}
596
+ ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {},
597
+ ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
541
598
  };
542
599
  let out;
543
600
  let captured;
@@ -550,24 +607,27 @@ var CLIBuilder = class CLIBuilder {
550
607
  };
551
608
  } else [out, captured] = createCaptureOutput(Object.keys(captureOptions).length > 0 ? captureOptions : void 0);
552
609
  clearRequestedExitCode(out);
610
+ const resolvedVersion = options?.help?.version ?? this.schema.version;
553
611
  const helpOptions = {
554
612
  ...this.schema.helpConfig,
555
613
  ...options?.help,
556
614
  binName: options?.help?.binName ?? this.schema.name,
557
- hyperlinks: options?.help?.hyperlinks ?? this.schema.helpConfig?.hyperlinks ?? out.isTTY,
558
- colors: options?.help?.colors ?? out.color
615
+ hyperlinks: options?.help?.hyperlinks ?? this.schema.helpConfig?.hyperlinks ?? out.isHyperlinkSupported,
616
+ colors: options?.help?.colors ?? out.color,
617
+ ...resolvedVersion !== void 0 ? { version: resolvedVersion } : {}
559
618
  };
560
619
  const flagSettings = options?.flags ?? this.schema.flagSettings;
561
620
  const effectiveOptions = {
562
621
  ...options,
563
622
  plugins: this.schema.plugins,
564
623
  ...jsonMode ? { jsonMode } : {},
624
+ ...verbosity !== void 0 ? { verbosity } : {},
565
625
  ...flagSettings !== void 0 ? { flags: flagSettings } : {}
566
626
  };
567
627
  const output = {
568
628
  jsonMode,
569
629
  isTTY: out.isTTY,
570
- verbosity: options?.verbosity ?? "normal"
630
+ verbosity: verbosity ?? "normal"
571
631
  };
572
632
  const planned = planInvocation({
573
633
  schema: options?.flags !== void 0 ? {
@@ -616,14 +676,19 @@ var CLIBuilder = class CLIBuilder {
616
676
  error: void 0
617
677
  }, captured);
618
678
  }
619
- case "root-help": {
620
- const helpText = formatRootHelp(resolveHelpLinksSchema(this.schema), planned.help);
621
- out.log(helpText);
679
+ case "root-help":
680
+ if (jsonMode) out.json(generateSchema(this.schema, void 0, {
681
+ name: planned.help.binName ?? this.schema.name,
682
+ version: planned.help.version ?? this.schema.version
683
+ }));
684
+ else {
685
+ const helpText = formatRootHelp(resolveHelpLinksSchema(this.schema), planned.help);
686
+ out.log(helpText);
687
+ }
622
688
  return buildRunResult({
623
689
  exitCode: 0,
624
690
  error: void 0
625
691
  }, captured);
626
- }
627
692
  case "dispatch-error":
628
693
  if (jsonMode) out.json({ error: planned.error.toJSON() });
629
694
  else {
@@ -634,14 +699,19 @@ var CLIBuilder = class CLIBuilder {
634
699
  exitCode: planned.error.exitCode,
635
700
  error: planned.error
636
701
  }, captured);
637
- case "needs-subcommand": {
638
- const helpText = formatHelp(planned.command.schema, planned.help);
639
- out.log(helpText);
702
+ case "needs-subcommand":
703
+ if (jsonMode) out.json(generateCommandSchema(planned.command.schema, void 0, {
704
+ name: planned.help.binName ?? planned.command.schema.name,
705
+ version: planned.help.version
706
+ }));
707
+ else {
708
+ const helpText = formatHelp(planned.command.schema, planned.help);
709
+ out.log(helpText);
710
+ }
640
711
  return buildRunResult({
641
712
  exitCode: 0,
642
713
  error: void 0
643
714
  }, captured);
644
- }
645
715
  case "match": {
646
716
  const commandRunOptions = buildCommandRunOptions(effectiveOptions, planned.plan.help ?? helpOptions, planned.plan.meta);
647
717
  if (planned.plan.command._command === void 0) return planned.plan.command._execute(planned.plan.argv, {
@@ -708,7 +778,8 @@ var CLIBuilder = class CLIBuilder {
708
778
  stderr: adapter.stderr,
709
779
  jsonMode: preflight.inputs.jsonMode,
710
780
  isTTY: preflight.inputs.isTTY,
711
- ...preflight.inputs.verbosity !== "normal" ? { verbosity: preflight.inputs.verbosity } : {}
781
+ ...preflight.inputs.verbosity !== "normal" ? { verbosity: preflight.inputs.verbosity } : {},
782
+ ...hyperlinksOption(resolveHyperlinkOverride(adapter.env, adapter.argv))
712
783
  })
713
784
  };
714
785
  const result = await effectiveBuilder.execute(preflight.filteredArgv, executeOptions);
@@ -867,8 +938,8 @@ function buildManifestSchema(schema, input, defaultFiles, pinFiles) {
867
938
  }
868
939
  /**
869
940
  * Coerce a {@link ResolvedManifestSettings.from | `manifest.from`} input
870
- * (string path, `file:` URL string, or {@link URL} instance) to a plain
871
- * filesystem path string. `undefined` passes through unchanged.
941
+ * (string path, `file:` URL string, {@link URL} instance, or `import.meta`) to
942
+ * a plain filesystem path string. `undefined` passes through unchanged.
872
943
  *
873
944
  * Runtime-agnostic by design — relies only on the `URL` global (available in
874
945
  * every JS runtime) rather than `node:url`, keeping core free of Node
@@ -878,10 +949,11 @@ function buildManifestSchema(schema, input, defaultFiles, pinFiles) {
878
949
  */
879
950
  function normalizeFromSetting(from) {
880
951
  if (from === void 0) return void 0;
881
- if (from instanceof URL) {
882
- if (from.protocol !== "file:") return from.href;
883
- } else if (!from.startsWith("file:")) return from;
884
- const decoded = decodeURIComponent(new URL(from).pathname);
952
+ const source = typeof from === "object" && !(from instanceof URL) ? from.url : from;
953
+ if (source instanceof URL) {
954
+ if (source.protocol !== "file:") return source.href;
955
+ } else if (!source.startsWith("file:")) return source;
956
+ const decoded = decodeURIComponent(new URL(source).pathname);
885
957
  if (/^\/[A-Za-z]:/.test(decoded)) return decoded.slice(1).replace(/\//g, "\\");
886
958
  return decoded;
887
959
  }
@@ -936,5 +1008,25 @@ function cli(nameOrOptions, extraOptions) {
936
1008
  plugins: []
937
1009
  });
938
1010
  }
1011
+ /**
1012
+ * Report whether the calling module is the process entrypoint, cross-runtime.
1013
+ *
1014
+ * Node, Bun, and Deno set `import.meta.main` on the module invoked directly;
1015
+ * projects with the runtime's ambient types can read that property directly.
1016
+ * This helper is a compatibility form for projects whose `tsconfig.json` `lib`
1017
+ * override drops those `ImportMeta` extras: passing `import.meta` whole avoids
1018
+ * a direct `.main` access without requiring global augmentation.
1019
+ *
1020
+ * @param meta - The calling module's `import.meta`.
1021
+ * @returns `true` when the module was run as the entrypoint.
1022
+ *
1023
+ * @example
1024
+ * ```ts
1025
+ * if (isMainModule(import.meta)) cli('mycli').command(deploy).run();
1026
+ * ```
1027
+ */
1028
+ function isMainModule(meta) {
1029
+ return meta.main === true;
1030
+ }
939
1031
  //#endregion
940
- export { CLIBuilder, cli, formatRootHelp, plugin };
1032
+ export { CLIBuilder, cli, formatRootHelp, isMainModule, plugin, resolveRenderContext };
@@ -190,6 +190,12 @@ function planCompletionsFlag(argv, config) {
190
190
  };
191
191
  }
192
192
  }
193
+ /** Root-level output flags stripped before dispatch (never part of a command schema). */
194
+ const ROOT_OUTPUT_FLAGS = /* @__PURE__ */ new Set([
195
+ "--json",
196
+ "--quiet",
197
+ "-q"
198
+ ]);
193
199
  /**
194
200
  * Decide what to do with an argv invocation before any command executes.
195
201
  *
@@ -202,7 +208,7 @@ function planInvocation(options) {
202
208
  const separatorIndex = options.argv.indexOf("--");
203
209
  const head = separatorIndex === -1 ? options.argv : options.argv.slice(0, separatorIndex);
204
210
  const tail = separatorIndex === -1 ? [] : options.argv.slice(separatorIndex);
205
- const filteredHead = head.includes("--json") ? head.filter((arg) => arg !== "--json") : head;
211
+ const filteredHead = head.some((arg) => ROOT_OUTPUT_FLAGS.has(arg)) ? head.filter((arg) => !ROOT_OUTPUT_FLAGS.has(arg)) : head;
206
212
  const filteredArgv = separatorIndex === -1 ? filteredHead : [...filteredHead, ...tail];
207
213
  const defaultCommand = options.schema.defaultCommand;
208
214
  const rootValueFlags = defaultCommand !== void 0 ? buildFlagLookup(defaultCommand.schema.flags, options.schema.flagSettings) : void 0;
@@ -116,6 +116,7 @@ function completionsFlagSchema(shells) {
116
116
  valueHint: void 0,
117
117
  prompt: void 0,
118
118
  parseFn: void 0,
119
+ standard: void 0,
119
120
  deprecated: void 0,
120
121
  propagate: false,
121
122
  negation: void 0,
@@ -201,6 +202,10 @@ function formatGlobalOptionsSection(schema, width, theme) {
201
202
  left: theme.flag("--json"),
202
203
  description: "Emit machine-readable JSON output"
203
204
  });
205
+ entries.push({
206
+ left: theme.flag("-q, --quiet"),
207
+ description: "Suppress informational output"
208
+ });
204
209
  if (schema.configSettings !== void 0) entries.push({
205
210
  left: `${theme.flag("--config")} ${theme.placeholder("<path>")}`,
206
211
  description: "Load configuration from the given file"
@@ -114,6 +114,8 @@ interface RuntimePreflightOptions {
114
114
  readonly isTTY?: boolean;
115
115
  /** Filesystem probe override for `flag.path()` checks; bypasses the adapter probe. */
116
116
  readonly stat?: (path: string) => Promise<'file' | 'directory' | null>;
117
+ /** Directory creation override for `flag.path()` `create` checks; bypasses the adapter. */
118
+ readonly mkdir?: (path: string) => Promise<void>;
117
119
  }
118
120
  /**
119
121
  * Fully resolved runtime inputs ready for the execution pipeline.
@@ -139,6 +141,8 @@ interface RuntimeExecutionInputs {
139
141
  readonly config?: Readonly<Record<string, unknown>>;
140
142
  /** Filesystem probe (from the adapter) for `flag.path()` checks. */
141
143
  readonly stat?: (path: string) => Promise<'file' | 'directory' | null>;
144
+ /** Directory creation (from the adapter) for `flag.path()` `create` checks. */
145
+ readonly mkdir?: (path: string) => Promise<void>;
142
146
  }
143
147
  /** Preflight succeeded — all runtime inputs are resolved and ready for execution. @internal */
144
148
  interface ReadyRuntimePreflight {
@@ -1,5 +1,5 @@
1
1
  import { CLIError, ParseError } from "../errors/index.mjs";
2
- import { parse } from "../parse/index.mjs";
2
+ import { includesBeforeSeparator, parse } from "../parse/index.mjs";
3
3
  import { createTerminalPrompter } from "../prompt/index.mjs";
4
4
  import { discoverManifest, inferCliName } from "../config/package-json.mjs";
5
5
  import { deriveHelpLinks } from "./help-links.mjs";
@@ -138,7 +138,8 @@ async function prepareRuntimePreflight(options) {
138
138
  configPath: void 0,
139
139
  filteredArgv: rawArgv
140
140
  };
141
- const jsonMode = filteredArgv.includes("--json") || options.options?.jsonMode === true;
141
+ const jsonMode = includesBeforeSeparator(filteredArgv, "--json") || options.options?.jsonMode === true;
142
+ const hasQuietFlag = includesBeforeSeparator(filteredArgv, "--quiet") || includesBeforeSeparator(filteredArgv, "-q");
142
143
  const isCompletions = isCompletionsInvocation(options.schema, filteredArgv);
143
144
  const schema = await applyPackageJsonDiscovery(options.schema, options.adapter, options.inheritedName, isCompletions);
144
145
  const loadedConfig = await loadRuntimeConfig(schema, options.adapter, configPath, isCompletions, options.options?.config);
@@ -157,8 +158,9 @@ async function prepareRuntimePreflight(options) {
157
158
  env: options.options?.env ?? options.adapter.env,
158
159
  isTTY: options.options?.isTTY ?? options.adapter.isTTY,
159
160
  jsonMode,
160
- verbosity: options.options?.verbosity ?? "normal",
161
+ verbosity: hasQuietFlag ? "quiet" : options.options?.verbosity ?? "normal",
161
162
  stat: options.options?.stat ?? options.adapter.stat,
163
+ mkdir: options.options?.mkdir ?? options.adapter.mkdir,
162
164
  ...stdinData !== void 0 ? { stdinData } : {},
163
165
  ...options.options?.prompter !== void 0 ? { prompter: options.options.prompter } : autoPrompter !== void 0 ? { prompter: autoPrompter } : {},
164
166
  ...loadedConfig !== void 0 ? { config: loadedConfig } : {}
@@ -83,6 +83,7 @@ function createSyntheticRootFlag(description) {
83
83
  valueHint: void 0,
84
84
  prompt: void 0,
85
85
  parseFn: void 0,
86
+ standard: void 0,
86
87
  deprecated: void 0,
87
88
  propagate: false,
88
89
  negation: void 0,
@@ -41,6 +41,14 @@ interface ConfigDiscoveryOptions {
41
41
  * Probed in order; first found wins.
42
42
  */
43
43
  readonly searchPaths?: readonly string[];
44
+ /**
45
+ * Directory the project-scope ancestor walk starts from.
46
+ * Anchors discovery to a location other than the process working
47
+ * directory (e.g. the directory of a file an editor integration is
48
+ * operating on).
49
+ * @defaultValue `adapter.cwd`
50
+ */
51
+ readonly baseDir?: string;
44
52
  }
45
53
  /** Successful config discovery — file found and parsed. */
46
54
  interface ConfigFound {
@@ -60,6 +68,23 @@ interface ConfigNotFound {
60
68
  }
61
69
  /** Discriminated result of config discovery. */
62
70
  type ConfigDiscoveryResult = ConfigFound | ConfigNotFound;
71
+ /** Directory scopes feeding {@link buildConfigSearchPaths}. */
72
+ interface ConfigSearchPathOptions {
73
+ /** Directory the project-scope ancestor walk starts from. */
74
+ readonly baseDir: string;
75
+ /**
76
+ * User-scope config roots, highest priority first
77
+ * (XDG / AppData, plus `~/Library/Application Support` on macOS).
78
+ */
79
+ readonly userConfigDirs: readonly string[];
80
+ /**
81
+ * System-scope config roots (`/etc` on Linux and macOS).
82
+ * @defaultValue `[]`
83
+ */
84
+ readonly systemConfigDirs?: readonly string[];
85
+ /** Custom {@link FormatLoader}s whose extensions expand the search set. */
86
+ readonly loaders?: readonly FormatLoader[];
87
+ }
63
88
  /**
64
89
  * Build the default config search paths for an app.
65
90
  *
@@ -68,34 +93,40 @@ type ConfigDiscoveryResult = ConfigFound | ConfigNotFound;
68
93
  * manually. Exported for debugging, custom discovery flows, and help text.
69
94
  *
70
95
  * Search order (first match wins):
71
- * 1. `$CWD/.{appName}.json` — dotfile in project root
72
- * 2. `$CWD/{appName}.config.json` — explicit config in project root
73
- * 3. `$CONFIG_DIR/{appName}/config.json` — XDG / AppData standard
74
- * (`$XDG_CONFIG_HOME` / `~/.config` on Unix,
75
- * `%APPDATA%` / `%USERPROFILE%\\AppData\\Roaming` on Windows)
96
+ * 1. Project scope — for `baseDir` and each ancestor directory up to the
97
+ * filesystem root, nearest first:
98
+ * 1. `{dir}/.{appName}.json` — dotfile
99
+ * 2. `{dir}/{appName}.config.json` — explicit config
100
+ * 3. `{dir}/.config/{appName}.json` — project `.config/` convention
101
+ * 2. User scope — `{userConfigDir}/{appName}/config.json` for each entry of
102
+ * `userConfigDirs`, in order.
103
+ * 3. System scope — `{systemConfigDir}/{appName}/config.json` for each entry
104
+ * of `systemConfigDirs`, in order.
76
105
  *
77
106
  * When custom {@link ConfigDiscoveryOptions.loaders | loaders} are registered,
78
107
  * each path pattern is repeated per supported extension (JSON always first).
79
108
  *
80
109
  * @param appName - CLI application name used to derive config filenames.
81
- * @param cwd - Current working directory (project-root search location).
82
- * @param configDir - Platform config directory (XDG / AppData).
83
- * @param loaders - Optional custom {@link FormatLoader}s whose extensions expand the search set.
110
+ * @param options - Directory scopes and loaders (see {@link ConfigSearchPathOptions}).
84
111
  * @returns Ordered list of candidate config file paths (first match wins).
85
112
  *
86
113
  * @example
87
114
  * ```ts
88
- * const paths = buildConfigSearchPaths('mycli', '/repo', '/home/me/.config');
115
+ * const paths = buildConfigSearchPaths('mycli', {
116
+ * baseDir: '/repo/packages/app',
117
+ * userConfigDirs: ['/home/me/.config'],
118
+ * systemConfigDirs: ['/etc'],
119
+ * });
89
120
  * ```
90
121
  */
91
- declare function buildConfigSearchPaths(appName: string, cwd: string, configDir: string, loaders?: readonly FormatLoader[]): readonly string[];
122
+ declare function buildConfigSearchPaths(appName: string, options: ConfigSearchPathOptions): readonly string[];
92
123
  /**
93
124
  * The subset of {@link RuntimeAdapter} needed for config discovery.
94
125
  *
95
126
  * Exported so custom hosts and tests can type the minimal adapter required by
96
127
  * {@link discoverConfig} without depending on the full runtime adapter shape.
97
128
  */
98
- type ConfigAdapter = Pick<RuntimeAdapter, 'readFile' | 'cwd' | 'configDir'>;
129
+ type ConfigAdapter = Pick<RuntimeAdapter, 'readFile' | 'cwd' | 'configDir'> & Partial<Pick<RuntimeAdapter, 'userConfigDirs' | 'systemConfigDirs'>>;
99
130
  /**
100
131
  * Discover and load a config file.
101
132
  *
@@ -157,4 +188,4 @@ declare function discoverConfig(appName: string, adapter: ConfigAdapter, options
157
188
  */
158
189
  declare function configFormat(extensions: readonly string[], parse: (content: string) => unknown): FormatLoader;
159
190
  //#endregion
160
- export { type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type FormatLoader, type ManifestDiscoveryOptions, type PackageJsonAdapter, type PackageJsonData, type PackageRepository, type PackageRepositoryUrlOptions, buildConfigSearchPaths, configFormat, discoverConfig, discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl };
191
+ export { type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSearchPathOptions, type FormatLoader, type ManifestDiscoveryOptions, type PackageJsonAdapter, type PackageJsonData, type PackageRepository, type PackageRepositoryUrlOptions, buildConfigSearchPaths, configFormat, discoverConfig, discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl };
@@ -39,7 +39,31 @@ const jsonLoader = {
39
39
  */
40
40
  function joinPath(base, ...segments) {
41
41
  const sep = base.includes("\\") ? "\\" : "/";
42
- return [base, ...segments].join(sep);
42
+ return [base.endsWith(sep) ? base.slice(0, -1) : base, ...segments].join(sep);
43
+ }
44
+ /**
45
+ * List a directory and every ancestor up to the filesystem root,
46
+ * nearest first. Separator is inferred from the input; POSIX (`/`) and
47
+ * Windows drive roots (`C:\`) both terminate the walk.
48
+ *
49
+ * @internal
50
+ */
51
+ function ancestorDirs(base) {
52
+ const sep = base.includes("\\") ? "\\" : "/";
53
+ let current = base;
54
+ while (current.length > 1 && current.endsWith(sep) && !current.endsWith(`:${sep}`)) current = current.slice(0, -1);
55
+ const dirs = [current];
56
+ while (true) {
57
+ const idx = current.lastIndexOf(sep);
58
+ if (idx < 0) break;
59
+ let parent = current.slice(0, idx);
60
+ if (parent === "") parent = sep;
61
+ else if (/^[A-Za-z]:$/.test(parent)) parent = `${parent}${sep}`;
62
+ if (parent === current) break;
63
+ dirs.push(parent);
64
+ current = parent;
65
+ }
66
+ return dirs;
43
67
  }
44
68
  /**
45
69
  * Extract the file extension (without leading dot, lowercased).
@@ -60,32 +84,42 @@ function getExtension(path) {
60
84
  * manually. Exported for debugging, custom discovery flows, and help text.
61
85
  *
62
86
  * Search order (first match wins):
63
- * 1. `$CWD/.{appName}.json` — dotfile in project root
64
- * 2. `$CWD/{appName}.config.json` — explicit config in project root
65
- * 3. `$CONFIG_DIR/{appName}/config.json` — XDG / AppData standard
66
- * (`$XDG_CONFIG_HOME` / `~/.config` on Unix,
67
- * `%APPDATA%` / `%USERPROFILE%\\AppData\\Roaming` on Windows)
87
+ * 1. Project scope — for `baseDir` and each ancestor directory up to the
88
+ * filesystem root, nearest first:
89
+ * 1. `{dir}/.{appName}.json` — dotfile
90
+ * 2. `{dir}/{appName}.config.json` — explicit config
91
+ * 3. `{dir}/.config/{appName}.json` — project `.config/` convention
92
+ * 2. User scope — `{userConfigDir}/{appName}/config.json` for each entry of
93
+ * `userConfigDirs`, in order.
94
+ * 3. System scope — `{systemConfigDir}/{appName}/config.json` for each entry
95
+ * of `systemConfigDirs`, in order.
68
96
  *
69
97
  * When custom {@link ConfigDiscoveryOptions.loaders | loaders} are registered,
70
98
  * each path pattern is repeated per supported extension (JSON always first).
71
99
  *
72
100
  * @param appName - CLI application name used to derive config filenames.
73
- * @param cwd - Current working directory (project-root search location).
74
- * @param configDir - Platform config directory (XDG / AppData).
75
- * @param loaders - Optional custom {@link FormatLoader}s whose extensions expand the search set.
101
+ * @param options - Directory scopes and loaders (see {@link ConfigSearchPathOptions}).
76
102
  * @returns Ordered list of candidate config file paths (first match wins).
77
103
  *
78
104
  * @example
79
105
  * ```ts
80
- * const paths = buildConfigSearchPaths('mycli', '/repo', '/home/me/.config');
106
+ * const paths = buildConfigSearchPaths('mycli', {
107
+ * baseDir: '/repo/packages/app',
108
+ * userConfigDirs: ['/home/me/.config'],
109
+ * systemConfigDirs: ['/etc'],
110
+ * });
81
111
  * ```
82
112
  */
83
- function buildConfigSearchPaths(appName, cwd, configDir, loaders) {
84
- const extensions = buildExtensionList(loaders);
113
+ function buildConfigSearchPaths(appName, options) {
114
+ const extensions = buildExtensionList(options.loaders);
85
115
  const paths = [];
86
- for (const ext of extensions) paths.push(joinPath(cwd, `.${appName}.${ext}`));
87
- for (const ext of extensions) paths.push(joinPath(cwd, `${appName}.config.${ext}`));
88
- for (const ext of extensions) paths.push(joinPath(configDir, appName, `config.${ext}`));
116
+ for (const dir of ancestorDirs(options.baseDir)) {
117
+ for (const ext of extensions) paths.push(joinPath(dir, `.${appName}.${ext}`));
118
+ for (const ext of extensions) paths.push(joinPath(dir, `${appName}.config.${ext}`));
119
+ for (const ext of extensions) paths.push(joinPath(dir, ".config", `${appName}.${ext}`));
120
+ }
121
+ for (const dir of options.userConfigDirs) for (const ext of extensions) paths.push(joinPath(dir, appName, `config.${ext}`));
122
+ for (const dir of options.systemConfigDirs ?? []) for (const ext of extensions) paths.push(joinPath(dir, appName, `config.${ext}`));
89
123
  return paths;
90
124
  }
91
125
  /**
@@ -158,7 +192,12 @@ function buildLoaderMap(loaders) {
158
192
  */
159
193
  async function discoverConfig(appName, adapter, options) {
160
194
  const loaderMap = buildLoaderMap(options?.loaders);
161
- const searchPaths = options?.configPath !== void 0 ? [options.configPath] : options?.searchPaths ?? buildConfigSearchPaths(appName, adapter.cwd, adapter.configDir, options?.loaders);
195
+ const searchPaths = options?.configPath !== void 0 ? [options.configPath] : options?.searchPaths ?? buildConfigSearchPaths(appName, {
196
+ baseDir: options?.baseDir ?? adapter.cwd,
197
+ userConfigDirs: adapter.userConfigDirs ?? [adapter.configDir],
198
+ systemConfigDirs: adapter.systemConfigDirs ?? [],
199
+ ...options?.loaders !== void 0 ? { loaders: options.loaders } : {}
200
+ });
162
201
  for (const candidatePath of searchPaths) {
163
202
  const content = await adapter.readFile(candidatePath);
164
203
  if (content === null) {
@@ -174,6 +174,7 @@ interface PackageRepositoryUrlOptions {
174
174
  declare function packageRepositoryUrl(pkg: PackageJsonData, options: PackageRepositoryUrlOptions & {
175
175
  readonly require: true;
176
176
  }): string;
177
+ /** Resolve a package repository URL, returning `undefined` for absent or invalid locators. */
177
178
  declare function packageRepositoryUrl(pkg: PackageJsonData, options?: PackageRepositoryUrlOptions): string | undefined;
178
179
  /**
179
180
  * Infer the CLI binary name from manifest data.
@@ -87,7 +87,7 @@ interface ParseErrorOptions extends Omit<CLIErrorOptions, 'code' | 'exitCode'> {
87
87
  */
88
88
  declare class ParseError extends CLIError {
89
89
  /** Always `'ParseError'`. @override */
90
- readonly name: 'ParseError';
90
+ readonly name: "ParseError";
91
91
  /** Narrowed to parse-category codes. */
92
92
  readonly code: ParseErrorCode;
93
93
  /** Create a parse error with exit code defaulting to `2`. */
@@ -110,7 +110,7 @@ interface ValidationErrorOptions extends Omit<CLIErrorOptions, 'code' | 'exitCod
110
110
  */
111
111
  declare class ValidationError extends CLIError {
112
112
  /** Always `'ValidationError'`. @override */
113
- readonly name: 'ValidationError';
113
+ readonly name: "ValidationError";
114
114
  /** Narrowed to validation-category codes. */
115
115
  readonly code: ValidationErrorCode;
116
116
  /** Create a validation error with exit code defaulting to `2`. */
@@ -1,6 +1,7 @@
1
1
  import { CLIError } from "../errors/index.mjs";
2
2
  import { includesBeforeSeparator, parse } from "../parse/index.mjs";
3
3
  import { formatHelp } from "../help/index.mjs";
4
+ import { generateCommandSchema } from "../json-schema/index.mjs";
4
5
  import { clearRequestedExitCode, getRequestedExitCode } from "../output/index.mjs";
5
6
  import { createTestPrompter } from "../prompt/index.mjs";
6
7
  import { resolve } from "../resolve/index.mjs";
@@ -17,6 +18,16 @@ async function executeCommand(request) {
17
18
  clearRequestedExitCode(out);
18
19
  try {
19
20
  if (includesBeforeSeparator(argv, "--help") || includesBeforeSeparator(argv, "-h")) {
21
+ if (out.jsonMode || options?.jsonMode === true) {
22
+ out.json(generateCommandSchema(schema, void 0, {
23
+ name: options?.help?.binName ?? schema.name,
24
+ version: options?.help?.version
25
+ }));
26
+ return {
27
+ exitCode: 0,
28
+ error: void 0
29
+ };
30
+ }
20
31
  const helpText = formatHelp(schema, options?.help?.colors !== void 0 ? options.help : {
21
32
  ...options?.help,
22
33
  colors: out.color
@@ -52,7 +63,8 @@ async function executeCommand(request) {
52
63
  ...options?.env !== void 0 ? { env: options.env } : {},
53
64
  ...options?.config !== void 0 ? { config: options.config } : {},
54
65
  ...effectivePrompter !== void 0 ? { prompter: effectivePrompter } : {},
55
- ...options?.stat !== void 0 ? { stat: options.stat } : {}
66
+ ...options?.stat !== void 0 ? { stat: options.stat } : {},
67
+ ...options?.mkdir !== void 0 ? { mkdir: options.mkdir } : {}
56
68
  });
57
69
  const resolvedParams = {
58
70
  args: resolved.args,
@@ -13,6 +13,11 @@
13
13
  /**
14
14
  * Remove ANSI CSI and OSC escape sequences from `text`.
15
15
  *
16
+ * Delegates to `ansispeck`'s stripper, which handles SGR sequences and OSC
17
+ * hyperlinks under both terminators. Kept as a named export so help
18
+ * formatting and custom help renderers reach the width-aware helpers and
19
+ * their stripper through one module.
20
+ *
16
21
  * @param text - Text possibly containing terminal escapes.
17
22
  * @returns The text with all escape sequences removed.
18
23
  */
@@ -39,10 +44,10 @@ declare function visibleWidth(text: string): number;
39
44
  * Wrap `text` in an [OSC 8 hyperlink](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)
40
45
  * pointing at `url`.
41
46
  *
42
- * Supporting terminals render `text` as a clickable link; non-supporting
43
- * terminals ignore the escape sequence and show plain text. Combine with
44
- * {@linkcode visibleWidth}-aware formatting when embedding links in aligned
45
- * output.
47
+ * Supporting terminals render `text` as a clickable link; others show it
48
+ * plain. `text` defaults to the URL, so an omitted label degrades to a
49
+ * usable address. The framework's help layer decides *whether* to link
50
+ * (`help.hyperlinks`); this always emits when called.
46
51
  *
47
52
  * @param url - Link target (string or `URL` instance).
48
53
  * @param text - Visible link text.
@@ -51,9 +56,10 @@ declare function visibleWidth(text: string): number;
51
56
  * @example
52
57
  * ```ts
53
58
  * cli('mycli').version(osc8('https://github.com/me/mycli/releases/tag/v1.0.0', '1.0.0'));
59
+ * osc8('https://dreamcli.kjanat.dev'); // linked, displayed as the URL
54
60
  * ```
55
61
  */
56
- declare function osc8(url: string | URL, text: string): string;
62
+ declare function osc8(url: string | URL, text?: string): string;
57
63
  /**
58
64
  * Pad `text` to `length` visible columns with trailing spaces.
59
65
  *