uidex 0.6.0 → 0.7.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 (39) hide show
  1. package/README.md +3 -3
  2. package/dist/cli/cli.cjs +1510 -1244
  3. package/dist/cli/cli.cjs.map +1 -1
  4. package/dist/cloud/index.cjs +385 -175
  5. package/dist/cloud/index.cjs.map +1 -1
  6. package/dist/cloud/index.d.cts +192 -4
  7. package/dist/cloud/index.d.ts +192 -4
  8. package/dist/cloud/index.js +377 -177
  9. package/dist/cloud/index.js.map +1 -1
  10. package/dist/headless/index.cjs +82 -255
  11. package/dist/headless/index.cjs.map +1 -1
  12. package/dist/headless/index.d.cts +5 -11
  13. package/dist/headless/index.d.ts +5 -11
  14. package/dist/headless/index.js +82 -257
  15. package/dist/headless/index.js.map +1 -1
  16. package/dist/index.cjs +721 -1053
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +149 -160
  19. package/dist/index.d.ts +149 -160
  20. package/dist/index.js +741 -1068
  21. package/dist/index.js.map +1 -1
  22. package/dist/react/index.cjs +729 -1000
  23. package/dist/react/index.cjs.map +1 -1
  24. package/dist/react/index.d.cts +99 -86
  25. package/dist/react/index.d.ts +99 -86
  26. package/dist/react/index.js +745 -1015
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/scan/index.cjs +1518 -1237
  29. package/dist/scan/index.cjs.map +1 -1
  30. package/dist/scan/index.d.cts +209 -12
  31. package/dist/scan/index.d.ts +209 -12
  32. package/dist/scan/index.js +1515 -1236
  33. package/dist/scan/index.js.map +1 -1
  34. package/package.json +22 -21
  35. package/templates/claude/SKILL.md +71 -0
  36. package/templates/claude/references/audit.md +43 -0
  37. package/templates/claude/{rules.md → references/conventions.md} +25 -28
  38. package/templates/claude/audit.md +0 -43
  39. /package/templates/claude/{api.md → references/api.md} +0 -0
@@ -102,88 +102,10 @@ interface Registry {
102
102
  setReports(kind: EntityKind, id: string, reports: readonly ReportRecord[]): void;
103
103
  getReports(kind: EntityKind, id: string): readonly ReportRecord[];
104
104
  listReportKeys(): readonly string[];
105
- archiveReport?: (reportId: string, reason?: string) => void | Promise<void>;
105
+ closeReport?: (reportId: string, status?: string) => void | Promise<void>;
106
106
  onReportsChange(cb: () => void): () => void;
107
107
  }
108
108
 
109
- interface UserIdentity {
110
- id: string;
111
- name?: string;
112
- avatar?: string;
113
- }
114
-
115
- type ThemePreference = "light" | "dark" | "auto";
116
- type ResolvedTheme = "light" | "dark";
117
- interface ViewStackEntry {
118
- id: string;
119
- ref: EntityRef | null;
120
- }
121
- interface SessionSnapshot {
122
- hover: EntityRef | null;
123
- selection: EntityRef | null;
124
- stack: ViewStackEntry[];
125
- /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
126
- pinnedHighlight: EntityRef | null;
127
- inspectorActive: boolean;
128
- theme: ThemePreference;
129
- resolvedTheme: ResolvedTheme;
130
- ingestActive: boolean;
131
- /**
132
- * Identity for the local user. Set once at session creation; gates realtime
133
- * features (cursor labels, presence) and auto-populates report attribution.
134
- */
135
- user: UserIdentity | null;
136
- }
137
- type SessionState = SessionSnapshot;
138
-
139
- interface NavigationState {
140
- stack: ViewStackEntry[];
141
- }
142
- interface NavigationActions {
143
- push(entry: ViewStackEntry): void;
144
- pop(): void;
145
- replace(entry: ViewStackEntry): void;
146
- clear(): void;
147
- reset(stack: ViewStackEntry[]): void;
148
- }
149
- type NavigationStore = StoreApi<NavigationState> & {
150
- nav: NavigationActions;
151
- };
152
-
153
- type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
154
- interface ModeSnapshot {
155
- mode: SurfaceMode;
156
- inspectorActive: boolean;
157
- }
158
- interface ModeTransitions {
159
- openPalette(): void;
160
- openInspector(): void;
161
- closeInspector(): void;
162
- toggleInspector(): void;
163
- enterViewing(initialStack: ViewStackEntry[]): void;
164
- dismiss(): void;
165
- popOrTransition(): void;
166
- pushView(entry: ViewStackEntry): void;
167
- }
168
- type ModeStore = StoreApi<ModeSnapshot> & {
169
- transition: ModeTransitions;
170
- };
171
-
172
- interface HighlightActions {
173
- hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
174
- unhover(): void;
175
- pin(ref?: EntityRef): void;
176
- unpin(): void;
177
- }
178
- type SessionStore = StoreApi<SessionState> & {
179
- readonly nav: NavigationStore;
180
- readonly mode: ModeStore;
181
- readonly highlight: HighlightActions;
182
- select(ref: EntityRef | null): void;
183
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
184
- setIngest(active: boolean): void;
185
- };
186
-
187
109
  type ConsoleLevel = "warn" | "error";
188
110
  interface ConsoleEntry {
189
111
  level: ConsoleLevel;
@@ -225,6 +147,12 @@ interface NetworkCapture {
225
147
  clear(): void;
226
148
  }
227
149
 
150
+ interface UserIdentity {
151
+ id: string;
152
+ name?: string;
153
+ avatar?: string;
154
+ }
155
+
228
156
  type RealtimePresenceUser = {
229
157
  userId: string;
230
158
  name: string;
@@ -242,6 +170,8 @@ interface RealtimeChannel {
242
170
  joinRoute(route: string): void;
243
171
  onPresence(cb: (users: RealtimePresenceUser[]) => void): () => void;
244
172
  onPin(cb: (pin: PinRecord) => void): () => void;
173
+ /** Optional so pre-existing channel stubs keep satisfying the interface. */
174
+ onPinArchived?(cb: (reportId: string) => void): () => void;
245
175
  }
246
176
  interface CloudAdapter<TPayload = ReportPayload, TResult = ReportResult, TIntegrations = {
247
177
  getConfig(): Promise<IngestConfig>;
@@ -263,8 +193,17 @@ interface CloudAdapter<TPayload = ReportPayload, TResult = ReportResult, TIntegr
263
193
  route?: string;
264
194
  entities?: string;
265
195
  }): Promise<PinRecord[]>;
266
- archive(reportId: string, reason?: ArchiveReason): Promise<void>;
196
+ /**
197
+ * Pin records travel without their screenshot (kept out of `pins.list`
198
+ * so multi-MB frames don't stall the shared socket); the report detail
199
+ * view fetches it lazily through here. Optional for host-provided
200
+ * adapters that inline screenshots on the record instead.
201
+ */
202
+ screenshot?(reportId: string): Promise<string | null>;
203
+ close(reportId: string, reason?: ArchiveReason): Promise<void>;
267
204
  };
205
+ /** Closes the adapter's shared socket. Any later RPC call revives it. */
206
+ dispose?(): void;
268
207
  }
269
208
 
270
209
  interface IngestOptions {
@@ -284,6 +223,74 @@ interface Ingest {
284
223
  readonly network: NetworkCapture | null;
285
224
  }
286
225
 
226
+ type ThemePreference = "light" | "dark" | "auto";
227
+ type ResolvedTheme = "light" | "dark";
228
+ interface ViewStackEntry {
229
+ id: string;
230
+ ref: EntityRef | null;
231
+ }
232
+ interface SessionSnapshot {
233
+ stack: ViewStackEntry[];
234
+ /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
235
+ pinnedHighlight: EntityRef | null;
236
+ /** Mirrored from the mode store; the surface mode the session is currently in. */
237
+ mode: SurfaceMode;
238
+ theme: ThemePreference;
239
+ resolvedTheme: ResolvedTheme;
240
+ /**
241
+ * Identity for the local user. Set once at session creation; gates realtime
242
+ * features (cursor labels, presence) and auto-populates report attribution.
243
+ */
244
+ user: UserIdentity | null;
245
+ }
246
+ type SessionState = SessionSnapshot;
247
+
248
+ interface NavigationState {
249
+ stack: ViewStackEntry[];
250
+ }
251
+ interface NavigationActions {
252
+ push(entry: ViewStackEntry): void;
253
+ pop(): void;
254
+ clear(): void;
255
+ reset(stack: ViewStackEntry[]): void;
256
+ }
257
+ type NavigationStore = StoreApi<NavigationState> & {
258
+ nav: NavigationActions;
259
+ };
260
+
261
+ type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
262
+ interface ModeSnapshot {
263
+ mode: SurfaceMode;
264
+ }
265
+ interface ModeTransitions {
266
+ openPalette(): void;
267
+ openInspector(): void;
268
+ closeInspector(): void;
269
+ toggleInspector(): void;
270
+ enterViewing(initialStack: ViewStackEntry[]): void;
271
+ dismiss(): void;
272
+ popOrTransition(): void;
273
+ pushView(entry: ViewStackEntry): void;
274
+ }
275
+ type ModeStore = StoreApi<ModeSnapshot> & {
276
+ transition: ModeTransitions;
277
+ };
278
+
279
+ interface HighlightActions {
280
+ hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
281
+ unhover(): void;
282
+ pin(ref?: EntityRef): void;
283
+ unpin(): void;
284
+ }
285
+ type SessionStore = StoreApi<SessionState> & {
286
+ readonly nav: NavigationStore;
287
+ readonly mode: ModeStore;
288
+ readonly highlight: HighlightActions;
289
+ setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
290
+ };
291
+
292
+ type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
293
+
287
294
  interface OverlayShowOptions {
288
295
  label?: string;
289
296
  color?: string;
@@ -294,8 +301,6 @@ interface OverlayShowOptions {
294
301
  backdrop?: boolean;
295
302
  }
296
303
 
297
- type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
298
-
299
304
  interface RouteMatch {
300
305
  view: View;
301
306
  priority: number;
@@ -441,9 +446,16 @@ type DetailSection = {
441
446
  id: "routes";
442
447
  paths: readonly string[];
443
448
  filterable?: boolean;
444
- } | {
449
+ }
450
+ /**
451
+ * `url` renders immediately; `load` fetches lazily (cloud pins travel
452
+ * without their screenshot) and the section stays hidden until — and
453
+ * unless — the promise resolves with a data URL.
454
+ */
455
+ | {
445
456
  id: "screenshot";
446
- url: string;
457
+ url?: string;
458
+ load?: () => Promise<string | null>;
447
459
  } | {
448
460
  id: "metadata";
449
461
  entries: readonly MetadataEntry[];
@@ -642,8 +654,9 @@ interface View {
642
654
  * when the declared target has been removed from the host.
643
655
  */
644
656
  focusTarget?: (root: HTMLElement, ctx: ViewContext) => HTMLElement | null;
645
- surface: (ctx: ViewContext) => ViewSurface;
646
- /** Direct render for integration adapters (React, etc.). Mutually exclusive with surface renderers. */
657
+ /** Required unless `render` is provided. */
658
+ surface?: (ctx: ViewContext) => ViewSurface;
659
+ /** Direct render for integration adapters (React, etc.). Takes precedence over `surface` when both are present. */
647
660
  render?: (ctx: ViewContext, root: HTMLElement) => Cleanup | void;
648
661
  parent?: (ref: EntityRef | null) => ViewStackEntry | null;
649
662
  }
@@ -102,88 +102,10 @@ interface Registry {
102
102
  setReports(kind: EntityKind, id: string, reports: readonly ReportRecord[]): void;
103
103
  getReports(kind: EntityKind, id: string): readonly ReportRecord[];
104
104
  listReportKeys(): readonly string[];
105
- archiveReport?: (reportId: string, reason?: string) => void | Promise<void>;
105
+ closeReport?: (reportId: string, status?: string) => void | Promise<void>;
106
106
  onReportsChange(cb: () => void): () => void;
107
107
  }
108
108
 
109
- interface UserIdentity {
110
- id: string;
111
- name?: string;
112
- avatar?: string;
113
- }
114
-
115
- type ThemePreference = "light" | "dark" | "auto";
116
- type ResolvedTheme = "light" | "dark";
117
- interface ViewStackEntry {
118
- id: string;
119
- ref: EntityRef | null;
120
- }
121
- interface SessionSnapshot {
122
- hover: EntityRef | null;
123
- selection: EntityRef | null;
124
- stack: ViewStackEntry[];
125
- /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
126
- pinnedHighlight: EntityRef | null;
127
- inspectorActive: boolean;
128
- theme: ThemePreference;
129
- resolvedTheme: ResolvedTheme;
130
- ingestActive: boolean;
131
- /**
132
- * Identity for the local user. Set once at session creation; gates realtime
133
- * features (cursor labels, presence) and auto-populates report attribution.
134
- */
135
- user: UserIdentity | null;
136
- }
137
- type SessionState = SessionSnapshot;
138
-
139
- interface NavigationState {
140
- stack: ViewStackEntry[];
141
- }
142
- interface NavigationActions {
143
- push(entry: ViewStackEntry): void;
144
- pop(): void;
145
- replace(entry: ViewStackEntry): void;
146
- clear(): void;
147
- reset(stack: ViewStackEntry[]): void;
148
- }
149
- type NavigationStore = StoreApi<NavigationState> & {
150
- nav: NavigationActions;
151
- };
152
-
153
- type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
154
- interface ModeSnapshot {
155
- mode: SurfaceMode;
156
- inspectorActive: boolean;
157
- }
158
- interface ModeTransitions {
159
- openPalette(): void;
160
- openInspector(): void;
161
- closeInspector(): void;
162
- toggleInspector(): void;
163
- enterViewing(initialStack: ViewStackEntry[]): void;
164
- dismiss(): void;
165
- popOrTransition(): void;
166
- pushView(entry: ViewStackEntry): void;
167
- }
168
- type ModeStore = StoreApi<ModeSnapshot> & {
169
- transition: ModeTransitions;
170
- };
171
-
172
- interface HighlightActions {
173
- hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
174
- unhover(): void;
175
- pin(ref?: EntityRef): void;
176
- unpin(): void;
177
- }
178
- type SessionStore = StoreApi<SessionState> & {
179
- readonly nav: NavigationStore;
180
- readonly mode: ModeStore;
181
- readonly highlight: HighlightActions;
182
- select(ref: EntityRef | null): void;
183
- setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
184
- setIngest(active: boolean): void;
185
- };
186
-
187
109
  type ConsoleLevel = "warn" | "error";
188
110
  interface ConsoleEntry {
189
111
  level: ConsoleLevel;
@@ -225,6 +147,12 @@ interface NetworkCapture {
225
147
  clear(): void;
226
148
  }
227
149
 
150
+ interface UserIdentity {
151
+ id: string;
152
+ name?: string;
153
+ avatar?: string;
154
+ }
155
+
228
156
  type RealtimePresenceUser = {
229
157
  userId: string;
230
158
  name: string;
@@ -242,6 +170,8 @@ interface RealtimeChannel {
242
170
  joinRoute(route: string): void;
243
171
  onPresence(cb: (users: RealtimePresenceUser[]) => void): () => void;
244
172
  onPin(cb: (pin: PinRecord) => void): () => void;
173
+ /** Optional so pre-existing channel stubs keep satisfying the interface. */
174
+ onPinArchived?(cb: (reportId: string) => void): () => void;
245
175
  }
246
176
  interface CloudAdapter<TPayload = ReportPayload, TResult = ReportResult, TIntegrations = {
247
177
  getConfig(): Promise<IngestConfig>;
@@ -263,8 +193,17 @@ interface CloudAdapter<TPayload = ReportPayload, TResult = ReportResult, TIntegr
263
193
  route?: string;
264
194
  entities?: string;
265
195
  }): Promise<PinRecord[]>;
266
- archive(reportId: string, reason?: ArchiveReason): Promise<void>;
196
+ /**
197
+ * Pin records travel without their screenshot (kept out of `pins.list`
198
+ * so multi-MB frames don't stall the shared socket); the report detail
199
+ * view fetches it lazily through here. Optional for host-provided
200
+ * adapters that inline screenshots on the record instead.
201
+ */
202
+ screenshot?(reportId: string): Promise<string | null>;
203
+ close(reportId: string, reason?: ArchiveReason): Promise<void>;
267
204
  };
205
+ /** Closes the adapter's shared socket. Any later RPC call revives it. */
206
+ dispose?(): void;
268
207
  }
269
208
 
270
209
  interface IngestOptions {
@@ -284,6 +223,74 @@ interface Ingest {
284
223
  readonly network: NetworkCapture | null;
285
224
  }
286
225
 
226
+ type ThemePreference = "light" | "dark" | "auto";
227
+ type ResolvedTheme = "light" | "dark";
228
+ interface ViewStackEntry {
229
+ id: string;
230
+ ref: EntityRef | null;
231
+ }
232
+ interface SessionSnapshot {
233
+ stack: ViewStackEntry[];
234
+ /** Sticky overlay highlight. Set by "Highlight Element" actions; cleared on Esc. */
235
+ pinnedHighlight: EntityRef | null;
236
+ /** Mirrored from the mode store; the surface mode the session is currently in. */
237
+ mode: SurfaceMode;
238
+ theme: ThemePreference;
239
+ resolvedTheme: ResolvedTheme;
240
+ /**
241
+ * Identity for the local user. Set once at session creation; gates realtime
242
+ * features (cursor labels, presence) and auto-populates report attribution.
243
+ */
244
+ user: UserIdentity | null;
245
+ }
246
+ type SessionState = SessionSnapshot;
247
+
248
+ interface NavigationState {
249
+ stack: ViewStackEntry[];
250
+ }
251
+ interface NavigationActions {
252
+ push(entry: ViewStackEntry): void;
253
+ pop(): void;
254
+ clear(): void;
255
+ reset(stack: ViewStackEntry[]): void;
256
+ }
257
+ type NavigationStore = StoreApi<NavigationState> & {
258
+ nav: NavigationActions;
259
+ };
260
+
261
+ type SurfaceMode = "idle" | "inspecting" | "palette" | "viewing";
262
+ interface ModeSnapshot {
263
+ mode: SurfaceMode;
264
+ }
265
+ interface ModeTransitions {
266
+ openPalette(): void;
267
+ openInspector(): void;
268
+ closeInspector(): void;
269
+ toggleInspector(): void;
270
+ enterViewing(initialStack: ViewStackEntry[]): void;
271
+ dismiss(): void;
272
+ popOrTransition(): void;
273
+ pushView(entry: ViewStackEntry): void;
274
+ }
275
+ type ModeStore = StoreApi<ModeSnapshot> & {
276
+ transition: ModeTransitions;
277
+ };
278
+
279
+ interface HighlightActions {
280
+ hover(ref: EntityRef, element?: HTMLElement | null, color?: string | null): void;
281
+ unhover(): void;
282
+ pin(ref?: EntityRef): void;
283
+ unpin(): void;
284
+ }
285
+ type SessionStore = StoreApi<SessionState> & {
286
+ readonly nav: NavigationStore;
287
+ readonly mode: ModeStore;
288
+ readonly highlight: HighlightActions;
289
+ setTheme(theme: ThemePreference, resolved?: ResolvedTheme): void;
290
+ };
291
+
292
+ type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
293
+
287
294
  interface OverlayShowOptions {
288
295
  label?: string;
289
296
  color?: string;
@@ -294,8 +301,6 @@ interface OverlayShowOptions {
294
301
  backdrop?: boolean;
295
302
  }
296
303
 
297
- type Corner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
298
-
299
304
  interface RouteMatch {
300
305
  view: View;
301
306
  priority: number;
@@ -441,9 +446,16 @@ type DetailSection = {
441
446
  id: "routes";
442
447
  paths: readonly string[];
443
448
  filterable?: boolean;
444
- } | {
449
+ }
450
+ /**
451
+ * `url` renders immediately; `load` fetches lazily (cloud pins travel
452
+ * without their screenshot) and the section stays hidden until — and
453
+ * unless — the promise resolves with a data URL.
454
+ */
455
+ | {
445
456
  id: "screenshot";
446
- url: string;
457
+ url?: string;
458
+ load?: () => Promise<string | null>;
447
459
  } | {
448
460
  id: "metadata";
449
461
  entries: readonly MetadataEntry[];
@@ -642,8 +654,9 @@ interface View {
642
654
  * when the declared target has been removed from the host.
643
655
  */
644
656
  focusTarget?: (root: HTMLElement, ctx: ViewContext) => HTMLElement | null;
645
- surface: (ctx: ViewContext) => ViewSurface;
646
- /** Direct render for integration adapters (React, etc.). Mutually exclusive with surface renderers. */
657
+ /** Required unless `render` is provided. */
658
+ surface?: (ctx: ViewContext) => ViewSurface;
659
+ /** Direct render for integration adapters (React, etc.). Takes precedence over `surface` when both are present. */
647
660
  render?: (ctx: ViewContext, root: HTMLElement) => Cleanup | void;
648
661
  parent?: (ref: EntityRef | null) => ViewStackEntry | null;
649
662
  }