@hydranium/cli 1.0.0-next.42 → 1.0.0-next.420

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 (371) hide show
  1. package/README.md +125 -204
  2. package/bin/hydranium-cli.js +13 -0
  3. package/heap-analysis/heap/core/load.mjs +2 -2
  4. package/heap-analysis/heap/langium/langium.classifier.mjs +22 -11
  5. package/lib/cli-version.js.map +1 -1
  6. package/lib/cli.js +11 -2
  7. package/lib/cli.js.map +1 -1
  8. package/lib/commands/analyze-heap-args.d.ts.map +1 -1
  9. package/lib/commands/analyze-heap-args.js +1 -2
  10. package/lib/commands/analyze-heap-args.js.map +1 -1
  11. package/lib/commands/analyze-heap.d.ts +3 -0
  12. package/lib/commands/analyze-heap.d.ts.map +1 -1
  13. package/lib/commands/analyze-heap.js +2 -1
  14. package/lib/commands/analyze-heap.js.map +1 -1
  15. package/lib/commands/ast-ground-truth-args.d.ts +3 -2
  16. package/lib/commands/ast-ground-truth-args.d.ts.map +1 -1
  17. package/lib/commands/ast-ground-truth-args.js +12 -10
  18. package/lib/commands/ast-ground-truth-args.js.map +1 -1
  19. package/lib/commands/ast-ground-truth-driver.js +4 -2
  20. package/lib/commands/ast-ground-truth-driver.js.map +1 -1
  21. package/lib/commands/ast-ground-truth.js +1 -1
  22. package/lib/commands/ast-ground-truth.js.map +1 -1
  23. package/lib/commands/check-skills-args.d.ts +11 -0
  24. package/lib/commands/check-skills-args.d.ts.map +1 -0
  25. package/lib/commands/check-skills-args.js +71 -0
  26. package/lib/commands/check-skills-args.js.map +1 -0
  27. package/lib/commands/client-session.d.ts +17 -0
  28. package/lib/commands/client-session.d.ts.map +1 -0
  29. package/lib/commands/client-session.js +27 -0
  30. package/lib/commands/client-session.js.map +1 -0
  31. package/lib/commands/create-args.d.ts +17 -0
  32. package/lib/commands/create-args.d.ts.map +1 -0
  33. package/lib/commands/create-args.js +53 -0
  34. package/lib/commands/create-args.js.map +1 -0
  35. package/lib/commands/create.d.ts +38 -0
  36. package/lib/commands/create.d.ts.map +1 -0
  37. package/lib/commands/create.js +43 -0
  38. package/lib/commands/create.js.map +1 -0
  39. package/lib/commands/delete-args.d.ts +17 -0
  40. package/lib/commands/delete-args.d.ts.map +1 -0
  41. package/lib/commands/delete-args.js +49 -0
  42. package/lib/commands/delete-args.js.map +1 -0
  43. package/lib/commands/delete.d.ts +30 -0
  44. package/lib/commands/delete.d.ts.map +1 -0
  45. package/lib/commands/delete.js +32 -0
  46. package/lib/commands/delete.js.map +1 -0
  47. package/lib/commands/generate-ast-builder.d.ts +1 -1
  48. package/lib/commands/generate-ast-builder.d.ts.map +1 -1
  49. package/lib/commands/generate-ast-builder.js +2 -11
  50. package/lib/commands/generate-ast-builder.js.map +1 -1
  51. package/lib/commands/generate-languages.d.ts +35 -0
  52. package/lib/commands/generate-languages.d.ts.map +1 -0
  53. package/lib/commands/generate-languages.js +105 -0
  54. package/lib/commands/generate-languages.js.map +1 -0
  55. package/lib/commands/generate-transfer-builder.d.ts +33 -0
  56. package/lib/commands/generate-transfer-builder.d.ts.map +1 -0
  57. package/lib/commands/generate-transfer-builder.js +86 -0
  58. package/lib/commands/generate-transfer-builder.js.map +1 -0
  59. package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
  60. package/lib/commands/generate-transfer-model-args.js +20 -5
  61. package/lib/commands/generate-transfer-model-args.js.map +1 -1
  62. package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
  63. package/lib/commands/generate-transfer-model-config.js +8 -3
  64. package/lib/commands/generate-transfer-model-config.js.map +1 -1
  65. package/lib/commands/generate-transfer-model.d.ts +41 -9
  66. package/lib/commands/generate-transfer-model.d.ts.map +1 -1
  67. package/lib/commands/generate-transfer-model.js +225 -68
  68. package/lib/commands/generate-transfer-model.js.map +1 -1
  69. package/lib/commands/generated-module-path.d.ts +16 -0
  70. package/lib/commands/generated-module-path.d.ts.map +1 -0
  71. package/lib/commands/generated-module-path.js +21 -0
  72. package/lib/commands/generated-module-path.js.map +1 -0
  73. package/lib/commands/harness-args.d.ts +46 -43
  74. package/lib/commands/harness-args.d.ts.map +1 -1
  75. package/lib/commands/harness-args.js +170 -29
  76. package/lib/commands/harness-args.js.map +1 -1
  77. package/lib/commands/headless-harness.d.ts +37 -20
  78. package/lib/commands/headless-harness.d.ts.map +1 -1
  79. package/lib/commands/headless-harness.js +71 -19
  80. package/lib/commands/headless-harness.js.map +1 -1
  81. package/lib/commands/init-args.d.ts +5 -18
  82. package/lib/commands/init-args.d.ts.map +1 -1
  83. package/lib/commands/init-args.js +131 -35
  84. package/lib/commands/init-args.js.map +1 -1
  85. package/lib/commands/init-hosts.d.ts +24 -0
  86. package/lib/commands/init-hosts.d.ts.map +1 -0
  87. package/lib/commands/init-hosts.js +37 -0
  88. package/lib/commands/init-hosts.js.map +1 -0
  89. package/lib/commands/init-prompt.d.ts +3 -3
  90. package/lib/commands/init-prompt.d.ts.map +1 -1
  91. package/lib/commands/init-prompt.js +4 -5
  92. package/lib/commands/init-prompt.js.map +1 -1
  93. package/lib/commands/init-skills.d.ts +41 -0
  94. package/lib/commands/init-skills.d.ts.map +1 -0
  95. package/lib/commands/init-skills.js +110 -0
  96. package/lib/commands/init-skills.js.map +1 -0
  97. package/lib/commands/init-templates.d.ts +20 -14
  98. package/lib/commands/init-templates.d.ts.map +1 -1
  99. package/lib/commands/init-templates.js +3107 -759
  100. package/lib/commands/init-templates.js.map +1 -1
  101. package/lib/commands/init-wizard.d.ts +10 -0
  102. package/lib/commands/init-wizard.d.ts.map +1 -1
  103. package/lib/commands/init-wizard.js +76 -31
  104. package/lib/commands/init-wizard.js.map +1 -1
  105. package/lib/commands/init-workspace.d.ts +13 -11
  106. package/lib/commands/init-workspace.d.ts.map +1 -1
  107. package/lib/commands/init-workspace.js +21 -7
  108. package/lib/commands/init-workspace.js.map +1 -1
  109. package/lib/commands/init.d.ts +61 -24
  110. package/lib/commands/init.d.ts.map +1 -1
  111. package/lib/commands/init.js +244 -50
  112. package/lib/commands/init.js.map +1 -1
  113. package/lib/commands/kebab.d.ts +15 -0
  114. package/lib/commands/kebab.d.ts.map +1 -0
  115. package/lib/commands/kebab.js +17 -0
  116. package/lib/commands/kebab.js.map +1 -0
  117. package/lib/commands/lint-grammar-args.d.ts +3 -2
  118. package/lib/commands/lint-grammar-args.d.ts.map +1 -1
  119. package/lib/commands/lint-grammar-args.js +14 -11
  120. package/lib/commands/lint-grammar-args.js.map +1 -1
  121. package/lib/commands/lint-grammar-driver.js +2 -1
  122. package/lib/commands/lint-grammar-driver.js.map +1 -1
  123. package/lib/commands/lint-grammar-report.js.map +1 -1
  124. package/lib/commands/lint-grammar.js +1 -1
  125. package/lib/commands/lint-grammar.js.map +1 -1
  126. package/lib/commands/measure-memory-args.d.ts +3 -2
  127. package/lib/commands/measure-memory-args.d.ts.map +1 -1
  128. package/lib/commands/measure-memory-args.js +26 -14
  129. package/lib/commands/measure-memory-args.js.map +1 -1
  130. package/lib/commands/measure-memory-driver.js +5 -3
  131. package/lib/commands/measure-memory-driver.js.map +1 -1
  132. package/lib/commands/measure-memory.d.ts +1 -1
  133. package/lib/commands/measure-memory.d.ts.map +1 -1
  134. package/lib/commands/measure-memory.js +6 -3
  135. package/lib/commands/measure-memory.js.map +1 -1
  136. package/lib/commands/message-catalogue-args.d.ts +16 -0
  137. package/lib/commands/message-catalogue-args.d.ts.map +1 -0
  138. package/lib/commands/message-catalogue-args.js +53 -0
  139. package/lib/commands/message-catalogue-args.js.map +1 -0
  140. package/lib/commands/message-catalogue.d.ts +21 -0
  141. package/lib/commands/message-catalogue.d.ts.map +1 -0
  142. package/lib/commands/message-catalogue.js +48 -0
  143. package/lib/commands/message-catalogue.js.map +1 -0
  144. package/lib/commands/model-docs-args.d.ts +4 -3
  145. package/lib/commands/model-docs-args.d.ts.map +1 -1
  146. package/lib/commands/model-docs-args.js +13 -11
  147. package/lib/commands/model-docs-args.js.map +1 -1
  148. package/lib/commands/model-docs-driver.js +2 -1
  149. package/lib/commands/model-docs-driver.js.map +1 -1
  150. package/lib/commands/model-docs.js +1 -1
  151. package/lib/commands/model-docs.js.map +1 -1
  152. package/lib/commands/projects-args.d.ts.map +1 -1
  153. package/lib/commands/projects-args.js +5 -5
  154. package/lib/commands/projects-args.js.map +1 -1
  155. package/lib/commands/projects.d.ts +3 -4
  156. package/lib/commands/projects.d.ts.map +1 -1
  157. package/lib/commands/projects.js +2 -2
  158. package/lib/commands/projects.js.map +1 -1
  159. package/lib/commands/query-args.d.ts.map +1 -1
  160. package/lib/commands/query-args.js +6 -5
  161. package/lib/commands/query-args.js.map +1 -1
  162. package/lib/commands/query.d.ts +6 -5
  163. package/lib/commands/query.d.ts.map +1 -1
  164. package/lib/commands/query.js +5 -4
  165. package/lib/commands/query.js.map +1 -1
  166. package/lib/commands/reflect-args.d.ts +3 -2
  167. package/lib/commands/reflect-args.d.ts.map +1 -1
  168. package/lib/commands/reflect-args.js +14 -11
  169. package/lib/commands/reflect-args.js.map +1 -1
  170. package/lib/commands/reflect-driver.js +2 -1
  171. package/lib/commands/reflect-driver.js.map +1 -1
  172. package/lib/commands/reflect-report.js.map +1 -1
  173. package/lib/commands/reflect.js +1 -1
  174. package/lib/commands/reflect.js.map +1 -1
  175. package/lib/commands/save-args.d.ts.map +1 -1
  176. package/lib/commands/save-args.js +7 -4
  177. package/lib/commands/save-args.js.map +1 -1
  178. package/lib/commands/save.d.ts +8 -4
  179. package/lib/commands/save.d.ts.map +1 -1
  180. package/lib/commands/save.js +12 -23
  181. package/lib/commands/save.js.map +1 -1
  182. package/lib/commands/skills.d.ts +22 -0
  183. package/lib/commands/skills.d.ts.map +1 -0
  184. package/lib/commands/skills.js +129 -0
  185. package/lib/commands/skills.js.map +1 -0
  186. package/lib/commands/validate-args.d.ts +3 -2
  187. package/lib/commands/validate-args.d.ts.map +1 -1
  188. package/lib/commands/validate-args.js +14 -11
  189. package/lib/commands/validate-args.js.map +1 -1
  190. package/lib/commands/validate-driver.js +2 -1
  191. package/lib/commands/validate-driver.js.map +1 -1
  192. package/lib/commands/validate-report.js.map +1 -1
  193. package/lib/commands/validate.js +1 -1
  194. package/lib/commands/validate.js.map +1 -1
  195. package/lib/commands/watch-args.d.ts.map +1 -1
  196. package/lib/commands/watch-args.js +6 -4
  197. package/lib/commands/watch-args.js.map +1 -1
  198. package/lib/commands/watch.d.ts +3 -4
  199. package/lib/commands/watch.d.ts.map +1 -1
  200. package/lib/commands/watch.js +5 -2
  201. package/lib/commands/watch.js.map +1 -1
  202. package/lib/driver-heap.d.ts +52 -0
  203. package/lib/driver-heap.d.ts.map +1 -0
  204. package/lib/driver-heap.js +51 -0
  205. package/lib/driver-heap.js.map +1 -0
  206. package/lib/index.d.ts +3 -0
  207. package/lib/index.d.ts.map +1 -1
  208. package/lib/index.js +3 -0
  209. package/lib/index.js.map +1 -1
  210. package/lib/log-level.d.ts +21 -11
  211. package/lib/log-level.d.ts.map +1 -1
  212. package/lib/log-level.js +25 -14
  213. package/lib/log-level.js.map +1 -1
  214. package/lib/spawn-data-server.d.ts +9 -4
  215. package/lib/spawn-data-server.d.ts.map +1 -1
  216. package/lib/spawn-data-server.js +5 -4
  217. package/lib/spawn-data-server.js.map +1 -1
  218. package/lib/stderr-connection-logger.d.ts +12 -0
  219. package/lib/stderr-connection-logger.d.ts.map +1 -0
  220. package/lib/stderr-connection-logger.js +16 -0
  221. package/lib/stderr-connection-logger.js.map +1 -0
  222. package/lib/testing/echo-server.js +9 -1
  223. package/lib/testing/echo-server.js.map +1 -1
  224. package/package.json +99 -41
  225. package/src/cli.ts +11 -2
  226. package/src/commands/analyze-heap-args.ts +1 -2
  227. package/src/commands/analyze-heap.ts +4 -1
  228. package/src/commands/ast-ground-truth-args.ts +16 -13
  229. package/src/commands/ast-ground-truth-driver.ts +4 -2
  230. package/src/commands/ast-ground-truth.ts +1 -1
  231. package/src/commands/check-skills-args.ts +70 -0
  232. package/src/commands/client-session.ts +33 -0
  233. package/src/commands/create-args.ts +68 -0
  234. package/src/commands/create.ts +83 -0
  235. package/src/commands/delete-args.ts +64 -0
  236. package/src/commands/delete.ts +61 -0
  237. package/src/commands/generate-ast-builder.ts +2 -12
  238. package/src/commands/generate-languages.ts +132 -0
  239. package/src/commands/generate-transfer-builder.ts +101 -0
  240. package/src/commands/generate-transfer-model-args.ts +20 -5
  241. package/src/commands/generate-transfer-model-config.ts +8 -3
  242. package/src/commands/generate-transfer-model.ts +297 -66
  243. package/src/commands/generated-module-path.ts +22 -0
  244. package/src/commands/harness-args.ts +163 -33
  245. package/src/commands/headless-harness.ts +89 -28
  246. package/src/commands/init-args.ts +135 -35
  247. package/src/commands/init-hosts.ts +51 -0
  248. package/src/commands/init-prompt.ts +5 -6
  249. package/src/commands/init-skills.ts +129 -0
  250. package/src/commands/init-templates.ts +3300 -785
  251. package/src/commands/init-wizard.ts +97 -32
  252. package/src/commands/init-workspace.ts +31 -16
  253. package/src/commands/init.ts +311 -65
  254. package/src/commands/kebab.ts +17 -0
  255. package/src/commands/lint-grammar-args.ts +18 -14
  256. package/src/commands/lint-grammar-driver.ts +2 -1
  257. package/src/commands/lint-grammar.ts +1 -1
  258. package/src/commands/measure-memory-args.ts +31 -17
  259. package/src/commands/measure-memory-driver.ts +5 -3
  260. package/src/commands/measure-memory.ts +6 -3
  261. package/src/commands/message-catalogue-args.ts +55 -0
  262. package/src/commands/message-catalogue.ts +56 -0
  263. package/src/commands/model-docs-args.ts +17 -14
  264. package/src/commands/model-docs-driver.ts +2 -1
  265. package/src/commands/model-docs.ts +1 -1
  266. package/src/commands/projects-args.ts +5 -4
  267. package/src/commands/projects.ts +4 -6
  268. package/src/commands/query-args.ts +6 -4
  269. package/src/commands/query.ts +9 -9
  270. package/src/commands/reflect-args.ts +18 -14
  271. package/src/commands/reflect-driver.ts +2 -1
  272. package/src/commands/reflect.ts +1 -1
  273. package/src/commands/save-args.ts +7 -3
  274. package/src/commands/save.ts +24 -27
  275. package/src/commands/skills.ts +146 -0
  276. package/src/commands/validate-args.ts +18 -14
  277. package/src/commands/validate-driver.ts +2 -1
  278. package/src/commands/validate.ts +1 -1
  279. package/src/commands/watch-args.ts +6 -3
  280. package/src/commands/watch.ts +7 -6
  281. package/src/driver-heap.ts +65 -0
  282. package/src/index.ts +3 -0
  283. package/src/log-level.ts +42 -14
  284. package/src/spawn-data-server.ts +17 -5
  285. package/src/stderr-connection-logger.ts +18 -0
  286. package/src/testing/echo-server.ts +11 -2
  287. package/templates/client/gitignore +3 -0
  288. package/templates/client/src/__GRAMMAR_ID__-diagram-module.ts +82 -0
  289. package/templates/editorconfig +15 -0
  290. package/templates/gitignore +1 -0
  291. package/templates/host-browser/esbuild.mjs +82 -0
  292. package/templates/host-browser/gitignore +4 -0
  293. package/templates/host-browser/hydranium-mark.svg +40 -0
  294. package/templates/host-browser/index.html +287 -0
  295. package/templates/host-browser/playwright.config.mts +24 -0
  296. package/templates/host-browser/src/data-status.ts +15 -0
  297. package/templates/host-browser/src/diagram-save.ts +60 -0
  298. package/templates/host-browser/src/diagram.ts +121 -0
  299. package/templates/host-browser/src/editor.ts +116 -0
  300. package/templates/host-browser/src/log.ts +14 -0
  301. package/templates/host-browser/src/monaco-editor-core-worker.d.ts +7 -0
  302. package/templates/host-browser/src/monaco-editor-worker.ts +10 -0
  303. package/templates/host-browser/src/posix-path-shim.ts +23 -0
  304. package/templates/host-browser/src/shown-file.ts +61 -0
  305. package/templates/host-browser/src/workspace.ts +5 -0
  306. package/templates/host-browser/tsconfig.e2e.json +16 -0
  307. package/templates/host-browser/tsconfig.page.json +16 -0
  308. package/templates/host-browser/tsconfig.worker.json +16 -0
  309. package/templates/host-theia-browser/esbuild.mjs +24 -0
  310. package/templates/host-theia-browser/gitignore +9 -0
  311. package/templates/host-theia-browser/playwright.config.mts +42 -0
  312. package/templates/host-theia-browser/start.mjs +50 -0
  313. package/templates/host-theia-browser/tsconfig.e2e.json +16 -0
  314. package/templates/host-theia-electron/esbuild.mjs +27 -0
  315. package/templates/host-theia-electron/gitignore +8 -0
  316. package/templates/host-theia-electron/playwright.config.mts +12 -0
  317. package/templates/host-theia-electron/start.mjs +47 -0
  318. package/templates/host-theia-electron/tsconfig.e2e.json +16 -0
  319. package/templates/host-vscode/esbuild.mjs +38 -0
  320. package/templates/host-vscode/gitignore +7 -0
  321. package/templates/host-vscode/playwright.config.mts +14 -0
  322. package/templates/host-vscode/src/__GRAMMAR_ID__-diagram-editor.ts +19 -0
  323. package/templates/host-vscode/src/show-model-command.ts +24 -0
  324. package/templates/host-vscode/src/webview/__GRAMMAR_ID__-diagram.ts +18 -0
  325. package/templates/host-vscode/src/webview/diagram.css +40 -0
  326. package/templates/host-vscode/start.mjs +22 -0
  327. package/templates/host-vscode/test/content-server.cjs +40 -0
  328. package/templates/host-vscode/test/install-vscode.mts +21 -0
  329. package/templates/host-vscode/test/virtual-documents.spec.mts +28 -0
  330. package/templates/host-vscode/test/vscode-version.mts +10 -0
  331. package/templates/host-vscode/tsconfig.e2e.json +17 -0
  332. package/templates/host-vscode/tsconfig.json +19 -0
  333. package/templates/host-vscode/tsconfig.webview.json +17 -0
  334. package/templates/oxlintrc.json +4 -0
  335. package/templates/protocol/gitignore +3 -0
  336. package/templates/protocol/src/__GRAMMAR_ID__-diagram-types.ts +47 -0
  337. package/templates/server/gitignore +6 -0
  338. package/templates/server/src/glsp/__GRAMMAR_ID__/create-node-operation-handler.ts +62 -0
  339. package/templates/server/src/glsp/__GRAMMAR_ID__/delete-operation-handler.ts +63 -0
  340. package/templates/server/src/glsp/__GRAMMAR_ID__/gmodel-factory.ts +144 -0
  341. package/templates/server/src/glsp/__GRAMMAR_ID__/state.ts +18 -0
  342. package/templates/server/src/glsp/__GRAMMAR_ID__/storage.ts +16 -0
  343. package/templates/server/src/glsp/__GRAMMAR_ID__/submission-handler.ts +24 -0
  344. package/templates/server/src/grammar/common.langium +12 -0
  345. package/templates/server/src/language-server/__GRAMMAR_ID__-semantic-tokens.ts +10 -0
  346. package/templates/server/src/language-server/__GRAMMAR_ID__-serializer.ts +53 -0
  347. package/templates/server/src/language-server/__GRAMMAR_ID__-validation.ts +30 -0
  348. package/templates/server/src/language-server/ast.ts +23 -0
  349. package/templates/server/src/node/services.ts +16 -0
  350. package/templates/server/test/__GRAMMAR_ID__-diagram.test.ts +403 -0
  351. package/templates/server/test/__GRAMMAR_ID__-semantic-tokens.test.ts +34 -0
  352. package/templates/server/test/tsconfig.json +4 -0
  353. package/templates/server/tsconfig.test.json +10 -0
  354. package/templates/server/vitest.config.ts +14 -0
  355. package/templates/theia/gitignore +3 -0
  356. package/templates/theia/src/browser/__GRAMMAR_ID__-diagram-frontend-module.ts +65 -0
  357. package/templates/theia/src/browser/__PROJECT_ID__-connection-preload-module.ts +15 -0
  358. package/templates/theia/src/browser/__PROJECT_ID__-data-connection.ts +15 -0
  359. package/templates/theia/src/browser/__PROJECT_ID__-data-port.ts +11 -0
  360. package/templates/theia/src/browser/__PROJECT_ID__-glsp-client-contribution.ts +13 -0
  361. package/templates/theia/src/browser/__PROJECT_ID__-show-model-command.ts +51 -0
  362. package/templates/theia/src/common/__PROJECT_ID__-glsp-contribution.ts +3 -0
  363. package/templates/theia/src/node/__PROJECT_ID__-connection-backend-module.ts +12 -0
  364. package/templates/theia/src/node/__PROJECT_ID__-data-backend-module.ts +15 -0
  365. package/templates/theia/src/node/__PROJECT_ID__-glsp-backend-module.ts +16 -0
  366. package/templates/theia/style/diagram.css +20 -0
  367. package/templates/theia/tsconfig.json +24 -0
  368. package/templates/vscode-servers/gitignore +4 -0
  369. package/templates/vscode-servers/tsconfig.json +19 -0
  370. package/templates/workspace/nodes.__EXTENSION__ +5 -0
  371. package/templates/workspace/references.__EXTENSION__ +2 -0
@@ -39,6 +39,9 @@
39
39
  * posture rather than a packaging detail: the emission withholds publication
40
40
  * AND declares itself UNLICENSED, so a default nobody was shown would settle
41
41
  * the licence question by silence.
42
+ * - **installation**, which opts into network access and lifecycle scripts.
43
+ * Workspace members need parent-manifest edits first, so only standalone
44
+ * projects offer it, unless the caller already supplied `--install`.
42
45
  *
43
46
  * The **language id is deliberately not asked**, though it is the third of the
44
47
  * three independent names: its derivation was settled and built separately
@@ -55,8 +58,10 @@
55
58
  */
56
59
 
57
60
  import * as path from 'node:path';
58
- import { DEFAULT_INIT_HEADS, INIT_HEADS, type InitHead, isNonEmptyDir, kebab } from './init.js';
59
- import { InitWizardCancelled, OPTIONAL_HEAD_CHOICES, type PromptPort } from './init-prompt.js';
61
+ import { DEFAULT_INIT_HEADS, INIT_HEADS, type InitHead, initMembers, isNonEmptyDir, isUsableExtension, memberPlacements } from './init.js';
62
+ import { editingHeads, INIT_HOSTS, type InitHost } from './init-hosts.js';
63
+ import { kebab } from './kebab.js';
64
+ import { HEAD_CHOICES, InitWizardCancelled, type PromptPort } from './init-prompt.js';
60
65
  import { type WorkspaceDetection } from './init-workspace.js';
61
66
 
62
67
  /** One grammar as the wizard collected it. */
@@ -77,6 +82,8 @@ export interface InitAnswers {
77
82
  readonly name: string;
78
83
  /** The protocol heads to start. */
79
84
  readonly heads: readonly InitHead[];
85
+ /** The host applications to emit around the server. */
86
+ readonly hosts: readonly InitHost[];
80
87
  /** The grammars, in the order they were given. */
81
88
  readonly grammars: readonly InitGrammarAnswer[];
82
89
  /** Scaffold into a non-empty directory anyway. */
@@ -87,6 +94,10 @@ export interface InitAnswers {
87
94
  readonly scope?: string;
88
95
  /** Leave the package publishable, which the scaffold does not do by default. */
89
96
  readonly public: boolean;
97
+ /** Run npm install after writing the scaffold. */
98
+ readonly install: boolean;
99
+ readonly skills?: string;
100
+ readonly agents?: string;
90
101
  }
91
102
 
92
103
  /** PascalCase a directory name, splitting on any non-alphanumeric run. */
@@ -117,6 +128,9 @@ export function composeInitArgv(answers: InitAnswers): string[] {
117
128
  if (answers.heads.join(',') !== DEFAULT_INIT_HEADS.join(',')) {
118
129
  argv.push('--heads', answers.heads.join(','));
119
130
  }
131
+ if (answers.hosts.length > 0) {
132
+ argv.push('--hosts', answers.hosts.join(','));
133
+ }
120
134
  const several = answers.grammars.length > 1;
121
135
  for (const grammar of answers.grammars) {
122
136
  // A lone grammar named after the project, taking the derived extension, is
@@ -146,6 +160,12 @@ export function composeInitArgv(answers: InitAnswers): string[] {
146
160
  if (answers.public) {
147
161
  argv.push('--public');
148
162
  }
163
+ if (answers.install) {
164
+ argv.push('--install');
165
+ }
166
+ if (answers.skills !== undefined && answers.agents !== undefined) {
167
+ argv.push('--skills', answers.skills, '--agents', answers.agents);
168
+ }
149
169
  return argv;
150
170
  }
151
171
 
@@ -158,13 +178,13 @@ export function formatCommand(argv: readonly string[]): string {
158
178
  /** Validate a file extension, and reject one another grammar already claims. */
159
179
  function extensionProblem(value: string, taken: ReadonlySet<string>): string | undefined {
160
180
  const extension = value.replace(/^\./, '');
161
- if (!/^[A-Za-z0-9][A-Za-z0-9-]*$/.test(extension)) {
181
+ if (!isUsableExtension(extension)) {
162
182
  return `'${value}' is not a usable file extension.`;
163
183
  }
164
184
  // Checked here rather than left to the scaffolder so the answer is corrected
165
185
  // while the grammar that owns it is still on screen. Langium routes documents
166
186
  // to a language BY extension, so a duplicate is a silent mis-route.
167
- return taken.has(extension) ? `'.${extension}' is already claimed by another grammar.` : undefined;
187
+ return taken.has(extension.toLowerCase()) ? `'.${extension}' is already claimed by another grammar.` : undefined;
168
188
  }
169
189
 
170
190
  /**
@@ -198,31 +218,42 @@ async function askGrammar(
198
218
  return { name, extension: extension.replace(/^\./, ''), diagram: false };
199
219
  }
200
220
 
221
+ /** Ask for the protocol head set, in composition order whatever order they were picked in. */
222
+ async function askHeads(prompt: PromptPort): Promise<InitHead[]> {
223
+ const chosen = await prompt.multiselect({ message: 'Protocol heads', choices: HEAD_CHOICES, initialValues: DEFAULT_INIT_HEADS });
224
+ return INIT_HEADS.filter(head => chosen.includes(head));
225
+ }
226
+
227
+ /** What the wizard asks about each host. */
228
+ const HOST_QUESTIONS: Record<InitHost, string> = {
229
+ browser: 'Add a browser host (every head in a web worker, no backend)?',
230
+ vscode: 'Add a VS Code extension (the language client, Show Model with the data head, and a custom editor per diagram)?',
231
+ 'theia-browser':
232
+ 'Add a Theia browser application (the language client, Show Model with the data head, and a diagram editor per diagram)?',
233
+ 'theia-electron': 'Add a Theia Electron application (the same as the Theia browser application, in a desktop window)?'
234
+ };
235
+
201
236
  /**
202
- * Ask for the protocol head set.
203
- *
204
- * `lsp` is not offered, it is stated: it owns the workspace, the build pipeline
205
- * and the shared tier the other heads read through, so a project without it has
206
- * nothing for them to serve. Presenting it as a checkbox would offer a choice
207
- * the scaffolder then refuses.
237
+ * Ask for each host the head set can run, one yes/no each. A host none of
238
+ * whose editing heads is on is not offered: `init` would refuse it.
208
239
  */
209
- async function askHeads(prompt: PromptPort): Promise<InitHead[]> {
210
- const optional = await prompt.multiselect({
211
- message: 'Protocol heads — lsp is always included',
212
- choices: OPTIONAL_HEAD_CHOICES,
213
- initialValues: DEFAULT_INIT_HEADS.filter((head): head is Exclude<InitHead, 'lsp'> => head !== 'lsp')
214
- });
215
- const chosen = new Set<InitHead>(['lsp', ...optional]);
216
- return INIT_HEADS.filter(head => chosen.has(head));
240
+ async function askHosts(prompt: PromptPort, heads: readonly InitHead[]): Promise<InitHost[]> {
241
+ const hosts: InitHost[] = [];
242
+ for (const host of INIT_HOSTS.filter(candidate => editingHeads(candidate).some(head => heads.includes(head)))) {
243
+ if (await prompt.confirm({ message: HOST_QUESTIONS[host], initialValue: false })) {
244
+ hosts.push(host);
245
+ }
246
+ }
247
+ return hosts;
217
248
  }
218
249
 
219
250
  /**
220
251
  * Mark the grammar a scaffolded diagram edits.
221
252
  *
222
- * Only a real question with `glsp` on AND several grammars: a diagram type
223
- * binds exactly ONE grammar, and with a single grammar the scaffolder derives
224
- * that answer already — so asking would offer a choice whose "no" it would
225
- * silently overrule.
253
+ * Only a real question with `glsp` on AND several grammars: the scaffolded
254
+ * diagram is typed over one grammar's model, and with a single grammar the
255
+ * scaffolder derives that answer already — so asking would offer a choice
256
+ * whose "no" it would silently overrule.
226
257
  */
227
258
  async function askDiagramGrammar(
228
259
  prompt: PromptPort,
@@ -263,15 +294,18 @@ async function confirmOccupiedTarget(prompt: PromptPort, targetDir: string, isOc
263
294
  /** Ask the workspace questions, or answer them "no" when there is no workspace to join. */
264
295
  async function askWorkspaceMembership(
265
296
  prompt: PromptPort,
266
- detection: WorkspaceDetection | undefined
297
+ detection: WorkspaceDetection | undefined,
298
+ heads: readonly InitHead[],
299
+ hosts: readonly InitHost[]
267
300
  ): Promise<{ monorepo: boolean; scope?: string }> {
268
301
  if (detection === undefined) {
269
302
  return { monorepo: false };
270
303
  }
304
+ const uncovered = memberPlacements(detection, initMembers(heads, hosts)).filter(placement => placement.coveredBy === undefined);
271
305
  const covered =
272
- detection.coveredBy === undefined
273
- ? `The root manifest has no entry covering it, so one is printed for you to add.`
274
- : `Already covered by the "${detection.coveredBy}" workspaces entry.`;
306
+ uncovered.length === 0
307
+ ? 'Its packages are already covered by the workspaces entries.'
308
+ : `The root manifest has no entry covering ${uncovered.map(placement => placement.path).join(', ')}, so ${uncovered.length === 1 ? 'one is' : 'they are'} printed for you to add.`;
275
309
  // The placement is named, not just the root. The root alone reads as "this
276
310
  // ran somewhere I did not ask for" whenever the command was issued from a
277
311
  // different directory than the target, which is the normal case.
@@ -310,9 +344,11 @@ async function askWorkspaceMembership(
310
344
  */
311
345
  async function askPackaging(
312
346
  prompt: PromptPort,
313
- detection: WorkspaceDetection | undefined
347
+ detection: WorkspaceDetection | undefined,
348
+ heads: readonly InitHead[],
349
+ hosts: readonly InitHost[]
314
350
  ): Promise<{ monorepo: boolean; scope?: string; public: boolean }> {
315
- const membership = await askWorkspaceMembership(prompt, detection);
351
+ const membership = await askWorkspaceMembership(prompt, detection, heads, hosts);
316
352
  const isPublic = await prompt.confirm({ message: 'Publishable to npm (the manifest says UNLICENSED)?', initialValue: false });
317
353
  return { ...membership, public: isPublic };
318
354
  }
@@ -327,7 +363,13 @@ async function askPackaging(
327
363
  export async function runInitWizard(
328
364
  prompt: PromptPort,
329
365
  detect: (targetDir: string) => WorkspaceDetection | undefined,
330
- options: { readonly targetDir?: string; readonly isOccupied?: (targetDir: string) => boolean } = {}
366
+ options: {
367
+ readonly targetDir?: string;
368
+ readonly isOccupied?: (targetDir: string) => boolean;
369
+ readonly install?: boolean;
370
+ readonly skills?: string;
371
+ readonly agents?: string;
372
+ } = {}
331
373
  ): Promise<string[]> {
332
374
  prompt.intro('Scaffold a Hydranium language project');
333
375
 
@@ -353,6 +395,7 @@ export async function runInitWizard(
353
395
  });
354
396
 
355
397
  const heads = await askHeads(prompt);
398
+ const hosts = await askHosts(prompt, heads);
356
399
 
357
400
  // One grammar at a time, each with its own settings, then an explicit "add
358
401
  // another" — so the single-grammar case costs two keystrokes and the
@@ -364,13 +407,35 @@ export async function runInitWizard(
364
407
  const grammar = await askGrammar(prompt, grammars.length, grammars.length === 0 ? name : undefined, takenNames, takenExtensions);
365
408
  grammars.push(grammar);
366
409
  takenNames.add(grammar.name);
367
- takenExtensions.add(grammar.extension);
410
+ takenExtensions.add(grammar.extension.toLowerCase());
368
411
  } while (await prompt.confirm({ message: 'Add another grammar?', initialValue: false }));
369
412
 
370
413
  const withDiagram = await askDiagramGrammar(prompt, heads, grammars);
371
- const packaging = await askPackaging(prompt, detect(targetDir));
414
+ const detection = detect(targetDir);
415
+ if (options.install && detection !== undefined) {
416
+ prompt.note('--install requires a standalone project; workspace membership is skipped.', 'Installation');
417
+ }
418
+ const packaging = await askPackaging(prompt, options.install ? undefined : detection, heads, hosts);
419
+ const install =
420
+ (options.install ?? false) ||
421
+ (!packaging.monorepo &&
422
+ (await prompt.confirm({
423
+ message: 'Install dependencies now (npm install)?',
424
+ initialValue: false
425
+ })));
372
426
 
373
- const argv = composeInitArgv({ targetDir, name, heads, grammars: withDiagram, force, ...packaging });
427
+ const argv = composeInitArgv({
428
+ targetDir,
429
+ name,
430
+ heads,
431
+ hosts,
432
+ grammars: withDiagram,
433
+ force,
434
+ install,
435
+ skills: options.skills,
436
+ agents: options.agents,
437
+ ...packaging
438
+ });
374
439
  // Echoed as the LAST thing before the scaffold runs, because it is the
375
440
  // artefact the session produces: everything above is how it was reached.
376
441
  prompt.outro(formatCommand(argv));
@@ -169,14 +169,6 @@ export interface WorkspaceDetection {
169
169
  readonly workspaces: readonly string[];
170
170
  /** POSIX path of the target relative to {@link rootDir}, e.g. `packages/foo`. */
171
171
  readonly targetPath: string;
172
- /**
173
- * The `workspaces` glob already covering {@link targetPath}, if any.
174
- *
175
- * Absent means the root manifest needs a new entry — which is why this is
176
- * computed per target rather than assumed: a `packages/*` glob covers a new
177
- * package for free, while a repo that lists its examples one by one does not.
178
- */
179
- readonly coveredBy?: string;
180
172
  /** The npm scope the sibling packages agree on (`@acme`), when they agree. */
181
173
  readonly scope?: string;
182
174
  /**
@@ -186,10 +178,14 @@ export interface WorkspaceDetection {
186
178
  readonly baseTsconfig?: string;
187
179
  /** That tsconfig's `compilerOptions`, so the emitted one can drop what it inherits. */
188
180
  readonly baseCompilerOptions?: Readonly<Record<string, JsonValue>>;
189
- /** The root prettier config's `printWidth`, so emitted sources wrap where the repo wraps. */
181
+ /** The root formatter config's `printWidth`, so emitted sources wrap where the repo wraps. */
190
182
  readonly printWidth?: number;
191
183
  /** Filename of the root eslint config, when there is one. Absent means the repo does not lint. */
192
184
  readonly eslintConfig?: string;
185
+ /** Filename of the root Oxlint config, when present. */
186
+ readonly oxlintConfig?: string;
187
+ /** The npm version the root's `packageManager` field declares, when it names npm. */
188
+ readonly packageManagerNpm?: string;
193
189
  }
194
190
 
195
191
  /**
@@ -339,7 +335,7 @@ export function findBaseTsconfig(
339
335
  }
340
336
 
341
337
  /**
342
- * The repo's prettier `printWidth`, so the emitted sources wrap where the repo
338
+ * The repo's formatter `printWidth`, so the emitted sources wrap where the repo
343
339
  * wraps instead of at the scaffold's own default.
344
340
  *
345
341
  * **Why this is worth detecting at all.** There is no width that is stable for
@@ -360,19 +356,21 @@ export function findBaseTsconfig(
360
356
  * adopter's formatter rewraps on first commit. So a heuristic that is usually
361
357
  * right strictly improves on no detection, and can break nothing.
362
358
  */
363
- export function findPrettierPrintWidth(rootDir: string, probe: WorkspaceProbe): number | undefined {
359
+ export function findFormatterPrintWidth(rootDir: string, probe: WorkspaceProbe): number | undefined {
364
360
  const manifest = probe.readJson(path.join(rootDir, 'package.json'));
365
361
  if (isJsonObject(manifest) && isJsonObject(manifest.prettier) && typeof manifest.prettier.printWidth === 'number') {
366
362
  return manifest.prettier.printWidth;
367
363
  }
368
364
  const present = probe.listFiles(rootDir);
369
- for (const file of present.filter(name => name === '.prettierrc' || name === '.prettierrc.json')) {
365
+ for (const file of present.filter(name => name === '.oxfmtrc.json' || name === '.prettierrc' || name === '.prettierrc.json')) {
370
366
  const parsed = probe.readJson(path.join(rootDir, file));
371
367
  if (isJsonObject(parsed) && typeof parsed.printWidth === 'number') {
372
368
  return parsed.printWidth;
373
369
  }
374
370
  }
375
- for (const file of present.filter(name => /^(\.prettierrc\.[cm]?[jt]s|prettier\.config\.[cm]?[jt]s)$/.test(name))) {
371
+ for (const file of present.filter(name =>
372
+ /^(\.prettierrc\.[cm]?[jt]s|prettier\.config\.[cm]?[jt]s|oxfmt\.config\.[cm]?[jt]s)$/.test(name)
373
+ )) {
376
374
  const width = /\bprintWidth\s*:\s*(\d+)/.exec(probe.readText(path.join(rootDir, file)) ?? '');
377
375
  if (width) {
378
376
  return Number(width[1]);
@@ -398,6 +396,22 @@ export function findEslintConfig(rootDir: string, probe: WorkspaceProbe): string
398
396
  return probe.listFiles(rootDir).find(name => /^eslint\.config\.[cm]?[jt]s$/.test(name) || /^\.eslintrc(\..+)?$/.test(name));
399
397
  }
400
398
 
399
+ /** Detect Oxlint without evaluating executable configuration files. */
400
+ export function findOxlintConfig(rootDir: string, probe: WorkspaceProbe): string | undefined {
401
+ return probe.listFiles(rootDir).find(name => /^(oxlint\.config\.[cm]?[jt]s|\.oxlintrc\.jsonc?)$/.test(name));
402
+ }
403
+
404
+ /** The npm version the root's `packageManager` field declares (`npm@11.15.0` gives `11.15.0`), when it names npm. */
405
+ export function findPackageManagerNpm(rootDir: string, probe: WorkspaceProbe): string | undefined {
406
+ const manifest = probe.readJson(path.join(rootDir, 'package.json'));
407
+ return parseNpmVersion(isJsonObject(manifest) && typeof manifest.packageManager === 'string' ? manifest.packageManager : undefined);
408
+ }
409
+
410
+ /** The npm version, prerelease included, of a `packageManager` field (`npm@…`) or a user agent (`npm/…`); undefined for another tool. */
411
+ export function parseNpmVersion(spec: string | undefined): string | undefined {
412
+ return /^npm[@/](\d+\.\d+\.\d+(?:-[\w.]+)?)/.exec(spec ?? '')?.[1];
413
+ }
414
+
401
415
  /** POSIX-style relative path, which is what both `extends` and `--prefix` want on every platform. */
402
416
  function posixRelative(from: string, to: string): string {
403
417
  return path.relative(from, to).split(path.sep).join('/');
@@ -432,11 +446,12 @@ export function detectWorkspace(targetDir: string, probe: WorkspaceProbe): Works
432
446
  rootDir,
433
447
  workspaces,
434
448
  targetPath,
435
- coveredBy: workspaces.find(glob => workspaceGlobCovers(glob, targetPath)),
436
449
  scope: inferPackageScope(rootDir, workspaces, probe),
437
450
  baseTsconfig: base && posixRelative(absoluteTarget, path.join(rootDir, base.file)),
438
451
  baseCompilerOptions: base?.compilerOptions,
439
- printWidth: findPrettierPrintWidth(rootDir, probe),
440
- eslintConfig: findEslintConfig(rootDir, probe)
452
+ printWidth: findFormatterPrintWidth(rootDir, probe),
453
+ eslintConfig: findEslintConfig(rootDir, probe),
454
+ oxlintConfig: findOxlintConfig(rootDir, probe),
455
+ packageManagerNpm: findPackageManagerNpm(rootDir, probe)
441
456
  };
442
457
  }