@ykdz/template 0.0.37 → 0.0.40

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 (225) hide show
  1. package/dist/application.d.ts +1 -52
  2. package/dist/application.js +0 -81
  3. package/dist/cli.js +14 -28
  4. package/dist/input-schemas.d.ts +30 -0
  5. package/dist/input-schemas.js +75 -0
  6. package/dist/main.d.ts +3 -14
  7. package/dist/main.js +496 -378
  8. package/dist/result-schemas.d.ts +222 -0
  9. package/dist/result-schemas.js +74 -0
  10. package/dist/standard-schema.d.ts +3 -0
  11. package/dist/standard-schema.js +29 -0
  12. package/node_modules/@standard-schema/spec/LICENSE +21 -0
  13. package/node_modules/@standard-schema/spec/README.md +198 -0
  14. package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
  15. package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
  16. package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
  17. package/node_modules/@standard-schema/spec/dist/index.js +0 -0
  18. package/node_modules/@standard-schema/spec/package.json +52 -0
  19. package/node_modules/@types/node/LICENSE +21 -0
  20. package/node_modules/@types/node/README.md +15 -0
  21. package/node_modules/@types/node/assert/strict.d.ts +111 -0
  22. package/node_modules/@types/node/assert.d.ts +1115 -0
  23. package/node_modules/@types/node/async_hooks.d.ts +619 -0
  24. package/node_modules/@types/node/buffer.buffer.d.ts +477 -0
  25. package/node_modules/@types/node/buffer.d.ts +1941 -0
  26. package/node_modules/@types/node/child_process.d.ts +1480 -0
  27. package/node_modules/@types/node/cluster.d.ts +578 -0
  28. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  29. package/node_modules/@types/node/console.d.ts +453 -0
  30. package/node_modules/@types/node/constants.d.ts +21 -0
  31. package/node_modules/@types/node/crypto.d.ts +5484 -0
  32. package/node_modules/@types/node/dgram.d.ts +715 -0
  33. package/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  34. package/node_modules/@types/node/dns/promises.d.ts +503 -0
  35. package/node_modules/@types/node/dns.d.ts +923 -0
  36. package/node_modules/@types/node/domain.d.ts +166 -0
  37. package/node_modules/@types/node/events.d.ts +967 -0
  38. package/node_modules/@types/node/fs/promises.d.ts +1354 -0
  39. package/node_modules/@types/node/fs.d.ts +4777 -0
  40. package/node_modules/@types/node/globals.d.ts +170 -0
  41. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  42. package/node_modules/@types/node/http.d.ts +2246 -0
  43. package/node_modules/@types/node/http2.d.ts +2882 -0
  44. package/node_modules/@types/node/https.d.ts +585 -0
  45. package/node_modules/@types/node/index.d.ts +101 -0
  46. package/node_modules/@types/node/inspector.d.ts +323 -0
  47. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  48. package/node_modules/@types/node/module.d.ts +844 -0
  49. package/node_modules/@types/node/net.d.ts +1197 -0
  50. package/node_modules/@types/node/os.d.ts +507 -0
  51. package/node_modules/@types/node/package.json +140 -0
  52. package/node_modules/@types/node/path.d.ts +200 -0
  53. package/node_modules/@types/node/perf_hooks.d.ts +1054 -0
  54. package/node_modules/@types/node/process.d.ts +2101 -0
  55. package/node_modules/@types/node/punycode.d.ts +117 -0
  56. package/node_modules/@types/node/querystring.d.ts +152 -0
  57. package/node_modules/@types/node/readline/promises.d.ts +161 -0
  58. package/node_modules/@types/node/readline.d.ts +600 -0
  59. package/node_modules/@types/node/repl.d.ts +438 -0
  60. package/node_modules/@types/node/sea.d.ts +162 -0
  61. package/node_modules/@types/node/sqlite.d.ts +1182 -0
  62. package/node_modules/@types/node/stream/consumers.d.ts +45 -0
  63. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  64. package/node_modules/@types/node/stream/web.d.ts +596 -0
  65. package/node_modules/@types/node/stream.d.ts +1707 -0
  66. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  67. package/node_modules/@types/node/test.d.ts +2656 -0
  68. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  69. package/node_modules/@types/node/timers.d.ts +285 -0
  70. package/node_modules/@types/node/tls.d.ts +1314 -0
  71. package/node_modules/@types/node/trace_events.d.ts +197 -0
  72. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +473 -0
  73. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  74. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  75. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  76. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  77. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  78. package/node_modules/@types/node/tty.d.ts +209 -0
  79. package/node_modules/@types/node/url.d.ts +1103 -0
  80. package/node_modules/@types/node/util.d.ts +2376 -0
  81. package/node_modules/@types/node/v8.d.ts +1010 -0
  82. package/node_modules/@types/node/vm.d.ts +1160 -0
  83. package/node_modules/@types/node/wasi.d.ts +202 -0
  84. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  85. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  86. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  87. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  88. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  89. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  90. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  91. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  92. package/node_modules/@types/node/worker_threads.d.ts +894 -0
  93. package/node_modules/@types/node/zlib.d.ts +768 -0
  94. package/node_modules/@valibot/to-json-schema/LICENSE.md +9 -0
  95. package/node_modules/@valibot/to-json-schema/README.md +475 -0
  96. package/node_modules/@valibot/to-json-schema/dist/index.cjs +800 -0
  97. package/node_modules/@valibot/to-json-schema/dist/index.d.cts +991 -0
  98. package/node_modules/@valibot/to-json-schema/dist/index.d.mts +991 -0
  99. package/node_modules/@valibot/to-json-schema/dist/index.min.cjs +1 -0
  100. package/node_modules/@valibot/to-json-schema/dist/index.min.mjs +1 -0
  101. package/node_modules/@valibot/to-json-schema/dist/index.mjs +795 -0
  102. package/node_modules/@valibot/to-json-schema/package.json +75 -0
  103. package/node_modules/@ykdz/cli-contract/LICENSE +21 -0
  104. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.d.ts +17 -0
  105. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.js +55 -0
  106. package/node_modules/@ykdz/cli-contract/dist/cli-contract.d.ts +1164 -0
  107. package/node_modules/@ykdz/cli-contract/dist/cli-contract.js +1408 -0
  108. package/node_modules/@ykdz/cli-contract/dist/cli-execution.d.ts +54 -0
  109. package/node_modules/@ykdz/cli-contract/dist/cli-execution.js +708 -0
  110. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.d.ts +174 -0
  111. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.js +524 -0
  112. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.d.ts +10 -0
  113. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.js +14 -0
  114. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.d.ts +260 -0
  115. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.js +130 -0
  116. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.d.ts +63 -0
  117. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.js +17 -0
  118. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.d.ts +6 -0
  119. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.js +532 -0
  120. package/node_modules/@ykdz/cli-contract/dist/contract-schema.d.ts +14 -0
  121. package/node_modules/@ykdz/cli-contract/dist/contract-schema.js +1 -0
  122. package/node_modules/@ykdz/cli-contract/dist/description.d.ts +2 -0
  123. package/node_modules/@ykdz/cli-contract/dist/description.js +13 -0
  124. package/node_modules/@ykdz/cli-contract/dist/index.d.ts +8 -0
  125. package/node_modules/@ykdz/cli-contract/dist/index.js +7 -0
  126. package/node_modules/@ykdz/cli-contract/dist/json-value.d.ts +4 -0
  127. package/node_modules/@ykdz/cli-contract/dist/json-value.js +64 -0
  128. package/node_modules/@ykdz/cli-contract/dist/node.d.ts +21 -0
  129. package/node_modules/@ykdz/cli-contract/dist/node.js +109 -0
  130. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.d.ts +162 -0
  131. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.js +113 -0
  132. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.d.ts +53 -0
  133. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.js +189 -0
  134. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.d.ts +16 -0
  135. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.js +45 -0
  136. package/node_modules/@ykdz/cli-contract/package.json +69 -0
  137. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +20 -0
  138. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +27 -28
  139. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +19 -0
  140. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +1 -1
  141. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -1
  142. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +2 -1
  143. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +9 -5
  144. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +0 -4
  145. package/node_modules/@ykdz/template-builtin-presets/package.json +2 -1
  146. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/AGENTS.md.template +10 -4
  147. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/devcontainer.json +3 -0
  148. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +128 -59
  149. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +80 -8
  150. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +7 -3
  151. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +9 -19
  152. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +144 -60
  153. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/standard-schema.ts +37 -0
  154. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/lookup.journey.ts +71 -0
  155. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +118 -59
  156. package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +0 -1
  157. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +2 -1
  158. package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +15 -0
  159. package/node_modules/@ykdz/template-core/dist/project-blueprint.js +1 -1
  160. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +1 -1
  161. package/node_modules/undici-types/LICENSE +21 -0
  162. package/node_modules/undici-types/README.md +6 -0
  163. package/node_modules/undici-types/agent.d.ts +32 -0
  164. package/node_modules/undici-types/api.d.ts +43 -0
  165. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  166. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  167. package/node_modules/undici-types/cache.d.ts +36 -0
  168. package/node_modules/undici-types/client-stats.d.ts +15 -0
  169. package/node_modules/undici-types/client.d.ts +123 -0
  170. package/node_modules/undici-types/connector.d.ts +36 -0
  171. package/node_modules/undici-types/content-type.d.ts +21 -0
  172. package/node_modules/undici-types/cookies.d.ts +30 -0
  173. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  174. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  175. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  176. package/node_modules/undici-types/errors.d.ts +177 -0
  177. package/node_modules/undici-types/eventsource.d.ts +66 -0
  178. package/node_modules/undici-types/fetch.d.ts +211 -0
  179. package/node_modules/undici-types/formdata.d.ts +108 -0
  180. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  181. package/node_modules/undici-types/global-origin.d.ts +7 -0
  182. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  183. package/node_modules/undici-types/handlers.d.ts +15 -0
  184. package/node_modules/undici-types/header.d.ts +160 -0
  185. package/node_modules/undici-types/index.d.ts +91 -0
  186. package/node_modules/undici-types/interceptors.d.ts +80 -0
  187. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  188. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  189. package/node_modules/undici-types/mock-client.d.ts +27 -0
  190. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  191. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  192. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  193. package/node_modules/undici-types/package.json +55 -0
  194. package/node_modules/undici-types/patch.d.ts +29 -0
  195. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  196. package/node_modules/undici-types/pool.d.ts +41 -0
  197. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  198. package/node_modules/undici-types/readable.d.ts +68 -0
  199. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  200. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  201. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  202. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  203. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  204. package/node_modules/undici-types/util.d.ts +18 -0
  205. package/node_modules/undici-types/utility.d.ts +7 -0
  206. package/node_modules/undici-types/webidl.d.ts +347 -0
  207. package/node_modules/undici-types/websocket.d.ts +188 -0
  208. package/package.json +5 -3
  209. package/dist/command-result.d.ts +0 -9
  210. package/dist/command-result.js +0 -231
  211. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/greet.journey.ts +0 -46
  212. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/greet.test.ts +0 -15
  213. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/devcontainer/docker-client.Dockerfile +0 -3
  214. package/node_modules/commander/LICENSE +0 -22
  215. package/node_modules/commander/Readme.md +0 -1172
  216. package/node_modules/commander/index.js +0 -21
  217. package/node_modules/commander/lib/argument.js +0 -147
  218. package/node_modules/commander/lib/command.js +0 -2790
  219. package/node_modules/commander/lib/error.js +0 -36
  220. package/node_modules/commander/lib/help.js +0 -731
  221. package/node_modules/commander/lib/option.js +0 -377
  222. package/node_modules/commander/lib/suggestSimilar.js +0 -99
  223. package/node_modules/commander/package-support.json +0 -19
  224. package/node_modules/commander/package.json +0 -64
  225. package/node_modules/commander/typings/index.d.ts +0 -1113
@@ -0,0 +1,260 @@
1
+ export type SchemaDefinitionTarget = Readonly<{
2
+ readonly command: string;
3
+ readonly location: "input";
4
+ }> | Readonly<{
5
+ readonly command: string;
6
+ readonly location: "data" | "record";
7
+ readonly variant: string;
8
+ }> | Readonly<{
9
+ readonly command: string;
10
+ readonly location: "failure";
11
+ readonly variant: string;
12
+ }>;
13
+ export type ContractDefinitionIssue = Readonly<{
14
+ readonly code: "unknownDefinitionProperty";
15
+ readonly path: readonly string[];
16
+ }> | Readonly<{
17
+ readonly code: "missingHelpFactTemplate";
18
+ readonly command: string;
19
+ readonly slot: "commandPlaceholder" | "choices" | "default" | "requires" | "exclusive" | "forbiddenCombination";
20
+ }> | Readonly<SchemaDefinitionTarget & {
21
+ readonly code: "missingSchemaCapability";
22
+ readonly capability: "standard" | "validation" | "jsonSchema";
23
+ }> | Readonly<SchemaDefinitionTarget & {
24
+ readonly code: "schemaDialectMismatch";
25
+ readonly projection: "input" | "output";
26
+ readonly received: string | null;
27
+ }> | Readonly<SchemaDefinitionTarget & {
28
+ readonly code: "schemaExportFailed";
29
+ readonly projection: "input" | "output";
30
+ }> | Readonly<SchemaDefinitionTarget & {
31
+ readonly code: "invalidSchemaProjection";
32
+ readonly projection: "input" | "output";
33
+ }> | Readonly<{
34
+ readonly code: "schemaFieldSetMismatch";
35
+ readonly command: string;
36
+ readonly location: "input";
37
+ readonly missingFields: readonly string[];
38
+ readonly unexpectedFields: readonly string[];
39
+ }> | Readonly<{
40
+ readonly code: "schemaFieldDoesNotAcceptRawValue";
41
+ readonly command: string;
42
+ readonly location: "input";
43
+ readonly fields: readonly Readonly<{
44
+ readonly field: string;
45
+ readonly expected: "boolean" | "string" | "stringArray";
46
+ }>[];
47
+ }> | Readonly<{
48
+ readonly code: "invalidInputSchemaShape";
49
+ readonly command: string;
50
+ readonly location: "input";
51
+ readonly aspect: "properties" | "required" | "type";
52
+ }> | Readonly<{
53
+ readonly code: "missingInputDefault";
54
+ readonly command: string;
55
+ readonly location: "input";
56
+ readonly field: string;
57
+ }> | Readonly<{
58
+ readonly code: "invalidOutputSchemaShape";
59
+ readonly command: string;
60
+ readonly location: "input";
61
+ readonly aspect: "properties" | "required";
62
+ }> | Readonly<{
63
+ readonly code: "outputRequiredFieldMissingFromInput";
64
+ readonly command: string;
65
+ readonly location: "input";
66
+ readonly field: string;
67
+ }> | Readonly<{
68
+ readonly code: "invalidVariantName";
69
+ readonly command: string;
70
+ readonly location: "data" | "failure" | "record";
71
+ readonly variant: string;
72
+ }> | Readonly<{
73
+ readonly code: "invalidDescription";
74
+ readonly command: string;
75
+ readonly location: "command" | "field" | "data" | "failure" | "record";
76
+ readonly field?: string;
77
+ readonly variant?: string;
78
+ readonly received: string | null;
79
+ }> | Readonly<{
80
+ readonly code: "invalidVariantExitCode";
81
+ readonly command: string;
82
+ readonly location: "data" | "failure";
83
+ readonly variant: string;
84
+ readonly received: number | null;
85
+ readonly minimum: 0 | 1;
86
+ readonly maximum: 255;
87
+ }> | Readonly<{
88
+ readonly code: "missingStreamRecord";
89
+ readonly command: string;
90
+ }> | Readonly<{
91
+ readonly code: "invalidCapability";
92
+ readonly capability: "help" | "output" | "version";
93
+ }> | Readonly<{
94
+ readonly code: "invalidOutputFormat";
95
+ readonly expected: "structured|text";
96
+ readonly received: string | null;
97
+ }> | Readonly<{
98
+ readonly code: "invalidOutputCompatibilityFlag";
99
+ readonly flag: string;
100
+ readonly received: string | null;
101
+ }> | Readonly<{
102
+ readonly code: "invalidOutputCompatibilityFlags";
103
+ readonly received: string;
104
+ }> | Readonly<{
105
+ readonly code: "missingTextPresenter";
106
+ readonly command: string;
107
+ readonly location: "completion" | "data" | "failure" | "record" | "streamSuccess";
108
+ readonly variant?: string;
109
+ }> | Readonly<{
110
+ readonly code: "unexpectedTextPresenter";
111
+ readonly command: string;
112
+ readonly location: "completion" | "data" | "failure" | "record" | "streamSuccess";
113
+ readonly variant?: string;
114
+ }> | Readonly<{
115
+ readonly code: "invalidUsageFailureExitCode";
116
+ readonly received: number | null;
117
+ readonly minimum: 1;
118
+ readonly maximum: 255;
119
+ }> | Readonly<{
120
+ readonly code: "invalidRootCommandSet";
121
+ readonly root: string;
122
+ readonly receivedCommands: readonly string[];
123
+ }> | Readonly<{
124
+ readonly code: "invalidRootCommandKind";
125
+ readonly command: string;
126
+ readonly received: string | null;
127
+ }> | Readonly<{
128
+ readonly code: "invalidCommandIdentity";
129
+ readonly command: string;
130
+ }> | Readonly<{
131
+ readonly code: "invalidCommandNodeKind";
132
+ readonly command: string;
133
+ readonly received: string | null;
134
+ }> | Readonly<{
135
+ readonly code: "invalidCommandHandler";
136
+ readonly command: string;
137
+ }> | Readonly<{
138
+ readonly code: "invalidCommandParent";
139
+ readonly command: string;
140
+ readonly parent: string | null;
141
+ }> | Readonly<{
142
+ readonly code: "invalidCommandSpelling";
143
+ readonly command: string;
144
+ readonly spelling: string;
145
+ }> | Readonly<{
146
+ readonly code: "rootGroupWithoutChildren";
147
+ readonly command: string;
148
+ }> | Readonly<{
149
+ readonly code: "commandHierarchyCycle";
150
+ readonly commands: readonly string[];
151
+ }> | Readonly<{
152
+ readonly code: "duplicateCommandSpelling";
153
+ readonly parent: string;
154
+ readonly spelling: string;
155
+ readonly commands: readonly string[];
156
+ }> | Readonly<{
157
+ readonly code: "missingCommandText";
158
+ readonly command: string;
159
+ readonly field: "name";
160
+ }> | Readonly<{
161
+ readonly code: "invalidHelpSupplement";
162
+ readonly command: string;
163
+ }> | Readonly<{
164
+ readonly code: "invalidFieldLongOption";
165
+ readonly command: string;
166
+ readonly field: string;
167
+ readonly received: string | null;
168
+ }> | Readonly<{
169
+ readonly code: "invalidFieldIdentity";
170
+ readonly command: string;
171
+ readonly field: string;
172
+ }> | Readonly<{
173
+ readonly code: "invalidFieldKind";
174
+ readonly command: string;
175
+ readonly field: string;
176
+ readonly expected: readonly [
177
+ "positional",
178
+ "variadicPositional",
179
+ "flag",
180
+ "valueOption",
181
+ "repeatableOption"
182
+ ];
183
+ readonly received: string | null;
184
+ }> | Readonly<{
185
+ readonly code: "invalidFieldShortAlias";
186
+ readonly command: string;
187
+ readonly field: string;
188
+ readonly received: string | null;
189
+ }> | Readonly<{
190
+ readonly code: "duplicateFieldOptionSpelling";
191
+ readonly command: string;
192
+ readonly spelling: string;
193
+ readonly fields: readonly string[];
194
+ }> | Readonly<{
195
+ readonly code: "fieldOptionConflictsWithControl";
196
+ readonly command: string;
197
+ readonly field: string;
198
+ readonly spelling: string;
199
+ readonly control: "help" | "outputFormat" | "version";
200
+ }> | Readonly<{
201
+ readonly code: "requiredPositionalAfterOptional";
202
+ readonly command: string;
203
+ readonly field: string;
204
+ readonly precedingOptionalField: string;
205
+ }> | Readonly<{
206
+ readonly code: "positionalAfterVariadic";
207
+ readonly command: string;
208
+ readonly field: string;
209
+ readonly variadicField: string;
210
+ }> | Readonly<{
211
+ readonly code: "duplicateFieldLongOption";
212
+ readonly command: string;
213
+ readonly longOption: string;
214
+ readonly fields: readonly string[];
215
+ }> | Readonly<{
216
+ readonly code: "missingDataVariant";
217
+ readonly command: string;
218
+ }> | Readonly<{
219
+ readonly code: "invalidUsageConstraint";
220
+ readonly command: string;
221
+ readonly index: number | null;
222
+ readonly aspect: "collection" | "entry" | "kind" | "members";
223
+ readonly received: string | null;
224
+ }> | Readonly<{
225
+ readonly code: "unknownUsageConstraintField";
226
+ readonly command: string;
227
+ readonly constraint: "requires" | "exclusive" | "forbiddenCombination";
228
+ readonly index: number;
229
+ readonly member: "field" | "requires" | "fields" | "values.field";
230
+ readonly field: string;
231
+ }> | Readonly<{
232
+ readonly code: "inapplicableUsageConstraintField";
233
+ readonly command: string;
234
+ readonly constraint: "requires" | "exclusive" | "forbiddenCombination";
235
+ readonly field: string;
236
+ readonly kind: FieldKind;
237
+ }> | Readonly<{
238
+ readonly code: "invalidUsageConstraintValue";
239
+ readonly command: string;
240
+ readonly field: string;
241
+ readonly expected: "boolean" | "string";
242
+ }> | Readonly<{
243
+ readonly code: "contradictoryUsageConstraint";
244
+ readonly command: string;
245
+ readonly constraint: "requires" | "exclusive" | "forbiddenCombination";
246
+ readonly fields: readonly string[];
247
+ }>;
248
+ type FieldKind = "positional" | "variadicPositional" | "flag" | "valueOption" | "repeatableOption";
249
+ /**
250
+ * 定义期发现动态声明违反契约时抛出的闭合问题集合,在执行 handler 前定位无效声明。
251
+ * 它服务作者修正契约,不代表命令调用的用法失败;核心不会自动将它写入 CLI 诊断输出。
252
+ */
253
+ export declare class ContractDefinitionError extends Error {
254
+ readonly issues: readonly [
255
+ ContractDefinitionIssue,
256
+ ...ContractDefinitionIssue[]
257
+ ];
258
+ constructor(issues: readonly [ContractDefinitionIssue, ...ContractDefinitionIssue[]]);
259
+ }
260
+ export {};
@@ -0,0 +1,130 @@
1
+ /**
2
+ * 定义期发现动态声明违反契约时抛出的闭合问题集合,在执行 handler 前定位无效声明。
3
+ * 它服务作者修正契约,不代表命令调用的用法失败;核心不会自动将它写入 CLI 诊断输出。
4
+ */
5
+ export class ContractDefinitionError extends Error {
6
+ issues;
7
+ constructor(issues) {
8
+ super(issues.map(formatContractDefinitionIssue).join(";"));
9
+ this.name = "ContractDefinitionError";
10
+ const [first, ...rest] = issues;
11
+ this.issues = Object.freeze([
12
+ Object.freeze(first),
13
+ ...rest.map((issue) => Object.freeze(issue)),
14
+ ]);
15
+ }
16
+ }
17
+ // oxlint-disable-next-line typescript/consistent-return -- 所有闭合定义问题 code 均由 switch 返回。
18
+ function formatContractDefinitionIssue(issue) {
19
+ switch (issue.code) {
20
+ case "unknownDefinitionProperty":
21
+ return `CLI 声明包含未知属性 ${issue.path.join(".")}`;
22
+ case "missingHelpFactTemplate":
23
+ return `命令 ${issue.command} 的帮助事实缺少 ${issue.slot} 模板`;
24
+ case "missingSchemaCapability":
25
+ return `${formatSchemaTarget(issue)} 缺少 ${issue.capability} 能力`;
26
+ case "schemaDialectMismatch":
27
+ return `${formatSchemaTarget(issue)} 的 ${issue.projection} 投影不是 Draft 2020-12`;
28
+ case "schemaExportFailed":
29
+ return `${formatSchemaTarget(issue)} 无法导出 ${issue.projection} 投影`;
30
+ case "invalidSchemaProjection":
31
+ return `${formatSchemaTarget(issue)} 的 ${issue.projection} 投影不是 JSON object`;
32
+ case "schemaFieldSetMismatch":
33
+ return `命令 ${issue.command} 的字段与输入模式属性不一致`;
34
+ case "schemaFieldDoesNotAcceptRawValue":
35
+ return `命令 ${issue.command} 的输入字段 ${issue.fields.map(({ field, expected }) => `${field} 不接受 raw ${expected}`).join(", ")}`;
36
+ case "invalidInputSchemaShape":
37
+ return `命令 ${issue.command} 的输入模式 ${issue.aspect} 无效`;
38
+ case "missingInputDefault":
39
+ return `命令 ${issue.command} 的输入字段 ${issue.field} 缺少 default 注解`;
40
+ case "invalidOutputSchemaShape":
41
+ return `命令 ${issue.command} 的输出模式 ${issue.aspect} 无效`;
42
+ case "outputRequiredFieldMissingFromInput":
43
+ return `命令 ${issue.command} 的输出必填字段 ${issue.field} 不在输入模式属性中`;
44
+ case "invalidVariantName":
45
+ return `命令 ${issue.command} 的 ${issue.location} 变体名 ${issue.variant} 无效`;
46
+ case "invalidDescription":
47
+ return issue.location === "command"
48
+ ? `命令 ${issue.command} 的描述必须是合法单行文本`
49
+ : issue.location === "field"
50
+ ? `命令 ${issue.command} 的字段 ${issue.field} 描述必须是合法单行文本`
51
+ : `命令 ${issue.command} 的 ${issue.location} 变体 ${issue.variant} 描述必须是合法单行文本`;
52
+ case "invalidVariantExitCode":
53
+ return `命令 ${issue.command} 的 ${issue.location} 变体 ${issue.variant} 退出码无效`;
54
+ case "missingStreamRecord":
55
+ return `命令 ${issue.command} 的 stream 必须声明至少一个 record`;
56
+ case "invalidCapability":
57
+ return `CLI 的 ${issue.capability} 能力无效`;
58
+ case "invalidOutputFormat":
59
+ return `CLI 输出格式应为 ${issue.expected},实际为 ${issue.received ?? "非字符串"}`;
60
+ case "invalidOutputCompatibilityFlag":
61
+ return `CLI 输出兼容 flag ${issue.flag} 无效`;
62
+ case "invalidOutputCompatibilityFlags":
63
+ return `CLI 输出兼容 flags 必须是普通 record,实际为 ${issue.received}`;
64
+ case "missingTextPresenter":
65
+ return `命令 ${issue.command} 的 ${issue.location}${issue.variant === undefined ? "" : ` 变体 ${issue.variant}`} 缺少 text presenter`;
66
+ case "unexpectedTextPresenter":
67
+ return `命令 ${issue.command} 的 ${issue.location}${issue.variant === undefined ? "" : ` 变体 ${issue.variant}`} 不应声明 text presenter`;
68
+ case "invalidUsageFailureExitCode":
69
+ return "CLI 的用法失败退出码无效";
70
+ case "invalidRootCommandSet":
71
+ return `CLI 根 ${issue.root} 必须对应唯一根命令`;
72
+ case "invalidRootCommandKind":
73
+ return `命令 ${issue.command} 的 kind 无效`;
74
+ case "invalidCommandIdentity":
75
+ return `命令身份 ${issue.command} 无效`;
76
+ case "invalidCommandNodeKind":
77
+ return `命令 ${issue.command} 的节点 kind 无效`;
78
+ case "invalidCommandHandler":
79
+ return `命令 ${issue.command} 的 handler 声明无效`;
80
+ case "invalidCommandParent":
81
+ return `命令 ${issue.command} 的 parent ${issue.parent ?? "缺失"} 无效`;
82
+ case "invalidCommandSpelling":
83
+ return `命令 ${issue.command} 的 spelling ${issue.spelling} 无效`;
84
+ case "rootGroupWithoutChildren":
85
+ return `根命令组 ${issue.command} 没有子命令`;
86
+ case "commandHierarchyCycle":
87
+ return `命令层级存在环:${issue.commands.join(", ")}`;
88
+ case "duplicateCommandSpelling":
89
+ return `命令 ${issue.commands.join(", ")} 在 ${issue.parent} 下重复使用 spelling ${issue.spelling}`;
90
+ case "missingCommandText":
91
+ return `命令 ${issue.command} 缺少 ${issue.field}`;
92
+ case "invalidHelpSupplement":
93
+ return `命令 ${issue.command} 的帮助补充必须是合法文本行组`;
94
+ case "invalidFieldLongOption":
95
+ return `命令 ${issue.command} 的字段 ${issue.field} long option 无效`;
96
+ case "invalidFieldIdentity":
97
+ return `命令 ${issue.command} 的字段身份 ${issue.field} 无效`;
98
+ case "invalidFieldKind":
99
+ return `命令 ${issue.command} 的字段 ${issue.field} kind 无效`;
100
+ case "invalidFieldShortAlias":
101
+ return `命令 ${issue.command} 的字段 ${issue.field} short alias 无效`;
102
+ case "duplicateFieldOptionSpelling":
103
+ return `命令 ${issue.command} 的字段 ${issue.fields.join(", ")} 重复使用 option spelling ${issue.spelling}`;
104
+ case "fieldOptionConflictsWithControl":
105
+ return `命令 ${issue.command} 的字段 ${issue.field} 与 ${issue.control} control spelling ${issue.spelling} 冲突`;
106
+ case "requiredPositionalAfterOptional":
107
+ return `命令 ${issue.command} 的必填 positional ${issue.field} 位于可选 positional ${issue.precedingOptionalField} 之后`;
108
+ case "positionalAfterVariadic":
109
+ return `命令 ${issue.command} 的 positional ${issue.field} 位于 variadic positional ${issue.variadicField} 之后`;
110
+ case "duplicateFieldLongOption":
111
+ return `命令 ${issue.command} 的字段 ${issue.fields.join(", ")} 重复使用 long option ${issue.longOption}`;
112
+ case "missingDataVariant":
113
+ return `命令 ${issue.command} 必须声明至少一个 data 变体`;
114
+ case "invalidUsageConstraint":
115
+ return `命令 ${issue.command} 的 usage constraint ${issue.received ?? "非字符串"} 无效`;
116
+ case "unknownUsageConstraintField":
117
+ return `命令 ${issue.command} 的 usage constraint[${issue.index}] ${issue.constraint}.${issue.member} 引用了不存在字段 ${issue.field}`;
118
+ case "inapplicableUsageConstraintField":
119
+ return `命令 ${issue.command} 的 ${issue.constraint} usage constraint 不适用于字段 ${issue.field}(${issue.kind})`;
120
+ case "invalidUsageConstraintValue":
121
+ return `命令 ${issue.command} 的 usage constraint 字段 ${issue.field} 必须使用 ${issue.expected} 离散值`;
122
+ case "contradictoryUsageConstraint":
123
+ return `命令 ${issue.command} 的 ${issue.constraint} usage constraint 内部矛盾:${issue.fields.join(", ")}`;
124
+ }
125
+ }
126
+ function formatSchemaTarget(target) {
127
+ return target.location === "input"
128
+ ? `命令 ${target.command} 输入`
129
+ : `命令 ${target.command} 的 ${target.location} 变体 ${target.variant}`;
130
+ }
@@ -0,0 +1,63 @@
1
+ export type ExecutionSchemaTarget = Readonly<{
2
+ readonly command: string;
3
+ readonly location: "input";
4
+ }> | Readonly<{
5
+ readonly command: string;
6
+ readonly location: "data" | "failure" | "record";
7
+ readonly variant: string;
8
+ }>;
9
+ export type ContractExecutionIssue = Readonly<{
10
+ readonly code: "invocationContractMismatch";
11
+ readonly expectedCommand: string;
12
+ readonly receivedCommand: string;
13
+ }> | Readonly<{
14
+ readonly code: "invalidOutcomeFact";
15
+ readonly command: string;
16
+ }> | Readonly<{
17
+ readonly code: "streamHandlerMustReturnAsyncGenerator";
18
+ readonly command: string;
19
+ }> | Readonly<{
20
+ readonly code: "invalidCliContract";
21
+ }> | Readonly<{
22
+ readonly code: "outcomeKindMismatch";
23
+ readonly command: string;
24
+ readonly expected: "completion" | "data" | "stream";
25
+ readonly received: string;
26
+ }> | Readonly<{
27
+ readonly code: "undeclaredOutcomeVariant";
28
+ readonly command: string;
29
+ readonly location: "data" | "failure" | "record";
30
+ readonly variant: string;
31
+ }> | Readonly<ExecutionSchemaTarget & {
32
+ readonly code: "asynchronousSchemaValidation";
33
+ readonly expected: "synchronousStandardResult";
34
+ readonly received: "promise";
35
+ }> | Readonly<ExecutionSchemaTarget & {
36
+ readonly code: "invalidStandardResult";
37
+ readonly expected: "standardResult";
38
+ readonly received: "array" | "bigint" | "boolean" | "function" | "null" | "number" | "object" | "string" | "symbol" | "undefined";
39
+ }> | Readonly<Exclude<ExecutionSchemaTarget, {
40
+ readonly location: "input";
41
+ }> & {
42
+ readonly code: "outputSchemaRejected";
43
+ readonly expected: "schemaAccepted";
44
+ readonly received: "schemaRejected";
45
+ }> | Readonly<Exclude<ExecutionSchemaTarget, {
46
+ readonly location: "input";
47
+ }> & {
48
+ readonly code: "invalidJsonValue";
49
+ readonly expected: "jsonValue";
50
+ readonly received: "nonJsonValue";
51
+ }>;
52
+ /**
53
+ * 核心检测到执行契约不变量被破坏时抛出的闭合问题集合,例如非法输出或错配调用。
54
+ * 消费者模式、handler、generator 和呈现器自行抛出的值保持原始身份,不被包装成此类。
55
+ * 它不进入应用失败、正常终止或 CLI 线输出;诊断展示与进程状态由宿主决定。
56
+ */
57
+ export declare class ContractExecutionError extends Error {
58
+ readonly issues: readonly [
59
+ ContractExecutionIssue,
60
+ ...ContractExecutionIssue[]
61
+ ];
62
+ constructor(issues: readonly [ContractExecutionIssue, ...ContractExecutionIssue[]]);
63
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 核心检测到执行契约不变量被破坏时抛出的闭合问题集合,例如非法输出或错配调用。
3
+ * 消费者模式、handler、generator 和呈现器自行抛出的值保持原始身份,不被包装成此类。
4
+ * 它不进入应用失败、正常终止或 CLI 线输出;诊断展示与进程状态由宿主决定。
5
+ */
6
+ export class ContractExecutionError extends Error {
7
+ issues;
8
+ constructor(issues) {
9
+ super("contractExecutionError");
10
+ this.name = "ContractExecutionError";
11
+ const [first, ...rest] = issues;
12
+ this.issues = Object.freeze([
13
+ Object.freeze(first),
14
+ ...rest.map((issue) => Object.freeze(issue)),
15
+ ]);
16
+ }
17
+ }
@@ -0,0 +1,6 @@
1
+ import type { FieldDefinitions, FieldGrammar, SchemaManifest } from "#/cli-contract";
2
+ import type { ContractDefinitionIssue, SchemaDefinitionTarget } from "#/contract-definition-error";
3
+ import type { ContractSchema, JsonObject } from "#/contract-schema";
4
+ export declare function compileContractSchema(schema: ContractSchema, target: SchemaDefinitionTarget, issues: ContractDefinitionIssue[], description?: string): SchemaManifest | undefined;
5
+ export declare function projectFieldDescriptions(schema: SchemaManifest, fields: readonly FieldGrammar[]): SchemaManifest;
6
+ export declare function compileInputFields(definitions: FieldDefinitions, inputSchema: JsonObject, command: string, issues: ContractDefinitionIssue[]): readonly FieldGrammar[];