@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.
Files changed (214) hide show
  1. package/bin/design-surface.mjs +286 -0
  2. package/dist/cli/init.mjs +411 -0
  3. package/dist/cli/propose.mjs +172 -0
  4. package/dist/cli/reviewOps.mjs +127 -0
  5. package/dist/editor/AgentProposalCard.d.ts +10 -0
  6. package/dist/editor/AgentProposalCard.d.ts.map +1 -0
  7. package/dist/editor/AgentProposalCard.js +28 -0
  8. package/dist/editor/AgentProposalCard.js.map +1 -0
  9. package/dist/editor/App.d.ts +2 -0
  10. package/dist/editor/App.d.ts.map +1 -0
  11. package/dist/editor/App.js +1813 -0
  12. package/dist/editor/App.js.map +1 -0
  13. package/dist/editor/CanvasHud.d.ts +12 -0
  14. package/dist/editor/CanvasHud.d.ts.map +1 -0
  15. package/dist/editor/CanvasHud.js +13 -0
  16. package/dist/editor/CanvasHud.js.map +1 -0
  17. package/dist/editor/CanvasSurface.d.ts +20 -0
  18. package/dist/editor/CanvasSurface.d.ts.map +1 -0
  19. package/dist/editor/CanvasSurface.js +252 -0
  20. package/dist/editor/CanvasSurface.js.map +1 -0
  21. package/dist/editor/Changes.d.ts +17 -0
  22. package/dist/editor/Changes.d.ts.map +1 -0
  23. package/dist/editor/Changes.js +59 -0
  24. package/dist/editor/Changes.js.map +1 -0
  25. package/dist/editor/CommentPopover.d.ts +17 -0
  26. package/dist/editor/CommentPopover.d.ts.map +1 -0
  27. package/dist/editor/CommentPopover.js +62 -0
  28. package/dist/editor/CommentPopover.js.map +1 -0
  29. package/dist/editor/Comments.d.ts +13 -0
  30. package/dist/editor/Comments.d.ts.map +1 -0
  31. package/dist/editor/Comments.js +39 -0
  32. package/dist/editor/Comments.js.map +1 -0
  33. package/dist/editor/History.d.ts +7 -0
  34. package/dist/editor/History.d.ts.map +1 -0
  35. package/dist/editor/History.js +43 -0
  36. package/dist/editor/History.js.map +1 -0
  37. package/dist/editor/Inspector.d.ts +22 -0
  38. package/dist/editor/Inspector.d.ts.map +1 -0
  39. package/dist/editor/Inspector.js +241 -0
  40. package/dist/editor/Inspector.js.map +1 -0
  41. package/dist/editor/LazyMount.d.ts +10 -0
  42. package/dist/editor/LazyMount.d.ts.map +1 -0
  43. package/dist/editor/LazyMount.js +29 -0
  44. package/dist/editor/LazyMount.js.map +1 -0
  45. package/dist/editor/LocaleSwitch.d.ts +2 -0
  46. package/dist/editor/LocaleSwitch.d.ts.map +1 -0
  47. package/dist/editor/LocaleSwitch.js +13 -0
  48. package/dist/editor/LocaleSwitch.js.map +1 -0
  49. package/dist/editor/NodeInspector.d.ts +9 -0
  50. package/dist/editor/NodeInspector.d.ts.map +1 -0
  51. package/dist/editor/NodeInspector.js +9 -0
  52. package/dist/editor/NodeInspector.js.map +1 -0
  53. package/dist/editor/PreviewFrame.d.ts +10 -0
  54. package/dist/editor/PreviewFrame.d.ts.map +1 -0
  55. package/dist/editor/PreviewFrame.js +22 -0
  56. package/dist/editor/PreviewFrame.js.map +1 -0
  57. package/dist/editor/ProjectIndex.d.ts +12 -0
  58. package/dist/editor/ProjectIndex.d.ts.map +1 -0
  59. package/dist/editor/ProjectIndex.js +43 -0
  60. package/dist/editor/ProjectIndex.js.map +1 -0
  61. package/dist/editor/StyleEditor.d.ts +37 -0
  62. package/dist/editor/StyleEditor.d.ts.map +1 -0
  63. package/dist/editor/StyleEditor.js +275 -0
  64. package/dist/editor/StyleEditor.js.map +1 -0
  65. package/dist/editor/TokenWorkbench.d.ts +37 -0
  66. package/dist/editor/TokenWorkbench.d.ts.map +1 -0
  67. package/dist/editor/TokenWorkbench.js +146 -0
  68. package/dist/editor/TokenWorkbench.js.map +1 -0
  69. package/dist/editor/Tokens.d.ts +21 -0
  70. package/dist/editor/Tokens.d.ts.map +1 -0
  71. package/dist/editor/Tokens.js +56 -0
  72. package/dist/editor/Tokens.js.map +1 -0
  73. package/dist/editor/VariablesPage.d.ts +28 -0
  74. package/dist/editor/VariablesPage.d.ts.map +1 -0
  75. package/dist/editor/VariablesPage.js +14 -0
  76. package/dist/editor/VariablesPage.js.map +1 -0
  77. package/dist/editor/api.d.ts +13 -0
  78. package/dist/editor/api.d.ts.map +1 -0
  79. package/dist/editor/api.js +70 -0
  80. package/dist/editor/api.js.map +1 -0
  81. package/dist/editor/camera.d.ts +18 -0
  82. package/dist/editor/camera.d.ts.map +1 -0
  83. package/dist/editor/camera.js +40 -0
  84. package/dist/editor/camera.js.map +1 -0
  85. package/dist/editor/canvas.d.ts +26 -0
  86. package/dist/editor/canvas.d.ts.map +1 -0
  87. package/dist/editor/canvas.js +51 -0
  88. package/dist/editor/canvas.js.map +1 -0
  89. package/dist/editor/chrome/EditorChrome.d.ts +42 -0
  90. package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
  91. package/dist/editor/chrome/EditorChrome.js +21 -0
  92. package/dist/editor/chrome/EditorChrome.js.map +1 -0
  93. package/dist/editor/i18n.d.ts +18 -0
  94. package/dist/editor/i18n.d.ts.map +1 -0
  95. package/dist/editor/i18n.js +762 -0
  96. package/dist/editor/i18n.js.map +1 -0
  97. package/dist/editor/main.d.ts +3 -0
  98. package/dist/editor/main.d.ts.map +1 -0
  99. package/dist/editor/main.js +12 -0
  100. package/dist/editor/main.js.map +1 -0
  101. package/dist/editor/model.d.ts +17 -0
  102. package/dist/editor/model.d.ts.map +1 -0
  103. package/dist/editor/model.js +12 -0
  104. package/dist/editor/model.js.map +1 -0
  105. package/dist/editor/reviewLifecycle.d.ts +9 -0
  106. package/dist/editor/reviewLifecycle.d.ts.map +1 -0
  107. package/dist/editor/reviewLifecycle.js +30 -0
  108. package/dist/editor/reviewLifecycle.js.map +1 -0
  109. package/dist/editor/styles.css +6626 -0
  110. package/dist/editor/ui/Button.d.ts +3 -0
  111. package/dist/editor/ui/Button.d.ts.map +1 -0
  112. package/dist/editor/ui/Button.js +6 -0
  113. package/dist/editor/ui/Button.js.map +1 -0
  114. package/dist/editor/ui/CommentBox.d.ts +23 -0
  115. package/dist/editor/ui/CommentBox.d.ts.map +1 -0
  116. package/dist/editor/ui/CommentBox.js +41 -0
  117. package/dist/editor/ui/CommentBox.js.map +1 -0
  118. package/dist/editor/ui/Icon.d.ts +9 -0
  119. package/dist/editor/ui/Icon.d.ts.map +1 -0
  120. package/dist/editor/ui/Icon.js +6 -0
  121. package/dist/editor/ui/Icon.js.map +1 -0
  122. package/dist/editor/ui/IconButton.d.ts +11 -0
  123. package/dist/editor/ui/IconButton.d.ts.map +1 -0
  124. package/dist/editor/ui/IconButton.js +6 -0
  125. package/dist/editor/ui/IconButton.js.map +1 -0
  126. package/dist/editor/ui/NumberInput.d.ts +14 -0
  127. package/dist/editor/ui/NumberInput.d.ts.map +1 -0
  128. package/dist/editor/ui/NumberInput.js +6 -0
  129. package/dist/editor/ui/NumberInput.js.map +1 -0
  130. package/dist/editor/ui/PageLine.d.ts +14 -0
  131. package/dist/editor/ui/PageLine.d.ts.map +1 -0
  132. package/dist/editor/ui/PageLine.js +7 -0
  133. package/dist/editor/ui/PageLine.js.map +1 -0
  134. package/dist/editor/ui/Select.d.ts +15 -0
  135. package/dist/editor/ui/Select.d.ts.map +1 -0
  136. package/dist/editor/ui/Select.js +11 -0
  137. package/dist/editor/ui/Select.js.map +1 -0
  138. package/dist/editor/ui/TokenField.d.ts +14 -0
  139. package/dist/editor/ui/TokenField.d.ts.map +1 -0
  140. package/dist/editor/ui/TokenField.js +41 -0
  141. package/dist/editor/ui/TokenField.js.map +1 -0
  142. package/dist/editor-ui.d.ts +14 -0
  143. package/dist/editor-ui.d.ts.map +1 -0
  144. package/dist/editor-ui.js +13 -0
  145. package/dist/editor-ui.js.map +1 -0
  146. package/dist/inspector/runtime.d.ts +18 -0
  147. package/dist/inspector/runtime.d.ts.map +1 -0
  148. package/dist/inspector/runtime.js +987 -0
  149. package/dist/inspector/runtime.js.map +1 -0
  150. package/dist/preview/main.d.ts +3 -0
  151. package/dist/preview/main.d.ts.map +1 -0
  152. package/dist/preview/main.js +72 -0
  153. package/dist/preview/main.js.map +1 -0
  154. package/dist/preview/preview.css +39 -0
  155. package/dist/runtime/flow.d.ts +15 -0
  156. package/dist/runtime/flow.d.ts.map +1 -0
  157. package/dist/runtime/flow.js +48 -0
  158. package/dist/runtime/flow.js.map +1 -0
  159. package/dist/runtime/free.d.ts +18 -0
  160. package/dist/runtime/free.d.ts.map +1 -0
  161. package/dist/runtime/free.js +8 -0
  162. package/dist/runtime/free.js.map +1 -0
  163. package/dist/runtime/index.d.ts +11 -0
  164. package/dist/runtime/index.d.ts.map +1 -0
  165. package/dist/runtime/index.js +46 -0
  166. package/dist/runtime/index.js.map +1 -0
  167. package/dist/runtime/types.d.ts +57 -0
  168. package/dist/runtime/types.d.ts.map +1 -0
  169. package/dist/runtime/types.js +14 -0
  170. package/dist/runtime/types.js.map +1 -0
  171. package/dist/shared/prompt.d.mts +13 -0
  172. package/dist/shared/prompt.mjs +97 -0
  173. package/dist/shared/protocol.d.ts +79 -0
  174. package/dist/shared/protocol.d.ts.map +1 -0
  175. package/dist/shared/protocol.js +7 -0
  176. package/dist/shared/protocol.js.map +1 -0
  177. package/dist/shared/tokens.d.ts +66 -0
  178. package/dist/shared/tokens.d.ts.map +1 -0
  179. package/dist/shared/tokens.js +2 -0
  180. package/dist/shared/tokens.js.map +1 -0
  181. package/dist/shared/types.d.ts +301 -0
  182. package/dist/shared/types.d.ts.map +1 -0
  183. package/dist/shared/types.js +13 -0
  184. package/dist/shared/types.js.map +1 -0
  185. package/dist/tokens/adapters/css.mjs +44 -0
  186. package/dist/tokens/adapters/cssInCode.mjs +277 -0
  187. package/dist/tokens/adapters/oxcShared.mjs +59 -0
  188. package/dist/tokens/adapters/preprocessor.mjs +63 -0
  189. package/dist/tokens/adapters/registry.mjs +53 -0
  190. package/dist/tokens/adapters/tailwindcss.mjs +360 -0
  191. package/dist/tokens/adapters/types.mjs +117 -0
  192. package/dist/tokens/extract.mjs +328 -0
  193. package/dist/tokens/pipeline.mjs +688 -0
  194. package/dist/vite/events.d.ts +25 -0
  195. package/dist/vite/events.d.ts.map +1 -0
  196. package/dist/vite/events.js +137 -0
  197. package/dist/vite/events.js.map +1 -0
  198. package/dist/vite/layout.d.ts +4 -0
  199. package/dist/vite/layout.d.ts.map +1 -0
  200. package/dist/vite/layout.js +78 -0
  201. package/dist/vite/layout.js.map +1 -0
  202. package/dist/vite/plugin.d.ts +33 -0
  203. package/dist/vite/plugin.d.ts.map +1 -0
  204. package/dist/vite/plugin.js +403 -0
  205. package/dist/vite/plugin.js.map +1 -0
  206. package/dist/vite/review.d.ts +7 -0
  207. package/dist/vite/review.d.ts.map +1 -0
  208. package/dist/vite/review.js +334 -0
  209. package/dist/vite/review.js.map +1 -0
  210. package/package.json +86 -4
  211. package/skills/design-surface/SKILL.md +190 -0
  212. package/skills/design-surface-authoring/SKILL.md +257 -0
  213. package/skills/design-surface-tokens/SKILL.md +235 -0
  214. package/README.md +0 -3
@@ -0,0 +1,172 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
2
+ import { dirname, join, resolve } from 'node:path'
3
+
4
+ import { colorToRgb, loadTokenConfig } from '../tokens/pipeline.mjs'
5
+
6
+ const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/
7
+ const VALID_ACTIONS = new Set(['create', 'update', 'alias', 'merge'])
8
+ const VALID_TIERS = new Set(['primitive', 'semantic', 'component'])
9
+ const VALID_TYPES = new Set(['color', 'length', 'text'])
10
+ const VALUE_FLAGS = new Set(['name', 'value', 'tier', 'alias', 'type', 'action', 'rationale'])
11
+
12
+ function parseArgs(argv) {
13
+ const flags = {}
14
+ const positionals = []
15
+ for (let i = 0; i < argv.length; i += 1) {
16
+ const token = argv[i]
17
+ if (token.startsWith('--')) {
18
+ const eq = token.indexOf('=')
19
+ if (eq > 2) {
20
+ const key = token.slice(2, eq)
21
+ if (!VALUE_FLAGS.has(key)) throw new Error(`unknown option: --${key}`)
22
+ flags[key] = token.slice(eq + 1)
23
+ continue
24
+ }
25
+ const key = token.slice(2)
26
+ if (!VALUE_FLAGS.has(key)) throw new Error(`unknown option: --${key}`)
27
+ const next = argv[i + 1]
28
+ if (next === undefined) throw new Error(`--${key} requires a value`)
29
+ flags[key] = next
30
+ i += 1
31
+ continue
32
+ }
33
+ positionals.push(token)
34
+ }
35
+ return { flags, positionals }
36
+ }
37
+
38
+ function inferTokenType(value, targetType) {
39
+ if (targetType === 'color') return 'color'
40
+ if (targetType === 'dimension') return 'length'
41
+ if (typeof value === 'string') {
42
+ const trimmed = value.trim()
43
+ if (/^-?\d+(?:\.\d+)?(px|rem|em|%)$/.test(trimmed)) return 'length'
44
+ if (
45
+ colorToRgb(trimmed) ||
46
+ /^(?:color-mix|rgba?|hsla?|oklch|oklab|color)\(/i.test(trimmed)
47
+ ) {
48
+ return 'color'
49
+ }
50
+ }
51
+ return 'text'
52
+ }
53
+
54
+ function readJson(file) {
55
+ if (!existsSync(file)) return null
56
+ try {
57
+ return JSON.parse(readFileSync(file, 'utf8'))
58
+ } catch {
59
+ return null
60
+ }
61
+ }
62
+
63
+ export function proposeToken({ root = process.cwd(), argv = [] } = {}) {
64
+ const { flags, positionals } = parseArgs(argv)
65
+ const design = positionals[0]
66
+ if (!design) throw new Error('propose token requires a <design> id')
67
+ if (!SAFE_ID.test(design)) throw new Error(`Invalid design id: ${design}`)
68
+
69
+ const name = flags.name
70
+ if (!name || !/^--[a-zA-Z0-9_-]+$/.test(name)) {
71
+ throw new Error('--name is required and must be a CSS custom property starting with "--"')
72
+ }
73
+
74
+ const action = flags.action ?? 'create'
75
+ if (!VALID_ACTIONS.has(action)) {
76
+ throw new Error(`Invalid --action "${action}". Expected one of: create, update, alias, merge`)
77
+ }
78
+
79
+ const tier = flags.tier ?? 'semantic'
80
+ if (!VALID_TIERS.has(tier)) {
81
+ throw new Error(`Invalid --tier "${tier}". Expected one of: primitive, semantic, component`)
82
+ }
83
+
84
+ const alias = flags.alias
85
+ if (alias !== undefined) {
86
+ if (!alias || alias.startsWith('--')) {
87
+ throw new Error('--alias must be a DTCG dot-path (e.g. color.surface), not a CSS variable name')
88
+ }
89
+ }
90
+ if ((action === 'alias' || action === 'merge') && !alias) {
91
+ throw new Error(`--alias is required when --action is ${action}`)
92
+ }
93
+
94
+ const value = flags.value ?? (action === 'alias' || action === 'merge' ? alias : undefined)
95
+ if ((action === 'create' || action === 'update') && !value) {
96
+ throw new Error(`--value is required when --action is ${action}`)
97
+ }
98
+
99
+ let manifestPath = join(root, 'design/tokens.manifest.json')
100
+ try {
101
+ const config = loadTokenConfig(root)
102
+ manifestPath = resolve(root, config.manifestOut)
103
+ } catch {
104
+ // fallback to default manifest path
105
+ }
106
+ const manifest = readJson(manifestPath)
107
+ const manifestTokens = Array.isArray(manifest?.tokens) ? manifest.tokens : []
108
+ const existingToken = manifestTokens.find((entry) => entry.cssName === name)
109
+ const aliasTarget = alias ? manifestTokens.find((entry) => entry.path === alias) : undefined
110
+
111
+ const tokenType = flags.type ?? inferTokenType(value, aliasTarget?.type)
112
+ if (!VALID_TYPES.has(tokenType)) {
113
+ throw new Error(`Invalid --type "${tokenType}". Expected one of: color, length, text`)
114
+ }
115
+
116
+ const source = `design/tokens/${tier}.tokens.json`
117
+ const sourceHash = typeof manifest?.sourceHash === 'string' ? manifest.sourceHash : ''
118
+ const reviewPath = resolve(root, 'design', design, 'review.json')
119
+ const existingReview = readJson(reviewPath)
120
+ const now = new Date().toISOString()
121
+
122
+ const items = Array.isArray(existingReview?.items) ? [...existingReview.items] : []
123
+ const batches = Array.isArray(existingReview?.batches) ? [...existingReview.batches] : []
124
+ const id = `token-propose-${name}`
125
+ const existingIndex = items.findIndex(
126
+ (entry) =>
127
+ entry.id === id ||
128
+ (entry.kind === 'token' &&
129
+ entry.author === 'agent' &&
130
+ entry.target?.type === 'token' &&
131
+ entry.target.token === name &&
132
+ entry.status !== 'archived'),
133
+ )
134
+ const prev = existingIndex >= 0 ? items[existingIndex] : null
135
+
136
+ const item = {
137
+ id: prev?.id ?? id,
138
+ design,
139
+ kind: 'token',
140
+ scope: 'design',
141
+ author: 'agent',
142
+ target: { type: 'token', token: name },
143
+ from: action === 'create' ? '' : existingToken?.value ?? prev?.from ?? '',
144
+ to: value,
145
+ source,
146
+ ...(sourceHash ? { sourceHash } : {}),
147
+ tokenType,
148
+ tokenAction: action,
149
+ ...(alias ? { tokenAlias: alias } : {}),
150
+ tokenTier: tier,
151
+ ...(flags.rationale ? { rationale: flags.rationale } : {}),
152
+ status: 'open',
153
+ createdAt: prev?.createdAt ?? now,
154
+ updatedAt: now,
155
+ }
156
+
157
+ if (existingIndex >= 0) items[existingIndex] = item
158
+ else items.push(item)
159
+
160
+ const nextReview = {
161
+ version: 1,
162
+ design,
163
+ updatedAt: now,
164
+ items,
165
+ batches,
166
+ }
167
+
168
+ mkdirSync(dirname(reviewPath), { recursive: true })
169
+ writeFileSync(reviewPath, `${JSON.stringify(nextReview, null, 2)}\n`)
170
+
171
+ return { item, reviewPath }
172
+ }
@@ -0,0 +1,127 @@
1
+ import crypto from 'node:crypto'
2
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
3
+ import { resolve } from 'node:path'
4
+
5
+ const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/
6
+ const VALID_STATUSES = new Set(['in_progress', 'resolved'])
7
+
8
+ function loadReviewForMutation(root, design) {
9
+ if (!design) throw new Error('design id is required')
10
+ if (!SAFE_ID.test(design)) throw new Error(`Invalid design id: ${design}`)
11
+ const file = resolve(root, 'design', design, 'review.json')
12
+ if (!existsSync(file)) throw new Error(`no review ledger for ${design}`)
13
+ let parsed
14
+ try {
15
+ parsed = JSON.parse(readFileSync(file, 'utf8'))
16
+ } catch {
17
+ throw new Error(`failed to parse review ledger for ${design}`)
18
+ }
19
+ if (!parsed || parsed.version !== 1 || !Array.isArray(parsed.items)) {
20
+ throw new Error(`invalid review ledger shape for ${design}`)
21
+ }
22
+ return { file, review: parsed }
23
+ }
24
+
25
+ function saveReviewMutation(file, review, now) {
26
+ const next = {
27
+ ...review,
28
+ updatedAt: now,
29
+ }
30
+ writeFileSync(file, `${JSON.stringify(next, null, 2)}\n`)
31
+ return next
32
+ }
33
+
34
+ export function replyReviewItem({ root = process.cwd(), argv = [] } = {}) {
35
+ let resolveItem = false
36
+ const positionals = []
37
+ for (const token of argv) {
38
+ if (token === '--resolve') {
39
+ resolveItem = true
40
+ continue
41
+ }
42
+ if (token.startsWith('--')) {
43
+ throw new Error(`unknown option: ${token}`)
44
+ }
45
+ positionals.push(token)
46
+ }
47
+
48
+ const [design, itemId, message] = positionals
49
+ if (!design || !itemId || !message || !message.trim()) {
50
+ throw new Error('reply requires <design> <itemId> "<message>" [--resolve]')
51
+ }
52
+
53
+ const { file, review } = loadReviewForMutation(root, design)
54
+ const index = review.items.findIndex((entry) => entry?.id === itemId)
55
+ if (index === -1) {
56
+ throw new Error(`review item not found in ${design}: ${itemId}`)
57
+ }
58
+
59
+ const now = new Date().toISOString()
60
+ const existing = review.items[index]
61
+ const reply = {
62
+ id: `reply-${crypto.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`}`,
63
+ author: 'agent',
64
+ body: message.trim(),
65
+ createdAt: now,
66
+ }
67
+ const thread = Array.isArray(existing.thread) ? [...existing.thread, reply] : [reply]
68
+ const updatedItem = {
69
+ ...existing,
70
+ thread,
71
+ updatedAt: now,
72
+ ...(resolveItem ? { status: 'resolved', resolvedAt: existing.resolvedAt ?? now } : {}),
73
+ }
74
+ const items = review.items.map((entry, idx) => (idx === index ? updatedItem : entry))
75
+ saveReviewMutation(file, { ...review, items }, now)
76
+ return { item: updatedItem, reply, file }
77
+ }
78
+
79
+ export function updateReviewItemStatus({ root = process.cwd(), argv = [] } = {}) {
80
+ let agentReply
81
+ const positionals = []
82
+ for (let i = 0; i < argv.length; i += 1) {
83
+ const token = argv[i]
84
+ if (token === '--reply') {
85
+ const next = argv[i + 1]
86
+ if (next === undefined) throw new Error('--reply requires a summary string')
87
+ agentReply = next
88
+ i += 1
89
+ continue
90
+ }
91
+ if (token.startsWith('--reply=')) {
92
+ agentReply = token.slice('--reply='.length)
93
+ continue
94
+ }
95
+ if (token.startsWith('--')) {
96
+ throw new Error(`unknown option: ${token}`)
97
+ }
98
+ positionals.push(token)
99
+ }
100
+
101
+ const [design, itemId, status] = positionals
102
+ if (!design || !itemId || !status) {
103
+ throw new Error('status requires <design> <itemId> <in_progress|resolved> [--reply "<summary>"]')
104
+ }
105
+ if (!VALID_STATUSES.has(status)) {
106
+ throw new Error(`Invalid status "${status}". Expected "in_progress" or "resolved".`)
107
+ }
108
+
109
+ const { file, review } = loadReviewForMutation(root, design)
110
+ const index = review.items.findIndex((entry) => entry?.id === itemId)
111
+ if (index === -1) {
112
+ throw new Error(`review item not found in ${design}: ${itemId}`)
113
+ }
114
+
115
+ const now = new Date().toISOString()
116
+ const existing = review.items[index]
117
+ const updatedItem = {
118
+ ...existing,
119
+ status,
120
+ updatedAt: now,
121
+ ...(status === 'resolved' ? { resolvedAt: now } : {}),
122
+ ...(agentReply !== undefined ? { agentReply } : {}),
123
+ }
124
+ const items = review.items.map((entry, idx) => (idx === index ? updatedItem : entry))
125
+ saveReviewMutation(file, { ...review, items }, now)
126
+ return { item: updatedItem, file }
127
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReviewItem } from '../shared/types';
2
+ type Props = {
3
+ item: ReviewItem;
4
+ onApprove: (id: string, value: string, note: string) => void;
5
+ onReject: (id: string, note: string) => void;
6
+ onUpdateValue?: (id: string, value: string) => void;
7
+ };
8
+ export declare function AgentProposalCard({ item, onApprove, onReject, onUpdateValue }: Props): import("react").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=AgentProposalCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentProposalCard.d.ts","sourceRoot":"","sources":["../../src/editor/AgentProposalCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACpD,CAAA;AAID,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,+BAsGpF"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useI18n } from './i18n';
4
+ import { Button } from './ui/Button';
5
+ const isHexColor = (value) => /^#[0-9a-f]{6}$/i.test(value.trim());
6
+ export function AgentProposalCard({ item, onApprove, onReject, onUpdateValue }) {
7
+ const { t } = useI18n();
8
+ const tokenName = item.target.type === 'token' ? item.target.token : '';
9
+ const [valueDraft, setValueDraft] = useState(String(item.to ?? ''));
10
+ const [noteDraft, setNoteDraft] = useState(item.decisionNote ?? '');
11
+ useEffect(() => {
12
+ setValueDraft(String(item.to ?? ''));
13
+ }, [item.to]);
14
+ useEffect(() => {
15
+ setNoteDraft(item.decisionNote ?? '');
16
+ }, [item.decisionNote]);
17
+ const tierKey = item.tokenTier === 'primitive' || item.tokenTier === 'component' ? item.tokenTier : 'semantic';
18
+ return (_jsxs("div", { className: "proposal-card", "data-proposal-id": item.id, children: [_jsxs("div", { className: "proposal-head", children: [_jsx("span", { className: "proposal-badge", children: t('proposal.badge') }), item.tokenAction ? (_jsx("span", { className: "change-action", children: t(`changes.tokenAction.${item.tokenAction}`) })) : null, _jsx("span", { className: "proposal-tier", children: t(`tokens.tier.${tierKey}`) })] }), _jsxs("div", { className: "proposal-token-row", children: [_jsx("code", { children: tokenName }), item.tokenAlias ? (_jsxs("span", { className: "proposal-alias", children: [t('proposal.aliasLabel'), ": ", _jsx("code", { children: `{${item.tokenAlias}}` })] })) : null] }), item.source ? _jsx("code", { className: "proposal-source", children: item.source }) : null, item.rationale ? (_jsxs("p", { className: "proposal-rationale", children: [_jsxs("strong", { children: [t('proposal.rationale'), ":"] }), " ", item.rationale] })) : null, _jsxs("div", { className: "proposal-controls", children: [_jsxs("label", { className: "proposal-field", children: [_jsx("span", { children: t('proposal.valueLabel') }), _jsxs("div", { className: "proposal-value-input", children: [item.tokenType === 'color' && isHexColor(valueDraft) ? (_jsx("input", { "aria-label": tokenName, className: "proposal-color-picker", type: "color", value: valueDraft.trim(), onChange: (event) => {
19
+ const next = event.target.value;
20
+ setValueDraft(next);
21
+ onUpdateValue?.(item.id, next);
22
+ } })) : null, _jsx("input", { className: "input", value: valueDraft, onChange: (event) => {
23
+ const next = event.target.value;
24
+ setValueDraft(next);
25
+ onUpdateValue?.(item.id, next);
26
+ } })] })] }), _jsxs("label", { className: "proposal-field", children: [_jsx("span", { children: t('proposal.noteLabel') }), _jsx("input", { className: "input", placeholder: t('proposal.notePlaceholder'), value: noteDraft, onChange: (event) => setNoteDraft(event.target.value) })] })] }), _jsxs("div", { className: "proposal-actions", children: [_jsx(Button, { className: "primary-button", type: "button", onClick: () => onApprove(item.id, valueDraft.trim() || String(item.to ?? ''), noteDraft), children: t('proposal.approve') }), _jsx(Button, { className: "button", type: "button", onClick: () => onReject(item.id, noteDraft), children: t('proposal.reject') })] })] }));
27
+ }
28
+ //# sourceMappingURL=AgentProposalCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentProposalCard.js","sourceRoot":"","sources":["../../src/editor/AgentProposalCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,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KAAC,MAAM,IACL,SAAS,EAAC,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,YAE1C,CAAC,CAAC,iBAAiB,CAAC,GACd,IACL,IACF,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function App(): import("react").JSX.Element;
2
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/editor/App.tsx"],"names":[],"mappings":"AA+IA,wBAAgB,GAAG,gCA4kFlB"}