@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,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field Helpers Generator
|
|
3
|
+
* Generates utility functions for form field handling
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface FieldHelpersGeneratorContext {
|
|
7
|
+
spec: any;
|
|
8
|
+
manifest: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function generate(context: FieldHelpersGeneratorContext): Promise<string> {
|
|
12
|
+
return `/**
|
|
13
|
+
* Utility functions for form field handling
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Check if a field should be hidden because it's auto-generated
|
|
18
|
+
*/
|
|
19
|
+
export function isAutoGeneratedField(attrName: string, attrDef: any): boolean {
|
|
20
|
+
const typeStr = typeof attrDef === 'string' ? attrDef : attrDef?.type || '';
|
|
21
|
+
|
|
22
|
+
// Hide UUID id field
|
|
23
|
+
if (attrName === 'id' && typeStr.includes('UUID')) return true;
|
|
24
|
+
|
|
25
|
+
// Hide auto-generated DateTime fields
|
|
26
|
+
const autoDateFields = ['createdAt', 'updatedAt', 'joinedAt', 'publishedAt'];
|
|
27
|
+
if (autoDateFields.includes(attrName) && typeStr.includes('DateTime')) return true;
|
|
28
|
+
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check if a field is required
|
|
34
|
+
*/
|
|
35
|
+
export function isFieldRequired(attrDef: any): boolean {
|
|
36
|
+
if (!attrDef) return false;
|
|
37
|
+
if (typeof attrDef === 'string') {
|
|
38
|
+
return attrDef.toLowerCase().includes('required');
|
|
39
|
+
}
|
|
40
|
+
return attrDef.required === true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get default value for a field based on its type
|
|
45
|
+
*/
|
|
46
|
+
export function getFieldDefaultValue(attrDef: any): any {
|
|
47
|
+
if (!attrDef) return '';
|
|
48
|
+
|
|
49
|
+
const typeStr = typeof attrDef === 'string' ? attrDef : attrDef?.type || '';
|
|
50
|
+
|
|
51
|
+
// Check if schema has a default value
|
|
52
|
+
if (attrDef && typeof attrDef === 'object' && attrDef.default !== undefined) {
|
|
53
|
+
const defaultVal = attrDef.default;
|
|
54
|
+
// Parse string defaults to proper types
|
|
55
|
+
if (typeStr.toLowerCase().includes('bool')) {
|
|
56
|
+
return defaultVal === 'true' || defaultVal === true;
|
|
57
|
+
} else if (
|
|
58
|
+
typeStr.toLowerCase().includes('int') ||
|
|
59
|
+
typeStr.toLowerCase().includes('number')
|
|
60
|
+
) {
|
|
61
|
+
return typeof defaultVal === 'number' ? defaultVal : parseInt(defaultVal) || 0;
|
|
62
|
+
} else if (typeStr.toLowerCase().includes('string')) {
|
|
63
|
+
// Remove surrounding quotes if present
|
|
64
|
+
return typeof defaultVal === 'string'
|
|
65
|
+
? defaultVal.replace(/^"|"$/g, '')
|
|
66
|
+
: defaultVal;
|
|
67
|
+
} else {
|
|
68
|
+
return defaultVal;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Otherwise use type-based defaults
|
|
73
|
+
if (typeStr.toLowerCase().includes('bool')) {
|
|
74
|
+
return false;
|
|
75
|
+
} else if (
|
|
76
|
+
typeStr.toLowerCase().includes('int') ||
|
|
77
|
+
typeStr.toLowerCase().includes('number')
|
|
78
|
+
) {
|
|
79
|
+
return 0;
|
|
80
|
+
} else {
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Initialize form data from schema attributes
|
|
87
|
+
*/
|
|
88
|
+
export function initializeFormData(
|
|
89
|
+
attributes: Record<string, any>,
|
|
90
|
+
options: { includeAutoGenerated?: boolean } = {}
|
|
91
|
+
): Record<string, any> {
|
|
92
|
+
const data: Record<string, any> = {};
|
|
93
|
+
|
|
94
|
+
Object.entries(attributes).forEach(([attrName, attrDef]) => {
|
|
95
|
+
// Skip auto-generated fields unless explicitly included
|
|
96
|
+
if (!options.includeAutoGenerated && isAutoGeneratedField(attrName, attrDef)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
data[attrName] = getFieldDefaultValue(attrDef);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .gitignore Generator for React Frontend
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
6
|
+
|
|
7
|
+
export default function generateGitignore(context: TemplateContext): string {
|
|
8
|
+
return `# Logs
|
|
9
|
+
logs
|
|
10
|
+
*.log
|
|
11
|
+
npm-debug.log*
|
|
12
|
+
yarn-debug.log*
|
|
13
|
+
yarn-error.log*
|
|
14
|
+
pnpm-debug.log*
|
|
15
|
+
lerna-debug.log*
|
|
16
|
+
|
|
17
|
+
node_modules
|
|
18
|
+
dist
|
|
19
|
+
dist-ssr
|
|
20
|
+
*.local
|
|
21
|
+
|
|
22
|
+
# Editor directories and files
|
|
23
|
+
.vscode/*
|
|
24
|
+
!.vscode/extensions.json
|
|
25
|
+
.idea
|
|
26
|
+
.DS_Store
|
|
27
|
+
*.suo
|
|
28
|
+
*.ntvs*
|
|
29
|
+
*.njsproj
|
|
30
|
+
*.sln
|
|
31
|
+
*.sw?
|
|
32
|
+
|
|
33
|
+
# Environment variables
|
|
34
|
+
.env
|
|
35
|
+
.env.local
|
|
36
|
+
.env.*.local
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index CSS Generator for React App
|
|
3
|
+
*
|
|
4
|
+
* Generates basic CSS with Tailwind-style reset
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
8
|
+
|
|
9
|
+
export default function generateIndexCss(context: TemplateContext): string {
|
|
10
|
+
return `/* Base styles with Tailwind-inspired reset */
|
|
11
|
+
*,
|
|
12
|
+
*::before,
|
|
13
|
+
*::after {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:root {
|
|
20
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
21
|
+
line-height: 1.5;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
|
|
24
|
+
color-scheme: light dark;
|
|
25
|
+
color: rgba(255, 255, 255, 0.87);
|
|
26
|
+
background-color: #242424;
|
|
27
|
+
|
|
28
|
+
font-synthesis: none;
|
|
29
|
+
text-rendering: optimizeLegibility;
|
|
30
|
+
-webkit-font-smoothing: antialiased;
|
|
31
|
+
-moz-osx-font-smoothing: grayscale;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
margin: 0;
|
|
36
|
+
min-width: 320px;
|
|
37
|
+
min-height: 100vh;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#root {
|
|
41
|
+
width: 100%;
|
|
42
|
+
min-height: 100vh;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-color-scheme: light) {
|
|
46
|
+
:root {
|
|
47
|
+
color: #213547;
|
|
48
|
+
background-color: #ffffff;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Utility classes */
|
|
53
|
+
.container {
|
|
54
|
+
width: 100%;
|
|
55
|
+
margin-right: auto;
|
|
56
|
+
margin-left: auto;
|
|
57
|
+
padding-right: 1rem;
|
|
58
|
+
padding-left: 1rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (min-width: 640px) {
|
|
62
|
+
.container {
|
|
63
|
+
max-width: 640px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (min-width: 768px) {
|
|
68
|
+
.container {
|
|
69
|
+
max-width: 768px;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (min-width: 1024px) {
|
|
74
|
+
.container {
|
|
75
|
+
max-width: 1024px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (min-width: 1280px) {
|
|
80
|
+
.container {
|
|
81
|
+
max-width: 1280px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index HTML Generator for React App
|
|
3
|
+
*
|
|
4
|
+
* Generates the HTML entry point for a React SPA
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
8
|
+
|
|
9
|
+
export default function generateIndexHtml(context: TemplateContext): string {
|
|
10
|
+
const { spec } = context;
|
|
11
|
+
|
|
12
|
+
const appName = spec.metadata?.component || 'SpecVerse App';
|
|
13
|
+
const description = spec.metadata?.description || 'Generated by SpecVerse';
|
|
14
|
+
|
|
15
|
+
return `<!DOCTYPE html>
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="UTF-8" />
|
|
19
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
21
|
+
<meta name="description" content="${description}" />
|
|
22
|
+
<title>${appName}</title>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div id="root"></div>
|
|
26
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main.tsx Generator for React App
|
|
3
|
+
*
|
|
4
|
+
* Generates the React entry point with React Query provider
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
8
|
+
|
|
9
|
+
export default function generateMainTsx(context: TemplateContext): string {
|
|
10
|
+
return `import React from 'react';
|
|
11
|
+
import ReactDOM from 'react-dom/client';
|
|
12
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
13
|
+
import App from './App';
|
|
14
|
+
import './index.css';
|
|
15
|
+
|
|
16
|
+
// Create a client for React Query
|
|
17
|
+
const queryClient = new QueryClient({
|
|
18
|
+
defaultOptions: {
|
|
19
|
+
queries: {
|
|
20
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
21
|
+
retry: 1,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
27
|
+
<React.StrictMode>
|
|
28
|
+
<QueryClientProvider client={queryClient}>
|
|
29
|
+
<App />
|
|
30
|
+
</QueryClientProvider>
|
|
31
|
+
</React.StrictMode>,
|
|
32
|
+
);
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package.json Generator for React Frontend
|
|
3
|
+
*
|
|
4
|
+
* Generates package.json for the frontend workspace
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
8
|
+
|
|
9
|
+
export default function generatePackageJson(context: TemplateContext): string {
|
|
10
|
+
const { spec } = context;
|
|
11
|
+
|
|
12
|
+
const appName = spec.metadata?.component?.toLowerCase() || 'frontend';
|
|
13
|
+
const version = spec.metadata?.version || '1.0.0';
|
|
14
|
+
const description = spec.metadata?.description || 'Frontend application';
|
|
15
|
+
|
|
16
|
+
const pkg = {
|
|
17
|
+
name: `${appName}-frontend`,
|
|
18
|
+
version,
|
|
19
|
+
description,
|
|
20
|
+
private: true,
|
|
21
|
+
type: "module",
|
|
22
|
+
scripts: {
|
|
23
|
+
dev: "vite",
|
|
24
|
+
build: "tsc && vite build",
|
|
25
|
+
preview: "vite preview",
|
|
26
|
+
test: "echo 'No tests configured for frontend'",
|
|
27
|
+
lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
28
|
+
},
|
|
29
|
+
dependencies: {
|
|
30
|
+
"react": "^18.2.0",
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"react-router-dom": "^6.18.0",
|
|
33
|
+
"@tanstack/react-query": "^5.0.0",
|
|
34
|
+
"react-hook-form": "^7.48.0",
|
|
35
|
+
"zod": "^3.22.0",
|
|
36
|
+
"@hookform/resolvers": "^3.3.0",
|
|
37
|
+
"zustand": "^4.4.0"
|
|
38
|
+
},
|
|
39
|
+
devDependencies: {
|
|
40
|
+
"@types/react": "^18.2.0",
|
|
41
|
+
"@types/react-dom": "^18.2.0",
|
|
42
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
43
|
+
"typescript": "^5.2.0",
|
|
44
|
+
"vite": "^5.0.0",
|
|
45
|
+
"eslint": "^8.53.0",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
47
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
48
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
49
|
+
"eslint-plugin-react-refresh": "^0.4.4"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return JSON.stringify(pkg, null, 2);
|
|
54
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Adapter Generator (v0.9.0)
|
|
3
|
+
*
|
|
4
|
+
* Copies ReactPatternAdapter from specverse-app-demo for pattern-based view rendering.
|
|
5
|
+
* This bundles the adapter with generated code for standalone deployment.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync, existsSync } from 'fs';
|
|
9
|
+
import { join, dirname } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
|
|
12
|
+
export interface PatternAdapterGeneratorContext {
|
|
13
|
+
spec: any;
|
|
14
|
+
manifest: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function generate(context: PatternAdapterGeneratorContext): Promise<string> {
|
|
18
|
+
// Try to find the react-pattern-adapter.tsx source file
|
|
19
|
+
// It should be in specverse-app-demo/frontend-react/src/lib/react-pattern-adapter.tsx
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
|
|
24
|
+
// Possible locations for the source file
|
|
25
|
+
const possiblePaths = [
|
|
26
|
+
// PRIORITY 0: Same directory as this generator (source)
|
|
27
|
+
join(__dirname, 'react-pattern-adapter.tsx'),
|
|
28
|
+
// PRIORITY 1: Bundled with package (in libs/ directory, from dist/)
|
|
29
|
+
join(__dirname, '../../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx'),
|
|
30
|
+
// Up from dist to package root then into libs
|
|
31
|
+
join(__dirname, '../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx'),
|
|
32
|
+
join(__dirname, '../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx'),
|
|
33
|
+
// Development environment (specverse-app-demo sibling)
|
|
34
|
+
join(__dirname, '../../../../../../../specverse-app-demo/frontend-react/src/lib/react-pattern-adapter.tsx'),
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
let adapterSource: string | null = null;
|
|
38
|
+
let foundPath: string | null = null;
|
|
39
|
+
|
|
40
|
+
for (const path of possiblePaths) {
|
|
41
|
+
if (existsSync(path)) {
|
|
42
|
+
try {
|
|
43
|
+
adapterSource = readFileSync(path, 'utf-8');
|
|
44
|
+
foundPath = path;
|
|
45
|
+
break;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
// Continue to next path
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (adapterSource) {
|
|
53
|
+
// Successfully read the adapter - return it with a header comment
|
|
54
|
+
// The imports from @specverse/engine-realize are valid and exported
|
|
55
|
+
return `/**
|
|
56
|
+
* ReactPatternAdapter - Pattern-Based View Rendering
|
|
57
|
+
*
|
|
58
|
+
* AUTO-GENERATED: Copied from specverse-app-demo
|
|
59
|
+
* Source: ${foundPath}
|
|
60
|
+
*
|
|
61
|
+
* This file provides pattern detection and React/Tailwind rendering for
|
|
62
|
+
* tech-independent composite patterns. It is bundled with generated code
|
|
63
|
+
* for standalone deployment.
|
|
64
|
+
*
|
|
65
|
+
* Imports COMPOSITE_VIEW_PATTERNS and types from @specverse/engine-realize
|
|
66
|
+
* which are exported from the published npm package.
|
|
67
|
+
*
|
|
68
|
+
* DO NOT EDIT: Changes will be overwritten on next generation.
|
|
69
|
+
* To customize, create a wrapper or modify the original source.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
${adapterSource}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Fallback: Return stub that imports from @specverse/engine-realize
|
|
77
|
+
return `/**
|
|
78
|
+
* ReactPatternAdapter - Pattern-Based View Rendering (STUB)
|
|
79
|
+
*
|
|
80
|
+
* ⚠️ WARNING: Could not locate react-pattern-adapter.tsx source file.
|
|
81
|
+
*
|
|
82
|
+
* This is a stub implementation that imports from @specverse/engine-realize.
|
|
83
|
+
* For full functionality, ensure specverse-app-demo is available at generation time.
|
|
84
|
+
*
|
|
85
|
+
* Attempted paths:
|
|
86
|
+
${possiblePaths.map(p => ` * - ${p}`).join('\n')}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
import { useMemo } from 'react';
|
|
90
|
+
import {
|
|
91
|
+
COMPOSITE_VIEW_PATTERNS,
|
|
92
|
+
type CompositeViewPattern,
|
|
93
|
+
type CURVEDOperation
|
|
94
|
+
} from '@specverse/engine-realize';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* React-specific protocol mapping for CURVED operations (STUB)
|
|
98
|
+
*/
|
|
99
|
+
export const REACT_PROTOCOL_MAPPING: Record<CURVEDOperation, {
|
|
100
|
+
method: string;
|
|
101
|
+
pathPattern: string;
|
|
102
|
+
}> = {
|
|
103
|
+
create: {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
pathPattern: '/api/{resource}'
|
|
106
|
+
},
|
|
107
|
+
update: {
|
|
108
|
+
method: 'PUT',
|
|
109
|
+
pathPattern: '/api/{resource}/{id}'
|
|
110
|
+
},
|
|
111
|
+
retrieve: {
|
|
112
|
+
method: 'GET',
|
|
113
|
+
pathPattern: '/api/{resource}/{id}'
|
|
114
|
+
},
|
|
115
|
+
retrieve_many: {
|
|
116
|
+
method: 'GET',
|
|
117
|
+
pathPattern: '/api/{resource}'
|
|
118
|
+
},
|
|
119
|
+
validate: {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
pathPattern: '/api/{resource}/validate'
|
|
122
|
+
},
|
|
123
|
+
evolve: {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
pathPattern: '/api/{resource}/{id}/evolve'
|
|
126
|
+
},
|
|
127
|
+
delete: {
|
|
128
|
+
method: 'DELETE',
|
|
129
|
+
pathPattern: '/api/{resource}/{id}'
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Simple Tailwind adapter stub
|
|
135
|
+
*/
|
|
136
|
+
const createStubTailwindAdapter = () => ({
|
|
137
|
+
renderComponent: (type: string, _props: any) => {
|
|
138
|
+
return \`<div class="p-2 text-gray-600">[\${type}]</div>\`;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Stub PatternAdapter that uses browser exports
|
|
144
|
+
*/
|
|
145
|
+
export function usePatternAdapter() {
|
|
146
|
+
return useMemo(() => ({
|
|
147
|
+
tailwindAdapter: createStubTailwindAdapter(),
|
|
148
|
+
|
|
149
|
+
detectPattern(view: any): CompositeViewPattern | null {
|
|
150
|
+
const viewType = view.type?.toLowerCase();
|
|
151
|
+
const typeToPattern: Record<string, string> = {
|
|
152
|
+
'form': 'form-view',
|
|
153
|
+
'list': 'list-view',
|
|
154
|
+
'detail': 'detail-view',
|
|
155
|
+
'dashboard': 'dashboard-view'
|
|
156
|
+
};
|
|
157
|
+
const patternId = typeToPattern[viewType];
|
|
158
|
+
return patternId ? COMPOSITE_VIEW_PATTERNS[patternId] : null;
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
renderPattern(_context: any): string {
|
|
162
|
+
return \`
|
|
163
|
+
<div class="p-4 bg-yellow-50 border border-yellow-200 rounded">
|
|
164
|
+
<p class="text-yellow-800 font-semibold">⚠️ Pattern Adapter Stub</p>
|
|
165
|
+
<p class="text-sm text-yellow-700 mt-2">
|
|
166
|
+
Full ReactPatternAdapter could not be bundled.
|
|
167
|
+
Views will not render correctly.
|
|
168
|
+
</p>
|
|
169
|
+
</div>
|
|
170
|
+
\`;
|
|
171
|
+
}
|
|
172
|
+
}), []);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { COMPOSITE_VIEW_PATTERNS } from '@specverse/engine-realize';
|
|
176
|
+
|
|
177
|
+
console.warn('⚠️ Using stub ReactPatternAdapter - full source file not found during generation');
|
|
178
|
+
`;
|
|
179
|
+
}
|