@specverse/engines 4.1.28 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/assets/examples/manifests/frontend-only.yaml +3 -6
  2. package/assets/examples/manifests/fullstack-app.yaml +5 -7
  3. package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
  4. package/dist/inference/comprehensive-engine.d.ts.map +1 -1
  5. package/dist/inference/comprehensive-engine.js +3 -19
  6. package/dist/inference/comprehensive-engine.js.map +1 -1
  7. package/dist/inference/core/rule-engine.d.ts +31 -0
  8. package/dist/inference/core/rule-engine.d.ts.map +1 -1
  9. package/dist/inference/core/rule-engine.js +117 -33
  10. package/dist/inference/core/rule-engine.js.map +1 -1
  11. package/dist/inference/core/rule-file-types.d.ts +0 -2
  12. package/dist/inference/core/rule-file-types.d.ts.map +1 -1
  13. package/dist/inference/core/rule-file-types.js +3 -6
  14. package/dist/inference/core/rule-file-types.js.map +1 -1
  15. package/dist/inference/core/rule-loader.d.ts +5 -15
  16. package/dist/inference/core/rule-loader.d.ts.map +1 -1
  17. package/dist/inference/core/rule-loader.js +43 -132
  18. package/dist/inference/core/rule-loader.js.map +1 -1
  19. package/dist/inference/core/types.d.ts +0 -6
  20. package/dist/inference/core/types.d.ts.map +1 -1
  21. package/dist/inference/core/types.js +0 -4
  22. package/dist/inference/core/types.js.map +1 -1
  23. package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
  24. package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
  25. package/dist/inference/logical/generators/component-type-resolver.js +0 -19
  26. package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
  27. package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
  28. package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
  29. package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
  30. package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
  31. package/dist/inference/logical/generators/view-generator.d.ts +4 -14
  32. package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
  33. package/dist/inference/logical/generators/view-generator.js +6 -26
  34. package/dist/inference/logical/generators/view-generator.js.map +1 -1
  35. package/dist/inference/logical/index.d.ts +2 -2
  36. package/dist/inference/logical/index.d.ts.map +1 -1
  37. package/dist/inference/logical/logical-engine.d.ts.map +1 -1
  38. package/dist/inference/logical/logical-engine.js +17 -80
  39. package/dist/inference/logical/logical-engine.js.map +1 -1
  40. package/dist/inference/quint-transpiler.d.ts +5 -3
  41. package/dist/inference/quint-transpiler.d.ts.map +1 -1
  42. package/dist/inference/quint-transpiler.js +11 -6
  43. package/dist/inference/quint-transpiler.js.map +1 -1
  44. package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +3 -3
  45. package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +16 -6
  46. package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
  47. package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +121 -0
  48. package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +78 -0
  49. package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +190 -0
  50. package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +45 -0
  51. package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
  52. package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +46 -0
  53. package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +30 -0
  54. package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
  55. package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
  56. package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +56 -0
  57. package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
  58. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +14 -11
  59. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +11 -3
  60. package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +27 -17
  61. package/dist/libs/instance-factories/shared/path-resolver.js +1 -1
  62. package/dist/realize/index.d.ts.map +1 -1
  63. package/dist/realize/index.js +15 -22
  64. package/dist/realize/index.js.map +1 -1
  65. package/dist/registry/utils/manifest-adapter.d.ts +8 -1
  66. package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
  67. package/dist/registry/utils/manifest-adapter.js +8 -1
  68. package/dist/registry/utils/manifest-adapter.js.map +1 -1
  69. package/libs/instance-factories/applications/react-app-starter.yaml +150 -0
  70. package/libs/instance-factories/applications/templates/generic/main-generator.ts +3 -3
  71. package/libs/instance-factories/applications/templates/react/api-client-generator.ts +16 -6
  72. package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  73. package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
  74. package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +145 -0
  75. package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +175 -0
  76. package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
  77. package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
  78. package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
  79. package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +163 -0
  80. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
  81. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
  82. package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
  83. package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
  84. package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
  85. package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
  86. package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
  87. package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +174 -0
  88. package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
  89. package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +306 -0
  90. package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +60 -0
  91. package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
  92. package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +120 -0
  93. package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +80 -0
  94. package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
  95. package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
  96. package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +47 -0
  97. package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +94 -0
  98. package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +114 -0
  99. package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +72 -0
  100. package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +151 -0
  101. package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
  102. package/libs/instance-factories/cli/templates/commander/command-generator.ts +14 -11
  103. package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +11 -3
  104. package/libs/instance-factories/services/templates/prisma/controller-generator.ts +27 -17
  105. package/libs/instance-factories/shared/path-resolver.ts +8 -2
  106. package/package.json +3 -3
  107. package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
  108. package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
  109. package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
  110. package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
  111. package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
  112. package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
  113. package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
  114. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
  115. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
  116. package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
  117. package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
  118. package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
  119. package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
  120. package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
  121. package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js.bak +0 -244
  122. package/dist/libs/instance-factories/views/index.js +0 -48
  123. package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
  124. package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
  125. package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
  126. package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
  127. package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
  128. package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
  129. package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
  130. package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
  131. package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
  132. package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
  133. package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
  134. package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
  135. package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
  136. package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
  137. package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
  138. package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
  139. package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
  140. package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
  141. package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
  142. package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
  143. package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
  144. package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
  145. package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
  146. package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
  147. package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
  148. package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
  149. package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
  150. package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
  151. package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
  152. package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
  153. package/dist/realize/index.js.bak +0 -758
  154. package/libs/instance-factories/applications/react-app.yaml +0 -186
  155. package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
  156. package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
  157. package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
  158. package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
  159. package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
  160. package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
  161. package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
  162. package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
  163. package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
  164. package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
  165. package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
  166. package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
  167. package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
  168. package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
  169. package/libs/instance-factories/views/README.md +0 -62
  170. package/libs/instance-factories/views/index.d.ts +0 -13
  171. package/libs/instance-factories/views/index.d.ts.map +0 -1
  172. package/libs/instance-factories/views/index.js +0 -18
  173. package/libs/instance-factories/views/index.js.map +0 -1
  174. package/libs/instance-factories/views/index.ts +0 -45
  175. package/libs/instance-factories/views/react-components.yaml +0 -129
  176. package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
  177. package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
  178. package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
  179. package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
  180. package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
  181. package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
  182. package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
  183. package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
  184. package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
  185. package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
  186. package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
  187. package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
  188. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
  189. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
  190. package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
  191. package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
  192. package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
  193. package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
  194. package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
  195. package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
  196. package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
  197. package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
  198. package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
  199. package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
  200. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
  201. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
  202. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
  203. package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
  204. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
  205. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
  206. package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
  207. package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
  208. package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
  209. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
  210. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
  211. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
  212. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
  213. package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
  214. package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
  215. package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
  216. package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
  217. package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
  218. package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
  219. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
  220. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
  221. package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
  222. package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
  223. package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
  224. package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
  225. package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
  226. package/libs/instance-factories/views/templates/shared/index.ts +0 -68
  227. package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
  228. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
  229. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
  230. package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
  231. package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
  232. package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
  233. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
  234. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
  235. package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
  236. package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
  237. package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
@@ -1,244 +0,0 @@
1
- import { existsSync, readdirSync, statSync, mkdirSync, writeFileSync, copyFileSync } from "fs";
2
- import { join, dirname } from "path";
3
- import { fileURLToPath } from "url";
4
- const __generatorDir = dirname(fileURLToPath(import.meta.url));
5
- function generateVSCodeExtension(context) {
6
- const { spec, outputDir } = context;
7
- const extensionDir = join(outputDir || ".", "tools", "vscode-extension");
8
- if (!existsSync(extensionDir)) mkdirSync(extensionDir, { recursive: true });
9
- const distribution = extractDistribution(spec);
10
- let cliCommands = [];
11
- if (distribution?.commands) {
12
- cliCommands = distribution.commands.map((cmd) => {
13
- const parts = (cmd.from || cmd.command || "").split(".");
14
- const name = parts[parts.length - 1] || "unknown";
15
- return {
16
- command: `specverse.${name}`,
17
- title: cmd.title || `${capitalize(name)}: ${cmd.description || ""}`,
18
- category: "SpecVerse"
19
- };
20
- });
21
- }
22
- if (cliCommands.length === 0) {
23
- cliCommands = extractCLICommands(spec);
24
- }
25
- if (cliCommands.length === 0) {
26
- cliCommands = getStandardCommands();
27
- }
28
- const entityTypes = extractEntityTypes(spec);
29
- const specVersion = distribution?.version || spec?.metadata?.version || spec?.version || "4.0.0";
30
- const packageJson = generatePackageJson(cliCommands, entityTypes, specVersion);
31
- if (distribution) {
32
- if (distribution.displayName) packageJson.displayName = distribution.displayName;
33
- if (distribution.publisher) packageJson.publisher = distribution.publisher;
34
- if (distribution.description) packageJson.description = distribution.description;
35
- if (distribution.languages && distribution.languages.length > 0) {
36
- packageJson.contributes.languages = distribution.languages.map((lang) => ({
37
- id: lang.id,
38
- aliases: lang.aliases || [lang.id],
39
- extensions: lang.extensions || [],
40
- configuration: `./language-configuration.json`
41
- }));
42
- packageJson.contributes.grammars = distribution.languages.filter((lang) => lang.grammar).map((lang) => ({
43
- language: lang.id,
44
- scopeName: lang.grammar,
45
- path: `./syntaxes/${lang.id}.tmLanguage.json`
46
- }));
47
- }
48
- if (distribution.themes && distribution.themes.length > 0) {
49
- packageJson.contributes.themes = distribution.themes.map((theme) => ({
50
- label: theme.name,
51
- uiTheme: theme.type === "dark" ? "vs-dark" : theme.type === "light" ? "vs" : "hc-black",
52
- path: `./themes/${theme.name.toLowerCase().replace(/\s+/g, "-")}-theme.json`
53
- }));
54
- }
55
- }
56
- writeFileSync(join(extensionDir, "package.json"), JSON.stringify(packageJson, null, 2) + "\n");
57
- let staticDir = join(__generatorDir, "static");
58
- if (!existsSync(staticDir)) {
59
- staticDir = join(__generatorDir.replace("/dist/libs/", "/libs/"), "static");
60
- }
61
- if (existsSync(staticDir)) {
62
- copyRecursive(staticDir, extensionDir);
63
- }
64
- const srcDir = join(extensionDir, "src");
65
- if (!existsSync(srcDir)) mkdirSync(srcDir, { recursive: true });
66
- const extTs = join(staticDir, "extension.ts");
67
- if (existsSync(extTs)) {
68
- copyFileSync(extTs, join(srcDir, "extension.ts"));
69
- }
70
- const buildScript = `const esbuild = require('esbuild');
71
- esbuild.build({
72
- entryPoints: ['src/extension.ts'],
73
- bundle: true,
74
- outfile: 'dist/extension.js',
75
- external: ['vscode'],
76
- format: 'cjs',
77
- platform: 'node',
78
- }).catch(() => process.exit(1));
79
- `;
80
- const scriptsDir = join(extensionDir, "scripts");
81
- if (!existsSync(scriptsDir)) mkdirSync(scriptsDir, { recursive: true });
82
- writeFileSync(join(scriptsDir, "build.js"), buildScript);
83
- return `VSCode extension generated in: ${extensionDir}
84
- ${cliCommands.length} commands, ${entityTypes.length} entity keywords`;
85
- }
86
- function extractDistribution(spec) {
87
- const allDistributions = [];
88
- if (spec?.distributions) {
89
- const entries = Array.isArray(spec.distributions) ? spec.distributions : Object.entries(spec.distributions).map(([name, data]) => ({ name, ...data }));
90
- allDistributions.push(...entries);
91
- }
92
- const components = spec?.components || {};
93
- const componentList = Array.isArray(components) ? components : Object.values(components);
94
- for (const comp of componentList) {
95
- const distributions = comp?.distributions;
96
- if (!distributions) continue;
97
- const distEntries = Array.isArray(distributions) ? distributions : Object.entries(distributions).map(([name, data]) => ({ name, ...data }));
98
- allDistributions.push(...distEntries);
99
- }
100
- for (const dist of allDistributions) {
101
- if (dist.type === "ide") return dist;
102
- }
103
- return allDistributions.length > 0 ? allDistributions[0] : null;
104
- }
105
- function extractCLICommands(spec) {
106
- const commands = [];
107
- const components = spec?.components || {};
108
- const componentList = Array.isArray(components) ? components : Object.entries(components).map(([name, data]) => ({ name, ...data }));
109
- for (const comp of componentList) {
110
- const cliCommands = comp?.commands;
111
- if (!cliCommands) continue;
112
- for (const [rootName, rootDef] of Object.entries(cliCommands)) {
113
- const subcommands = rootDef?.subcommands || {};
114
- for (const [subName, subDef] of Object.entries(subcommands)) {
115
- const sub = subDef;
116
- const nestedSubs = sub?.subcommands;
117
- if (nestedSubs) {
118
- for (const [nestedName, nestedDef] of Object.entries(nestedSubs)) {
119
- commands.push({
120
- command: `specverse.${subName}.${nestedName}`,
121
- title: `${capitalize(subName)} ${capitalize(nestedName)}: ${nestedDef.description || ""}`,
122
- category: "SpecVerse"
123
- });
124
- }
125
- } else {
126
- commands.push({
127
- command: `specverse.${subName}`,
128
- title: `${capitalize(subName)}: ${sub.description || ""}`,
129
- category: "SpecVerse"
130
- });
131
- }
132
- }
133
- }
134
- }
135
- return commands;
136
- }
137
- function extractEntityTypes(spec) {
138
- const types = /* @__PURE__ */ new Set();
139
- const components = spec?.components || [];
140
- for (const component of Array.isArray(components) ? components : Object.values(components)) {
141
- const comp = component;
142
- const models = comp?.models;
143
- if (models) {
144
- if (Array.isArray(models)) {
145
- models.forEach((m) => types.add(m.name));
146
- } else {
147
- Object.keys(models).forEach((name) => types.add(name));
148
- }
149
- }
150
- }
151
- return [...types];
152
- }
153
- function generatePackageJson(commands, _entityTypes, specVersion = "1.0.0") {
154
- return {
155
- name: "specverse",
156
- displayName: "SpecVerse",
157
- description: "SpecVerse specification language support \u2014 syntax highlighting, validation, IntelliSense",
158
- version: specVersion,
159
- publisher: "specverse",
160
- engines: { vscode: "^1.80.0" },
161
- categories: ["Programming Languages", "Linters", "Snippets"],
162
- activationEvents: ["onLanguage:specverse"],
163
- main: "./dist/extension.js",
164
- contributes: {
165
- languages: [{
166
- id: "specverse",
167
- aliases: ["SpecVerse", "specly"],
168
- extensions: [".specly", ".specverse"],
169
- configuration: "./language-configuration.json"
170
- }],
171
- grammars: [{
172
- language: "specverse",
173
- scopeName: "source.specverse",
174
- path: "./syntaxes/specverse.tmLanguage.json"
175
- }],
176
- jsonValidation: [{
177
- fileMatch: ["*.specly", "*.specverse"],
178
- url: "./schemas/specverse-v3-schema.json"
179
- }],
180
- themes: [
181
- { label: "SpecVerse Dark", uiTheme: "vs-dark", path: "./themes/specverse-complete-theme.json" },
182
- { label: "SpecVerse Basic", uiTheme: "vs-dark", path: "./themes/specverse-basic-theme.json" }
183
- ],
184
- commands: commands.map((c) => ({
185
- command: c.command,
186
- title: c.title,
187
- category: c.category
188
- }))
189
- },
190
- scripts: {
191
- "vscode:prepublish": "npm run build",
192
- build: "node scripts/build.js",
193
- package: "npx @vscode/vsce package"
194
- },
195
- devDependencies: {
196
- "@types/vscode": "^1.80.0",
197
- "@vscode/vsce": "^3.0.0",
198
- esbuild: "^0.25.0"
199
- },
200
- overrides: {
201
- // Force the patched version of lodash through @vscode/vsce →
202
- // @secretlint → @textlint transitive chain (4.17.23 has a
203
- // code-injection advisory in `_.template`).
204
- lodash: "^4.18.1"
205
- }
206
- };
207
- }
208
- function copyRecursive(src, dest) {
209
- for (const entry of readdirSync(src)) {
210
- if (entry === "extension.ts") continue;
211
- const srcPath = join(src, entry);
212
- const destPath = join(dest, entry);
213
- if (statSync(srcPath).isDirectory()) {
214
- if (!existsSync(destPath)) mkdirSync(destPath, { recursive: true });
215
- copyRecursive(srcPath, destPath);
216
- } else {
217
- copyFileSync(srcPath, destPath);
218
- }
219
- }
220
- }
221
- function getStandardCommands() {
222
- return [
223
- { command: "specverse.validate", title: "Validate specification", category: "SpecVerse" },
224
- { command: "specverse.infer", title: "Infer full architecture", category: "SpecVerse" },
225
- { command: "specverse.realize", title: "Generate code from specification", category: "SpecVerse" },
226
- { command: "specverse.init", title: "Initialize new project", category: "SpecVerse" },
227
- { command: "specverse.gen.diagrams", title: "Generate Mermaid diagrams", category: "SpecVerse" },
228
- { command: "specverse.gen.docs", title: "Generate documentation", category: "SpecVerse" },
229
- { command: "specverse.gen.uml", title: "Generate UML diagrams", category: "SpecVerse" },
230
- { command: "specverse.dev.format", title: "Format .specly file", category: "SpecVerse" },
231
- { command: "specverse.dev.watch", title: "Watch and validate on change", category: "SpecVerse" },
232
- { command: "specverse.dev.quick", title: "Quick validation", category: "SpecVerse" },
233
- { command: "specverse.cache", title: "Manage import cache", category: "SpecVerse" },
234
- { command: "specverse.ai.docs", title: "Generate AI implementation prompt", category: "SpecVerse" },
235
- { command: "specverse.ai.suggest", title: "Get spec improvement suggestions", category: "SpecVerse" },
236
- { command: "specverse.ai.template", title: "Load AI prompt template", category: "SpecVerse" }
237
- ];
238
- }
239
- function capitalize(str) {
240
- return str.charAt(0).toUpperCase() + str.slice(1);
241
- }
242
- export {
243
- generateVSCodeExtension as default
244
- };
@@ -1,48 +0,0 @@
1
- import {
2
- BaseComponentGenerator,
3
- ViewSpec,
4
- StateDefinition,
5
- EventDefinition,
6
- UIComponent,
7
- RenderContext,
8
- GeneratorConfig,
9
- extractComponentTypes,
10
- countComponents,
11
- validateNestingDepth
12
- } from "./templates/shared/base-generator.js";
13
- export * from "./templates/shared/property-mapper.js";
14
- export * from "./templates/shared/syntax-mapper.js";
15
- export * from "./templates/shared/component-metadata.js";
16
- import {
17
- ATOMIC_COMPONENTS_REGISTRY,
18
- AtomicComponentDefinition
19
- } from "./templates/shared/atomic-components-registry.js";
20
- import {
21
- ComponentAdapter,
22
- ComponentLibraryAdapter,
23
- ComponentMapping,
24
- renderProps,
25
- indent,
26
- wrapWithChildren
27
- } from "./templates/shared/adapter-types.js";
28
- export * from "./templates/react/react-component-generator.js";
29
- export {
30
- ATOMIC_COMPONENTS_REGISTRY,
31
- AtomicComponentDefinition,
32
- BaseComponentGenerator,
33
- ComponentAdapter,
34
- ComponentLibraryAdapter,
35
- ComponentMapping,
36
- EventDefinition,
37
- GeneratorConfig,
38
- RenderContext,
39
- StateDefinition,
40
- UIComponent,
41
- ViewSpec,
42
- countComponents,
43
- extractComponentTypes,
44
- indent,
45
- renderProps,
46
- validateNestingDepth,
47
- wrapWithChildren
48
- };