@lushly-dev/violet-afd 0.0.0-stage → 0.3.0-preview.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.
- package/LICENSE +21 -0
- package/README.md +29 -2
- package/dist/commands/analyze/compare.d.ts +34 -0
- package/dist/commands/analyze/compare.d.ts.map +1 -0
- package/dist/commands/analyze/compare.js +180 -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 +114 -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 +46 -0
- package/dist/commands/specimen/get.d.ts.map +1 -0
- package/dist/commands/specimen/get.js +121 -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 +188 -0
- package/dist/commands/specimen/set.js.map +1 -0
- package/dist/commands/specimen/shared.d.ts +16 -0
- package/dist/commands/specimen/shared.d.ts.map +1 -0
- package/dist/commands/specimen/shared.js +27 -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,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module docs/generator
|
|
3
|
+
* Documentation generator from command registry
|
|
4
|
+
*/
|
|
5
|
+
import { matchesGlob } from '@lushly-dev/violet-core/engine';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { ErrorCodes } from '../../types/command-result.js';
|
|
8
|
+
import { toJsonSchema } from '../json-schema.js';
|
|
9
|
+
import { registry } from '../registry.js';
|
|
10
|
+
// Input schema
|
|
11
|
+
export const DocsGenerateInputSchema = z.object({
|
|
12
|
+
format: z.enum(['markdown', 'json']).default('markdown'),
|
|
13
|
+
includeExamples: z.boolean().default(true),
|
|
14
|
+
includeSchemas: z.boolean().default(true),
|
|
15
|
+
filter: z.string().optional().describe("Filter commands by pattern (e.g., 'node.*')"),
|
|
16
|
+
});
|
|
17
|
+
// Output schema
|
|
18
|
+
export const DocsGenerateOutputSchema = z.object({
|
|
19
|
+
generated: z.string(),
|
|
20
|
+
version: z.string(),
|
|
21
|
+
commandCount: z.number(),
|
|
22
|
+
categories: z.array(z.string()),
|
|
23
|
+
commands: z.array(z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
category: z.string(),
|
|
26
|
+
description: z.string(),
|
|
27
|
+
inputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
28
|
+
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
+
examples: z
|
|
30
|
+
.array(z.object({
|
|
31
|
+
input: z.record(z.string(), z.unknown()),
|
|
32
|
+
description: z.string().optional(),
|
|
33
|
+
}))
|
|
34
|
+
.optional(),
|
|
35
|
+
errors: z.array(z.string()).optional(),
|
|
36
|
+
tags: z.array(z.string()).optional(),
|
|
37
|
+
})),
|
|
38
|
+
errorCodes: z.array(z.object({
|
|
39
|
+
code: z.string(),
|
|
40
|
+
description: z.string(),
|
|
41
|
+
})),
|
|
42
|
+
markdown: z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Generate markdown for a single command
|
|
46
|
+
*/
|
|
47
|
+
function generateCommandMarkdown(cmd) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
lines.push(`## ${cmd.name}`);
|
|
50
|
+
lines.push('');
|
|
51
|
+
lines.push(cmd.description);
|
|
52
|
+
lines.push('');
|
|
53
|
+
lines.push(`**Category:** \`${cmd.category}\``);
|
|
54
|
+
lines.push('');
|
|
55
|
+
if (cmd.inputSchema) {
|
|
56
|
+
lines.push('### Input Schema');
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push('```json');
|
|
59
|
+
lines.push(JSON.stringify(cmd.inputSchema, null, 2));
|
|
60
|
+
lines.push('```');
|
|
61
|
+
lines.push('');
|
|
62
|
+
}
|
|
63
|
+
if (cmd.outputSchema) {
|
|
64
|
+
lines.push('### Output Schema');
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push('```json');
|
|
67
|
+
lines.push(JSON.stringify(cmd.outputSchema, null, 2));
|
|
68
|
+
lines.push('```');
|
|
69
|
+
lines.push('');
|
|
70
|
+
}
|
|
71
|
+
if (cmd.examples && cmd.examples.length > 0) {
|
|
72
|
+
lines.push('### Examples');
|
|
73
|
+
lines.push('');
|
|
74
|
+
for (const example of cmd.examples) {
|
|
75
|
+
if (example.description) {
|
|
76
|
+
lines.push(`**${example.description}**`);
|
|
77
|
+
lines.push('');
|
|
78
|
+
}
|
|
79
|
+
lines.push('```json');
|
|
80
|
+
lines.push(JSON.stringify(example.input, null, 2));
|
|
81
|
+
lines.push('```');
|
|
82
|
+
lines.push('');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (cmd.errors && cmd.errors.length > 0) {
|
|
86
|
+
lines.push('### Error Codes');
|
|
87
|
+
lines.push('');
|
|
88
|
+
for (const error of cmd.errors) {
|
|
89
|
+
lines.push(`- \`${error}\``);
|
|
90
|
+
}
|
|
91
|
+
lines.push('');
|
|
92
|
+
}
|
|
93
|
+
lines.push('---');
|
|
94
|
+
lines.push('');
|
|
95
|
+
return lines.join('\n');
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Generate full markdown documentation
|
|
99
|
+
*/
|
|
100
|
+
function generateFullMarkdown(output) {
|
|
101
|
+
const lines = [];
|
|
102
|
+
// Header
|
|
103
|
+
lines.push('# Violet Design Command Reference');
|
|
104
|
+
lines.push('');
|
|
105
|
+
lines.push(`*Generated: ${output.generated}*`);
|
|
106
|
+
lines.push('');
|
|
107
|
+
lines.push(`**Version:** ${output.version}`);
|
|
108
|
+
lines.push('');
|
|
109
|
+
lines.push(`**Total Commands:** ${output.commandCount}`);
|
|
110
|
+
lines.push('');
|
|
111
|
+
// Table of Contents
|
|
112
|
+
lines.push('## Table of Contents');
|
|
113
|
+
lines.push('');
|
|
114
|
+
lines.push('- [Commands by Category](#commands-by-category)');
|
|
115
|
+
for (const category of output.categories) {
|
|
116
|
+
lines.push(` - [${category}](#${category.toLowerCase().replace(/\s+/g, '-')})`);
|
|
117
|
+
}
|
|
118
|
+
lines.push('- [Error Codes](#error-codes)');
|
|
119
|
+
lines.push('');
|
|
120
|
+
// Commands by Category
|
|
121
|
+
lines.push('## Commands by Category');
|
|
122
|
+
lines.push('');
|
|
123
|
+
for (const category of output.categories) {
|
|
124
|
+
const categoryCommands = output.commands.filter((c) => c.category === category);
|
|
125
|
+
lines.push(`### ${category}`);
|
|
126
|
+
lines.push('');
|
|
127
|
+
lines.push('| Command | Description |');
|
|
128
|
+
lines.push('|---------|-------------|');
|
|
129
|
+
for (const cmd of categoryCommands) {
|
|
130
|
+
lines.push(`| \`${cmd.name}\` | ${cmd.description.split('\n')[0]} |`);
|
|
131
|
+
}
|
|
132
|
+
lines.push('');
|
|
133
|
+
}
|
|
134
|
+
// Detailed Command Documentation
|
|
135
|
+
lines.push('## Command Details');
|
|
136
|
+
lines.push('');
|
|
137
|
+
for (const cmd of output.commands) {
|
|
138
|
+
lines.push(generateCommandMarkdown(cmd));
|
|
139
|
+
}
|
|
140
|
+
// Error Codes
|
|
141
|
+
lines.push('## Error Codes');
|
|
142
|
+
lines.push('');
|
|
143
|
+
lines.push('| Code | Description |');
|
|
144
|
+
lines.push('|------|-------------|');
|
|
145
|
+
for (const error of output.errorCodes) {
|
|
146
|
+
lines.push(`| \`${error.code}\` | ${error.description} |`);
|
|
147
|
+
}
|
|
148
|
+
lines.push('');
|
|
149
|
+
return lines.join('\n');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Extract command documentation from a command definition
|
|
153
|
+
*/
|
|
154
|
+
function extractCommandDoc(cmd, options) {
|
|
155
|
+
const doc = {
|
|
156
|
+
name: cmd.name,
|
|
157
|
+
category: cmd.category,
|
|
158
|
+
description: cmd.description,
|
|
159
|
+
};
|
|
160
|
+
if (options.includeSchemas) {
|
|
161
|
+
doc.inputSchema = toJsonSchema(cmd.inputSchema);
|
|
162
|
+
doc.outputSchema = toJsonSchema(cmd.outputSchema);
|
|
163
|
+
}
|
|
164
|
+
if (options.includeExamples && cmd.examples && cmd.examples.length > 0) {
|
|
165
|
+
doc.examples = cmd.examples.map((ex) => ({
|
|
166
|
+
input: ex.input,
|
|
167
|
+
description: ex.description,
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
// Extract error codes from description or use common ones
|
|
171
|
+
const errorPattern = /`([A-Z_]+)`/g;
|
|
172
|
+
const matches = cmd.description.match(errorPattern);
|
|
173
|
+
if (matches) {
|
|
174
|
+
doc.errors = matches.map((m) => m.replace(/`/g, ''));
|
|
175
|
+
}
|
|
176
|
+
return doc;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generate documentation from command registry
|
|
180
|
+
*/
|
|
181
|
+
export async function docsGenerate(input, _context) {
|
|
182
|
+
const parsed = DocsGenerateInputSchema.parse(input);
|
|
183
|
+
// Get all commands from registry
|
|
184
|
+
const allCommandSummaries = registry.list();
|
|
185
|
+
// Filter commands if pattern provided
|
|
186
|
+
let filteredSummaries = allCommandSummaries;
|
|
187
|
+
if (parsed.filter) {
|
|
188
|
+
const filter = parsed.filter;
|
|
189
|
+
filteredSummaries = allCommandSummaries.filter((cmd) => matchesGlob(cmd.name, filter));
|
|
190
|
+
}
|
|
191
|
+
// Get full command definitions and extract docs
|
|
192
|
+
const commands = [];
|
|
193
|
+
for (const summary of filteredSummaries) {
|
|
194
|
+
const cmd = registry.get(summary.name);
|
|
195
|
+
if (cmd) {
|
|
196
|
+
commands.push(extractCommandDoc(cmd, {
|
|
197
|
+
includeExamples: parsed.includeExamples,
|
|
198
|
+
includeSchemas: parsed.includeSchemas,
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Get unique categories
|
|
203
|
+
const categories = [...new Set(commands.map((c) => c.category))].sort();
|
|
204
|
+
// Build error codes list from ErrorCodes constant
|
|
205
|
+
const errorCodes = Object.entries(ErrorCodes).map(([key, value]) => ({
|
|
206
|
+
code: key,
|
|
207
|
+
description: value.replace(/_/g, ' ').toLowerCase(),
|
|
208
|
+
}));
|
|
209
|
+
const output = {
|
|
210
|
+
generated: new Date().toISOString(),
|
|
211
|
+
version: '1.0.0', // Could read from package.json
|
|
212
|
+
commandCount: commands.length,
|
|
213
|
+
categories,
|
|
214
|
+
commands: commands.sort((a, b) => a.name.localeCompare(b.name)),
|
|
215
|
+
errorCodes,
|
|
216
|
+
};
|
|
217
|
+
// Generate markdown if requested
|
|
218
|
+
if (parsed.format === 'markdown') {
|
|
219
|
+
output.markdown = generateFullMarkdown(output);
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
success: true,
|
|
223
|
+
data: output,
|
|
224
|
+
reasoning: `Generated documentation for ${commands.length} commands in ${categories.length} categories`,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// Command definition
|
|
228
|
+
export const docsGenerateCommand = {
|
|
229
|
+
name: 'docs.generate',
|
|
230
|
+
category: 'system',
|
|
231
|
+
description: 'Generate documentation from command registry. Produces command reference with schemas and examples.',
|
|
232
|
+
inputSchema: DocsGenerateInputSchema,
|
|
233
|
+
outputSchema: DocsGenerateOutputSchema,
|
|
234
|
+
handler: docsGenerate,
|
|
235
|
+
examples: [
|
|
236
|
+
{
|
|
237
|
+
description: 'Generate markdown documentation',
|
|
238
|
+
input: { format: 'markdown' },
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
description: 'Generate JSON documentation',
|
|
242
|
+
input: { format: 'json', includeSchemas: true },
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
description: 'Generate docs for node commands only',
|
|
246
|
+
input: { format: 'markdown', filter: 'node.*' },
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Register the docs.generate command
|
|
252
|
+
*/
|
|
253
|
+
export function registerDocsCommand() {
|
|
254
|
+
registry.register(docsGenerateCommand);
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/commands/docs/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAA+C,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvF,eAAe;AACf,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACxD,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1C,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CACrF,CAAC,CAAC;AA+BH,gBAAgB;AAChB,MAAM,CAAC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AAM,EAAE,UAAU,EAAE;SAC7B;QACD;YACC,WAAW,EAAE,6BAA6B;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;SAC/C;QACD;YACC,WAAW,EAAE,sCAAsC;YACnD,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC/C;KACD;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module docs
|
|
3
|
+
* Documentation generation commands
|
|
4
|
+
*/
|
|
5
|
+
export { docsGenerateCommand, registerDocsCommand, DocsGenerateInputSchema, DocsGenerateOutputSchema, type DocsGenerateInput, type DocsOutput, type CommandDoc, type ErrorCodeDoc, } from './generator.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GAKxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CommandDefinition } from '../registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Input schema for export command
|
|
5
|
+
*/
|
|
6
|
+
declare const InputSchema: z.ZodObject<{
|
|
7
|
+
nodeId: z.ZodString;
|
|
8
|
+
format: z.ZodEnum<{
|
|
9
|
+
css: "css";
|
|
10
|
+
dart: "dart";
|
|
11
|
+
json: "json";
|
|
12
|
+
kotlin: "kotlin";
|
|
13
|
+
lua: "lua";
|
|
14
|
+
scss: "scss";
|
|
15
|
+
swift: "swift";
|
|
16
|
+
tailwind: "tailwind";
|
|
17
|
+
typescript: "typescript";
|
|
18
|
+
}>;
|
|
19
|
+
output: z.ZodOptional<z.ZodString>;
|
|
20
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
21
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
22
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
23
|
+
pretty: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
includeComments: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
groupByCategory: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
+
exportStyle: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
flat: "flat";
|
|
28
|
+
nested: "nested";
|
|
29
|
+
}>>;
|
|
30
|
+
exportType: z.ZodDefault<z.ZodEnum<{
|
|
31
|
+
both: "both";
|
|
32
|
+
default: "default";
|
|
33
|
+
named: "named";
|
|
34
|
+
}>>;
|
|
35
|
+
className: z.ZodOptional<z.ZodString>;
|
|
36
|
+
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
internal: "internal";
|
|
38
|
+
private: "private";
|
|
39
|
+
public: "public";
|
|
40
|
+
}>>;
|
|
41
|
+
packageName: z.ZodOptional<z.ZodString>;
|
|
42
|
+
esm: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
themeMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
44
|
+
outputReferences: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
/**
|
|
47
|
+
* Output schema for export command
|
|
48
|
+
*/
|
|
49
|
+
declare const OutputSchema: z.ZodObject<{
|
|
50
|
+
format: z.ZodString;
|
|
51
|
+
content: z.ZodString;
|
|
52
|
+
tokenCount: z.ZodNumber;
|
|
53
|
+
nodeId: z.ZodString;
|
|
54
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
type Output = z.infer<typeof OutputSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Export command
|
|
59
|
+
*
|
|
60
|
+
* Export resolved tokens to various formats.
|
|
61
|
+
*/
|
|
62
|
+
export declare const exportCommand: CommandDefinition<typeof InputSchema, Output>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/commands/export/export.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAkB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCf,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,YAAY;;;;;;iBAMhB,CAAC;AAEH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,OAAO,WAAW,EAAE,MAAM,CA0JvE,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { InheritanceResolutionError, matchesGlob, resolveInheritance, transformerRegistry, } from '@lushly-dev/violet-core/engine';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ErrorCodes, failure, success } from '../../types/command-result.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input schema for export command
|
|
6
|
+
*/
|
|
7
|
+
const InputSchema = z.object({
|
|
8
|
+
nodeId: z.string().min(1),
|
|
9
|
+
format: z.enum([
|
|
10
|
+
'json',
|
|
11
|
+
'css',
|
|
12
|
+
'scss',
|
|
13
|
+
'typescript',
|
|
14
|
+
'swift',
|
|
15
|
+
'kotlin',
|
|
16
|
+
'dart',
|
|
17
|
+
'tailwind',
|
|
18
|
+
'lua',
|
|
19
|
+
]),
|
|
20
|
+
output: z.string().optional(), // File path (not used in handler, for CLI)
|
|
21
|
+
filter: z.string().optional(), // Glob pattern
|
|
22
|
+
prefix: z.string().optional(), // Variable prefix
|
|
23
|
+
selector: z.string().optional(), // CSS selector (default: :root)
|
|
24
|
+
pretty: z.boolean().default(true),
|
|
25
|
+
includeComments: z.boolean().default(false),
|
|
26
|
+
groupByCategory: z.boolean().default(false),
|
|
27
|
+
exportStyle: z.enum(['flat', 'nested']).default('nested'),
|
|
28
|
+
exportType: z.enum(['named', 'default', 'both']).default('both'),
|
|
29
|
+
// Mobile-specific options
|
|
30
|
+
className: z.string().optional(), // Swift/Kotlin/Dart class name
|
|
31
|
+
accessLevel: z.enum(['public', 'internal', 'private']).optional(), // Swift access level
|
|
32
|
+
packageName: z.string().optional(), // Kotlin package name
|
|
33
|
+
// Tailwind-specific options
|
|
34
|
+
esm: z.boolean().optional(), // Use ES modules for Tailwind config
|
|
35
|
+
// Lua-specific options
|
|
36
|
+
themeMap: z.record(z.string(), z.string()).optional(), // FenUI semantic name -> color token ID
|
|
37
|
+
// CSS-specific options
|
|
38
|
+
outputReferences: z.boolean().default(false), // Emit aliases as var(--target) instead of values
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Output schema for export command
|
|
42
|
+
*/
|
|
43
|
+
const OutputSchema = z.object({
|
|
44
|
+
format: z.string(),
|
|
45
|
+
content: z.string(),
|
|
46
|
+
tokenCount: z.number(),
|
|
47
|
+
nodeId: z.string(),
|
|
48
|
+
outputPath: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Export command
|
|
52
|
+
*
|
|
53
|
+
* Export resolved tokens to various formats.
|
|
54
|
+
*/
|
|
55
|
+
export const exportCommand = {
|
|
56
|
+
name: 'export',
|
|
57
|
+
description: 'Export tokens to various formats (json, css, scss, typescript, swift, kotlin, dart, tailwind, lua)',
|
|
58
|
+
category: 'export',
|
|
59
|
+
inputSchema: InputSchema,
|
|
60
|
+
outputSchema: OutputSchema,
|
|
61
|
+
async handler(rawInput, context) {
|
|
62
|
+
const input = InputSchema.parse(rawInput);
|
|
63
|
+
const { db } = context;
|
|
64
|
+
// Verify node exists
|
|
65
|
+
const node = await db.getNode(input.nodeId);
|
|
66
|
+
if (!node) {
|
|
67
|
+
return failure({
|
|
68
|
+
code: ErrorCodes.NODE_NOT_FOUND,
|
|
69
|
+
message: `Node '${input.nodeId}' not found`,
|
|
70
|
+
suggestion: `Use 'node.list' to see available nodes`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Get transformer
|
|
74
|
+
const transformer = transformerRegistry.get(input.format);
|
|
75
|
+
if (!transformer) {
|
|
76
|
+
return failure({
|
|
77
|
+
code: ErrorCodes.VALIDATION_ERROR,
|
|
78
|
+
message: `Unknown export format '${input.format}'`,
|
|
79
|
+
suggestion: 'Available formats: json, css, scss, typescript, swift, kotlin, dart, tailwind, lua',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Resolve tokens for node
|
|
83
|
+
// Uses the same resolver as tokens.resolve so exports always match it
|
|
84
|
+
// (overrides, resets, copies, includes and includePolicy).
|
|
85
|
+
const ancestryChain = await db.getAncestryChain(input.nodeId);
|
|
86
|
+
let tokens;
|
|
87
|
+
try {
|
|
88
|
+
tokens = (await resolveInheritance(db, input.nodeId, ancestryChain, false)).sort((a, b) => a.id.localeCompare(b.id));
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (error instanceof InheritanceResolutionError) {
|
|
92
|
+
return failure({
|
|
93
|
+
code: ErrorCodes.CIRCULAR_REFERENCE,
|
|
94
|
+
message: error.message,
|
|
95
|
+
suggestion: 'Remove the copy or include that creates the loop (see token.lineage / node.get) and export again',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
if (input.outputReferences && input.format !== 'css') {
|
|
101
|
+
return failure({
|
|
102
|
+
code: ErrorCodes.VALIDATION_ERROR,
|
|
103
|
+
message: `outputReferences is only supported for css exports, not ${input.format}`,
|
|
104
|
+
suggestion: 'Drop outputReferences to export resolved values',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Apply filter if provided. References were already followed against the
|
|
108
|
+
// whole node, so a filtered token can still point at one left out.
|
|
109
|
+
let filteredTokens = tokens;
|
|
110
|
+
if (input.filter) {
|
|
111
|
+
const filter = input.filter;
|
|
112
|
+
filteredTokens = tokens.filter((t) => matchesGlob(t.id, filter));
|
|
113
|
+
}
|
|
114
|
+
// Exports never emit unresolved aliases: fail on the first broken reference.
|
|
115
|
+
const broken = filteredTokens.find((t) => t.referenceError);
|
|
116
|
+
if (broken?.referenceError) {
|
|
117
|
+
const { code, message } = broken.referenceError;
|
|
118
|
+
return failure({
|
|
119
|
+
code: ErrorCodes[code],
|
|
120
|
+
message,
|
|
121
|
+
suggestion: code === 'NOT_IMPLEMENTED'
|
|
122
|
+
? `Replace the transform on '${broken.id}' with a literal value`
|
|
123
|
+
: code === 'CIRCULAR_REFERENCE'
|
|
124
|
+
? `Point one of the tokens in the loop at a literal value (see tokens.resolve for '${input.nodeId}')`
|
|
125
|
+
: `Add the referenced token to '${input.nodeId}' or one of its ancestors, or fix the reference on '${broken.id}'`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// Transform. Transformers throw when options don't fit the tokens
|
|
129
|
+
// (e.g. a Lua themeMap entry that names a missing color).
|
|
130
|
+
let content;
|
|
131
|
+
try {
|
|
132
|
+
content = transformer.transform(filteredTokens, {
|
|
133
|
+
prefix: input.prefix,
|
|
134
|
+
selector: input.selector,
|
|
135
|
+
pretty: input.pretty,
|
|
136
|
+
includeComments: input.includeComments,
|
|
137
|
+
groupByCategory: input.groupByCategory,
|
|
138
|
+
exportStyle: input.exportStyle,
|
|
139
|
+
exportType: input.exportType,
|
|
140
|
+
// Mobile-specific options
|
|
141
|
+
className: input.className,
|
|
142
|
+
accessLevel: input.accessLevel,
|
|
143
|
+
packageName: input.packageName,
|
|
144
|
+
// Tailwind-specific options
|
|
145
|
+
esm: input.esm,
|
|
146
|
+
// Lua-specific options
|
|
147
|
+
themeMap: input.themeMap,
|
|
148
|
+
// CSS-specific options
|
|
149
|
+
outputReferences: input.outputReferences,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
return failure({
|
|
154
|
+
code: ErrorCodes.VALIDATION_ERROR,
|
|
155
|
+
message: `Export to ${input.format} failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
156
|
+
suggestion: 'Check the export options against the tokens in this node',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return success({
|
|
160
|
+
format: input.format,
|
|
161
|
+
content,
|
|
162
|
+
tokenCount: filteredTokens.length,
|
|
163
|
+
nodeId: input.nodeId,
|
|
164
|
+
outputPath: input.output,
|
|
165
|
+
}, {
|
|
166
|
+
reasoning: `Exported ${filteredTokens.length} tokens from '${input.nodeId}' to ${input.format} format`,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
examples: [
|
|
170
|
+
{
|
|
171
|
+
description: 'Export to CSS',
|
|
172
|
+
input: { nodeId: 'global-base', format: 'css' },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
description: 'Export to CSS, keeping aliases as var() references',
|
|
176
|
+
input: { nodeId: 'global-base', format: 'css', outputReferences: true },
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
description: 'Export to JSON with filter',
|
|
180
|
+
input: { nodeId: 'global-base', format: 'json', filter: 'color.*' },
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
description: 'Export to TypeScript with prefix',
|
|
184
|
+
input: {
|
|
185
|
+
nodeId: 'global-base',
|
|
186
|
+
format: 'typescript',
|
|
187
|
+
prefix: 'vlt',
|
|
188
|
+
exportStyle: 'flat',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/commands/export/export.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,0BAA0B,EAC1B,WAAW,EACX,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;QACd,MAAM;QACN,KAAK;QACL,MAAM;QACN,YAAY;QACZ,OAAO;QACP,QAAQ;QACR,MAAM;QACN,UAAU;QACV,KAAK;KACL,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,2CAA2C;IAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,eAAe;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,kBAAkB;IACjD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,gCAAgC;IACjE,MAAM,EAAE,CAAC,CAAC,O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d.ts","sourceRoot":"","sources":["../../../src/commands/export/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Commands
|
|
3
|
+
*/
|
|
4
|
+
import { registry } from '../registry.js';
|
|
5
|
+
import { exportCommand } from './export.js';
|
|
6
|
+
export { exportCommand } from './export.js';
|
|
7
|
+
/**
|
|
8
|
+
* Register all export commands
|
|
9
|
+
*/
|
|
10
|
+
export function registerExportCommands() {
|
|
11
|
+
registry.register(exportCommand);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/export/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TokenMetadata } from '@lushly-dev/violet-core/types';
|
|
2
|
+
/**
|
|
3
|
+
* A token read from an import file
|
|
4
|
+
*/
|
|
5
|
+
export interface FlatToken {
|
|
6
|
+
id: string;
|
|
7
|
+
value: unknown;
|
|
8
|
+
/** Metadata read from `$type` / `$description` (DTCG only) and the tier group */
|
|
9
|
+
metadata?: Partial<TokenMetadata>;
|
|
10
|
+
}
|
|
11
|
+
interface FlattenOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Treat top-level `global` / `semantic` / `component` groups as tiers: the
|
|
14
|
+
* group is left out of the token ID and stored as `metadata.tier`.
|
|
15
|
+
*/
|
|
16
|
+
tiers?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Flatten a token file, optionally reading top-level tier groups (see FlattenOptions)
|
|
20
|
+
*
|
|
21
|
+
* With `tiers`: `{ semantic: { color: { accent: { $value: "{color.gold}" } } } }`
|
|
22
|
+
* -> [{ id: "color.accent", value: "{color.gold}", metadata: { tier: "semantic" } }]
|
|
23
|
+
*/
|
|
24
|
+
export declare function flattenTokenFile(obj: Record<string, unknown>, prefix?: string, options?: FlattenOptions): FlatToken[];
|
|
25
|
+
/**
|
|
26
|
+
* Token IDs that appear more than once (e.g. the same path in two tier groups)
|
|
27
|
+
*/
|
|
28
|
+
export declare function findDuplicateTokenIds(tokens: FlatToken[]): string[];
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/commands/import/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAa,MAAM,+BAA+B,CAAC;AAG7F;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED,UAAU,cAAc;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE,cAAmB,GAC1B,SAAS,EAAE,CAsBb;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAQnE"}
|