@rien7/design-surface 0.0.0-stage → 0.1.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/bin/design-surface.mjs +286 -0
- package/dist/cli/init.mjs +411 -0
- package/dist/cli/propose.mjs +172 -0
- package/dist/cli/reviewOps.mjs +127 -0
- package/dist/editor/AgentProposalCard.d.ts +10 -0
- package/dist/editor/AgentProposalCard.d.ts.map +1 -0
- package/dist/editor/AgentProposalCard.js +28 -0
- package/dist/editor/AgentProposalCard.js.map +1 -0
- package/dist/editor/App.d.ts +2 -0
- package/dist/editor/App.d.ts.map +1 -0
- package/dist/editor/App.js +1813 -0
- package/dist/editor/App.js.map +1 -0
- package/dist/editor/CanvasHud.d.ts +12 -0
- package/dist/editor/CanvasHud.d.ts.map +1 -0
- package/dist/editor/CanvasHud.js +13 -0
- package/dist/editor/CanvasHud.js.map +1 -0
- package/dist/editor/CanvasSurface.d.ts +20 -0
- package/dist/editor/CanvasSurface.d.ts.map +1 -0
- package/dist/editor/CanvasSurface.js +252 -0
- package/dist/editor/CanvasSurface.js.map +1 -0
- package/dist/editor/Changes.d.ts +17 -0
- package/dist/editor/Changes.d.ts.map +1 -0
- package/dist/editor/Changes.js +59 -0
- package/dist/editor/Changes.js.map +1 -0
- package/dist/editor/CommentPopover.d.ts +17 -0
- package/dist/editor/CommentPopover.d.ts.map +1 -0
- package/dist/editor/CommentPopover.js +62 -0
- package/dist/editor/CommentPopover.js.map +1 -0
- package/dist/editor/Comments.d.ts +13 -0
- package/dist/editor/Comments.d.ts.map +1 -0
- package/dist/editor/Comments.js +39 -0
- package/dist/editor/Comments.js.map +1 -0
- package/dist/editor/History.d.ts +7 -0
- package/dist/editor/History.d.ts.map +1 -0
- package/dist/editor/History.js +43 -0
- package/dist/editor/History.js.map +1 -0
- package/dist/editor/Inspector.d.ts +22 -0
- package/dist/editor/Inspector.d.ts.map +1 -0
- package/dist/editor/Inspector.js +241 -0
- package/dist/editor/Inspector.js.map +1 -0
- package/dist/editor/LazyMount.d.ts +10 -0
- package/dist/editor/LazyMount.d.ts.map +1 -0
- package/dist/editor/LazyMount.js +29 -0
- package/dist/editor/LazyMount.js.map +1 -0
- package/dist/editor/LocaleSwitch.d.ts +2 -0
- package/dist/editor/LocaleSwitch.d.ts.map +1 -0
- package/dist/editor/LocaleSwitch.js +13 -0
- package/dist/editor/LocaleSwitch.js.map +1 -0
- package/dist/editor/NodeInspector.d.ts +9 -0
- package/dist/editor/NodeInspector.d.ts.map +1 -0
- package/dist/editor/NodeInspector.js +9 -0
- package/dist/editor/NodeInspector.js.map +1 -0
- package/dist/editor/PreviewFrame.d.ts +10 -0
- package/dist/editor/PreviewFrame.d.ts.map +1 -0
- package/dist/editor/PreviewFrame.js +22 -0
- package/dist/editor/PreviewFrame.js.map +1 -0
- package/dist/editor/ProjectIndex.d.ts +12 -0
- package/dist/editor/ProjectIndex.d.ts.map +1 -0
- package/dist/editor/ProjectIndex.js +43 -0
- package/dist/editor/ProjectIndex.js.map +1 -0
- package/dist/editor/StyleEditor.d.ts +37 -0
- package/dist/editor/StyleEditor.d.ts.map +1 -0
- package/dist/editor/StyleEditor.js +275 -0
- package/dist/editor/StyleEditor.js.map +1 -0
- package/dist/editor/TokenWorkbench.d.ts +37 -0
- package/dist/editor/TokenWorkbench.d.ts.map +1 -0
- package/dist/editor/TokenWorkbench.js +146 -0
- package/dist/editor/TokenWorkbench.js.map +1 -0
- package/dist/editor/Tokens.d.ts +21 -0
- package/dist/editor/Tokens.d.ts.map +1 -0
- package/dist/editor/Tokens.js +56 -0
- package/dist/editor/Tokens.js.map +1 -0
- package/dist/editor/VariablesPage.d.ts +28 -0
- package/dist/editor/VariablesPage.d.ts.map +1 -0
- package/dist/editor/VariablesPage.js +14 -0
- package/dist/editor/VariablesPage.js.map +1 -0
- package/dist/editor/api.d.ts +13 -0
- package/dist/editor/api.d.ts.map +1 -0
- package/dist/editor/api.js +70 -0
- package/dist/editor/api.js.map +1 -0
- package/dist/editor/camera.d.ts +18 -0
- package/dist/editor/camera.d.ts.map +1 -0
- package/dist/editor/camera.js +40 -0
- package/dist/editor/camera.js.map +1 -0
- package/dist/editor/canvas.d.ts +26 -0
- package/dist/editor/canvas.d.ts.map +1 -0
- package/dist/editor/canvas.js +51 -0
- package/dist/editor/canvas.js.map +1 -0
- package/dist/editor/chrome/EditorChrome.d.ts +42 -0
- package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
- package/dist/editor/chrome/EditorChrome.js +21 -0
- package/dist/editor/chrome/EditorChrome.js.map +1 -0
- package/dist/editor/i18n.d.ts +18 -0
- package/dist/editor/i18n.d.ts.map +1 -0
- package/dist/editor/i18n.js +762 -0
- package/dist/editor/i18n.js.map +1 -0
- package/dist/editor/main.d.ts +3 -0
- package/dist/editor/main.d.ts.map +1 -0
- package/dist/editor/main.js +12 -0
- package/dist/editor/main.js.map +1 -0
- package/dist/editor/model.d.ts +17 -0
- package/dist/editor/model.d.ts.map +1 -0
- package/dist/editor/model.js +12 -0
- package/dist/editor/model.js.map +1 -0
- package/dist/editor/reviewLifecycle.d.ts +9 -0
- package/dist/editor/reviewLifecycle.d.ts.map +1 -0
- package/dist/editor/reviewLifecycle.js +30 -0
- package/dist/editor/reviewLifecycle.js.map +1 -0
- package/dist/editor/styles.css +6626 -0
- package/dist/editor/ui/Button.d.ts +3 -0
- package/dist/editor/ui/Button.d.ts.map +1 -0
- package/dist/editor/ui/Button.js +6 -0
- package/dist/editor/ui/Button.js.map +1 -0
- package/dist/editor/ui/CommentBox.d.ts +23 -0
- package/dist/editor/ui/CommentBox.d.ts.map +1 -0
- package/dist/editor/ui/CommentBox.js +41 -0
- package/dist/editor/ui/CommentBox.js.map +1 -0
- package/dist/editor/ui/Icon.d.ts +9 -0
- package/dist/editor/ui/Icon.d.ts.map +1 -0
- package/dist/editor/ui/Icon.js +6 -0
- package/dist/editor/ui/Icon.js.map +1 -0
- package/dist/editor/ui/IconButton.d.ts +11 -0
- package/dist/editor/ui/IconButton.d.ts.map +1 -0
- package/dist/editor/ui/IconButton.js +6 -0
- package/dist/editor/ui/IconButton.js.map +1 -0
- package/dist/editor/ui/NumberInput.d.ts +14 -0
- package/dist/editor/ui/NumberInput.d.ts.map +1 -0
- package/dist/editor/ui/NumberInput.js +6 -0
- package/dist/editor/ui/NumberInput.js.map +1 -0
- package/dist/editor/ui/PageLine.d.ts +14 -0
- package/dist/editor/ui/PageLine.d.ts.map +1 -0
- package/dist/editor/ui/PageLine.js +7 -0
- package/dist/editor/ui/PageLine.js.map +1 -0
- package/dist/editor/ui/Select.d.ts +15 -0
- package/dist/editor/ui/Select.d.ts.map +1 -0
- package/dist/editor/ui/Select.js +11 -0
- package/dist/editor/ui/Select.js.map +1 -0
- package/dist/editor/ui/TokenField.d.ts +14 -0
- package/dist/editor/ui/TokenField.d.ts.map +1 -0
- package/dist/editor/ui/TokenField.js +41 -0
- package/dist/editor/ui/TokenField.js.map +1 -0
- package/dist/editor-ui.d.ts +14 -0
- package/dist/editor-ui.d.ts.map +1 -0
- package/dist/editor-ui.js +13 -0
- package/dist/editor-ui.js.map +1 -0
- package/dist/inspector/runtime.d.ts +18 -0
- package/dist/inspector/runtime.d.ts.map +1 -0
- package/dist/inspector/runtime.js +987 -0
- package/dist/inspector/runtime.js.map +1 -0
- package/dist/preview/main.d.ts +3 -0
- package/dist/preview/main.d.ts.map +1 -0
- package/dist/preview/main.js +72 -0
- package/dist/preview/main.js.map +1 -0
- package/dist/preview/preview.css +39 -0
- package/dist/runtime/flow.d.ts +15 -0
- package/dist/runtime/flow.d.ts.map +1 -0
- package/dist/runtime/flow.js +48 -0
- package/dist/runtime/flow.js.map +1 -0
- package/dist/runtime/free.d.ts +18 -0
- package/dist/runtime/free.d.ts.map +1 -0
- package/dist/runtime/free.js +8 -0
- package/dist/runtime/free.js.map +1 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +46 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/types.d.ts +57 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +14 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/shared/prompt.d.mts +13 -0
- package/dist/shared/prompt.mjs +97 -0
- package/dist/shared/protocol.d.ts +79 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +7 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/shared/tokens.d.ts +66 -0
- package/dist/shared/tokens.d.ts.map +1 -0
- package/dist/shared/tokens.js +2 -0
- package/dist/shared/tokens.js.map +1 -0
- package/dist/shared/types.d.ts +301 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +13 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tokens/adapters/css.mjs +44 -0
- package/dist/tokens/adapters/cssInCode.mjs +277 -0
- package/dist/tokens/adapters/oxcShared.mjs +59 -0
- package/dist/tokens/adapters/preprocessor.mjs +63 -0
- package/dist/tokens/adapters/registry.mjs +53 -0
- package/dist/tokens/adapters/tailwindcss.mjs +360 -0
- package/dist/tokens/adapters/types.mjs +117 -0
- package/dist/tokens/extract.mjs +328 -0
- package/dist/tokens/pipeline.mjs +688 -0
- package/dist/vite/events.d.ts +25 -0
- package/dist/vite/events.d.ts.map +1 -0
- package/dist/vite/events.js +137 -0
- package/dist/vite/events.js.map +1 -0
- package/dist/vite/layout.d.ts +4 -0
- package/dist/vite/layout.d.ts.map +1 -0
- package/dist/vite/layout.js +78 -0
- package/dist/vite/layout.js.map +1 -0
- package/dist/vite/plugin.d.ts +33 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +403 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/review.d.ts +7 -0
- package/dist/vite/review.d.ts.map +1 -0
- package/dist/vite/review.js +334 -0
- package/dist/vite/review.js.map +1 -0
- package/package.json +86 -4
- package/skills/design-surface/SKILL.md +190 -0
- package/skills/design-surface-authoring/SKILL.md +257 -0
- package/skills/design-surface-tokens/SKILL.md +235 -0
- package/README.md +0 -3
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import process from 'node:process'
|
|
5
|
+
|
|
6
|
+
const runtimeBase = fs.existsSync(new URL('../dist/cli/init.mjs', import.meta.url))
|
|
7
|
+
? '../dist'
|
|
8
|
+
: '../src'
|
|
9
|
+
|
|
10
|
+
const { initDesignSurface } = await import(`${runtimeBase}/cli/init.mjs`)
|
|
11
|
+
const { proposeToken } = await import(`${runtimeBase}/cli/propose.mjs`)
|
|
12
|
+
const { replyReviewItem, updateReviewItemStatus } = await import(`${runtimeBase}/cli/reviewOps.mjs`)
|
|
13
|
+
const { buildAgentPrompt, isCopyableReviewItem, isUnreviewedProposal } = await import(
|
|
14
|
+
`${runtimeBase}/shared/prompt.mjs`
|
|
15
|
+
)
|
|
16
|
+
const { extractTokensFromCss } = await import(`${runtimeBase}/tokens/extract.mjs`)
|
|
17
|
+
const { runTokenPipeline } = await import(`${runtimeBase}/tokens/pipeline.mjs`)
|
|
18
|
+
|
|
19
|
+
const root = process.cwd()
|
|
20
|
+
const designRoot = path.join(root, 'design')
|
|
21
|
+
|
|
22
|
+
const usage = `design-surface — inspect the design review ledger, tokens, and project setup
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
design-surface init [--css-format theme|root] [--no-skills]
|
|
26
|
+
design-surface tokens build
|
|
27
|
+
design-surface tokens check
|
|
28
|
+
design-surface tokens extract [files...] [--dry-run]
|
|
29
|
+
design-surface propose token <design> --name <--token> [--value <val>] [--tier <tier>] [--alias <path>] [--type <type>] [--action <action>] [--rationale <text>]
|
|
30
|
+
design-surface status <design> <itemId> <in_progress|resolved> [--reply "<summary>"]
|
|
31
|
+
design-surface reply <design> <itemId> "<message>" [--resolve]
|
|
32
|
+
design-surface list
|
|
33
|
+
design-surface show <design>
|
|
34
|
+
design-surface prompt <design>
|
|
35
|
+
design-surface check
|
|
36
|
+
design-surface clear <design>
|
|
37
|
+
|
|
38
|
+
Review ledgers live in design/<design>/review.json and are tracked. A ledger contains
|
|
39
|
+
design-scoped tokens, frame/component-scoped styles, free layout, suggestions and comments.
|
|
40
|
+
Agents update item status/replies in place. Resolved non-token items are archived after
|
|
41
|
+
10 minutes; token items are archived only after the surface writes verifiedAt and 10 minutes pass.
|
|
42
|
+
`
|
|
43
|
+
|
|
44
|
+
const fail = (message) => {
|
|
45
|
+
console.error(`design-surface: ${message}`)
|
|
46
|
+
process.exit(1)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const readJson = (file) => {
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
52
|
+
} catch {
|
|
53
|
+
return null
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const reviewFiles = () => {
|
|
58
|
+
if (!fs.existsSync(designRoot)) return []
|
|
59
|
+
const files = []
|
|
60
|
+
for (const entry of fs.readdirSync(designRoot, { withFileTypes: true })) {
|
|
61
|
+
if (!entry.isDirectory()) continue
|
|
62
|
+
const file = path.join(designRoot, entry.name, 'review.json')
|
|
63
|
+
if (fs.existsSync(file)) files.push({ design: entry.name, file })
|
|
64
|
+
}
|
|
65
|
+
return files.sort((a, b) => a.design.localeCompare(b.design))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const pending = (items) => (items ?? []).filter((item) => item.status !== 'archived')
|
|
69
|
+
const countBy = (items, status) =>
|
|
70
|
+
(items ?? []).filter((item) => item.status === status).length
|
|
71
|
+
|
|
72
|
+
const command = process.argv[2]
|
|
73
|
+
const arg = process.argv[3]
|
|
74
|
+
|
|
75
|
+
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
76
|
+
console.log(usage)
|
|
77
|
+
process.exit(0)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (command === 'init') {
|
|
81
|
+
const initArgs = process.argv.slice(3)
|
|
82
|
+
let cssFormat
|
|
83
|
+
let copySkills = true
|
|
84
|
+
for (let i = 0; i < initArgs.length; i += 1) {
|
|
85
|
+
const token = initArgs[i]
|
|
86
|
+
if (token === '--no-skills') {
|
|
87
|
+
copySkills = false
|
|
88
|
+
} else if (token === '--css-format') {
|
|
89
|
+
const next = initArgs[i + 1]
|
|
90
|
+
if (!next) fail('--css-format requires "theme" or "root"')
|
|
91
|
+
cssFormat = next
|
|
92
|
+
i += 1
|
|
93
|
+
} else if (token.startsWith('--css-format=')) {
|
|
94
|
+
cssFormat = token.slice('--css-format='.length)
|
|
95
|
+
} else {
|
|
96
|
+
fail(`unknown init option: ${token}`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (cssFormat !== undefined && cssFormat !== 'theme' && cssFormat !== 'root') {
|
|
100
|
+
fail(`invalid --css-format "${cssFormat}". Expected "theme" or "root".`)
|
|
101
|
+
}
|
|
102
|
+
const { results, viteSnippet, agentGuideSnippet } = await initDesignSurface({
|
|
103
|
+
root,
|
|
104
|
+
cssFormat,
|
|
105
|
+
copySkills,
|
|
106
|
+
})
|
|
107
|
+
for (const item of results) {
|
|
108
|
+
console.log(`${item.status === 'created' ? 'CREATE' : 'SKIP '} ${item.file}`)
|
|
109
|
+
}
|
|
110
|
+
console.log('\nAdd designPlugin to vite.config.ts:\n')
|
|
111
|
+
console.log(viteSnippet)
|
|
112
|
+
console.log('\nOptional AGENTS.md / CLAUDE.md snippet:\n')
|
|
113
|
+
console.log(agentGuideSnippet)
|
|
114
|
+
console.log('\nNext steps:')
|
|
115
|
+
console.log(' 1. Import ./tokens.generated.css in your app CSS (e.g. src/index.css)')
|
|
116
|
+
console.log(' 2. Start Vite dev server and open /__design')
|
|
117
|
+
process.exit(0)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (command === 'tokens') {
|
|
121
|
+
const sub = arg
|
|
122
|
+
if (sub === 'build' || sub === 'check') {
|
|
123
|
+
try {
|
|
124
|
+
const check = sub === 'check'
|
|
125
|
+
const { counts, warnings, contrast, unsupported } = await runTokenPipeline({ root, check })
|
|
126
|
+
console.log(
|
|
127
|
+
`Tokens ${check ? 'OK' : 'built'}: ${counts.total} total · ${counts.byTier.primitive} primitive · ${counts.byTier.semantic} semantic · ${counts.byTier.component} component`,
|
|
128
|
+
)
|
|
129
|
+
for (const warning of warnings) console.warn(`Warning: ${warning}`)
|
|
130
|
+
for (const item of unsupported ?? []) {
|
|
131
|
+
console.log(
|
|
132
|
+
`Unsupported [${item.adapter}] ${item.file}${item.line ? `:${item.line}` : ''}: ${item.reason} (${item.count})`,
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
for (const item of contrast) {
|
|
136
|
+
console.log(`Contrast ${item.fg} on ${item.bg}: ${item.ratio}:1 ${item.pass ? 'PASS' : 'FAIL'}`)
|
|
137
|
+
}
|
|
138
|
+
process.exit(0)
|
|
139
|
+
} catch (error) {
|
|
140
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (sub === 'extract') {
|
|
144
|
+
const rest = process.argv.slice(4)
|
|
145
|
+
const dryRun = rest.includes('--dry-run')
|
|
146
|
+
const files = rest.filter((item) => item !== '--dry-run')
|
|
147
|
+
try {
|
|
148
|
+
const result = await extractTokensFromCss({ root, files, dryRun })
|
|
149
|
+
console.log(
|
|
150
|
+
`${dryRun ? '[dry-run] ' : ''}Scanned ${result.scannedFiles.length} CSS file(s): ${result.addedPrimitives.length} primitive, ${result.addedSemantics.length} semantic, ${result.skippedExisting.length} existing skipped`,
|
|
151
|
+
)
|
|
152
|
+
if (result.addedPrimitives.length) {
|
|
153
|
+
console.log(`Primitive (${result.primitiveFile}):`)
|
|
154
|
+
for (const item of result.addedPrimitives) {
|
|
155
|
+
console.log(` + ${item.path} (${item.cssName}): ${JSON.stringify(item.value)} [${item.type}]`)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (result.addedSemantics.length) {
|
|
159
|
+
console.log(`Semantic (${result.semanticFile}):`)
|
|
160
|
+
for (const item of result.addedSemantics) {
|
|
161
|
+
console.log(` + ${item.path} (${item.cssName}): ${item.value} [${item.type}]`)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (!dryRun && (result.addedPrimitives.length || result.addedSemantics.length)) {
|
|
165
|
+
console.log('Run `design-surface tokens build` to regenerate CSS and TS metadata.')
|
|
166
|
+
}
|
|
167
|
+
process.exit(0)
|
|
168
|
+
} catch (error) {
|
|
169
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
fail(`unknown tokens subcommand: ${sub ?? '(missing)'} (expected build, check, or extract)`)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (command === 'propose') {
|
|
176
|
+
if (arg !== 'token') {
|
|
177
|
+
fail(`unknown propose target: ${arg ?? '(missing)'} (expected "token")`)
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
const { item, reviewPath } = proposeToken({ root, argv: process.argv.slice(4) })
|
|
181
|
+
const rel = path.relative(root, reviewPath).split(path.sep).join('/')
|
|
182
|
+
console.log(
|
|
183
|
+
`Proposed ${item.target.token} (${item.tokenTier ?? 'semantic'} · ${item.tokenAction ?? 'create'} -> ${item.to}) in ${rel}`,
|
|
184
|
+
)
|
|
185
|
+
process.exit(0)
|
|
186
|
+
} catch (error) {
|
|
187
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (command === 'reply') {
|
|
192
|
+
try {
|
|
193
|
+
const { item } = replyReviewItem({ root, argv: process.argv.slice(3) })
|
|
194
|
+
console.log(`Replied to ${item.id} (${item.status})`)
|
|
195
|
+
process.exit(0)
|
|
196
|
+
} catch (error) {
|
|
197
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (command === 'status') {
|
|
202
|
+
try {
|
|
203
|
+
const { item } = updateReviewItemStatus({ root, argv: process.argv.slice(3) })
|
|
204
|
+
console.log(`Updated ${item.id} -> ${item.status}`)
|
|
205
|
+
process.exit(0)
|
|
206
|
+
} catch (error) {
|
|
207
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (command === 'list') {
|
|
212
|
+
const files = reviewFiles()
|
|
213
|
+
if (!files.length) {
|
|
214
|
+
console.log('No review ledgers.')
|
|
215
|
+
process.exit(0)
|
|
216
|
+
}
|
|
217
|
+
for (const item of files) {
|
|
218
|
+
const review = readJson(item.file)
|
|
219
|
+
const items = review?.items ?? []
|
|
220
|
+
const awaitingApproval = items.filter(isUnreviewedProposal).length
|
|
221
|
+
const approvalSuffix = awaitingApproval ? `, ${awaitingApproval} awaiting approval` : ''
|
|
222
|
+
console.log(
|
|
223
|
+
`${item.design}: ${pending(items).length} pending — ${countBy(items, 'open')} open, ${countBy(items, 'in_progress')} in progress, ${countBy(items, 'resolved')} resolved, ${countBy(items, 'archived')} archived${approvalSuffix}`,
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
process.exit(0)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (command === 'show') {
|
|
230
|
+
if (!arg) fail('show requires a design id')
|
|
231
|
+
const file = path.join(designRoot, arg, 'review.json')
|
|
232
|
+
const review = readJson(file)
|
|
233
|
+
if (!review) fail(`no review ledger for ${arg}`)
|
|
234
|
+
console.log(JSON.stringify(review, null, 2))
|
|
235
|
+
process.exit(0)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (command === 'clear') {
|
|
239
|
+
if (!arg) fail('clear requires a design id')
|
|
240
|
+
const file = path.join(designRoot, arg, 'review.json')
|
|
241
|
+
const review = readJson(file)
|
|
242
|
+
if (!review) fail(`no review ledger for ${arg}`)
|
|
243
|
+
const items = (review.items ?? []).filter(
|
|
244
|
+
(item) => item.status === 'archived' || item.kind === 'comment',
|
|
245
|
+
)
|
|
246
|
+
fs.writeFileSync(file, `${JSON.stringify({ ...review, items, updatedAt: new Date().toISOString() }, null, 2)}\n`)
|
|
247
|
+
console.log(`cleared pending non-comment items for ${arg}`)
|
|
248
|
+
process.exit(0)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (command === 'prompt') {
|
|
252
|
+
if (!arg) fail('prompt requires a design id')
|
|
253
|
+
const file = path.join(designRoot, arg, 'review.json')
|
|
254
|
+
const review = readJson(file)
|
|
255
|
+
if (!review) fail(`no review ledger for ${arg}`)
|
|
256
|
+
const allPending = pending(review.items)
|
|
257
|
+
const items = allPending.filter(isCopyableReviewItem)
|
|
258
|
+
if (!items.length) {
|
|
259
|
+
const unreviewed = allPending.filter(isUnreviewedProposal).length
|
|
260
|
+
if (unreviewed) {
|
|
261
|
+
fail(`no actionable review items for ${arg} (${unreviewed} agent proposal(s) awaiting human approval)`)
|
|
262
|
+
}
|
|
263
|
+
fail(`no pending review items for ${arg}`)
|
|
264
|
+
}
|
|
265
|
+
console.log(buildAgentPrompt({ design: arg, items }))
|
|
266
|
+
process.exit(0)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (command === 'check') {
|
|
270
|
+
const files = reviewFiles()
|
|
271
|
+
let failed = false
|
|
272
|
+
for (const item of files) {
|
|
273
|
+
const review = readJson(item.file)
|
|
274
|
+
if (!review || review.version !== 1 || !Array.isArray(review.items)) {
|
|
275
|
+
console.error(`INVALID ${item.design}: review.json must contain version 1 and items[]`)
|
|
276
|
+
failed = true
|
|
277
|
+
continue
|
|
278
|
+
}
|
|
279
|
+
console.log(`OK ${item.design}: ${review.items.length} item(s), ${(review.batches ?? []).length} batch(es)`)
|
|
280
|
+
}
|
|
281
|
+
if (failed) process.exit(1)
|
|
282
|
+
if (!files.length) console.log('No review ledgers.')
|
|
283
|
+
process.exit(0)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
fail(`unknown command: ${command}`)
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, join, relative, sep } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
import { DEFAULT_TOKEN_CONFIG, runTokenPipeline } from '../tokens/pipeline.mjs'
|
|
6
|
+
|
|
7
|
+
const SKILL_NAMES = ['design-surface', 'design-surface-tokens', 'design-surface-authoring']
|
|
8
|
+
|
|
9
|
+
export function detectCssFormat(root) {
|
|
10
|
+
const pkgPath = join(root, 'package.json')
|
|
11
|
+
if (!existsSync(pkgPath)) return 'root'
|
|
12
|
+
try {
|
|
13
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
|
|
14
|
+
const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) }
|
|
15
|
+
if ('@tailwindcss/vite' in deps) return 'theme'
|
|
16
|
+
const twVersion = deps.tailwindcss
|
|
17
|
+
if (typeof twVersion === 'string') {
|
|
18
|
+
const trimmed = twVersion.trim()
|
|
19
|
+
if (/(?:^|\|\||\s)(?:[\^~v]*|>=?\s*)4(?:\.|$)/.test(trimmed)) {
|
|
20
|
+
return 'theme'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
// ignore malformed package.json
|
|
25
|
+
}
|
|
26
|
+
return 'root'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function copyDirNonDestructive(srcDir, dstDir, root, results) {
|
|
30
|
+
if (!existsSync(srcDir)) return
|
|
31
|
+
for (const entry of readdirSync(srcDir).sort()) {
|
|
32
|
+
const srcPath = join(srcDir, entry)
|
|
33
|
+
const dstPath = join(dstDir, entry)
|
|
34
|
+
const stat = statSync(srcPath)
|
|
35
|
+
if (stat.isDirectory()) {
|
|
36
|
+
copyDirNonDestructive(srcPath, dstPath, root, results)
|
|
37
|
+
} else {
|
|
38
|
+
const rel = relative(root, dstPath).split(sep).join('/')
|
|
39
|
+
if (existsSync(dstPath)) {
|
|
40
|
+
results.push({ file: rel, status: 'skipped' })
|
|
41
|
+
continue
|
|
42
|
+
}
|
|
43
|
+
mkdirSync(dirname(dstPath), { recursive: true })
|
|
44
|
+
copyFileSync(srcPath, dstPath)
|
|
45
|
+
results.push({ file: rel, status: 'created' })
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const STARTER_PRIMITIVE = {
|
|
51
|
+
color: {
|
|
52
|
+
$extensions: {
|
|
53
|
+
'design-surface': {
|
|
54
|
+
tier: 'primitive',
|
|
55
|
+
group: 'color',
|
|
56
|
+
label: 'Color',
|
|
57
|
+
labelZh: '颜色',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
$type: 'color',
|
|
61
|
+
ink: {
|
|
62
|
+
$type: 'color',
|
|
63
|
+
$value: '#18181b',
|
|
64
|
+
$extensions: {
|
|
65
|
+
'design-surface': {
|
|
66
|
+
label: 'Ink',
|
|
67
|
+
labelZh: '墨色',
|
|
68
|
+
uiType: 'color',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
surface: {
|
|
73
|
+
$type: 'color',
|
|
74
|
+
$value: '#ffffff',
|
|
75
|
+
$extensions: {
|
|
76
|
+
'design-surface': {
|
|
77
|
+
label: 'Surface',
|
|
78
|
+
labelZh: '表面',
|
|
79
|
+
uiType: 'color',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
canvas: {
|
|
84
|
+
$type: 'color',
|
|
85
|
+
$value: '#f4f4f5',
|
|
86
|
+
$extensions: {
|
|
87
|
+
'design-surface': {
|
|
88
|
+
label: 'Canvas',
|
|
89
|
+
labelZh: '画布',
|
|
90
|
+
uiType: 'color',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
primary: {
|
|
95
|
+
$type: 'color',
|
|
96
|
+
$value: '#2563eb',
|
|
97
|
+
$extensions: {
|
|
98
|
+
'design-surface': {
|
|
99
|
+
label: 'Primary',
|
|
100
|
+
labelZh: '主色',
|
|
101
|
+
uiType: 'color',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
space: {
|
|
107
|
+
$extensions: {
|
|
108
|
+
'design-surface': {
|
|
109
|
+
tier: 'primitive',
|
|
110
|
+
group: 'space',
|
|
111
|
+
label: 'Space',
|
|
112
|
+
labelZh: '间距',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
$type: 'dimension',
|
|
116
|
+
card: {
|
|
117
|
+
$type: 'dimension',
|
|
118
|
+
$value: { value: 24, unit: 'px' },
|
|
119
|
+
$extensions: {
|
|
120
|
+
'design-surface': {
|
|
121
|
+
label: 'Card padding',
|
|
122
|
+
labelZh: '卡片内边距',
|
|
123
|
+
uiType: 'length',
|
|
124
|
+
min: 8,
|
|
125
|
+
max: 64,
|
|
126
|
+
step: 2,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
radius: {
|
|
132
|
+
$extensions: {
|
|
133
|
+
'design-surface': {
|
|
134
|
+
tier: 'primitive',
|
|
135
|
+
group: 'shape',
|
|
136
|
+
label: 'Shape',
|
|
137
|
+
labelZh: '形状',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
$type: 'dimension',
|
|
141
|
+
card: {
|
|
142
|
+
$type: 'dimension',
|
|
143
|
+
$value: { value: 12, unit: 'px' },
|
|
144
|
+
$extensions: {
|
|
145
|
+
'design-surface': {
|
|
146
|
+
label: 'Card radius',
|
|
147
|
+
labelZh: '卡片圆角',
|
|
148
|
+
uiType: 'length',
|
|
149
|
+
min: 0,
|
|
150
|
+
max: 32,
|
|
151
|
+
step: 1,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const STARTER_SEMANTIC = {
|
|
159
|
+
surface: {
|
|
160
|
+
$extensions: {
|
|
161
|
+
'design-surface': {
|
|
162
|
+
tier: 'semantic',
|
|
163
|
+
group: 'semantic-color',
|
|
164
|
+
label: 'Semantic color',
|
|
165
|
+
labelZh: '语义颜色',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
$type: 'color',
|
|
169
|
+
bg: {
|
|
170
|
+
$type: 'color',
|
|
171
|
+
$value: '{color.canvas}',
|
|
172
|
+
$extensions: {
|
|
173
|
+
'design-surface': {
|
|
174
|
+
label: 'Background',
|
|
175
|
+
labelZh: '背景',
|
|
176
|
+
uiType: 'color',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
card: {
|
|
181
|
+
$type: 'color',
|
|
182
|
+
$value: '{color.surface}',
|
|
183
|
+
$extensions: {
|
|
184
|
+
'design-surface': {
|
|
185
|
+
label: 'Card',
|
|
186
|
+
labelZh: '卡片',
|
|
187
|
+
uiType: 'color',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
text: {
|
|
192
|
+
$type: 'color',
|
|
193
|
+
$value: '{color.ink}',
|
|
194
|
+
$extensions: {
|
|
195
|
+
'design-surface': {
|
|
196
|
+
label: 'Text',
|
|
197
|
+
labelZh: '文字',
|
|
198
|
+
uiType: 'color',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
accent: {
|
|
203
|
+
$type: 'color',
|
|
204
|
+
$value: '{color.primary}',
|
|
205
|
+
$extensions: {
|
|
206
|
+
'design-surface': {
|
|
207
|
+
label: 'Accent',
|
|
208
|
+
labelZh: '强调色',
|
|
209
|
+
uiType: 'color',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const STARTER_TOKENS_TS = `export {
|
|
217
|
+
tokenAliases,
|
|
218
|
+
tokenGroups,
|
|
219
|
+
tokenHealth,
|
|
220
|
+
tokenSourceHash,
|
|
221
|
+
tokenSources,
|
|
222
|
+
tokenValues,
|
|
223
|
+
} from './tokens.generated'
|
|
224
|
+
export type { TokenDef, TokenGroup, TokenTier, TokenType } from '@rien7/design-surface/runtime'
|
|
225
|
+
`
|
|
226
|
+
|
|
227
|
+
const STARTER_PROVIDERS_TSX = `import type { ReactNode } from 'react'
|
|
228
|
+
|
|
229
|
+
export function Providers({ children }: { children: ReactNode }) {
|
|
230
|
+
return <>{children}</>
|
|
231
|
+
}
|
|
232
|
+
`
|
|
233
|
+
|
|
234
|
+
const STARTER_COMPONENTS_TS = `export const componentPages: Record<string, { design: string; page: string }> = {}
|
|
235
|
+
`
|
|
236
|
+
|
|
237
|
+
const STARTER_DESIGN_TSX = `import { defineDesign, type PageBoardProps } from '@rien7/design-surface/runtime'
|
|
238
|
+
|
|
239
|
+
export default defineDesign({
|
|
240
|
+
title: 'Starter',
|
|
241
|
+
titleZh: '示例画板',
|
|
242
|
+
pages: [
|
|
243
|
+
{
|
|
244
|
+
id: 'main',
|
|
245
|
+
title: 'Main',
|
|
246
|
+
titleZh: '主页',
|
|
247
|
+
size: [960, 640],
|
|
248
|
+
board: StarterBoard,
|
|
249
|
+
frames: [
|
|
250
|
+
{
|
|
251
|
+
id: 'default',
|
|
252
|
+
title: 'Default',
|
|
253
|
+
titleZh: '默认状态',
|
|
254
|
+
size: [960, 640],
|
|
255
|
+
component: StarterFrame,
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
function StarterBoard({ frames, renderFrame }: PageBoardProps) {
|
|
263
|
+
return <div style={{ display: 'flex', gap: 24 }}>{frames.map(renderFrame)}</div>
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function StarterFrame() {
|
|
267
|
+
return (
|
|
268
|
+
<div
|
|
269
|
+
data-ds="starter-shell"
|
|
270
|
+
style={{
|
|
271
|
+
minHeight: '100vh',
|
|
272
|
+
display: 'grid',
|
|
273
|
+
placeItems: 'center',
|
|
274
|
+
padding: 'var(--space-card, 24px)',
|
|
275
|
+
background: 'var(--surface-bg, #f4f4f5)',
|
|
276
|
+
color: 'var(--surface-text, #18181b)',
|
|
277
|
+
}}
|
|
278
|
+
>
|
|
279
|
+
<div
|
|
280
|
+
data-ds="starter-card"
|
|
281
|
+
style={{
|
|
282
|
+
padding: 'var(--space-card, 24px)',
|
|
283
|
+
borderRadius: 'var(--radius-card, 12px)',
|
|
284
|
+
background: 'var(--surface-card, #ffffff)',
|
|
285
|
+
border: '1px solid #e4e4e7',
|
|
286
|
+
maxWidth: 420,
|
|
287
|
+
}}
|
|
288
|
+
>
|
|
289
|
+
<h1 style={{ margin: '0 0 8px', fontSize: 18 }}>Design Surface Ready</h1>
|
|
290
|
+
<p style={{ margin: 0, fontSize: 13, lineHeight: 1.6, opacity: 0.75 }}>
|
|
291
|
+
Mount real components from <code>src/</code> inside state frames here.
|
|
292
|
+
</p>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
`
|
|
298
|
+
|
|
299
|
+
export async function initDesignSurface({
|
|
300
|
+
root = process.cwd(),
|
|
301
|
+
cssFormat: requestedCssFormat,
|
|
302
|
+
copySkills = true,
|
|
303
|
+
} = {}) {
|
|
304
|
+
const cssFormat =
|
|
305
|
+
requestedCssFormat === 'theme' || requestedCssFormat === 'root'
|
|
306
|
+
? requestedCssFormat
|
|
307
|
+
: detectCssFormat(root)
|
|
308
|
+
const tokenConfig = {
|
|
309
|
+
...DEFAULT_TOKEN_CONFIG,
|
|
310
|
+
cssFormat,
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const files = [
|
|
314
|
+
{
|
|
315
|
+
rel: 'design/tokens/primitive.tokens.json',
|
|
316
|
+
content: `${JSON.stringify(STARTER_PRIMITIVE, null, 2)}\n`,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
rel: 'design/tokens/semantic.tokens.json',
|
|
320
|
+
content: `${JSON.stringify(STARTER_SEMANTIC, null, 2)}\n`,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
rel: 'design/tokens/component.tokens.json',
|
|
324
|
+
content: '{}\n',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
rel: 'design/tokens.config.json',
|
|
328
|
+
content: `${JSON.stringify(tokenConfig, null, 2)}\n`,
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
rel: 'design/tokens.ts',
|
|
332
|
+
content: STARTER_TOKENS_TS,
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
rel: 'design/providers.tsx',
|
|
336
|
+
content: STARTER_PROVIDERS_TSX,
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
rel: 'design/components.ts',
|
|
340
|
+
content: STARTER_COMPONENTS_TS,
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
rel: 'design/starter/design.tsx',
|
|
344
|
+
content: STARTER_DESIGN_TSX,
|
|
345
|
+
},
|
|
346
|
+
]
|
|
347
|
+
|
|
348
|
+
const results = []
|
|
349
|
+
for (const entry of files) {
|
|
350
|
+
const abs = join(root, entry.rel)
|
|
351
|
+
if (existsSync(abs)) {
|
|
352
|
+
results.push({ file: entry.rel, status: 'skipped' })
|
|
353
|
+
continue
|
|
354
|
+
}
|
|
355
|
+
mkdirSync(dirname(abs), { recursive: true })
|
|
356
|
+
writeFileSync(abs, entry.content)
|
|
357
|
+
results.push({ file: entry.rel, status: 'created' })
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (copySkills) {
|
|
361
|
+
const skillsRoot = fileURLToPath(new URL('../../skills', import.meta.url))
|
|
362
|
+
for (const skill of SKILL_NAMES) {
|
|
363
|
+
copyDirNonDestructive(
|
|
364
|
+
join(skillsRoot, skill),
|
|
365
|
+
join(root, '.agents', 'skills', skill),
|
|
366
|
+
root,
|
|
367
|
+
results,
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const cssOut = join(root, tokenConfig.cssOut)
|
|
373
|
+
const tsOut = join(root, tokenConfig.tsOut)
|
|
374
|
+
const manifestOut = join(root, tokenConfig.manifestOut)
|
|
375
|
+
if (!existsSync(cssOut) && !existsSync(tsOut) && !existsSync(manifestOut)) {
|
|
376
|
+
try {
|
|
377
|
+
await runTokenPipeline({ root, check: false })
|
|
378
|
+
results.push({ file: tokenConfig.cssOut, status: 'created' })
|
|
379
|
+
results.push({ file: tokenConfig.tsOut, status: 'created' })
|
|
380
|
+
results.push({ file: tokenConfig.manifestOut, status: 'created' })
|
|
381
|
+
} catch {
|
|
382
|
+
// Non-fatal during init; user may customize tokens.config.json first.
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const viteSnippet = `// vite.config.ts
|
|
387
|
+
import react from '@vitejs/plugin-react'
|
|
388
|
+
import { defineConfig } from 'vite'
|
|
389
|
+
import { designPlugin } from '@rien7/design-surface/vite'
|
|
390
|
+
|
|
391
|
+
export default defineConfig({
|
|
392
|
+
plugins: [
|
|
393
|
+
react(),
|
|
394
|
+
designPlugin({
|
|
395
|
+
dir: 'design',
|
|
396
|
+
css: ['/src/index.css'],
|
|
397
|
+
componentGroups: [
|
|
398
|
+
{ id: 'components', label: 'Components', globs: ['src/components/**/*.tsx'] },
|
|
399
|
+
],
|
|
400
|
+
}),
|
|
401
|
+
],
|
|
402
|
+
})`
|
|
403
|
+
|
|
404
|
+
const agentGuideSnippet = `## Design Surface
|
|
405
|
+
- Real UI components live in \`src/\`; \`design/<id>/design.tsx\` is a thin shell for state frames, mock data, and annotations.
|
|
406
|
+
- Inspect and update review items via \`npx design-surface list | show <id> | prompt <id> | status | reply\` (ledger: \`design/<id>/review.json\`).
|
|
407
|
+
- Reuse existing semantic tokens first; propose missing tokens via \`npx design-surface propose token <id> ...\` with fallback \`var(--proposed, var(--fallback))\`.
|
|
408
|
+
- After editing \`design/tokens/*.tokens.json\`, run \`npx design-surface tokens build && npx design-surface tokens check\`.`
|
|
409
|
+
|
|
410
|
+
return { results, viteSnippet, agentGuideSnippet, cssFormat }
|
|
411
|
+
}
|