@skriv/ads 0.0.0-stage → 0.2.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.
Files changed (36) hide show
  1. package/README.md +47 -2
  2. package/bin/ads.mjs +59 -0
  3. package/dist/manifest.json +53 -0
  4. package/dist/skills/ads-code-review/SKILL.md +12 -0
  5. package/dist/skills/ads-code-to-figma/SKILL.md +10 -0
  6. package/dist/skills/ads-figma-to-code/SKILL.md +10 -0
  7. package/dist/skills/ads-init/SKILL.md +16 -0
  8. package/dist/skills/ads-init/profile.md +11 -0
  9. package/dist/skills/ads-init/scripts/connect.py +75 -0
  10. package/dist/skills/ads-record/SKILL.md +12 -0
  11. package/dist/skills/heroui-react/LICENSE.txt +199 -0
  12. package/dist/skills/heroui-react/SKILL.md +234 -0
  13. package/dist/skills/heroui-react/scripts/get_component_docs.mjs +157 -0
  14. package/dist/skills/heroui-react/scripts/get_docs.mjs +148 -0
  15. package/dist/skills/heroui-react/scripts/get_source.mjs +160 -0
  16. package/dist/skills/heroui-react/scripts/get_styles.mjs +160 -0
  17. package/dist/skills/heroui-react/scripts/get_theme.mjs +177 -0
  18. package/dist/skills/heroui-react/scripts/list_components.mjs +134 -0
  19. package/dist/skills/heroui-theming/LICENSE.txt +199 -0
  20. package/dist/skills/heroui-theming/SKILL.md +268 -0
  21. package/dist/skills/heroui-theming/references/any-framework.md +219 -0
  22. package/dist/skills/heroui-theming/references/components.md +237 -0
  23. package/dist/skills/heroui-theming/references/theme-recipe.md +701 -0
  24. package/dist/skills/heroui-theming/references/tokens.md +258 -0
  25. package/dist/skills/heroui-theming/scripts/_styles_dir.mjs +112 -0
  26. package/dist/skills/heroui-theming/scripts/list_component_classes.mjs +319 -0
  27. package/dist/skills/heroui-theming/scripts/list_tokens.mjs +157 -0
  28. package/dist/templates/flow.md +12 -0
  29. package/dist/templates/project.md +13 -0
  30. package/dist/templates/review.md +14 -0
  31. package/dist/templates/routing.md +11 -0
  32. package/dist/templates/theming.md +26 -0
  33. package/package.json +32 -4
  34. package/src/doctor.mjs +38 -0
  35. package/src/install.mjs +140 -0
  36. package/src/video.mjs +18 -0
@@ -0,0 +1,319 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Inspect the BEM surface of HeroUI components from the INSTALLED `@heroui/styles`
4
+ * (no network), so overrides target selectors that exist in the project's version.
5
+ *
6
+ * Usage:
7
+ * node list_component_classes.mjs # list every component stylesheet
8
+ * node list_component_classes.mjs button # summary for one component
9
+ * node list_component_classes.mjs button switch # several components
10
+ * node list_component_classes.mjs button --css # also print the raw CSS
11
+ * node list_component_classes.mjs button --json # machine-readable output
12
+ * node list_component_classes.mjs --dir <path> # explicit @heroui/styles location
13
+ *
14
+ * The summary lists: blocks, elements, modifiers, state selectors, `data-slot`
15
+ * hooks, component custom properties (with their defaults), and the theme
16
+ * tokens the component reads.
17
+ */
18
+ import fs from "node:fs";
19
+ import path from "node:path";
20
+
21
+ import {findStylesDir, stripComments, takeDirArg} from "./_styles_dir.mjs";
22
+
23
+ const COLOR_UTILITY_PREFIXES = [
24
+ "bg",
25
+ "text",
26
+ "border",
27
+ "ring",
28
+ "ring-offset",
29
+ "outline",
30
+ "fill",
31
+ "stroke",
32
+ "from",
33
+ "via",
34
+ "to",
35
+ "placeholder",
36
+ "divide",
37
+ "caret",
38
+ "decoration",
39
+ ];
40
+
41
+ const STATE_PSEUDO_CLASSES = new Set([
42
+ "active",
43
+ "autofill",
44
+ "checked",
45
+ "disabled",
46
+ "focus",
47
+ "focus-visible",
48
+ "focus-within",
49
+ "hover",
50
+ "indeterminate",
51
+ "invalid",
52
+ "placeholder-shown",
53
+ "read-only",
54
+ "required",
55
+ ]);
56
+
57
+ /** `.block`, `.block__element` (elements can nest: `.a__b__c`), and an optional `--modifier`. */
58
+ const NAME = "[a-z0-9]+(?:-[a-z0-9]+)*";
59
+ const CLASS_PATTERN = new RegExp(
60
+ `\\.([a-z][a-z0-9]*(?:-[a-z0-9]+)*)((?:__${NAME})+)?(--${NAME})?(?![\\w-])`,
61
+ "g",
62
+ );
63
+
64
+ const toKebab = (name) =>
65
+ name
66
+ .replace(/\.css$/, "")
67
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
68
+ .replace(/[\s_]+/g, "-")
69
+ .toLowerCase();
70
+
71
+ /** Returns every selector prelude (the text right before a `{`), skipping at-rules. */
72
+ const readSelectors = (css) => {
73
+ const selectors = [];
74
+ let start = 0;
75
+
76
+ for (let i = 0; i < css.length; i++) {
77
+ const char = css[i];
78
+
79
+ if (char === ";" || char === "}") {
80
+ start = i + 1;
81
+ } else if (char === "{") {
82
+ const prelude = css.slice(start, i).trim();
83
+
84
+ if (prelude && !prelude.startsWith("@")) selectors.push(prelude.replace(/\s+/g, " "));
85
+ start = i + 1;
86
+ }
87
+ }
88
+
89
+ return selectors;
90
+ };
91
+
92
+ /**
93
+ * Reads themes/shared/theme.css: which Tailwind theme variable points at which HeroUI token,
94
+ * e.g. `--color-field` -> `--field-background`, `--radius-3xl` -> `--radius`.
95
+ */
96
+ const readThemeMap = (cssRoot) => {
97
+ const themeCss = stripComments(
98
+ fs.readFileSync(path.join(cssRoot, "themes", "shared", "theme.css"), "utf8"),
99
+ );
100
+ const themeMap = new Map();
101
+
102
+ for (const match of themeCss.matchAll(/(--[\w-]+)\s*:\s*[^;]*?var\(\s*(--[\w-]+)/g)) {
103
+ themeMap.set(match[1], match[2]);
104
+ }
105
+
106
+ const colorNames = [...themeMap.keys()]
107
+ .filter((name) => name.startsWith("--color-"))
108
+ .map((name) => name.slice("--color-".length))
109
+ .sort((a, b) => b.length - a.length);
110
+
111
+ return {colorNames, themeMap};
112
+ };
113
+
114
+ /** HeroUI state utilities (utilities/index.css) and the tokens behind them. */
115
+ const STATUS_UTILITY_TOKENS = {
116
+ "focus-field-ring": ["--focus"],
117
+ "focus-ring": ["--focus", "--ring-offset-width"],
118
+ "invalid-field-ring": ["--danger"],
119
+ scrollbar: ["--scrollbar-width", "--scrollbar-color", "--scrollbar-gutter"],
120
+ "scrollbar-thin": ["--scrollbar-thumb", "--scrollbar-track"],
121
+ "status-disabled": ["--disabled-opacity", "--cursor-disabled"],
122
+ "status-focused": ["--focus", "--ring-offset-width"],
123
+ "status-focused-field": ["--focus"],
124
+ "status-invalid-field": ["--danger"],
125
+ };
126
+
127
+ const analyze = (css, {colorNames, themeMap}) => {
128
+ const clean = stripComments(css);
129
+ const selectors = readSelectors(clean);
130
+ const blocks = new Map();
131
+ const states = new Set();
132
+ const slots = new Set();
133
+
134
+ const blockEntry = (block) => {
135
+ if (!blocks.has(block)) blocks.set(block, {elements: new Set(), modifiers: new Set()});
136
+
137
+ return blocks.get(block);
138
+ };
139
+
140
+ for (const selector of selectors) {
141
+ for (const match of selector.matchAll(CLASS_PATTERN)) {
142
+ const [, block, element, modifier] = match;
143
+ const entry = blockEntry(block);
144
+
145
+ if (element && modifier) entry.modifiers.add(`.${block}${element}${modifier}`);
146
+ else if (element) entry.elements.add(`.${block}${element}`);
147
+ else if (modifier) entry.modifiers.add(`.${block}${modifier}`);
148
+ }
149
+
150
+ for (const match of selector.matchAll(
151
+ /\[((?:data|aria)-[\w-]+)(?:[~|^$*]?=("[^"]*"|[^\]]*))?\]/g,
152
+ )) {
153
+ const [whole, attribute] = match;
154
+
155
+ if (attribute === "data-slot") slots.add(whole);
156
+ else states.add(whole);
157
+ }
158
+
159
+ for (const match of selector.matchAll(/:([a-z-]+)/g)) {
160
+ if (STATE_PSEUDO_CLASSES.has(match[1])) states.add(`:${match[1]}`);
161
+ }
162
+ }
163
+
164
+ const properties = new Map();
165
+
166
+ for (const match of clean.matchAll(/(?:^|[;{}])\s*(--[\w-]+)\s*:\s*([^;{}]+)/g)) {
167
+ const [, name, value] = match;
168
+
169
+ if (name.startsWith("--tw-")) continue;
170
+ if (!properties.has(name)) properties.set(name, value.replace(/\s+/g, " ").trim());
171
+ }
172
+
173
+ const tokens = new Set();
174
+ /** Records the HeroUI token behind a Tailwind theme variable (`--color-field` -> `--field-background`). */
175
+ const addToken = (name) => tokens.add(themeMap.get(name) ?? name);
176
+
177
+ for (const match of clean.matchAll(/var\(\s*(--[\w-]+)/g)) {
178
+ if (!properties.has(match[1]) && !match[1].startsWith("--tw-")) addToken(match[1]);
179
+ }
180
+
181
+ for (const match of clean.matchAll(/@apply\s+([^;]+);/g)) {
182
+ for (const rawUtility of match[1].split(/\s+/)) {
183
+ const utility = rawUtility
184
+ .split(":")
185
+ .pop()
186
+ .replace(/^!|!$/g, "")
187
+ .replace(/\/[\w.[\]%-]+$/, "");
188
+
189
+ if (STATUS_UTILITY_TOKENS[utility]) {
190
+ for (const token of STATUS_UTILITY_TOKENS[utility]) tokens.add(token);
191
+ continue;
192
+ }
193
+ if (/^shadow-(surface|overlay|field)$/.test(utility)) {
194
+ addToken(`--${utility}`);
195
+ continue;
196
+ }
197
+ if (/^rounded(-[a-z]{1,2})?-(xs|sm|md|lg|xl|2xl|3xl|4xl)$/.test(utility)) {
198
+ tokens.add("--radius");
199
+ continue;
200
+ }
201
+ if (/^rounded(-[a-z]{1,2})?-field$/.test(utility)) {
202
+ addToken("--radius-field");
203
+ continue;
204
+ }
205
+ for (const prefix of COLOR_UTILITY_PREFIXES) {
206
+ if (!utility.startsWith(`${prefix}-`)) continue;
207
+ const color = colorNames.find((name) => utility === `${prefix}-${name}`);
208
+
209
+ if (color) addToken(`--color-${color}`);
210
+ }
211
+ }
212
+ }
213
+
214
+ return {
215
+ blocks: [...blocks].map(([name, entry]) => ({
216
+ elements: [...entry.elements].sort(),
217
+ modifiers: [...entry.modifiers].sort(),
218
+ name: `.${name}`,
219
+ })),
220
+ customProperties: [...properties].map(([name, value]) => ({name, value})),
221
+ slots: [...slots].sort(),
222
+ states: [...states].sort(),
223
+ tokens: [...tokens].sort(),
224
+ };
225
+ };
226
+
227
+ const printList = (title, items) => {
228
+ if (items.length === 0) return;
229
+ console.log(`\n${title}`);
230
+ for (const item of items) console.log(` ${item}`);
231
+ };
232
+
233
+ const main = () => {
234
+ const {dir, rest} = takeDirArg(process.argv.slice(2));
235
+ const flags = new Set(rest.filter((arg) => arg.startsWith("--")));
236
+ const names = rest.filter((arg) => !arg.startsWith("--")).map(toKebab);
237
+
238
+ const {cssRoot, version} = findStylesDir(dir);
239
+ const componentsDir = path.join(cssRoot, "components");
240
+ const available = fs
241
+ .readdirSync(componentsDir)
242
+ .filter((file) => file.endsWith(".css") && file !== "index.css")
243
+ .map((file) => file.replace(/\.css$/, ""))
244
+ .sort();
245
+
246
+ if (names.length === 0) {
247
+ console.log(`# @heroui/styles ${version}`);
248
+ console.log(`# ${componentsDir}`);
249
+ console.log(`# ${available.length} component stylesheets\n`);
250
+ console.log(available.join("\n"));
251
+
252
+ return;
253
+ }
254
+
255
+ const theme = readThemeMap(cssRoot);
256
+ const results = [];
257
+
258
+ for (const name of names) {
259
+ if (!available.includes(name)) {
260
+ const hints = available.filter((item) => item.includes(name) || name.includes(item));
261
+
262
+ console.error(
263
+ `# No stylesheet for "${name}".` +
264
+ (hints.length
265
+ ? ` Did you mean: ${hints.join(", ")}?`
266
+ : " Run without arguments to list all."),
267
+ );
268
+ continue;
269
+ }
270
+
271
+ const file = path.join(componentsDir, `${name}.css`);
272
+ const css = fs.readFileSync(file, "utf8");
273
+
274
+ results.push({component: name, file, ...analyze(css, theme), css});
275
+ }
276
+
277
+ if (flags.has("--json")) {
278
+ const payload = results.map(({css, ...result}) =>
279
+ flags.has("--css") ? {...result, css} : result,
280
+ );
281
+
282
+ console.log(JSON.stringify({components: payload, version}, null, 2));
283
+
284
+ return;
285
+ }
286
+
287
+ for (const result of results) {
288
+ console.log(`\n# ${result.component} (@heroui/styles ${version})`);
289
+ console.log(`# ${result.file}`);
290
+
291
+ for (const block of result.blocks) {
292
+ console.log(`\nBlock ${block.name}`);
293
+ if (block.elements.length) console.log(` elements: ${block.elements.join(" ")}`);
294
+ if (block.modifiers.length) console.log(` modifiers: ${block.modifiers.join(" ")}`);
295
+ }
296
+
297
+ printList("State selectors (style the pseudo-class AND the data attribute)", result.states);
298
+ printList("data-slot hooks", result.slots);
299
+ printList(
300
+ "Component custom properties (set them on the component class, not on :root)",
301
+ result.customProperties.map((property) => `${property.name}: ${property.value}`),
302
+ );
303
+ printList("Theme tokens read by this component", result.tokens);
304
+
305
+ if (flags.has("--css")) {
306
+ console.log("\n/* ---- source ---- */");
307
+ console.log(result.css);
308
+ }
309
+ }
310
+
311
+ if (results.length === 0) process.exit(1);
312
+ };
313
+
314
+ try {
315
+ main();
316
+ } catch (error) {
317
+ console.error(`Error: ${error.message}`);
318
+ process.exit(1);
319
+ }
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * List the theme tokens of the INSTALLED `@heroui/styles` (no network).
4
+ *
5
+ * Usage:
6
+ * node list_tokens.mjs # every block: shared, light, dark + Tailwind mapping
7
+ * node list_tokens.mjs --mode dark # only the dark block
8
+ * node list_tokens.mjs --names # token names only, one per line (deduplicated)
9
+ * node list_tokens.mjs --json # machine-readable output
10
+ * node list_tokens.mjs --dir <path> # explicit @heroui/styles location
11
+ *
12
+ * Reads `themes/default/variables.css` (token values per mode) and
13
+ * `themes/shared/theme.css` (token -> Tailwind theme variable mapping).
14
+ */
15
+ import fs from "node:fs";
16
+ import path from "node:path";
17
+
18
+ import {findStylesDir, stripComments, takeDirArg} from "./_styles_dir.mjs";
19
+
20
+ /** Splits `css` into top-level `{selector, body}` rules, descending into at-rules. */
21
+ const readRules = (css) => {
22
+ const rules = [];
23
+ let depth = 0;
24
+ let start = 0;
25
+ let prelude = "";
26
+ let bodyStart = 0;
27
+
28
+ for (let i = 0; i < css.length; i++) {
29
+ const char = css[i];
30
+
31
+ if (char === "{") {
32
+ if (depth === 0) {
33
+ prelude = css.slice(start, i).trim();
34
+ bodyStart = i + 1;
35
+ }
36
+ depth++;
37
+ } else if (char === "}") {
38
+ depth--;
39
+ if (depth === 0) {
40
+ const body = css.slice(bodyStart, i);
41
+
42
+ if (prelude.startsWith("@layer") || prelude.startsWith("@media")) {
43
+ rules.push(...readRules(body));
44
+ } else {
45
+ rules.push({body, selector: prelude.replace(/\s+/g, " ")});
46
+ }
47
+ start = i + 1;
48
+ }
49
+ }
50
+ }
51
+
52
+ return rules;
53
+ };
54
+
55
+ /** Reads `--name: value;` declarations at the top level of a rule body. */
56
+ const readDeclarations = (body) => {
57
+ const declarations = [];
58
+ let depth = 0;
59
+ let current = "";
60
+
61
+ for (const char of body) {
62
+ if (char === "{") depth++;
63
+ if (char === "}") {
64
+ depth--;
65
+ current = "";
66
+ continue;
67
+ }
68
+ if (depth > 0) continue;
69
+ if (char === ";") {
70
+ const match = current.match(/^\s*(--[\w-]+)\s*:\s*([\s\S]+)$/);
71
+
72
+ if (match) declarations.push({name: match[1], value: match[2].replace(/\s+/g, " ").trim()});
73
+ current = "";
74
+ } else {
75
+ current += char;
76
+ }
77
+ }
78
+
79
+ return declarations;
80
+ };
81
+
82
+ const modeOf = (selector) => {
83
+ if (selector.startsWith("@theme")) return "tailwind";
84
+ if (selector.includes("data-vibrant-palette")) return "vibrant";
85
+ if (/\.dark|data-theme="dark"/.test(selector)) return "dark";
86
+ if (/\.light|data-theme="light"/.test(selector)) return "light";
87
+
88
+ return "shared";
89
+ };
90
+
91
+ const main = () => {
92
+ const {dir, rest} = takeDirArg(process.argv.slice(2));
93
+ const asJson = rest.includes("--json");
94
+ const namesOnly = rest.includes("--names");
95
+ const modeIndex = rest.indexOf("--mode");
96
+ const onlyMode = modeIndex === -1 ? null : rest[modeIndex + 1];
97
+
98
+ const {cssRoot, version} = findStylesDir(dir);
99
+ const variablesPath = path.join(cssRoot, "themes", "default", "variables.css");
100
+ const themePath = path.join(cssRoot, "themes", "shared", "theme.css");
101
+
102
+ const blocks = [];
103
+
104
+ for (const file of [variablesPath, themePath]) {
105
+ for (const rule of readRules(stripComments(fs.readFileSync(file, "utf8")))) {
106
+ const mode = modeOf(rule.selector);
107
+
108
+ if (mode === "vibrant") continue;
109
+ const existing = blocks.find((block) => block.mode === mode);
110
+ const tokens = readDeclarations(rule.body);
111
+
112
+ if (existing) existing.tokens.push(...tokens);
113
+ else blocks.push({mode, selector: rule.selector, tokens});
114
+ }
115
+ }
116
+
117
+ const selected = onlyMode ? blocks.filter((block) => block.mode === onlyMode) : blocks;
118
+
119
+ if (asJson) {
120
+ console.log(JSON.stringify({blocks: selected, cssRoot, version}, null, 2));
121
+
122
+ return;
123
+ }
124
+
125
+ if (namesOnly) {
126
+ const names = new Set(selected.flatMap((block) => block.tokens.map((token) => token.name)));
127
+
128
+ console.log([...names].join("\n"));
129
+
130
+ return;
131
+ }
132
+
133
+ console.log(`/* @heroui/styles ${version} */`);
134
+ console.log(`/* ${variablesPath} */`);
135
+ console.log(`/* ${themePath} */`);
136
+
137
+ const titles = {
138
+ dark: "Dark mode tokens",
139
+ light: "Light mode tokens",
140
+ shared: "Shared tokens (same in every mode)",
141
+ tailwind: "Tailwind mapping (@theme inline): theme variable -> HeroUI token",
142
+ };
143
+
144
+ for (const block of selected) {
145
+ console.log(`\n/* ${titles[block.mode]} */`);
146
+ console.log(`${block.selector} {`);
147
+ for (const token of block.tokens) console.log(` ${token.name}: ${token.value};`);
148
+ console.log("}");
149
+ }
150
+ };
151
+
152
+ try {
153
+ main();
154
+ } catch (error) {
155
+ console.error(`Error: ${error.message}`);
156
+ process.exit(1);
157
+ }
@@ -0,0 +1,12 @@
1
+ # Flow behavior contract
2
+
3
+ Use one contract per independently designed flow. Name the flow, starting route and relevant components. Record approved design decisions in English; keep open questions separate. Preserve existing scenario IDs when editing.
4
+
5
+ | ID | Starting condition | Trigger | Expected result | Side effects / evidence |
6
+ | --- | --- | --- | --- | --- |
7
+
8
+ Include validation, pending, failure, recovery, success and retained data where applicable. Reference shared controls and approved tokens. Add only scenarios grounded in agreed requirements.
9
+
10
+ ## Open questions
11
+
12
+ Record unresolved product decisions here before treating them as acceptance criteria.
@@ -0,0 +1,13 @@
1
+ # ADS project profile
2
+
3
+ <!-- ads-profile: pending -->
4
+
5
+ Installation is complete. Project discovery is pending. Ask the agent to connect ADS using ads-init before recording or reviewing. Replace this starter with verified settings; remove the pending marker after discovery.
6
+
7
+ - **Application:** inspect app roots, manifests, lockfiles, framework and existing UI library.
8
+ - **Run locally:** record verified install, start and test commands with working directories, environment variable names and loopback URL discovery.
9
+ - **Flow mapping:** identify routes, components, services, existing contracts and shared dependencies. For new contracts without an existing convention use docs/ads/flows/<slug>.md.
10
+ - **Recording:** inspect existing tools and synthetic fixtures; select a Git-ignored output path. Record missing dependencies explicitly.
11
+ - **Design tokens:** identify approved theme sources, token validation and build integration; record any gaps.
12
+ - **Review:** identify available checks and evidence of business acceptance; distinguish actual acceptance from controlled responses.
13
+ - **Verification and gaps:** list checks actually run and unresolved decisions. Do not infer approved behavior from implementation.
@@ -0,0 +1,14 @@
1
+ # ADS behavior review
2
+
3
+ Record scope, revision or working tree, application origin and commands actually run. Lead with actionable findings and give an overall Passed, Failed or Unverified verdict.
4
+
5
+ | Component / scenario ID | Verdict | Expected / observed | Evidence / reproduction |
6
+ | --- | --- | --- | --- |
7
+
8
+ ## Design tokens
9
+
10
+ Give a separate token-gate verdict with source references. Report unresolved values by element, state, property and location. Withhold acceptance until mappings are resolved.
11
+
12
+ ## Evidence gaps
13
+
14
+ Passed requires observed evidence for all criteria. Failed requires a reproducible mismatch. Use Unverified for missing evidence. Identify controlled responses and actual service acceptance separately.
@@ -0,0 +1,11 @@
1
+ ## Agentic Design System
2
+
3
+ Use ads-init to discover or refresh this project's settings. Read docs/ads/project.md before recording, review or Figma handoff. If it contains `ads-profile: pending`, complete discovery with ads-init first. Preserve this project's UI stack and team conventions.
4
+
5
+ Maintain the affected flow's English behavior contract and stable scenario IDs when approved behavior changes. Use the approved contract as the baseline for fixes. Use approved design-system tokens for authored visual values, including nested slots and states. Run the project's token check and trace dynamic styles and Figma bindings. For an unresolved mapping, name the element, state, property, value and source; ask the designer which approved token to use and withhold acceptance until resolved.
6
+
7
+ Use ads-record for a separately requested walkthrough; use ads-code-review to verify integrated behavior. Use ads-figma-to-code for supplied Figma designs and ads-code-to-figma for editable Figma components or flows. Run local tools for the user. Recordings use synthetic input. Post results externally only when requested.
8
+
9
+ For HeroUI projects, use heroui-react to build interfaces and heroui-theming for explicitly requested global restyling or themes. Read tokens and component selectors from the installed @heroui/styles. Keep new token approval with the designer; allow literal definitions only in explicitly approved files and selectors recorded in the project profile. Component overrides, slots and states must use approved tokens. When installed, docs/ads/templates/theming.md explains the ADS integration and checks. Verify both modes, keyboard focus and reduced motion after a theme change.
10
+
11
+ The installed package version and file hashes are in .ads/install.json. To upgrade the bundle use `npx @skriv/ads@latest update`; reconcile reported local changes before retrying. Use `npx @skriv/ads@latest doctor` to check setup. Templates are in docs/ads/templates/.
@@ -0,0 +1,26 @@
1
+ # HeroUI theming in ADS
2
+
3
+ Use heroui-theming for an explicitly requested global visual change or named theme; use heroui-react to build interfaces. Preserve the target project's UI library and installed version. Custom styling and new tokens follow its designer-approval rules. The skill's examples illustrate HeroUI mechanics; raw visual values in example component overrides still need approved tokens under ADS.
4
+
5
+ ## Inspect the installed library
6
+
7
+ From the app root, run the installed skill's scripts by their actual paths:
8
+
9
+ ```sh
10
+ node .agents/skills/heroui-theming/scripts/list_tokens.mjs --json
11
+ node .agents/skills/heroui-theming/scripts/list_component_classes.mjs button --json
12
+ ```
13
+
14
+ In monorepos use the app working directory with an absolute skill-script path, or pass --dir pointing to that app's @heroui/styles package. These tools read local CSS and do not change node_modules. Install dependencies through the project's existing workflow if needed.
15
+
16
+ ## Definition sites and component overrides
17
+
18
+ Record the approved theme-definition files, exact theme selectors, entry import and token-check command in docs/ads/project.md. A named theme can use src/themes/<name>/variables.css plus component override files as described in the upstream recipe. Approve the definition site and any new tokens before adding them. Import the theme after HeroUI, use the prescribed cascade layers and activate it on html, including portaled overlays.
19
+
20
+ The reference ADS lab's checker reads docs/ads/token-sources.json. Each source names an exact repository-relative CSS file and the individual theme selectors where token values may be defined. @theme definitions are allowed in listed files too. For example, after approving a theme, append its variables.css with .brand-light, [data-theme="brand-light"], .brand-dark and [data-theme="brand-dark"] as its selectors. This is a configuration format for the reference checker, not an instruction to replace another project's existing token tooling.
21
+
22
+ Imports and a themes/ folder name grant no exemption. In an approved file only custom-property definitions in the approved theme scopes can contain raw visual values. Other declarations and component rules remain checked; component overrides reference the approved tokens. Unknown var() references still fail, including aliases inside definitions. Existing project profiles and theme decisions survive npm updates.
23
+
24
+ ## Verification
25
+
26
+ Run the project's token gate and production CSS build. Then exercise changed components and consuming flows in light and dark modes: rest, hover, pressed, invalid, disabled, keyboard focus, overlays and reduced motion as applicable. Keep foreground pairs readable. Update DESIGN.md and the profile to reflect approved visual changes. Maintain behavior contracts when an agreed behavior requirement changes; a visual theme alone does not authorize business behavior changes.
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@skriv/ads",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Project-local Agentic Design System skills, onboarding and diagnostics",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "bin": {
11
+ "ads": "bin/ads.mjs"
12
+ },
13
+ "files": [
14
+ "bin/",
15
+ "src/",
16
+ "dist/",
17
+ "README.md"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/skriv/ADS.git",
25
+ "directory": "packages/ads"
26
+ },
27
+ "scripts": {
28
+ "build": "node scripts/build.mjs",
29
+ "test": "node --test test/install.test.mjs",
30
+ "check": "npm run build && npm test",
31
+ "prepack": "npm run check",
32
+ "test:packed": "node scripts/test-packed.mjs"
33
+ }
34
+ }
package/src/doctor.mjs ADDED
@@ -0,0 +1,38 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { createRequire } from 'node:module';
5
+ import { hash, readOptional, readState, safePath } from './install.mjs';
6
+
7
+ export function doctor(target) {
8
+ const root = fs.realpathSync(target);
9
+ const checks = [];
10
+ const add = (name, status, detail) => checks.push({ name, status, detail });
11
+ add('Node.js', Number(process.versions.node.split('.')[0]) >= 22 ? 'ok' : 'error', process.version);
12
+ const state = readState(root);
13
+ add('ADS installation', state ? 'ok' : 'error', state ? `${state.package}@${state.version}` : 'Run npx @skriv/ads@latest init');
14
+ if (state) {
15
+ for (const [relative, digest] of Object.entries(state.files)) {
16
+ const bytes = readOptional(safePath(root, relative));
17
+ if (!bytes || hash(bytes) !== digest) add(relative, 'error', bytes ? 'Changed locally; reconcile before update' : 'Missing managed file; run update');
18
+ }
19
+ const instructions = readOptional(safePath(root, 'AGENTS.md'))?.toString() ?? '';
20
+ const block = instructions.match(/<!-- ads-package:begin -->[\s\S]*?<!-- ads-package:end -->/)?.[0];
21
+ const routingValid = block && hash(block) === state.routingHash;
22
+ add('Agent routing', routingValid ? 'ok' : 'error', routingValid ? 'ADS routing block checked' : block ? 'ADS routing block changed locally; reconcile before update' : 'ADS routing block missing');
23
+ }
24
+ const profile = readOptional(safePath(root, 'docs/ads/project.md'))?.toString();
25
+ add('Project discovery', !profile ? 'error' : profile.includes('ads-profile: pending') ? 'warn' : 'ok', !profile || profile.includes('ads-profile: pending') ? 'Ask the agent: Connect ADS to this project' : 'Profile present; agent must verify commands before use');
26
+ for (const [command, args] of [['ffmpeg', ['-version']], ['ffprobe', ['-version']], ['agent-browser', ['--version']]]) {
27
+ // Do not execute project-local npm scripts or auto-install packages during diagnostics.
28
+ const result = spawnSync(command, args, { encoding: 'utf8', timeout: 5000, shell: false });
29
+ add(command, !result.error && result.status === 0 ? 'ok' : 'warn', result.status === 0 ? result.stdout.trim().split('\n')[0] : 'Optional recording tool unavailable; see package setup guide');
30
+ }
31
+ let playwright;
32
+ for (const dir of [root, path.join(root, 'review')]) {
33
+ try { playwright = createRequire(path.join(dir, 'package.json')).resolve('playwright'); break; } catch {}
34
+ }
35
+ add('Playwright', playwright ? 'ok' : 'warn', playwright ? 'Available in project or review dependencies' : 'Use the project browser tooling or install Playwright when needed');
36
+ add('Figma connection', 'info', 'Agent verifies read/write access in the connected Figma tool when requested');
37
+ return { root, healthy: !checks.some(c => c.status === 'error'), checks };
38
+ }