uidex 0.2.1 → 0.2.4
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/README.md +132 -32
- package/claude/audit-command.md +40 -10
- package/claude/rules.md +99 -20
- package/dist/api/index.cjs +254 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +236 -0
- package/dist/api/index.d.ts +236 -0
- package/dist/api/index.js +226 -0
- package/dist/api/index.js.map +1 -0
- package/dist/core/index.cjs +10148 -2593
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +155 -172
- package/dist/core/index.d.ts +155 -172
- package/dist/core/index.global.js +65918 -2871
- package/dist/core/index.global.js.map +1 -1
- package/dist/core/index.js +10144 -2593
- package/dist/core/index.js.map +1 -1
- package/dist/core/style.css +1170 -612
- package/dist/index.cjs +10129 -2554
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -8
- package/dist/index.d.ts +43 -8
- package/dist/index.js +10128 -2555
- package/dist/index.js.map +1 -1
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.d.cts +2 -2
- package/dist/playwright/index.d.ts +2 -2
- package/dist/playwright/index.js.map +1 -1
- package/dist/playwright/reporter.cjs.map +1 -1
- package/dist/playwright/reporter.js.map +1 -1
- package/dist/react/index.cjs +10129 -2554
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +43 -8
- package/dist/react/index.d.ts +43 -8
- package/dist/react/index.js +10128 -2555
- package/dist/react/index.js.map +1 -1
- package/dist/scripts/cli.cjs +3235 -499
- package/package.json +20 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# uidex
|
|
2
2
|
|
|
3
|
-
A framework-agnostic library for highlighting and annotating UI elements. Works with React, vanilla JS, or any framework. Includes a build-time scanner, inspect mode, Playwright integration, and Claude Code tooling.
|
|
3
|
+
A framework-agnostic library for highlighting and annotating UI elements. Works with React, vanilla JS, or any framework. Includes a build-time scanner, annotation linting, inspect mode, Playwright integration, and Claude Code tooling.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -96,7 +96,7 @@ The scanner finds `data-uidex` attributes in your source files and generates a t
|
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
98
|
npx uidex scan # Generate registry
|
|
99
|
-
npx uidex scan --
|
|
99
|
+
npx uidex scan --audit # Validate coverage and annotations
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
Add it to your build:
|
|
@@ -117,6 +117,7 @@ Add it to your build:
|
|
|
117
117
|
<a href="/">Home</a>
|
|
118
118
|
</nav>
|
|
119
119
|
|
|
120
|
+
{/* Optional: add a JSDoc description for richer documentation */}
|
|
120
121
|
/** @uidex cta-button - Primary call-to-action button */
|
|
121
122
|
<button data-uidex="cta-button">Click Me</button>
|
|
122
123
|
```
|
|
@@ -130,11 +131,12 @@ The scanner generates `src/uidex.gen.ts` (gitignored) with:
|
|
|
130
131
|
- `ComponentId` — union type of all ids
|
|
131
132
|
- `pages` — from `UIDEX_PAGE.md` files (directory-based component association)
|
|
132
133
|
- `features` — from `UIDEX_FEATURE.md` files (explicit component association)
|
|
134
|
+
- `uiComponents` — presentational primitives detected under `ui/` directories (see [UI Primitives](#ui-primitives))
|
|
133
135
|
- Auto-registration calls
|
|
134
136
|
|
|
135
137
|
### Monorepo Support
|
|
136
138
|
|
|
137
|
-
Use `sources` for multiple scan roots:
|
|
139
|
+
The scanner auto-discovers multiple `.uidex.json` files in monorepo setups. Use `sources` for multiple scan roots within a single config:
|
|
138
140
|
|
|
139
141
|
```json
|
|
140
142
|
{
|
|
@@ -149,6 +151,72 @@ Use `sources` for multiple scan roots:
|
|
|
149
151
|
}
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
## UI Primitives
|
|
155
|
+
|
|
156
|
+
The scanner treats any `.tsx` file whose path contains a literal `ui/` segment as a presentational primitive (e.g. `components/ui/button.tsx`, `features/auth/ui/Form.tsx`). Primitives don't need `data-uidex` annotations — the scanner detects them by convention and emits a separate `uiComponents` array in `uidex.gen.ts` alongside the usual component map.
|
|
157
|
+
|
|
158
|
+
Each primitive gets a **scope** resolved by walking up from its file:
|
|
159
|
+
|
|
160
|
+
| Marker found first | Scope |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `UIDEX_FEATURE.md` | `feature:<dir-name>` |
|
|
163
|
+
| `UIDEX_PAGE.md` | `page:<dir-name>` |
|
|
164
|
+
| neither | `global` |
|
|
165
|
+
|
|
166
|
+
`npx uidex scan --audit` flags imports of feature- or page-scoped primitives from outside their scope tree. Global primitives are exempt.
|
|
167
|
+
|
|
168
|
+
### Shape
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import type { PrimitiveEntry } from 'uidex';
|
|
172
|
+
|
|
173
|
+
// interface PrimitiveEntry {
|
|
174
|
+
// name: string; // exported component name, e.g. "Button"
|
|
175
|
+
// filePath: string; // source-root-relative path, e.g. "ui/button.tsx"
|
|
176
|
+
// scope: string; // "global" | "feature:<name>" | "page:<name>"
|
|
177
|
+
// composes: string[]; // names of other primitives this one imports
|
|
178
|
+
// usedBy: string[]; // file paths of consumers (non-primitive sources)
|
|
179
|
+
// kind: 'ui';
|
|
180
|
+
// }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`composes` and `usedBy` are filled in by a cross-source provenance pass, so you get the full dependency graph without maintaining it by hand. Barrel (`index.ts`) re-exports are **not** followed — import primitives directly from their source file for accurate tracking.
|
|
184
|
+
|
|
185
|
+
### Building a custom catalog from `uiComponents`
|
|
186
|
+
|
|
187
|
+
`uiComponents` is the public contract for building your own design-system docs page or component explorer. Import it from the generated file and render however you like:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// app/gallery/page.tsx
|
|
191
|
+
import { uiComponents } from '@/uidex.gen';
|
|
192
|
+
import { Button } from '@/components/ui/button';
|
|
193
|
+
|
|
194
|
+
// The only thing you maintain by hand: a map from primitive name to a live preview.
|
|
195
|
+
const previews: Record<string, React.ReactNode> = {
|
|
196
|
+
Button: <Button>Click me</Button>,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default function Gallery() {
|
|
200
|
+
return (
|
|
201
|
+
<ul>
|
|
202
|
+
{uiComponents.map((entry) => (
|
|
203
|
+
<li key={entry.filePath + entry.name}>
|
|
204
|
+
<h3>{entry.name} <small>({entry.scope})</small></h3>
|
|
205
|
+
<div>{previews[entry.name] ?? <em>no preview</em>}</div>
|
|
206
|
+
<p>Used by {entry.usedBy.length} file(s)</p>
|
|
207
|
+
</li>
|
|
208
|
+
))}
|
|
209
|
+
</ul>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
That's the whole pattern: **uidex ships the data, you ship the renderer.** Group by `scope` for sectioned layouts, filter on `composes`/`usedBy` to surface dependency graphs, or skip live previews entirely and render it as a plain data table.
|
|
215
|
+
|
|
216
|
+
> **Note:** the `uiComponents` export is only present when the scanner finds at least one primitive. If your project has none yet, create a file under a `ui/` directory and re-run `npx uidex scan`.
|
|
217
|
+
|
|
218
|
+
See [`examples/next-app/app/gallery/page.tsx`](./examples/next-app/app/gallery/page.tsx) for a worked example that groups primitives by scope and renders each with a live preview + `composes`/`usedBy` metadata.
|
|
219
|
+
|
|
152
220
|
## Components
|
|
153
221
|
|
|
154
222
|
### UidexDevtools (React)
|
|
@@ -160,6 +228,7 @@ import { UidexDevtools } from 'uidex';
|
|
|
160
228
|
|
|
161
229
|
<UidexDevtools
|
|
162
230
|
buttonPosition="bottom-right"
|
|
231
|
+
theme="auto"
|
|
163
232
|
onSelect={(id) => console.log(id)}
|
|
164
233
|
/>
|
|
165
234
|
```
|
|
@@ -169,9 +238,12 @@ import { UidexDevtools } from 'uidex';
|
|
|
169
238
|
| `components` | `UidexMap` | registry | Components map |
|
|
170
239
|
| `config` | `UidexConfig` | - | Styling configuration |
|
|
171
240
|
| `buttonPosition` | `ButtonPosition` | `'bottom-right'` | Initial button position |
|
|
241
|
+
| `theme` | `UidexTheme` | `'auto'` | Theme: `'dark'`, `'light'`, or `'auto'` |
|
|
172
242
|
| `disabled` | `boolean` | `false` | Disable devtools |
|
|
173
243
|
| `onSelect` | `(id: string) => void` | - | Selection callback |
|
|
174
244
|
| `inspectShortcut` | `KeyboardShortcut \| false` | `Shift+Cmd+U` | Inspect mode shortcut |
|
|
245
|
+
| `ingest` | `IngestConfig` | - | Server feedback submission config |
|
|
246
|
+
| `onSubmit` | `(report, result) => void` | - | Callback after feedback submission |
|
|
175
247
|
|
|
176
248
|
### UidexOverlay (React)
|
|
177
249
|
|
|
@@ -209,6 +281,7 @@ const ui = createUidexUI({
|
|
|
209
281
|
features: [ ... ],
|
|
210
282
|
config: { defaults: { color: '#3b82f6' } },
|
|
211
283
|
buttonPosition: 'bottom-right',
|
|
284
|
+
theme: 'auto',
|
|
212
285
|
inspectShortcut: { key: 'u', shiftKey: true, metaKey: true },
|
|
213
286
|
onSelect: (id) => console.log(id),
|
|
214
287
|
});
|
|
@@ -217,6 +290,37 @@ ui.mount();
|
|
|
217
290
|
ui.destroy();
|
|
218
291
|
```
|
|
219
292
|
|
|
293
|
+
## Theming
|
|
294
|
+
|
|
295
|
+
The devtools widget supports automatic theme detection. Set `theme="auto"` (the default) to match the host page's theme — it checks for `.dark` / `.light` classes on `<html>` and falls back to the OS `prefers-color-scheme` media query. Changes are tracked live via `MutationObserver` and `matchMedia` listeners.
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
// Auto-detect (default) — matches host page or OS preference
|
|
299
|
+
<UidexDevtools theme="auto" />
|
|
300
|
+
|
|
301
|
+
// Force dark or light
|
|
302
|
+
<UidexDevtools theme="dark" />
|
|
303
|
+
<UidexDevtools theme="light" />
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
All UI renders inside a Shadow DOM with CSS custom properties. The default theme is dark. Override tokens for a light theme:
|
|
307
|
+
|
|
308
|
+
```css
|
|
309
|
+
:root {
|
|
310
|
+
--background: #ffffff;
|
|
311
|
+
--foreground: #262626;
|
|
312
|
+
--card: #ffffff;
|
|
313
|
+
--card-foreground: #262626;
|
|
314
|
+
--popover: #ffffff;
|
|
315
|
+
--popover-foreground: #262626;
|
|
316
|
+
--primary: #262626;
|
|
317
|
+
--primary-foreground: #fafafa;
|
|
318
|
+
--muted: rgba(0, 0, 0, 0.04);
|
|
319
|
+
--muted-foreground: #6b6b6b;
|
|
320
|
+
--border: rgba(0, 0, 0, 0.08);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
220
324
|
## Inspect Mode
|
|
221
325
|
|
|
222
326
|
Press **Shift+Cmd+U** (Shift+Ctrl+U on Windows/Linux) to enter inspect mode. Hover over elements to highlight them, click to select. Press **Escape** to exit.
|
|
@@ -275,42 +379,21 @@ npx uidex scaffold [dir]
|
|
|
275
379
|
|
|
276
380
|
## Claude Code Integration
|
|
277
381
|
|
|
278
|
-
Set up Claude Code with uidex-aware rules, a `/uidex
|
|
382
|
+
Set up Claude Code with uidex-aware rules, a `/uidex:audit` skill, and a post-edit hook that validates coverage:
|
|
279
383
|
|
|
280
384
|
```bash
|
|
281
|
-
npx uidex claude
|
|
282
|
-
npx uidex claude
|
|
385
|
+
npx uidex claude install # Add rules + skill + hooks
|
|
386
|
+
npx uidex claude uninstall # Remove everything
|
|
283
387
|
```
|
|
284
388
|
|
|
285
389
|
Manage individually:
|
|
286
390
|
|
|
287
391
|
```bash
|
|
288
392
|
npx uidex claude rules add|remove # .claude/rules/uidex.md
|
|
289
|
-
npx uidex claude skill add|remove # .claude/commands/uidex
|
|
393
|
+
npx uidex claude skill add|remove # .claude/commands/uidex/audit.md
|
|
290
394
|
npx uidex claude hooks add|remove # PostToolUse hook in .claude/settings.json
|
|
291
395
|
```
|
|
292
396
|
|
|
293
|
-
## Theming
|
|
294
|
-
|
|
295
|
-
All UI renders inside a Shadow DOM with CSS custom properties. Override any token at `:root`:
|
|
296
|
-
|
|
297
|
-
```css
|
|
298
|
-
:root {
|
|
299
|
-
--uidex-color-primary: #2e2e2e;
|
|
300
|
-
--uidex-color-bg: #ffffff;
|
|
301
|
-
--uidex-color-bg-elevated: #f5f5f5;
|
|
302
|
-
--uidex-color-text: #1f2937;
|
|
303
|
-
--uidex-color-text-strong: #111827;
|
|
304
|
-
--uidex-color-text-muted: #6b7280;
|
|
305
|
-
--uidex-color-surface-hover: #f3f4f6;
|
|
306
|
-
--uidex-color-surface-active: #e5e7eb;
|
|
307
|
-
--uidex-color-border: #d1d5db;
|
|
308
|
-
--uidex-color-border-light: #e5e7eb;
|
|
309
|
-
}
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
33 tokens available across colors, shadows, border-radius, z-index, typography, and transitions. The default theme is dark monochromatic with zero border-radius and monospace typography.
|
|
313
|
-
|
|
314
397
|
## Package Exports
|
|
315
398
|
|
|
316
399
|
| Import | Description |
|
|
@@ -320,18 +403,26 @@ All UI renders inside a Shadow DOM with CSS custom properties. Override any toke
|
|
|
320
403
|
| `uidex/react` | React wrappers (`UidexDevtools`, `UidexOverlay`) |
|
|
321
404
|
| `uidex/playwright` | Test fixture and helpers |
|
|
322
405
|
| `uidex/playwright/reporter` | Coverage reporter |
|
|
406
|
+
| `uidex/api` | API client (Node.js) |
|
|
323
407
|
| `uidex/styles.css` | Standalone CSS (optional, auto-injected via Shadow DOM) |
|
|
324
408
|
|
|
325
409
|
## CLI Reference
|
|
326
410
|
|
|
327
411
|
```
|
|
328
|
-
npx uidex
|
|
412
|
+
npx uidex Show help / list commands
|
|
329
413
|
npx uidex init Create .uidex.json and update .gitignore
|
|
330
414
|
npx uidex scan Run component scanner
|
|
331
|
-
npx uidex scan --
|
|
415
|
+
npx uidex scan --audit Validate coverage and annotations
|
|
332
416
|
npx uidex scaffold [dir] Generate Playwright test stubs
|
|
333
|
-
npx uidex claude
|
|
334
|
-
npx uidex claude
|
|
417
|
+
npx uidex claude install Set up Claude Code integration
|
|
418
|
+
npx uidex claude uninstall Remove Claude Code integration
|
|
419
|
+
npx uidex login Authenticate with uidex server
|
|
420
|
+
npx uidex logout Remove stored credentials
|
|
421
|
+
npx uidex link Link current directory to org/project
|
|
422
|
+
npx uidex status Show auth and link state
|
|
423
|
+
npx uidex feedback Manage feedback (list, show, update, delete)
|
|
424
|
+
npx uidex triage Manage triage (run, list, show, approve, dismiss, submit)
|
|
425
|
+
npx uidex integrations Manage integrations (list, add, remove, test, targets)
|
|
335
426
|
```
|
|
336
427
|
|
|
337
428
|
## TypeScript
|
|
@@ -346,10 +437,19 @@ import type {
|
|
|
346
437
|
UidexLocation,
|
|
347
438
|
UidexPage,
|
|
348
439
|
UidexFeature,
|
|
440
|
+
UidexTheme,
|
|
441
|
+
UidexUIOptions,
|
|
442
|
+
PrimitiveEntry,
|
|
349
443
|
BorderStyle,
|
|
350
444
|
LabelPosition,
|
|
351
445
|
ButtonPosition,
|
|
352
446
|
KeyboardShortcut,
|
|
447
|
+
OverlayOptions,
|
|
448
|
+
IngestConfig,
|
|
449
|
+
FeedbackReport,
|
|
450
|
+
FeedbackResult,
|
|
451
|
+
FeedbackType,
|
|
452
|
+
FeedbackSeverity,
|
|
353
453
|
} from 'uidex';
|
|
354
454
|
```
|
|
355
455
|
|
package/claude/audit-command.md
CHANGED
|
@@ -1,16 +1,46 @@
|
|
|
1
|
-
Run `npx uidex scan --
|
|
1
|
+
Run `npx uidex scan --audit` and fix all reported issues:
|
|
2
2
|
|
|
3
|
-
1. **Uncovered components** (components missing
|
|
4
|
-
- Create a `UIDEX_PAGE.md` in the
|
|
5
|
-
-
|
|
3
|
+
1. **Uncovered components** (components missing doc coverage):
|
|
4
|
+
- Create a `UIDEX_PAGE.md` in the component's directory for page-specific components
|
|
5
|
+
- For cross-cutting components (auth, billing, search, etc.), create or update a `UIDEX_FEATURE.md` in `features/<name>/` and list the component ID in the `components:` frontmatter
|
|
6
|
+
- Include a `# Title`, `> description` blockquote, and `## Acceptance` with `- [ ]` checkboxes
|
|
6
7
|
|
|
7
|
-
2. **
|
|
8
|
+
2. **Route directories missing UIDEX_PAGE.md** (route with `page.tsx` but no doc):
|
|
9
|
+
- Create a `UIDEX_PAGE.md` in the route directory
|
|
10
|
+
- Without its own doc, the route's components get absorbed by a parent page doc
|
|
11
|
+
|
|
12
|
+
3. **Orphaned UIDEX_PAGE.md files** (docs with no components underneath):
|
|
8
13
|
- If the components were removed, delete the UIDEX_PAGE.md
|
|
9
|
-
- If components are missing
|
|
14
|
+
- If components are missing annotations, add them
|
|
15
|
+
|
|
16
|
+
4. **Orphaned UIDEX_FEATURE.md files** (features referencing no known components):
|
|
17
|
+
- Update the `components:` frontmatter to reference valid component IDs
|
|
18
|
+
- If the feature is no longer relevant, delete it
|
|
19
|
+
|
|
20
|
+
5. **Missing descriptions** (pages/features without a `>` blockquote description):
|
|
21
|
+
- Add a `> description` blockquote immediately after the `# Title` heading
|
|
22
|
+
|
|
23
|
+
6. **Missing block annotations** (structural regions):
|
|
24
|
+
- Add `data-uidex-block="kebab-id"` to page root wrappers and section containers
|
|
25
|
+
- Blocks do NOT need JSDoc comments
|
|
26
|
+
|
|
27
|
+
7. **Missing interactive annotations**:
|
|
28
|
+
- Add `data-uidex="kebab-id"` to buttons, inputs, links, and other interactive elements
|
|
29
|
+
- Optionally add `/** @uidex id - description */` JSDoc above interactive elements
|
|
30
|
+
|
|
31
|
+
8. **Primitive annotations** — use `data-uidex-primitive="kebab-name"` when a component is a **reusable presentational building block**, not a consumer/page component. Apply when ALL of these are true:
|
|
32
|
+
- The file **exports** a component (not a page or layout)
|
|
33
|
+
- The component **wraps native HTML elements or other primitives** (buttons, inputs, cards, badges) rather than composing app-level features
|
|
34
|
+
- The component is **imported by multiple consumers** or is designed to be reusable
|
|
35
|
+
- The component does **not fetch data or contain business logic** — it receives everything via props
|
|
36
|
+
|
|
37
|
+
Do NOT add `data-uidex-primitive` to:
|
|
38
|
+
- Page components, layouts, or route-level files
|
|
39
|
+
- Feature orchestrators (dialogs that compose multiple primitives with business logic)
|
|
40
|
+
- Components that call hooks for data fetching (`useQuery`, `useMutation`, etc.)
|
|
41
|
+
- One-off components only used in a single place (use `data-uidex` or `data-uidex-block` instead)
|
|
10
42
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- Add `data-uidex="kebab-id"` attributes where missing
|
|
14
|
-
- Add `/** @uidex id - description */` JSDoc above each annotated element
|
|
43
|
+
Files with `data-uidex-primitive` are exempt from missing-annotation lint checks.
|
|
44
|
+
The scanner detects primitives by the attribute alone — directory structure does not matter.
|
|
15
45
|
|
|
16
46
|
After fixing all issues, run `npx uidex scan` to regenerate the component registry.
|
package/claude/rules.md
CHANGED
|
@@ -2,16 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses [uidex](https://github.com/soel/uidex) for UI element tracking and documentation.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Annotations
|
|
6
|
+
|
|
7
|
+
uidex uses three annotation types:
|
|
8
|
+
|
|
9
|
+
### `data-uidex` — interactive elements
|
|
10
|
+
|
|
11
|
+
Every user-facing interactive element MUST have a `data-uidex="kebab-id"` attribute.
|
|
6
12
|
|
|
7
|
-
- Every user-facing interactive element MUST have a `data-uidex="kebab-id"` attribute.
|
|
8
13
|
- IDs should be descriptive and kebab-cased: `data-uidex="submit-btn"`, `data-uidex="user-avatar"`.
|
|
9
14
|
- When creating new components with interactive elements, always add `data-uidex` attributes.
|
|
10
15
|
- When modifying components, preserve existing `data-uidex` attributes. If you rename or remove an element, update or remove its attribute accordingly.
|
|
11
16
|
|
|
17
|
+
### `data-uidex-block` — structural regions
|
|
18
|
+
|
|
19
|
+
Structural UI regions (pages, sections, panels, toolbars) use `data-uidex-block="kebab-id"`.
|
|
20
|
+
|
|
21
|
+
- Add `data-uidex-block` to the root wrapper of each page/component.
|
|
22
|
+
- Add `data-uidex-block` to meaningful sections within a page (forms, tables, sidebars, etc.).
|
|
23
|
+
- Blocks do NOT need JSDoc comments — they are spatial context, not documented behavior.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<div data-uidex-block="settings-page">
|
|
27
|
+
<form data-uidex-block="settings-form">
|
|
28
|
+
/** @uidex save-btn - Saves current settings */
|
|
29
|
+
<button data-uidex="save-btn">Save</button>
|
|
30
|
+
</form>
|
|
31
|
+
</div>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `data-uidex-primitive` — reusable UI component definitions
|
|
35
|
+
|
|
36
|
+
Reusable, presentational components (buttons, inputs, cards, etc.) use `data-uidex-primitive="kebab-name"` on the root element inside the component definition.
|
|
37
|
+
|
|
38
|
+
- Place the attribute on the root element of the component's **definition**, not at call sites.
|
|
39
|
+
- IDs should be descriptive and kebab-cased: `data-uidex-primitive="button"`, `data-uidex-primitive="sign-in-card"`.
|
|
40
|
+
- A single element can carry both `data-uidex-primitive` and `data-uidex` without conflict.
|
|
41
|
+
- Files containing `data-uidex-primitive` are exempt from missing-annotation lint checks.
|
|
42
|
+
- Primitives do NOT need JSDoc comments — they are tracked by the scanner automatically.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
// Button.tsx — component definition
|
|
46
|
+
export function Button({ children, ...props }) {
|
|
47
|
+
return <button data-uidex-primitive="button" {...props}>{children}</button>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### When to use which annotation
|
|
52
|
+
|
|
53
|
+
| Annotation | Use for | Placed on |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `data-uidex` | Interactive elements (buttons, inputs, links) | Usage sites in consumer components |
|
|
56
|
+
| `data-uidex-block` | Structural regions (pages, forms, sections) | Wrapper elements in consumer components |
|
|
57
|
+
| `data-uidex-primitive` | Reusable UI component definitions | Root element inside the component definition file |
|
|
58
|
+
|
|
12
59
|
## @uidex JSDoc comments
|
|
13
60
|
|
|
14
|
-
Add
|
|
61
|
+
Add JSDoc comments above `data-uidex` (interactive) elements to enrich documentation. Do NOT add JSDoc to `data-uidex-block` elements.
|
|
15
62
|
|
|
16
63
|
```tsx
|
|
17
64
|
/** @uidex submit-btn - Primary action button for form submission */
|
|
@@ -31,28 +78,43 @@ Multi-line format for longer descriptions:
|
|
|
31
78
|
|
|
32
79
|
## UIDEX_PAGE.md files
|
|
33
80
|
|
|
34
|
-
Page docs describe a route
|
|
81
|
+
Page docs describe a **route** (a URL the user can visit). Components in the directory are automatically associated.
|
|
35
82
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
83
|
+
- Place `UIDEX_PAGE.md` only in **route directories** (e.g., `app/settings/`, `app/dashboard/`, `app/(auth)/login/`).
|
|
84
|
+
- Do NOT place `UIDEX_PAGE.md` in non-route directories like `contexts/`, `hooks/`, `lib/`, `utils/`, or shared `components/`.
|
|
85
|
+
- Each route directory should have a `UIDEX_PAGE.md` with acceptance criteria.
|
|
86
|
+
- The description MUST be a `>` blockquote immediately after the `# Title` heading.
|
|
87
|
+
- Acceptance criteria MUST use `- [ ]` checkbox syntax.
|
|
88
|
+
- When adding components to a route directory that lacks a `UIDEX_PAGE.md`, create one.
|
|
89
|
+
- When removing all components from a route directory, remove its `UIDEX_PAGE.md`.
|
|
39
90
|
|
|
40
91
|
```markdown
|
|
41
92
|
# Page Name
|
|
42
93
|
|
|
43
|
-
Brief description of
|
|
94
|
+
> Brief description of what this page does and its purpose.
|
|
44
95
|
|
|
45
96
|
## Acceptance
|
|
46
|
-
- User can do X
|
|
47
|
-
- Y is displayed when Z
|
|
97
|
+
- [ ] User can do X
|
|
98
|
+
- [ ] Y is displayed when Z
|
|
48
99
|
```
|
|
49
100
|
|
|
50
101
|
## UIDEX_FEATURE.md files
|
|
51
102
|
|
|
52
|
-
Feature docs describe a cross-cutting feature. Components are explicitly listed via frontmatter.
|
|
103
|
+
Feature docs describe a cross-cutting feature that spans multiple pages. Components are explicitly listed via frontmatter.
|
|
53
104
|
|
|
54
|
-
-
|
|
105
|
+
- Place feature docs in a `features/` directory inside the scanner root (e.g., `app/features/auth/UIDEX_FEATURE.md`).
|
|
106
|
+
- Use one subdirectory per feature: `features/auth/`, `features/billing/`, `features/notifications/`, etc.
|
|
55
107
|
- List associated component IDs in the `components:` frontmatter.
|
|
108
|
+
- The description MUST be a `>` blockquote immediately after the `# Title` heading.
|
|
109
|
+
- When a component participates in a cross-cutting concern (auth, billing, search, etc.) and isn't fully described by its page alone, add it to a feature.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
features/
|
|
113
|
+
auth/
|
|
114
|
+
UIDEX_FEATURE.md
|
|
115
|
+
billing/
|
|
116
|
+
UIDEX_FEATURE.md
|
|
117
|
+
```
|
|
56
118
|
|
|
57
119
|
```markdown
|
|
58
120
|
---
|
|
@@ -62,11 +124,7 @@ components:
|
|
|
62
124
|
---
|
|
63
125
|
# Feature Name
|
|
64
126
|
|
|
65
|
-
Brief description of the feature.
|
|
66
|
-
|
|
67
|
-
## Acceptance
|
|
68
|
-
- User can do X
|
|
69
|
-
- Y is displayed when Z
|
|
127
|
+
> Brief description of the feature and its scope.
|
|
70
128
|
```
|
|
71
129
|
|
|
72
130
|
## Component registry
|
|
@@ -75,14 +133,35 @@ For a project-wide view of all components, pages, and features, read the generat
|
|
|
75
133
|
|
|
76
134
|
## Scanner
|
|
77
135
|
|
|
78
|
-
After adding, removing, or renaming `data-uidex` attributes, run:
|
|
136
|
+
After adding, removing, or renaming `data-uidex`, `data-uidex-block`, or `data-uidex-primitive` attributes, run:
|
|
79
137
|
|
|
80
138
|
```bash
|
|
81
139
|
npx uidex scan
|
|
82
140
|
```
|
|
83
141
|
|
|
84
|
-
To validate
|
|
142
|
+
To validate coverage and check for missing annotations:
|
|
85
143
|
|
|
86
144
|
```bash
|
|
87
|
-
npx uidex scan --
|
|
145
|
+
npx uidex scan --audit
|
|
88
146
|
```
|
|
147
|
+
|
|
148
|
+
## Setup & Administration
|
|
149
|
+
|
|
150
|
+
Manage authentication, project linking, and integrations via the CLI. These commands run in the user's terminal — use `! uidex <command>` to execute them from Claude Code.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Auth & context
|
|
154
|
+
! uidex login # Authenticate with uidex server
|
|
155
|
+
! uidex status # Show auth and link state
|
|
156
|
+
! uidex link # Link current directory to org/project
|
|
157
|
+
|
|
158
|
+
# Integrations
|
|
159
|
+
! uidex integrations list # List configured integrations
|
|
160
|
+
! uidex integrations add jira # Add Jira (interactive prompts)
|
|
161
|
+
! uidex integrations add github # Add GitHub (browser flow)
|
|
162
|
+
! uidex integrations test <id> # Test integration connection
|
|
163
|
+
! uidex integrations remove <id> # Remove integration (with confirmation)
|
|
164
|
+
! uidex integrations targets <id> # List available targets (repos, projects)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The prerequisite flow is: `login` → `link` → `integrations`. Adding/removing integrations requires org owner role.
|