@lushly-dev/violet-afd 0.0.0-stage → 0.3.0-preview.1
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 +21 -0
- package/README.md +29 -2
- package/dist/commands/analyze/compare.d.ts +36 -0
- package/dist/commands/analyze/compare.d.ts.map +1 -0
- package/dist/commands/analyze/compare.js +196 -0
- package/dist/commands/analyze/compare.js.map +1 -0
- package/dist/commands/analyze/compliance.d.ts +41 -0
- package/dist/commands/analyze/compliance.d.ts.map +1 -0
- package/dist/commands/analyze/compliance.js +166 -0
- package/dist/commands/analyze/compliance.js.map +1 -0
- package/dist/commands/analyze/deviations.d.ts +30 -0
- package/dist/commands/analyze/deviations.d.ts.map +1 -0
- package/dist/commands/analyze/deviations.js +201 -0
- package/dist/commands/analyze/deviations.js.map +1 -0
- package/dist/commands/analyze/health.d.ts +211 -0
- package/dist/commands/analyze/health.d.ts.map +1 -0
- package/dist/commands/analyze/health.js +697 -0
- package/dist/commands/analyze/health.js.map +1 -0
- package/dist/commands/analyze/index.d.ts +15 -0
- package/dist/commands/analyze/index.d.ts.map +1 -0
- package/dist/commands/analyze/index.js +31 -0
- package/dist/commands/analyze/index.js.map +1 -0
- package/dist/commands/analyze/snapshot.d.ts +64 -0
- package/dist/commands/analyze/snapshot.d.ts.map +1 -0
- package/dist/commands/analyze/snapshot.js +126 -0
- package/dist/commands/analyze/snapshot.js.map +1 -0
- package/dist/commands/analyze/trends.d.ts +82 -0
- package/dist/commands/analyze/trends.d.ts.map +1 -0
- package/dist/commands/analyze/trends.js +312 -0
- package/dist/commands/analyze/trends.js.map +1 -0
- package/dist/commands/analyze/violations.d.ts +84 -0
- package/dist/commands/analyze/violations.d.ts.map +1 -0
- package/dist/commands/analyze/violations.js +158 -0
- package/dist/commands/analyze/violations.js.map +1 -0
- package/dist/commands/apikeys/check.d.ts +39 -0
- package/dist/commands/apikeys/check.d.ts.map +1 -0
- package/dist/commands/apikeys/check.js +61 -0
- package/dist/commands/apikeys/check.js.map +1 -0
- package/dist/commands/apikeys/create.d.ts +36 -0
- package/dist/commands/apikeys/create.d.ts.map +1 -0
- package/dist/commands/apikeys/create.js +116 -0
- package/dist/commands/apikeys/create.js.map +1 -0
- package/dist/commands/apikeys/index.d.ts +15 -0
- package/dist/commands/apikeys/index.d.ts.map +1 -0
- package/dist/commands/apikeys/index.js +21 -0
- package/dist/commands/apikeys/index.js.map +1 -0
- package/dist/commands/apikeys/keys.d.ts +79 -0
- package/dist/commands/apikeys/keys.d.ts.map +1 -0
- package/dist/commands/apikeys/keys.js +239 -0
- package/dist/commands/apikeys/keys.js.map +1 -0
- package/dist/commands/audit/index.d.ts +11 -0
- package/dist/commands/audit/index.d.ts.map +1 -0
- package/dist/commands/audit/index.js +15 -0
- package/dist/commands/audit/index.js.map +1 -0
- package/dist/commands/audit/list.d.ts +101 -0
- package/dist/commands/audit/list.d.ts.map +1 -0
- package/dist/commands/audit/list.js +230 -0
- package/dist/commands/audit/list.js.map +1 -0
- package/dist/commands/changes/impact.d.ts +477 -0
- package/dist/commands/changes/impact.d.ts.map +1 -0
- package/dist/commands/changes/impact.js +541 -0
- package/dist/commands/changes/impact.js.map +1 -0
- package/dist/commands/changes/index.d.ts +11 -0
- package/dist/commands/changes/index.d.ts.map +1 -0
- package/dist/commands/changes/index.js +15 -0
- package/dist/commands/changes/index.js.map +1 -0
- package/dist/commands/constraints/index.d.ts +11 -0
- package/dist/commands/constraints/index.d.ts.map +1 -0
- package/dist/commands/constraints/index.js +19 -0
- package/dist/commands/constraints/index.js.map +1 -0
- package/dist/commands/constraints/list.d.ts +52 -0
- package/dist/commands/constraints/list.d.ts.map +1 -0
- package/dist/commands/constraints/list.js +103 -0
- package/dist/commands/constraints/list.js.map +1 -0
- package/dist/commands/constraints/set.d.ts +50 -0
- package/dist/commands/constraints/set.d.ts.map +1 -0
- package/dist/commands/constraints/set.js +137 -0
- package/dist/commands/constraints/set.js.map +1 -0
- package/dist/commands/constraints/validate.d.ts +38 -0
- package/dist/commands/constraints/validate.d.ts.map +1 -0
- package/dist/commands/constraints/validate.js +164 -0
- package/dist/commands/constraints/validate.js.map +1 -0
- package/dist/commands/docs/generator.d.ts +77 -0
- package/dist/commands/docs/generator.d.ts.map +1 -0
- package/dist/commands/docs/generator.js +256 -0
- package/dist/commands/docs/generator.js.map +1 -0
- package/dist/commands/docs/index.d.ts +6 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +6 -0
- package/dist/commands/docs/index.js.map +1 -0
- package/dist/commands/export/export.d.ts +64 -0
- package/dist/commands/export/export.d.ts.map +1 -0
- package/dist/commands/export/export.js +193 -0
- package/dist/commands/export/export.js.map +1 -0
- package/dist/commands/export/index.d.ts +9 -0
- package/dist/commands/export/index.d.ts.map +1 -0
- package/dist/commands/export/index.js +13 -0
- package/dist/commands/export/index.js.map +1 -0
- package/dist/commands/import/flatten.d.ts +30 -0
- package/dist/commands/import/flatten.d.ts.map +1 -0
- package/dist/commands/import/flatten.js +121 -0
- package/dist/commands/import/flatten.js.map +1 -0
- package/dist/commands/import/index.d.ts +11 -0
- package/dist/commands/import/index.d.ts.map +1 -0
- package/dist/commands/import/index.js +19 -0
- package/dist/commands/import/index.js.map +1 -0
- package/dist/commands/import/json.d.ts +40 -0
- package/dist/commands/import/json.d.ts.map +1 -0
- package/dist/commands/import/json.js +209 -0
- package/dist/commands/import/json.js.map +1 -0
- package/dist/commands/import/tree.d.ts +39 -0
- package/dist/commands/import/tree.d.ts.map +1 -0
- package/dist/commands/import/tree.js +247 -0
- package/dist/commands/import/tree.js.map +1 -0
- package/dist/commands/import/validate.d.ts +53 -0
- package/dist/commands/import/validate.d.ts.map +1 -0
- package/dist/commands/import/validate.js +201 -0
- package/dist/commands/import/validate.js.map +1 -0
- package/dist/commands/index.d.ts +21 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +21 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/json-schema.d.ts +21 -0
- package/dist/commands/json-schema.d.ts.map +1 -0
- package/dist/commands/json-schema.js +41 -0
- package/dist/commands/json-schema.js.map +1 -0
- package/dist/commands/node/create.d.ts +80 -0
- package/dist/commands/node/create.d.ts.map +1 -0
- package/dist/commands/node/create.js +174 -0
- package/dist/commands/node/create.js.map +1 -0
- package/dist/commands/node/delete.d.ts +28 -0
- package/dist/commands/node/delete.d.ts.map +1 -0
- package/dist/commands/node/delete.js +134 -0
- package/dist/commands/node/delete.js.map +1 -0
- package/dist/commands/node/deprecation.d.ts +23 -0
- package/dist/commands/node/deprecation.d.ts.map +1 -0
- package/dist/commands/node/deprecation.js +59 -0
- package/dist/commands/node/deprecation.js.map +1 -0
- package/dist/commands/node/get.d.ts +79 -0
- package/dist/commands/node/get.d.ts.map +1 -0
- package/dist/commands/node/get.js +106 -0
- package/dist/commands/node/get.js.map +1 -0
- package/dist/commands/node/graph.d.ts +138 -0
- package/dist/commands/node/graph.d.ts.map +1 -0
- package/dist/commands/node/graph.js +285 -0
- package/dist/commands/node/graph.js.map +1 -0
- package/dist/commands/node/index.d.ts +17 -0
- package/dist/commands/node/index.d.ts.map +1 -0
- package/dist/commands/node/index.js +31 -0
- package/dist/commands/node/index.js.map +1 -0
- package/dist/commands/node/list.d.ts +74 -0
- package/dist/commands/node/list.d.ts.map +1 -0
- package/dist/commands/node/list.js +130 -0
- package/dist/commands/node/list.js.map +1 -0
- package/dist/commands/node/operations.d.ts +35 -0
- package/dist/commands/node/operations.d.ts.map +1 -0
- package/dist/commands/node/operations.js +66 -0
- package/dist/commands/node/operations.js.map +1 -0
- package/dist/commands/node/scope.d.ts +14 -0
- package/dist/commands/node/scope.d.ts.map +1 -0
- package/dist/commands/node/scope.js +49 -0
- package/dist/commands/node/scope.js.map +1 -0
- package/dist/commands/node/update.d.ts +84 -0
- package/dist/commands/node/update.d.ts.map +1 -0
- package/dist/commands/node/update.js +229 -0
- package/dist/commands/node/update.js.map +1 -0
- package/dist/commands/registry.d.ts +126 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +141 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/specimen/get.d.ts +47 -0
- package/dist/commands/specimen/get.d.ts.map +1 -0
- package/dist/commands/specimen/get.js +124 -0
- package/dist/commands/specimen/get.js.map +1 -0
- package/dist/commands/specimen/index.d.ts +10 -0
- package/dist/commands/specimen/index.d.ts.map +1 -0
- package/dist/commands/specimen/index.js +16 -0
- package/dist/commands/specimen/index.js.map +1 -0
- package/dist/commands/specimen/set.d.ts +31 -0
- package/dist/commands/specimen/set.d.ts.map +1 -0
- package/dist/commands/specimen/set.js +198 -0
- package/dist/commands/specimen/set.js.map +1 -0
- package/dist/commands/specimen/shared.d.ts +15 -0
- package/dist/commands/specimen/shared.d.ts.map +1 -0
- package/dist/commands/specimen/shared.js +26 -0
- package/dist/commands/specimen/shared.js.map +1 -0
- package/dist/commands/system/doctor.d.ts +48 -0
- package/dist/commands/system/doctor.d.ts.map +1 -0
- package/dist/commands/system/doctor.js +224 -0
- package/dist/commands/system/doctor.js.map +1 -0
- package/dist/commands/system/index.d.ts +12 -0
- package/dist/commands/system/index.d.ts.map +1 -0
- package/dist/commands/system/index.js +17 -0
- package/dist/commands/system/index.js.map +1 -0
- package/dist/commands/system/validate.d.ts +47 -0
- package/dist/commands/system/validate.d.ts.map +1 -0
- package/dist/commands/system/validate.js +245 -0
- package/dist/commands/system/validate.js.map +1 -0
- package/dist/commands/token/add.d.ts +94 -0
- package/dist/commands/token/add.d.ts.map +1 -0
- package/dist/commands/token/add.js +162 -0
- package/dist/commands/token/add.js.map +1 -0
- package/dist/commands/token/catalog.d.ts +69 -0
- package/dist/commands/token/catalog.d.ts.map +1 -0
- package/dist/commands/token/catalog.js +175 -0
- package/dist/commands/token/catalog.js.map +1 -0
- package/dist/commands/token/compare.d.ts +140 -0
- package/dist/commands/token/compare.d.ts.map +1 -0
- package/dist/commands/token/compare.js +207 -0
- package/dist/commands/token/compare.js.map +1 -0
- package/dist/commands/token/copy.d.ts +31 -0
- package/dist/commands/token/copy.d.ts.map +1 -0
- package/dist/commands/token/copy.js +179 -0
- package/dist/commands/token/copy.js.map +1 -0
- package/dist/commands/token/definitions.d.ts +29 -0
- package/dist/commands/token/definitions.d.ts.map +1 -0
- package/dist/commands/token/definitions.js +63 -0
- package/dist/commands/token/definitions.js.map +1 -0
- package/dist/commands/token/index.d.ts +22 -0
- package/dist/commands/token/index.d.ts.map +1 -0
- package/dist/commands/token/index.js +44 -0
- package/dist/commands/token/index.js.map +1 -0
- package/dist/commands/token/lineage.d.ts +43 -0
- package/dist/commands/token/lineage.d.ts.map +1 -0
- package/dist/commands/token/lineage.js +187 -0
- package/dist/commands/token/lineage.js.map +1 -0
- package/dist/commands/token/matrix.d.ts +249 -0
- package/dist/commands/token/matrix.d.ts.map +1 -0
- package/dist/commands/token/matrix.js +658 -0
- package/dist/commands/token/matrix.js.map +1 -0
- package/dist/commands/token/override.d.ts +51 -0
- package/dist/commands/token/override.d.ts.map +1 -0
- package/dist/commands/token/override.js +158 -0
- package/dist/commands/token/override.js.map +1 -0
- package/dist/commands/token/previous-value.d.ts +23 -0
- package/dist/commands/token/previous-value.d.ts.map +1 -0
- package/dist/commands/token/previous-value.js +26 -0
- package/dist/commands/token/previous-value.js.map +1 -0
- package/dist/commands/token/reset.d.ts +29 -0
- package/dist/commands/token/reset.d.ts.map +1 -0
- package/dist/commands/token/reset.js +143 -0
- package/dist/commands/token/reset.js.map +1 -0
- package/dist/commands/token/resolve.d.ts +43 -0
- package/dist/commands/token/resolve.d.ts.map +1 -0
- package/dist/commands/token/resolve.js +136 -0
- package/dist/commands/token/resolve.js.map +1 -0
- package/dist/commands/token/subtract.d.ts +27 -0
- package/dist/commands/token/subtract.d.ts.map +1 -0
- package/dist/commands/token/subtract.js +129 -0
- package/dist/commands/token/subtract.js.map +1 -0
- package/dist/commands/webhooks/delete.d.ts +31 -0
- package/dist/commands/webhooks/delete.d.ts.map +1 -0
- package/dist/commands/webhooks/delete.js +94 -0
- package/dist/commands/webhooks/delete.js.map +1 -0
- package/dist/commands/webhooks/get.d.ts +50 -0
- package/dist/commands/webhooks/get.d.ts.map +1 -0
- package/dist/commands/webhooks/get.js +122 -0
- package/dist/commands/webhooks/get.js.map +1 -0
- package/dist/commands/webhooks/index.d.ts +24 -0
- package/dist/commands/webhooks/index.d.ts.map +1 -0
- package/dist/commands/webhooks/index.js +41 -0
- package/dist/commands/webhooks/index.js.map +1 -0
- package/dist/commands/webhooks/list.d.ts +72 -0
- package/dist/commands/webhooks/list.d.ts.map +1 -0
- package/dist/commands/webhooks/list.js +116 -0
- package/dist/commands/webhooks/list.js.map +1 -0
- package/dist/commands/webhooks/logs.d.ts +65 -0
- package/dist/commands/webhooks/logs.d.ts.map +1 -0
- package/dist/commands/webhooks/logs.js +138 -0
- package/dist/commands/webhooks/logs.js.map +1 -0
- package/dist/commands/webhooks/redact.d.ts +18 -0
- package/dist/commands/webhooks/redact.d.ts.map +1 -0
- package/dist/commands/webhooks/redact.js +24 -0
- package/dist/commands/webhooks/redact.js.map +1 -0
- package/dist/commands/webhooks/register.d.ts +78 -0
- package/dist/commands/webhooks/register.d.ts.map +1 -0
- package/dist/commands/webhooks/register.js +175 -0
- package/dist/commands/webhooks/register.js.map +1 -0
- package/dist/commands/webhooks/test.d.ts +32 -0
- package/dist/commands/webhooks/test.d.ts.map +1 -0
- package/dist/commands/webhooks/test.js +101 -0
- package/dist/commands/webhooks/test.js.map +1 -0
- package/dist/commands/webhooks/update.d.ts +77 -0
- package/dist/commands/webhooks/update.d.ts.map +1 -0
- package/dist/commands/webhooks/update.js +198 -0
- package/dist/commands/webhooks/update.js.map +1 -0
- package/dist/css.d.ts +3 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +3 -0
- package/dist/css.js.map +1 -0
- package/dist/demo/index.d.ts +8 -0
- package/dist/demo/index.d.ts.map +1 -0
- package/dist/demo/index.js +8 -0
- package/dist/demo/index.js.map +1 -0
- package/dist/demo/realistic-system.d.ts +54 -0
- package/dist/demo/realistic-system.d.ts.map +1 -0
- package/dist/demo/realistic-system.js +919 -0
- package/dist/demo/realistic-system.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/types/command-result.d.ts +10 -0
- package/dist/types/command-result.d.ts.map +1 -0
- package/dist/types/command-result.js +11 -0
- package/dist/types/command-result.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/dist/webhooks/dispatcher.d.ts +147 -0
- package/dist/webhooks/dispatcher.d.ts.map +1 -0
- package/dist/webhooks/dispatcher.js +420 -0
- package/dist/webhooks/dispatcher.js.map +1 -0
- package/dist/webhooks/index.d.ts +9 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +9 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/signer.d.ts +119 -0
- package/dist/webhooks/signer.d.ts.map +1 -0
- package/dist/webhooks/signer.js +149 -0
- package/dist/webhooks/signer.js.map +1 -0
- package/dist/webhooks/url-policy.d.ts +73 -0
- package/dist/webhooks/url-policy.d.ts.map +1 -0
- package/dist/webhooks/url-policy.js +250 -0
- package/dist/webhooks/url-policy.js.map +1 -0
- package/dist/worker.d.ts +11 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +31 -0
- package/dist/worker.js.map +1 -0
- package/package.json +84 -3
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PACKAGE_VERSION } from '../../version.js';
|
|
3
|
+
import { registry } from '../registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Health check result for a single check
|
|
6
|
+
*/
|
|
7
|
+
const HealthCheckSchema = z.object({
|
|
8
|
+
name: z.string(),
|
|
9
|
+
status: z.enum(['pass', 'warn', 'fail']),
|
|
10
|
+
message: z.string(),
|
|
11
|
+
detail: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Environment info for verbose output
|
|
15
|
+
*/
|
|
16
|
+
const EnvironmentInfoSchema = z.object({
|
|
17
|
+
nodeVersion: z.string(),
|
|
18
|
+
platform: z.string(),
|
|
19
|
+
arch: z.string(),
|
|
20
|
+
cwd: z.string(),
|
|
21
|
+
packageVersion: z.string(),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Doctor command input schema
|
|
25
|
+
*/
|
|
26
|
+
const DoctorInputSchema = z.object({
|
|
27
|
+
verbose: z.boolean().default(false).describe('Include environment details'),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Doctor command output
|
|
31
|
+
*/
|
|
32
|
+
const DoctorOutputSchema = z.object({
|
|
33
|
+
healthy: z.boolean(),
|
|
34
|
+
checks: z.array(HealthCheckSchema),
|
|
35
|
+
summary: z.object({
|
|
36
|
+
passed: z.number(),
|
|
37
|
+
warnings: z.number(),
|
|
38
|
+
failed: z.number(),
|
|
39
|
+
total: z.number(),
|
|
40
|
+
}),
|
|
41
|
+
environment: EnvironmentInfoSchema.optional(),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Check Node.js version
|
|
45
|
+
*/
|
|
46
|
+
function checkNodeVersion() {
|
|
47
|
+
const nodeVersion = process.version;
|
|
48
|
+
const major = Number.parseInt(nodeVersion.slice(1).split('.')[0], 10);
|
|
49
|
+
if (major >= 24) {
|
|
50
|
+
return {
|
|
51
|
+
name: 'Node.js version',
|
|
52
|
+
status: 'pass',
|
|
53
|
+
message: `Node.js ${nodeVersion} (required: v24+)`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
name: 'Node.js version',
|
|
58
|
+
status: 'fail',
|
|
59
|
+
message: `Node.js ${nodeVersion} (v24+ required)`,
|
|
60
|
+
detail: 'Violet requires Node.js 24 or higher (see "engines" in package.json)',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check database connectivity
|
|
65
|
+
*/
|
|
66
|
+
async function checkDatabase(context) {
|
|
67
|
+
try {
|
|
68
|
+
// Try to list nodes - this tests basic DB connectivity
|
|
69
|
+
const nodes = await context.db.listNodes();
|
|
70
|
+
return {
|
|
71
|
+
name: 'Database connectivity',
|
|
72
|
+
status: 'pass',
|
|
73
|
+
message: `Connected (${nodes.length} nodes)`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
name: 'Database connectivity',
|
|
79
|
+
status: 'fail',
|
|
80
|
+
message: 'Failed to connect to database',
|
|
81
|
+
detail: error instanceof Error ? error.message : 'Unknown error',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Check command registry health
|
|
87
|
+
*/
|
|
88
|
+
function checkRegistry() {
|
|
89
|
+
const commands = registry.list();
|
|
90
|
+
if (commands.length === 0) {
|
|
91
|
+
return {
|
|
92
|
+
name: 'Command registry',
|
|
93
|
+
status: 'fail',
|
|
94
|
+
message: 'No commands registered',
|
|
95
|
+
detail: 'Call initializeCore() before using Violet',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// Check for expected minimum commands
|
|
99
|
+
const expectedMinimum = 15; // We have 21+ commands
|
|
100
|
+
if (commands.length < expectedMinimum) {
|
|
101
|
+
return {
|
|
102
|
+
name: 'Command registry',
|
|
103
|
+
status: 'warn',
|
|
104
|
+
message: `${commands.length} commands registered (expected ${expectedMinimum}+)`,
|
|
105
|
+
detail: 'Some command modules may not be loaded',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
name: 'Command registry',
|
|
110
|
+
status: 'pass',
|
|
111
|
+
message: `${commands.length} commands registered`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Check write permissions (try to create a temp node if DB is memory-based)
|
|
116
|
+
* For non-destructive check, we just verify DB methods exist
|
|
117
|
+
*/
|
|
118
|
+
function checkWriteCapability(context) {
|
|
119
|
+
try {
|
|
120
|
+
// Check that essential methods exist
|
|
121
|
+
const requiredMethods = ['createNode', 'updateNode', 'deleteNode', 'addOperation'];
|
|
122
|
+
for (const method of requiredMethods) {
|
|
123
|
+
if (typeof context.db[method] !== 'function') {
|
|
124
|
+
return {
|
|
125
|
+
name: 'Write capability',
|
|
126
|
+
status: 'fail',
|
|
127
|
+
message: `Database missing ${method} method`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
name: 'Write capability',
|
|
133
|
+
status: 'pass',
|
|
134
|
+
message: 'Database supports write operations',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return {
|
|
139
|
+
name: 'Write capability',
|
|
140
|
+
status: 'fail',
|
|
141
|
+
message: 'Failed to verify write capability',
|
|
142
|
+
detail: error instanceof Error ? error.message : 'Unknown error',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get environment info for verbose output
|
|
148
|
+
*/
|
|
149
|
+
function getEnvironmentInfo() {
|
|
150
|
+
return {
|
|
151
|
+
nodeVersion: process.version,
|
|
152
|
+
platform: process.platform,
|
|
153
|
+
arch: process.arch,
|
|
154
|
+
cwd: process.cwd(),
|
|
155
|
+
packageVersion: PACKAGE_VERSION,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Doctor command handler
|
|
160
|
+
*/
|
|
161
|
+
async function doctorHandler(rawInput, context) {
|
|
162
|
+
const input = DoctorInputSchema.parse(rawInput);
|
|
163
|
+
const checks = [];
|
|
164
|
+
// Run all health checks
|
|
165
|
+
checks.push(checkNodeVersion());
|
|
166
|
+
checks.push(await checkDatabase(context));
|
|
167
|
+
checks.push(checkRegistry());
|
|
168
|
+
checks.push(checkWriteCapability(context));
|
|
169
|
+
// Calculate summary
|
|
170
|
+
const passed = checks.filter((c) => c.status === 'pass').length;
|
|
171
|
+
const warnings = checks.filter((c) => c.status === 'warn').length;
|
|
172
|
+
const failed = checks.filter((c) => c.status === 'fail').length;
|
|
173
|
+
const healthy = failed === 0;
|
|
174
|
+
const output = {
|
|
175
|
+
healthy,
|
|
176
|
+
checks,
|
|
177
|
+
summary: {
|
|
178
|
+
passed,
|
|
179
|
+
warnings,
|
|
180
|
+
failed,
|
|
181
|
+
total: checks.length,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
// Add environment info if verbose
|
|
185
|
+
if (input.verbose) {
|
|
186
|
+
output.environment = getEnvironmentInfo();
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
success: true,
|
|
190
|
+
data: output,
|
|
191
|
+
reasoning: healthy
|
|
192
|
+
? `All ${checks.length} health checks passed`
|
|
193
|
+
: `${failed} check(s) failed, ${warnings} warning(s)`,
|
|
194
|
+
confidence: 1.0,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Doctor command definition
|
|
199
|
+
*/
|
|
200
|
+
export const doctorCommand = {
|
|
201
|
+
name: 'doctor',
|
|
202
|
+
description: 'Check system health and configuration',
|
|
203
|
+
category: 'system',
|
|
204
|
+
inputSchema: DoctorInputSchema,
|
|
205
|
+
outputSchema: DoctorOutputSchema,
|
|
206
|
+
handler: doctorHandler,
|
|
207
|
+
examples: [
|
|
208
|
+
{
|
|
209
|
+
description: 'Basic health check',
|
|
210
|
+
input: {},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
description: 'Verbose health check with environment info',
|
|
214
|
+
input: { verbose: true },
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Register system commands
|
|
220
|
+
*/
|
|
221
|
+
export function registerSystemCommands() {
|
|
222
|
+
registry.register(doctorCommand);
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/commands/system/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAA+C,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvF;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC3E,CAAC,CAAC;AAIH;;GAEG;A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AK,EAAE,EAAE;SACT;QACD;YACC,WAAW,EAAE,4CAA4C;YACzD,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SACxB;KACD;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System commands for Violet Design
|
|
3
|
+
*
|
|
4
|
+
* Health checks, validation, and documentation generation.
|
|
5
|
+
*/
|
|
6
|
+
export { doctorCommand, registerSystemCommands as registerDoctorCommand, } from './doctor.js';
|
|
7
|
+
export { systemValidateCommand, registerValidateCommand } from './validate.js';
|
|
8
|
+
/**
|
|
9
|
+
* Register all system commands
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerSystemCommands(): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/system/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,aAAa,EACb,sBAAsB,IAAI,qBAAqB,GAC/C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAK/E;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAG7C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System commands for Violet Design
|
|
3
|
+
*
|
|
4
|
+
* Health checks, validation, and documentation generation.
|
|
5
|
+
*/
|
|
6
|
+
export { doctorCommand, registerSystemCommands as registerDoctorCommand, } from './doctor.js';
|
|
7
|
+
export { systemValidateCommand, registerValidateCommand } from './validate.js';
|
|
8
|
+
import { registerSystemCommands as registerDoctor } from './doctor.js';
|
|
9
|
+
import { registerValidateCommand } from './validate.js';
|
|
10
|
+
/**
|
|
11
|
+
* Register all system commands
|
|
12
|
+
*/
|
|
13
|
+
export function registerSystemCommands() {
|
|
14
|
+
registerDoctor();
|
|
15
|
+
registerValidateCommand();
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/system/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,aAAa,EACb,sBAAsB,IAAI,qBAAqB,GAC/C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,cAAc,EAAE,CAAC;IACjB,uBAAuB,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type CommandDefinition } from '../registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validate command input schema
|
|
5
|
+
*/
|
|
6
|
+
declare const ValidateInputSchema: z.ZodObject<{
|
|
7
|
+
coverage: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
9
|
+
bail: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate command output
|
|
13
|
+
*/
|
|
14
|
+
declare const ValidateOutputSchema: z.ZodObject<{
|
|
15
|
+
passed: z.ZodBoolean;
|
|
16
|
+
testResults: z.ZodObject<{
|
|
17
|
+
total: z.ZodNumber;
|
|
18
|
+
passed: z.ZodNumber;
|
|
19
|
+
failed: z.ZodNumber;
|
|
20
|
+
skipped: z.ZodNumber;
|
|
21
|
+
duration: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
coverage: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
lines: z.ZodNumber;
|
|
25
|
+
statements: z.ZodNumber;
|
|
26
|
+
functions: z.ZodNumber;
|
|
27
|
+
branches: z.ZodNumber;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
failures: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
30
|
+
file: z.ZodString;
|
|
31
|
+
test: z.ZodString;
|
|
32
|
+
error: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
rawOutput: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
type ValidateOutput = z.infer<typeof ValidateOutputSchema>;
|
|
37
|
+
/**
|
|
38
|
+
* Validate command definition (system.validate - runs test suite)
|
|
39
|
+
* Named systemValidateCommand to avoid conflict with constraints.validateCommand
|
|
40
|
+
*/
|
|
41
|
+
export declare const systemValidateCommand: CommandDefinition<typeof ValidateInputSchema, ValidateOutput>;
|
|
42
|
+
/**
|
|
43
|
+
* Register validate command
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerValidateCommand(): void;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/system/validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAuB,KAAK,iBAAiB,EAAY,MAAM,gBAAgB,CAAC;AAgBvF;;GAEG;AACH,QAAA,MAAM,mBAAmB;;;;iBAIvB,CAAC;AAIH;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;iBAoBxB,CAAC;AAEH,KAAK,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAmN3D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,cAAc,CA0B9F,CAAC;AAEH;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { registry } from '../registry.js';
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
/**
|
|
7
|
+
* Coverage statistics
|
|
8
|
+
*/
|
|
9
|
+
const CoverageStatsSchema = z.object({
|
|
10
|
+
lines: z.number(),
|
|
11
|
+
statements: z.number(),
|
|
12
|
+
functions: z.number(),
|
|
13
|
+
branches: z.number(),
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Validate command input schema
|
|
17
|
+
*/
|
|
18
|
+
const ValidateInputSchema = z.object({
|
|
19
|
+
coverage: z.boolean().default(false).describe('Include coverage statistics'),
|
|
20
|
+
filter: z.string().optional().describe('Filter pattern for test files'),
|
|
21
|
+
bail: z.boolean().default(false).describe('Stop on first failure'),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Validate command output
|
|
25
|
+
*/
|
|
26
|
+
const ValidateOutputSchema = z.object({
|
|
27
|
+
passed: z.boolean(),
|
|
28
|
+
testResults: z.object({
|
|
29
|
+
total: z.number(),
|
|
30
|
+
passed: z.number(),
|
|
31
|
+
failed: z.number(),
|
|
32
|
+
skipped: z.number(),
|
|
33
|
+
duration: z.number(),
|
|
34
|
+
}),
|
|
35
|
+
coverage: CoverageStatsSchema.optional(),
|
|
36
|
+
failures: z
|
|
37
|
+
.array(z.object({
|
|
38
|
+
file: z.string(),
|
|
39
|
+
test: z.string(),
|
|
40
|
+
error: z.string(),
|
|
41
|
+
}))
|
|
42
|
+
.optional(),
|
|
43
|
+
rawOutput: z.string().optional(),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Parse vitest JSON output to extract results
|
|
47
|
+
*/
|
|
48
|
+
function parseVitestOutput(stdout) {
|
|
49
|
+
// Parse one or more vitest summary lines like "Tests 181 passed (181)"
|
|
50
|
+
const testMatches = Array.from(stdout.matchAll(/Tests\s+(?:(\d+) failed \| )?(\d+) passed(?: \| (\d+) skipped)?\s+\((\d+)\)/g));
|
|
51
|
+
if (testMatches.length > 0) {
|
|
52
|
+
const aggregate = testMatches.reduce((acc, match) => {
|
|
53
|
+
acc.failed += Number.parseInt(match[1] || '0', 10);
|
|
54
|
+
acc.passed += Number.parseInt(match[2] || '0', 10);
|
|
55
|
+
acc.skipped += Number.parseInt(match[3] || '0', 10);
|
|
56
|
+
acc.total += Number.parseInt(match[4] || '0', 10);
|
|
57
|
+
return acc;
|
|
58
|
+
}, { total: 0, passed: 0, failed: 0, skipped: 0 });
|
|
59
|
+
const turboDurationMatch = stdout.match(/Time:\s+([\d.]+)s/);
|
|
60
|
+
const durationMatch = stdout.match(/Duration\s+([\d.]+)s/g);
|
|
61
|
+
let duration = 0;
|
|
62
|
+
if (turboDurationMatch) {
|
|
63
|
+
duration = Number.parseFloat(turboDurationMatch[1]) * 1000;
|
|
64
|
+
}
|
|
65
|
+
else if (durationMatch) {
|
|
66
|
+
duration = Array.from(stdout.matchAll(/Duration\s+([\d.]+)s/g)).reduce((sum, match) => sum + Number.parseFloat(match[1]) * 1000, 0);
|
|
67
|
+
}
|
|
68
|
+
return { ...aggregate, duration };
|
|
69
|
+
}
|
|
70
|
+
// Fallback: look for individual counts
|
|
71
|
+
const failedMatch = stdout.match(/(\d+) failed/);
|
|
72
|
+
const passedMatch = stdout.match(/(\d+) passed/);
|
|
73
|
+
const skippedMatch = stdout.match(/(\d+) skipped/);
|
|
74
|
+
const totalMatch = stdout.match(/\((\d+)\)/);
|
|
75
|
+
const failed = failedMatch ? Number.parseInt(failedMatch[1], 10) : 0;
|
|
76
|
+
const passed = passedMatch ? Number.parseInt(passedMatch[1], 10) : 0;
|
|
77
|
+
const skipped = skippedMatch ? Number.parseInt(skippedMatch[1], 10) : 0;
|
|
78
|
+
const total = totalMatch ? Number.parseInt(totalMatch[1], 10) : passed + failed + skipped;
|
|
79
|
+
// Parse duration
|
|
80
|
+
const durationMatch = stdout.match(/Duration\s+([\d.]+)s/);
|
|
81
|
+
const duration = durationMatch ? Number.parseFloat(durationMatch[1]) * 1000 : 0;
|
|
82
|
+
return { total, passed, failed, skipped, duration };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse coverage from vitest output
|
|
86
|
+
*/
|
|
87
|
+
function parseCoverage(stdout) {
|
|
88
|
+
// Look for coverage summary like "All files | 80.5 | 75.2 | 82.1 | 78.9"
|
|
89
|
+
const coverageMatch = stdout.match(/All files\s*\|\s*([\d.]+)\s*\|\s*([\d.]+)\s*\|\s*([\d.]+)\s*\|\s*([\d.]+)/);
|
|
90
|
+
if (coverageMatch) {
|
|
91
|
+
return {
|
|
92
|
+
statements: Number.parseFloat(coverageMatch[1]),
|
|
93
|
+
branches: Number.parseFloat(coverageMatch[2]),
|
|
94
|
+
functions: Number.parseFloat(coverageMatch[3]),
|
|
95
|
+
lines: Number.parseFloat(coverageMatch[4]),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Parse failure details from output
|
|
102
|
+
*/
|
|
103
|
+
function parseFailures(stdout) {
|
|
104
|
+
const failures = [];
|
|
105
|
+
// Look for FAIL markers
|
|
106
|
+
const failPattern = /FAIL\s+(.+?)\s+>\s+(.+?)(?:\n|$)/g;
|
|
107
|
+
let match = failPattern.exec(stdout);
|
|
108
|
+
while (match !== null) {
|
|
109
|
+
failures.push({
|
|
110
|
+
file: match[1].trim(),
|
|
111
|
+
test: match[2].trim(),
|
|
112
|
+
error: 'Test failed (see raw output for details)',
|
|
113
|
+
});
|
|
114
|
+
match = failPattern.exec(stdout);
|
|
115
|
+
}
|
|
116
|
+
return failures;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Validate command handler
|
|
120
|
+
*/
|
|
121
|
+
async function validateHandler(rawInput, _context) {
|
|
122
|
+
const input = ValidateInputSchema.parse(rawInput);
|
|
123
|
+
const ignoredOptions = [];
|
|
124
|
+
if (input.filter) {
|
|
125
|
+
ignoredOptions.push('filter');
|
|
126
|
+
}
|
|
127
|
+
if (input.bail) {
|
|
128
|
+
ignoredOptions.push('bail');
|
|
129
|
+
}
|
|
130
|
+
const command = input.coverage ? 'pnpm test:coverage' : 'pnpm test';
|
|
131
|
+
try {
|
|
132
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
133
|
+
cwd: process.cwd(),
|
|
134
|
+
timeout: 120000, // 2 minute timeout
|
|
135
|
+
maxBuffer: 10 * 1024 * 1024, // 10MB buffer
|
|
136
|
+
});
|
|
137
|
+
const combined = stdout + stderr;
|
|
138
|
+
const testResults = parseVitestOutput(combined);
|
|
139
|
+
const coverage = input.coverage ? parseCoverage(combined) : undefined;
|
|
140
|
+
const failures = testResults.failed > 0 ? parseFailures(combined) : undefined;
|
|
141
|
+
return {
|
|
142
|
+
success: true,
|
|
143
|
+
data: {
|
|
144
|
+
passed: testResults.failed === 0,
|
|
145
|
+
testResults,
|
|
146
|
+
coverage,
|
|
147
|
+
failures,
|
|
148
|
+
},
|
|
149
|
+
reasoning: testResults.failed === 0
|
|
150
|
+
? `All ${testResults.passed} tests passed`
|
|
151
|
+
: `${testResults.failed} test(s) failed out of ${testResults.total}`,
|
|
152
|
+
confidence: 1.0,
|
|
153
|
+
warnings: ignoredOptions.length > 0
|
|
154
|
+
? [
|
|
155
|
+
{
|
|
156
|
+
code: 'UNSUPPORTED_OPTIONS_IGNORED',
|
|
157
|
+
message: `Ignored validate option(s): ${ignoredOptions.join(', ')}`,
|
|
158
|
+
severity: 'warning',
|
|
159
|
+
},
|
|
160
|
+
]
|
|
161
|
+
: undefined,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
// Test failures cause non-zero exit code
|
|
166
|
+
if (error instanceof Error && 'stdout' in error) {
|
|
167
|
+
const execError = error;
|
|
168
|
+
const combined = (execError.stdout || '') + (execError.stderr || '');
|
|
169
|
+
const testResults = parseVitestOutput(combined);
|
|
170
|
+
const failures = parseFailures(combined);
|
|
171
|
+
return {
|
|
172
|
+
success: true, // Command succeeded even if tests failed
|
|
173
|
+
data: {
|
|
174
|
+
passed: false,
|
|
175
|
+
testResults,
|
|
176
|
+
failures: failures.length > 0 ? failures : undefined,
|
|
177
|
+
rawOutput: combined.slice(0, 2000), // Truncate for readability
|
|
178
|
+
},
|
|
179
|
+
reasoning: `${testResults.failed} test(s) failed out of ${testResults.total}`,
|
|
180
|
+
confidence: 1.0,
|
|
181
|
+
warnings: [
|
|
182
|
+
{
|
|
183
|
+
code: 'TEST_FAILURES',
|
|
184
|
+
message: `${testResults.failed} test(s) failed`,
|
|
185
|
+
severity: 'warning',
|
|
186
|
+
},
|
|
187
|
+
...(ignoredOptions.length > 0
|
|
188
|
+
? [
|
|
189
|
+
{
|
|
190
|
+
code: 'UNSUPPORTED_OPTIONS_IGNORED',
|
|
191
|
+
message: `Ignored validate option(s): ${ignoredOptions.join(', ')}`,
|
|
192
|
+
severity: 'warning',
|
|
193
|
+
},
|
|
194
|
+
]
|
|
195
|
+
: []),
|
|
196
|
+
],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
success: false,
|
|
201
|
+
error: {
|
|
202
|
+
code: 'VALIDATION_ERROR',
|
|
203
|
+
message: error instanceof Error ? error.message : 'Validation failed',
|
|
204
|
+
suggestion: 'Check that vitest is installed and configured correctly',
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Validate command definition (system.validate - runs test suite)
|
|
211
|
+
* Named systemValidateCommand to avoid conflict with constraints.validateCommand
|
|
212
|
+
*/
|
|
213
|
+
export const systemValidateCommand = {
|
|
214
|
+
name: 'validate',
|
|
215
|
+
description: 'Run test suite and optionally collect coverage',
|
|
216
|
+
category: 'system',
|
|
217
|
+
inputSchema: ValidateInputSchema,
|
|
218
|
+
outputSchema: ValidateOutputSchema,
|
|
219
|
+
handler: validateHandler,
|
|
220
|
+
examples: [
|
|
221
|
+
{
|
|
222
|
+
description: 'Run all tests',
|
|
223
|
+
input: {},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
description: 'Run tests with coverage',
|
|
227
|
+
input: { coverage: true },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
description: 'Run filtered tests',
|
|
231
|
+
input: { filter: 'node.*' },
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
description: 'Stop on first failure',
|
|
235
|
+
input: { bail: true },
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Register validate command
|
|
241
|
+
*/
|
|
242
|
+
export function registerValidateCommand() {
|
|
243
|
+
registry.register(systemValidateCommand);
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/system/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA+C,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvF,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM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E,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC3B;QACD;YACC,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACrB;KACD;CACD,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CommandDefinition } from '../registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Input schema for token.add command
|
|
5
|
+
*/
|
|
6
|
+
declare const InputSchema: z.ZodObject<{
|
|
7
|
+
nodeId: z.ZodString;
|
|
8
|
+
tokenId: z.ZodString;
|
|
9
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
|
|
10
|
+
ref: z.ZodString;
|
|
11
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
web: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
14
|
+
ios: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
15
|
+
android: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
|
+
}, z.core.$strict>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
17
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
description: z.ZodOptional<z.ZodString>;
|
|
19
|
+
type: z.ZodOptional<z.ZodString>;
|
|
20
|
+
category: z.ZodDefault<z.ZodEnum<{
|
|
21
|
+
color: "color";
|
|
22
|
+
custom: "custom";
|
|
23
|
+
motion: "motion";
|
|
24
|
+
opacity: "opacity";
|
|
25
|
+
radius: "radius";
|
|
26
|
+
shadow: "shadow";
|
|
27
|
+
spacing: "spacing";
|
|
28
|
+
typography: "typography";
|
|
29
|
+
"z-index": "z-index";
|
|
30
|
+
}>>;
|
|
31
|
+
tier: z.ZodDefault<z.ZodEnum<{
|
|
32
|
+
component: "component";
|
|
33
|
+
global: "global";
|
|
34
|
+
semantic: "semantic";
|
|
35
|
+
}>>;
|
|
36
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
beta: "beta";
|
|
38
|
+
deprecated: "deprecated";
|
|
39
|
+
stable: "stable";
|
|
40
|
+
}>>;
|
|
41
|
+
deprecatedBy: z.ZodOptional<z.ZodString>;
|
|
42
|
+
since: z.ZodOptional<z.ZodString>;
|
|
43
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
44
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
45
|
+
cssProperty: z.ZodOptional<z.ZodString>;
|
|
46
|
+
figmaVariable: z.ZodOptional<z.ZodString>;
|
|
47
|
+
constraint: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
type: z.ZodEnum<{
|
|
49
|
+
color: "color";
|
|
50
|
+
dimension: "dimension";
|
|
51
|
+
enum: "enum";
|
|
52
|
+
ratio: "ratio";
|
|
53
|
+
}>;
|
|
54
|
+
contrastAgainst: z.ZodOptional<z.ZodString>;
|
|
55
|
+
minContrast: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
wcagLevel: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
AA: "AA";
|
|
58
|
+
AAA: "AAA";
|
|
59
|
+
}>>;
|
|
60
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
63
|
+
multipleOf: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
/**
|
|
71
|
+
* Output schema for token.add command
|
|
72
|
+
*/
|
|
73
|
+
declare const OutputSchema: z.ZodObject<{
|
|
74
|
+
nodeId: z.ZodString;
|
|
75
|
+
tokenId: z.ZodString;
|
|
76
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
|
|
77
|
+
ref: z.ZodString;
|
|
78
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
web: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
81
|
+
ios: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
82
|
+
android: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
83
|
+
}, z.core.$strict>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
84
|
+
operationId: z.ZodString;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
type Output = z.infer<typeof OutputSchema>;
|
|
87
|
+
/**
|
|
88
|
+
* token.add command
|
|
89
|
+
*
|
|
90
|
+
* Add a new token to a node. The token must not exist in ancestors.
|
|
91
|
+
*/
|
|
92
|
+
export declare const tokenAddCommand: CommandDefinition<typeof InputSchema, Output>;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=add.d.ts.map
|