@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,539 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax Mapper - Framework Syntax Patterns
|
|
3
|
+
*
|
|
4
|
+
* Maps universal programming patterns to framework-specific syntax.
|
|
5
|
+
* Enables consistent code generation across React, Vue, Svelte, Angular, and runtime.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - SyntaxPattern: Template strings for each framework
|
|
9
|
+
* - SYNTAX_PATTERNS: Universal patterns (state, loops, events, conditions, imports)
|
|
10
|
+
* - getSyntaxPattern(): Template variable replacement
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* getSyntaxPattern('stateDeclaration', 'react', {name: 'count', initial: '0'})
|
|
14
|
+
* → "const [count, setCount] = useState(0);"
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Types
|
|
19
|
+
// ============================================================================
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* All supported framework targets for syntax generation
|
|
23
|
+
*/
|
|
24
|
+
export type FrameworkTarget = 'react' | 'vue' | 'svelte' | 'angular' | 'runtime';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Syntax pattern definition for a single programming pattern
|
|
28
|
+
* Maps each framework to its specific syntax template
|
|
29
|
+
*/
|
|
30
|
+
export interface SyntaxPattern {
|
|
31
|
+
react: string;
|
|
32
|
+
vue: string;
|
|
33
|
+
svelte: string;
|
|
34
|
+
angular: string;
|
|
35
|
+
runtime: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Available syntax pattern categories
|
|
40
|
+
*/
|
|
41
|
+
export type SyntaxPatternKey =
|
|
42
|
+
// State management
|
|
43
|
+
| 'stateDeclaration'
|
|
44
|
+
| 'stateUpdate'
|
|
45
|
+
| 'stateGetter'
|
|
46
|
+
// Rendering patterns
|
|
47
|
+
| 'loopRender'
|
|
48
|
+
| 'conditionalRender'
|
|
49
|
+
| 'componentRender'
|
|
50
|
+
// Event handling
|
|
51
|
+
| 'eventHandler'
|
|
52
|
+
| 'eventBinding'
|
|
53
|
+
// Lifecycle
|
|
54
|
+
| 'onMount'
|
|
55
|
+
| 'onUnmount'
|
|
56
|
+
| 'onUpdate'
|
|
57
|
+
// Props/Attributes
|
|
58
|
+
| 'propDeclaration'
|
|
59
|
+
| 'propAccess'
|
|
60
|
+
| 'propBinding'
|
|
61
|
+
// Imports
|
|
62
|
+
| 'componentImport'
|
|
63
|
+
| 'hookImport'
|
|
64
|
+
| 'libraryImport';
|
|
65
|
+
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Syntax Pattern Definitions
|
|
68
|
+
// ============================================================================
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* State Management Patterns
|
|
72
|
+
*/
|
|
73
|
+
export const STATE_PATTERNS: Record<string, SyntaxPattern> = {
|
|
74
|
+
/**
|
|
75
|
+
* Declare a state variable
|
|
76
|
+
* Variables: name, Name (capitalized), type (optional), initial
|
|
77
|
+
*/
|
|
78
|
+
stateDeclaration: {
|
|
79
|
+
react: 'const [${name}, set${Name}] = useState<${type}>(${initial});',
|
|
80
|
+
vue: 'const ${name} = ref<${type}>(${initial});',
|
|
81
|
+
svelte: 'let ${name}: ${type} = ${initial};',
|
|
82
|
+
angular: '${name}: ${type} = ${initial};',
|
|
83
|
+
runtime: 'const [${name}, set${Name}] = useState<${type}>(${initial});'
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Update a state variable
|
|
88
|
+
* Variables: name, Name (capitalized), value
|
|
89
|
+
*/
|
|
90
|
+
stateUpdate: {
|
|
91
|
+
react: 'set${Name}(${value});',
|
|
92
|
+
vue: '${name}.value = ${value};',
|
|
93
|
+
svelte: '${name} = ${value};',
|
|
94
|
+
angular: 'this.${name} = ${value};',
|
|
95
|
+
runtime: 'set${Name}(${value});'
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Access a state variable value
|
|
100
|
+
* Variables: name
|
|
101
|
+
*/
|
|
102
|
+
stateGetter: {
|
|
103
|
+
react: '${name}',
|
|
104
|
+
vue: '${name}.value',
|
|
105
|
+
svelte: '${name}',
|
|
106
|
+
angular: 'this.${name}',
|
|
107
|
+
runtime: '${name}'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Rendering Patterns
|
|
113
|
+
*/
|
|
114
|
+
export const RENDER_PATTERNS: Record<string, SyntaxPattern> = {
|
|
115
|
+
/**
|
|
116
|
+
* Render array of items with loop
|
|
117
|
+
* Variables: array, item, key, Component
|
|
118
|
+
*/
|
|
119
|
+
loopRender: {
|
|
120
|
+
react: '{${array}.map((${item}) => <${Component} key={${item}.${key}} ${item}={${item}} />)}',
|
|
121
|
+
vue: '<${Component} v-for="${item} in ${array}" :key="${item}.${key}" :${item}="${item}" />',
|
|
122
|
+
svelte: '{#each ${array} as ${item} (${item}.${key})}<${Component} ${item}={${item}} />{/each}',
|
|
123
|
+
angular: '<${component} *ngFor="let ${item} of ${array}; trackBy: track${Item}" [${item}]="${item}"></${component}>',
|
|
124
|
+
runtime: '{${array}.map((${item}) => createElement(${Component}, { key: ${item}.${key}, ${item} }))}'
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Conditional rendering
|
|
129
|
+
* Variables: condition, Component, props (optional)
|
|
130
|
+
*/
|
|
131
|
+
conditionalRender: {
|
|
132
|
+
react: '{${condition} && <${Component} ${props} />}',
|
|
133
|
+
vue: '<${Component} v-if="${condition}" ${props} />',
|
|
134
|
+
svelte: '{#if ${condition}}<${Component} ${props} />{/if}',
|
|
135
|
+
angular: '<${component} *ngIf="${condition}" ${props}></${component}>',
|
|
136
|
+
runtime: '{${condition} && createElement(${Component}, ${props})}'
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Render a component with props
|
|
141
|
+
* Variables: Component, props
|
|
142
|
+
*/
|
|
143
|
+
componentRender: {
|
|
144
|
+
react: '<${Component} ${props} />',
|
|
145
|
+
vue: '<${Component} ${props} />',
|
|
146
|
+
svelte: '<${Component} ${props} />',
|
|
147
|
+
angular: '<${component} ${props}></${component}>',
|
|
148
|
+
runtime: 'createElement(${Component}, ${props})'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Event Handling Patterns
|
|
154
|
+
*/
|
|
155
|
+
export const EVENT_PATTERNS: Record<string, SyntaxPattern> = {
|
|
156
|
+
/**
|
|
157
|
+
* Declare event handler function
|
|
158
|
+
* Variables: name, Name (capitalized), params, body
|
|
159
|
+
*/
|
|
160
|
+
eventHandler: {
|
|
161
|
+
react: 'const handle${Name} = (${params}) => {\n ${body}\n};',
|
|
162
|
+
vue: 'const handle${Name} = (${params}) => {\n ${body}\n};',
|
|
163
|
+
svelte: 'function handle${Name}(${params}) {\n ${body}\n}',
|
|
164
|
+
angular: 'handle${Name}(${params}): void {\n ${body}\n}',
|
|
165
|
+
runtime: 'const handle${Name} = (${params}) => {\n ${body}\n};'
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Bind event to handler
|
|
170
|
+
* Variables: event, handler
|
|
171
|
+
*/
|
|
172
|
+
eventBinding: {
|
|
173
|
+
react: '${event}={${handler}}',
|
|
174
|
+
vue: '@${event}="${handler}"',
|
|
175
|
+
svelte: 'on:${event}={${handler}}',
|
|
176
|
+
angular: '(${event})="${handler}($event)"',
|
|
177
|
+
runtime: '${event}: ${handler}'
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Lifecycle Patterns
|
|
183
|
+
*/
|
|
184
|
+
export const LIFECYCLE_PATTERNS: Record<string, SyntaxPattern> = {
|
|
185
|
+
/**
|
|
186
|
+
* Component mount lifecycle
|
|
187
|
+
* Variables: body
|
|
188
|
+
*/
|
|
189
|
+
onMount: {
|
|
190
|
+
react: 'useEffect(() => {\n ${body}\n}, []);',
|
|
191
|
+
vue: 'onMounted(() => {\n ${body}\n});',
|
|
192
|
+
svelte: 'onMount(() => {\n ${body}\n});',
|
|
193
|
+
angular: 'ngOnInit(): void {\n ${body}\n}',
|
|
194
|
+
runtime: 'useEffect(() => {\n ${body}\n}, []);'
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Component unmount lifecycle
|
|
199
|
+
* Variables: body
|
|
200
|
+
*/
|
|
201
|
+
onUnmount: {
|
|
202
|
+
react: 'useEffect(() => {\n return () => {\n ${body}\n };\n}, []);',
|
|
203
|
+
vue: 'onUnmounted(() => {\n ${body}\n});',
|
|
204
|
+
svelte: 'onDestroy(() => {\n ${body}\n});',
|
|
205
|
+
angular: 'ngOnDestroy(): void {\n ${body}\n}',
|
|
206
|
+
runtime: 'useEffect(() => {\n return () => {\n ${body}\n };\n}, []);'
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Value change/update lifecycle
|
|
211
|
+
* Variables: dependencies, body
|
|
212
|
+
*/
|
|
213
|
+
onUpdate: {
|
|
214
|
+
react: 'useEffect(() => {\n ${body}\n}, [${dependencies}]);',
|
|
215
|
+
vue: 'watch([${dependencies}], () => {\n ${body}\n});',
|
|
216
|
+
svelte: '$: if (${dependencies}) {\n ${body}\n}',
|
|
217
|
+
angular: 'ngOnChanges(changes: SimpleChanges): void {\n ${body}\n}',
|
|
218
|
+
runtime: 'useEffect(() => {\n ${body}\n}, [${dependencies}]);'
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Props/Attributes Patterns
|
|
224
|
+
*/
|
|
225
|
+
export const PROP_PATTERNS: Record<string, SyntaxPattern> = {
|
|
226
|
+
/**
|
|
227
|
+
* Declare component props/properties
|
|
228
|
+
* Variables: name, type, required (boolean)
|
|
229
|
+
*/
|
|
230
|
+
propDeclaration: {
|
|
231
|
+
react: '${name}${required ? "" : "?"}: ${type}',
|
|
232
|
+
vue: '${name}: { type: ${type}, required: ${required} }',
|
|
233
|
+
svelte: 'export let ${name}: ${type}${required ? "" : " | undefined"};',
|
|
234
|
+
angular: '@Input() ${name}${required ? "!" : "?"}: ${type};',
|
|
235
|
+
runtime: '${name}${required ? "" : "?"}: ${type}'
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Access props inside component
|
|
240
|
+
* Variables: name
|
|
241
|
+
*/
|
|
242
|
+
propAccess: {
|
|
243
|
+
react: '${name}',
|
|
244
|
+
vue: 'props.${name}',
|
|
245
|
+
svelte: '${name}',
|
|
246
|
+
angular: 'this.${name}',
|
|
247
|
+
runtime: '${name}'
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Bind prop value to component
|
|
252
|
+
* Variables: name, value
|
|
253
|
+
*/
|
|
254
|
+
propBinding: {
|
|
255
|
+
react: '${name}={${value}}',
|
|
256
|
+
vue: ':${name}="${value}"',
|
|
257
|
+
svelte: '${name}={${value}}',
|
|
258
|
+
angular: '[${name}]="${value}"',
|
|
259
|
+
runtime: '${name}: ${value}'
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Import Patterns
|
|
265
|
+
*/
|
|
266
|
+
export const IMPORT_PATTERNS: Record<string, SyntaxPattern> = {
|
|
267
|
+
/**
|
|
268
|
+
* Import a component
|
|
269
|
+
* Variables: Component, path
|
|
270
|
+
*/
|
|
271
|
+
componentImport: {
|
|
272
|
+
react: "import ${Component} from '${path}';",
|
|
273
|
+
vue: "import ${Component} from '${path}';",
|
|
274
|
+
svelte: "import ${Component} from '${path}';",
|
|
275
|
+
angular: "import { ${Component} } from '${path}';",
|
|
276
|
+
runtime: "import ${Component} from '${path}';"
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Import hooks/composables
|
|
281
|
+
* Variables: hooks (comma-separated), source
|
|
282
|
+
*/
|
|
283
|
+
hookImport: {
|
|
284
|
+
react: "import { ${hooks} } from '${source}';",
|
|
285
|
+
vue: "import { ${hooks} } from '${source}';",
|
|
286
|
+
svelte: "import { ${hooks} } from '${source}';",
|
|
287
|
+
angular: "import { ${hooks} } from '${source}';",
|
|
288
|
+
runtime: "import { ${hooks} } from '${source}';"
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Import from library
|
|
293
|
+
* Variables: exports, library
|
|
294
|
+
*/
|
|
295
|
+
libraryImport: {
|
|
296
|
+
react: "import { ${exports} } from '${library}';",
|
|
297
|
+
vue: "import { ${exports} } from '${library}';",
|
|
298
|
+
svelte: "import { ${exports} } from '${library}';",
|
|
299
|
+
angular: "import { ${exports} } from '${library}';",
|
|
300
|
+
runtime: "import { ${exports} } from '${library}';"
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* All syntax patterns organized by category
|
|
306
|
+
*/
|
|
307
|
+
export const SYNTAX_PATTERNS: Record<SyntaxPatternKey, SyntaxPattern> = {
|
|
308
|
+
// State
|
|
309
|
+
stateDeclaration: STATE_PATTERNS.stateDeclaration,
|
|
310
|
+
stateUpdate: STATE_PATTERNS.stateUpdate,
|
|
311
|
+
stateGetter: STATE_PATTERNS.stateGetter,
|
|
312
|
+
// Rendering
|
|
313
|
+
loopRender: RENDER_PATTERNS.loopRender,
|
|
314
|
+
conditionalRender: RENDER_PATTERNS.conditionalRender,
|
|
315
|
+
componentRender: RENDER_PATTERNS.componentRender,
|
|
316
|
+
// Events
|
|
317
|
+
eventHandler: EVENT_PATTERNS.eventHandler,
|
|
318
|
+
eventBinding: EVENT_PATTERNS.eventBinding,
|
|
319
|
+
// Lifecycle
|
|
320
|
+
onMount: LIFECYCLE_PATTERNS.onMount,
|
|
321
|
+
onUnmount: LIFECYCLE_PATTERNS.onUnmount,
|
|
322
|
+
onUpdate: LIFECYCLE_PATTERNS.onUpdate,
|
|
323
|
+
// Props
|
|
324
|
+
propDeclaration: PROP_PATTERNS.propDeclaration,
|
|
325
|
+
propAccess: PROP_PATTERNS.propAccess,
|
|
326
|
+
propBinding: PROP_PATTERNS.propBinding,
|
|
327
|
+
// Imports
|
|
328
|
+
componentImport: IMPORT_PATTERNS.componentImport,
|
|
329
|
+
hookImport: IMPORT_PATTERNS.hookImport,
|
|
330
|
+
libraryImport: IMPORT_PATTERNS.libraryImport
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// ============================================================================
|
|
334
|
+
// Template Replacement Functions
|
|
335
|
+
// ============================================================================
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Replaces template variables in a pattern string
|
|
339
|
+
*
|
|
340
|
+
* Template variables use ${variableName} syntax.
|
|
341
|
+
* Special handling for capitalization: ${Name} will capitalize first letter
|
|
342
|
+
*
|
|
343
|
+
* @param template - Template string with ${variables}
|
|
344
|
+
* @param variables - Object mapping variable names to values
|
|
345
|
+
* @returns String with variables replaced
|
|
346
|
+
*/
|
|
347
|
+
export function replaceTemplateVariables(
|
|
348
|
+
template: string,
|
|
349
|
+
variables: Record<string, any>
|
|
350
|
+
): string {
|
|
351
|
+
let result = template;
|
|
352
|
+
|
|
353
|
+
// Replace all ${variable} patterns
|
|
354
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
355
|
+
// Handle capitalized version (e.g., ${Name} from ${name})
|
|
356
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
357
|
+
const capitalizedPattern = new RegExp(`\\$\\{${capitalizedKey}\\}`, 'g');
|
|
358
|
+
result = result.replace(capitalizedPattern, String(value).charAt(0).toUpperCase() + String(value).slice(1));
|
|
359
|
+
|
|
360
|
+
// Handle normal version (e.g., ${name})
|
|
361
|
+
const normalPattern = new RegExp(`\\$\\{${key}\\}`, 'g');
|
|
362
|
+
result = result.replace(normalPattern, String(value));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Handle conditional expressions in template (e.g., ${required ? "" : "?"})
|
|
366
|
+
// This is a simple evaluator for common patterns
|
|
367
|
+
result = result.replace(/\$\{(\w+)\s*\?\s*"([^"]*)"\s*:\s*"([^"]*)"\}/g, (match, varName, trueVal, falseVal) => {
|
|
368
|
+
const varValue = variables[varName];
|
|
369
|
+
return varValue ? trueVal : falseVal;
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Gets a syntax pattern for a specific framework with variable replacement
|
|
377
|
+
*
|
|
378
|
+
* @param pattern - The syntax pattern key to use
|
|
379
|
+
* @param framework - Target framework
|
|
380
|
+
* @param variables - Variables to replace in template
|
|
381
|
+
* @returns Generated code string for the framework
|
|
382
|
+
*/
|
|
383
|
+
export function getSyntaxPattern(
|
|
384
|
+
pattern: SyntaxPatternKey,
|
|
385
|
+
framework: FrameworkTarget,
|
|
386
|
+
variables: Record<string, any>
|
|
387
|
+
): string {
|
|
388
|
+
const syntaxPattern = SYNTAX_PATTERNS[pattern];
|
|
389
|
+
|
|
390
|
+
if (!syntaxPattern) {
|
|
391
|
+
throw new Error(`Unknown syntax pattern: ${pattern}`);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const template = syntaxPattern[framework];
|
|
395
|
+
|
|
396
|
+
if (!template) {
|
|
397
|
+
throw new Error(`Framework ${framework} not supported for pattern ${pattern}`);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return replaceTemplateVariables(template, variables);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Gets all framework implementations of a pattern
|
|
405
|
+
*
|
|
406
|
+
* Useful for documentation or comparison
|
|
407
|
+
*
|
|
408
|
+
* @param pattern - The syntax pattern key
|
|
409
|
+
* @param variables - Variables to replace in templates
|
|
410
|
+
* @returns Object mapping frameworks to generated code
|
|
411
|
+
*/
|
|
412
|
+
export function getAllFrameworkSyntax(
|
|
413
|
+
pattern: SyntaxPatternKey,
|
|
414
|
+
variables: Record<string, any>
|
|
415
|
+
): Record<FrameworkTarget, string> {
|
|
416
|
+
const frameworks: FrameworkTarget[] = ['react', 'vue', 'svelte', 'angular', 'runtime'];
|
|
417
|
+
const result: Partial<Record<FrameworkTarget, string>> = {};
|
|
418
|
+
|
|
419
|
+
for (const framework of frameworks) {
|
|
420
|
+
result[framework] = getSyntaxPattern(pattern, framework, variables);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return result as Record<FrameworkTarget, string>;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Checks if a pattern is available for a framework
|
|
428
|
+
*
|
|
429
|
+
* @param pattern - The syntax pattern key
|
|
430
|
+
* @param framework - Target framework
|
|
431
|
+
* @returns True if pattern exists for framework
|
|
432
|
+
*/
|
|
433
|
+
export function hasPattern(
|
|
434
|
+
pattern: SyntaxPatternKey,
|
|
435
|
+
framework: FrameworkTarget
|
|
436
|
+
): boolean {
|
|
437
|
+
const syntaxPattern = SYNTAX_PATTERNS[pattern];
|
|
438
|
+
return Boolean(syntaxPattern && syntaxPattern[framework] !== undefined);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Gets all available pattern keys
|
|
443
|
+
*
|
|
444
|
+
* @returns Array of all syntax pattern keys
|
|
445
|
+
*/
|
|
446
|
+
export function getAllPatternKeys(): SyntaxPatternKey[] {
|
|
447
|
+
return Object.keys(SYNTAX_PATTERNS) as SyntaxPatternKey[];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Gets pattern keys by category
|
|
452
|
+
*
|
|
453
|
+
* @param category - Pattern category
|
|
454
|
+
* @returns Array of pattern keys in that category
|
|
455
|
+
*/
|
|
456
|
+
export function getPatternsByCategory(
|
|
457
|
+
category: 'state' | 'render' | 'event' | 'lifecycle' | 'prop' | 'import'
|
|
458
|
+
): SyntaxPatternKey[] {
|
|
459
|
+
const categoryMap: Record<string, SyntaxPatternKey[]> = {
|
|
460
|
+
state: ['stateDeclaration', 'stateUpdate', 'stateGetter'],
|
|
461
|
+
render: ['loopRender', 'conditionalRender', 'componentRender'],
|
|
462
|
+
event: ['eventHandler', 'eventBinding'],
|
|
463
|
+
lifecycle: ['onMount', 'onUnmount', 'onUpdate'],
|
|
464
|
+
prop: ['propDeclaration', 'propAccess', 'propBinding'],
|
|
465
|
+
import: ['componentImport', 'hookImport', 'libraryImport']
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
return categoryMap[category] || [];
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// ============================================================================
|
|
472
|
+
// Framework-Specific Helpers
|
|
473
|
+
// ============================================================================
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Generate state management code for a framework
|
|
477
|
+
* Convenience function that combines declaration and update patterns
|
|
478
|
+
*
|
|
479
|
+
* @param framework - Target framework
|
|
480
|
+
* @param stateName - Name of state variable
|
|
481
|
+
* @param stateType - TypeScript type
|
|
482
|
+
* @param initialValue - Initial value
|
|
483
|
+
* @returns Object with declaration and updater syntax
|
|
484
|
+
*/
|
|
485
|
+
export function generateStateCode(
|
|
486
|
+
framework: FrameworkTarget,
|
|
487
|
+
stateName: string,
|
|
488
|
+
stateType: string,
|
|
489
|
+
initialValue: string
|
|
490
|
+
): { declaration: string; update: (value: string) => string; get: string } {
|
|
491
|
+
const declaration = getSyntaxPattern('stateDeclaration', framework, {
|
|
492
|
+
name: stateName,
|
|
493
|
+
Name: stateName.charAt(0).toUpperCase() + stateName.slice(1),
|
|
494
|
+
type: stateType,
|
|
495
|
+
initial: initialValue
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
const update = (value: string) => getSyntaxPattern('stateUpdate', framework, {
|
|
499
|
+
name: stateName,
|
|
500
|
+
Name: stateName.charAt(0).toUpperCase() + stateName.slice(1),
|
|
501
|
+
value
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
const get = getSyntaxPattern('stateGetter', framework, { name: stateName });
|
|
505
|
+
|
|
506
|
+
return { declaration, update, get };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Generate event handler code for a framework
|
|
511
|
+
*
|
|
512
|
+
* @param framework - Target framework
|
|
513
|
+
* @param eventName - Name of event (e.g., 'click', 'submit')
|
|
514
|
+
* @param handlerName - Name of handler function
|
|
515
|
+
* @param params - Handler parameters
|
|
516
|
+
* @param body - Handler body code
|
|
517
|
+
* @returns Object with handler function and binding syntax
|
|
518
|
+
*/
|
|
519
|
+
export function generateEventCode(
|
|
520
|
+
framework: FrameworkTarget,
|
|
521
|
+
eventName: string,
|
|
522
|
+
handlerName: string,
|
|
523
|
+
params: string,
|
|
524
|
+
body: string
|
|
525
|
+
): { handler: string; binding: string } {
|
|
526
|
+
const handler = getSyntaxPattern('eventHandler', framework, {
|
|
527
|
+
name: handlerName,
|
|
528
|
+
Name: handlerName.charAt(0).toUpperCase() + handlerName.slice(1),
|
|
529
|
+
params,
|
|
530
|
+
body
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
const binding = getSyntaxPattern('eventBinding', framework, {
|
|
534
|
+
event: eventName,
|
|
535
|
+
handler: `handle${handlerName.charAt(0).toUpperCase() + handlerName.slice(1)}`
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
return { handler, binding };
|
|
539
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@specverse/engine-realize",
|
|
3
|
+
"version": "3.5.3",
|
|
4
|
+
"description": "SpecVerse realize engine \u2014 generate code from specifications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"clean": "rm -rf dist"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@specverse/types": "3.5.3",
|
|
14
|
+
"@specverse/engine-parser": "3.5.3",
|
|
15
|
+
"@specverse/engine-generators": "3.5.3",
|
|
16
|
+
"ajv": "^8.12.0",
|
|
17
|
+
"ajv-formats": "^2.1.1",
|
|
18
|
+
"glob": "^10.3.10",
|
|
19
|
+
"js-yaml": "^4.1.0",
|
|
20
|
+
"semver": "^7.7.3",
|
|
21
|
+
"yaml": "^2.8.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^20.8.0",
|
|
25
|
+
"@types/semver": "^7.5.0"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"libs",
|
|
30
|
+
"schema",
|
|
31
|
+
"assets"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"default": "./dist/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
}
|
|
42
|
+
}
|