@specverse/engines 4.1.5 → 4.1.7

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.
Files changed (122) hide show
  1. package/dist/libs/instance-factories/applications/templates/generic/backend-env-generator.js +22 -0
  2. package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +66 -0
  3. package/dist/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.js +54 -0
  4. package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +290 -0
  5. package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +530 -0
  6. package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +437 -0
  7. package/dist/libs/instance-factories/applications/templates/react/api-types-generator.js +146 -0
  8. package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +73 -0
  9. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +18 -0
  10. package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +99 -0
  11. package/dist/libs/instance-factories/applications/templates/react/gitignore-generator.js +35 -0
  12. package/dist/libs/instance-factories/applications/templates/react/index-css-generator.js +9 -0
  13. package/dist/libs/instance-factories/applications/templates/react/index-html-generator.js +23 -0
  14. package/dist/libs/instance-factories/applications/templates/react/main-tsx-generator.js +29 -0
  15. package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +49 -0
  16. package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +156 -0
  17. package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +935 -0
  18. package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +143 -0
  19. package/dist/libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.js +101 -0
  20. package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +50 -0
  21. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +646 -0
  22. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +65 -0
  23. package/dist/libs/instance-factories/applications/templates/react/tsconfig-generator.js +28 -0
  24. package/dist/libs/instance-factories/applications/templates/react/use-api-hooks-generator.js +132 -0
  25. package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +143 -0
  26. package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +143 -0
  27. package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +355 -0
  28. package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +91 -0
  29. package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +79 -0
  30. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +42 -0
  31. package/dist/libs/instance-factories/cli/templates/commander/cli-bin-wrapper-generator.js +11 -0
  32. package/dist/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +111 -0
  33. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +928 -0
  34. package/dist/libs/instance-factories/communication/templates/eventemitter/bus-generator.js +83 -0
  35. package/dist/libs/instance-factories/communication/templates/eventemitter/publisher-generator.js +91 -0
  36. package/dist/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.js +86 -0
  37. package/dist/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.js +93 -0
  38. package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +280 -0
  39. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +125 -0
  40. package/dist/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.js +25 -0
  41. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +371 -0
  42. package/dist/libs/instance-factories/orms/templates/prisma/services-generator.js +266 -0
  43. package/dist/libs/instance-factories/scaffolding/templates/generic/env-example-generator.js +51 -0
  44. package/dist/libs/instance-factories/scaffolding/templates/generic/env-generator.js +61 -0
  45. package/dist/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.js +59 -0
  46. package/dist/libs/instance-factories/scaffolding/templates/generic/package-json-generator.js +126 -0
  47. package/dist/libs/instance-factories/scaffolding/templates/generic/readme-generator.js +159 -0
  48. package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.js +56 -0
  49. package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js +37 -0
  50. package/dist/libs/instance-factories/sdks/templates/python/sdk-generator.js +29 -0
  51. package/dist/libs/instance-factories/sdks/templates/typescript/sdk-generator.js +28 -0
  52. package/dist/libs/instance-factories/services/templates/memory/generate-interpreter.js +14 -0
  53. package/dist/libs/instance-factories/services/templates/memory/step-conventions-memory.js +415 -0
  54. package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +177 -0
  55. package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +413 -0
  56. package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +243 -0
  57. package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +264 -0
  58. package/dist/libs/instance-factories/services/templates/shared-patterns.js +24 -0
  59. package/dist/libs/instance-factories/shared/path-resolver.js +59 -0
  60. package/dist/libs/instance-factories/storage/templates/mongodb/config-generator.js +13 -0
  61. package/dist/libs/instance-factories/storage/templates/mongodb/docker-generator.js +16 -0
  62. package/dist/libs/instance-factories/storage/templates/postgresql/config-generator.js +45 -0
  63. package/dist/libs/instance-factories/storage/templates/postgresql/docker-generator.js +46 -0
  64. package/dist/libs/instance-factories/storage/templates/redis/config-generator.js +14 -0
  65. package/dist/libs/instance-factories/storage/templates/redis/docker-generator.js +16 -0
  66. package/dist/libs/instance-factories/test-generation.js +145 -0
  67. package/dist/libs/instance-factories/testing/templates/vitest/tests-generator.js +30 -0
  68. package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +149 -0
  69. package/dist/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.js +232 -0
  70. package/dist/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.js +49 -0
  71. package/dist/libs/instance-factories/tools/templates/mcp/static/src/index.js +18 -0
  72. package/dist/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.js +0 -0
  73. package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.js +97 -0
  74. package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.js +64 -0
  75. package/dist/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.js +182 -0
  76. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.js +1210 -0
  77. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.js +172 -0
  78. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.js +240 -0
  79. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.js +147 -0
  80. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.js +281 -0
  81. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.js +409 -0
  82. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.js +414 -0
  83. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.js +467 -0
  84. package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.js +135 -0
  85. package/dist/libs/instance-factories/tools/templates/mcp/static/src/types/index.js +0 -0
  86. package/dist/libs/instance-factories/tools/templates/vscode/static/extension.js +965 -0
  87. package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +238 -0
  88. package/dist/libs/instance-factories/validation/templates/zod/validation-generator.js +25 -0
  89. package/dist/libs/instance-factories/views/index.js +48 -0
  90. package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +742 -0
  91. package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +824 -0
  92. package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +719 -0
  93. package/dist/libs/instance-factories/views/templates/react/app-generator.js +45 -0
  94. package/dist/libs/instance-factories/views/templates/react/components-generator.js +779 -0
  95. package/dist/libs/instance-factories/views/templates/react/forms-generator.js +285 -0
  96. package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +46 -0
  97. package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +111 -0
  98. package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +9 -0
  99. package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +23 -0
  100. package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +21 -0
  101. package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +299 -0
  102. package/dist/libs/instance-factories/views/templates/react/router-generator.js +136 -0
  103. package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +107 -0
  104. package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +179 -0
  105. package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +7 -0
  106. package/dist/libs/instance-factories/views/templates/react/types-generator.js +56 -0
  107. package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +27 -0
  108. package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +29 -0
  109. package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +261 -0
  110. package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +34 -0
  111. package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +800 -0
  112. package/dist/libs/instance-factories/views/templates/shared/base-generator.js +305 -0
  113. package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +517 -0
  114. package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
  115. package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +445 -0
  116. package/dist/libs/instance-factories/views/templates/shared/index.js +80 -0
  117. package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +210 -0
  118. package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +492 -0
  119. package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +321 -0
  120. package/dist/realize/index.js +36 -12
  121. package/dist/realize/index.js.map +1 -1
  122. package/package.json +3 -2
@@ -0,0 +1,99 @@
1
+ async function generate(context) {
2
+ return `/**
3
+ * Utility functions for form field handling
4
+ */
5
+
6
+ /**
7
+ * Check if a field should be hidden because it's auto-generated
8
+ */
9
+ export function isAutoGeneratedField(attrName: string, attrDef: any): boolean {
10
+ const typeStr = typeof attrDef === 'string' ? attrDef : attrDef?.type || '';
11
+
12
+ // Hide UUID id field
13
+ if (attrName === 'id' && typeStr.includes('UUID')) return true;
14
+
15
+ // Hide auto-generated DateTime fields
16
+ const autoDateFields = ['createdAt', 'updatedAt', 'joinedAt', 'publishedAt'];
17
+ if (autoDateFields.includes(attrName) && typeStr.includes('DateTime')) return true;
18
+
19
+ return false;
20
+ }
21
+
22
+ /**
23
+ * Check if a field is required
24
+ */
25
+ export function isFieldRequired(attrDef: any): boolean {
26
+ if (!attrDef) return false;
27
+ if (typeof attrDef === 'string') {
28
+ return attrDef.toLowerCase().includes('required');
29
+ }
30
+ return attrDef.required === true;
31
+ }
32
+
33
+ /**
34
+ * Get default value for a field based on its type
35
+ */
36
+ export function getFieldDefaultValue(attrDef: any): any {
37
+ if (!attrDef) return '';
38
+
39
+ const typeStr = typeof attrDef === 'string' ? attrDef : attrDef?.type || '';
40
+
41
+ // Check if schema has a default value
42
+ if (attrDef && typeof attrDef === 'object' && attrDef.default !== undefined) {
43
+ const defaultVal = attrDef.default;
44
+ // Parse string defaults to proper types
45
+ if (typeStr.toLowerCase().includes('bool')) {
46
+ return defaultVal === 'true' || defaultVal === true;
47
+ } else if (
48
+ typeStr.toLowerCase().includes('int') ||
49
+ typeStr.toLowerCase().includes('number')
50
+ ) {
51
+ return typeof defaultVal === 'number' ? defaultVal : parseInt(defaultVal) || 0;
52
+ } else if (typeStr.toLowerCase().includes('string')) {
53
+ // Remove surrounding quotes if present
54
+ return typeof defaultVal === 'string'
55
+ ? defaultVal.replace(/^"|"$/g, '')
56
+ : defaultVal;
57
+ } else {
58
+ return defaultVal;
59
+ }
60
+ }
61
+
62
+ // Otherwise use type-based defaults
63
+ if (typeStr.toLowerCase().includes('bool')) {
64
+ return false;
65
+ } else if (
66
+ typeStr.toLowerCase().includes('int') ||
67
+ typeStr.toLowerCase().includes('number')
68
+ ) {
69
+ return 0;
70
+ } else {
71
+ return '';
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Initialize form data from schema attributes
77
+ */
78
+ export function initializeFormData(
79
+ attributes: Record<string, any>,
80
+ options: { includeAutoGenerated?: boolean } = {}
81
+ ): Record<string, any> {
82
+ const data: Record<string, any> = {};
83
+
84
+ Object.entries(attributes).forEach(([attrName, attrDef]) => {
85
+ // Skip auto-generated fields unless explicitly included
86
+ if (!options.includeAutoGenerated && isAutoGeneratedField(attrName, attrDef)) {
87
+ return;
88
+ }
89
+
90
+ data[attrName] = getFieldDefaultValue(attrDef);
91
+ });
92
+
93
+ return data;
94
+ }
95
+ `;
96
+ }
97
+ export {
98
+ generate
99
+ };
@@ -0,0 +1,35 @@
1
+ function generateGitignore(context) {
2
+ return `# Logs
3
+ logs
4
+ *.log
5
+ npm-debug.log*
6
+ yarn-debug.log*
7
+ yarn-error.log*
8
+ pnpm-debug.log*
9
+ lerna-debug.log*
10
+
11
+ node_modules
12
+ dist
13
+ dist-ssr
14
+ *.local
15
+
16
+ # Editor directories and files
17
+ .vscode/*
18
+ !.vscode/extensions.json
19
+ .idea
20
+ .DS_Store
21
+ *.suo
22
+ *.ntvs*
23
+ *.njsproj
24
+ *.sln
25
+ *.sw?
26
+
27
+ # Environment variables
28
+ .env
29
+ .env.local
30
+ .env.*.local
31
+ `;
32
+ }
33
+ export {
34
+ generateGitignore as default
35
+ };
@@ -0,0 +1,9 @@
1
+ function generateIndexCss(context) {
2
+ return `@tailwind base;
3
+ @tailwind components;
4
+ @tailwind utilities;
5
+ `;
6
+ }
7
+ export {
8
+ generateIndexCss as default
9
+ };
@@ -0,0 +1,23 @@
1
+ function generateIndexHtml(context) {
2
+ const { spec } = context;
3
+ const appName = spec.metadata?.component || "SpecVerse App";
4
+ const description = spec.metadata?.description || "Generated by SpecVerse";
5
+ return `<!DOCTYPE html>
6
+ <html lang="en">
7
+ <head>
8
+ <meta charset="UTF-8" />
9
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
11
+ <meta name="description" content="${description}" />
12
+ <title>${appName}</title>
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ <script type="module" src="/src/main.tsx"></script>
17
+ </body>
18
+ </html>
19
+ `;
20
+ }
21
+ export {
22
+ generateIndexHtml as default
23
+ };
@@ -0,0 +1,29 @@
1
+ function generateMainTsx(context) {
2
+ return `import React from 'react';
3
+ import ReactDOM from 'react-dom/client';
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
+ import App from './App';
6
+ import './index.css';
7
+
8
+ // Create a client for React Query
9
+ const queryClient = new QueryClient({
10
+ defaultOptions: {
11
+ queries: {
12
+ staleTime: 1000 * 60 * 5, // 5 minutes
13
+ retry: 1,
14
+ },
15
+ },
16
+ });
17
+
18
+ ReactDOM.createRoot(document.getElementById('root')!).render(
19
+ <React.StrictMode>
20
+ <QueryClientProvider client={queryClient}>
21
+ <App />
22
+ </QueryClientProvider>
23
+ </React.StrictMode>,
24
+ );
25
+ `;
26
+ }
27
+ export {
28
+ generateMainTsx as default
29
+ };
@@ -0,0 +1,49 @@
1
+ function generatePackageJson(context) {
2
+ const { spec } = context;
3
+ const appName = spec.metadata?.component?.toLowerCase() || "frontend";
4
+ const version = spec.metadata?.version || "1.0.0";
5
+ const description = spec.metadata?.description || "Frontend application";
6
+ const pkg = {
7
+ name: `${appName}-frontend`,
8
+ version,
9
+ description,
10
+ private: true,
11
+ type: "module",
12
+ scripts: {
13
+ dev: "vite",
14
+ build: "tsc && vite build",
15
+ preview: "vite preview",
16
+ test: "echo 'No tests configured for frontend'",
17
+ lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
18
+ },
19
+ dependencies: {
20
+ "react": "^18.2.0",
21
+ "react-dom": "^18.2.0",
22
+ "react-router-dom": "^6.18.0",
23
+ "@tanstack/react-query": "^5.0.0",
24
+ "react-hook-form": "^7.48.0",
25
+ "zod": "^3.22.0",
26
+ "@hookform/resolvers": "^3.3.0",
27
+ "zustand": "^4.4.0"
28
+ },
29
+ devDependencies: {
30
+ "@types/react": "^18.2.0",
31
+ "@types/react-dom": "^18.2.0",
32
+ "@vitejs/plugin-react": "^4.2.0",
33
+ "autoprefixer": "^10.4.20",
34
+ "postcss": "^8.4.47",
35
+ "tailwindcss": "^3.4.13",
36
+ "typescript": "^5.2.0",
37
+ "vite": "^5.0.0",
38
+ "eslint": "^8.53.0",
39
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
40
+ "@typescript-eslint/parser": "^6.10.0",
41
+ "eslint-plugin-react-hooks": "^4.6.0",
42
+ "eslint-plugin-react-refresh": "^0.4.4"
43
+ }
44
+ };
45
+ return JSON.stringify(pkg, null, 2);
46
+ }
47
+ export {
48
+ generatePackageJson as default
49
+ };
@@ -0,0 +1,156 @@
1
+ import { readFileSync, existsSync } from "fs";
2
+ import { join, dirname } from "path";
3
+ import { fileURLToPath } from "url";
4
+ async function generate(context) {
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+ const possiblePaths = [
8
+ // PRIORITY 0: Same directory as this generator (source)
9
+ join(__dirname, "react-pattern-adapter.tsx"),
10
+ // PRIORITY 1: Bundled with package (in libs/ directory, from dist/)
11
+ join(__dirname, "../../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
12
+ // Up from dist to package root then into libs
13
+ join(__dirname, "../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
14
+ join(__dirname, "../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
15
+ // Development environment (specverse-app-demo sibling)
16
+ join(__dirname, "../../../../../../../specverse-app-demo/frontend-react/src/lib/react-pattern-adapter.tsx")
17
+ ];
18
+ let adapterSource = null;
19
+ let foundPath = null;
20
+ for (const path of possiblePaths) {
21
+ if (existsSync(path)) {
22
+ try {
23
+ adapterSource = readFileSync(path, "utf-8");
24
+ foundPath = path;
25
+ break;
26
+ } catch (error) {
27
+ }
28
+ }
29
+ }
30
+ if (adapterSource) {
31
+ return `/**
32
+ * ReactPatternAdapter - Pattern-Based View Rendering
33
+ *
34
+ * AUTO-GENERATED: Copied from specverse-app-demo
35
+ * Source: ${foundPath}
36
+ *
37
+ * This file provides pattern detection and React/Tailwind rendering for
38
+ * tech-independent composite patterns. It is bundled with generated code
39
+ * for standalone deployment.
40
+ *
41
+ * Imports COMPOSITE_VIEW_PATTERNS and types from @specverse/engine-realize
42
+ * which are exported from the published npm package.
43
+ *
44
+ * DO NOT EDIT: Changes will be overwritten on next generation.
45
+ * To customize, create a wrapper or modify the original source.
46
+ */
47
+
48
+ ${adapterSource}
49
+ `;
50
+ }
51
+ return `/**
52
+ * ReactPatternAdapter - Pattern-Based View Rendering (STUB)
53
+ *
54
+ * \u26A0\uFE0F WARNING: Could not locate react-pattern-adapter.tsx source file.
55
+ *
56
+ * This is a stub implementation that imports from @specverse/engine-realize.
57
+ * For full functionality, ensure specverse-app-demo is available at generation time.
58
+ *
59
+ * Attempted paths:
60
+ ${possiblePaths.map((p) => ` * - ${p}`).join("\n")}
61
+ */
62
+
63
+ import { useMemo } from 'react';
64
+ import {
65
+ COMPOSITE_VIEW_PATTERNS,
66
+ type CompositeViewPattern,
67
+ type CURVEDOperation
68
+ } from '@specverse/engines/realize';
69
+
70
+ /**
71
+ * React-specific protocol mapping for CURVED operations (STUB)
72
+ */
73
+ export const REACT_PROTOCOL_MAPPING: Record<CURVEDOperation, {
74
+ method: string;
75
+ pathPattern: string;
76
+ }> = {
77
+ create: {
78
+ method: 'POST',
79
+ pathPattern: '/api/{resource}'
80
+ },
81
+ update: {
82
+ method: 'PUT',
83
+ pathPattern: '/api/{resource}/{id}'
84
+ },
85
+ retrieve: {
86
+ method: 'GET',
87
+ pathPattern: '/api/{resource}/{id}'
88
+ },
89
+ retrieve_many: {
90
+ method: 'GET',
91
+ pathPattern: '/api/{resource}'
92
+ },
93
+ validate: {
94
+ method: 'POST',
95
+ pathPattern: '/api/{resource}/validate'
96
+ },
97
+ evolve: {
98
+ method: 'POST',
99
+ pathPattern: '/api/{resource}/{id}/evolve'
100
+ },
101
+ delete: {
102
+ method: 'DELETE',
103
+ pathPattern: '/api/{resource}/{id}'
104
+ }
105
+ };
106
+
107
+ /**
108
+ * Simple Tailwind adapter stub
109
+ */
110
+ const createStubTailwindAdapter = () => ({
111
+ renderComponent: (type: string, _props: any) => {
112
+ return \`<div class="p-2 text-gray-600">[\${type}]</div>\`;
113
+ }
114
+ });
115
+
116
+ /**
117
+ * Stub PatternAdapter that uses browser exports
118
+ */
119
+ export function usePatternAdapter() {
120
+ return useMemo(() => ({
121
+ tailwindAdapter: createStubTailwindAdapter(),
122
+
123
+ detectPattern(view: any): CompositeViewPattern | null {
124
+ const viewType = view.type?.toLowerCase();
125
+ const typeToPattern: Record<string, string> = {
126
+ 'form': 'form-view',
127
+ 'list': 'list-view',
128
+ 'detail': 'detail-view',
129
+ 'dashboard': 'dashboard-view'
130
+ };
131
+ const patternId = typeToPattern[viewType];
132
+ return patternId ? COMPOSITE_VIEW_PATTERNS[patternId] : null;
133
+ },
134
+
135
+ renderPattern(_context: any): string {
136
+ return \`
137
+ <div class="p-4 bg-yellow-50 border border-yellow-200 rounded">
138
+ <p class="text-yellow-800 font-semibold">\u26A0\uFE0F Pattern Adapter Stub</p>
139
+ <p class="text-sm text-yellow-700 mt-2">
140
+ Full ReactPatternAdapter could not be bundled.
141
+ Views will not render correctly.
142
+ </p>
143
+ </div>
144
+ \`;
145
+ }
146
+ }), []);
147
+ }
148
+
149
+ export { COMPOSITE_VIEW_PATTERNS } from '@specverse/engines/realize';
150
+
151
+ console.warn('\u26A0\uFE0F Using stub ReactPatternAdapter - full source file not found during generation');
152
+ `;
153
+ }
154
+ export {
155
+ generate
156
+ };