@ykdz/template 0.0.38 → 0.0.41

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 (227) 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 +38 -2
  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/package.json +2 -1
  145. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/AGENTS.md.template +5 -3
  146. package/node_modules/@ykdz/template-builtin-presets/templates/{shared/devcontainer/node-pnpm.Dockerfile → foundation/devcontainer/base.Dockerfile} +14 -1
  147. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/rust.Dockerfile +1 -5
  148. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/github-cli.Dockerfile +1 -3
  149. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +128 -59
  150. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +80 -8
  151. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +7 -3
  152. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +9 -19
  153. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +144 -60
  154. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/standard-schema.ts +37 -0
  155. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/lookup.journey.ts +71 -0
  156. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +118 -59
  157. package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +0 -1
  158. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +0 -19
  159. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +3 -2
  160. package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +15 -0
  161. package/node_modules/@ykdz/template-core/dist/project-blueprint.js +1 -1
  162. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +0 -59
  163. package/node_modules/@ykdz/template-core/dist/project-github.js +0 -67
  164. package/node_modules/undici-types/LICENSE +21 -0
  165. package/node_modules/undici-types/README.md +6 -0
  166. package/node_modules/undici-types/agent.d.ts +32 -0
  167. package/node_modules/undici-types/api.d.ts +43 -0
  168. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  169. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  170. package/node_modules/undici-types/cache.d.ts +36 -0
  171. package/node_modules/undici-types/client-stats.d.ts +15 -0
  172. package/node_modules/undici-types/client.d.ts +123 -0
  173. package/node_modules/undici-types/connector.d.ts +36 -0
  174. package/node_modules/undici-types/content-type.d.ts +21 -0
  175. package/node_modules/undici-types/cookies.d.ts +30 -0
  176. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  177. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  178. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  179. package/node_modules/undici-types/errors.d.ts +177 -0
  180. package/node_modules/undici-types/eventsource.d.ts +66 -0
  181. package/node_modules/undici-types/fetch.d.ts +211 -0
  182. package/node_modules/undici-types/formdata.d.ts +108 -0
  183. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  184. package/node_modules/undici-types/global-origin.d.ts +7 -0
  185. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  186. package/node_modules/undici-types/handlers.d.ts +15 -0
  187. package/node_modules/undici-types/header.d.ts +160 -0
  188. package/node_modules/undici-types/index.d.ts +91 -0
  189. package/node_modules/undici-types/interceptors.d.ts +80 -0
  190. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  191. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  192. package/node_modules/undici-types/mock-client.d.ts +27 -0
  193. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  194. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  195. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  196. package/node_modules/undici-types/package.json +55 -0
  197. package/node_modules/undici-types/patch.d.ts +29 -0
  198. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  199. package/node_modules/undici-types/pool.d.ts +41 -0
  200. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  201. package/node_modules/undici-types/readable.d.ts +68 -0
  202. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  203. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  204. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  205. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  206. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  207. package/node_modules/undici-types/util.d.ts +18 -0
  208. package/node_modules/undici-types/utility.d.ts +7 -0
  209. package/node_modules/undici-types/webidl.d.ts +347 -0
  210. package/node_modules/undici-types/websocket.d.ts +188 -0
  211. package/package.json +5 -3
  212. package/dist/command-result.d.ts +0 -9
  213. package/dist/command-result.js +0 -231
  214. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/greet.journey.ts +0 -46
  215. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/greet.test.ts +0 -15
  216. package/node_modules/commander/LICENSE +0 -22
  217. package/node_modules/commander/Readme.md +0 -1172
  218. package/node_modules/commander/index.js +0 -21
  219. package/node_modules/commander/lib/argument.js +0 -147
  220. package/node_modules/commander/lib/command.js +0 -2790
  221. package/node_modules/commander/lib/error.js +0 -36
  222. package/node_modules/commander/lib/help.js +0 -731
  223. package/node_modules/commander/lib/option.js +0 -377
  224. package/node_modules/commander/lib/suggestSimilar.js +0 -99
  225. package/node_modules/commander/package-support.json +0 -19
  226. package/node_modules/commander/package.json +0 -64
  227. package/node_modules/commander/typings/index.d.ts +0 -1113
@@ -0,0 +1,188 @@
1
+ /// <reference types="node" />
2
+
3
+ import type { Blob } from 'node:buffer'
4
+ import type { ReadableStream, WritableStream } from 'node:stream/web'
5
+ import type { MessagePort } from 'node:worker_threads'
6
+ import {
7
+ EventInit,
8
+ EventListenerOptions,
9
+ AddEventListenerOptions,
10
+ EventListenerOrEventListenerObject
11
+ } from './patch'
12
+ import Dispatcher from './dispatcher'
13
+ import { HeadersInit } from './fetch'
14
+
15
+ export type BinaryType = 'blob' | 'arraybuffer'
16
+
17
+ interface WebSocketEventMap {
18
+ close: CloseEvent
19
+ error: ErrorEvent
20
+ message: MessageEvent
21
+ open: Event
22
+ }
23
+
24
+ interface WebSocket extends EventTarget {
25
+ binaryType: BinaryType
26
+
27
+ readonly bufferedAmount: number
28
+ readonly extensions: string
29
+
30
+ onclose: ((this: WebSocket, ev: WebSocketEventMap['close']) => any) | null
31
+ onerror: ((this: WebSocket, ev: WebSocketEventMap['error']) => any) | null
32
+ onmessage: ((this: WebSocket, ev: WebSocketEventMap['message']) => any) | null
33
+ onopen: ((this: WebSocket, ev: WebSocketEventMap['open']) => any) | null
34
+
35
+ readonly protocol: string
36
+ readonly readyState: number
37
+ readonly url: string
38
+
39
+ close(code?: number, reason?: string): void
40
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void
41
+
42
+ readonly CLOSED: number
43
+ readonly CLOSING: number
44
+ readonly CONNECTING: number
45
+ readonly OPEN: number
46
+
47
+ addEventListener<K extends keyof WebSocketEventMap>(
48
+ type: K,
49
+ listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
50
+ options?: boolean | AddEventListenerOptions
51
+ ): void
52
+ addEventListener(
53
+ type: string,
54
+ listener: EventListenerOrEventListenerObject,
55
+ options?: boolean | AddEventListenerOptions
56
+ ): void
57
+ removeEventListener<K extends keyof WebSocketEventMap>(
58
+ type: K,
59
+ listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
60
+ options?: boolean | EventListenerOptions
61
+ ): void
62
+ removeEventListener(
63
+ type: string,
64
+ listener: EventListenerOrEventListenerObject,
65
+ options?: boolean | EventListenerOptions
66
+ ): void
67
+ }
68
+
69
+ export declare const WebSocket: {
70
+ prototype: WebSocket
71
+ new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket
72
+ readonly CLOSED: number
73
+ readonly CLOSING: number
74
+ readonly CONNECTING: number
75
+ readonly OPEN: number
76
+ }
77
+
78
+ interface CloseEventInit extends EventInit {
79
+ code?: number
80
+ reason?: string
81
+ wasClean?: boolean
82
+ }
83
+
84
+ interface CloseEvent extends Event {
85
+ readonly code: number
86
+ readonly reason: string
87
+ readonly wasClean: boolean
88
+ }
89
+
90
+ export declare const CloseEvent: {
91
+ prototype: CloseEvent
92
+ new (type: string, eventInitDict?: CloseEventInit): CloseEvent
93
+ }
94
+
95
+ interface MessageEventInit<T = any> extends EventInit {
96
+ data?: T
97
+ lastEventId?: string
98
+ origin?: string
99
+ ports?: MessagePort[]
100
+ source?: MessagePort | null
101
+ }
102
+
103
+ interface MessageEvent<T = any> extends Event {
104
+ readonly data: T
105
+ readonly lastEventId: string
106
+ readonly origin: string
107
+ readonly ports: readonly MessagePort[]
108
+ readonly source: MessagePort | null
109
+ initMessageEvent(
110
+ type: string,
111
+ bubbles?: boolean,
112
+ cancelable?: boolean,
113
+ data?: any,
114
+ origin?: string,
115
+ lastEventId?: string,
116
+ source?: MessagePort | null,
117
+ ports?: MessagePort[]
118
+ ): void;
119
+ }
120
+
121
+ export declare const MessageEvent: {
122
+ prototype: MessageEvent
123
+ new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>
124
+ }
125
+
126
+ interface ErrorEventInit extends EventInit {
127
+ message?: string
128
+ filename?: string
129
+ lineno?: number
130
+ colno?: number
131
+ error?: any
132
+ }
133
+
134
+ interface ErrorEvent extends Event {
135
+ readonly message: string
136
+ readonly filename: string
137
+ readonly lineno: number
138
+ readonly colno: number
139
+ readonly error: Error
140
+ }
141
+
142
+ export declare const ErrorEvent: {
143
+ prototype: ErrorEvent
144
+ new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent
145
+ }
146
+
147
+ interface WebSocketInit {
148
+ protocols?: string | string[],
149
+ dispatcher?: Dispatcher,
150
+ headers?: HeadersInit
151
+ }
152
+
153
+ interface WebSocketStreamOptions {
154
+ protocols?: string | string[]
155
+ signal?: AbortSignal
156
+ }
157
+
158
+ interface WebSocketCloseInfo {
159
+ closeCode: number
160
+ reason: string
161
+ }
162
+
163
+ interface WebSocketStream {
164
+ closed: Promise<WebSocketCloseInfo>
165
+ opened: Promise<{
166
+ extensions: string
167
+ protocol: string
168
+ readable: ReadableStream
169
+ writable: WritableStream
170
+ }>
171
+ url: string
172
+
173
+ close(options?: Partial<WebSocketCloseInfo>): void
174
+ }
175
+
176
+ export declare const WebSocketStream: {
177
+ prototype: WebSocketStream
178
+ new (url: string | URL, options?: WebSocketStreamOptions): WebSocketStream
179
+ }
180
+
181
+ interface WebSocketError extends Event, WebSocketCloseInfo {}
182
+
183
+ export declare const WebSocketError: {
184
+ prototype: WebSocketError
185
+ new (type: string, init?: WebSocketCloseInfo): WebSocketError
186
+ }
187
+
188
+ export declare const ping: (ws: WebSocket, body?: Buffer) => void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ykdz/template",
3
- "version": "0.0.38",
3
+ "version": "0.0.41",
4
4
  "private": false,
5
5
  "description": "Project template generator for YKDZ starter projects.",
6
6
  "keywords": [
@@ -45,9 +45,10 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
+ "@valibot/to-json-schema": "^1.8.0",
49
+ "@ykdz/cli-contract": "0.2.1",
48
50
  "@ykdz/template-builtin-presets": "0.0.0",
49
51
  "@ykdz/template-core": "0.0.0",
50
- "commander": "^15.0.0",
51
52
  "hosted-git-info": "^10.0.0",
52
53
  "lru-cache": "^11.5.3",
53
54
  "node-diff3": "^3.2.1",
@@ -70,9 +71,10 @@
70
71
  "vitest": "^5.0.0"
71
72
  },
72
73
  "bundleDependencies": [
74
+ "@valibot/to-json-schema",
75
+ "@ykdz/cli-contract",
73
76
  "@ykdz/template-builtin-presets",
74
77
  "@ykdz/template-core",
75
- "commander",
76
78
  "hosted-git-info",
77
79
  "lru-cache",
78
80
  "node-diff3",
@@ -1,9 +0,0 @@
1
- import { type BlueprintValidationCommandResult, type InitCommandResult, type PackageAdditionCommandResult, type PresetCatalogCommandResult } from "./application.ts";
2
- export type TemplateCommandResult = PresetCatalogCommandResult | BlueprintValidationCommandResult | InitCommandResult | PackageAdditionCommandResult;
3
- export type CommandPresentation = {
4
- readonly destination: "stdout" | "stderr";
5
- readonly text: string;
6
- readonly exitCode: 0 | 1 | 2 | 64 | 65;
7
- };
8
- /** 纯投影;main 拥有身份前缀和实际流写入。 */
9
- export declare function projectCommandResult(result: TemplateCommandResult, json: boolean, cliVersion: string): CommandPresentation;
@@ -1,231 +0,0 @@
1
- import {} from "./application.js";
2
- /** 纯投影;main 拥有身份前缀和实际流写入。 */
3
- export function projectCommandResult(result, json, cliVersion) {
4
- const exitCode = exitCodeFor(result);
5
- if (json) {
6
- return {
7
- destination: "stdout",
8
- text: `${JSON.stringify({ ...result, cliVersion })}\n`,
9
- exitCode,
10
- };
11
- }
12
- return {
13
- destination: exitCode === 0 ? "stdout" : "stderr",
14
- text: `${formatHuman(result)}\n`,
15
- exitCode,
16
- };
17
- }
18
- function exitCodeFor(result) {
19
- if (result.command === "presets")
20
- return 0;
21
- if (result.command === "blueprint validate") {
22
- return result.status === "success"
23
- ? 0
24
- : result.status === "invalid"
25
- ? 1
26
- : 65;
27
- }
28
- switch (result.status) {
29
- case "success":
30
- return 0;
31
- case "conflict":
32
- return 1;
33
- case "cancelled":
34
- return 2;
35
- case "usage-error":
36
- return 64;
37
- case "operation-failure":
38
- return 65;
39
- }
40
- }
41
- function formatHuman(result) {
42
- if (result.command === "presets")
43
- return formatPresets(result);
44
- if (result.command === "blueprint validate")
45
- return formatBlueprint(result);
46
- if (result.command === "init")
47
- return formatInit(result);
48
- return formatAddition(result);
49
- }
50
- function formatInit(result) {
51
- switch (result.status) {
52
- case "success":
53
- return [
54
- result.dryRun ? "项目生成预览" : "已初始化项目",
55
- "",
56
- ...rows([
57
- ["预设", result.resolved.preset],
58
- ["名称", result.resolved.packages.map(({ name }) => name).join(", ")],
59
- ["路径", result.resolved.packages.map(({ path }) => path).join(", ")],
60
- ["Scope", result.resolved.scope],
61
- ["目标", result.targetDir],
62
- ]),
63
- ...(result.dryRun
64
- ? []
65
- : [
66
- "",
67
- "下一步",
68
- "",
69
- ...result.nextSteps.map((item, index) => ` ${index + 1}. ${item.display}`),
70
- ]),
71
- ...(result.publicationSetup === null
72
- ? []
73
- : [
74
- "",
75
- "一次性 npm 发布设置",
76
- "",
77
- ` ${result.publicationSetup.command}`,
78
- ]),
79
- ].join("\n");
80
- case "cancelled":
81
- return "已取消初始化;没有写入目标目录。";
82
- case "usage-error":
83
- return [
84
- `错误 [${result.code}]: 初始化参数无效。`,
85
- ...result.issues.map((issue) => ` ${initIssueMessage(issue.code)}`),
86
- "建议: 修正上述输入后重新运行初始化。",
87
- ].join("\n");
88
- case "operation-failure":
89
- return [
90
- `错误 [${result.code}]: ${result.error.message}`,
91
- `目标: ${result.targetDir}`,
92
- `建议: ${result.error.suggestion}`,
93
- ].join("\n");
94
- }
95
- }
96
- function rows(items) {
97
- const width = Math.max(...items.map(([label]) => `${label}:`.length));
98
- return items.map(([label, value]) => ` ${`${label}:`.padEnd(width)} ${value}`);
99
- }
100
- function initIssueMessage(code) {
101
- switch (code) {
102
- case "PRESET_UNKNOWN":
103
- return "--preset 必须指定一个已支持的内置预设。";
104
- case "FIXED_TOPOLOGY_OVERRIDE":
105
- return "该预设使用固定初始包拓扑,不能同时使用 --name 或 --path。";
106
- case "INVALID_PACKAGE_NAME":
107
- return "--name 必须是有效的无 scope 包叶名称。";
108
- case "INVALID_PACKAGE_PATH":
109
- return "--path 必须恰好包含两个安全路径段。";
110
- case "RESERVED_PACKAGE_PATH":
111
- return "--path 不能使用保留的工作区集合。";
112
- case "INVALID_PACKAGE_SCOPE":
113
- return "--scope 必须是不含空白字符的有效 npm scope。";
114
- case "INVALID_REPOSITORY_SCOPE":
115
- return "目标目录名不能作为默认包 scope;请传入有效的 --scope。";
116
- case "CONFLICTING_PACKAGE_IDENTITY":
117
- return "初始包身份不能与 Foundation 的 TypeScript 配置包冲突。";
118
- case "NON_INTERACTIVE_CONFIRMATION_REQUIRED":
119
- return "非交互式初始化必须显式传入 --yes 接受默认值。";
120
- }
121
- }
122
- function formatPresets(result) {
123
- const width = Math.max(...result.presets.map((preset) => `${preset.name}:`.length));
124
- return [
125
- "内置预设",
126
- "",
127
- ...result.presets.map((preset) => ` ${`${preset.name}:`.padEnd(width)} ${preset.title} - ${preset.description}`),
128
- ].join("\n");
129
- }
130
- function formatBlueprint(result) {
131
- switch (result.status) {
132
- case "success":
133
- return "蓝图有效。";
134
- case "invalid":
135
- return [
136
- `错误 [BLUEPRINT_INVALID]: 蓝图无效。`,
137
- "",
138
- ...result.issues.map((issue) => ` ${issue.path}: 该位置的 Blueprint 定义不符合要求;请检查必填字段、数据类型和拓扑约束。`),
139
- "",
140
- "建议: 修正上述 Blueprint 问题后重新验证。",
141
- ].join("\n");
142
- case "operation-failure":
143
- return [
144
- `错误 [${result.code}]: ${result.error.message}`,
145
- `路径: ${result.path}`,
146
- `建议: ${result.error.suggestion}`,
147
- ].join("\n");
148
- }
149
- }
150
- function formatAddition(result) {
151
- switch (result.status) {
152
- case "success":
153
- return [
154
- result.dryRun ? "Package Addition 预览" : "已添加 Package",
155
- "",
156
- ...(result.actions.length === 0
157
- ? ["没有变更。"]
158
- : result.actions.map((action) => ` ${action.action} ${action.path} (${action.driver})`)),
159
- ].join("\n");
160
- case "conflict":
161
- return [
162
- "Package Addition 冲突",
163
- "",
164
- ...result.conflicts.flatMap((conflict) => "kind" in conflict
165
- ? [
166
- ` ${conflict.kind === "missing-link" ? "Package Link" : "Package Identity"}`,
167
- ` 已有: ${conflict.existing.name} (${conflict.existing.path}, ${conflict.existing.role})`,
168
- ` 请求: ${conflict.requested.name} (${conflict.requested.path}, ${conflict.requested.role})`,
169
- ...(conflict.missingLink === undefined
170
- ? []
171
- : [
172
- ` 缺少链接: ${conflict.missingLink.consumerPackagePath} -> ${conflict.missingLink.providerPackagePath}`,
173
- ]),
174
- ]
175
- : [
176
- ` ${conflict.path} (${conflict.driver})`,
177
- ...(conflict.location === undefined
178
- ? []
179
- : [` 位置: ${conflict.location || "<文档根>"}`]),
180
- ...(conflict.region === undefined
181
- ? []
182
- : [
183
- ` 区域: 生成前第 ${conflict.region.before.startLine} 行;当前第 ${conflict.region.current.startLine} 行;请求后第 ${conflict.region.after.startLine} 行`,
184
- ]),
185
- ...(conflict.attribute === undefined
186
- ? []
187
- : [` 属性: ${conflict.attribute}`]),
188
- ` 原因: ${conflict.reason}`,
189
- ` 生成前: ${conflict.context.before}`,
190
- ` 当前: ${conflict.context.current}`,
191
- ` 请求后: ${conflict.context.after}`,
192
- ]),
193
- "",
194
- "建议: 处理冲突后重试;命令没有写入工作区。",
195
- ].join("\n");
196
- case "usage-error":
197
- return [
198
- `错误 [${result.code}]: Package Addition 输入无效。`,
199
- ...result.issues.map((issue) => ` ${additionIssueMessage(issue.code)}`),
200
- "建议: 修正上述输入后重新运行。",
201
- ].join("\n");
202
- case "operation-failure":
203
- return [
204
- `错误 [${result.code}]: ${result.error.message}`,
205
- `阶段: ${result.phase}`,
206
- `建议: ${result.error.suggestion}`,
207
- ].join("\n");
208
- }
209
- }
210
- function additionIssueMessage(code) {
211
- switch (code) {
212
- case "PRESET_UNKNOWN":
213
- return "未找到该预设;使用 template presets 查看可用预设。";
214
- case "PRESET_NOT_ADDABLE":
215
- return "该预设不支持添加 Package;选择支持 Package Addition 的预设。";
216
- case "INVALID_PACKAGE_NAME":
217
- return "Package 名称必须是有效的小写 npm 叶名称。";
218
- case "INVALID_PACKAGE_PATH":
219
- return "Package 路径必须是两段小写路径,例如 packages/example。";
220
- case "RESERVED_PACKAGE_PATH":
221
- return "Package 路径不能使用保留工作区目录。";
222
- case "INVALID_LINK_FROM":
223
- return "--link-from 必须是两段现有 Package 路径。";
224
- case "RESERVED_LINK_FROM":
225
- return "--link-from 不能使用保留工作区目录。";
226
- case "UNKNOWN_LINK_FROM":
227
- return "--link-from 指向的 consumer Package 不存在;选择 Blueprint 中已有的 Package 路径。";
228
- case "UNSUPPORTED_LINK":
229
- return "该 consumer 与 provider 不支持 Package Link;选择兼容的 Package 角色与公开接口。";
230
- }
231
- }
@@ -1,46 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { readFile, writeFile } from "node:fs/promises";
3
- import path from "node:path";
4
-
5
- import type { CliJourney } from "../journey.ts";
6
-
7
- const journey: CliJourney = {
8
- name: "greet",
9
- modes: ["source", "distribution", "packed"],
10
- async setup(context) {
11
- await writeFile(
12
- path.join(context.workDir, "journey-ready.txt"),
13
- `${context.mode}\n`,
14
- );
15
- },
16
- commands() {
17
- return [
18
- {
19
- name: "valid greeting",
20
- args: ["greet", " Ada Lovelace "],
21
- },
22
- {
23
- name: "invalid greeting",
24
- args: ["greet", " "],
25
- },
26
- ];
27
- },
28
- async assertions({ context, results }) {
29
- assert.equal(
30
- await readFile(path.join(context.workDir, "journey-ready.txt"), "utf8"),
31
- `${context.mode}\n`,
32
- );
33
- assert.deepEqual(results[0], {
34
- commandName: "valid greeting",
35
- exitCode: 0,
36
- stdout: "Hello, Ada Lovelace\n",
37
- stderr: "",
38
- });
39
- assert.equal(results[1]?.commandName, "invalid greeting");
40
- assert.equal(results[1]?.exitCode, 1);
41
- assert.equal(results[1]?.stdout, "");
42
- assert.match(results[1]?.stderr ?? "", /error: Name must not be empty/u);
43
- },
44
- };
45
-
46
- export default journey;
@@ -1,15 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
-
3
- import { greet } from "../../src/main.ts";
4
-
5
- describe("greet", () => {
6
- it("normalizes a name and returns a deterministic greeting", () => {
7
- expect(greet(" Ada Lovelace ")).toEqual({
8
- message: "Hello, Ada Lovelace",
9
- });
10
- });
11
-
12
- it("rejects an empty normalized name", () => {
13
- expect(() => greet(" ")).toThrow("Name must not be empty");
14
- });
15
- });
@@ -1,22 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- 'Software'), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.