uidex 0.3.0 → 0.5.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 (44) hide show
  1. package/dist/cli/cli.cjs +1116 -112
  2. package/dist/cli/cli.cjs.map +1 -1
  3. package/dist/cloud/index.cjs +395 -72
  4. package/dist/cloud/index.cjs.map +1 -1
  5. package/dist/cloud/index.d.cts +60 -86
  6. package/dist/cloud/index.d.ts +60 -86
  7. package/dist/cloud/index.js +396 -71
  8. package/dist/cloud/index.js.map +1 -1
  9. package/dist/headless/index.cjs +1505 -791
  10. package/dist/headless/index.cjs.map +1 -1
  11. package/dist/headless/index.d.cts +83 -75
  12. package/dist/headless/index.d.ts +83 -75
  13. package/dist/headless/index.js +1514 -791
  14. package/dist/headless/index.js.map +1 -1
  15. package/dist/index.cjs +6281 -3190
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +337 -229
  18. package/dist/index.d.ts +337 -229
  19. package/dist/index.js +6362 -3231
  20. package/dist/index.js.map +1 -1
  21. package/dist/playwright/index.cjs +4 -4
  22. package/dist/playwright/index.cjs.map +1 -1
  23. package/dist/playwright/index.js +3 -3
  24. package/dist/playwright/index.js.map +1 -1
  25. package/dist/playwright/reporter.cjs +3 -3
  26. package/dist/playwright/reporter.cjs.map +1 -1
  27. package/dist/playwright/reporter.js +3 -3
  28. package/dist/playwright/reporter.js.map +1 -1
  29. package/dist/react/index.cjs +6291 -3206
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +239 -186
  32. package/dist/react/index.d.ts +239 -186
  33. package/dist/react/index.js +6338 -3208
  34. package/dist/react/index.js.map +1 -1
  35. package/dist/scan/index.cjs +212 -82
  36. package/dist/scan/index.cjs.map +1 -1
  37. package/dist/scan/index.d.cts +31 -0
  38. package/dist/scan/index.d.ts +31 -0
  39. package/dist/scan/index.js +211 -81
  40. package/dist/scan/index.js.map +1 -1
  41. package/package.json +10 -8
  42. package/templates/claude/api.md +110 -0
  43. package/templates/claude/audit.md +8 -2
  44. package/templates/claude/rules.md +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uidex",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Convention-driven UI element registry and devtools surface for React apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -58,18 +58,15 @@
58
58
  "access": "public"
59
59
  },
60
60
  "peerDependencies": {
61
- "@playwright/test": ">=1.40",
62
- "react": ">=18",
63
- "react-dom": ">=18"
61
+ "@hey-api/client-fetch": "^0.10.0"
64
62
  },
65
63
  "peerDependenciesMeta": {
66
- "@playwright/test": {
64
+ "@hey-api/client-fetch": {
67
65
  "optional": true
68
66
  }
69
67
  },
70
68
  "dependencies": {
71
69
  "@clack/prompts": "^1.2.0",
72
- "@zag-js/combobox": "^1.40.0",
73
70
  "@zag-js/core": "^1.40.0",
74
71
  "@zag-js/dialog": "^1.40.0",
75
72
  "@zag-js/menu": "^1.40.0",
@@ -81,14 +78,17 @@
81
78
  "@zag-js/types": "^1.40.0",
82
79
  "@zag-js/utils": "^1.40.0",
83
80
  "clsx": "^2.1.1",
81
+ "lit-html": "^3.3.2",
84
82
  "lucide": "^1.8.0",
85
83
  "lucide-react": "^1.7.0",
84
+ "modern-screenshot": "^4.7.0",
86
85
  "tailwind-merge": "^3.5.0",
87
86
  "xstate": "^5.30.0",
88
87
  "zod": "^4.3.6",
89
88
  "zustand": "^5.0.2"
90
89
  },
91
90
  "devDependencies": {
91
+ "@hey-api/client-fetch": "^0.10.0",
92
92
  "@playwright/test": "^1.58.2",
93
93
  "@tailwindcss/cli": "^4.2.2",
94
94
  "@testing-library/jest-dom": "^6.6.3",
@@ -106,6 +106,7 @@
106
106
  "tsx": "^4.7.0",
107
107
  "typescript": "^5.9.3",
108
108
  "vitest": "^2.1.8",
109
+ "@uidex/api-client": "0.0.1",
109
110
  "@uidex/eslint-config": "0.0.0",
110
111
  "@uidex/tsconfig": "0.0.0"
111
112
  },
@@ -125,8 +126,9 @@
125
126
  },
126
127
  "scripts": {
127
128
  "dev": "tsup --watch",
128
- "build": "pnpm run build:css && tsup && pnpm run check:bundles",
129
- "build:css": "tailwindcss --input src/styles/tailwind.css --output src/styles/tailwind.built.css",
129
+ "build": "pnpm run generate:api-routes && pnpm run build:css && tsup && pnpm run check:bundles",
130
+ "generate:api-routes": "tsx scripts/generate-api-routes.ts",
131
+ "build:css": "tailwindcss --input src/browser/styles/tailwind.css --output src/browser/styles/tailwind.built.css",
130
132
  "check:bundles": "node scripts/check-bundles.mjs",
131
133
  "test": "vitest run",
132
134
  "test:watch": "vitest",
@@ -0,0 +1,110 @@
1
+ # uidex API
2
+
3
+ The uidex CLI includes an API client for querying and managing uidex resources (organizations, projects, reports, integrations, etc.).
4
+
5
+ ## Authentication
6
+
7
+ ```bash
8
+ npx uidex api login # Interactive browser login (opens browser, creates a personal access token)
9
+ npx uidex api login --token <tok> # Store a token directly
10
+ npx uidex api status # Check auth state
11
+ ```
12
+
13
+ Tokens are stored at `~/.uidex/cloud-token.json`. The `UIDEX_TOKEN` env var overrides the stored token.
14
+
15
+ ## Making requests
16
+
17
+ ```bash
18
+ npx uidex api <METHOD> <PATH> [flags]
19
+ ```
20
+
21
+ ### Flags
22
+
23
+ | Flag | Description |
24
+ | ------------------ | -------------------------------------------------------- |
25
+ | `--body <json>` | Request body (JSON string) |
26
+ | `--query <params>` | Query string (`key=val&key2=val2`) |
27
+ | `--base-url <url>` | Override API base URL (default: `https://app.uidex.dev`) |
28
+ | `--token <tok>` | Use a specific token for this request |
29
+ | `--raw` | Disable JSON pretty-printing |
30
+ | `--no-color` | Disable colored output |
31
+
32
+ Use `UIDEX_API_URL` env var to permanently override the base URL (e.g. for local dev at `http://localhost:4339`).
33
+
34
+ ## Discovering routes
35
+
36
+ ```bash
37
+ npx uidex api --list # List all routes
38
+ npx uidex api --list --tag Reports # Filter by tag
39
+ npx uidex api --list --json # JSON output
40
+ ```
41
+
42
+ ## Common workflows
43
+
44
+ ### List organizations and projects
45
+
46
+ ```bash
47
+ npx uidex api GET /api/organizations
48
+ npx uidex api GET /api/organizations/{orgId}/projects
49
+ ```
50
+
51
+ ### Query reports
52
+
53
+ ```bash
54
+ # All reports in an org
55
+ npx uidex api GET /api/organizations/{orgId}/reports
56
+
57
+ # Reports for a specific project
58
+ npx uidex api GET /api/organizations/{orgId}/projects/{projectId}/reports
59
+
60
+ # Filter with query params (status, type, severity, search, page, limit)
61
+ npx uidex api GET /api/organizations/{orgId}/projects/{projectId}/reports \
62
+ --query "status=open&type=bug&limit=10"
63
+
64
+ # Single report detail
65
+ npx uidex api GET /api/organizations/{orgId}/projects/{projectId}/feedback/{reportId}
66
+ ```
67
+
68
+ ### Update a report
69
+
70
+ ```bash
71
+ npx uidex api PATCH /api/organizations/{orgId}/projects/{projectId}/feedback/{reportId} \
72
+ --body '{"status":"resolved"}'
73
+ ```
74
+
75
+ ### Resolve a project key
76
+
77
+ Given a project key (e.g. from `NEXT_PUBLIC_UIDEX_PROJECT_KEY` in `.env.local`), resolve it to the project and org in one call:
78
+
79
+ ```bash
80
+ npx uidex api GET /api/projects/resolve --query "key=ux_dev_6ghJQlUj-OfgvKvbyQCGc8ugqgYe_xjO"
81
+ ```
82
+
83
+ Returns `{ organization, project, apiKey }` with full details.
84
+
85
+ ### Manage integrations
86
+
87
+ ```bash
88
+ npx uidex api GET /api/organizations/{orgId}/integrations
89
+ npx uidex api POST /api/organizations/{orgId}/integrations/{integrationId}/test
90
+ ```
91
+
92
+ ### Issue drafts
93
+
94
+ ```bash
95
+ npx uidex api GET /api/organizations/{orgId}/issue-drafts
96
+ npx uidex api POST /api/organizations/{orgId}/issue-drafts/{draftId}/submit
97
+ ```
98
+
99
+ ## Route tags
100
+
101
+ Routes are grouped by tag: `Ingest`, `Organizations`, `Members`, `Invitations`, `Projects`, `API Keys`, `Reports`, `Integrations`, `External Issues`, `Issue Drafts`, `Triage`, `User Tokens`, `CLI Auth`. Use `--list --tag <Tag>` to explore a specific group.
102
+
103
+ ## Resolving IDs
104
+
105
+ Most routes require `orgId` and `projectId` path parameters. To resolve them:
106
+
107
+ - **From a project key** (fastest): `GET /api/projects/resolve?key=<raw_key>` → returns both `organization.id` and `project.id`
108
+ - **From scratch**: `GET /api/organizations` → find org by `slug`, then `GET /api/organizations/{orgId}/projects` → find project by `slug`
109
+
110
+ When working in a repo that has uidex configured, read `NEXT_PUBLIC_UIDEX_PROJECT_KEY` from `.env.local` (or `.env`) and use the resolve endpoint to get the org and project IDs in one call.
@@ -1,8 +1,8 @@
1
1
  Run `npx uidex scan --audit` and fix all reported diagnostics.
2
2
 
3
3
  1. **`marker-md-ignored`** — legacy `UIDEX_PAGE.md` / `UIDEX_FEATURE.md` files from v1. Migrate their content:
4
- - Copy the description and acceptance list into a `@uidex page <id>` or `@uidex feature <id>` JSDoc block on the corresponding module (`page.tsx` for pages; the feature's main index/component for features).
5
- - Each `- [ ]` checkbox becomes one `@acceptance <text>` tag.
4
+ - Create a `uidex.page.ts` (in the route directory) or `uidex.feature.ts` (in the feature directory) and add an `export const uidex` block carrying the `page`/`feature` id, the description, and the acceptance list.
5
+ - Each `- [ ]` checkbox becomes one entry in the `acceptance` array.
6
6
  - Delete the `UIDEX_PAGE.md` / `UIDEX_FEATURE.md` file.
7
7
 
8
8
  2. **`acceptance-uncovered`** — a declared `@acceptance` criterion has no flow exercising it.
@@ -24,6 +24,12 @@ Run `npx uidex scan --audit` and fix all reported diagnostics.
24
24
  6. **`acceptance-orphan`** — an `@acceptance` tag appears on a JSDoc that doesn't declare `@uidex page|feature|widget`.
25
25
  - Move the acceptance tags into the correct JSDoc block, or remove them.
26
26
 
27
+ 7. **`prefer-well-known-file`** (INFO) — a page or feature's `export const uidex` lives on an arbitrary file instead of the well-known file (`uidex.page.ts` for pages, `uidex.feature.ts` for features). Migrate:
28
+ - Create `uidex.page.ts` (in the route directory) or `uidex.feature.ts` (in the feature directory).
29
+ - Move the `export const uidex` block from the current file into the new well-known file.
30
+ - Remove the export (and any now-unused `Uidex` type import) from the original file.
31
+ - Run `npx uidex scan` to regenerate the gen file — `loc.file` updates but the entity itself is unchanged.
32
+
27
33
  After fixing, run `npx uidex scan` to regenerate the gen file before re-running the audit.
28
34
 
29
35
  ## Decision rules for primitives
@@ -2,6 +2,21 @@
2
2
 
3
3
  This project uses [uidex](https://github.com/soel/uidex) for UI element tracking and feedback ingestion.
4
4
 
5
+ ## AI behavior
6
+
7
+ Before editing any file inside a feature directory (`src/features/<name>/`) or a Next.js route directory, read the entity's well-known metadata file first:
8
+
9
+ - Feature directories: `uidex.feature.ts` — the feature's `export const uidex` block lives here.
10
+ - Route directories: `uidex.page.ts` — the page's `export const uidex` block lives here.
11
+
12
+ These files declare `acceptance` criteria and a `description`. Treat them as **context steering**, not test assertions:
13
+
14
+ - Acceptance criteria capture what matters about the page or feature so changes preserve the right behaviors. They are NOT the testing source of truth — Playwright flows under `e2e/**` are.
15
+ - Before making a change, check whether it would violate a declared acceptance criterion. If it would, flag the conflict to the user before proceeding.
16
+ - If a change adds or removes user-visible behavior, update the acceptance list in the well-known file alongside the code change.
17
+
18
+ If a feature or page directory has no `uidex.feature.ts` / `uidex.page.ts`, the metadata may live on an arbitrary file in the directory (legacy convention) — `uidex scan --audit` will surface a `prefer-well-known-file` diagnostic with the current location.
19
+
5
20
  ## Entity model
6
21
 
7
22
  Eight entity kinds make up the registry. Most are discovered by convention; annotations only override.