@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,159 @@
|
|
|
1
|
+
function generateReadme(context) {
|
|
2
|
+
const { spec, manifest } = context;
|
|
3
|
+
const sections = [];
|
|
4
|
+
sections.push(`# ${spec.metadata?.component || "SpecVerse Application"}`);
|
|
5
|
+
sections.push("");
|
|
6
|
+
sections.push(spec.metadata?.description || "Generated with SpecVerse");
|
|
7
|
+
sections.push("");
|
|
8
|
+
const techStack = inferTechStack(manifest);
|
|
9
|
+
if (techStack.length > 0) {
|
|
10
|
+
sections.push("## Tech Stack");
|
|
11
|
+
sections.push("");
|
|
12
|
+
for (const tech of techStack) {
|
|
13
|
+
sections.push(`- **${tech.category}**: ${tech.items.join(", ")}`);
|
|
14
|
+
}
|
|
15
|
+
sections.push("");
|
|
16
|
+
}
|
|
17
|
+
sections.push("## Getting Started");
|
|
18
|
+
sections.push("");
|
|
19
|
+
sections.push("### Prerequisites");
|
|
20
|
+
sections.push("");
|
|
21
|
+
sections.push("- Node.js 18+");
|
|
22
|
+
sections.push("- npm or yarn");
|
|
23
|
+
if (usesPrisma(manifest)) {
|
|
24
|
+
sections.push("- PostgreSQL (or your database of choice)");
|
|
25
|
+
}
|
|
26
|
+
sections.push("");
|
|
27
|
+
sections.push("### Installation");
|
|
28
|
+
sections.push("");
|
|
29
|
+
sections.push("```bash");
|
|
30
|
+
sections.push("npm install");
|
|
31
|
+
sections.push("```");
|
|
32
|
+
sections.push("");
|
|
33
|
+
const hasEnvVars = manifestHasEnvVars(manifest);
|
|
34
|
+
if (hasEnvVars) {
|
|
35
|
+
sections.push("### Environment Setup");
|
|
36
|
+
sections.push("");
|
|
37
|
+
sections.push("```bash");
|
|
38
|
+
sections.push("cp .env.example .env");
|
|
39
|
+
sections.push("```");
|
|
40
|
+
sections.push("");
|
|
41
|
+
sections.push("Configure your environment variables in `.env`");
|
|
42
|
+
sections.push("");
|
|
43
|
+
}
|
|
44
|
+
if (usesPrisma(manifest)) {
|
|
45
|
+
sections.push("### Database Setup");
|
|
46
|
+
sections.push("");
|
|
47
|
+
sections.push("**Important**: Create the database before running Prisma commands.");
|
|
48
|
+
sections.push("");
|
|
49
|
+
sections.push("```bash");
|
|
50
|
+
sections.push("# Create database (PostgreSQL example)");
|
|
51
|
+
sections.push("createdb your_database_name");
|
|
52
|
+
sections.push("");
|
|
53
|
+
sections.push("# Or using psql:");
|
|
54
|
+
sections.push("# psql postgres");
|
|
55
|
+
sections.push("# CREATE DATABASE your_database_name;");
|
|
56
|
+
sections.push("# \\q");
|
|
57
|
+
sections.push("");
|
|
58
|
+
sections.push("# Update DATABASE_URL in .env with your database name");
|
|
59
|
+
sections.push('# DATABASE_URL="postgresql://localhost:5432/your_database_name"');
|
|
60
|
+
sections.push("");
|
|
61
|
+
sections.push("# Generate Prisma client");
|
|
62
|
+
sections.push("npm run db:generate");
|
|
63
|
+
sections.push("");
|
|
64
|
+
sections.push("# Push schema to database (for development)");
|
|
65
|
+
sections.push("npm run db:push");
|
|
66
|
+
sections.push("");
|
|
67
|
+
sections.push("# Or use migrations (for production)");
|
|
68
|
+
sections.push("npm run db:migrate");
|
|
69
|
+
sections.push("```");
|
|
70
|
+
sections.push("");
|
|
71
|
+
}
|
|
72
|
+
sections.push("### Development");
|
|
73
|
+
sections.push("");
|
|
74
|
+
sections.push("```bash");
|
|
75
|
+
sections.push("npm run dev");
|
|
76
|
+
sections.push("```");
|
|
77
|
+
sections.push("");
|
|
78
|
+
sections.push("### Production Build");
|
|
79
|
+
sections.push("");
|
|
80
|
+
sections.push("```bash");
|
|
81
|
+
sections.push("npm run build");
|
|
82
|
+
sections.push("npm start");
|
|
83
|
+
sections.push("```");
|
|
84
|
+
sections.push("");
|
|
85
|
+
if (hasRestAPI(manifest)) {
|
|
86
|
+
sections.push("## API");
|
|
87
|
+
sections.push("");
|
|
88
|
+
sections.push("The API server runs on `http://localhost:${PORT}` (default: 3000)");
|
|
89
|
+
sections.push("");
|
|
90
|
+
if (spec.controllers && spec.controllers.length > 0) {
|
|
91
|
+
sections.push("### Endpoints");
|
|
92
|
+
sections.push("");
|
|
93
|
+
for (const controller of spec.controllers) {
|
|
94
|
+
sections.push(`- **${controller.name}**: \`${controller.basePath || "/api"}\``);
|
|
95
|
+
}
|
|
96
|
+
sections.push("");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
sections.push("---");
|
|
100
|
+
sections.push("");
|
|
101
|
+
sections.push("_Generated with [SpecVerse](https://github.com/specverse/specverse-lang)_");
|
|
102
|
+
return sections.join("\n");
|
|
103
|
+
}
|
|
104
|
+
function inferTechStack(manifest) {
|
|
105
|
+
const stack = [];
|
|
106
|
+
if (!manifest || !manifest.capabilityMappings) {
|
|
107
|
+
return stack;
|
|
108
|
+
}
|
|
109
|
+
stack.push({
|
|
110
|
+
category: "Runtime",
|
|
111
|
+
items: ["Node.js", "TypeScript"]
|
|
112
|
+
});
|
|
113
|
+
const apiMapping = manifest.capabilityMappings.find(
|
|
114
|
+
(m) => m.capability === "api.rest"
|
|
115
|
+
);
|
|
116
|
+
if (apiMapping) {
|
|
117
|
+
stack.push({
|
|
118
|
+
category: "Web Framework",
|
|
119
|
+
items: [apiMapping.instanceFactory]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const ormMapping = manifest.capabilityMappings.find(
|
|
123
|
+
(m) => m.capability === "orm.client" || m.capability === "orm.schema"
|
|
124
|
+
);
|
|
125
|
+
if (ormMapping) {
|
|
126
|
+
stack.push({
|
|
127
|
+
category: "ORM",
|
|
128
|
+
items: [ormMapping.instanceFactory]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return stack;
|
|
132
|
+
}
|
|
133
|
+
function usesPrisma(manifest) {
|
|
134
|
+
if (!manifest || !manifest.capabilityMappings) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
return manifest.capabilityMappings.some(
|
|
138
|
+
(m) => m.instanceFactory?.toLowerCase().includes("prisma")
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function hasRestAPI(manifest) {
|
|
142
|
+
if (!manifest || !manifest.capabilityMappings) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
return manifest.capabilityMappings.some(
|
|
146
|
+
(m) => m.capability === "api.rest"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
function manifestHasEnvVars(manifest) {
|
|
150
|
+
if (!manifest || !manifest.capabilityMappings) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return manifest.capabilityMappings.some(
|
|
154
|
+
(m) => m.capability === "storage.database" || m.capability === "api.rest"
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
generateReadme as default
|
|
159
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function generateTsConfig(context) {
|
|
2
|
+
const { manifest, spec } = context;
|
|
3
|
+
const mergedOptions = extractTsConfigOptions(context.implementationTypes || []);
|
|
4
|
+
const hasViews = spec && (spec.views || Array.isArray(spec.views) && spec.views.length > 0);
|
|
5
|
+
const usesReact = hasViews && (context.implementationTypes || []).some(
|
|
6
|
+
(implType) => implType.capabilities?.provides?.includes("ui.components") && implType.technology?.framework === "react"
|
|
7
|
+
);
|
|
8
|
+
const tsconfig = {
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
// Defaults
|
|
11
|
+
target: "ES2022",
|
|
12
|
+
module: "ESNext",
|
|
13
|
+
moduleResolution: "node",
|
|
14
|
+
lib: ["ES2022"],
|
|
15
|
+
outDir: "./dist",
|
|
16
|
+
rootDir: "./src",
|
|
17
|
+
// Strict mode
|
|
18
|
+
strict: true,
|
|
19
|
+
esModuleInterop: true,
|
|
20
|
+
skipLibCheck: true,
|
|
21
|
+
forceConsistentCasingInFileNames: true,
|
|
22
|
+
// Module resolution
|
|
23
|
+
resolveJsonModule: true,
|
|
24
|
+
allowSyntheticDefaultImports: true,
|
|
25
|
+
// Output
|
|
26
|
+
declaration: true,
|
|
27
|
+
declarationMap: true,
|
|
28
|
+
sourceMap: true,
|
|
29
|
+
// Merge options from implementation types
|
|
30
|
+
...mergedOptions
|
|
31
|
+
},
|
|
32
|
+
include: usesReact ? ["src/**/*.ts"] : ["src/**/*"],
|
|
33
|
+
// Exclude .tsx files if React is used
|
|
34
|
+
exclude: usesReact ? ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts", "src/components/**", "src/hooks/**", "src/types/**"] : ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"],
|
|
35
|
+
...usesReact && {
|
|
36
|
+
references: [{ path: "./tsconfig.react.json" }]
|
|
37
|
+
// Reference React config
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return JSON.stringify(tsconfig, null, 2);
|
|
41
|
+
}
|
|
42
|
+
function extractTsConfigOptions(implementationTypes) {
|
|
43
|
+
const options = {};
|
|
44
|
+
if (!implementationTypes || implementationTypes.length === 0) {
|
|
45
|
+
return options;
|
|
46
|
+
}
|
|
47
|
+
for (const implType of implementationTypes) {
|
|
48
|
+
if (implType.requirements?.configuration?.tsconfig?.compilerOptions) {
|
|
49
|
+
Object.assign(options, implType.requirements.configuration.tsconfig.compilerOptions);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return options;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
generateTsConfig as default
|
|
56
|
+
};
|
package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function generateReactTsConfig(context) {
|
|
2
|
+
const tsconfigReact = {
|
|
3
|
+
extends: "./tsconfig.json",
|
|
4
|
+
compilerOptions: {
|
|
5
|
+
// React/Vite specific settings
|
|
6
|
+
moduleResolution: "bundler",
|
|
7
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
8
|
+
jsx: "react-jsx",
|
|
9
|
+
jsxImportSource: "react",
|
|
10
|
+
types: ["vite/client"],
|
|
11
|
+
// Allow importing .ts/.tsx files with extensions
|
|
12
|
+
allowImportingTsExtensions: true,
|
|
13
|
+
// Project reference settings
|
|
14
|
+
composite: true,
|
|
15
|
+
outDir: "./dist/react"
|
|
16
|
+
},
|
|
17
|
+
include: ["src/**/*.tsx", "src/**/*.ts"],
|
|
18
|
+
exclude: [
|
|
19
|
+
"node_modules",
|
|
20
|
+
"dist",
|
|
21
|
+
"**/*.test.ts",
|
|
22
|
+
"**/*.spec.ts",
|
|
23
|
+
"src/main.ts",
|
|
24
|
+
// Backend entry point
|
|
25
|
+
"src/controllers/**",
|
|
26
|
+
// Backend controllers
|
|
27
|
+
"src/routes/**",
|
|
28
|
+
// Backend routes
|
|
29
|
+
"src/services/**"
|
|
30
|
+
// Backend services (if any)
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
return JSON.stringify(tsconfigReact, null, 2);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
generateReactTsConfig as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { generatePythonSDK } from "../../../../../scripts/generate-sdk-python.js";
|
|
2
|
+
function generateSDK(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
|
+
packageName: config.packageName || "specverse_client",
|
|
10
|
+
packageVersion: config.packageVersion || "1.0.0",
|
|
11
|
+
includeAuth: config.includeAuth !== false,
|
|
12
|
+
includeRetry: config.includeRetry !== false,
|
|
13
|
+
includeAsync: config.includeAsync !== false,
|
|
14
|
+
timeout: config.timeout || 3e4,
|
|
15
|
+
retries: config.retries || 3
|
|
16
|
+
};
|
|
17
|
+
const result = generatePythonSDK(spec, outputDir || "./sdk-python", options);
|
|
18
|
+
return JSON.stringify({
|
|
19
|
+
message: "Python SDK generated successfully",
|
|
20
|
+
packageName: result.packageName,
|
|
21
|
+
resourceCount: result.resourceCount,
|
|
22
|
+
endpointCount: result.endpointCount,
|
|
23
|
+
outputDir: result.outputDir,
|
|
24
|
+
files: result.files
|
|
25
|
+
}, null, 2);
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
generateSDK as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { generateTypeScriptSDK } from "../../../../../scripts/generate-sdk-typescript.js";
|
|
2
|
+
function generateSDK(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
|
+
packageName: config.packageName || "@specverse/sdk",
|
|
10
|
+
packageVersion: config.packageVersion || "1.0.0",
|
|
11
|
+
includeAuth: config.includeAuth !== false,
|
|
12
|
+
includeRetry: config.includeRetry !== false,
|
|
13
|
+
timeout: config.timeout || 3e4,
|
|
14
|
+
retries: config.retries || 3
|
|
15
|
+
};
|
|
16
|
+
const result = generateTypeScriptSDK(spec, outputDir || "./sdk-typescript", options);
|
|
17
|
+
return JSON.stringify({
|
|
18
|
+
message: "TypeScript SDK generated successfully",
|
|
19
|
+
packageName: result.packageName,
|
|
20
|
+
resourceCount: result.resourceCount,
|
|
21
|
+
endpointCount: result.endpointCount,
|
|
22
|
+
outputDir: result.outputDir,
|
|
23
|
+
files: result.files
|
|
24
|
+
}, null, 2);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
generateSDK as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
import { generateInterpreterModule } from "./step-conventions-memory.js";
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
const outputIdx = args.indexOf("-o");
|
|
5
|
+
const source = generateInterpreterModule();
|
|
6
|
+
if (outputIdx !== -1 && args[outputIdx + 1]) {
|
|
7
|
+
const { writeFileSync } = await import("fs");
|
|
8
|
+
const { resolve } = await import("path");
|
|
9
|
+
const outPath = resolve(args[outputIdx + 1]);
|
|
10
|
+
writeFileSync(outPath, source, "utf8");
|
|
11
|
+
console.log(`Generated ${outPath} (${source.split("\n").length} lines)`);
|
|
12
|
+
} else {
|
|
13
|
+
console.log(source);
|
|
14
|
+
}
|