@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,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Generator for React Applications
|
|
3
|
+
*
|
|
4
|
+
* Generates an apiClient.ts file that matches the backend routing instance factory.
|
|
5
|
+
* Detects whether the backend uses controller-based endpoints or standard REST.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface ApiClientGeneratorContext {
|
|
9
|
+
spec: any;
|
|
10
|
+
manifest: any;
|
|
11
|
+
models: any[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function generate(context: ApiClientGeneratorContext): Promise<string> {
|
|
15
|
+
const { manifest } = context;
|
|
16
|
+
|
|
17
|
+
// Determine API pattern from backend routing instance factory
|
|
18
|
+
const apiPattern = detectApiPattern(manifest);
|
|
19
|
+
|
|
20
|
+
return generateApiClient(apiPattern);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Detect which API pattern the backend uses by checking the routing instance factory
|
|
25
|
+
*/
|
|
26
|
+
function detectApiPattern(manifest: any): 'rest' | 'controller' {
|
|
27
|
+
// Find the routing capability mapping
|
|
28
|
+
const routingCapability = manifest.capabilityMappings?.find(
|
|
29
|
+
(mapping: any) => mapping.capability === 'api.rest'
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (!routingCapability) {
|
|
33
|
+
// Default to REST if no routing capability specified
|
|
34
|
+
return 'rest';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const instanceFactory = routingCapability.instanceFactory;
|
|
38
|
+
|
|
39
|
+
// Map known instance factories to their API patterns
|
|
40
|
+
const restFactories = ['FastifyAPI', 'ExpressAPI', 'NestJSAPI'];
|
|
41
|
+
const controllerFactories = ['ControllerAPI', 'RuntimeAPI'];
|
|
42
|
+
|
|
43
|
+
if (restFactories.includes(instanceFactory)) {
|
|
44
|
+
return 'rest';
|
|
45
|
+
} else if (controllerFactories.includes(instanceFactory)) {
|
|
46
|
+
return 'controller';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Default to REST for unknown factories
|
|
50
|
+
return 'rest';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Generate the apiClient.ts content based on the API pattern
|
|
55
|
+
*/
|
|
56
|
+
function generateApiClient(pattern: 'rest' | 'controller'): string {
|
|
57
|
+
const commonImports = `/**
|
|
58
|
+
* API Client
|
|
59
|
+
*
|
|
60
|
+
* HTTP client for interacting with the backend API
|
|
61
|
+
* Generated based on backend routing instance factory
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
import type { ApiResponse, RuntimeInfo, ModelSchema, View, Service, Behavior, Entity, Operation } from '../types/api';
|
|
65
|
+
|
|
66
|
+
// Get API URL from query parameter or default to proxy
|
|
67
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
68
|
+
const apiUrl = urlParams.get('api');
|
|
69
|
+
|
|
70
|
+
// API base URL
|
|
71
|
+
export const API_BASE = apiUrl ? \`\${apiUrl}/api\` : '/api';
|
|
72
|
+
|
|
73
|
+
// WebSocket URL - preserve path and use wss:// for https://
|
|
74
|
+
export const WS_URL = apiUrl
|
|
75
|
+
? \`\${apiUrl.replace(/^http/, 'ws')}/ws\`
|
|
76
|
+
: \`\${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}/\${window.location.host}/ws\`;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Generic API request helper
|
|
80
|
+
*/
|
|
81
|
+
async function apiRequest<T = any>(
|
|
82
|
+
method: string,
|
|
83
|
+
path: string,
|
|
84
|
+
body: any = null
|
|
85
|
+
): Promise<T> {
|
|
86
|
+
const options: RequestInit = {
|
|
87
|
+
method,
|
|
88
|
+
headers: { 'Content-Type': 'application/json' }
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (body) {
|
|
92
|
+
options.body = JSON.stringify(body);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const response = await fetch(\`\${API_BASE}\${path}\`, options);
|
|
96
|
+
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
throw new Error(\`API request failed: \${response.statusText}\`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return await response.json();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get full specification object
|
|
106
|
+
*/
|
|
107
|
+
export async function getSpec(): Promise<any> {
|
|
108
|
+
return apiRequest('GET', '/spec');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get runtime information
|
|
113
|
+
*/
|
|
114
|
+
export async function getRuntimeInfo(): Promise<RuntimeInfo> {
|
|
115
|
+
return apiRequest<RuntimeInfo>('GET', '/runtime/info');
|
|
116
|
+
}`;
|
|
117
|
+
|
|
118
|
+
const metaFunctions = `
|
|
119
|
+
/**
|
|
120
|
+
* Get all views
|
|
121
|
+
*/
|
|
122
|
+
export async function getViews(): Promise<View[]> {
|
|
123
|
+
const result = await apiRequest<{ views: View[] }>('GET', '/views');
|
|
124
|
+
return result.views || [];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get all services
|
|
129
|
+
*/
|
|
130
|
+
export async function getServices(): Promise<Service[]> {
|
|
131
|
+
const result = await apiRequest<{ services: Service[] }>('GET', '/services');
|
|
132
|
+
return result.services || [];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get operations for a controller
|
|
137
|
+
*/
|
|
138
|
+
export async function getControllerOperations(controllerName: string): Promise<Operation[]> {
|
|
139
|
+
const result = await apiRequest<{ operations: Operation[] }>('GET', \`/controllers/\${controllerName}/operations\`);
|
|
140
|
+
return result.operations || [];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Get behaviors for a model
|
|
145
|
+
*/
|
|
146
|
+
export async function getBehaviors(modelName: string): Promise<Behavior[]> {
|
|
147
|
+
const result = await apiRequest<{ behaviors: Behavior[] }>('GET', \`/behaviors/\${modelName}\`);
|
|
148
|
+
return result.behaviors || [];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get event history
|
|
153
|
+
*/
|
|
154
|
+
export async function getEventHistory(limit: number = 100): Promise<Array<{
|
|
155
|
+
eventName: string;
|
|
156
|
+
payload: any;
|
|
157
|
+
timestamp: string;
|
|
158
|
+
}>> {
|
|
159
|
+
const result = await apiRequest<{
|
|
160
|
+
history: Array<{ eventName: string; payload: any; timestamp: string }>;
|
|
161
|
+
}>('GET', \`/events/history?limit=\${limit}\`);
|
|
162
|
+
return result.history || [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get diagram types
|
|
167
|
+
*/
|
|
168
|
+
export async function getDiagramTypes(): Promise<string[]> {
|
|
169
|
+
const result = await apiRequest<{ types: string[] }>('GET', '/diagrams/types');
|
|
170
|
+
return result.types || [];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Generate diagram
|
|
175
|
+
*/
|
|
176
|
+
export async function generateDiagram(
|
|
177
|
+
type: string,
|
|
178
|
+
direction: 'TB' | 'LR' = 'TB'
|
|
179
|
+
): Promise<string> {
|
|
180
|
+
const result = await apiRequest<{ success: boolean; diagram?: string; error?: string }>(
|
|
181
|
+
'GET',
|
|
182
|
+
\`/diagrams/\${type}?direction=\${direction}\`
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
if (!result.success || !result.diagram) {
|
|
186
|
+
throw new Error(result.error || 'Failed to generate diagram');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return result.diagram;
|
|
190
|
+
}`;
|
|
191
|
+
|
|
192
|
+
if (pattern === 'rest') {
|
|
193
|
+
// Standard REST API pattern
|
|
194
|
+
return `${commonImports}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get model schema
|
|
198
|
+
*/
|
|
199
|
+
export async function getModelSchema(modelName: string): Promise<ModelSchema> {
|
|
200
|
+
const spec = await getSpec();
|
|
201
|
+
|
|
202
|
+
// Find model in components and extract schema
|
|
203
|
+
for (const component of Object.values(spec.components || {})) {
|
|
204
|
+
const models = (component as any).models || {};
|
|
205
|
+
if (models[modelName]) {
|
|
206
|
+
const model = models[modelName];
|
|
207
|
+
return {
|
|
208
|
+
name: modelName,
|
|
209
|
+
attributes: model.attributes || {},
|
|
210
|
+
relationships: model.relationships || {}
|
|
211
|
+
} as ModelSchema;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
throw new Error(\`Model schema not found: \${modelName}\`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* List all entities for a model
|
|
220
|
+
*/
|
|
221
|
+
export async function listEntities(controllerName: string): Promise<Entity[]> {
|
|
222
|
+
try {
|
|
223
|
+
// Extract model name from controller name (e.g., "AuthorController" -> "authors")
|
|
224
|
+
const modelName = controllerName
|
|
225
|
+
.replace(/Controller$/, '')
|
|
226
|
+
.toLowerCase() + 's';
|
|
227
|
+
|
|
228
|
+
const entities = await apiRequest<Entity[]>('GET', \`/\${modelName}\`);
|
|
229
|
+
return entities || [];
|
|
230
|
+
} catch (error) {
|
|
231
|
+
// Model endpoint might not exist
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Execute a controller operation
|
|
238
|
+
* Maps CURVED operations to standard REST endpoints
|
|
239
|
+
*/
|
|
240
|
+
export async function executeOperation(
|
|
241
|
+
controllerName: string,
|
|
242
|
+
operationName: string,
|
|
243
|
+
params: Record<string, any>
|
|
244
|
+
): Promise<ApiResponse> {
|
|
245
|
+
// Extract model name from controller name (e.g., "AuthorController" -> "authors")
|
|
246
|
+
const modelName = controllerName
|
|
247
|
+
.replace(/Controller$/, '')
|
|
248
|
+
.toLowerCase() + 's';
|
|
249
|
+
|
|
250
|
+
let method: string;
|
|
251
|
+
let path: string;
|
|
252
|
+
|
|
253
|
+
switch (operationName) {
|
|
254
|
+
case 'create':
|
|
255
|
+
method = 'POST';
|
|
256
|
+
path = \`/\${modelName}\`;
|
|
257
|
+
break;
|
|
258
|
+
|
|
259
|
+
case 'update':
|
|
260
|
+
method = 'PUT';
|
|
261
|
+
path = \`/\${modelName}/\${params.id}\`;
|
|
262
|
+
// Remove id from body
|
|
263
|
+
const { id: _id, ...updateData } = params;
|
|
264
|
+
params = updateData;
|
|
265
|
+
break;
|
|
266
|
+
|
|
267
|
+
case 'retrieve':
|
|
268
|
+
method = 'GET';
|
|
269
|
+
path = \`/\${modelName}/\${params.id}\`;
|
|
270
|
+
params = {};
|
|
271
|
+
break;
|
|
272
|
+
|
|
273
|
+
case 'retrieve_many':
|
|
274
|
+
case 'list':
|
|
275
|
+
method = 'GET';
|
|
276
|
+
path = \`/\${modelName}\`;
|
|
277
|
+
params = {};
|
|
278
|
+
break;
|
|
279
|
+
|
|
280
|
+
case 'delete':
|
|
281
|
+
method = 'DELETE';
|
|
282
|
+
path = \`/\${modelName}/\${params.id}\`;
|
|
283
|
+
params = {};
|
|
284
|
+
break;
|
|
285
|
+
|
|
286
|
+
case 'validate':
|
|
287
|
+
method = 'POST';
|
|
288
|
+
path = \`/\${modelName}/validate\`;
|
|
289
|
+
break;
|
|
290
|
+
|
|
291
|
+
case 'evolve':
|
|
292
|
+
method = 'POST';
|
|
293
|
+
path = \`/\${modelName}/\${params.id}/evolve\`;
|
|
294
|
+
break;
|
|
295
|
+
|
|
296
|
+
default:
|
|
297
|
+
// Custom operation
|
|
298
|
+
method = 'POST';
|
|
299
|
+
path = \`/\${modelName}/\${operationName}\`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return apiRequest<ApiResponse>(method, path, Object.keys(params).length > 0 ? params : null);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Transition entity lifecycle state
|
|
307
|
+
*/
|
|
308
|
+
export async function transitionState(
|
|
309
|
+
modelName: string,
|
|
310
|
+
entityId: string,
|
|
311
|
+
toState: string,
|
|
312
|
+
lifecycleName?: string
|
|
313
|
+
): Promise<ApiResponse> {
|
|
314
|
+
const body: any = { toState };
|
|
315
|
+
if (lifecycleName) {
|
|
316
|
+
body.lifecycleName = lifecycleName;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const resource = modelName.toLowerCase() + 's';
|
|
320
|
+
return apiRequest<ApiResponse>(
|
|
321
|
+
'POST',
|
|
322
|
+
\`/\${resource}/\${entityId}/transition\`,
|
|
323
|
+
body
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Get available transitions for an entity
|
|
329
|
+
*/
|
|
330
|
+
export async function getAvailableTransitions(
|
|
331
|
+
modelName: string,
|
|
332
|
+
entityId: string,
|
|
333
|
+
lifecycleName?: string
|
|
334
|
+
): Promise<string[]> {
|
|
335
|
+
const resource = modelName.toLowerCase() + 's';
|
|
336
|
+
const url = lifecycleName
|
|
337
|
+
? \`/\${resource}/\${entityId}/transitions?lifecycleName=\${lifecycleName}\`
|
|
338
|
+
: \`/\${resource}/\${entityId}/transitions\`;
|
|
339
|
+
|
|
340
|
+
const result = await apiRequest<{ transitions: string[] }>('GET', url);
|
|
341
|
+
return result.transitions || [];
|
|
342
|
+
}
|
|
343
|
+
${metaFunctions}
|
|
344
|
+
`;
|
|
345
|
+
} else {
|
|
346
|
+
// Controller-based API pattern (used by app-demo runtime)
|
|
347
|
+
return `${commonImports}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Get model schema
|
|
351
|
+
*/
|
|
352
|
+
export async function getModelSchema(modelName: string): Promise<ModelSchema> {
|
|
353
|
+
return apiRequest<ModelSchema>('GET', \`/models/\${modelName}/schema\`);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* List all entities for a model via its controller
|
|
358
|
+
* Returns empty array if controller doesn't exist (not all models have controllers)
|
|
359
|
+
*/
|
|
360
|
+
export async function listEntities(controllerName: string): Promise<Entity[]> {
|
|
361
|
+
try {
|
|
362
|
+
const result = await apiRequest<ApiResponse<{ entities: Entity[] }>>(
|
|
363
|
+
'POST',
|
|
364
|
+
\`/controllers/\${controllerName}/list\`,
|
|
365
|
+
{}
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
if (!result.success) {
|
|
369
|
+
// Controller might not exist for this model
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return result.data?.entities || [];
|
|
374
|
+
} catch (error) {
|
|
375
|
+
// Controller doesn't exist for this model - this is normal
|
|
376
|
+
// Not all models have controllers
|
|
377
|
+
// Silently return empty array (this is expected behavior)
|
|
378
|
+
return [];
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Execute a controller operation
|
|
384
|
+
*/
|
|
385
|
+
export async function executeOperation(
|
|
386
|
+
controllerName: string,
|
|
387
|
+
operationName: string,
|
|
388
|
+
params: Record<string, any>
|
|
389
|
+
): Promise<ApiResponse> {
|
|
390
|
+
return apiRequest<ApiResponse>(
|
|
391
|
+
'POST',
|
|
392
|
+
\`/controllers/\${controllerName}/\${operationName}\`,
|
|
393
|
+
params
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Transition entity lifecycle state
|
|
399
|
+
*/
|
|
400
|
+
export async function transitionState(
|
|
401
|
+
modelName: string,
|
|
402
|
+
entityId: string,
|
|
403
|
+
toState: string,
|
|
404
|
+
lifecycleName?: string
|
|
405
|
+
): Promise<ApiResponse> {
|
|
406
|
+
const body: any = { toState };
|
|
407
|
+
if (lifecycleName) {
|
|
408
|
+
body.lifecycleName = lifecycleName;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return apiRequest<ApiResponse>(
|
|
412
|
+
'POST',
|
|
413
|
+
\`/lifecycle/\${modelName}/\${entityId}/transition\`,
|
|
414
|
+
body
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Get available transitions for an entity
|
|
420
|
+
*/
|
|
421
|
+
export async function getAvailableTransitions(
|
|
422
|
+
modelName: string,
|
|
423
|
+
entityId: string,
|
|
424
|
+
lifecycleName?: string
|
|
425
|
+
): Promise<string[]> {
|
|
426
|
+
const url = lifecycleName
|
|
427
|
+
? \`/lifecycle/\${modelName}/\${entityId}/transitions?lifecycleName=\${lifecycleName}\`
|
|
428
|
+
: \`/lifecycle/\${modelName}/\${entityId}/transitions\`;
|
|
429
|
+
|
|
430
|
+
const result = await apiRequest<{ transitions: string[] }>('GET', url);
|
|
431
|
+
return result.transitions || [];
|
|
432
|
+
}
|
|
433
|
+
${metaFunctions}
|
|
434
|
+
`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Types Generator
|
|
3
|
+
* Generates TypeScript type definitions for API interactions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ApiTypesGeneratorContext {
|
|
7
|
+
spec: any;
|
|
8
|
+
manifest: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function generate(context: ApiTypesGeneratorContext): Promise<string> {
|
|
12
|
+
return `/**
|
|
13
|
+
* API Types
|
|
14
|
+
*
|
|
15
|
+
* Shared type definitions for API interactions
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export interface RuntimeInfo {
|
|
19
|
+
models: string[];
|
|
20
|
+
controllers: string[];
|
|
21
|
+
controllerModels?: Record<string, string>; // Controller name -> Model name mapping
|
|
22
|
+
events: string[];
|
|
23
|
+
services: string[];
|
|
24
|
+
views?: string[];
|
|
25
|
+
operations?: Record<string, (Operation | string)[]>;
|
|
26
|
+
specFile?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Operation {
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
parameters?: Record<string, any>;
|
|
33
|
+
returns?: string;
|
|
34
|
+
requires?: string[];
|
|
35
|
+
ensures?: string[];
|
|
36
|
+
publishes?: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Event {
|
|
40
|
+
eventName: string;
|
|
41
|
+
data: any;
|
|
42
|
+
timestamp: Date;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ModelSchema {
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
attributes: Record<string, AttributeDefinition>;
|
|
49
|
+
relationships?: Record<string, RelationshipDefinition>;
|
|
50
|
+
lifecycles?: Record<string, LifecycleDefinition>;
|
|
51
|
+
behaviors?: Record<string, BehaviorDefinition>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AttributeDefinition {
|
|
55
|
+
type: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
default?: any;
|
|
58
|
+
auto?: string;
|
|
59
|
+
unique?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface RelationshipDefinition {
|
|
63
|
+
type: 'belongsTo' | 'hasMany' | 'hasOne';
|
|
64
|
+
model: string;
|
|
65
|
+
targetModel?: string;
|
|
66
|
+
foreignKey?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface LifecycleDefinition {
|
|
70
|
+
initial?: string;
|
|
71
|
+
states?: Record<string, any>;
|
|
72
|
+
flow?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface BehaviorDefinition {
|
|
76
|
+
description?: string;
|
|
77
|
+
parameters?: Record<string, any>;
|
|
78
|
+
returns?: string;
|
|
79
|
+
requires?: string[];
|
|
80
|
+
ensures?: string[];
|
|
81
|
+
publishes?: string[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface Entity {
|
|
85
|
+
id: string;
|
|
86
|
+
data: Record<string, any>;
|
|
87
|
+
metadata?: {
|
|
88
|
+
lifecycleStates?: Record<string, string>;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface View {
|
|
94
|
+
name: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
type: string;
|
|
97
|
+
model?: string | string[]; // Legacy: model-based views
|
|
98
|
+
controller?: string; // New: controller-based views
|
|
99
|
+
related?: Array<{ model: string }>; // Related models for multi-model views
|
|
100
|
+
columns?: string[]; // Column names for list/table views
|
|
101
|
+
sections?: any[]; // Sections for dashboard views
|
|
102
|
+
uiComponents?: Record<string, any>;
|
|
103
|
+
subscribesTo?: string[];
|
|
104
|
+
properties?: Record<string, any>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface Service {
|
|
108
|
+
name: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
subscribesTo: string[];
|
|
111
|
+
subscribes_to?: string[];
|
|
112
|
+
operations: ServiceOperation[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ServiceOperation {
|
|
116
|
+
name: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
parameters?: Record<string, any>;
|
|
119
|
+
returns?: string;
|
|
120
|
+
requires?: string[];
|
|
121
|
+
ensures?: string[];
|
|
122
|
+
publishes?: string[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface Behavior {
|
|
126
|
+
name: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
parameters?: Record<string, any>;
|
|
129
|
+
returns?: string;
|
|
130
|
+
requires?: string[];
|
|
131
|
+
ensures?: string[];
|
|
132
|
+
publishes?: string[];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface WebSocketMessage {
|
|
136
|
+
id?: string;
|
|
137
|
+
type: 'subscribe' | 'unsubscribe' | 'execute' | 'transition' | 'query';
|
|
138
|
+
payload: any;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface WebSocketResponse {
|
|
142
|
+
id?: string;
|
|
143
|
+
type: 'event' | 'result' | 'error' | 'reload';
|
|
144
|
+
payload: any;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ApiResponse<T = any> {
|
|
148
|
+
success: boolean;
|
|
149
|
+
data?: T;
|
|
150
|
+
error?: string;
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App.tsx Generator for React App
|
|
3
|
+
*
|
|
4
|
+
* Generates root App component with sidebar navigation grouped by model.
|
|
5
|
+
* Only List and +New are in the nav — Detail is accessed via list row clicks.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
9
|
+
|
|
10
|
+
export default function generateAppTsx(context: TemplateContext): string {
|
|
11
|
+
const { spec } = context;
|
|
12
|
+
|
|
13
|
+
// Get views — handle both array and object formats
|
|
14
|
+
let viewList: any[] = [];
|
|
15
|
+
if (spec.views) {
|
|
16
|
+
viewList = Array.isArray(spec.views) ? spec.views
|
|
17
|
+
: Object.entries(spec.views).map(([name, def]: [string, any]) => ({ name, ...def }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Group views by model
|
|
21
|
+
const modelViews = new Map<string, { list?: string; detail?: string; form?: string; other: string[] }>();
|
|
22
|
+
const dashboardView: string | null = viewList.find((v: any) => v.type === 'dashboard')?.name || null;
|
|
23
|
+
|
|
24
|
+
for (const view of viewList) {
|
|
25
|
+
const model = Array.isArray(view.model) ? view.model[0] : (view.model || view.primaryModel);
|
|
26
|
+
if (!model) continue;
|
|
27
|
+
if (!modelViews.has(model)) modelViews.set(model, { other: [] });
|
|
28
|
+
const entry = modelViews.get(model)!;
|
|
29
|
+
const type = view.type || 'list';
|
|
30
|
+
if (type === 'list') entry.list = view.name;
|
|
31
|
+
else if (type === 'detail') entry.detail = view.name;
|
|
32
|
+
else if (type === 'form') entry.form = view.name;
|
|
33
|
+
else if (type !== 'dashboard') entry.other.push(view.name);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Generate imports
|
|
37
|
+
const imports = viewList.map((v: any) => `import ${v.name} from './components/${v.name}';`).join('\n');
|
|
38
|
+
|
|
39
|
+
// Generate routes
|
|
40
|
+
const routes = viewList.map((v: any) => {
|
|
41
|
+
const path = `/${v.name.toLowerCase().replace('view', '')}`;
|
|
42
|
+
return ` <Route path="${path}" element={<${v.name} />} />`;
|
|
43
|
+
}).join('\n');
|
|
44
|
+
|
|
45
|
+
// Default route
|
|
46
|
+
const defaultView = dashboardView || viewList[0]?.name || 'div';
|
|
47
|
+
const defaultElement = defaultView === 'div' ? '<div className="p-8">Welcome</div>' : `<${defaultView} />`;
|
|
48
|
+
|
|
49
|
+
// Sidebar nav items grouped by model
|
|
50
|
+
const navGroups = Array.from(modelViews.entries()).map(([model, views]) => {
|
|
51
|
+
const lower = model.charAt(0).toLowerCase() + model.slice(1);
|
|
52
|
+
const listPath = views.list ? `/${views.list.toLowerCase().replace('view', '')}` : '';
|
|
53
|
+
const formPath = views.form ? `/${views.form.toLowerCase().replace('view', '')}` : '';
|
|
54
|
+
return ` <div>
|
|
55
|
+
<h3 className="px-3 text-xs font-semibold text-gray-400 uppercase tracking-wider mb-1">${model}s</h3>
|
|
56
|
+
${listPath ? ` <a href="${listPath}" className="block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 rounded">Browse</a>` : ''}
|
|
57
|
+
${formPath ? ` <a href="${formPath}" className="block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 rounded">+ New</a>` : ''}
|
|
58
|
+
</div>`;
|
|
59
|
+
}).join('\n');
|
|
60
|
+
|
|
61
|
+
return `import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
|
62
|
+
${imports}
|
|
63
|
+
|
|
64
|
+
function App() {
|
|
65
|
+
return (
|
|
66
|
+
<Router>
|
|
67
|
+
<div className="flex min-h-screen bg-gray-50">
|
|
68
|
+
{/* Sidebar */}
|
|
69
|
+
<aside className="w-56 bg-white border-r border-gray-200 p-4 space-y-5">
|
|
70
|
+
<div>
|
|
71
|
+
<h1 className="text-lg font-bold text-gray-900">SpecVerse App</h1>
|
|
72
|
+
<p className="text-xs text-gray-400">Generated from specification</p>
|
|
73
|
+
</div>
|
|
74
|
+
${dashboardView ? ` <a href="/dashboard" className="block px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 rounded">Dashboard</a>` : ''}
|
|
75
|
+
${navGroups}
|
|
76
|
+
</aside>
|
|
77
|
+
|
|
78
|
+
{/* Main content */}
|
|
79
|
+
<main className="flex-1 overflow-auto">
|
|
80
|
+
<Routes>
|
|
81
|
+
<Route path="/" element={${defaultElement}} />
|
|
82
|
+
${dashboardView ? ` <Route path="/dashboard" element={<${dashboardView} />} />` : ''}
|
|
83
|
+
${routes}
|
|
84
|
+
<Route path="*" element={<div className="p-8"><h1 className="text-2xl">404 - Not Found</h1></div>} />
|
|
85
|
+
</Routes>
|
|
86
|
+
</main>
|
|
87
|
+
</div>
|
|
88
|
+
</Router>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default App;
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .env.example Generator for React Frontend
|
|
3
|
+
*
|
|
4
|
+
* Generates example environment configuration
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TemplateContext } from '@specverse/engine-realize';
|
|
8
|
+
import { getApiBaseUrl, getPathConfig } from '../../../shared/path-resolver.js';
|
|
9
|
+
|
|
10
|
+
export default function generateEnvExample(context: TemplateContext): string {
|
|
11
|
+
const pathConfig = getPathConfig(context);
|
|
12
|
+
const defaultApiUrl = getApiBaseUrl(pathConfig);
|
|
13
|
+
|
|
14
|
+
return `# API Configuration
|
|
15
|
+
# Base URL for backend API
|
|
16
|
+
VITE_API_BASE_URL=${defaultApiUrl}
|
|
17
|
+
|
|
18
|
+
# API Path Prefix
|
|
19
|
+
VITE_API_PREFIX=/api
|
|
20
|
+
|
|
21
|
+
# Application Mode
|
|
22
|
+
VITE_APP_MODE=development
|
|
23
|
+
`;
|
|
24
|
+
}
|