@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,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpecVerse TypeScript/JavaScript API Usage Examples
|
|
3
|
+
*
|
|
4
|
+
* This file demonstrates how to use SpecVerse functionality programmatically
|
|
5
|
+
* instead of through the CLI.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
// Parser and AST
|
|
10
|
+
SpecVerseParser,
|
|
11
|
+
ParseResult,
|
|
12
|
+
SpecVerseAST,
|
|
13
|
+
|
|
14
|
+
// Inference Engine
|
|
15
|
+
LogicalInferenceEngine,
|
|
16
|
+
InferenceEngineConfig,
|
|
17
|
+
|
|
18
|
+
// Generators
|
|
19
|
+
AIViewGenerator,
|
|
20
|
+
UMLGenerator,
|
|
21
|
+
DocumentationGenerator,
|
|
22
|
+
UnifiedDiagramGenerator,
|
|
23
|
+
|
|
24
|
+
// Types
|
|
25
|
+
ModelSpec,
|
|
26
|
+
ControllerSpec,
|
|
27
|
+
ServiceSpec,
|
|
28
|
+
EventSpec,
|
|
29
|
+
ViewSpec
|
|
30
|
+
} from '@specverse/lang';
|
|
31
|
+
|
|
32
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
33
|
+
import * as yaml from 'js-yaml';
|
|
34
|
+
|
|
35
|
+
// ============================================
|
|
36
|
+
// 1. PARSING SPECVERSE FILES
|
|
37
|
+
// ============================================
|
|
38
|
+
|
|
39
|
+
async function parseSpecification(filePath: string): Promise<SpecVerseAST | undefined> {
|
|
40
|
+
// Load the schema (in real usage, this would be from node_modules/@specverse/lang/schema/)
|
|
41
|
+
const schema = JSON.parse(readFileSync('node_modules/@specverse/lang/schema/SPECVERSE-SCHEMA.json', 'utf8'));
|
|
42
|
+
|
|
43
|
+
// Create parser instance
|
|
44
|
+
const parser = new SpecVerseParser(schema);
|
|
45
|
+
|
|
46
|
+
// Read and parse the file
|
|
47
|
+
const content = readFileSync(filePath, 'utf8');
|
|
48
|
+
const result: ParseResult = parser.parseContent(content, filePath);
|
|
49
|
+
|
|
50
|
+
// Check for errors
|
|
51
|
+
if (result.errors.length > 0) {
|
|
52
|
+
console.error('Parse errors:', result.errors);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Handle warnings if any
|
|
57
|
+
if (result.warnings && result.warnings.length > 0) {
|
|
58
|
+
console.warn('Parse warnings:', result.warnings);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log('✅ Successfully parsed:', filePath);
|
|
62
|
+
return result.ast;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ============================================
|
|
66
|
+
// 2. USING THE INFERENCE ENGINE
|
|
67
|
+
// ============================================
|
|
68
|
+
|
|
69
|
+
async function runInference(ast: SpecVerseAST): Promise<any> {
|
|
70
|
+
// Configure inference options
|
|
71
|
+
const config: Partial<InferenceEngineConfig> = {
|
|
72
|
+
logical: {
|
|
73
|
+
generateControllers: true,
|
|
74
|
+
generateServices: true,
|
|
75
|
+
generateEvents: true,
|
|
76
|
+
generateViews: true,
|
|
77
|
+
generateTypes: true,
|
|
78
|
+
},
|
|
79
|
+
rules: {
|
|
80
|
+
logicalRulesPath: 'node_modules/@specverse/lang/dist/inference-engine/rules/logical',
|
|
81
|
+
deploymentRulesPath: 'node_modules/@specverse/lang/dist/inference-engine/rules/deployment'
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Create inference engine instance
|
|
86
|
+
const inferenceEngine = new LogicalInferenceEngine(config);
|
|
87
|
+
|
|
88
|
+
// Extract models from AST
|
|
89
|
+
const models = ast.components.flatMap(c => c.models);
|
|
90
|
+
|
|
91
|
+
// Load rules first
|
|
92
|
+
console.log('📋 Loading inference rules...');
|
|
93
|
+
const rulesValidation = await inferenceEngine.loadRules();
|
|
94
|
+
|
|
95
|
+
if (!rulesValidation.valid) {
|
|
96
|
+
console.error('❌ Failed to load inference rules:', rulesValidation.errors.map(e => e.message));
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Run inference on models
|
|
101
|
+
const componentName = 'GeneratedComponent';
|
|
102
|
+
const inferenceResult = await inferenceEngine.inferLogicalSpecification(models, componentName);
|
|
103
|
+
|
|
104
|
+
console.log('📊 Inference Results:');
|
|
105
|
+
console.log(' Validation:', inferenceResult.validation.valid ? '✅' : '❌');
|
|
106
|
+
console.log(' Models processed:', inferenceResult.statistics.modelsProcessed);
|
|
107
|
+
console.log(' Controllers generated:', inferenceResult.statistics.controllersGenerated);
|
|
108
|
+
console.log(' Services generated:', inferenceResult.statistics.servicesGenerated);
|
|
109
|
+
console.log(' Events generated:', inferenceResult.statistics.eventsGenerated);
|
|
110
|
+
console.log(' Views generated:', inferenceResult.statistics.viewsGenerated);
|
|
111
|
+
|
|
112
|
+
if (!inferenceResult.validation.valid) {
|
|
113
|
+
console.error(' Errors:', inferenceResult.validation.errors.map(e => e.message));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return inferenceResult;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ============================================
|
|
120
|
+
// 3. GENERATING AI-OPTIMIZED SPECIFICATIONS
|
|
121
|
+
// ============================================
|
|
122
|
+
|
|
123
|
+
async function generateAIView(ast: SpecVerseAST): Promise<void> {
|
|
124
|
+
const generator = new AIViewGenerator();
|
|
125
|
+
|
|
126
|
+
// Generate AI-optimized specification
|
|
127
|
+
const aiSpec = generator.generate(ast);
|
|
128
|
+
|
|
129
|
+
// Convert to YAML for readability
|
|
130
|
+
const yamlOutput = yaml.dump(aiSpec, {
|
|
131
|
+
indent: 2,
|
|
132
|
+
lineWidth: 120,
|
|
133
|
+
noRefs: true
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
writeFileSync('output/ai-optimized.yaml', yamlOutput);
|
|
137
|
+
console.log('✅ AI-optimized specification generated');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ============================================
|
|
141
|
+
// 4. GENERATING UML DIAGRAMS
|
|
142
|
+
// ============================================
|
|
143
|
+
|
|
144
|
+
async function generateUMLDiagrams(ast: SpecVerseAST): Promise<void> {
|
|
145
|
+
try {
|
|
146
|
+
const generator = new UMLGenerator();
|
|
147
|
+
|
|
148
|
+
// Generate different types of diagrams with proper options
|
|
149
|
+
const diagramTypes = [
|
|
150
|
+
{ type: 'er' as const, includeAttributes: true, includeRelationships: true },
|
|
151
|
+
{ type: 'sequence' as const, includeEvents: true },
|
|
152
|
+
{ type: 'architecture' as const, includeControllers: true, includeServices: true, includeEvents: true },
|
|
153
|
+
{ type: 'lifecycle' as const }
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
// Generate and save diagrams
|
|
157
|
+
for (const options of diagramTypes) {
|
|
158
|
+
const content = generator.generate(ast, options);
|
|
159
|
+
if (content) {
|
|
160
|
+
writeFileSync(`output/diagram-${options.type}.mmd`, content);
|
|
161
|
+
console.log(`✅ Generated ${options.type} diagram`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.warn('⚠️ UML diagram generation failed:', error instanceof Error ? error.message : String(error));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ============================================
|
|
170
|
+
// 5. GENERATING DOCUMENTATION
|
|
171
|
+
// ============================================
|
|
172
|
+
|
|
173
|
+
async function generateDocumentation(ast: SpecVerseAST): Promise<void> {
|
|
174
|
+
try {
|
|
175
|
+
const generator = new DocumentationGenerator();
|
|
176
|
+
|
|
177
|
+
// Generate markdown documentation
|
|
178
|
+
const markdown = generator.generate(ast, {
|
|
179
|
+
format: 'markdown',
|
|
180
|
+
includeTableOfContents: true,
|
|
181
|
+
includeExamples: true,
|
|
182
|
+
includeDiagrams: false
|
|
183
|
+
});
|
|
184
|
+
writeFileSync('output/documentation.md', markdown);
|
|
185
|
+
|
|
186
|
+
// Generate HTML documentation
|
|
187
|
+
const html = generator.generate(ast, {
|
|
188
|
+
format: 'html',
|
|
189
|
+
includeTableOfContents: true,
|
|
190
|
+
includeExamples: true
|
|
191
|
+
});
|
|
192
|
+
writeFileSync('output/documentation.html', html);
|
|
193
|
+
|
|
194
|
+
// Generate OpenAPI specification
|
|
195
|
+
const openapi = generator.generate(ast, {
|
|
196
|
+
format: 'openapi',
|
|
197
|
+
baseUrl: 'https://api.example.com'
|
|
198
|
+
});
|
|
199
|
+
writeFileSync('output/openapi.json', openapi);
|
|
200
|
+
|
|
201
|
+
console.log('✅ Documentation generated (Markdown, HTML, OpenAPI)');
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.warn('⚠️ Documentation generation failed:', error instanceof Error ? error.message : String(error));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ============================================
|
|
208
|
+
// 6. WORKING WITH MERMAID DIAGRAMS (V3.1)
|
|
209
|
+
// ============================================
|
|
210
|
+
|
|
211
|
+
async function generateMermaidDiagrams(filePath: string): Promise<void> {
|
|
212
|
+
const generator = new UnifiedDiagramGenerator();
|
|
213
|
+
|
|
214
|
+
// Generate all diagram types
|
|
215
|
+
const outputDir = 'output/diagrams';
|
|
216
|
+
await generator.generateFromFile(filePath, outputDir);
|
|
217
|
+
|
|
218
|
+
console.log('✅ Mermaid diagrams generated in:', outputDir);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ============================================
|
|
222
|
+
// 7. CUSTOM PROCESSING EXAMPLE
|
|
223
|
+
// ============================================
|
|
224
|
+
|
|
225
|
+
async function customProcessing(ast: SpecVerseAST): Promise<void> {
|
|
226
|
+
// Extract all models
|
|
227
|
+
const allModels: ModelSpec[] = ast.components.flatMap(c => c.models);
|
|
228
|
+
|
|
229
|
+
// Extract all controllers
|
|
230
|
+
const allControllers: ControllerSpec[] = ast.components.flatMap(c => c.controllers);
|
|
231
|
+
|
|
232
|
+
// Extract all events
|
|
233
|
+
const allEvents: EventSpec[] = ast.components.flatMap(c => c.events);
|
|
234
|
+
|
|
235
|
+
// Custom analysis
|
|
236
|
+
console.log('\n📊 Custom Analysis:');
|
|
237
|
+
console.log('Total models:', allModels.length);
|
|
238
|
+
console.log('Models with lifecycles:', allModels.filter(m => m.lifecycle).length);
|
|
239
|
+
console.log('Total endpoints:', allControllers.flatMap(c => c.actions).length);
|
|
240
|
+
console.log('Total events:', allEvents.length);
|
|
241
|
+
|
|
242
|
+
// Generate custom output
|
|
243
|
+
const customOutput = {
|
|
244
|
+
summary: {
|
|
245
|
+
modelCount: allModels.length,
|
|
246
|
+
controllerCount: allControllers.length,
|
|
247
|
+
eventCount: allEvents.length,
|
|
248
|
+
},
|
|
249
|
+
models: allModels.map(m => ({
|
|
250
|
+
name: m.name,
|
|
251
|
+
attributeCount: Object.keys(m.attributes || {}).length,
|
|
252
|
+
hasLifecycle: !!m.lifecycle,
|
|
253
|
+
relationshipCount: m.relationships?.length || 0
|
|
254
|
+
})),
|
|
255
|
+
controllers: allControllers.map(c => ({
|
|
256
|
+
name: c.name,
|
|
257
|
+
actionCount: c.actions.length,
|
|
258
|
+
model: c.model
|
|
259
|
+
}))
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
writeFileSync('output/custom-analysis.json', JSON.stringify(customOutput, null, 2));
|
|
263
|
+
console.log('✅ Custom analysis saved');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ============================================
|
|
267
|
+
// 8. VALIDATION ONLY
|
|
268
|
+
// ============================================
|
|
269
|
+
|
|
270
|
+
function validateSpecification(filePath: string): boolean {
|
|
271
|
+
const schema = JSON.parse(readFileSync('node_modules/@specverse/lang/schema/SPECVERSE-SCHEMA.json', 'utf8'));
|
|
272
|
+
const parser = new SpecVerseParser(schema);
|
|
273
|
+
|
|
274
|
+
const content = readFileSync(filePath, 'utf8');
|
|
275
|
+
const result = parser.parseContent(content, filePath);
|
|
276
|
+
|
|
277
|
+
if (result.errors.length === 0) {
|
|
278
|
+
console.log('✅ Specification is valid');
|
|
279
|
+
return true;
|
|
280
|
+
} else {
|
|
281
|
+
console.error('❌ Validation errors:');
|
|
282
|
+
result.errors.forEach(error => console.error(' -', error));
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ============================================
|
|
288
|
+
// 9. PROCESSING SPECLY TO YAML
|
|
289
|
+
// ============================================
|
|
290
|
+
|
|
291
|
+
function processSpeclyToYaml(speclyPath: string, outputPath: string): void {
|
|
292
|
+
const schema = JSON.parse(readFileSync('node_modules/@specverse/lang/schema/SPECVERSE-SCHEMA.json', 'utf8'));
|
|
293
|
+
const parser = new SpecVerseParser(schema);
|
|
294
|
+
|
|
295
|
+
const content = readFileSync(speclyPath, 'utf8');
|
|
296
|
+
const result = parser.processToYaml(content);
|
|
297
|
+
|
|
298
|
+
if (result.errors.length > 0) {
|
|
299
|
+
console.error('❌ Processing errors:', result.errors);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
writeFileSync(outputPath, result.yaml);
|
|
304
|
+
console.log('✅ Processed to YAML:', outputPath);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// ============================================
|
|
308
|
+
// MAIN EXAMPLE USAGE
|
|
309
|
+
// ============================================
|
|
310
|
+
|
|
311
|
+
async function main() {
|
|
312
|
+
try {
|
|
313
|
+
const specFile = 'examples/01-fundamentals/01-01-basic-model.specly';
|
|
314
|
+
|
|
315
|
+
// 1. Parse the specification
|
|
316
|
+
const ast = await parseSpecification(specFile);
|
|
317
|
+
if (!ast) {
|
|
318
|
+
console.error('Failed to parse specification');
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 2. Run inference to generate complete architecture
|
|
323
|
+
const inferenceResult = await runInference(ast);
|
|
324
|
+
|
|
325
|
+
// 3. Generate various outputs
|
|
326
|
+
await generateAIView(ast);
|
|
327
|
+
await generateUMLDiagrams(ast);
|
|
328
|
+
await generateDocumentation(ast);
|
|
329
|
+
await generateMermaidDiagrams(specFile);
|
|
330
|
+
|
|
331
|
+
// 4. Custom processing
|
|
332
|
+
await customProcessing(ast);
|
|
333
|
+
|
|
334
|
+
// 5. Process .specly to .yaml
|
|
335
|
+
processSpeclyToYaml(specFile, 'output/processed.yaml');
|
|
336
|
+
|
|
337
|
+
console.log('\n✨ All operations completed successfully!');
|
|
338
|
+
|
|
339
|
+
} catch (error) {
|
|
340
|
+
console.error('Error:', error);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Run if this file is executed directly
|
|
345
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
346
|
+
main();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// ============================================
|
|
350
|
+
// EXPORTS FOR USE IN OTHER MODULES
|
|
351
|
+
// ============================================
|
|
352
|
+
|
|
353
|
+
export {
|
|
354
|
+
parseSpecification,
|
|
355
|
+
runInference,
|
|
356
|
+
generateAIView,
|
|
357
|
+
generateUMLDiagrams,
|
|
358
|
+
generateDocumentation,
|
|
359
|
+
generateMermaidDiagrams,
|
|
360
|
+
customProcessing,
|
|
361
|
+
validateSpecification,
|
|
362
|
+
processSpeclyToYaml
|
|
363
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpecVerse API Workflow Test
|
|
3
|
+
*
|
|
4
|
+
* Focused end-to-end workflow test for the SpecVerse API
|
|
5
|
+
* This is a minimal, streamlined test extracted from test-specverse-api
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { SpecVerseParser, LogicalInferenceEngine } from '../../dist/index.js';
|
|
9
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
10
|
+
|
|
11
|
+
// Simple test specification
|
|
12
|
+
const testSpec = `components:
|
|
13
|
+
UserManagement:
|
|
14
|
+
version: "1.0.0"
|
|
15
|
+
description: "User management system"
|
|
16
|
+
|
|
17
|
+
models:
|
|
18
|
+
User:
|
|
19
|
+
description: "User model for API testing"
|
|
20
|
+
attributes:
|
|
21
|
+
id: UUID required
|
|
22
|
+
name: String required
|
|
23
|
+
email: Email unique required
|
|
24
|
+
created_at: DateTime auto=now
|
|
25
|
+
|
|
26
|
+
lifecycles:
|
|
27
|
+
status:
|
|
28
|
+
flow: inactive -> active -> suspended
|
|
29
|
+
|
|
30
|
+
deployments: {}`;
|
|
31
|
+
|
|
32
|
+
async function testFullWorkflow() {
|
|
33
|
+
console.log('🧪 Testing full API workflow...');
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
// 1. Parse the spec
|
|
37
|
+
console.log('1️⃣ Parsing specification...');
|
|
38
|
+
|
|
39
|
+
const schema = JSON.parse(readFileSync('schema/SPECVERSE-SCHEMA.json', 'utf8'));
|
|
40
|
+
const parser = new SpecVerseParser(schema);
|
|
41
|
+
const result = parser.parseContent(testSpec, 'test.specly');
|
|
42
|
+
|
|
43
|
+
if (result.errors.length > 0) {
|
|
44
|
+
throw new Error('Parse failed: ' + result.errors.map(e => e.message).join(', '));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const ast = result.ast;
|
|
48
|
+
console.log('✅ Parsed successfully');
|
|
49
|
+
|
|
50
|
+
// 2. Run inference
|
|
51
|
+
console.log('2️⃣ Running inference...');
|
|
52
|
+
const config = {
|
|
53
|
+
logical: {
|
|
54
|
+
generateControllers: true,
|
|
55
|
+
generateServices: true,
|
|
56
|
+
generateEvents: true,
|
|
57
|
+
generateViews: true,
|
|
58
|
+
generateTypes: true
|
|
59
|
+
},
|
|
60
|
+
rules: {
|
|
61
|
+
logicalRulesPath: 'dist/inference-engine/rules/logical',
|
|
62
|
+
deploymentRulesPath: 'dist/inference-engine/rules/deployment'
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const engine = new LogicalInferenceEngine(config);
|
|
67
|
+
const models = ast.components.flatMap(c => c.models);
|
|
68
|
+
|
|
69
|
+
// Load rules
|
|
70
|
+
const rulesResult = await engine.loadRules();
|
|
71
|
+
if (!rulesResult.valid) {
|
|
72
|
+
throw new Error('Failed to load rules: ' + rulesResult.errors.map(e => e.message).join(', '));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Run inference
|
|
76
|
+
const inferenceResult = await engine.inferLogicalSpecification(models, 'TestComponent');
|
|
77
|
+
|
|
78
|
+
console.log('✅ Inference completed!');
|
|
79
|
+
console.log(' Generated Controllers:', inferenceResult.statistics.controllersGenerated || 0);
|
|
80
|
+
console.log(' Generated Services:', inferenceResult.statistics.servicesGenerated || 0);
|
|
81
|
+
console.log(' Generated Events:', inferenceResult.statistics.eventsGenerated || 0);
|
|
82
|
+
console.log(' Generated Views:', inferenceResult.statistics.viewsGenerated || 0);
|
|
83
|
+
|
|
84
|
+
if (inferenceResult.validation.valid) {
|
|
85
|
+
console.log('✅ Generated specification is valid!');
|
|
86
|
+
console.log('🎉 FULL API WORKFLOW SUCCESS!');
|
|
87
|
+
return true;
|
|
88
|
+
} else {
|
|
89
|
+
console.log('⚠️ Generated specification has warnings:', inferenceResult.validation.errors.length);
|
|
90
|
+
inferenceResult.validation.errors.forEach(error => {
|
|
91
|
+
console.log(' -', error.message);
|
|
92
|
+
});
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('❌ Workflow failed:', error.message);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Export for use in tests
|
|
103
|
+
export { testFullWorkflow };
|
|
104
|
+
|
|
105
|
+
// Run if executed directly
|
|
106
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
107
|
+
testFullWorkflow()
|
|
108
|
+
.then(success => process.exit(success ? 0 : 1))
|
|
109
|
+
.catch(error => {
|
|
110
|
+
console.error('Unexpected error:', error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SpecVerse v3.3 Manifest - Simple Default Mappings Example
|
|
2
|
+
#
|
|
3
|
+
# This manifest demonstrates the simplest v3.3 approach:
|
|
4
|
+
# Using defaultMappings to specify instance factories by category.
|
|
5
|
+
#
|
|
6
|
+
# Resolution: All instances of a category use the same factory.
|
|
7
|
+
|
|
8
|
+
specVersion: "3.3.0"
|
|
9
|
+
name: "simple-api-manifest"
|
|
10
|
+
description: "Basic REST API with Fastify and PostgreSQL using default mappings"
|
|
11
|
+
version: "1.0.0"
|
|
12
|
+
|
|
13
|
+
# Link to deployment specification
|
|
14
|
+
deployment:
|
|
15
|
+
deploymentSource: "./blog-api.specly"
|
|
16
|
+
deploymentName: "production"
|
|
17
|
+
|
|
18
|
+
# Default instance factories by category (lowest priority)
|
|
19
|
+
# Fine-grained factories allow flexible composition
|
|
20
|
+
defaultMappings:
|
|
21
|
+
controller: "FastifyAPI" # Pure Fastify routes (no ORM coupling)
|
|
22
|
+
service: "PrismaORM" # Prisma ORM for data access
|
|
23
|
+
storage: "PostgreSQL15" # PostgreSQL database instance
|
|
24
|
+
|
|
25
|
+
# Capability-based mappings for cross-cutting concerns
|
|
26
|
+
capabilityMappings:
|
|
27
|
+
- capability: "validation.runtime"
|
|
28
|
+
instanceFactory: "ZodValidation"
|
|
29
|
+
|
|
30
|
+
# Global configuration applied to all instance factories
|
|
31
|
+
configuration:
|
|
32
|
+
environment: "production"
|
|
33
|
+
region: "us-east-1"
|
|
34
|
+
logging:
|
|
35
|
+
level: "info"
|
|
36
|
+
format: "json"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# SpecVerse v3.3 Manifest - Capability Mappings Example
|
|
2
|
+
#
|
|
3
|
+
# This manifest demonstrates capability-based mapping with pattern matching.
|
|
4
|
+
# Different capabilities can be mapped to different instance factories.
|
|
5
|
+
#
|
|
6
|
+
# Resolution: Matches capability patterns with wildcard support.
|
|
7
|
+
|
|
8
|
+
specVersion: "3.3.0"
|
|
9
|
+
name: "capability-based-manifest"
|
|
10
|
+
description: "API with specialized factories for different capability patterns"
|
|
11
|
+
version: "1.0.0"
|
|
12
|
+
|
|
13
|
+
deployment:
|
|
14
|
+
deploymentSource: "./blog-api.specly"
|
|
15
|
+
deploymentName: "production"
|
|
16
|
+
|
|
17
|
+
# Default factories (used when no capability match found)
|
|
18
|
+
defaultMappings:
|
|
19
|
+
controller: "FastifyPrismaAPI"
|
|
20
|
+
storage: "PostgreSQL15"
|
|
21
|
+
|
|
22
|
+
# Capability-based mappings (medium priority)
|
|
23
|
+
# Overrides defaults when capability pattern matches
|
|
24
|
+
capabilityMappings:
|
|
25
|
+
# REST API endpoints use Fastify
|
|
26
|
+
- capability: "api.rest"
|
|
27
|
+
instanceFactory: "FastifyPrismaAPI"
|
|
28
|
+
version: "^1.0.0"
|
|
29
|
+
|
|
30
|
+
# WebSocket capabilities use specialized factory
|
|
31
|
+
- capability: "api.websocket"
|
|
32
|
+
instanceFactory: "FastifyWebSocketAPI"
|
|
33
|
+
version: "^1.0.0"
|
|
34
|
+
|
|
35
|
+
# Reporting endpoints get specialized configuration
|
|
36
|
+
- capability: "api.rest.reports"
|
|
37
|
+
instanceFactory: "ReportingAPI"
|
|
38
|
+
configuration:
|
|
39
|
+
caching: true
|
|
40
|
+
timeout: 60000
|
|
41
|
+
|
|
42
|
+
# Database storage uses PostgreSQL
|
|
43
|
+
- capability: "storage.database"
|
|
44
|
+
instanceFactory: "PostgreSQL15"
|
|
45
|
+
|
|
46
|
+
# Cache capabilities use Redis
|
|
47
|
+
- capability: "storage.cache"
|
|
48
|
+
instanceFactory: "Redis7"
|
|
49
|
+
|
|
50
|
+
# Validation uses Zod
|
|
51
|
+
- capability: "validation.runtime"
|
|
52
|
+
instanceFactory: "ZodValidation"
|
|
53
|
+
|
|
54
|
+
configuration:
|
|
55
|
+
environment: "production"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# SpecVerse v3.3 Manifest - Hybrid Mappings Example
|
|
2
|
+
#
|
|
3
|
+
# This manifest demonstrates the full power of v3.3 hybrid mapping:
|
|
4
|
+
# All three mapping strategies working together with clear priorities.
|
|
5
|
+
#
|
|
6
|
+
# Resolution Priority:
|
|
7
|
+
# 1. instanceMappings (highest) - explicit instance name
|
|
8
|
+
# 2. capabilityMappings (medium) - capability pattern match
|
|
9
|
+
# 3. defaultMappings (lowest) - category-based fallback
|
|
10
|
+
|
|
11
|
+
specVersion: "3.3.0"
|
|
12
|
+
name: "hybrid-mapping-manifest"
|
|
13
|
+
description: "Complex API using all three mapping strategies for maximum flexibility"
|
|
14
|
+
version: "1.0.0"
|
|
15
|
+
|
|
16
|
+
deployment:
|
|
17
|
+
deploymentSource: "./blog-api.specly"
|
|
18
|
+
deploymentName: "production"
|
|
19
|
+
|
|
20
|
+
# PRIORITY 3: Default factories by category (lowest priority)
|
|
21
|
+
# Used when no capability or instance mapping matches
|
|
22
|
+
# Fine-grained factories enable flexible composition
|
|
23
|
+
defaultMappings:
|
|
24
|
+
controller: "FastifyAPI" # Pure Fastify (no ORM coupling)
|
|
25
|
+
service: "PrismaORM" # Prisma data access layer
|
|
26
|
+
view: "TypeScriptSDK"
|
|
27
|
+
storage: "PostgreSQL15"
|
|
28
|
+
infrastructure: "DockerK8s"
|
|
29
|
+
|
|
30
|
+
# PRIORITY 2: Capability-based mappings (medium priority)
|
|
31
|
+
# Overrides defaultMappings when capability pattern matches
|
|
32
|
+
capabilityMappings:
|
|
33
|
+
# Validation capabilities
|
|
34
|
+
- capability: "validation.runtime"
|
|
35
|
+
instanceFactory: "ZodValidation"
|
|
36
|
+
|
|
37
|
+
# Most REST APIs use Fastify
|
|
38
|
+
- capability: "api.rest"
|
|
39
|
+
instanceFactory: "FastifyAPI"
|
|
40
|
+
|
|
41
|
+
# But reporting APIs get specialized treatment
|
|
42
|
+
- capability: "api.rest.reports"
|
|
43
|
+
instanceFactory: "ReportingAPI"
|
|
44
|
+
configuration:
|
|
45
|
+
caching: true
|
|
46
|
+
batchSize: 1000
|
|
47
|
+
timeout: 120000
|
|
48
|
+
|
|
49
|
+
# Analytics capabilities use special processing
|
|
50
|
+
- capability: "api.rest.analytics"
|
|
51
|
+
instanceFactory: "AnalyticsAPI"
|
|
52
|
+
configuration:
|
|
53
|
+
aggregation: true
|
|
54
|
+
realtime: true
|
|
55
|
+
|
|
56
|
+
# WebSocket for real-time features
|
|
57
|
+
- capability: "api.websocket"
|
|
58
|
+
instanceFactory: "FastifyWebSocketAPI"
|
|
59
|
+
|
|
60
|
+
# Standard database operations
|
|
61
|
+
- capability: "storage.database"
|
|
62
|
+
instanceFactory: "PostgreSQL15"
|
|
63
|
+
|
|
64
|
+
# Cache operations
|
|
65
|
+
- capability: "storage.cache"
|
|
66
|
+
instanceFactory: "Redis7"
|
|
67
|
+
|
|
68
|
+
# PRIORITY 1: Instance-specific mappings (highest priority)
|
|
69
|
+
# Explicit instance names override everything else
|
|
70
|
+
instanceMappings:
|
|
71
|
+
# Analytics database uses MongoDB instead of PostgreSQL
|
|
72
|
+
- instanceName: "analyticsDb"
|
|
73
|
+
instanceFactory: "MongoDB6"
|
|
74
|
+
configuration:
|
|
75
|
+
sharding: true
|
|
76
|
+
replication: 3
|
|
77
|
+
|
|
78
|
+
# High-performance cache for user sessions
|
|
79
|
+
- instanceName: "sessionCache"
|
|
80
|
+
instanceFactory: "Redis7"
|
|
81
|
+
configuration:
|
|
82
|
+
maxMemory: "4gb"
|
|
83
|
+
evictionPolicy: "allkeys-lru"
|
|
84
|
+
|
|
85
|
+
# Specialized API for admin operations
|
|
86
|
+
- instanceName: "adminApi"
|
|
87
|
+
instanceFactory: "NestJSAPI"
|
|
88
|
+
configuration:
|
|
89
|
+
rbac: true
|
|
90
|
+
auditLog: true
|
|
91
|
+
|
|
92
|
+
# Main user-facing API with specific config
|
|
93
|
+
- instanceName: "userApi"
|
|
94
|
+
instanceFactory: "FastifyPrismaAPI"
|
|
95
|
+
configuration:
|
|
96
|
+
rateLimit:
|
|
97
|
+
max: 1000
|
|
98
|
+
timeWindow: "1 minute"
|
|
99
|
+
|
|
100
|
+
# Global configuration
|
|
101
|
+
configuration:
|
|
102
|
+
environment: "production"
|
|
103
|
+
region: "us-east-1"
|
|
104
|
+
monitoring:
|
|
105
|
+
enabled: true
|
|
106
|
+
provider: "datadog"
|
|
107
|
+
logging:
|
|
108
|
+
level: "info"
|
|
109
|
+
format: "json"
|