@specverse/engines 4.1.5 → 4.1.7
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/dist/libs/instance-factories/applications/templates/generic/backend-env-generator.js +22 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +66 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.js +54 -0
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +290 -0
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +530 -0
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +437 -0
- package/dist/libs/instance-factories/applications/templates/react/api-types-generator.js +146 -0
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +73 -0
- package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +18 -0
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +99 -0
- package/dist/libs/instance-factories/applications/templates/react/gitignore-generator.js +35 -0
- package/dist/libs/instance-factories/applications/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/applications/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/applications/templates/react/main-tsx-generator.js +29 -0
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +49 -0
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +156 -0
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +935 -0
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.js +101 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +50 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +646 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +65 -0
- package/dist/libs/instance-factories/applications/templates/react/tsconfig-generator.js +28 -0
- package/dist/libs/instance-factories/applications/templates/react/use-api-hooks-generator.js +132 -0
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +355 -0
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +91 -0
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +79 -0
- package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +42 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-bin-wrapper-generator.js +11 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +111 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +928 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/bus-generator.js +83 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/publisher-generator.js +91 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.js +86 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.js +93 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +280 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +125 -0
- package/dist/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.js +25 -0
- package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +371 -0
- package/dist/libs/instance-factories/orms/templates/prisma/services-generator.js +266 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-example-generator.js +51 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-generator.js +61 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.js +59 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/package-json-generator.js +126 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/readme-generator.js +159 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.js +56 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js +37 -0
- package/dist/libs/instance-factories/sdks/templates/python/sdk-generator.js +29 -0
- package/dist/libs/instance-factories/sdks/templates/typescript/sdk-generator.js +28 -0
- package/dist/libs/instance-factories/services/templates/memory/generate-interpreter.js +14 -0
- package/dist/libs/instance-factories/services/templates/memory/step-conventions-memory.js +415 -0
- package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +177 -0
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +413 -0
- package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +243 -0
- package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +264 -0
- package/dist/libs/instance-factories/services/templates/shared-patterns.js +24 -0
- package/dist/libs/instance-factories/shared/path-resolver.js +59 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/config-generator.js +13 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/docker-generator.js +16 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/config-generator.js +45 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/docker-generator.js +46 -0
- package/dist/libs/instance-factories/storage/templates/redis/config-generator.js +14 -0
- package/dist/libs/instance-factories/storage/templates/redis/docker-generator.js +16 -0
- package/dist/libs/instance-factories/test-generation.js +145 -0
- package/dist/libs/instance-factories/testing/templates/vitest/tests-generator.js +30 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +149 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.js +232 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.js +49 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/index.js +18 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.js +0 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.js +97 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.js +64 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.js +182 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.js +1210 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.js +172 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.js +240 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.js +147 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.js +281 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.js +409 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.js +414 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.js +467 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.js +135 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/types/index.js +0 -0
- package/dist/libs/instance-factories/tools/templates/vscode/static/extension.js +965 -0
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +238 -0
- package/dist/libs/instance-factories/validation/templates/zod/validation-generator.js +25 -0
- package/dist/libs/instance-factories/views/index.js +48 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +742 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +824 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +719 -0
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +45 -0
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +779 -0
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +285 -0
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +46 -0
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +111 -0
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +21 -0
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +299 -0
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +136 -0
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +107 -0
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +179 -0
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +7 -0
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +56 -0
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +27 -0
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +29 -0
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +261 -0
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +34 -0
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +800 -0
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +305 -0
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +517 -0
- 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 +445 -0
- package/dist/libs/instance-factories/views/templates/shared/index.js +80 -0
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +210 -0
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +492 -0
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +321 -0
- package/dist/realize/index.js +36 -12
- package/dist/realize/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,238 @@
|
|
|
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.19.0"
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function copyRecursive(src, dest) {
|
|
203
|
+
for (const entry of readdirSync(src)) {
|
|
204
|
+
if (entry === "extension.ts") continue;
|
|
205
|
+
const srcPath = join(src, entry);
|
|
206
|
+
const destPath = join(dest, entry);
|
|
207
|
+
if (statSync(srcPath).isDirectory()) {
|
|
208
|
+
if (!existsSync(destPath)) mkdirSync(destPath, { recursive: true });
|
|
209
|
+
copyRecursive(srcPath, destPath);
|
|
210
|
+
} else {
|
|
211
|
+
copyFileSync(srcPath, destPath);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function getStandardCommands() {
|
|
216
|
+
return [
|
|
217
|
+
{ command: "specverse.validate", title: "Validate specification", category: "SpecVerse" },
|
|
218
|
+
{ command: "specverse.infer", title: "Infer full architecture", category: "SpecVerse" },
|
|
219
|
+
{ command: "specverse.realize", title: "Generate code from specification", category: "SpecVerse" },
|
|
220
|
+
{ command: "specverse.init", title: "Initialize new project", category: "SpecVerse" },
|
|
221
|
+
{ command: "specverse.gen.diagrams", title: "Generate Mermaid diagrams", category: "SpecVerse" },
|
|
222
|
+
{ command: "specverse.gen.docs", title: "Generate documentation", category: "SpecVerse" },
|
|
223
|
+
{ command: "specverse.gen.uml", title: "Generate UML diagrams", category: "SpecVerse" },
|
|
224
|
+
{ command: "specverse.dev.format", title: "Format .specly file", category: "SpecVerse" },
|
|
225
|
+
{ command: "specverse.dev.watch", title: "Watch and validate on change", category: "SpecVerse" },
|
|
226
|
+
{ command: "specverse.dev.quick", title: "Quick validation", category: "SpecVerse" },
|
|
227
|
+
{ command: "specverse.cache", title: "Manage import cache", category: "SpecVerse" },
|
|
228
|
+
{ command: "specverse.ai.docs", title: "Generate AI implementation prompt", category: "SpecVerse" },
|
|
229
|
+
{ command: "specverse.ai.suggest", title: "Get spec improvement suggestions", category: "SpecVerse" },
|
|
230
|
+
{ command: "specverse.ai.template", title: "Load AI prompt template", category: "SpecVerse" }
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
function capitalize(str) {
|
|
234
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
generateVSCodeExtension as default
|
|
238
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { generateValidation } from "../../../../../scripts/generate-validation.js";
|
|
2
|
+
function generateValidationSchemas(context) {
|
|
3
|
+
const { spec, implType, outputDir } = context;
|
|
4
|
+
if (!spec) {
|
|
5
|
+
throw new Error("Specification is required in template context");
|
|
6
|
+
}
|
|
7
|
+
const config = implType.configuration || {};
|
|
8
|
+
const options = {
|
|
9
|
+
framework: config.framework || "zod",
|
|
10
|
+
generateJsonSchema: config.generateJsonSchema !== false,
|
|
11
|
+
stripUnknown: config.stripUnknown !== false,
|
|
12
|
+
abortEarly: config.abortEarly || false
|
|
13
|
+
};
|
|
14
|
+
const result = generateValidation(spec, outputDir || "./validation", options);
|
|
15
|
+
return JSON.stringify({
|
|
16
|
+
message: "Validation schemas generated successfully",
|
|
17
|
+
modelCount: result.modelCount,
|
|
18
|
+
schemaCount: result.schemaCount,
|
|
19
|
+
outputDir: result.outputDir,
|
|
20
|
+
files: result.files
|
|
21
|
+
}, null, 2);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
generateValidationSchemas as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
};
|