@revealui/mcp 0.1.0 → 0.1.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/LICENSE +22 -0
- package/LICENSE.commercial +111 -0
- package/README.md +3 -0
- package/dist/{packages/mcp/src/adapters → adapters}/db.d.ts +1 -1
- package/dist/adapters/db.d.ts.map +1 -0
- package/dist/adapters/db.js.map +1 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js.map +1 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js.map +1 -0
- package/dist/{packages/mcp/src/hypervisor.d.ts → hypervisor.d.ts} +56 -0
- package/dist/hypervisor.d.ts.map +1 -0
- package/dist/{packages/mcp/src/hypervisor.js → hypervisor.js} +209 -1
- package/dist/hypervisor.js.map +1 -0
- package/dist/{packages/mcp/src/index.d.ts → index.d.ts} +9 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/{packages/mcp/src/index.js → index.js} +8 -4
- package/dist/index.js.map +1 -0
- package/dist/{packages/mcp/src/servers → servers}/adapter.d.ts +11 -1
- package/dist/servers/adapter.d.ts.map +1 -0
- package/dist/{packages/mcp/src/servers → servers}/adapter.js +20 -4
- package/dist/servers/adapter.js.map +1 -0
- package/dist/servers/revealui-content.d.ts +21 -0
- package/dist/servers/revealui-content.d.ts.map +1 -0
- package/dist/servers/revealui-content.js +211 -0
- package/dist/servers/revealui-content.js.map +1 -0
- package/dist/servers/revealui-email.d.ts +18 -0
- package/dist/servers/revealui-email.d.ts.map +1 -0
- package/dist/servers/revealui-email.js +190 -0
- package/dist/servers/revealui-email.js.map +1 -0
- package/dist/servers/revealui-stripe.d.ts +19 -0
- package/dist/servers/revealui-stripe.d.ts.map +1 -0
- package/dist/servers/revealui-stripe.js +228 -0
- package/dist/servers/revealui-stripe.js.map +1 -0
- package/package.json +50 -11
- package/.env.example +0 -9
- package/MCP_MAINTENANCE.md +0 -265
- package/__tests__/crdt.integration.test.ts +0 -156
- package/configs/README.md +0 -77
- package/configs/claude-template.json +0 -54
- package/dist/packages/core/src/database/ssl-config.d.ts +0 -9
- package/dist/packages/core/src/database/ssl-config.d.ts.map +0 -1
- package/dist/packages/core/src/database/ssl-config.js +0 -8
- package/dist/packages/core/src/database/ssl-config.js.map +0 -1
- package/dist/packages/core/src/features.d.ts +0 -86
- package/dist/packages/core/src/features.d.ts.map +0 -1
- package/dist/packages/core/src/features.js +0 -93
- package/dist/packages/core/src/features.js.map +0 -1
- package/dist/packages/core/src/license.d.ts +0 -75
- package/dist/packages/core/src/license.d.ts.map +0 -1
- package/dist/packages/core/src/license.js +0 -174
- package/dist/packages/core/src/license.js.map +0 -1
- package/dist/packages/core/src/monitoring/alerts.d.ts +0 -118
- package/dist/packages/core/src/monitoring/alerts.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/alerts.js +0 -325
- package/dist/packages/core/src/monitoring/alerts.js.map +0 -1
- package/dist/packages/core/src/monitoring/cleanup-manager.d.ts +0 -71
- package/dist/packages/core/src/monitoring/cleanup-manager.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/cleanup-manager.js +0 -227
- package/dist/packages/core/src/monitoring/cleanup-manager.js.map +0 -1
- package/dist/packages/core/src/monitoring/health-monitor.d.ts +0 -22
- package/dist/packages/core/src/monitoring/health-monitor.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/health-monitor.js +0 -143
- package/dist/packages/core/src/monitoring/health-monitor.js.map +0 -1
- package/dist/packages/core/src/monitoring/index.d.ts +0 -14
- package/dist/packages/core/src/monitoring/index.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/index.js +0 -18
- package/dist/packages/core/src/monitoring/index.js.map +0 -1
- package/dist/packages/core/src/monitoring/process-registry.d.ts +0 -97
- package/dist/packages/core/src/monitoring/process-registry.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/process-registry.js +0 -223
- package/dist/packages/core/src/monitoring/process-registry.js.map +0 -1
- package/dist/packages/core/src/monitoring/types.d.ts +0 -231
- package/dist/packages/core/src/monitoring/types.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/types.js +0 -43
- package/dist/packages/core/src/monitoring/types.js.map +0 -1
- package/dist/packages/core/src/monitoring/zombie-detector.d.ts +0 -81
- package/dist/packages/core/src/monitoring/zombie-detector.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/zombie-detector.js +0 -232
- package/dist/packages/core/src/monitoring/zombie-detector.js.map +0 -1
- package/dist/packages/core/src/observability/logger.d.ts +0 -47
- package/dist/packages/core/src/observability/logger.d.ts.map +0 -1
- package/dist/packages/core/src/observability/logger.js +0 -141
- package/dist/packages/core/src/observability/logger.js.map +0 -1
- package/dist/packages/core/src/utils/logger-server.d.ts +0 -32
- package/dist/packages/core/src/utils/logger-server.d.ts.map +0 -1
- package/dist/packages/core/src/utils/logger-server.js +0 -69
- package/dist/packages/core/src/utils/logger-server.js.map +0 -1
- package/dist/packages/core/src/utils/request-context.d.ts +0 -143
- package/dist/packages/core/src/utils/request-context.d.ts.map +0 -1
- package/dist/packages/core/src/utils/request-context.js +0 -169
- package/dist/packages/core/src/utils/request-context.js.map +0 -1
- package/dist/packages/dev/src/code-validator/index.d.ts +0 -20
- package/dist/packages/dev/src/code-validator/index.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/index.js +0 -20
- package/dist/packages/dev/src/code-validator/index.js.map +0 -1
- package/dist/packages/dev/src/code-validator/types.d.ts +0 -67
- package/dist/packages/dev/src/code-validator/types.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/types.js +0 -7
- package/dist/packages/dev/src/code-validator/types.js.map +0 -1
- package/dist/packages/dev/src/code-validator/validator.d.ts +0 -48
- package/dist/packages/dev/src/code-validator/validator.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/validator.js +0 -176
- package/dist/packages/dev/src/code-validator/validator.js.map +0 -1
- package/dist/packages/mcp/src/adapters/db.d.ts.map +0 -1
- package/dist/packages/mcp/src/adapters/db.js.map +0 -1
- package/dist/packages/mcp/src/config/index.d.ts.map +0 -1
- package/dist/packages/mcp/src/config/index.js.map +0 -1
- package/dist/packages/mcp/src/contracts.d.ts.map +0 -1
- package/dist/packages/mcp/src/contracts.js.map +0 -1
- package/dist/packages/mcp/src/hypervisor.d.ts.map +0 -1
- package/dist/packages/mcp/src/hypervisor.js.map +0 -1
- package/dist/packages/mcp/src/index.d.ts.map +0 -1
- package/dist/packages/mcp/src/index.js.map +0 -1
- package/dist/packages/mcp/src/servers/adapter.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/adapter.js.map +0 -1
- package/dist/packages/mcp/src/servers/code-validator.d.ts +0 -24
- package/dist/packages/mcp/src/servers/code-validator.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/code-validator.js +0 -156
- package/dist/packages/mcp/src/servers/code-validator.js.map +0 -1
- package/dist/packages/mcp/src/servers/neon.d.ts +0 -11
- package/dist/packages/mcp/src/servers/neon.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/neon.js +0 -90
- package/dist/packages/mcp/src/servers/neon.js.map +0 -1
- package/dist/packages/mcp/src/servers/next-devtools.d.ts +0 -11
- package/dist/packages/mcp/src/servers/next-devtools.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/next-devtools.js +0 -215
- package/dist/packages/mcp/src/servers/next-devtools.js.map +0 -1
- package/dist/packages/mcp/src/servers/playwright.d.ts +0 -11
- package/dist/packages/mcp/src/servers/playwright.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/playwright.js +0 -68
- package/dist/packages/mcp/src/servers/playwright.js.map +0 -1
- package/dist/packages/mcp/src/servers/stripe.d.ts +0 -11
- package/dist/packages/mcp/src/servers/stripe.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/stripe.js +0 -86
- package/dist/packages/mcp/src/servers/stripe.js.map +0 -1
- package/dist/packages/mcp/src/servers/supabase.d.ts +0 -11
- package/dist/packages/mcp/src/servers/supabase.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/supabase.js +0 -144
- package/dist/packages/mcp/src/servers/supabase.js.map +0 -1
- package/dist/packages/mcp/src/servers/vercel.d.ts +0 -11
- package/dist/packages/mcp/src/servers/vercel.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/vercel.js +0 -87
- package/dist/packages/mcp/src/servers/vercel.js.map +0 -1
- package/dist/packages/mcp/src/servers/vultr-test.d.ts +0 -3
- package/dist/packages/mcp/src/servers/vultr-test.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/vultr-test.js +0 -82
- package/dist/packages/mcp/src/servers/vultr-test.js.map +0 -1
- package/dist/scripts/lib/analyzers/console-analyzer.d.ts +0 -188
- package/dist/scripts/lib/analyzers/console-analyzer.d.ts.map +0 -1
- package/dist/scripts/lib/analyzers/console-analyzer.js +0 -432
- package/dist/scripts/lib/analyzers/console-analyzer.js.map +0 -1
- package/dist/scripts/lib/analyzers/index.d.ts +0 -11
- package/dist/scripts/lib/analyzers/index.d.ts.map +0 -1
- package/dist/scripts/lib/analyzers/index.js +0 -11
- package/dist/scripts/lib/analyzers/index.js.map +0 -1
- package/dist/scripts/lib/args.d.ts +0 -104
- package/dist/scripts/lib/args.d.ts.map +0 -1
- package/dist/scripts/lib/args.js +0 -304
- package/dist/scripts/lib/args.js.map +0 -1
- package/dist/scripts/lib/cache.d.ts +0 -185
- package/dist/scripts/lib/cache.d.ts.map +0 -1
- package/dist/scripts/lib/cache.js +0 -390
- package/dist/scripts/lib/cache.js.map +0 -1
- package/dist/scripts/lib/cli/dispatch.d.ts +0 -116
- package/dist/scripts/lib/cli/dispatch.d.ts.map +0 -1
- package/dist/scripts/lib/cli/dispatch.js +0 -206
- package/dist/scripts/lib/cli/dispatch.js.map +0 -1
- package/dist/scripts/lib/cli/index.d.ts +0 -10
- package/dist/scripts/lib/cli/index.d.ts.map +0 -1
- package/dist/scripts/lib/cli/index.js +0 -10
- package/dist/scripts/lib/cli/index.js.map +0 -1
- package/dist/scripts/lib/database/ssl-config.d.ts +0 -26
- package/dist/scripts/lib/database/ssl-config.d.ts.map +0 -1
- package/dist/scripts/lib/database/ssl-config.js +0 -47
- package/dist/scripts/lib/database/ssl-config.js.map +0 -1
- package/dist/scripts/lib/errors.d.ts +0 -218
- package/dist/scripts/lib/errors.d.ts.map +0 -1
- package/dist/scripts/lib/errors.js +0 -543
- package/dist/scripts/lib/errors.js.map +0 -1
- package/dist/scripts/lib/exec.d.ts +0 -107
- package/dist/scripts/lib/exec.d.ts.map +0 -1
- package/dist/scripts/lib/exec.js +0 -232
- package/dist/scripts/lib/exec.js.map +0 -1
- package/dist/scripts/lib/index.d.ts +0 -50
- package/dist/scripts/lib/index.d.ts.map +0 -1
- package/dist/scripts/lib/index.js +0 -65
- package/dist/scripts/lib/index.js.map +0 -1
- package/dist/scripts/lib/logger.d.ts +0 -50
- package/dist/scripts/lib/logger.d.ts.map +0 -1
- package/dist/scripts/lib/logger.js +0 -159
- package/dist/scripts/lib/logger.js.map +0 -1
- package/dist/scripts/lib/output.d.ts +0 -149
- package/dist/scripts/lib/output.d.ts.map +0 -1
- package/dist/scripts/lib/output.js +0 -263
- package/dist/scripts/lib/output.js.map +0 -1
- package/dist/scripts/lib/parallel.d.ts +0 -164
- package/dist/scripts/lib/parallel.d.ts.map +0 -1
- package/dist/scripts/lib/parallel.js +0 -355
- package/dist/scripts/lib/parallel.js.map +0 -1
- package/dist/scripts/lib/paths.d.ts +0 -92
- package/dist/scripts/lib/paths.d.ts.map +0 -1
- package/dist/scripts/lib/paths.js +0 -171
- package/dist/scripts/lib/paths.js.map +0 -1
- package/dist/scripts/lib/state/adapters/memory.d.ts +0 -42
- package/dist/scripts/lib/state/adapters/memory.d.ts.map +0 -1
- package/dist/scripts/lib/state/adapters/memory.js +0 -110
- package/dist/scripts/lib/state/adapters/memory.js.map +0 -1
- package/dist/scripts/lib/state/adapters/pglite.d.ts +0 -46
- package/dist/scripts/lib/state/adapters/pglite.d.ts.map +0 -1
- package/dist/scripts/lib/state/adapters/pglite.js +0 -256
- package/dist/scripts/lib/state/adapters/pglite.js.map +0 -1
- package/dist/scripts/lib/state/index.d.ts +0 -16
- package/dist/scripts/lib/state/index.d.ts.map +0 -1
- package/dist/scripts/lib/state/index.js +0 -16
- package/dist/scripts/lib/state/index.js.map +0 -1
- package/dist/scripts/lib/state/types.d.ts +0 -111
- package/dist/scripts/lib/state/types.d.ts.map +0 -1
- package/dist/scripts/lib/state/types.js +0 -8
- package/dist/scripts/lib/state/types.js.map +0 -1
- package/dist/scripts/lib/state/workflow-state.d.ts +0 -110
- package/dist/scripts/lib/state/workflow-state.d.ts.map +0 -1
- package/dist/scripts/lib/state/workflow-state.js +0 -331
- package/dist/scripts/lib/state/workflow-state.js.map +0 -1
- package/dist/scripts/lib/telemetry.d.ts +0 -194
- package/dist/scripts/lib/telemetry.d.ts.map +0 -1
- package/dist/scripts/lib/telemetry.js +0 -394
- package/dist/scripts/lib/telemetry.js.map +0 -1
- package/dist/scripts/lib/utils.d.ts +0 -270
- package/dist/scripts/lib/utils.d.ts.map +0 -1
- package/dist/scripts/lib/utils.js +0 -473
- package/dist/scripts/lib/utils.js.map +0 -1
- package/dist/scripts/lib/validation/database.d.ts +0 -83
- package/dist/scripts/lib/validation/database.d.ts.map +0 -1
- package/dist/scripts/lib/validation/database.js +0 -199
- package/dist/scripts/lib/validation/database.js.map +0 -1
- package/dist/scripts/lib/validation/env.d.ts +0 -80
- package/dist/scripts/lib/validation/env.d.ts.map +0 -1
- package/dist/scripts/lib/validation/env.js +0 -246
- package/dist/scripts/lib/validation/env.js.map +0 -1
- package/dist/scripts/lib/validation/index.d.ts +0 -16
- package/dist/scripts/lib/validation/index.d.ts.map +0 -1
- package/dist/scripts/lib/validation/index.js +0 -16
- package/dist/scripts/lib/validation/index.js.map +0 -1
- package/dist/scripts/lib/validation/post-execution.d.ts +0 -74
- package/dist/scripts/lib/validation/post-execution.d.ts.map +0 -1
- package/dist/scripts/lib/validation/post-execution.js +0 -110
- package/dist/scripts/lib/validation/post-execution.js.map +0 -1
- package/dist/scripts/lib/validation/pre-execution.d.ts +0 -165
- package/dist/scripts/lib/validation/pre-execution.d.ts.map +0 -1
- package/dist/scripts/lib/validation/pre-execution.js +0 -466
- package/dist/scripts/lib/validation/pre-execution.js.map +0 -1
- package/dist/scripts/lib/validators/documentation-validator.d.ts +0 -242
- package/dist/scripts/lib/validators/documentation-validator.d.ts.map +0 -1
- package/dist/scripts/lib/validators/documentation-validator.js +0 -584
- package/dist/scripts/lib/validators/documentation-validator.js.map +0 -1
- package/dist/scripts/lib/validators/index.d.ts +0 -11
- package/dist/scripts/lib/validators/index.d.ts.map +0 -1
- package/dist/scripts/lib/validators/index.js +0 -11
- package/dist/scripts/lib/validators/index.js.map +0 -1
- package/docker-compose.yml +0 -46
- package/docs/INDEX.md +0 -88
- package/docs/README.md +0 -774
- package/docs/SETUP.md +0 -264
- package/docs/servers/code-validator.md +0 -586
- package/eslint.config.js +0 -7
- package/migrations/0001_add_crdt_columns.sql +0 -8
- package/migrations/0001_rollback.sql +0 -6
- package/migrations/005_performance_indexes.sql +0 -190
- package/migrations/backfill_crdt_meta.js +0 -45
- package/src/__tests__/hypervisor.test.ts +0 -212
- package/src/adapters/db.ts +0 -180
- package/src/config/config.json +0 -49
- package/src/config/index.ts +0 -30
- package/src/contracts.ts +0 -221
- package/src/hypervisor.ts +0 -464
- package/src/index.ts +0 -87
- package/src/servers/adapter.ts +0 -643
- package/src/servers/code-validator.ts +0 -188
- package/src/servers/neon.ts +0 -103
- package/src/servers/next-devtools.ts +0 -230
- package/src/servers/playwright.ts +0 -77
- package/src/servers/stripe.ts +0 -99
- package/src/servers/supabase.ts +0 -161
- package/src/servers/vercel.ts +0 -100
- package/src/servers/vultr-test.ts +0 -97
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -22
- /package/dist/{packages/mcp/src/adapters → adapters}/db.js +0 -0
- /package/dist/{packages/mcp/src/config → config}/index.d.ts +0 -0
- /package/dist/{packages/mcp/src/config → config}/index.js +0 -0
- /package/dist/{packages/mcp/src/contracts.d.ts → contracts.d.ts} +0 -0
- /package/dist/{packages/mcp/src/contracts.js → contracts.js} +0 -0
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified CLI Command Dispatcher
|
|
3
|
-
*
|
|
4
|
-
* Consolidates the two different dispatch patterns used across CLIs:
|
|
5
|
-
* 1. Import pattern: import(scriptPath) - Used by setup.ts
|
|
6
|
-
* 2. Subprocess pattern: execCommand('pnpm tsx', scriptPath) - Used by analyze.ts, maintain.ts
|
|
7
|
-
*
|
|
8
|
-
* Provides a single, consistent API for dispatching to script files.
|
|
9
|
-
*
|
|
10
|
-
* @dependencies
|
|
11
|
-
* - scripts/lib/args.ts - ParsedArgs type definition
|
|
12
|
-
* - scripts/lib/errors.ts - Error handling with ErrorCode
|
|
13
|
-
* - scripts/lib/exec.ts - Command execution for subprocess mode
|
|
14
|
-
*/
|
|
15
|
-
import { ErrorCode, notFound, ScriptError } from '../errors.js';
|
|
16
|
-
import { execCommand } from '../exec.js';
|
|
17
|
-
/**
|
|
18
|
-
* Determine if a script should run in subprocess mode
|
|
19
|
-
* Heuristics:
|
|
20
|
-
* - Scripts in 'workflows/' should run in subprocess (long-running)
|
|
21
|
-
* - Scripts with 'build' or 'deploy' in name should run in subprocess (resource-intensive)
|
|
22
|
-
* - Everything else can use import mode (faster)
|
|
23
|
-
*/
|
|
24
|
-
function shouldUseSubprocess(scriptPath) {
|
|
25
|
-
const path = scriptPath.toLowerCase();
|
|
26
|
-
// Long-running or resource-intensive tasks
|
|
27
|
-
if (path.includes('/workflows/'))
|
|
28
|
-
return true;
|
|
29
|
-
if (path.includes('build'))
|
|
30
|
-
return true;
|
|
31
|
-
if (path.includes('deploy'))
|
|
32
|
-
return true;
|
|
33
|
-
if (path.includes('release'))
|
|
34
|
-
return true;
|
|
35
|
-
// Short analysis/validation scripts can use import
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Dispatch a command using the import pattern
|
|
40
|
-
* Loads and executes the script in the same process
|
|
41
|
-
*/
|
|
42
|
-
async function dispatchImport(scriptPath, _options = {}) {
|
|
43
|
-
try {
|
|
44
|
-
// Import the script module
|
|
45
|
-
await import(scriptPath);
|
|
46
|
-
return {
|
|
47
|
-
success: true,
|
|
48
|
-
mode: 'import',
|
|
49
|
-
scriptPath,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
if (error.code === 'ERR_MODULE_NOT_FOUND') {
|
|
54
|
-
throw notFound('Script', scriptPath);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
success: false,
|
|
58
|
-
mode: 'import',
|
|
59
|
-
scriptPath,
|
|
60
|
-
error: error instanceof Error ? error.message : String(error),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Dispatch a command using the subprocess pattern
|
|
66
|
-
* Spawns a new process with pnpm tsx
|
|
67
|
-
*/
|
|
68
|
-
async function dispatchSubprocess(scriptPath, options = {}) {
|
|
69
|
-
const { cwd, args, env = {}, timeout, captureOutput = false } = options;
|
|
70
|
-
// Build command arguments
|
|
71
|
-
const cmdArgs = ['tsx', scriptPath];
|
|
72
|
-
// Add parsed arguments to command
|
|
73
|
-
if (args?.command)
|
|
74
|
-
cmdArgs.push(args.command);
|
|
75
|
-
// Add flags
|
|
76
|
-
if (args?.flags) {
|
|
77
|
-
Object.entries(args.flags).forEach(([key, value]) => {
|
|
78
|
-
if (typeof value === 'boolean' && value) {
|
|
79
|
-
cmdArgs.push(`--${key}`);
|
|
80
|
-
}
|
|
81
|
-
else if (value !== undefined && value !== false) {
|
|
82
|
-
cmdArgs.push(`--${key}`, String(value));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
// Add positional arguments
|
|
87
|
-
if (args?.positional && args.positional.length > 0) {
|
|
88
|
-
cmdArgs.push(...args.positional.map(String));
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const result = await execCommand('pnpm', cmdArgs, {
|
|
92
|
-
cwd,
|
|
93
|
-
env,
|
|
94
|
-
timeout,
|
|
95
|
-
});
|
|
96
|
-
return {
|
|
97
|
-
success: result.success,
|
|
98
|
-
mode: 'subprocess',
|
|
99
|
-
scriptPath,
|
|
100
|
-
output: captureOutput ? result.stdout : undefined,
|
|
101
|
-
error: result.success ? undefined : result.stderr,
|
|
102
|
-
exitCode: result.exitCode,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
return {
|
|
107
|
-
success: false,
|
|
108
|
-
mode: 'subprocess',
|
|
109
|
-
scriptPath,
|
|
110
|
-
error: error instanceof Error ? error.message : String(error),
|
|
111
|
-
exitCode: ErrorCode.EXECUTION_ERROR,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Dispatch a CLI command to its implementation script
|
|
117
|
-
*
|
|
118
|
-
* This is the main entry point for command dispatch. It automatically
|
|
119
|
-
* chooses the best dispatch mode based on the script characteristics.
|
|
120
|
-
*
|
|
121
|
-
* @param scriptPath - Absolute or relative path to the script file
|
|
122
|
-
* @param options - Dispatch options
|
|
123
|
-
* @returns Result of the dispatch operation
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* // Auto mode (recommended)
|
|
128
|
-
* const result = await dispatchCommand('scripts/analyze/console-usage.ts')
|
|
129
|
-
*
|
|
130
|
-
* // Force subprocess mode
|
|
131
|
-
* const result = await dispatchCommand('scripts/build/production.ts', {
|
|
132
|
-
* mode: 'subprocess',
|
|
133
|
-
* args: { flags: { verbose: true } }
|
|
134
|
-
* })
|
|
135
|
-
*
|
|
136
|
-
* // Force import mode (faster for quick scripts)
|
|
137
|
-
* const result = await dispatchCommand('scripts/validate/types.ts', {
|
|
138
|
-
* mode: 'import'
|
|
139
|
-
* })
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
export async function dispatchCommand(scriptPath, options = {}) {
|
|
143
|
-
const { mode = 'auto' } = options;
|
|
144
|
-
// Determine dispatch mode
|
|
145
|
-
let actualMode;
|
|
146
|
-
if (mode === 'auto') {
|
|
147
|
-
actualMode = shouldUseSubprocess(scriptPath) ? 'subprocess' : 'import';
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
actualMode = mode;
|
|
151
|
-
}
|
|
152
|
-
// Dispatch based on mode
|
|
153
|
-
if (actualMode === 'import') {
|
|
154
|
-
return dispatchImport(scriptPath, options);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
return dispatchSubprocess(scriptPath, options);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Helper to dispatch and throw on failure.
|
|
162
|
-
* Useful when you want to fail fast on command errors instead of checking results.
|
|
163
|
-
*
|
|
164
|
-
* @param scriptPath - Absolute or relative path to the script file
|
|
165
|
-
* @param options - Dispatch options
|
|
166
|
-
* @throws {ScriptError} If the command fails
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* import { ErrorCode } from '../errors.js'
|
|
171
|
-
*
|
|
172
|
-
* // Will throw if validation fails
|
|
173
|
-
* await dispatchOrThrow('scripts/validate/typescript.ts')
|
|
174
|
-
*
|
|
175
|
-
* // Catch and handle errors
|
|
176
|
-
* try {
|
|
177
|
-
* await dispatchOrThrow('scripts/build/production.ts', {
|
|
178
|
-
* mode: 'subprocess',
|
|
179
|
-
* timeout: 60000
|
|
180
|
-
* })
|
|
181
|
-
* console.log('Build succeeded!')
|
|
182
|
-
* } catch (error) {
|
|
183
|
-
* console.error('Build failed:', error.message)
|
|
184
|
-
* process.exit(ErrorCode.EXECUTION_ERROR)
|
|
185
|
-
* }
|
|
186
|
-
* ```
|
|
187
|
-
*
|
|
188
|
-
* @see {@link dispatchCommand} for non-throwing version
|
|
189
|
-
*/
|
|
190
|
-
export async function dispatchOrThrow(scriptPath, options = {}) {
|
|
191
|
-
const result = await dispatchCommand(scriptPath, options);
|
|
192
|
-
if (!result.success) {
|
|
193
|
-
throw new ScriptError(result.error || `Command failed: ${scriptPath}`, result.exitCode || ErrorCode.EXECUTION_ERROR, {
|
|
194
|
-
context: {
|
|
195
|
-
scriptPath: result.scriptPath,
|
|
196
|
-
mode: result.mode,
|
|
197
|
-
},
|
|
198
|
-
suggestions: [
|
|
199
|
-
'Check the script path is correct',
|
|
200
|
-
'Verify the script has no syntax errors',
|
|
201
|
-
'Review the error message above for details',
|
|
202
|
-
],
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=dispatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../../../../scripts/lib/cli/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA8CxC;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,UAAkB;IAC7C,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;IAErC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAA;IAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IACvC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAA;IAEzC,mDAAmD;IACnD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,cAAc,CAC3B,U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3
|
-
*
|
|
4
|
-
* Exports CLI-related utilities including unified command dispatcher.
|
|
5
|
-
*
|
|
6
|
-
* @dependencies
|
|
7
|
-
* - scripts/lib/cli/dispatch.ts - Command dispatch implementation
|
|
8
|
-
*/
|
|
9
|
-
export { type DispatchMode, type DispatchOptions, type DispatchResult, dispatchCommand, dispatchOrThrow, } from './dispatch.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../scripts/lib/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI Utilities Module
|
|
3
|
-
*
|
|
4
|
-
* Exports CLI-related utilities including unified command dispatcher.
|
|
5
|
-
*
|
|
6
|
-
* @dependencies
|
|
7
|
-
* - scripts/lib/cli/dispatch.ts - Command dispatch implementation
|
|
8
|
-
*/
|
|
9
|
-
export { dispatchCommand, dispatchOrThrow, } from './dispatch.js';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../scripts/lib/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSL Configuration Utility for Scripts
|
|
3
|
-
*
|
|
4
|
-
* Provides centralized SSL configuration for PostgreSQL connections based on
|
|
5
|
-
* connection string sslmode parameter and environment variables.
|
|
6
|
-
*
|
|
7
|
-
* Note: This is a copy of the core SSL config utility for use in scripts.
|
|
8
|
-
* Scripts cannot import from @revealui/core due to build dependencies.
|
|
9
|
-
*
|
|
10
|
-
* @module ssl-config
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* PostgreSQL SSL configuration options
|
|
14
|
-
*/
|
|
15
|
-
export interface SSLConfig {
|
|
16
|
-
rejectUnauthorized: boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Determines the appropriate SSL configuration for a PostgreSQL connection
|
|
20
|
-
* based on the connection string's sslmode parameter.
|
|
21
|
-
*
|
|
22
|
-
* @param connectionString - PostgreSQL connection string (may include sslmode parameter)
|
|
23
|
-
* @returns SSL configuration object or false to disable SSL, or undefined for default behavior
|
|
24
|
-
*/
|
|
25
|
-
export declare function getSSLConfig(connectionString: string): SSLConfig | false | undefined;
|
|
26
|
-
//# sourceMappingURL=ssl-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssl-config.d.ts","sourceRoot":"","sources":["../../../../../../scripts/lib/database/ssl-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,kBAAkB,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CA8BpF"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSL Configuration Utility for Scripts
|
|
3
|
-
*
|
|
4
|
-
* Provides centralized SSL configuration for PostgreSQL connections based on
|
|
5
|
-
* connection string sslmode parameter and environment variables.
|
|
6
|
-
*
|
|
7
|
-
* Note: This is a copy of the core SSL config utility for use in scripts.
|
|
8
|
-
* Scripts cannot import from @revealui/core due to build dependencies.
|
|
9
|
-
*
|
|
10
|
-
* @module ssl-config
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Determines the appropriate SSL configuration for a PostgreSQL connection
|
|
14
|
-
* based on the connection string's sslmode parameter.
|
|
15
|
-
*
|
|
16
|
-
* @param connectionString - PostgreSQL connection string (may include sslmode parameter)
|
|
17
|
-
* @returns SSL configuration object or false to disable SSL, or undefined for default behavior
|
|
18
|
-
*/
|
|
19
|
-
export function getSSLConfig(connectionString) {
|
|
20
|
-
try {
|
|
21
|
-
// Parse connection string
|
|
22
|
-
const url = new URL(connectionString);
|
|
23
|
-
const sslmode = url.searchParams.get('sslmode');
|
|
24
|
-
// No SSL if sslmode is explicitly disabled
|
|
25
|
-
if (sslmode === 'disable') {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
// No sslmode specified - return undefined to use driver defaults
|
|
29
|
-
if (!sslmode) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
// Environment override for local development with self-signed certificates
|
|
33
|
-
// This should ONLY be used in development environments
|
|
34
|
-
if (process.env.DATABASE_SSL_REJECT_UNAUTHORIZED === 'false') {
|
|
35
|
-
return { rejectUnauthorized: false };
|
|
36
|
-
}
|
|
37
|
-
// Default: verify certificates (security best practice)
|
|
38
|
-
// Handles: require, verify-full, verify-ca, prefer
|
|
39
|
-
return { rejectUnauthorized: true };
|
|
40
|
-
}
|
|
41
|
-
catch (_error) {
|
|
42
|
-
// If URL parsing fails, assume local connection - return undefined for defaults
|
|
43
|
-
// Silently fallback to driver defaults for invalid connection strings
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=ssl-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssl-config.js","sourceRoot":"","sources":["../../../../../../scripts/lib/database/ssl-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,gBAAwB;IACnD,IAAI,CAAC;QACH,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAE/C,2CAA2C;QAC3C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,iEAAiE;QACjE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,2EAA2E;QAC3E,uDAAuD;QACvD,IAAI,OAAO,CAAC,GAAG,CAAC,gCAAgC,KAAK,OAAO,EAAE,CAAC;YAC7D,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QAED,wDAAwD;QACxD,mDAAmD;QACnD,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;IACrC,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,gFAAgF;QAChF,sEAAsE;QACtE,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified Error System
|
|
3
|
-
*
|
|
4
|
-
* Consolidates error-handler.ts and errors.ts into a single comprehensive error system.
|
|
5
|
-
* Provides standardized error codes, enhanced error messages, suggestions, and recovery options.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Typed error codes with exit code mapping
|
|
9
|
-
* - Contextual error enhancement with suggestions
|
|
10
|
-
* - Pattern-based suggestion generation
|
|
11
|
-
* - Documentation link generation
|
|
12
|
-
* - Error recovery helpers
|
|
13
|
-
* - Retry logic with enhanced errors
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { ScriptError, ErrorCode } from './errors.js'
|
|
18
|
-
*
|
|
19
|
-
* // Throw typed errors with suggestions
|
|
20
|
-
* throw new ScriptError('Database connection failed', ErrorCode.EXECUTION_ERROR, {
|
|
21
|
-
* suggestions: ['Check if database is running', 'Verify DATABASE_URL'],
|
|
22
|
-
* docsUrl: 'https://docs.revealui.dev/database',
|
|
23
|
-
* })
|
|
24
|
-
*
|
|
25
|
-
* // Use factory functions with auto-suggestions
|
|
26
|
-
* throw notFound('Workflow', id) // Auto-generates helpful suggestions
|
|
27
|
-
*
|
|
28
|
-
* // Handle errors with proper exit codes
|
|
29
|
-
* try {
|
|
30
|
-
* await runCommand()
|
|
31
|
-
* } catch (error) {
|
|
32
|
-
* if (error instanceof ScriptError) {
|
|
33
|
-
* console.error(error.format()) // Pretty formatted error
|
|
34
|
-
* process.exit(error.code)
|
|
35
|
-
* }
|
|
36
|
-
* process.exit(ErrorCode.GENERAL_ERROR)
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @dependencies
|
|
41
|
-
* - None (foundational module with no external dependencies)
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* Standardized exit codes for CLI scripts.
|
|
45
|
-
*
|
|
46
|
-
* These follow Unix conventions where 0 = success, non-zero = failure,
|
|
47
|
-
* with specific codes for different failure types.
|
|
48
|
-
*/
|
|
49
|
-
export declare enum ErrorCode {
|
|
50
|
-
/** Operation completed successfully */
|
|
51
|
-
SUCCESS = 0,
|
|
52
|
-
/** General/unknown error */
|
|
53
|
-
GENERAL_ERROR = 1,
|
|
54
|
-
/** Configuration error (missing env var, bad config file) */
|
|
55
|
-
CONFIG_ERROR = 2,
|
|
56
|
-
/** Execution error (command failed, external service error) */
|
|
57
|
-
EXECUTION_ERROR = 3,
|
|
58
|
-
/** Validation error (bad input, invalid arguments) */
|
|
59
|
-
VALIDATION_ERROR = 4,
|
|
60
|
-
/** Timeout error (operation took too long) */
|
|
61
|
-
TIMEOUT_ERROR = 5,
|
|
62
|
-
/** Resource not found (workflow, file, etc.) */
|
|
63
|
-
NOT_FOUND = 6,
|
|
64
|
-
/** Permission denied (auth failed, insufficient permissions) */
|
|
65
|
-
PERMISSION_DENIED = 7,
|
|
66
|
-
/** Conflict error (resource already exists, concurrent modification) */
|
|
67
|
-
CONFLICT = 8,
|
|
68
|
-
/** Operation cancelled by user */
|
|
69
|
-
CANCELLED = 9,
|
|
70
|
-
/** Dependency error (missing tool, wrong version) */
|
|
71
|
-
DEPENDENCY_ERROR = 10,
|
|
72
|
-
/** Network error (connection failed, DNS resolution) */
|
|
73
|
-
NETWORK_ERROR = 11,
|
|
74
|
-
/** Rate limit exceeded */
|
|
75
|
-
RATE_LIMITED = 12,
|
|
76
|
-
/** Invalid state (operation not allowed in current state) */
|
|
77
|
-
INVALID_STATE = 13
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Human-readable descriptions for error codes
|
|
81
|
-
*/
|
|
82
|
-
export declare const ErrorCodeDescriptions: Record<ErrorCode, string>;
|
|
83
|
-
/**
|
|
84
|
-
* Enhanced error options
|
|
85
|
-
*/
|
|
86
|
-
export interface EnhancedErrorOptions {
|
|
87
|
-
/** Additional error details/context */
|
|
88
|
-
context?: Record<string, unknown>;
|
|
89
|
-
/** Suggested fixes for the error */
|
|
90
|
-
suggestions?: string[];
|
|
91
|
-
/** Documentation URL for more information */
|
|
92
|
-
docsUrl?: string;
|
|
93
|
-
/** Recovery steps that can be attempted */
|
|
94
|
-
recovery?: string[];
|
|
95
|
-
/** Whether this error is recoverable */
|
|
96
|
-
recoverable?: boolean;
|
|
97
|
-
/** What operation was being performed */
|
|
98
|
-
operation?: string;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Unified error class for CLI scripts
|
|
102
|
-
*
|
|
103
|
-
* Includes error codes, contextual information, suggestions, and recovery options.
|
|
104
|
-
* Merges functionality from both ScriptError and EnhancedError.
|
|
105
|
-
*/
|
|
106
|
-
export declare class ScriptError extends Error {
|
|
107
|
-
/** Error code (maps to exit code) */
|
|
108
|
-
readonly code: ErrorCode;
|
|
109
|
-
/** Additional error details/context */
|
|
110
|
-
readonly context?: Record<string, unknown>;
|
|
111
|
-
/** Error code as string (for JSON output) */
|
|
112
|
-
readonly codeString: string;
|
|
113
|
-
/** Suggested fixes for this error */
|
|
114
|
-
readonly suggestions?: string[];
|
|
115
|
-
/** Documentation URL */
|
|
116
|
-
readonly docsUrl?: string;
|
|
117
|
-
/** Recovery steps */
|
|
118
|
-
readonly recovery?: string[];
|
|
119
|
-
/** Whether this error is recoverable */
|
|
120
|
-
readonly recoverable?: boolean;
|
|
121
|
-
/** Operation being performed when error occurred */
|
|
122
|
-
readonly operation?: string;
|
|
123
|
-
/** Timestamp when error was created */
|
|
124
|
-
readonly timestamp: number;
|
|
125
|
-
/** Original error if this wraps another error */
|
|
126
|
-
readonly originalError?: Error;
|
|
127
|
-
get details(): Record<string, unknown> | undefined;
|
|
128
|
-
constructor(message: string, code?: ErrorCode, options?: EnhancedErrorOptions | Record<string, unknown>);
|
|
129
|
-
/**
|
|
130
|
-
* Convert to JSON-serializable object
|
|
131
|
-
*/
|
|
132
|
-
toJSON(): {
|
|
133
|
-
code: string;
|
|
134
|
-
exitCode: number;
|
|
135
|
-
message: string;
|
|
136
|
-
context?: Record<string, unknown>;
|
|
137
|
-
suggestions?: string[];
|
|
138
|
-
docsUrl?: string;
|
|
139
|
-
recovery?: string[];
|
|
140
|
-
timestamp: number;
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Get the human-readable description for this error's code
|
|
144
|
-
*/
|
|
145
|
-
getCodeDescription(): string;
|
|
146
|
-
/**
|
|
147
|
-
* Format error for display with colors and suggestions
|
|
148
|
-
*/
|
|
149
|
-
format(verbose?: boolean): string;
|
|
150
|
-
/**
|
|
151
|
-
* Print error to console with formatting
|
|
152
|
-
*/
|
|
153
|
-
print(verbose?: boolean): void;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Create a not found error
|
|
157
|
-
*/
|
|
158
|
-
export declare function notFound(resource: string, id?: string, details?: Record<string, unknown>): ScriptError;
|
|
159
|
-
/**
|
|
160
|
-
* Create a validation error
|
|
161
|
-
*/
|
|
162
|
-
export declare function validationError(message: string, field?: string, details?: Record<string, unknown>): ScriptError;
|
|
163
|
-
/**
|
|
164
|
-
* Create a config error
|
|
165
|
-
*/
|
|
166
|
-
export declare function configError(message: string, envVar?: string, details?: Record<string, unknown>): ScriptError;
|
|
167
|
-
/**
|
|
168
|
-
* Create a timeout error
|
|
169
|
-
*/
|
|
170
|
-
export declare function timeoutError(operation: string, timeoutMs: number, details?: Record<string, unknown>): ScriptError;
|
|
171
|
-
/**
|
|
172
|
-
* Create an execution error
|
|
173
|
-
*/
|
|
174
|
-
export declare function executionError(command: string, exitCode?: number, stderr?: string, details?: Record<string, unknown>): ScriptError;
|
|
175
|
-
/**
|
|
176
|
-
* Create a conflict error
|
|
177
|
-
*/
|
|
178
|
-
export declare function conflictError(resource: string, reason?: string, details?: Record<string, unknown>): ScriptError;
|
|
179
|
-
/**
|
|
180
|
-
* Create a permission denied error
|
|
181
|
-
*/
|
|
182
|
-
export declare function permissionDenied(action: string, resource?: string, details?: Record<string, unknown>): ScriptError;
|
|
183
|
-
/**
|
|
184
|
-
* Create an invalid state error
|
|
185
|
-
*/
|
|
186
|
-
export declare function invalidState(operation: string, currentState: string, expectedStates?: string[], details?: Record<string, unknown>): ScriptError;
|
|
187
|
-
/**
|
|
188
|
-
* Check if an error is a ScriptError
|
|
189
|
-
*/
|
|
190
|
-
export declare function isScriptError(error: unknown): error is ScriptError;
|
|
191
|
-
/**
|
|
192
|
-
* Get the exit code for an error
|
|
193
|
-
*/
|
|
194
|
-
export declare function getExitCode(error: unknown): number;
|
|
195
|
-
/**
|
|
196
|
-
* Wrap an unknown error as a ScriptError
|
|
197
|
-
*/
|
|
198
|
-
export declare function wrapError(error: unknown, code?: ErrorCode): ScriptError;
|
|
199
|
-
/**
|
|
200
|
-
* Run a function and wrap any errors
|
|
201
|
-
*/
|
|
202
|
-
export declare function withErrorHandling<T>(fn: () => Promise<T>, errorCode?: ErrorCode): Promise<T>;
|
|
203
|
-
/**
|
|
204
|
-
* Retry a function with enhanced error handling
|
|
205
|
-
*/
|
|
206
|
-
export declare function retryWithEnhancedErrors<T>(fn: () => Promise<T>, options?: {
|
|
207
|
-
retries?: number;
|
|
208
|
-
delay?: number;
|
|
209
|
-
operation?: string;
|
|
210
|
-
context?: Record<string, unknown>;
|
|
211
|
-
}): Promise<T>;
|
|
212
|
-
/**
|
|
213
|
-
* Wrap a function with enhanced error handling
|
|
214
|
-
*/
|
|
215
|
-
export declare function withEnhancedErrors<T extends (...args: any[]) => any>(fn: T, options?: Omit<EnhancedErrorOptions, 'context'> & {
|
|
216
|
-
code?: ErrorCode;
|
|
217
|
-
}): T;
|
|
218
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../scripts/lib/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAMH;;;;;GAKG;AACH,oBAAY,SAAS;IACnB,uCAAuC;IACvC,OAAO,IAAI;IAEX,4BAA4B;IAC5B,aAAa,IAAI;IAEjB,6DAA6D;IAC7D,YAAY,IAAI;IAEhB,+DAA+D;IAC/D,eAAe,IAAI;IAEnB,sDAAsD;IACtD,gBAAgB,IAAI;IAEpB,8CAA8C;IAC9C,aAAa,IAAI;IAEjB,gDAAgD;IAChD,SAAS,IAAI;IAEb,gEAAgE;IAChE,iBAAiB,IAAI;IAErB,wEAAwE;IACxE,QAAQ,IAAI;IAEZ,kCAAkC;IAClC,SAAS,IAAI;IAEb,qDAAqD;IACrD,gBAAgB,KAAK;IAErB,wDAAwD;IACxD,aAAa,KAAK;IAElB,0BAA0B;IAC1B,YAAY,KAAK;IAEjB,6DAA6D;IAC7D,aAAa,KAAK;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAe3D,CAAA;AAMD;;GAEG;AACH,MAAM,WAAW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