@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.
- package/assets/examples/manifests/frontend-only.yaml +3 -6
- package/assets/examples/manifests/fullstack-app.yaml +5 -7
- package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
- package/dist/inference/comprehensive-engine.d.ts.map +1 -1
- package/dist/inference/comprehensive-engine.js +3 -19
- package/dist/inference/comprehensive-engine.js.map +1 -1
- package/dist/inference/core/rule-engine.d.ts +31 -0
- package/dist/inference/core/rule-engine.d.ts.map +1 -1
- package/dist/inference/core/rule-engine.js +117 -33
- package/dist/inference/core/rule-engine.js.map +1 -1
- package/dist/inference/core/rule-file-types.d.ts +0 -2
- package/dist/inference/core/rule-file-types.d.ts.map +1 -1
- package/dist/inference/core/rule-file-types.js +3 -6
- package/dist/inference/core/rule-file-types.js.map +1 -1
- package/dist/inference/core/rule-loader.d.ts +5 -15
- package/dist/inference/core/rule-loader.d.ts.map +1 -1
- package/dist/inference/core/rule-loader.js +43 -132
- package/dist/inference/core/rule-loader.js.map +1 -1
- package/dist/inference/core/types.d.ts +0 -6
- package/dist/inference/core/types.d.ts.map +1 -1
- package/dist/inference/core/types.js +0 -4
- package/dist/inference/core/types.js.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
- package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.js +0 -19
- package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
- package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
- package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
- package/dist/inference/logical/generators/view-generator.d.ts +4 -14
- package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/view-generator.js +6 -26
- package/dist/inference/logical/generators/view-generator.js.map +1 -1
- package/dist/inference/logical/index.d.ts +2 -2
- package/dist/inference/logical/index.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.js +17 -80
- package/dist/inference/logical/logical-engine.js.map +1 -1
- package/dist/inference/quint-transpiler.d.ts +5 -3
- package/dist/inference/quint-transpiler.d.ts.map +1 -1
- package/dist/inference/quint-transpiler.js +11 -6
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +3 -3
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +16 -6
- package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +121 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +78 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +190 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +45 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +46 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +30 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +56 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +14 -11
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +11 -3
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +27 -17
- package/dist/libs/instance-factories/shared/path-resolver.js +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +15 -22
- package/dist/realize/index.js.map +1 -1
- package/dist/registry/utils/manifest-adapter.d.ts +8 -1
- package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
- package/dist/registry/utils/manifest-adapter.js +8 -1
- package/dist/registry/utils/manifest-adapter.js.map +1 -1
- package/libs/instance-factories/applications/react-app-starter.yaml +150 -0
- package/libs/instance-factories/applications/templates/generic/main-generator.ts +3 -3
- package/libs/instance-factories/applications/templates/react/api-client-generator.ts +16 -6
- package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +145 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +175 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +163 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
- package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
- package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +174 -0
- package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
- package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +306 -0
- package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +60 -0
- package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
- package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +120 -0
- package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +80 -0
- package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
- package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +47 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +94 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +114 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +72 -0
- package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +151 -0
- package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +14 -11
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +11 -3
- package/libs/instance-factories/services/templates/prisma/controller-generator.ts +27 -17
- package/libs/instance-factories/shared/path-resolver.ts +8 -2
- package/package.json +3 -3
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js.bak +0 -244
- package/dist/libs/instance-factories/views/index.js +0 -48
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
- package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
- package/dist/realize/index.js.bak +0 -758
- package/libs/instance-factories/applications/react-app.yaml +0 -186
- package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
- package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
- package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
- package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
- package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
- package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
- package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
- package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
- package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
- package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
- package/libs/instance-factories/views/README.md +0 -62
- package/libs/instance-factories/views/index.d.ts +0 -13
- package/libs/instance-factories/views/index.d.ts.map +0 -1
- package/libs/instance-factories/views/index.js +0 -18
- package/libs/instance-factories/views/index.js.map +0 -1
- package/libs/instance-factories/views/index.ts +0 -45
- package/libs/instance-factories/views/react-components.yaml +0 -129
- package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
- package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
- package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
- package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
- package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
- package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
- package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
- package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
- package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
- package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
- package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
- package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
- package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
- package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
- package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
- package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
- package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
- package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
- package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
- package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
- package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
- package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
- package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
- package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
- package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
- package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
- package/libs/instance-factories/views/templates/shared/index.ts +0 -68
- package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
- package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js.bak
DELETED
|
@@ -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
|
-
};
|