@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,269 @@
|
|
|
1
|
+
# Example Template for SpecVerse Example Documentation
|
|
2
|
+
|
|
3
|
+
This template provides a consistent structure for documenting SpecVerse examples. Use this when adding new examples to maintain consistency across the documentation.
|
|
4
|
+
|
|
5
|
+
## Common Structure Pattern
|
|
6
|
+
|
|
7
|
+
Based on analysis of existing examples, here's the standard structure:
|
|
8
|
+
|
|
9
|
+
### Basic Structure (for fundamental examples)
|
|
10
|
+
```markdown
|
|
11
|
+
# Example XX-YY: [Descriptive Title]
|
|
12
|
+
|
|
13
|
+
This example demonstrates [brief description of what the example shows] in SpecVerse.
|
|
14
|
+
|
|
15
|
+
## Learning Objectives
|
|
16
|
+
|
|
17
|
+
- [First learning objective]
|
|
18
|
+
- [Second learning objective]
|
|
19
|
+
- [Third learning objective]
|
|
20
|
+
- [Fourth learning objective]
|
|
21
|
+
|
|
22
|
+
## Key Concepts
|
|
23
|
+
|
|
24
|
+
### [First Concept Name]
|
|
25
|
+
[Description of the concept with code example]
|
|
26
|
+
```specly
|
|
27
|
+
[code example]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### [Second Concept Name]
|
|
31
|
+
[Description with code example]
|
|
32
|
+
|
|
33
|
+
## Visual Diagram
|
|
34
|
+
|
|
35
|
+
import Mermaid from '@site/src/components/Mermaid';
|
|
36
|
+
|
|
37
|
+
{/* Auto-generated diagram from canonical examples */}
|
|
38
|
+
|
|
39
|
+
{/* Generated: [TIMESTAMP] */}
|
|
40
|
+
|
|
41
|
+
<div className="diagram-generated">
|
|
42
|
+
|
|
43
|
+
<Mermaid chart={`
|
|
44
|
+
[mermaid diagram content]
|
|
45
|
+
`} />
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
## Complete Example
|
|
50
|
+
|
|
51
|
+
### Primary: Specly DSL Format (.specly)
|
|
52
|
+
```specly
|
|
53
|
+
[complete example code]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See the full file: [XX-YY-example-name.specly](./XX-YY-example-name.specly)
|
|
57
|
+
|
|
58
|
+
### Generated: YAML Format
|
|
59
|
+
The YAML format is automatically generated from the Specly DSL using:
|
|
60
|
+
```bash
|
|
61
|
+
specverse gen yaml XX-YY-example-name.specly -o XX-YY-example-name.yaml
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Key Features Demonstrated
|
|
65
|
+
|
|
66
|
+
- [Feature 1]
|
|
67
|
+
- [Feature 2]
|
|
68
|
+
- [Feature 3]
|
|
69
|
+
|
|
70
|
+
## Validation
|
|
71
|
+
|
|
72
|
+
Test this example:
|
|
73
|
+
```bash
|
|
74
|
+
# Validate the Specly source file
|
|
75
|
+
specverse validate examples/[category]/XX-YY-example-name.specly
|
|
76
|
+
|
|
77
|
+
# Run full test cycle
|
|
78
|
+
specverse test cycle examples/[category]/XX-YY-example-name.specly
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Next Steps
|
|
82
|
+
|
|
83
|
+
Continue to [Example XX-YY: Next Example](./XX-YY-next-example) to learn about [next topic].
|
|
84
|
+
|
|
85
|
+
## Related Examples
|
|
86
|
+
|
|
87
|
+
- [Example AA-BB: Related Example](../category/AA-BB-related-example) - [Brief description]
|
|
88
|
+
- [Example CC-DD: Another Related](../category/CC-DD-another-related) - [Brief description]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Advanced Structure (for architecture/domain examples)
|
|
92
|
+
```markdown
|
|
93
|
+
# Example XX-YY: [Descriptive Title]
|
|
94
|
+
|
|
95
|
+
This [comprehensive/advanced] example demonstrates [complex scenario description] in SpecVerse, showcasing [list of major features].
|
|
96
|
+
|
|
97
|
+
## Learning Objectives
|
|
98
|
+
|
|
99
|
+
- [Learning objective focused on real-world application]
|
|
100
|
+
- [Learning objective about integration]
|
|
101
|
+
- [Learning objective about advanced patterns]
|
|
102
|
+
- [Learning objective about scalability]
|
|
103
|
+
|
|
104
|
+
## Business Domain / Use Case
|
|
105
|
+
|
|
106
|
+
[Description of the business domain or real-world scenario this example addresses]
|
|
107
|
+
|
|
108
|
+
## Key Features
|
|
109
|
+
|
|
110
|
+
### [Feature Category 1]
|
|
111
|
+
```specly
|
|
112
|
+
[code example showing this feature]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### [Feature Category 2]
|
|
116
|
+
```specly
|
|
117
|
+
[code example]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Visual Diagram
|
|
121
|
+
|
|
122
|
+
[Same diagram structure as basic]
|
|
123
|
+
|
|
124
|
+
## Architecture Patterns
|
|
125
|
+
|
|
126
|
+
### [Pattern Name 1]
|
|
127
|
+
- [Description of the pattern]
|
|
128
|
+
- [When to use it]
|
|
129
|
+
- [Benefits]
|
|
130
|
+
|
|
131
|
+
### [Pattern Name 2]
|
|
132
|
+
- [Description]
|
|
133
|
+
- [Implementation details]
|
|
134
|
+
|
|
135
|
+
## Complete Example
|
|
136
|
+
|
|
137
|
+
### Primary: Specly DSL Format
|
|
138
|
+
```specly
|
|
139
|
+
[full example]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Key Features Demonstrated
|
|
143
|
+
|
|
144
|
+
### V3.1 Core Features
|
|
145
|
+
- [Core feature 1]
|
|
146
|
+
- [Core feature 2]
|
|
147
|
+
|
|
148
|
+
### Advanced Patterns
|
|
149
|
+
- [Advanced pattern 1]
|
|
150
|
+
- [Advanced pattern 2]
|
|
151
|
+
|
|
152
|
+
## Business Use Cases
|
|
153
|
+
|
|
154
|
+
- [Use case 1]
|
|
155
|
+
- [Use case 2]
|
|
156
|
+
|
|
157
|
+
## Validation
|
|
158
|
+
|
|
159
|
+
[Same validation structure]
|
|
160
|
+
|
|
161
|
+
## Next Steps / Related Examples
|
|
162
|
+
|
|
163
|
+
[Same structure]
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Special Structure (for feature demonstration like steps)
|
|
167
|
+
```markdown
|
|
168
|
+
# Example XX-YY: [Feature Name]
|
|
169
|
+
|
|
170
|
+
**Example**: `XX-YY-feature-name.specly`
|
|
171
|
+
**Category**: [Category]
|
|
172
|
+
**Demonstrates**: [Brief description of the specific feature being demonstrated]
|
|
173
|
+
|
|
174
|
+
## Overview
|
|
175
|
+
|
|
176
|
+
[Detailed description of what the feature does and why it's useful]
|
|
177
|
+
|
|
178
|
+
## Key Features
|
|
179
|
+
|
|
180
|
+
### [Feature Name] Support
|
|
181
|
+
- **Context 1**: [How it works in first context]
|
|
182
|
+
- **Context 2**: [How it works in second context]
|
|
183
|
+
- **Context 3**: [How it works in third context]
|
|
184
|
+
|
|
185
|
+
### Format and Usage
|
|
186
|
+
```yaml
|
|
187
|
+
[example showing the feature syntax]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Implementation Details
|
|
191
|
+
|
|
192
|
+
### [Context 1] with [Feature]
|
|
193
|
+
[Description of how the feature is used in this context]
|
|
194
|
+
|
|
195
|
+
### [Context 2] with [Feature]
|
|
196
|
+
[Description of usage in second context]
|
|
197
|
+
|
|
198
|
+
## Benefits
|
|
199
|
+
|
|
200
|
+
### [Benefit Category 1]
|
|
201
|
+
- [Specific benefit 1]
|
|
202
|
+
- [Specific benefit 2]
|
|
203
|
+
|
|
204
|
+
### [Benefit Category 2]
|
|
205
|
+
- [Specific benefit 3]
|
|
206
|
+
- [Specific benefit 4]
|
|
207
|
+
|
|
208
|
+
## Schema Validation
|
|
209
|
+
|
|
210
|
+
[Description of how the feature is validated]
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
[schema snippet if relevant]
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Backward Compatibility
|
|
217
|
+
|
|
218
|
+
[Description of compatibility considerations]
|
|
219
|
+
|
|
220
|
+
## Usage Guidelines
|
|
221
|
+
|
|
222
|
+
### When to Use [Feature]
|
|
223
|
+
- [Scenario 1]
|
|
224
|
+
- [Scenario 2]
|
|
225
|
+
|
|
226
|
+
### Best Practices
|
|
227
|
+
- [Practice 1]
|
|
228
|
+
- [Practice 2]
|
|
229
|
+
|
|
230
|
+
[Rest follows standard structure]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Template Usage Instructions
|
|
234
|
+
|
|
235
|
+
1. **Choose the appropriate structure** based on your example type:
|
|
236
|
+
- **Basic**: For fundamental concepts (01-fundamentals)
|
|
237
|
+
- **Advanced**: For architecture/domain examples (03-architecture, 04-domains)
|
|
238
|
+
- **Special**: For specific feature demonstrations
|
|
239
|
+
|
|
240
|
+
2. **Replace placeholder content**:
|
|
241
|
+
- `XX-YY`: Replace with actual example number
|
|
242
|
+
- `[Descriptive Title]`: Replace with clear, descriptive title
|
|
243
|
+
- `[Category]`: Replace with category name (Fundamentals, Architecture, etc.)
|
|
244
|
+
- All bracketed placeholders with actual content
|
|
245
|
+
|
|
246
|
+
3. **Maintain consistency**:
|
|
247
|
+
- Use the same section headings across similar examples
|
|
248
|
+
- Keep code examples properly formatted with ```specly blocks
|
|
249
|
+
- Include validation commands for all examples
|
|
250
|
+
- Always link to related examples
|
|
251
|
+
|
|
252
|
+
4. **Key sections that should always be present**:
|
|
253
|
+
- Learning Objectives (3-5 bullet points)
|
|
254
|
+
- Key Concepts (with code examples)
|
|
255
|
+
- Complete Example (full .specly code)
|
|
256
|
+
- Validation (with bash commands)
|
|
257
|
+
- Next Steps / Related Examples
|
|
258
|
+
|
|
259
|
+
5. **Visual diagrams**:
|
|
260
|
+
- Include the standard Mermaid import and structure
|
|
261
|
+
- The diagram content is auto-generated, so use placeholder text
|
|
262
|
+
- Always include the "Generated: [TIMESTAMP]" comment
|
|
263
|
+
|
|
264
|
+
6. **File naming**:
|
|
265
|
+
- MD file should match .specly file name exactly
|
|
266
|
+
- Use descriptive, hyphenated names
|
|
267
|
+
- Follow category numbering convention
|
|
268
|
+
|
|
269
|
+
This template ensures consistency across all SpecVerse examples while allowing flexibility for different types of content.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Project Guides
|
|
2
|
+
|
|
3
|
+
Add your project-specific documentation and guides here.
|
|
4
|
+
|
|
5
|
+
## Suggested Structure
|
|
6
|
+
|
|
7
|
+
- `getting-started.md` - How to set up and run the project
|
|
8
|
+
- `architecture.md` - System architecture overview
|
|
9
|
+
- `deployment.md` - Deployment and scaling guide
|
|
10
|
+
- `api.md` - API usage examples
|
|
11
|
+
- `troubleshooting.md` - Common issues and solutions
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
Use `../example-documentation-template.md` as a starting point for creating guides.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Database Configuration
|
|
2
|
+
# Default database name is based on project name: spv_{{projectNameKebab}}_dev
|
|
3
|
+
DATABASE_URL="postgresql://{{DB_USER}}:{{DB_PASSWORD}}@localhost:5432/spv_{{projectNameKebab}}_dev"
|
|
4
|
+
|
|
5
|
+
# API Configuration
|
|
6
|
+
PORT=3000
|
|
7
|
+
NODE_ENV=development
|
|
8
|
+
|
|
9
|
+
# Frontend Configuration (if using views)
|
|
10
|
+
VITE_API_URL="http://localhost:3000"
|
|
11
|
+
|
|
12
|
+
# Security (generate secure values for production)
|
|
13
|
+
JWT_SECRET="your-secret-key-here"
|
|
14
|
+
SESSION_SECRET="your-session-secret-here"
|
|
15
|
+
|
|
16
|
+
# Optional: Override default database user
|
|
17
|
+
# DB_USER=your_username
|
|
18
|
+
# DB_PASSWORD=your_password
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated Directory
|
|
2
|
+
|
|
3
|
+
This directory contains specifications and artifacts generated by SpecVerse tools.
|
|
4
|
+
|
|
5
|
+
## Generated Content
|
|
6
|
+
|
|
7
|
+
When you run SpecVerse generation commands, files will be created here:
|
|
8
|
+
|
|
9
|
+
### Inferred Specifications
|
|
10
|
+
- **Complete Specifications**: AI-expanded specifications with full architecture
|
|
11
|
+
- **Deployment Specifications**: Environment-specific deployment configurations
|
|
12
|
+
- **Enhanced Specifications**: Minimally enhanced specifications
|
|
13
|
+
|
|
14
|
+
### Documentation (`docs/` subdirectory)
|
|
15
|
+
- **Generated Documentation**: Markdown documentation for inferred specifications
|
|
16
|
+
- **UML Diagrams**: Entity-relationship and deployment diagrams
|
|
17
|
+
- **API Documentation**: Generated API specifications
|
|
18
|
+
|
|
19
|
+
### Other Artifacts
|
|
20
|
+
- **Processed YAML**: Processed specification files
|
|
21
|
+
- **Type Definitions**: Generated type definitions
|
|
22
|
+
- **Database Schemas**: SQL DDL scripts and migrations
|
|
23
|
+
|
|
24
|
+
## Generation Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Generate complete specification with docs
|
|
28
|
+
npm run infer
|
|
29
|
+
|
|
30
|
+
# Generate deployment specifications with docs
|
|
31
|
+
npm run infer:deployment
|
|
32
|
+
npm run infer:deployment:prod
|
|
33
|
+
|
|
34
|
+
# Generate minimal enhancements
|
|
35
|
+
npm run infer:minimal
|
|
36
|
+
|
|
37
|
+
# Generate documentation for existing files
|
|
38
|
+
npm run generate:docs
|
|
39
|
+
npm run generate:diagrams
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Git Ignore
|
|
43
|
+
|
|
44
|
+
This directory is ignored by git (see `.gitignore`) because generated files should not be committed to version control. They can be recreated from your specifications at any time.
|
|
45
|
+
|
|
46
|
+
## Cleaning
|
|
47
|
+
|
|
48
|
+
To clean generated files:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Remove all generated files
|
|
52
|
+
rm -rf generated/*
|
|
53
|
+
|
|
54
|
+
# Regenerate from specifications
|
|
55
|
+
npm run generate:all
|
|
56
|
+
```
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Integration Test for Generated Code
|
|
5
|
+
*
|
|
6
|
+
* Tests that generated services and routes actually execute correctly:
|
|
7
|
+
* - Service methods can be called
|
|
8
|
+
* - Validation works
|
|
9
|
+
* - Database operations execute (with mock)
|
|
10
|
+
* - Event publishing happens
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { dirname, join } from 'path';
|
|
15
|
+
import { existsSync } from 'fs';
|
|
16
|
+
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
|
|
20
|
+
// ANSI color codes
|
|
21
|
+
const GREEN = '\x1b[32m';
|
|
22
|
+
const RED = '\x1b[31m';
|
|
23
|
+
const YELLOW = '\x1b[33m';
|
|
24
|
+
const BLUE = '\x1b[34m';
|
|
25
|
+
const RESET = '\x1b[0m';
|
|
26
|
+
|
|
27
|
+
let testsPassed = 0;
|
|
28
|
+
let testsFailed = 0;
|
|
29
|
+
|
|
30
|
+
function log(message, color = RESET) {
|
|
31
|
+
console.log(`${color}${message}${RESET}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function assert(condition, message) {
|
|
35
|
+
if (condition) {
|
|
36
|
+
log(` ✅ ${message}`, GREEN);
|
|
37
|
+
testsPassed++;
|
|
38
|
+
return true;
|
|
39
|
+
} else {
|
|
40
|
+
log(` ❌ ${message}`, RED);
|
|
41
|
+
testsFailed++;
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Mock database and event bus
|
|
47
|
+
class MockDatabase {
|
|
48
|
+
constructor() {
|
|
49
|
+
this.data = new Map();
|
|
50
|
+
this.operations = [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
create(model, data) {
|
|
54
|
+
const id = data.id || Math.random().toString(36);
|
|
55
|
+
const record = { ...data, id, createdAt: new Date(), version: 0 };
|
|
56
|
+
this.data.set(id, record);
|
|
57
|
+
this.operations.push({ type: 'create', model, data: record });
|
|
58
|
+
return record;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
findOne(model, where) {
|
|
62
|
+
for (const [id, record] of this.data.entries()) {
|
|
63
|
+
if (where.id === id && (!where.deletedAt || record.deletedAt === where.deletedAt)) {
|
|
64
|
+
return record;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
update(model, id, data) {
|
|
71
|
+
const record = this.data.get(id);
|
|
72
|
+
if (!record) return null;
|
|
73
|
+
|
|
74
|
+
const updated = { ...record, ...data, updatedAt: new Date(), version: record.version + 1 };
|
|
75
|
+
this.data.set(id, updated);
|
|
76
|
+
this.operations.push({ type: 'update', model, id, data: updated });
|
|
77
|
+
return updated;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
delete(model, id) {
|
|
81
|
+
const record = this.data.get(id);
|
|
82
|
+
if (!record) return null;
|
|
83
|
+
|
|
84
|
+
// Soft delete
|
|
85
|
+
record.deletedAt = new Date();
|
|
86
|
+
this.data.set(id, record);
|
|
87
|
+
this.operations.push({ type: 'delete', model, id });
|
|
88
|
+
return record;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
class MockEventBus {
|
|
93
|
+
constructor() {
|
|
94
|
+
this.events = [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async publish(eventName, payload) {
|
|
98
|
+
this.events.push({ eventName, payload, timestamp: new Date() });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getEvents() {
|
|
102
|
+
return this.events;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function runTests() {
|
|
107
|
+
log('\n🧪 Running Integration Tests for Generated Code\n', BLUE);
|
|
108
|
+
|
|
109
|
+
// Test 1: Check file structure
|
|
110
|
+
log('Test Suite 1: File Structure', BLUE);
|
|
111
|
+
assert(existsSync(join(__dirname, 'services')), 'Services directory exists');
|
|
112
|
+
assert(existsSync(join(__dirname, 'routes')), 'Routes directory exists');
|
|
113
|
+
|
|
114
|
+
// Test 2: Load and instantiate service
|
|
115
|
+
log('\nTest Suite 2: Service Instantiation', BLUE);
|
|
116
|
+
|
|
117
|
+
const db = new MockDatabase();
|
|
118
|
+
const eventBus = new MockEventBus();
|
|
119
|
+
|
|
120
|
+
let ServiceClass;
|
|
121
|
+
let serviceName;
|
|
122
|
+
|
|
123
|
+
// Try to find a service file
|
|
124
|
+
const { readdirSync } = await import('fs');
|
|
125
|
+
const serviceFiles = readdirSync(join(__dirname, 'services')).filter(f => f.endsWith('.service.ts'));
|
|
126
|
+
|
|
127
|
+
if (serviceFiles.length === 0) {
|
|
128
|
+
log(' ⚠️ No service files found to test', YELLOW);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
serviceName = serviceFiles[0].replace('.service.ts', '');
|
|
133
|
+
log(` 📝 Testing service: ${serviceName}`, BLUE);
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
// Note: This requires tsx or ts-node to run TypeScript directly
|
|
137
|
+
// For production testing, compile to JS first
|
|
138
|
+
const servicePath = join(__dirname, 'services', serviceFiles[0]);
|
|
139
|
+
|
|
140
|
+
log(` → Attempting to load service from: ${servicePath}`);
|
|
141
|
+
|
|
142
|
+
// This is a demonstration - actual loading would need proper TS support
|
|
143
|
+
assert(existsSync(servicePath), `Service file exists: ${serviceFiles[0]}`);
|
|
144
|
+
|
|
145
|
+
} catch (error) {
|
|
146
|
+
log(` ⚠️ Service loading requires TypeScript compilation: ${error.message}`, YELLOW);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Test 3: Validate method structure (by reading source)
|
|
150
|
+
log('\nTest Suite 3: v3.3 Feature Detection', BLUE);
|
|
151
|
+
|
|
152
|
+
const { readFileSync } = await import('fs');
|
|
153
|
+
const serviceContent = readFileSync(join(__dirname, 'services', serviceFiles[0]), 'utf-8');
|
|
154
|
+
|
|
155
|
+
// Check for v3.3 features
|
|
156
|
+
assert(
|
|
157
|
+
serviceContent.includes('validate(data'),
|
|
158
|
+
'Service has unified validate() method'
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
assert(
|
|
162
|
+
serviceContent.includes("operation: 'create' | 'update' | 'evolve'"),
|
|
163
|
+
'Validate method accepts operation context'
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
assert(
|
|
167
|
+
serviceContent.includes('this.validate(data,'),
|
|
168
|
+
'CURED operations call validate() internally'
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
assert(
|
|
172
|
+
serviceContent.includes('version mismatch') || serviceContent.includes('version'),
|
|
173
|
+
'Optimistic locking (version checking) present'
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
assert(
|
|
177
|
+
serviceContent.includes('deletedAt: null') || serviceContent.includes('isDeleted:'),
|
|
178
|
+
'Soft delete filtering present'
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
assert(
|
|
182
|
+
serviceContent.includes('eventBus.publish'),
|
|
183
|
+
'Event publishing present'
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// Test 4: Route structure
|
|
187
|
+
log('\nTest Suite 4: Route Structure', BLUE);
|
|
188
|
+
|
|
189
|
+
const routeDirs = readdirSync(join(__dirname, 'routes')).filter(f => {
|
|
190
|
+
const stat = require('fs').statSync(join(__dirname, 'routes', f));
|
|
191
|
+
return stat.isDirectory();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
assert(routeDirs.length > 0, `Found ${routeDirs.length} route directory(ies)`);
|
|
195
|
+
|
|
196
|
+
for (const routeDir of routeDirs) {
|
|
197
|
+
const routeFiles = readdirSync(join(__dirname, 'routes', routeDir));
|
|
198
|
+
|
|
199
|
+
// Check for CURED operations
|
|
200
|
+
const hasCRUD = routeFiles.some(f => ['create', 'retrieve', 'update', 'destroy'].some(op => f.includes(op)));
|
|
201
|
+
assert(hasCRUD, `${routeDir}: Has CURED operation files`);
|
|
202
|
+
|
|
203
|
+
// Check for validate endpoint
|
|
204
|
+
const hasValidate = routeFiles.some(f => f.includes('validate'));
|
|
205
|
+
assert(hasValidate, `${routeDir}: Has unified validate endpoint`);
|
|
206
|
+
|
|
207
|
+
// Should NOT have validate-create or validate-update
|
|
208
|
+
const hasWrongValidate = routeFiles.some(f =>
|
|
209
|
+
f.includes('validate-create') || f.includes('validate-update')
|
|
210
|
+
);
|
|
211
|
+
assert(!hasWrongValidate, `${routeDir}: No separate validate-create/update endpoints`);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Test 5: Mock service execution
|
|
215
|
+
log('\nTest Suite 5: Mock Service Execution', BLUE);
|
|
216
|
+
|
|
217
|
+
// Create a simple mock service to demonstrate functionality
|
|
218
|
+
class MockTaskService {
|
|
219
|
+
constructor(db, eventBus) {
|
|
220
|
+
this.db = db;
|
|
221
|
+
this.eventBus = eventBus;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
validate(data, context) {
|
|
225
|
+
const errors = [];
|
|
226
|
+
|
|
227
|
+
if (context.operation === 'create') {
|
|
228
|
+
if (!data.title) {
|
|
229
|
+
errors.push('Title is required');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return { valid: errors.length === 0, errors };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async create(data) {
|
|
237
|
+
const validationResult = this.validate(data, { operation: 'create' });
|
|
238
|
+
if (!validationResult.valid) {
|
|
239
|
+
throw new Error(`Validation failed: ${validationResult.errors.join(', ')}`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const task = this.db.create('Task', data);
|
|
243
|
+
await this.eventBus.publish('TaskCreated', { taskId: task.id });
|
|
244
|
+
return task;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
async update(id, data) {
|
|
248
|
+
const validationResult = this.validate(data, { operation: 'update' });
|
|
249
|
+
if (!validationResult.valid) {
|
|
250
|
+
throw new Error(`Validation failed: ${validationResult.errors.join(', ')}`);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Version checking
|
|
254
|
+
if (data.version !== undefined) {
|
|
255
|
+
const existing = this.db.findOne('Task', { id });
|
|
256
|
+
if (existing && existing.version !== data.version) {
|
|
257
|
+
throw new Error('Version mismatch: record has been modified');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const task = this.db.update('Task', id, data);
|
|
262
|
+
await this.eventBus.publish('TaskUpdated', { taskId: id });
|
|
263
|
+
return task;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const mockService = new MockTaskService(db, eventBus);
|
|
268
|
+
|
|
269
|
+
// Test create with validation
|
|
270
|
+
try {
|
|
271
|
+
await mockService.create({ title: 'Test Task' });
|
|
272
|
+
assert(true, 'Service.create() executed successfully');
|
|
273
|
+
} catch (error) {
|
|
274
|
+
assert(false, `Service.create() failed: ${error.message}`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
assert(db.operations.length > 0, 'Database operations were performed');
|
|
278
|
+
assert(eventBus.events.length > 0, 'Events were published');
|
|
279
|
+
|
|
280
|
+
// Test validation failure
|
|
281
|
+
try {
|
|
282
|
+
await mockService.create({});
|
|
283
|
+
assert(false, 'Validation should have failed for empty data');
|
|
284
|
+
} catch (error) {
|
|
285
|
+
assert(error.message.includes('Validation failed'), 'Validation correctly rejected invalid data');
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Test optimistic locking
|
|
289
|
+
const task = db.data.values().next().value;
|
|
290
|
+
try {
|
|
291
|
+
await mockService.update(task.id, { title: 'Updated', version: 999 });
|
|
292
|
+
assert(false, 'Version mismatch should have been detected');
|
|
293
|
+
} catch (error) {
|
|
294
|
+
assert(error.message.includes('Version mismatch'), 'Optimistic locking works correctly');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Summary
|
|
298
|
+
log('\n═══════════════════════════════════════', BLUE);
|
|
299
|
+
log(`Integration Test Summary:`, BLUE);
|
|
300
|
+
log(` ✅ Passed: ${testsPassed}`, GREEN);
|
|
301
|
+
if (testsFailed > 0) {
|
|
302
|
+
log(` ❌ Failed: ${testsFailed}`, RED);
|
|
303
|
+
}
|
|
304
|
+
log(` 📊 Total: ${testsPassed + testsFailed}`, BLUE);
|
|
305
|
+
|
|
306
|
+
if (testsFailed === 0) {
|
|
307
|
+
log('\n🎉 All integration tests passed!', GREEN);
|
|
308
|
+
process.exit(0);
|
|
309
|
+
} else {
|
|
310
|
+
log('\n⚠️ Some tests failed', YELLOW);
|
|
311
|
+
process.exit(1);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Run tests
|
|
316
|
+
runTests().catch(error => {
|
|
317
|
+
log(`\n❌ Test suite failed: ${error.message}`, RED);
|
|
318
|
+
console.error(error);
|
|
319
|
+
process.exit(1);
|
|
320
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectNameKebab}}-generated-code",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generated code for {{projectName}} - v3.3 runtime",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"test": "node test-runner.js",
|
|
9
|
+
"test:integration": "node integration-tests.js",
|
|
10
|
+
"start:dev": "tsx services/index.ts",
|
|
11
|
+
"prisma:generate": "prisma generate",
|
|
12
|
+
"prisma:migrate": "prisma migrate dev",
|
|
13
|
+
"db:setup": "node setup-database.js"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@prisma/client": "^5.0.0",
|
|
17
|
+
"typeorm": "^0.3.17",
|
|
18
|
+
"reflect-metadata": "^0.1.13",
|
|
19
|
+
"fastify": "^4.23.0",
|
|
20
|
+
"express": "^4.18.2",
|
|
21
|
+
"@nestjs/common": "^10.2.0",
|
|
22
|
+
"@nestjs/core": "^10.2.0",
|
|
23
|
+
"@nestjs/platform-express": "^10.2.0",
|
|
24
|
+
"zod": "^3.22.0",
|
|
25
|
+
"better-sqlite3": "^9.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"@types/express": "^4.17.17",
|
|
30
|
+
"typescript": "^5.2.0",
|
|
31
|
+
"tsx": "^3.12.0",
|
|
32
|
+
"vitest": "^0.34.0"
|
|
33
|
+
}
|
|
34
|
+
}
|