uidex 0.4.0 → 0.5.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 (42) hide show
  1. package/dist/cli/cli.cjs +1111 -87
  2. package/dist/cli/cli.cjs.map +1 -1
  3. package/dist/cloud/index.cjs +375 -72
  4. package/dist/cloud/index.cjs.map +1 -1
  5. package/dist/cloud/index.d.cts +82 -0
  6. package/dist/cloud/index.d.ts +82 -0
  7. package/dist/cloud/index.js +376 -71
  8. package/dist/cloud/index.js.map +1 -1
  9. package/dist/headless/index.cjs +623 -469
  10. package/dist/headless/index.cjs.map +1 -1
  11. package/dist/headless/index.d.cts +77 -75
  12. package/dist/headless/index.d.ts +77 -75
  13. package/dist/headless/index.js +627 -469
  14. package/dist/headless/index.js.map +1 -1
  15. package/dist/index.cjs +4258 -2884
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +275 -234
  18. package/dist/index.d.ts +275 -234
  19. package/dist/index.js +4280 -2890
  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 +4299 -2906
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +206 -200
  32. package/dist/react/index.d.ts +206 -200
  33. package/dist/react/index.js +4339 -2926
  34. package/dist/react/index.js.map +1 -1
  35. package/dist/scan/index.cjs +201 -49
  36. package/dist/scan/index.cjs.map +1 -1
  37. package/dist/scan/index.d.cts +27 -1
  38. package/dist/scan/index.d.ts +27 -1
  39. package/dist/scan/index.js +200 -48
  40. package/dist/scan/index.js.map +1 -1
  41. package/package.json +8 -14
  42. package/templates/claude/api.md +110 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uidex",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Convention-driven UI element registry and devtools surface for React apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -59,8 +59,9 @@
59
59
  },
60
60
  "scripts": {
61
61
  "dev": "tsup --watch",
62
- "build": "pnpm run build:css && tsup && pnpm run check:bundles",
63
- "build:css": "tailwindcss --input src/styles/tailwind.css --output src/styles/tailwind.built.css",
62
+ "build": "pnpm run generate:api-routes && pnpm run build:css && tsup && pnpm run check:bundles",
63
+ "generate:api-routes": "tsx scripts/generate-api-routes.ts",
64
+ "build:css": "tailwindcss --input src/browser/styles/tailwind.css --output src/browser/styles/tailwind.built.css",
64
65
  "check:bundles": "node scripts/check-bundles.mjs",
65
66
  "test": "vitest run",
66
67
  "test:watch": "vitest",
@@ -69,19 +70,9 @@
69
70
  "views-map": "tsx scripts/extract-views-map.ts",
70
71
  "views-map:check": "tsx scripts/extract-views-map.ts --check"
71
72
  },
72
- "peerDependencies": {
73
- "@playwright/test": ">=1.40",
74
- "react": ">=18",
75
- "react-dom": ">=18"
76
- },
77
- "peerDependenciesMeta": {
78
- "@playwright/test": {
79
- "optional": true
80
- }
81
- },
82
73
  "dependencies": {
74
+ "@hey-api/client-fetch": "^0.10.0",
83
75
  "@clack/prompts": "^1.2.0",
84
- "@zag-js/combobox": "^1.40.0",
85
76
  "@zag-js/core": "^1.40.0",
86
77
  "@zag-js/dialog": "^1.40.0",
87
78
  "@zag-js/menu": "^1.40.0",
@@ -93,6 +84,7 @@
93
84
  "@zag-js/types": "^1.40.0",
94
85
  "@zag-js/utils": "^1.40.0",
95
86
  "clsx": "^2.1.1",
87
+ "lit-html": "^3.3.2",
96
88
  "lucide": "^1.8.0",
97
89
  "lucide-react": "^1.7.0",
98
90
  "modern-screenshot": "^4.7.0",
@@ -102,6 +94,7 @@
102
94
  "zustand": "^5.0.2"
103
95
  },
104
96
  "devDependencies": {
97
+ "@hey-api/client-fetch": "^0.10.0",
105
98
  "@playwright/test": "^1.58.2",
106
99
  "@tailwindcss/cli": "^4.2.2",
107
100
  "@testing-library/jest-dom": "^6.6.3",
@@ -109,6 +102,7 @@
109
102
  "@types/node": "^22.10.5",
110
103
  "@types/react": "^19.2.14",
111
104
  "@types/react-dom": "^19.2.3",
105
+ "@uidex/api-client": "workspace:*",
112
106
  "@uidex/eslint-config": "workspace:*",
113
107
  "@uidex/tsconfig": "workspace:*",
114
108
  "@vitejs/plugin-react": "^4.3.4",
@@ -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.