@specverse/engine-realize 3.5.3
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/09-api/ai-spec.yaml +194 -0
- package/assets/examples/09-api/converted.yaml +95 -0
- package/assets/examples/09-api/diagram-architecture.mmd +10 -0
- package/assets/examples/09-api/diagram-er.mmd +10 -0
- package/assets/examples/09-api/documentation.html +104 -0
- package/assets/examples/09-api/documentation.md +95 -0
- package/assets/examples/09-api/inferred-spec.yaml +420 -0
- package/assets/examples/09-api/openapi.json +61 -0
- package/assets/examples/10-api/README.md +216 -0
- package/assets/examples/10-api/ai-spec.yaml +194 -0
- package/assets/examples/10-api/converted.yaml +96 -0
- package/assets/examples/10-api/diagram-architecture.mmd +10 -0
- package/assets/examples/10-api/diagram-er.mmd +10 -0
- package/assets/examples/10-api/documentation.html +104 -0
- package/assets/examples/10-api/documentation.md +95 -0
- package/assets/examples/10-api/inferred-spec.yaml +7 -0
- package/assets/examples/10-api/metadata.yaml +89 -0
- package/assets/examples/10-api/openapi.json +61 -0
- package/assets/examples/10-api/package-integration-test.js +177 -0
- package/assets/examples/10-api/usage-example.js +323 -0
- package/assets/examples/10-api/usage-example.ts +363 -0
- package/assets/examples/10-api/workflow-test.js +113 -0
- package/assets/examples/manifests/01-simple-default-mappings.yaml +36 -0
- package/assets/examples/manifests/02-capability-mappings.yaml +55 -0
- package/assets/examples/manifests/03-hybrid-mappings.yaml +109 -0
- package/assets/examples/manifests/README.md +245 -0
- package/assets/examples/manifests/backend-only.yaml +43 -0
- package/assets/examples/manifests/blog-api.md +78 -0
- package/assets/examples/manifests/blog-api.specly +79 -0
- package/assets/examples/manifests/frontend-only.yaml +27 -0
- package/assets/examples/manifests/fullstack-app.yaml +44 -0
- package/assets/examples/manifests/fullstack-monorepo.yaml +62 -0
- package/assets/examples/validate-examples-with-expected-failures.cjs +328 -0
- package/assets/examples/validate-examples.cjs +225 -0
- package/assets/examples-decomposed/cloud-native-manifest.example.yaml +8 -0
- package/assets/examples-decomposed/cloud-native-manifest.md +379 -0
- package/assets/examples-decomposed/cloud-native-manifest.specly +60 -0
- package/assets/examples-decomposed/docker-compose-manifest.example.yaml +8 -0
- package/assets/examples-decomposed/docker-compose-manifest.md +326 -0
- package/assets/examples-decomposed/docker-compose-manifest.specly +40 -0
- package/assets/examples-decomposed/kubernetes-deployment-manifest.example.yaml +8 -0
- package/assets/examples-decomposed/kubernetes-deployment-manifest.md +237 -0
- package/assets/examples-decomposed/kubernetes-deployment-manifest.specly +41 -0
- package/assets/templates/README.md +559 -0
- package/assets/templates/TEMPLATE-ENHANCEMENTS-V33.md +462 -0
- package/assets/templates/backend-only/CLAUDE.md +73 -0
- package/assets/templates/backend-only/README.md +197 -0
- package/assets/templates/backend-only/deployments/README.md +149 -0
- package/assets/templates/backend-only/deployments/development.specly +53 -0
- package/assets/templates/backend-only/deployments/production.specly +87 -0
- package/assets/templates/backend-only/docs/README.md +50 -0
- package/assets/templates/backend-only/docs/api/README.md +7 -0
- package/assets/templates/backend-only/docs/diagrams/README.md +85 -0
- package/assets/templates/backend-only/docs/example-documentation-template.md +269 -0
- package/assets/templates/backend-only/docs/guides/README.md +15 -0
- package/assets/templates/backend-only/dot.env.example +18 -0
- package/assets/templates/backend-only/generated/README.md +56 -0
- package/assets/templates/backend-only/generated/code/integration-test.template.js +320 -0
- package/assets/templates/backend-only/generated/code/package.json.template +34 -0
- package/assets/templates/backend-only/generated/docs/README.md +49 -0
- package/assets/templates/backend-only/gitignore +54 -0
- package/assets/templates/backend-only/manifests/README.md +72 -0
- package/assets/templates/backend-only/manifests/docker-compose.specly +91 -0
- package/assets/templates/backend-only/manifests/implementation.yaml +100 -0
- package/assets/templates/backend-only/manifests/kubernetes.specly +140 -0
- package/assets/templates/backend-only/package.json +59 -0
- package/assets/templates/backend-only/scripts/test-all.sh +160 -0
- package/assets/templates/backend-only/scripts/test-generated-code.sh +165 -0
- package/assets/templates/backend-only/specs/main.specly +67 -0
- package/assets/templates/default/CLAUDE.md +141 -0
- package/assets/templates/default/README.md +404 -0
- package/assets/templates/default/deployments/README.md +149 -0
- package/assets/templates/default/deployments/development.specly +53 -0
- package/assets/templates/default/deployments/production.specly +87 -0
- package/assets/templates/default/docs/README.md +50 -0
- package/assets/templates/default/docs/api/README.md +7 -0
- package/assets/templates/default/docs/diagrams/README.md +85 -0
- package/assets/templates/default/docs/example-documentation-template.md +269 -0
- package/assets/templates/default/docs/guides/README.md +15 -0
- package/assets/templates/default/dot.env.example +18 -0
- package/assets/templates/default/generated/README.md +56 -0
- package/assets/templates/default/generated/code/integration-test.template.js +320 -0
- package/assets/templates/default/generated/code/package.json.template +34 -0
- package/assets/templates/default/generated/docs/README.md +49 -0
- package/assets/templates/default/gitignore +54 -0
- package/assets/templates/default/manifests/README.md +72 -0
- package/assets/templates/default/manifests/docker-compose.specly +91 -0
- package/assets/templates/default/manifests/implementation.yaml +176 -0
- package/assets/templates/default/manifests/kubernetes.specly +140 -0
- package/assets/templates/default/package.json +61 -0
- package/assets/templates/default/scripts/test-all.sh +160 -0
- package/assets/templates/default/scripts/test-generated-code.sh +165 -0
- package/assets/templates/default/specs/main.specly +67 -0
- package/assets/templates/frontend-only/CLAUDE.md +75 -0
- package/assets/templates/frontend-only/README.md +231 -0
- package/assets/templates/frontend-only/deployments/README.md +149 -0
- package/assets/templates/frontend-only/deployments/development.specly +53 -0
- package/assets/templates/frontend-only/deployments/production.specly +87 -0
- package/assets/templates/frontend-only/docs/README.md +50 -0
- package/assets/templates/frontend-only/docs/api/README.md +7 -0
- package/assets/templates/frontend-only/docs/diagrams/README.md +85 -0
- package/assets/templates/frontend-only/docs/example-documentation-template.md +269 -0
- package/assets/templates/frontend-only/docs/guides/README.md +15 -0
- package/assets/templates/frontend-only/dot.env.example +18 -0
- package/assets/templates/frontend-only/generated/README.md +56 -0
- package/assets/templates/frontend-only/generated/code/integration-test.template.js +320 -0
- package/assets/templates/frontend-only/generated/code/package.json.template +34 -0
- package/assets/templates/frontend-only/generated/docs/README.md +49 -0
- package/assets/templates/frontend-only/gitignore +54 -0
- package/assets/templates/frontend-only/manifests/README.md +72 -0
- package/assets/templates/frontend-only/manifests/docker-compose.specly +91 -0
- package/assets/templates/frontend-only/manifests/implementation.yaml +58 -0
- package/assets/templates/frontend-only/manifests/kubernetes.specly +140 -0
- package/assets/templates/frontend-only/package.json +59 -0
- package/assets/templates/frontend-only/scripts/test-all.sh +160 -0
- package/assets/templates/frontend-only/scripts/test-generated-code.sh +165 -0
- package/assets/templates/frontend-only/specs/main.specly +57 -0
- package/assets/templates/full-stack/AI-GUIDE.md +60 -0
- package/assets/templates/full-stack/CLAUDE.md +141 -0
- package/assets/templates/full-stack/README.md +382 -0
- package/assets/templates/full-stack/archive/AI-GUIDE-legacy.md +392 -0
- package/assets/templates/full-stack/deployments/README.md +149 -0
- package/assets/templates/full-stack/deployments/development.specly +53 -0
- package/assets/templates/full-stack/deployments/production.specly +87 -0
- package/assets/templates/full-stack/docs/README.md +51 -0
- package/assets/templates/full-stack/docs/api/README.md +7 -0
- package/assets/templates/full-stack/docs/diagrams/README.md +85 -0
- package/assets/templates/full-stack/docs/example-documentation-template.md +269 -0
- package/assets/templates/full-stack/docs/guides/README.md +15 -0
- package/assets/templates/full-stack/generated/README.md +56 -0
- package/assets/templates/full-stack/generated/code/integration-test.template.js +320 -0
- package/assets/templates/full-stack/generated/code/package.json.template +34 -0
- package/assets/templates/full-stack/generated/docs/README.md +49 -0
- package/assets/templates/full-stack/gitignore +54 -0
- package/assets/templates/full-stack/manifests/README.md +72 -0
- package/assets/templates/full-stack/manifests/docker-compose.specly +91 -0
- package/assets/templates/full-stack/manifests/implementation.yaml +155 -0
- package/assets/templates/full-stack/manifests/kubernetes.specly +140 -0
- package/assets/templates/full-stack/package.json +45 -0
- package/assets/templates/full-stack/scripts/test-all.sh +160 -0
- package/assets/templates/full-stack/scripts/test-generated-code.sh +165 -0
- package/assets/templates/full-stack/specs/example-v33.specly +297 -0
- package/assets/templates/full-stack/specs/main-simple.specly +73 -0
- package/assets/templates/full-stack/specs/main.specly +408 -0
- package/dist/engines/code-generator.d.ts +86 -0
- package/dist/engines/code-generator.d.ts.map +1 -0
- package/dist/engines/code-generator.js +159 -0
- package/dist/engines/code-generator.js.map +1 -0
- package/dist/engines/engine-registry.d.ts +94 -0
- package/dist/engines/engine-registry.d.ts.map +1 -0
- package/dist/engines/engine-registry.js +163 -0
- package/dist/engines/engine-registry.js.map +1 -0
- package/dist/engines/index.d.ts +10 -0
- package/dist/engines/index.d.ts.map +1 -0
- package/dist/engines/index.js +12 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/typescript-engine.d.ts +74 -0
- package/dist/engines/typescript-engine.d.ts.map +1 -0
- package/dist/engines/typescript-engine.js +288 -0
- package/dist/engines/typescript-engine.js.map +1 -0
- package/dist/generators/index.d.ts +11 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +11 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +434 -0
- package/dist/index.js.map +1 -0
- package/dist/library/index.d.ts +12 -0
- package/dist/library/index.d.ts.map +1 -0
- package/dist/library/index.js +15 -0
- package/dist/library/index.js.map +1 -0
- package/dist/library/library.d.ts +132 -0
- package/dist/library/library.d.ts.map +1 -0
- package/dist/library/library.js +343 -0
- package/dist/library/library.js.map +1 -0
- package/dist/library/loader.d.ts +73 -0
- package/dist/library/loader.d.ts.map +1 -0
- package/dist/library/loader.js +150 -0
- package/dist/library/loader.js.map +1 -0
- package/dist/library/resolver.d.ts +104 -0
- package/dist/library/resolver.d.ts.map +1 -0
- package/dist/library/resolver.js +299 -0
- package/dist/library/resolver.js.map +1 -0
- package/dist/library/validator.d.ts +65 -0
- package/dist/library/validator.d.ts.map +1 -0
- package/dist/library/validator.js +203 -0
- package/dist/library/validator.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/instance-factory.d.ts +289 -0
- package/dist/types/instance-factory.d.ts.map +1 -0
- package/dist/types/instance-factory.js +8 -0
- package/dist/types/instance-factory.js.map +1 -0
- package/dist/types/unified-mappings.d.ts +163 -0
- package/dist/types/unified-mappings.d.ts.map +1 -0
- package/dist/types/unified-mappings.js +110 -0
- package/dist/types/unified-mappings.js.map +1 -0
- package/dist/utils/ai-spec-loader.d.ts +77 -0
- package/dist/utils/ai-spec-loader.d.ts.map +1 -0
- package/dist/utils/ai-spec-loader.js +138 -0
- package/dist/utils/ai-spec-loader.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/manifest-loader.d.ts +107 -0
- package/dist/utils/manifest-loader.d.ts.map +1 -0
- package/dist/utils/manifest-loader.js +168 -0
- package/dist/utils/manifest-loader.js.map +1 -0
- package/dist/utils/mapping-migration.d.ts +53 -0
- package/dist/utils/mapping-migration.d.ts.map +1 -0
- package/dist/utils/mapping-migration.js +194 -0
- package/dist/utils/mapping-migration.js.map +1 -0
- package/libs/instance-factories/CURVED-INTERFACE.md +278 -0
- package/libs/instance-factories/README.md +433 -0
- package/libs/instance-factories/applications/generic-app.yaml +52 -0
- package/libs/instance-factories/applications/react-app.yaml +186 -0
- package/libs/instance-factories/applications/templates/generic/backend-env-generator.ts +31 -0
- package/libs/instance-factories/applications/templates/generic/backend-package-json-generator.ts +80 -0
- package/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.ts +69 -0
- package/libs/instance-factories/applications/templates/generic/main-generator.ts +308 -0
- package/libs/instance-factories/applications/templates/react/_view-components-source.ts +555 -0
- package/libs/instance-factories/applications/templates/react/api-client-generator.ts +436 -0
- package/libs/instance-factories/applications/templates/react/api-types-generator.ts +153 -0
- package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +94 -0
- package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -0
- package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +106 -0
- package/libs/instance-factories/applications/templates/react/gitignore-generator.ts +38 -0
- package/libs/instance-factories/applications/templates/react/index-css-generator.ts +85 -0
- package/libs/instance-factories/applications/templates/react/index-html-generator.ts +30 -0
- package/libs/instance-factories/applications/templates/react/main-tsx-generator.ts +34 -0
- package/libs/instance-factories/applications/templates/react/package-json-generator.ts +54 -0
- package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +179 -0
- package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +1347 -0
- package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +150 -0
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +704 -0
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +84 -0
- package/libs/instance-factories/applications/templates/react/tsconfig-generator.ts +35 -0
- package/libs/instance-factories/applications/templates/react/use-api-hooks-generator.ts +121 -0
- package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +150 -0
- package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +150 -0
- package/libs/instance-factories/applications/templates/react/view-form-generator.ts +362 -0
- package/libs/instance-factories/applications/templates/react/view-list-generator.ts +98 -0
- package/libs/instance-factories/applications/templates/react/view-router-generator.ts +89 -0
- package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +49 -0
- package/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
- package/libs/instance-factories/cli/commander-js.yaml +55 -0
- package/libs/instance-factories/cli/templates/commander/cli-entry-generator.d.ts +12 -0
- package/libs/instance-factories/cli/templates/commander/cli-entry-generator.d.ts.map +1 -0
- package/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +115 -0
- package/libs/instance-factories/cli/templates/commander/cli-entry-generator.js.map +1 -0
- package/libs/instance-factories/cli/templates/commander/cli-entry-generator.ts +145 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.d.ts +14 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.d.ts.map +1 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.js +182 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.js.map +1 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +992 -0
- package/libs/instance-factories/communication/event-emitter.yaml +56 -0
- package/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
- package/libs/instance-factories/communication/templates/eventemitter/bus-generator.ts +93 -0
- package/libs/instance-factories/communication/templates/eventemitter/publisher-generator.ts +117 -0
- package/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.ts +101 -0
- package/libs/instance-factories/controllers/fastify.yaml +127 -0
- package/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.ts +103 -0
- package/libs/instance-factories/controllers/templates/fastify/routes-generator.ts +389 -0
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +76 -0
- package/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
- package/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.ts +46 -0
- package/libs/instance-factories/orms/prisma.yaml +89 -0
- package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +563 -0
- package/libs/instance-factories/orms/templates/prisma/services-generator.ts +408 -0
- package/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
- package/libs/instance-factories/scaffolding/templates/generic/env-example-generator.ts +73 -0
- package/libs/instance-factories/scaffolding/templates/generic/env-generator.ts +85 -0
- package/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.ts +69 -0
- package/libs/instance-factories/scaffolding/templates/generic/package-json-generator.ts +176 -0
- package/libs/instance-factories/scaffolding/templates/generic/readme-generator.ts +207 -0
- package/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.ts +78 -0
- package/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.ts +41 -0
- package/libs/instance-factories/sdks/python-sdk.yaml +66 -0
- package/libs/instance-factories/sdks/templates/python/sdk-generator.ts +50 -0
- package/libs/instance-factories/sdks/templates/typescript/sdk-generator.ts +49 -0
- package/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
- package/libs/instance-factories/services/prisma-services.yaml +71 -0
- package/libs/instance-factories/services/templates/prisma/behavior-generator.ts +303 -0
- package/libs/instance-factories/services/templates/prisma/controller-generator.ts +532 -0
- package/libs/instance-factories/services/templates/prisma/service-generator.ts +315 -0
- package/libs/instance-factories/shared/path-resolver.ts +111 -0
- package/libs/instance-factories/storage/mongodb.yaml +79 -0
- package/libs/instance-factories/storage/postgresql.yaml +75 -0
- package/libs/instance-factories/storage/redis.yaml +79 -0
- package/libs/instance-factories/storage/templates/mongodb/config-generator.ts +15 -0
- package/libs/instance-factories/storage/templates/mongodb/docker-generator.ts +18 -0
- package/libs/instance-factories/storage/templates/postgresql/config-generator.ts +54 -0
- package/libs/instance-factories/storage/templates/postgresql/docker-generator.ts +55 -0
- package/libs/instance-factories/storage/templates/redis/config-generator.ts +16 -0
- package/libs/instance-factories/storage/templates/redis/docker-generator.ts +18 -0
- package/libs/instance-factories/test-generation.ts +192 -0
- package/libs/instance-factories/testing/templates/vitest/tests-generator.ts +51 -0
- package/libs/instance-factories/testing/vitest-tests.yaml +63 -0
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +136 -0
- package/libs/instance-factories/tools/templates/mcp/static/docs/DEPLOYMENT_GUIDE.md +630 -0
- package/libs/instance-factories/tools/templates/mcp/static/docs/HYBRID_RESOURCE_SYSTEM.md +330 -0
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/EXTENSION_DEPLOYMENT.md +552 -0
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/LOCAL_DEPLOYMENT.md +164 -0
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/WEB_DEPLOYMENT.md +247 -0
- package/libs/instance-factories/tools/templates/mcp/static/package.json +92 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-enterprise.js +284 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-extension.js +139 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-local.js +74 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-web.js +156 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/copy-canonical-files.js +41 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-deployments.js +259 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-hybrid-resources.js +231 -0
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-hybrid-simple.js +196 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.ts +293 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.ts +90 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/index.ts +24 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.ts +15 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.ts +106 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.ts +75 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.ts +239 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.ts +1501 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.ts +211 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.ts +308 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.ts +210 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.ts +356 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.ts +524 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.ts +530 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.ts +594 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.ts +170 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/CLIProxyService.init.test.ts +544 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/CLIProxyService.test.ts +189 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/ResourcesProviderService.test.ts +89 -0
- package/libs/instance-factories/tools/templates/mcp/static/src/types/index.ts +110 -0
- package/libs/instance-factories/tools/templates/mcp/static/tsconfig.json +28 -0
- package/libs/instance-factories/tools/templates/vscode/static/extension.ts +1195 -0
- package/libs/instance-factories/tools/templates/vscode/static/language-configuration.json +34 -0
- package/libs/instance-factories/tools/templates/vscode/static/schemas/specverse-v3-schema.json +4279 -0
- package/libs/instance-factories/tools/templates/vscode/static/syntaxes/specverse.tmLanguage.json +138 -0
- package/libs/instance-factories/tools/templates/vscode/static/themes/README.md +74 -0
- package/libs/instance-factories/tools/templates/vscode/static/themes/complete-specverse-colors.json +122 -0
- package/libs/instance-factories/tools/templates/vscode/static/themes/specverse-basic-theme.json +65 -0
- package/libs/instance-factories/tools/templates/vscode/static/themes/specverse-complete-theme.json +123 -0
- package/libs/instance-factories/tools/templates/vscode/static/themes/specverse-theme-colors.json +64 -0
- package/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.ts +214 -0
- package/libs/instance-factories/validation/templates/zod/validation-generator.ts +46 -0
- package/libs/instance-factories/validation/zod.yaml +56 -0
- package/libs/instance-factories/views/index.d.ts +13 -0
- package/libs/instance-factories/views/index.d.ts.map +1 -0
- package/libs/instance-factories/views/index.js +18 -0
- package/libs/instance-factories/views/index.js.map +1 -0
- package/libs/instance-factories/views/index.ts +45 -0
- package/libs/instance-factories/views/react-components.yaml +129 -0
- package/libs/instance-factories/views/templates/ARCHITECTURE.md +198 -0
- package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +869 -0
- package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +953 -0
- package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +806 -0
- package/libs/instance-factories/views/templates/react/app-generator.ts +55 -0
- package/libs/instance-factories/views/templates/react/components-generator.ts +391 -0
- package/libs/instance-factories/views/templates/react/forms-generator.ts +343 -0
- package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +54 -0
- package/libs/instance-factories/views/templates/react/hooks-generator.ts +122 -0
- package/libs/instance-factories/views/templates/react/index-css-generator.ts +209 -0
- package/libs/instance-factories/views/templates/react/index-html-generator.ts +34 -0
- package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +29 -0
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +152 -0
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/react/react-component-generator.js +398 -0
- package/libs/instance-factories/views/templates/react/react-component-generator.js.map +1 -0
- package/libs/instance-factories/views/templates/react/react-component-generator.ts +533 -0
- package/libs/instance-factories/views/templates/react/router-generator.ts +197 -0
- package/libs/instance-factories/views/templates/react/router-generic-generator.ts +103 -0
- package/libs/instance-factories/views/templates/react/spec-json-generator.ts +17 -0
- package/libs/instance-factories/views/templates/react/types-generator.ts +76 -0
- package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +42 -0
- package/libs/instance-factories/views/templates/react/vite-config-generator.ts +38 -0
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +1 -0
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +474 -0
- package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +242 -0
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +77 -0
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/adapter-types.js +47 -0
- package/libs/instance-factories/views/templates/shared/adapter-types.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/adapter-types.ts +142 -0
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +63 -0
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +822 -0
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +908 -0
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts +247 -0
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/base-generator.js +363 -0
- package/libs/instance-factories/views/templates/shared/base-generator.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/base-generator.ts +608 -0
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +254 -0
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/component-metadata.js +602 -0
- package/libs/instance-factories/views/templates/shared/component-metadata.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/component-metadata.ts +803 -0
- package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +250 -0
- package/libs/instance-factories/views/templates/shared/composite-patterns.ts +535 -0
- package/libs/instance-factories/views/templates/shared/index.ts +68 -0
- package/libs/instance-factories/views/templates/shared/pattern-validator.ts +279 -0
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +149 -0
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/property-mapper.js +580 -0
- package/libs/instance-factories/views/templates/shared/property-mapper.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/property-mapper.ts +700 -0
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +143 -0
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +1 -0
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js +420 -0
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +1 -0
- package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +539 -0
- package/package.json +42 -0
- package/schema/SPECVERSE-SCHEMA.json +4274 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prisma Service Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates abstract business logic services
|
|
5
|
+
* Services are NOT tied to specific models but can interact with multiple models
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
9
|
+
import { generateBehaviorBody, type BehaviorContext, type BehaviorMetadata, type OperationMetadata } from './behavior-generator.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate Prisma service
|
|
13
|
+
*/
|
|
14
|
+
export default function generatePrismaService(context: TemplateContext): string {
|
|
15
|
+
const { service, spec } = context;
|
|
16
|
+
|
|
17
|
+
if (!service) {
|
|
18
|
+
throw new Error('Service is required in template context');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const serviceName = service.name;
|
|
22
|
+
const hasEvents = (service.publishes && service.publishes.length > 0) ||
|
|
23
|
+
(service.subscribes && service.subscribes.length > 0);
|
|
24
|
+
|
|
25
|
+
return `/**
|
|
26
|
+
* ${serviceName}
|
|
27
|
+
* Abstract business logic service
|
|
28
|
+
* ${service.description || ''}
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { PrismaClient } from '@prisma/client';
|
|
32
|
+
${hasEvents ? `import { eventBus, EventName } from '../events/eventBus.js';` : ''}
|
|
33
|
+
|
|
34
|
+
const prisma = new PrismaClient();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* ${serviceName} class
|
|
38
|
+
*/
|
|
39
|
+
export class ${serviceName} {
|
|
40
|
+
${generateConstructor(service)}
|
|
41
|
+
${generateOperations(service)}
|
|
42
|
+
${generateEventSubscriptions(service)}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Export singleton instance
|
|
46
|
+
export const ${serviceName.charAt(0).toLowerCase() + serviceName.slice(1)} = new ${serviceName}();
|
|
47
|
+
export default ${serviceName.charAt(0).toLowerCase() + serviceName.slice(1)};
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generate constructor with event subscriptions
|
|
53
|
+
*/
|
|
54
|
+
function generateConstructor(service: any): string {
|
|
55
|
+
const hasSubscriptions = service.subscribes && service.subscribes.length > 0;
|
|
56
|
+
|
|
57
|
+
if (!hasSubscriptions) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return `
|
|
62
|
+
private unsubscribers: Array<() => void> = [];
|
|
63
|
+
|
|
64
|
+
constructor() {
|
|
65
|
+
// Subscribe to events
|
|
66
|
+
this.setupEventSubscriptions();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Setup event subscriptions
|
|
71
|
+
*/
|
|
72
|
+
private setupEventSubscriptions(): void {
|
|
73
|
+
${service.subscribes.map((eventName: string) => `
|
|
74
|
+
// Subscribe to ${eventName}
|
|
75
|
+
const unsubscribe${eventName} = eventBus.subscribe(
|
|
76
|
+
EventName.${eventName},
|
|
77
|
+
this.on${eventName}.bind(this)
|
|
78
|
+
);
|
|
79
|
+
this.unsubscribers.push(unsubscribe${eventName});
|
|
80
|
+
`).join('\n')}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Cleanup subscriptions
|
|
85
|
+
*/
|
|
86
|
+
public destroy(): void {
|
|
87
|
+
this.unsubscribers.forEach(unsubscribe => unsubscribe());
|
|
88
|
+
this.unsubscribers = [];
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Generate service operations
|
|
95
|
+
*/
|
|
96
|
+
function generateOperations(service: any): string {
|
|
97
|
+
if (!service.operations ||
|
|
98
|
+
(Array.isArray(service.operations) && service.operations.length === 0) ||
|
|
99
|
+
(!Array.isArray(service.operations) && Object.keys(service.operations).length === 0)) {
|
|
100
|
+
return `
|
|
101
|
+
/**
|
|
102
|
+
* Execute service logic
|
|
103
|
+
*/
|
|
104
|
+
public async execute(params: any): Promise<any> {
|
|
105
|
+
// TODO: Implement service logic
|
|
106
|
+
throw new Error('Service logic not implemented');
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Normalize: array of operations (with .name) or object entries
|
|
112
|
+
const entries: [string, any][] = Array.isArray(service.operations)
|
|
113
|
+
? service.operations.map((op: any) => [op.name, op])
|
|
114
|
+
: Object.entries(service.operations);
|
|
115
|
+
|
|
116
|
+
const operations: string[] = [];
|
|
117
|
+
|
|
118
|
+
entries.forEach(([operationName, operation]) => {
|
|
119
|
+
operations.push(generateOperation(operationName, operation, service));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return operations.join('\n');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Generate individual operation
|
|
127
|
+
*/
|
|
128
|
+
function generateOperation(operationName: string, operation: any, service: any): string {
|
|
129
|
+
const params = generateOperationParams(operation);
|
|
130
|
+
const hasPublish = service.publishes && service.publishes.length > 0;
|
|
131
|
+
|
|
132
|
+
return `
|
|
133
|
+
/**
|
|
134
|
+
* ${operationName}
|
|
135
|
+
* ${operation.description || ''}
|
|
136
|
+
*/
|
|
137
|
+
public async ${operationName}(${params}): Promise<any> {
|
|
138
|
+
try {
|
|
139
|
+
${generateOperationLogic(operation, service)}
|
|
140
|
+
|
|
141
|
+
${hasPublish ? `
|
|
142
|
+
// Publish event (example)
|
|
143
|
+
// eventBus.publish(EventName.SomeEvent, {
|
|
144
|
+
// operation: '${operationName}',
|
|
145
|
+
// timestamp: new Date().toISOString()
|
|
146
|
+
// });
|
|
147
|
+
` : ''}
|
|
148
|
+
|
|
149
|
+
// Return result
|
|
150
|
+
return { success: true };
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error(\`[${service.name}] ${operationName} failed:\`, error);
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generate operation parameters
|
|
161
|
+
*/
|
|
162
|
+
function generateOperationParams(operation: any): string {
|
|
163
|
+
if (!operation.parameters || Object.keys(operation.parameters).length === 0) {
|
|
164
|
+
return 'params: any = {}';
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const params = Object.entries(operation.parameters).map(([name, param]: [string, any]) => {
|
|
168
|
+
const optional = !param.required;
|
|
169
|
+
return `${name}${optional ? '?' : ''}: ${mapTypeToTypeScript(param.type)}`;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return params.join(', ');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Generate operation logic from behavioral metadata (L3 generation).
|
|
177
|
+
* Falls back to placeholder if no behavioral data available.
|
|
178
|
+
*/
|
|
179
|
+
function generateOperationLogic(operation: any, service: any): string {
|
|
180
|
+
// Check for behavioral metadata — supports both AI-optimized format (implementation.preconditions)
|
|
181
|
+
// and SpecVerse convention format (requires/ensures/publishes)
|
|
182
|
+
const impl = operation.implementation || {};
|
|
183
|
+
const meta = operation.metadata;
|
|
184
|
+
|
|
185
|
+
// Map convention format to implementation format
|
|
186
|
+
if (!impl.preconditions && operation.requires) {
|
|
187
|
+
impl.preconditions = Array.isArray(operation.requires) ? operation.requires : [operation.requires];
|
|
188
|
+
}
|
|
189
|
+
if (!impl.postconditions && operation.ensures) {
|
|
190
|
+
impl.postconditions = Array.isArray(operation.ensures) ? operation.ensures : [operation.ensures];
|
|
191
|
+
}
|
|
192
|
+
if (!impl.sideEffects && operation.publishes) {
|
|
193
|
+
impl.sideEffects = (Array.isArray(operation.publishes) ? operation.publishes : [operation.publishes])
|
|
194
|
+
.map((e: string) => `Publish event: ${e}`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (impl.preconditions?.length || impl.postconditions?.length || impl.steps?.length || impl.transactional) {
|
|
198
|
+
// L3: Generate from behavioral specification
|
|
199
|
+
const modelName = inferModelFromServiceName(service.name);
|
|
200
|
+
const context: BehaviorContext = {
|
|
201
|
+
modelName,
|
|
202
|
+
serviceName: service.name,
|
|
203
|
+
operationName: operation.name || 'execute',
|
|
204
|
+
prismaModel: modelName
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const behavior: BehaviorMetadata = {
|
|
208
|
+
preconditions: impl.preconditions || [],
|
|
209
|
+
postconditions: impl.postconditions || [],
|
|
210
|
+
sideEffects: impl.sideEffects || [],
|
|
211
|
+
steps: impl.steps || [],
|
|
212
|
+
transactional: impl.transactional || false
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const opMeta: OperationMetadata = {
|
|
216
|
+
async: meta?.async ?? true,
|
|
217
|
+
cacheable: meta?.cacheable ?? false,
|
|
218
|
+
idempotent: meta?.idempotent ?? false
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
return generateBehaviorBody(behavior, opMeta, context);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Fallback: placeholder
|
|
225
|
+
if (operation.description) {
|
|
226
|
+
return `// ${operation.description}`;
|
|
227
|
+
}
|
|
228
|
+
return `// TODO: Implement operation logic`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Infer model name from service name.
|
|
233
|
+
* "SpecificationRelationshipService" -> "Specification"
|
|
234
|
+
* "ModelRelationshipService" -> "Model"
|
|
235
|
+
*/
|
|
236
|
+
function inferModelFromServiceName(serviceName: string): string {
|
|
237
|
+
return serviceName
|
|
238
|
+
.replace(/RelationshipService$/, '')
|
|
239
|
+
.replace(/Service$/, '') || 'Entity';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Generate event subscription handlers
|
|
244
|
+
*/
|
|
245
|
+
function generateEventSubscriptions(service: any): string {
|
|
246
|
+
if (!service.subscribes || service.subscribes.length === 0) {
|
|
247
|
+
return '';
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const handlers: string[] = [];
|
|
251
|
+
|
|
252
|
+
service.subscribes.forEach((eventName: string) => {
|
|
253
|
+
handlers.push(`
|
|
254
|
+
/**
|
|
255
|
+
* Handle ${eventName} event
|
|
256
|
+
*/
|
|
257
|
+
private async on${eventName}(payload: any): Promise<void> {
|
|
258
|
+
try {
|
|
259
|
+
console.log(\`[${service.name}] Received ${eventName} event\`, payload);
|
|
260
|
+
|
|
261
|
+
// TODO: Implement event handling logic
|
|
262
|
+
${generateEventHandlerLogic(eventName, service)}
|
|
263
|
+
|
|
264
|
+
console.log(\`[${service.name}] ${eventName} event processed successfully\`);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
console.error(\`[${service.name}] Failed to process ${eventName} event\`, error);
|
|
267
|
+
// TODO: Add error handling (retry, dead letter queue, etc.)
|
|
268
|
+
}
|
|
269
|
+
}`);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
return handlers.join('\n');
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Generate event handler logic placeholder
|
|
277
|
+
*/
|
|
278
|
+
function generateEventHandlerLogic(eventName: string, service: any): string {
|
|
279
|
+
return `
|
|
280
|
+
// Example: Update related records
|
|
281
|
+
// await prisma.someModel.update({
|
|
282
|
+
// where: { id: payload.id },
|
|
283
|
+
// data: { ... }
|
|
284
|
+
// });
|
|
285
|
+
|
|
286
|
+
// Example: Trigger workflows
|
|
287
|
+
// await this.triggerWorkflow(payload);
|
|
288
|
+
|
|
289
|
+
// Example: Publish follow-up events
|
|
290
|
+
// eventBus.publish(EventName.AnotherEvent, {
|
|
291
|
+
// original: payload,
|
|
292
|
+
// processed: true
|
|
293
|
+
// });
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Map SpecVerse types to TypeScript types
|
|
299
|
+
*/
|
|
300
|
+
function mapTypeToTypeScript(type: string): string {
|
|
301
|
+
const typeMap: Record<string, string> = {
|
|
302
|
+
String: 'string',
|
|
303
|
+
Integer: 'number',
|
|
304
|
+
Float: 'number',
|
|
305
|
+
Boolean: 'boolean',
|
|
306
|
+
Date: 'Date',
|
|
307
|
+
DateTime: 'Date',
|
|
308
|
+
UUID: 'string',
|
|
309
|
+
JSON: 'any',
|
|
310
|
+
Array: 'any[]',
|
|
311
|
+
Object: 'Record<string, any>'
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
return typeMap[type] || 'any';
|
|
315
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Resolver Utility for Instance Factories
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent path resolution based on output structure configuration.
|
|
5
|
+
* Supports both standalone and monorepo project structures.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type OutputStructure = 'standalone' | 'monorepo';
|
|
9
|
+
|
|
10
|
+
export interface PathResolverConfig {
|
|
11
|
+
outputStructure?: OutputStructure;
|
|
12
|
+
backendDir?: string;
|
|
13
|
+
frontendDir?: string;
|
|
14
|
+
baseDir?: string;
|
|
15
|
+
apiBaseUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolves output path based on structure and target
|
|
20
|
+
*/
|
|
21
|
+
export function resolvePath(
|
|
22
|
+
relativePath: string,
|
|
23
|
+
target: 'backend' | 'frontend' | 'shared',
|
|
24
|
+
config: PathResolverConfig = {}
|
|
25
|
+
): string {
|
|
26
|
+
const {
|
|
27
|
+
outputStructure = 'monorepo',
|
|
28
|
+
backendDir = 'backend',
|
|
29
|
+
frontendDir = 'frontend',
|
|
30
|
+
baseDir = '.'
|
|
31
|
+
} = config;
|
|
32
|
+
|
|
33
|
+
// For standalone structure, return path as-is
|
|
34
|
+
if (outputStructure === 'standalone') {
|
|
35
|
+
return baseDir === '.' ? relativePath : `${baseDir}/${relativePath}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// For monorepo structure, prefix with appropriate directory
|
|
39
|
+
const prefix = target === 'backend' ? backendDir : target === 'frontend' ? frontendDir : 'shared';
|
|
40
|
+
return `${prefix}/${relativePath}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Resolves import path for cross-component imports
|
|
45
|
+
*/
|
|
46
|
+
export function resolveImportPath(
|
|
47
|
+
from: 'backend' | 'frontend',
|
|
48
|
+
to: 'backend' | 'frontend' | 'shared',
|
|
49
|
+
importPath: string,
|
|
50
|
+
config: PathResolverConfig = {}
|
|
51
|
+
): string {
|
|
52
|
+
const { outputStructure = 'monorepo' } = config;
|
|
53
|
+
|
|
54
|
+
// In standalone mode, imports should be external (via API or npm package)
|
|
55
|
+
if (outputStructure === 'standalone') {
|
|
56
|
+
if (from === 'frontend' && to === 'backend') {
|
|
57
|
+
// Frontend importing from backend - should use API calls, not direct imports
|
|
58
|
+
throw new Error('Frontend cannot directly import from backend in standalone mode. Use API calls.');
|
|
59
|
+
}
|
|
60
|
+
return importPath;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// In monorepo mode, adjust relative paths based on location
|
|
64
|
+
if (from === to) {
|
|
65
|
+
return importPath; // Same workspace, path unchanged
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Cross-workspace import in monorepo
|
|
69
|
+
if (from === 'frontend' && to === 'shared') {
|
|
70
|
+
return `../../shared/${importPath}`;
|
|
71
|
+
}
|
|
72
|
+
if (from === 'backend' && to === 'shared') {
|
|
73
|
+
return `../../shared/${importPath}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return importPath;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Gets API base URL configuration
|
|
81
|
+
*/
|
|
82
|
+
export function getApiBaseUrl(config: PathResolverConfig & { apiBaseUrl?: string }): string {
|
|
83
|
+
const { outputStructure = 'monorepo', apiBaseUrl } = config;
|
|
84
|
+
|
|
85
|
+
// Use configured URL if provided
|
|
86
|
+
if (apiBaseUrl) {
|
|
87
|
+
return apiBaseUrl;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Default based on structure
|
|
91
|
+
if (outputStructure === 'standalone') {
|
|
92
|
+
// In standalone mode, expect external API
|
|
93
|
+
return '${VITE_API_BASE_URL}'; // Environment variable placeholder
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// In monorepo mode, default to local backend
|
|
97
|
+
return 'http://localhost:3000';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Helper to get configuration from template context
|
|
102
|
+
*/
|
|
103
|
+
export function getPathConfig(context: any): PathResolverConfig {
|
|
104
|
+
return {
|
|
105
|
+
outputStructure: context.configuration?.outputStructure || 'monorepo',
|
|
106
|
+
backendDir: context.configuration?.backendDir || 'backend',
|
|
107
|
+
frontendDir: context.configuration?.frontendDir || 'frontend',
|
|
108
|
+
baseDir: context.configuration?.baseDir || '.',
|
|
109
|
+
apiBaseUrl: context.configuration?.apiBaseUrl
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: MongoDB6
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: storage
|
|
4
|
+
description: "MongoDB 6 document database with sharding and replication support"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [mongodb, database, nosql, document]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: "^3.3.0"
|
|
13
|
+
mongodb: ">=6.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "storage.database"
|
|
18
|
+
- "storage.database.document"
|
|
19
|
+
- "storage.database.nosql"
|
|
20
|
+
- "database.mongodb"
|
|
21
|
+
requires: []
|
|
22
|
+
|
|
23
|
+
technology:
|
|
24
|
+
runtime: "node"
|
|
25
|
+
language: "typescript"
|
|
26
|
+
database: "mongodb"
|
|
27
|
+
version: "6.x"
|
|
28
|
+
|
|
29
|
+
dependencies:
|
|
30
|
+
runtime: [] # Database runs separately
|
|
31
|
+
|
|
32
|
+
dev:
|
|
33
|
+
- name: "mongodb"
|
|
34
|
+
version: "^6.3.0"
|
|
35
|
+
description: "MongoDB driver for Node.js"
|
|
36
|
+
|
|
37
|
+
codeTemplates:
|
|
38
|
+
config:
|
|
39
|
+
engine: typescript
|
|
40
|
+
generator: "libs/instance-factories/storage/templates/mongodb/config-generator.ts"
|
|
41
|
+
outputPattern: "config/database.{instance}.ts"
|
|
42
|
+
|
|
43
|
+
docker:
|
|
44
|
+
engine: typescript
|
|
45
|
+
generator: "libs/instance-factories/storage/templates/mongodb/docker-generator.ts"
|
|
46
|
+
outputPattern: "docker/mongodb.{instance}.yml"
|
|
47
|
+
|
|
48
|
+
configuration:
|
|
49
|
+
# Database connection
|
|
50
|
+
host: "${MONGO_HOST:-localhost}"
|
|
51
|
+
port: 27017
|
|
52
|
+
database: "${MONGO_DB}"
|
|
53
|
+
username: "${MONGO_USER}"
|
|
54
|
+
password: "${MONGO_PASSWORD}"
|
|
55
|
+
authSource: "admin"
|
|
56
|
+
|
|
57
|
+
# Connection options
|
|
58
|
+
options:
|
|
59
|
+
maxPoolSize: 10
|
|
60
|
+
minPoolSize: 2
|
|
61
|
+
serverSelectionTimeoutMS: 5000
|
|
62
|
+
socketTimeoutMS: 45000
|
|
63
|
+
|
|
64
|
+
# Replication
|
|
65
|
+
replication:
|
|
66
|
+
enabled: false
|
|
67
|
+
replSetName: "rs0"
|
|
68
|
+
replicas: 3
|
|
69
|
+
|
|
70
|
+
# Sharding
|
|
71
|
+
sharding:
|
|
72
|
+
enabled: false
|
|
73
|
+
shardKey: "_id"
|
|
74
|
+
|
|
75
|
+
# Backup
|
|
76
|
+
backup:
|
|
77
|
+
enabled: true
|
|
78
|
+
schedule: "0 2 * * *" # Daily at 2am
|
|
79
|
+
retention: 7 # days
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: PostgreSQL15
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: storage
|
|
4
|
+
description: "PostgreSQL 15 database with optimized configuration for production"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [postgresql, database, sql, relational]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: "^3.3.0"
|
|
13
|
+
postgresql: ">=15.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "storage.database"
|
|
18
|
+
- "storage.database.relational"
|
|
19
|
+
- "storage.database.sql"
|
|
20
|
+
- "database.postgresql"
|
|
21
|
+
requires: []
|
|
22
|
+
|
|
23
|
+
technology:
|
|
24
|
+
runtime: "node"
|
|
25
|
+
language: "typescript"
|
|
26
|
+
database: "postgresql"
|
|
27
|
+
version: "15.x"
|
|
28
|
+
|
|
29
|
+
dependencies:
|
|
30
|
+
runtime: [] # Database runs separately
|
|
31
|
+
|
|
32
|
+
dev:
|
|
33
|
+
- name: "pg"
|
|
34
|
+
version: "^8.11.0"
|
|
35
|
+
description: "PostgreSQL client for Node.js"
|
|
36
|
+
|
|
37
|
+
codeTemplates:
|
|
38
|
+
config:
|
|
39
|
+
engine: typescript
|
|
40
|
+
generator: "libs/instance-factories/storage/templates/postgresql/config-generator.ts"
|
|
41
|
+
outputPattern: "config/database.{instance}.ts"
|
|
42
|
+
|
|
43
|
+
docker:
|
|
44
|
+
engine: typescript
|
|
45
|
+
generator: "libs/instance-factories/storage/templates/postgresql/docker-generator.ts"
|
|
46
|
+
outputPattern: "docker/postgres.{instance}.yml"
|
|
47
|
+
|
|
48
|
+
configuration:
|
|
49
|
+
# Database connection
|
|
50
|
+
host: "${DB_HOST:-localhost}"
|
|
51
|
+
port: 5432
|
|
52
|
+
database: "${DB_NAME}"
|
|
53
|
+
username: "${DB_USER}"
|
|
54
|
+
password: "${DB_PASSWORD}"
|
|
55
|
+
|
|
56
|
+
# Connection pool
|
|
57
|
+
pool:
|
|
58
|
+
min: 2
|
|
59
|
+
max: 10
|
|
60
|
+
idleTimeoutMillis: 30000
|
|
61
|
+
connectionTimeoutMillis: 2000
|
|
62
|
+
|
|
63
|
+
# Performance
|
|
64
|
+
settings:
|
|
65
|
+
max_connections: 100
|
|
66
|
+
shared_buffers: "256MB"
|
|
67
|
+
effective_cache_size: "1GB"
|
|
68
|
+
work_mem: "16MB"
|
|
69
|
+
maintenance_work_mem: "128MB"
|
|
70
|
+
|
|
71
|
+
# Backup
|
|
72
|
+
backup:
|
|
73
|
+
enabled: true
|
|
74
|
+
schedule: "0 2 * * *" # Daily at 2am
|
|
75
|
+
retention: 7 # days
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Redis7
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: storage
|
|
4
|
+
description: "Redis 7 in-memory data store for caching and session management"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [redis, cache, session, key-value]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: "^3.3.0"
|
|
13
|
+
redis: ">=7.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "storage.cache"
|
|
18
|
+
- "storage.cache.memory"
|
|
19
|
+
- "storage.session"
|
|
20
|
+
- "database.redis"
|
|
21
|
+
requires: []
|
|
22
|
+
|
|
23
|
+
technology:
|
|
24
|
+
runtime: "node"
|
|
25
|
+
language: "typescript"
|
|
26
|
+
database: "redis"
|
|
27
|
+
version: "7.x"
|
|
28
|
+
|
|
29
|
+
dependencies:
|
|
30
|
+
runtime: [] # Database runs separately
|
|
31
|
+
|
|
32
|
+
dev:
|
|
33
|
+
- name: "redis"
|
|
34
|
+
version: "^4.6.0"
|
|
35
|
+
description: "Redis client for Node.js"
|
|
36
|
+
- name: "@types/redis"
|
|
37
|
+
version: "^4.0.11"
|
|
38
|
+
|
|
39
|
+
codeTemplates:
|
|
40
|
+
config:
|
|
41
|
+
engine: typescript
|
|
42
|
+
generator: "libs/instance-factories/storage/templates/redis/config-generator.ts"
|
|
43
|
+
outputPattern: "config/cache.{instance}.ts"
|
|
44
|
+
|
|
45
|
+
docker:
|
|
46
|
+
engine: typescript
|
|
47
|
+
generator: "libs/instance-factories/storage/templates/redis/docker-generator.ts"
|
|
48
|
+
outputPattern: "docker/redis.{instance}.yml"
|
|
49
|
+
|
|
50
|
+
configuration:
|
|
51
|
+
# Connection
|
|
52
|
+
host: "${REDIS_HOST:-localhost}"
|
|
53
|
+
port: 6379
|
|
54
|
+
password: "${REDIS_PASSWORD}"
|
|
55
|
+
database: 0
|
|
56
|
+
|
|
57
|
+
# Connection options
|
|
58
|
+
options:
|
|
59
|
+
connectTimeout: 10000
|
|
60
|
+
commandTimeout: 5000
|
|
61
|
+
retryStrategy: "exponential"
|
|
62
|
+
maxRetriesPerRequest: 3
|
|
63
|
+
|
|
64
|
+
# Memory management
|
|
65
|
+
memory:
|
|
66
|
+
maxMemory: "256mb"
|
|
67
|
+
evictionPolicy: "allkeys-lru"
|
|
68
|
+
|
|
69
|
+
# Persistence
|
|
70
|
+
persistence:
|
|
71
|
+
enabled: true
|
|
72
|
+
strategy: "aof" # append-only file
|
|
73
|
+
fsync: "everysec"
|
|
74
|
+
|
|
75
|
+
# Backup
|
|
76
|
+
backup:
|
|
77
|
+
enabled: true
|
|
78
|
+
schedule: "0 * * * *" # Hourly
|
|
79
|
+
retention: 24 # hours
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB Configuration Generator
|
|
3
|
+
*/
|
|
4
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
5
|
+
|
|
6
|
+
export default function generateMongoDBConfig(context: TemplateContext): string {
|
|
7
|
+
const { instance } = context;
|
|
8
|
+
const instanceName = instance?.name || 'mongodb';
|
|
9
|
+
return `// MongoDB configuration for ${instanceName}
|
|
10
|
+
// TODO: Implement full MongoDB config generator
|
|
11
|
+
export const mongoConfig = {
|
|
12
|
+
url: process.env.MONGO_URL || 'mongodb://localhost:27017/${instanceName}'
|
|
13
|
+
};
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB Docker Compose Generator
|
|
3
|
+
*/
|
|
4
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
5
|
+
|
|
6
|
+
export default function generateMongoDBDocker(context: TemplateContext): string {
|
|
7
|
+
const { instance } = context;
|
|
8
|
+
const instanceName = instance?.name || 'mongodb';
|
|
9
|
+
return `# MongoDB Docker Compose for ${instanceName}
|
|
10
|
+
# TODO: Implement full MongoDB docker generator
|
|
11
|
+
version: '3.8'
|
|
12
|
+
services:
|
|
13
|
+
${instanceName}:
|
|
14
|
+
image: mongo:6
|
|
15
|
+
ports:
|
|
16
|
+
- "27017:27017"
|
|
17
|
+
`;
|
|
18
|
+
}
|