@friggframework/devtools 2.0.0--canary.398.dd443c7.0 → 2.0.0--canary.402.d2f4ae6.0

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 (164) hide show
  1. package/frigg-cli/.eslintrc.js +141 -0
  2. package/frigg-cli/__tests__/jest.config.js +102 -0
  3. package/frigg-cli/__tests__/unit/commands/build.test.js +483 -0
  4. package/frigg-cli/__tests__/unit/commands/install.test.js +418 -0
  5. package/frigg-cli/__tests__/unit/commands/ui.test.js +592 -0
  6. package/frigg-cli/__tests__/utils/command-tester.js +170 -0
  7. package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
  8. package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
  9. package/frigg-cli/__tests__/utils/test-setup.js +286 -0
  10. package/frigg-cli/generate-command/__tests__/generate-command.test.js +312 -0
  11. package/frigg-cli/generate-command/azure-generator.js +43 -0
  12. package/frigg-cli/generate-command/gcp-generator.js +47 -0
  13. package/frigg-cli/generate-command/index.js +332 -0
  14. package/frigg-cli/generate-command/terraform-generator.js +555 -0
  15. package/frigg-cli/index.js +19 -1
  16. package/frigg-cli/init-command/backend-first-handler.js +756 -0
  17. package/frigg-cli/init-command/index.js +93 -0
  18. package/frigg-cli/init-command/template-handler.js +143 -0
  19. package/frigg-cli/package.json +51 -0
  20. package/frigg-cli/test/init-command.test.js +180 -0
  21. package/frigg-cli/test/npm-registry.test.js +319 -0
  22. package/frigg-cli/ui-command/index.js +154 -0
  23. package/frigg-cli/utils/app-resolver.js +319 -0
  24. package/frigg-cli/utils/backend-path.js +25 -0
  25. package/frigg-cli/utils/npm-registry.js +167 -0
  26. package/frigg-cli/utils/process-manager.js +199 -0
  27. package/frigg-cli/utils/repo-detection.js +405 -0
  28. package/infrastructure/serverless-template.js +177 -292
  29. package/management-ui/.eslintrc.js +22 -0
  30. package/management-ui/README.md +203 -0
  31. package/management-ui/components.json +21 -0
  32. package/management-ui/docs/phase2-integration-guide.md +320 -0
  33. package/management-ui/{dist/index.html → index.html} +1 -2
  34. package/management-ui/package-lock.json +16517 -0
  35. package/management-ui/package.json +76 -0
  36. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +302 -0
  37. package/management-ui/postcss.config.js +6 -0
  38. package/management-ui/server/api/backend.js +256 -0
  39. package/management-ui/server/api/cli.js +315 -0
  40. package/management-ui/server/api/codegen.js +663 -0
  41. package/management-ui/server/api/connections.js +857 -0
  42. package/management-ui/server/api/discovery.js +185 -0
  43. package/management-ui/server/api/environment/index.js +1 -0
  44. package/management-ui/server/api/environment/router.js +378 -0
  45. package/management-ui/server/api/environment.js +328 -0
  46. package/management-ui/server/api/integrations.js +876 -0
  47. package/management-ui/server/api/logs.js +248 -0
  48. package/management-ui/server/api/monitoring.js +282 -0
  49. package/management-ui/server/api/open-ide.js +31 -0
  50. package/management-ui/server/api/project.js +1029 -0
  51. package/management-ui/server/api/users/sessions.js +371 -0
  52. package/management-ui/server/api/users/simulation.js +254 -0
  53. package/management-ui/server/api/users.js +362 -0
  54. package/management-ui/server/api-contract.md +275 -0
  55. package/management-ui/server/index.js +873 -0
  56. package/management-ui/server/middleware/errorHandler.js +93 -0
  57. package/management-ui/server/middleware/security.js +32 -0
  58. package/management-ui/server/processManager.js +296 -0
  59. package/management-ui/server/server.js +346 -0
  60. package/management-ui/server/services/aws-monitor.js +413 -0
  61. package/management-ui/server/services/npm-registry.js +347 -0
  62. package/management-ui/server/services/template-engine.js +538 -0
  63. package/management-ui/server/utils/cliIntegration.js +220 -0
  64. package/management-ui/server/utils/environment/auditLogger.js +471 -0
  65. package/management-ui/server/utils/environment/awsParameterStore.js +264 -0
  66. package/management-ui/server/utils/environment/encryption.js +278 -0
  67. package/management-ui/server/utils/environment/envFileManager.js +286 -0
  68. package/management-ui/server/utils/import-commonjs.js +28 -0
  69. package/management-ui/server/utils/response.js +83 -0
  70. package/management-ui/server/websocket/handler.js +325 -0
  71. package/management-ui/src/App.jsx +109 -0
  72. package/management-ui/src/components/AppRouter.jsx +65 -0
  73. package/management-ui/src/components/Button.jsx +70 -0
  74. package/management-ui/src/components/Card.jsx +97 -0
  75. package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
  76. package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
  77. package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
  78. package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
  79. package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
  80. package/management-ui/src/components/ErrorBoundary.jsx +73 -0
  81. package/management-ui/src/components/IntegrationCard.jsx +481 -0
  82. package/management-ui/src/components/IntegrationCardEnhanced.jsx +770 -0
  83. package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
  84. package/management-ui/src/components/IntegrationStatus.jsx +336 -0
  85. package/management-ui/src/components/Layout.jsx +716 -0
  86. package/management-ui/src/components/LoadingSpinner.jsx +113 -0
  87. package/management-ui/src/components/RepositoryPicker.jsx +248 -0
  88. package/management-ui/src/components/SessionMonitor.jsx +350 -0
  89. package/management-ui/src/components/StatusBadge.jsx +208 -0
  90. package/management-ui/src/components/UserContextSwitcher.jsx +212 -0
  91. package/management-ui/src/components/UserSimulation.jsx +327 -0
  92. package/management-ui/src/components/Welcome.jsx +434 -0
  93. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
  94. package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
  95. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
  96. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
  97. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
  98. package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
  99. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
  100. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
  101. package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
  102. package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
  103. package/management-ui/src/components/codegen/index.js +10 -0
  104. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
  105. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
  106. package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
  107. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
  108. package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
  109. package/management-ui/src/components/connections/index.js +5 -0
  110. package/management-ui/src/components/index.js +21 -0
  111. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
  112. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
  113. package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
  114. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
  115. package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
  116. package/management-ui/src/components/monitoring/index.js +6 -0
  117. package/management-ui/src/components/monitoring/monitoring.css +218 -0
  118. package/management-ui/src/components/theme-provider.jsx +52 -0
  119. package/management-ui/src/components/theme-toggle.jsx +39 -0
  120. package/management-ui/src/components/ui/badge.tsx +36 -0
  121. package/management-ui/src/components/ui/button.test.jsx +56 -0
  122. package/management-ui/src/components/ui/button.tsx +57 -0
  123. package/management-ui/src/components/ui/card.tsx +76 -0
  124. package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
  125. package/management-ui/src/components/ui/select.tsx +157 -0
  126. package/management-ui/src/components/ui/skeleton.jsx +15 -0
  127. package/management-ui/src/hooks/useFrigg.jsx +601 -0
  128. package/management-ui/src/hooks/useSocket.jsx +58 -0
  129. package/management-ui/src/index.css +193 -0
  130. package/management-ui/src/lib/utils.ts +6 -0
  131. package/management-ui/src/main.jsx +10 -0
  132. package/management-ui/src/pages/CodeGeneration.jsx +14 -0
  133. package/management-ui/src/pages/Connections.jsx +252 -0
  134. package/management-ui/src/pages/ConnectionsEnhanced.jsx +633 -0
  135. package/management-ui/src/pages/Dashboard.jsx +311 -0
  136. package/management-ui/src/pages/Environment.jsx +314 -0
  137. package/management-ui/src/pages/IntegrationConfigure.jsx +669 -0
  138. package/management-ui/src/pages/IntegrationDiscovery.jsx +567 -0
  139. package/management-ui/src/pages/IntegrationTest.jsx +742 -0
  140. package/management-ui/src/pages/Integrations.jsx +253 -0
  141. package/management-ui/src/pages/Monitoring.jsx +17 -0
  142. package/management-ui/src/pages/Simulation.jsx +155 -0
  143. package/management-ui/src/pages/Users.jsx +492 -0
  144. package/management-ui/src/services/api.js +41 -0
  145. package/management-ui/src/services/apiModuleService.js +193 -0
  146. package/management-ui/src/services/websocket-handlers.js +120 -0
  147. package/management-ui/src/test/api/project.test.js +273 -0
  148. package/management-ui/src/test/components/Welcome.test.jsx +378 -0
  149. package/management-ui/src/test/mocks/server.js +178 -0
  150. package/management-ui/src/test/setup.js +61 -0
  151. package/management-ui/src/test/utils/test-utils.jsx +134 -0
  152. package/management-ui/src/utils/repository.js +98 -0
  153. package/management-ui/src/utils/repository.test.js +118 -0
  154. package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
  155. package/management-ui/tailwind.config.js +63 -0
  156. package/management-ui/tsconfig.json +37 -0
  157. package/management-ui/tsconfig.node.json +10 -0
  158. package/management-ui/vite.config.js +26 -0
  159. package/management-ui/vitest.config.js +38 -0
  160. package/package.json +5 -5
  161. package/management-ui/dist/assets/index-BA21WgFa.js +0 -1221
  162. package/management-ui/dist/assets/index-CbM64Oba.js +0 -1221
  163. package/management-ui/dist/assets/index-CkvseXTC.css +0 -1
  164. /package/management-ui/{dist/assets/FriggLogo-B7Xx8ZW1.svg → src/assets/FriggLogo.svg} +0 -0
@@ -0,0 +1,286 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { parse, stringify } from 'dotenv';
4
+
5
+ class EnvFileManager {
6
+ constructor(projectRoot) {
7
+ this.projectRoot = projectRoot;
8
+ this.environments = {
9
+ local: '.env.local',
10
+ staging: '.env.staging',
11
+ production: '.env.production'
12
+ };
13
+ }
14
+
15
+ /**
16
+ * Read environment variables from a specific environment file
17
+ */
18
+ async readEnvFile(environment = 'local') {
19
+ const fileName = this.environments[environment] || '.env';
20
+ const filePath = path.join(this.projectRoot, fileName);
21
+
22
+ try {
23
+ const content = await fs.readFile(filePath, 'utf-8');
24
+ const parsed = parse(content);
25
+
26
+ // Convert to our variable format
27
+ const variables = Object.entries(parsed).map(([key, value]) => ({
28
+ id: `${environment}-${key}`,
29
+ key,
30
+ value,
31
+ description: this.extractDescription(content, key),
32
+ isSecret: this.isSecretVariable(key),
33
+ environment
34
+ }));
35
+
36
+ return variables;
37
+ } catch (error) {
38
+ if (error.code === 'ENOENT') {
39
+ // File doesn't exist, return empty array
40
+ return [];
41
+ }
42
+ throw error;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Write environment variables to a specific environment file
48
+ */
49
+ async writeEnvFile(environment, variables) {
50
+ const fileName = this.environments[environment] || '.env';
51
+ const filePath = path.join(this.projectRoot, fileName);
52
+
53
+ // Create backup first
54
+ await this.createBackup(filePath);
55
+
56
+ // Build the content
57
+ let content = '';
58
+ const sortedVars = [...variables].sort((a, b) => a.key.localeCompare(b.key));
59
+
60
+ for (const variable of sortedVars) {
61
+ // Add description as comment if exists
62
+ if (variable.description) {
63
+ content += `# ${variable.description}\n`;
64
+ }
65
+
66
+ // Add the variable
67
+ const value = this.escapeValue(variable.value);
68
+ content += `${variable.key}=${value}\n`;
69
+
70
+ // Add extra newline between variables for readability
71
+ content += '\n';
72
+ }
73
+
74
+ // Write the file
75
+ await fs.writeFile(filePath, content.trim());
76
+
77
+ return { success: true, path: filePath };
78
+ }
79
+
80
+ /**
81
+ * Create a backup of the env file before modifying
82
+ */
83
+ async createBackup(filePath) {
84
+ try {
85
+ const backupPath = `${filePath}.backup.${Date.now()}`;
86
+ await fs.copyFile(filePath, backupPath);
87
+
88
+ // Keep only last 5 backups
89
+ await this.cleanupOldBackups(filePath);
90
+ } catch (error) {
91
+ // Ignore if file doesn't exist
92
+ if (error.code !== 'ENOENT') {
93
+ throw error;
94
+ }
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Clean up old backup files
100
+ */
101
+ async cleanupOldBackups(filePath) {
102
+ const dir = path.dirname(filePath);
103
+ const basename = path.basename(filePath);
104
+ const backupPattern = new RegExp(`^${basename}\\.backup\\.\\d+$`);
105
+
106
+ const files = await fs.readdir(dir);
107
+ const backups = files
108
+ .filter(f => backupPattern.test(f))
109
+ .map(f => ({
110
+ name: f,
111
+ path: path.join(dir, f)
112
+ }));
113
+
114
+ // Sort by timestamp (newest first)
115
+ backups.sort((a, b) => {
116
+ const timeA = parseInt(a.name.split('.').pop());
117
+ const timeB = parseInt(b.name.split('.').pop());
118
+ return timeB - timeA;
119
+ });
120
+
121
+ // Delete old backups
122
+ for (let i = 5; i < backups.length; i++) {
123
+ await fs.unlink(backups[i].path);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Extract description comment for a variable from the file content
129
+ */
130
+ extractDescription(content, key) {
131
+ const lines = content.split('\n');
132
+ for (let i = 0; i < lines.length; i++) {
133
+ const line = lines[i].trim();
134
+ if (line.startsWith(`${key}=`)) {
135
+ // Check previous line for comment
136
+ if (i > 0 && lines[i - 1].trim().startsWith('#')) {
137
+ return lines[i - 1].trim().substring(1).trim();
138
+ }
139
+ break;
140
+ }
141
+ }
142
+ return '';
143
+ }
144
+
145
+ /**
146
+ * Determine if a variable should be treated as secret based on its name
147
+ */
148
+ isSecretVariable(key) {
149
+ const secretPatterns = [
150
+ /password/i,
151
+ /secret/i,
152
+ /key/i,
153
+ /token/i,
154
+ /credential/i,
155
+ /auth/i,
156
+ /private/i,
157
+ /api_key/i
158
+ ];
159
+
160
+ return secretPatterns.some(pattern => pattern.test(key));
161
+ }
162
+
163
+ /**
164
+ * Escape value for .env file format
165
+ */
166
+ escapeValue(value) {
167
+ // If value contains spaces, newlines, or quotes, wrap in quotes
168
+ if (/[\s"'`]/.test(value) || value === '') {
169
+ // Escape any double quotes in the value
170
+ const escaped = value.replace(/"/g, '\\"');
171
+ return `"${escaped}"`;
172
+ }
173
+ return value;
174
+ }
175
+
176
+ /**
177
+ * Validate environment variables
178
+ */
179
+ validateVariables(variables) {
180
+ const errors = [];
181
+ const seen = new Set();
182
+
183
+ for (const variable of variables) {
184
+ // Check for duplicates
185
+ if (seen.has(variable.key)) {
186
+ errors.push({
187
+ id: variable.id,
188
+ error: `Duplicate key: ${variable.key}`
189
+ });
190
+ }
191
+ seen.add(variable.key);
192
+
193
+ // Validate key format
194
+ if (!/^[A-Z_][A-Z0-9_]*$/i.test(variable.key)) {
195
+ errors.push({
196
+ id: variable.id,
197
+ error: `Invalid key format: ${variable.key}`
198
+ });
199
+ }
200
+
201
+ // Type-specific validation
202
+ if (variable.key.endsWith('_PORT') && variable.value) {
203
+ const port = parseInt(variable.value);
204
+ if (isNaN(port) || port < 1 || port > 65535) {
205
+ errors.push({
206
+ id: variable.id,
207
+ error: `Invalid port value: ${variable.value}`
208
+ });
209
+ }
210
+ }
211
+
212
+ if (variable.key.endsWith('_URL') && variable.value) {
213
+ try {
214
+ new URL(variable.value);
215
+ } catch {
216
+ errors.push({
217
+ id: variable.id,
218
+ error: `Invalid URL format: ${variable.value}`
219
+ });
220
+ }
221
+ }
222
+ }
223
+
224
+ return errors;
225
+ }
226
+
227
+ /**
228
+ * Merge variables from multiple sources (e.g., file and AWS)
229
+ */
230
+ mergeVariables(fileVars, externalVars, preferExternal = false) {
231
+ const merged = new Map();
232
+
233
+ // Add file variables first
234
+ for (const v of fileVars) {
235
+ merged.set(v.key, v);
236
+ }
237
+
238
+ // Merge or override with external variables
239
+ for (const v of externalVars) {
240
+ if (preferExternal || !merged.has(v.key)) {
241
+ merged.set(v.key, v);
242
+ }
243
+ }
244
+
245
+ return Array.from(merged.values());
246
+ }
247
+
248
+ /**
249
+ * Get all environments and their variables
250
+ */
251
+ async getAllEnvironments() {
252
+ const result = {};
253
+
254
+ for (const [env, _] of Object.entries(this.environments)) {
255
+ try {
256
+ result[env] = await this.readEnvFile(env);
257
+ } catch (error) {
258
+ console.error(`Error reading ${env} environment:`, error);
259
+ result[env] = [];
260
+ }
261
+ }
262
+
263
+ return result;
264
+ }
265
+
266
+ /**
267
+ * Copy variables from one environment to another
268
+ */
269
+ async copyEnvironment(source, target, excludeSecrets = true) {
270
+ const sourceVars = await this.readEnvFile(source);
271
+
272
+ const targetVars = sourceVars
273
+ .filter(v => !excludeSecrets || !v.isSecret)
274
+ .map(v => ({
275
+ ...v,
276
+ environment: target,
277
+ id: `${target}-${v.key}`
278
+ }));
279
+
280
+ await this.writeEnvFile(target, targetVars);
281
+
282
+ return targetVars;
283
+ }
284
+ }
285
+
286
+ export default EnvFileManager;
@@ -0,0 +1,28 @@
1
+ import { createRequire } from 'module';
2
+ import { pathToFileURL } from 'url';
3
+
4
+ /**
5
+ * Helper function to import CommonJS modules in an ES module environment
6
+ * @param {string} modulePath - The path to the CommonJS module
7
+ * @returns {Promise<any>} The imported module
8
+ */
9
+ export async function importCommonJS(modulePath) {
10
+ try {
11
+ // First try dynamic import (works if the module supports ESM)
12
+ const moduleURL = pathToFileURL(modulePath).href;
13
+ return await import(moduleURL);
14
+ } catch (error) {
15
+ // If dynamic import fails, try using createRequire
16
+ try {
17
+ const require = createRequire(import.meta.url);
18
+ const module = require(modulePath);
19
+ // Wrap in an object to match ESM import structure
20
+ return { default: module, ...module };
21
+ } catch (requireError) {
22
+ console.error('Failed to import module:', modulePath);
23
+ console.error('Dynamic import error:', error.message);
24
+ console.error('Require error:', requireError.message);
25
+ throw new Error(`Unable to import module at ${modulePath}`);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Utility functions for creating standardized API responses
3
+ * Implements the API contract defined in api-contract.md
4
+ */
5
+
6
+ /**
7
+ * Create a standardized success response
8
+ * @param {any} data - The response data
9
+ * @param {string} message - Optional success message
10
+ * @returns {object} Standardized success response
11
+ */
12
+ export function createStandardResponse(data, message = null) {
13
+ return {
14
+ status: 'success',
15
+ data,
16
+ message,
17
+ timestamp: new Date().toISOString()
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Create a standardized error response
23
+ * @param {string} code - Error code
24
+ * @param {string} message - Error message
25
+ * @param {any} details - Optional error details
26
+ * @returns {object} Standardized error response
27
+ */
28
+ export function createErrorResponse(code, message, details = null) {
29
+ return {
30
+ status: 'error',
31
+ error: {
32
+ code,
33
+ message,
34
+ details
35
+ },
36
+ timestamp: new Date().toISOString()
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Error codes for different types of errors
42
+ */
43
+ export const ERROR_CODES = {
44
+ // General errors
45
+ INVALID_REQUEST: 'INVALID_REQUEST',
46
+ UNAUTHORIZED: 'UNAUTHORIZED',
47
+ FORBIDDEN: 'FORBIDDEN',
48
+ NOT_FOUND: 'NOT_FOUND',
49
+ INTERNAL_ERROR: 'INTERNAL_ERROR',
50
+
51
+ // Project errors
52
+ PROJECT_NOT_FOUND: 'PROJECT_NOT_FOUND',
53
+ PROJECT_ALREADY_RUNNING: 'PROJECT_ALREADY_RUNNING',
54
+ PROJECT_NOT_RUNNING: 'PROJECT_NOT_RUNNING',
55
+ PROJECT_START_FAILED: 'PROJECT_START_FAILED',
56
+ PROJECT_STOP_FAILED: 'PROJECT_STOP_FAILED',
57
+
58
+ // Integration errors
59
+ INTEGRATION_NOT_FOUND: 'INTEGRATION_NOT_FOUND',
60
+ INTEGRATION_ALREADY_INSTALLED: 'INTEGRATION_ALREADY_INSTALLED',
61
+ INTEGRATION_INSTALL_FAILED: 'INTEGRATION_INSTALL_FAILED',
62
+ INTEGRATION_CONFIG_INVALID: 'INTEGRATION_CONFIG_INVALID',
63
+
64
+ // Environment errors
65
+ ENV_READ_FAILED: 'ENV_READ_FAILED',
66
+ ENV_WRITE_FAILED: 'ENV_WRITE_FAILED',
67
+ ENV_SYNC_FAILED: 'ENV_SYNC_FAILED',
68
+
69
+ // CLI errors
70
+ CLI_COMMAND_FAILED: 'CLI_COMMAND_FAILED',
71
+ CLI_COMMAND_NOT_FOUND: 'CLI_COMMAND_NOT_FOUND'
72
+ }
73
+
74
+ /**
75
+ * Wrap async route handlers to catch errors automatically
76
+ * @param {Function} fn - Async route handler function
77
+ * @returns {Function} Wrapped function with error handling
78
+ */
79
+ export function asyncHandler(fn) {
80
+ return (req, res, next) => {
81
+ Promise.resolve(fn(req, res, next)).catch(next)
82
+ }
83
+ }