@hansenexus/hud 0.7.0 → 0.9.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 (77) hide show
  1. package/README.md +153 -14
  2. package/dist/{access-Bc709qpl.d.ts → access-CwPCPsv0.d.ts} +1 -1
  3. package/dist/auto/runtime.d.ts +9 -9
  4. package/dist/auto.d.ts +2 -2
  5. package/dist/auto.js +1 -1
  6. package/dist/cli.js +34 -1
  7. package/dist/{define-hud-DTv3njuU.d.ts → define-hud-B0aFXrcK.d.ts} +1 -1
  8. package/dist/{design-BXG1a4we.js → design-BIXY1-Ex.js} +26 -8
  9. package/dist/{force-state-panel-mu-txJnA.js → force-state-panel-D5oDydLs.js} +1 -1
  10. package/dist/{handler-DMzSTqyG.d.ts → handler-BmFhaA2D.d.ts} +1 -1
  11. package/dist/{index-C3wzZS3o.d.ts → index-5B7foZut.d.ts} +2 -2
  12. package/dist/{index-D-hI-DRJ.d.ts → index-B2KCKkN0.d.ts} +1 -1
  13. package/dist/index-B7qaEUgh.d.ts +44 -0
  14. package/dist/{index-CQXiuMZQ.d.ts → index-BGFyuJyN.d.ts} +1 -1
  15. package/dist/{index-Caohnz3B.d.ts → index-BeqWehuh.d.ts} +38 -10
  16. package/dist/{index-BJJoAXJ2.d.ts → index-BqKysxTq.d.ts} +1 -1
  17. package/dist/{index-DLCSLWW4.d.ts → index-D97Fnoie.d.ts} +2 -2
  18. package/dist/{index-BR5OB7DO.d.ts → index-DS0yT0c-.d.ts} +1 -1
  19. package/dist/{index-BNoPbSYD.d.ts → index-DvlCkGB1.d.ts} +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +49 -196
  22. package/dist/lanes-panel-Disg54DY.js +395 -0
  23. package/dist/navigation-CX6AXm7H.js +176 -0
  24. package/dist/next/config.cjs +2 -0
  25. package/dist/next/config.d.cts +1 -0
  26. package/dist/next/config.d.ts +1 -0
  27. package/dist/next/config.js +2 -0
  28. package/dist/next.d.ts +4 -1
  29. package/dist/next.js +12 -1
  30. package/dist/obstacles-CCmRFTcZ.js +176 -0
  31. package/dist/plugins/a11y.d.ts +1 -1
  32. package/dist/plugins/access/server.d.ts +3 -3
  33. package/dist/plugins/access.d.ts +2 -2
  34. package/dist/plugins/agent/server.js +1 -1
  35. package/dist/plugins/agent.d.ts +2 -2
  36. package/dist/plugins/capture.d.ts +2 -2
  37. package/dist/plugins/data/server.d.ts +1 -1
  38. package/dist/plugins/data/server.js +1 -1
  39. package/dist/plugins/data.d.ts +1 -1
  40. package/dist/plugins/design/server.d.ts +55 -15
  41. package/dist/plugins/design/server.js +187 -122
  42. package/dist/plugins/design.d.ts +3 -3
  43. package/dist/plugins/design.js +1 -1
  44. package/dist/plugins/inspect.d.ts +1 -1
  45. package/dist/plugins/lanes/server.d.ts +165 -0
  46. package/dist/plugins/lanes/server.js +845 -0
  47. package/dist/plugins/lanes.d.ts +22 -0
  48. package/dist/plugins/lanes.js +30 -0
  49. package/dist/plugins/observe.d.ts +1 -1
  50. package/dist/plugins/ops/server.d.ts +1 -1
  51. package/dist/plugins/ops.d.ts +1 -1
  52. package/dist/plugins/routes/server.d.ts +1 -1
  53. package/dist/plugins/routes.d.ts +3 -3
  54. package/dist/plugins/routes.js +381 -52
  55. package/dist/plugins/seo.d.ts +1 -1
  56. package/dist/plugins/vitals.d.ts +1 -1
  57. package/dist/{plugins-BZT-1LBe.d.ts → plugins-pL2CoWzI.d.ts} +7 -0
  58. package/dist/same-origin-BHuZO1_H.js +36 -0
  59. package/dist/server.d.ts +2 -2
  60. package/dist/store.d.ts +1 -1
  61. package/dist/store.js +1 -1
  62. package/dist/types-BkrkOP3h.js +6 -0
  63. package/dist/types-Dazn3aWZ.d.ts +86 -0
  64. package/dist/{meta-C_G7MB5w.d.ts → types-Dc6JWZR7.d.ts} +6 -6
  65. package/dist/variant-bar-BzZ0ln-C.js +768 -0
  66. package/dist/variant-picks-Byc0hC8a.js +144 -0
  67. package/dist/variants-export-vEtZ-OGC.js +75 -0
  68. package/dist/{variants-panel-B6zWcknV.js → variants-panel-D23v5KIp.js} +71 -54
  69. package/dist/variants-types-BOsZ5fDz.js +65 -0
  70. package/dist/variants-types-VkW7vFZF.d.ts +139 -0
  71. package/dist/variants.d.ts +1 -1
  72. package/dist/variants.js +1 -1
  73. package/dist/vite.d.ts +2 -2
  74. package/package.json +2 -2
  75. package/dist/index-B1vHAY9p.d.ts +0 -20
  76. package/dist/same-origin-BGet22CC.js +0 -21
  77. package/dist/variants-types-CcRf119M.d.ts +0 -63
package/README.md CHANGED
@@ -67,7 +67,9 @@ export const HudLoader = createHudLoader(
67
67
  );
68
68
  ```
69
69
 
70
- Render `<HudLoader />` in the root layout. The HUD then docks as an icon rail on the right edge,
70
+ Render `<HudLoader />` in the root layout. When the HUD's chunk does not load (a stale dev server, a
71
+ syntax error in `hud.tsx`), it renders nothing and warns once in the console; the page is
72
+ unaffected. The HUD then docks as an icon rail on the right edge,
71
73
  as its DEV chip until clicked (see [Dock](#dock-rail-and-pill)). Plugin routes mount through
72
74
  one catch-all route, fed the plugins' server halves:
73
75
 
@@ -280,8 +282,8 @@ In the playground, `?env=staging` runs this flow with the password `playground`.
280
282
 
281
283
  ## Write a plugin
282
284
 
283
- A plugin is `{ id, title?, capability?, icon?, badge?, panel?, pill?, pillPriority?, commands?, routes? }`,
284
- shipped as two halves with the same `id`: the client half (`panel`, `pill`, `icon`, `badge`, `commands`) and the server half
285
+ A plugin is `{ id, title?, capability?, icon?, badge?, panel?, overlay?, pill?, pillPriority?, commands?, routes? }`,
286
+ shipped as two halves with the same `id`: the client half (`panel`, `overlay`, `pill`, `icon`, `badge`, `commands`) and the server half
285
287
  (`routes`), so route code never reaches a client bundle. The panel is a plain React component
286
288
  receiving `ctx`. Make it a dynamic import, so its code loads on first open and the pill stays
287
289
  light; the shell shows "Loading…" meanwhile and contains a panel that fails to load or throws:
@@ -326,6 +328,10 @@ definePlugin({
326
328
  });
327
329
  ```
328
330
 
331
+ `overlay` is a component on the page itself, next to the dock, for as long as the HUD is mounted
332
+ (the variant bar is one). It places itself and sets `pointer-events: auto` on what takes input; one
333
+ that fails to load or throws renders nothing. Keep it a dynamic import too.
334
+
329
335
  Routes are keyed by path, then method: `routes: { "/runs/:id": { GET: (req, { params }) => ... } }`.
330
336
  An unknown path answers 404, a known path with another method 405.
331
337
 
@@ -469,6 +475,48 @@ export const { GET, POST } = createHudHandler([agentDispatch({ providers }), scr
469
475
  - Needs `capture.screenshot`: granted in development only. A dispatch waits up to 30 s for a
470
476
  screenshot still rendering.
471
477
 
478
+ ## Lanes plugin (lane previews and worker feedback)
479
+
480
+ `@hansenexus/hud/plugins/lanes` makes the HUD the preview and feedback channel for agent lanes
481
+ on one box (hud#101): open any lane's dev server from a phone, tell the lane's worker what to
482
+ change, and send it a screenshot of what you see.
483
+
484
+ ```tsx
485
+ import { lanes } from "@hansenexus/hud/plugins/lanes";
486
+ defineHud({ app: "my-app", plugins: [lanes()] });
487
+ ```
488
+
489
+ ```ts
490
+ import { lanes } from "@hansenexus/hud/plugins/lanes/server";
491
+ hud({ plugins: [lanes()] }); // or createHudHandler([lanes()])
492
+ ```
493
+
494
+ The Lanes panel lists every lane folder (`~/lanes/<repo>/<lane>`, and the Orca-era
495
+ `~/orca/workspaces`) with repo#issue, branch, the lane's worker from the session ledger, and the
496
+ dev servers listening in it (`lsof`; the agent CLIs' own sockets and the ephemeral port range are
497
+ skipped). Each server opens on the box's tailnet name (`tailscale status`, or `HUD_PREVIEW_HOST`),
498
+ so the link works from any device on the tailnet. A server bound to localhost only is marked so.
499
+
500
+ - **Start** runs the lane's `dev` script (`apps/<repo>` in a monorepo named after its app, else the
501
+ folder a root `dev` hands over to, else the root unless it is a `turbo` fan-out) on a port from
502
+ 3100–3999 leased with `hn-lease port:<n>`, bound to the box's tailnet IPv4 only. The lease holder
503
+ is the dev server's own pid, so the lease ends with the server. Next gets `--hostname`, Vite
504
+ `--host --strictPort`; `HUD_PREVIEW_HOST` is set so `withHud` adds the tailnet name to Next's
505
+ `allowedDevOrigins`, and Vite's allowed hosts get it too. A lane without `node_modules` is
506
+ installed first. Logs go to `<tmpdir>/hud-lanes/<lane>.log`.
507
+ - **This lane** (the lane the page is served from) has a comment box and a Screenshot button.
508
+ A comment becomes a `hud-comment` event on the session ledger (`~/.claude/sessions/events.jsonl`,
509
+ `sid` = the lane's worker) and is typed into the lane's terminal through
510
+ `lane-runtime terminal send`, the path kommandant's session mirror types answers with.
511
+ - **Screenshot** renders the current URL headless at the viewer's width and height (the capture
512
+ plugin's route, with the viewer's cookies), saves the PNG under `<tmpdir>/hud-lanes/shots`, hands
513
+ its path to the worker the same way, and posts it to the lane's open PR: the PNG goes up as a
514
+ one-file commit on the `hud-shots` branch and the comment links it by commit.
515
+ - Everything reads and runs on the machine the dev server runs on: mount the server half only in
516
+ a dev server on the lanes' box. Writes are refused cross-site; the routes answer 404 outside
517
+ development like every HUD route. Pass `box` to replace the machine (the playground uses an
518
+ in-memory one) and `capture` for the screenshot's browser.
519
+
472
520
  ## Routes plugin and `hud sweep`
473
521
 
474
522
  Every page of the app's `app/` tree, one click away, and a CI sweep over the same list.
@@ -497,8 +545,25 @@ locale); an optional catch-all without a fixture resolves to its parent. A segme
497
545
  fixture leaves its route listed but unresolved. Capability: `routes.read` (development, staging,
498
546
  preview).
499
547
 
500
- The panel groups routes by route group, filters by path, marks the current page and navigates on
501
- click. `GET /api/hud/routes/routes` answers the same list as JSON.
548
+ The panel is a quick switcher. `⌘⇧R` (Ctrl+Shift+R elsewhere; the "Go to route" command, also in
549
+ the `⋯` menu) opens it with the filter focused and its text selected; ↓ ↑ move the highlight,
550
+ Enter navigates, Esc closes. Navigation goes through Next's router when the page has one
551
+ (`window.next.router`), else `location.assign`. The filter matches path, pattern and route group
552
+ and is fuzzy on segments: `dsys` finds `/de/dev/design-system`, `mark about` needs both words.
553
+ Routes are listed by route group; the current page is marked. Two sections come first while the
554
+ filter is empty: **Pinned** (the `pinned` globs plus the rows starred in the panel; the star on
555
+ every row toggles it, kept per app in `localStorage`) and **Recent** (the last eight routes
556
+ visited, most recent first, recorded by a navigation observer the plugin starts at HUD mount).
557
+ With a `[locale]` segment each route shows once, for the locale the page is on, the other locales
558
+ as chips behind the row. `GET /api/hud/routes/routes` answers the same list as JSON.
559
+
560
+ ```tsx
561
+ routes({
562
+ shortcut: "mod+shift+r", // the "Go to route" command; `mod` is ⌘ on Apple, Ctrl elsewhere
563
+ pinned: ["/*/dev/*"], // path globs listed first: `*` within a segment, `**` across segments
564
+ navigate: (url) => router.push(url), // replaces the default navigation
565
+ });
566
+ ```
502
567
 
503
568
  `hud sweep` visits that list headless and fails the build on a 5xx answer, an uncaught error or a
504
569
  console error on any page. It needs Playwright in the app (`playwright` or `@playwright/test`,
@@ -537,7 +602,7 @@ forceState();
537
602
  group's `scope` attribute), so themed and scoped tokens show what the page renders. It re-reads
538
603
  when `<html>`/`<body>` attributes, stylesheets or the OS color scheme change.
539
604
  - **Variants** lists the page's live variant groups (below) with a switcher, agent scores and
540
- Decide. An optional adapter (`variants({ categories, generate })`) adds the app's own variant
605
+ picks; `variants({ pages })` adds the [variant bar](#variant-bar). An optional adapter (`variants({ categories, generate })`) adds the app's own variant
541
606
  registry and the generate-brief queue (`variants.generate`).
542
607
  - **States** toggles every mounted `StateBoundary` between real, loading, empty and error. It
543
608
  needs `state.force`.
@@ -596,10 +661,10 @@ keyed `<group>:<id>`, which an agent writes by hand:
596
661
  }
597
662
  ```
598
663
 
599
- **Decide** (needs `variants.decide`, granted on development only by default) writes
600
- `status: "decided"` and `decidedAt` on the winner and `status: "rejected"` on the rest, then queues
601
- a cleanup brief ("inline the winner, delete the losers and the wrapper, run the checks") through
602
- the dispatch seam. The server half:
664
+ **Pick** (needs `variants.decide`, granted on development only by default) records the decision:
665
+ `status: "decided"` and `decidedAt` on the winner, `status: "rejected"` on the rest. A second click
666
+ takes it back. A pick only records; it queues nothing and starts no agent, whatever `dispatch` says.
667
+ The server half:
603
668
 
604
669
  ```ts
605
670
  import { variantsServer } from "@hansenexus/hud/plugins/design/server";
@@ -611,10 +676,84 @@ export const { GET, POST } = createHudHandler([
611
676
  ]);
612
677
  ```
613
678
 
614
- Without `dispatch` the decision is recorded and nothing is queued. `GET <apiBase>/variants/` lists
615
- the records, `POST <apiBase>/variants/<group>/decide` decides; both answer only to same-origin
616
- JSON requests. In the playground the hero is a variant group with seeded scores, and Decide logs
617
- the brief to the browser console through the echo provider.
679
+ `dispatch` is optional. With it the panel shows **Queue cleanup** next to a picked group: that
680
+ button, and only that button, sends the brief ("inline the winner, delete the losers and the
681
+ wrapper, run the checks") through the dispatch seam.
682
+
683
+ | route | does |
684
+ | --------------------------------------- | ---------------------------------------------------------------- |
685
+ | `GET <apiBase>/variants/` | lists the records, the notes and the logs |
686
+ | `POST <apiBase>/variants/<group>/pick` | `{ id, note }`: records the pick (`id: null` takes it back) and the note; a field left out stays as it is |
687
+ | `POST <apiBase>/variants/<group>/cleanup` | queues the brief for the picked variant; 409 without a pick or a provider |
688
+
689
+ Writes answer only to JSON requests from the app's own origin: by `Sec-Fetch-Site`, and where the
690
+ browser does not send it (plain http to another machine, such as a phone on the LAN address) the
691
+ `Origin` has to name the host the request went to. In the playground the hero is a variant group
692
+ with seeded scores, and Queue cleanup logs the brief to the browser console through the echo
693
+ provider.
694
+
695
+ ### Variant bar
696
+
697
+ A design round covers several pages. `pages` names them, and a bar at the bottom of the screen
698
+ steps through the pages and through the variants of the page it stands on, with a pick and a note
699
+ for each:
700
+
701
+ ```tsx
702
+ variants({
703
+ pages: [
704
+ { group: "hero", label: "Home", href: "/" },
705
+ { group: "plans", label: "Pricing", href: "/pricing" },
706
+ { group: "cluster", label: "Cluster", href: "#/estate/cluster" }, // a hash router
707
+ ],
708
+ });
709
+ ```
710
+
711
+ - `group` is the `VariantGroup` id the page decides. Where the address fits no page (a detail
712
+ page), the first mounted group on the list is the one the bar shows. Without `pages` there is no
713
+ bar.
714
+ - **Pages** open through Next's router when the page has one, else with a full load; a `#…` href is
715
+ the browser's own fragment navigation. `navigate: (href) => router.push(href)` replaces this. The
716
+ `?variant=` choices travel along.
717
+ - **Keys**: ⌥← ⌥→ step through the variants, ⌥↑ ⌥↓ through the pages, except while typing.
718
+ - **Pick** and **Note** go through the pick route above. A note saves with Save, with ⌘Enter, and
719
+ when the page changes under it; Escape drops the draft. A save that fails puts the recorded state
720
+ back and says why in the bar.
721
+ - × folds the bar to a pill with the score; that is kept per app in `localStorage`.
722
+ - The bar keeps clear of the HUD, of pinned panels and of fixed elements at the bottom of the page
723
+ (a bottom navigation, a chat bubble), and stays usable while a modal sheet is open: it is not
724
+ caught by `pointer-events: none` on `<body>`, by `inert` or by a focus trap, and pressing it does
725
+ not dismiss the sheet. The limit is a native `<dialog>` opened with `showModal()`, which the
726
+ browser puts above everything; there the keys still step, and picking waits until it is closed.
727
+ - **Development only.** The bar is its own chunk behind `process.env.NODE_ENV === "development"`;
728
+ `"data-hud-variant-bar"` is the string to grep production chunks for.
729
+
730
+ `.hud/variants.json` then holds, next to the variants, one entry per group with its note and a log
731
+ that only grows:
732
+
733
+ ```json
734
+ {
735
+ "hero": {
736
+ "label": "Hero",
737
+ "note": "Shorter claim, please",
738
+ "log": [
739
+ { "at": "2026-11-22T12:52:53.587Z", "pick": "bold", "note": "" },
740
+ { "at": "2026-11-22T12:53:10.101Z", "pick": "bold", "note": "Shorter claim, please" }
741
+ ]
742
+ },
743
+ "hero:bold": { "group": "hero", "id": "bold", "status": "decided", "decidedAt": "2026-11-22T12:52:53.587Z" }
744
+ }
745
+ ```
746
+
747
+ `hud variants` prints the decisions, for an agent or an issue:
748
+
749
+ ```sh
750
+ npx hud variants # Markdown, from .hud/ in the current directory
751
+ npx hud variants --json # the same as JSON
752
+ npx hud variants --dir apps/web/.hud # another directory
753
+ ```
754
+
755
+ `formatVariantsMarkdown(await readVariants(store))` from `@hansenexus/hud/plugins/design/server`
756
+ does the same for any other store.
618
757
 
619
758
  ## Storage seam
620
759
 
@@ -1,4 +1,4 @@
1
- import { a as HudCapability } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability } from "./plugins-pL2CoWzI.js";
2
2
  import { t as HudEnv } from "./env-CApnbI0r.js";
3
3
  //#region src/plugins/access/capabilities.d.ts
4
4
  /** The capability vocabulary of the default matrix. Development grants these and any other. */
@@ -1,17 +1,17 @@
1
1
  import { t as HudAutoDetected } from "../detect-BxHZ0pxW.js";
2
- import { c as HudPlugin } from "../plugins-BZT-1LBe.js";
3
- import { n as a11y, t as A11yOptions } from "../index-DLCSLWW4.js";
4
- import { n as data } from "../index-BJJoAXJ2.js";
5
- import { t as forceState } from "../index-Caohnz3B.js";
2
+ import { c as HudPlugin } from "../plugins-pL2CoWzI.js";
3
+ import { n as a11y, t as A11yOptions } from "../index-D97Fnoie.js";
4
+ import { n as data } from "../index-BqKysxTq.js";
5
+ import { n as forceState } from "../index-BeqWehuh.js";
6
6
  import { t as InspectAdapter } from "../adapter-BYoxPYTI.js";
7
- import { n as InspectOptions, r as inspect } from "../index-BR5OB7DO.js";
7
+ import { n as InspectOptions, r as inspect } from "../index-DS0yT0c-.js";
8
8
  import { r as inspectConvex, t as ConvexClientLike } from "../index-BJ26pse9.js";
9
9
  import { i as inspectReactQuery, n as QueryClientLike } from "../index-RgXfMBuW.js";
10
10
  import { o as inspectSwr, t as InspectSwrOptions } from "../index-Dxz4fn4j.js";
11
- import { n as observe, t as ObserveOptions } from "../index-BNoPbSYD.js";
12
- import { t as routes } from "../index-B1vHAY9p.js";
13
- import { t as seo } from "../index-CQXiuMZQ.js";
14
- import { t as vitals } from "../index-D-hI-DRJ.js";
11
+ import { n as observe, t as ObserveOptions } from "../index-DvlCkGB1.js";
12
+ import { n as routes } from "../index-B7qaEUgh.js";
13
+ import { t as seo } from "../index-BGFyuJyN.js";
14
+ import { t as vitals } from "../index-B2KCKkN0.js";
15
15
  //#region src/auto/runtime.d.ts
16
16
  /**
17
17
  * What `auto()` takes: the instances a detected adapter wraps (a package can
package/dist/auto.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as HudAutoDetected } from "./detect-BxHZ0pxW.js";
2
- import { c as HudPlugin } from "./plugins-BZT-1LBe.js";
3
- import "./index-C3wzZS3o.js";
2
+ import { c as HudPlugin } from "./plugins-pL2CoWzI.js";
3
+ import "./index-5B7foZut.js";
4
4
  import { HudAutoFactories, HudAutoOptions } from "./auto/runtime.js";
5
5
  //#region src/auto/index.d.ts
6
6
  /** Nothing detected: this is the stand-in (`configured: false`). */
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as NOTHING_DETECTED } from "./detect-CHZiSeZs.js";
2
2
  import { t as a11y } from "./a11y-BGWw4jBr.js";
3
- import { t as forceState } from "./design-BXG1a4we.js";
3
+ import { t as forceState } from "./design-BIXY1-Ex.js";
4
4
  import { n as inspect } from "./inspect-CSkm8tn3.js";
5
5
  import { t as observe } from "./observe-CBNLU148.js";
6
6
  import { t as seo } from "./seo-BnnGq_vj.js";
package/dist/cli.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { t as file } from "./file-xdSaQ2uR.js";
3
+ import { n as readVariants, t as formatVariantsMarkdown } from "./variants-export-vEtZ-OGC.js";
2
4
  import { r as isExcluded } from "./scan-DzJNXqOk.js";
3
5
  //#region src/plugins/routes/sweep.ts
4
6
  /** Console errors every dev server produces that never mean a broken page. */
@@ -164,7 +166,12 @@ const USAGE = `hud sweep --base <url> [options]
164
166
  Visits every route the running app's routes plugin lists, headless, and fails on
165
167
  a 5xx answer, an uncaught error or a console error.
166
168
 
167
- Options
169
+ hud variants [--json] [--dir <path>]
170
+
171
+ Prints the picks, notes and log of the variant bar from .hud/variants.json, as
172
+ Markdown for an issue or an agent.
173
+
174
+ Options of hud sweep
168
175
  --base <url> dev server origin, e.g. http://localhost:3000 (required)
169
176
  --api <path> where createHudHandler is mounted (default /api/hud)
170
177
  --json print the report as JSON instead of lines
@@ -173,6 +180,10 @@ Options
173
180
  --ignore-console <re> ignore console errors matching this pattern (repeatable)
174
181
  --exclude <path> skip a URL path or folder pattern, trailing * allowed (repeatable)
175
182
 
183
+ Options of hud variants
184
+ --json print JSON instead of Markdown
185
+ --dir <path> directory of the file store (default .hud)
186
+
176
187
  Exit codes: 0 clean, 1 at least one route failed, 2 usage or setup error.`;
177
188
  var UsageError = class extends Error {};
178
189
  function next(argv, i, flag) {
@@ -185,10 +196,27 @@ function integer(value, flag) {
185
196
  if (!Number.isInteger(n) || n < 0) throw new UsageError(`${flag} needs a non-negative integer`);
186
197
  return n;
187
198
  }
199
+ function parseVariants(rest) {
200
+ const args = {
201
+ command: "variants",
202
+ json: false
203
+ };
204
+ for (let i = 0; i < rest.length; i++) {
205
+ const flag = rest[i] ?? "";
206
+ if (flag === "--json") args.json = true;
207
+ else if (flag.startsWith("--dir=") && flag.length > 6) args.dir = flag.slice(6);
208
+ else if (flag === "--dir") {
209
+ args.dir = next(rest, i, flag);
210
+ i++;
211
+ } else throw new UsageError(`unknown option "${flag}"`);
212
+ }
213
+ return args;
214
+ }
188
215
  /** `argv` without the runtime and script. */
189
216
  function parseArgs(argv) {
190
217
  const [command, ...rest] = argv;
191
218
  if (command === void 0 || command === "--help" || command === "-h" || command === "help") return { command: "help" };
219
+ if (command === "variants") return parseVariants(rest);
192
220
  if (command !== "sweep") throw new UsageError(`unknown command "${command}"`);
193
221
  const args = {
194
222
  command: "sweep",
@@ -246,6 +274,11 @@ async function main(argv) {
246
274
  process.stdout.write(`${USAGE}\n`);
247
275
  return 0;
248
276
  }
277
+ if (args.command === "variants") {
278
+ const decisions = await readVariants(file(args.dir === void 0 ? {} : { dir: args.dir }));
279
+ process.stdout.write(`${args.json ? JSON.stringify(decisions, null, 2) : formatVariantsMarkdown(decisions)}\n`);
280
+ return 0;
281
+ }
249
282
  const quiet = args.json;
250
283
  const log = (line) => {
251
284
  if (!quiet) process.stdout.write(`${line}\n`);
@@ -1,4 +1,4 @@
1
- import { a as HudCapability, c as HudPlugin } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability, c as HudPlugin } from "./plugins-pL2CoWzI.js";
2
2
  import { ComponentType, ReactNode } from "react";
3
3
  //#region src/shell/panels/types.d.ts
4
4
  /** The viewport edge the rail docks to. */
@@ -40,8 +40,9 @@ function useForceStateBadge() {
40
40
  //#endregion
41
41
  //#region src/plugins/design/index.tsx
42
42
  const TokensPanel = lazy(() => import("./tokens-panel-CbMQfasZ.js"));
43
- const VariantsPanel = lazy(() => import("./variants-panel-B6zWcknV.js"));
44
- const ForceStatePanel = lazy(() => import("./force-state-panel-mu-txJnA.js"));
43
+ const VariantsPanel = lazy(() => import("./variants-panel-D23v5KIp.js"));
44
+ const ForceStatePanel = lazy(() => import("./force-state-panel-D5oDydLs.js"));
45
+ const VariantBar = process.env.NODE_ENV === "development" ? lazy(() => import("./variant-bar-BzZ0ln-C.js")) : void 0;
45
46
  /**
46
47
  * Live swatches of the host app's design tokens. Values are read from the
47
48
  * host document, outside the HUD's shadow root, so scoped and themed tokens
@@ -60,23 +61,40 @@ function tokens(adapter) {
60
61
  }
61
62
  /**
62
63
  * The page's live variant groups (`VariantGroup` from `@hansenexus/hud/variants`)
63
- * with a switcher, agent scores from the storage seam and Decide, which
64
- * needs `variants.decide` and `variantsServer()` from
65
- * `@hansenexus/hud/plugins/design/server`. An adapter adds the app's own
66
- * variant registry and the generate-brief queue (`variants.generate`). Client only.
64
+ * with a switcher and agent scores from the storage seam. `pages` adds the
65
+ * variant bar, which steps through them and records picks and notes. Picks
66
+ * need `variants.decide` and `variantsServer()` from
67
+ * `@hansenexus/hud/plugins/design/server`. The adapter fields add the app's
68
+ * own variant registry and the generate-brief queue (`variants.generate`).
69
+ * Client only.
67
70
  */
68
- function variants(adapter) {
71
+ function variants(options = {}) {
72
+ const { pages, navigate, ...adapter } = options;
69
73
  function Panel({ ctx }) {
70
74
  return /* @__PURE__ */ jsx(VariantsPanel, {
71
75
  adapter,
72
76
  ctx
73
77
  });
74
78
  }
75
- return definePlugin({
79
+ const plugin = {
76
80
  id: "variants",
77
81
  title: "Variants",
78
82
  icon: hudIcon("layers"),
79
83
  panel: Panel
84
+ };
85
+ if (!VariantBar || !pages || pages.length === 0) return definePlugin(plugin);
86
+ const Bar = VariantBar;
87
+ const barPages = pages;
88
+ function Overlay({ ctx }) {
89
+ return /* @__PURE__ */ jsx(Bar, {
90
+ pages: barPages,
91
+ navigate,
92
+ ctx
93
+ });
94
+ }
95
+ return definePlugin({
96
+ ...plugin,
97
+ overlay: Overlay
80
98
  });
81
99
  }
82
100
  /**
@@ -1,5 +1,5 @@
1
1
  import { i as formatForceStateParam, o as getForceStateStore, r as FORCE_STATE_PARAM, s as resolveForcedState, t as FORCED_STATES } from "./force-state-BaqWsmrf.js";
2
- import { i as useForceState } from "./design-BXG1a4we.js";
2
+ import { i as useForceState } from "./design-BIXY1-Ex.js";
3
3
  import { t as DESIGN_CSS } from "./styles-DKU_P8MH.js";
4
4
  import { useEffect } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { a as HudCapability, c as HudPlugin, s as HudHttpMethod } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability, c as HudPlugin, s as HudHttpMethod } from "./plugins-pL2CoWzI.js";
2
2
  //#region src/server/handler.d.ts
3
3
  /**
4
4
  * Decides whether a request may reach a plugin route. Return a `Response` to
@@ -1,5 +1,5 @@
1
- import { a as HudCapability, c as HudPlugin } from "./plugins-BZT-1LBe.js";
2
- import { o as HudDock } from "./define-hud-DTv3njuU.js";
1
+ import { a as HudCapability, c as HudPlugin } from "./plugins-pL2CoWzI.js";
2
+ import { o as HudDock } from "./define-hud-B0aFXrcK.js";
3
3
  import { ComponentType, ReactNode } from "react";
4
4
  //#region src/core/grabber/outline.d.ts
5
5
  interface ElementOutlineProps {
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  import { Metric } from "web-vitals";
3
3
  //#region src/plugins/vitals/vitals-panel.d.ts
4
4
  declare function VitalsPanel(): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { l as HudPluginContext, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
+ import "./index-5B7foZut.js";
3
+ //#region src/plugins/routes/index.d.ts
4
+ interface RoutesOptions {
5
+ /**
6
+ * Shortcut of the "Go to route" command, which opens the panel with the
7
+ * filter focused and its text selected. Default `mod+shift+r`.
8
+ */
9
+ shortcut?: string;
10
+ /**
11
+ * Path globs listed first, above the groups: `["/*\/dev/*"]` pins every dev
12
+ * page. `*` matches within a segment, `**` across segments. Rows pinned from
13
+ * the panel join them, kept per app in `localStorage`.
14
+ */
15
+ pinned?: readonly string[];
16
+ /**
17
+ * How a row navigates. Default: Next's router (`window.next.router.push`)
18
+ * when the page has one, else `location.assign`.
19
+ */
20
+ navigate?: (url: string) => void;
21
+ }
22
+ /**
23
+ * Route index and quick switcher: every page of the app's `app/` tree,
24
+ * dynamic segments filled from the fixtures the server half knows, pinned
25
+ * and recent routes first, one keystroke away. Client half; the scanner lives
26
+ * in `@hansenexus/hud/plugins/routes/server`, which also feeds the `hud sweep`
27
+ * CLI.
28
+ */
29
+ declare function routes({ shortcut, pinned, navigate }?: RoutesOptions): {
30
+ readonly id: "routes";
31
+ readonly title: "Routes";
32
+ readonly capability: "routes.read";
33
+ readonly icon: import("react").ComponentType;
34
+ readonly badge: ({ ctx }: HudPluginProps) => null;
35
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
36
+ readonly commands: readonly [{
37
+ readonly id: "go";
38
+ readonly title: "Go to route";
39
+ readonly shortcut: string;
40
+ readonly run: (ctx: HudPluginContext) => void;
41
+ }];
42
+ };
43
+ //#endregion
44
+ export { routes as n, RoutesOptions as t };
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  //#region src/plugins/seo/seo-panel.d.ts
3
3
  /** Every check grouped, worst level first in the summary; head changes re-check automatically. */
4
4
  declare function SeoPanel(): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
2
  //#region src/plugins/design/force-state-panel.d.ts
3
3
  /**
4
4
  * Toggles every mounted `StateBoundary` between its real state and a forced
@@ -45,6 +45,16 @@ interface HudTokensAdapter {
45
45
  sourceHint?: string;
46
46
  }
47
47
  //#endregion
48
+ //#region src/plugins/design/variant-pages.d.ts
49
+ /** One stop of the variant bar: a page with a `VariantGroup` on it. */
50
+ interface HudVariantPage {
51
+ /** The `VariantGroup` id the page decides. */
52
+ group: string;
53
+ label: string;
54
+ /** Where the page is: `/pricing`, `#/settings` or `/app#/settings`. */
55
+ href: string;
56
+ }
57
+ //#endregion
48
58
  //#region src/plugins/design/variants-panel.d.ts
49
59
  interface HudVariantCategory {
50
60
  id: string;
@@ -74,7 +84,7 @@ interface HudGenerateResult {
74
84
  */
75
85
  interface HudVariantsAdapter {
76
86
  /** The categories, or a loader the panel calls each time it opens. */
77
- categories: readonly HudVariantCategory[] | (() => Promise<readonly HudVariantCategory[]>);
87
+ categories?: readonly HudVariantCategory[] | (() => Promise<readonly HudVariantCategory[]>);
78
88
  /** Deep link to the full review dashboard, where voting happens. */
79
89
  reviewHref?: string;
80
90
  /** Deep link for one category's drill-in page. */
@@ -100,18 +110,36 @@ declare function tokens(adapter: HudTokensAdapter): {
100
110
  readonly icon: import("react").ComponentType;
101
111
  readonly panel: () => import("react").JSX.Element;
102
112
  };
113
+ interface HudVariantsOptions extends HudVariantsAdapter {
114
+ /**
115
+ * The pages with a `VariantGroup`, in the order the owner walks them. With
116
+ * them the variant bar shows at the bottom of the screen, in development
117
+ * builds only. Keep the array stable.
118
+ */
119
+ pages?: readonly HudVariantPage[];
120
+ /** How the bar goes to a page. Default: Next's router when the page has one, else a full load. */
121
+ navigate?: (href: string) => void;
122
+ }
103
123
  /**
104
124
  * The page's live variant groups (`VariantGroup` from `@hansenexus/hud/variants`)
105
- * with a switcher, agent scores from the storage seam and Decide, which
106
- * needs `variants.decide` and `variantsServer()` from
107
- * `@hansenexus/hud/plugins/design/server`. An adapter adds the app's own
108
- * variant registry and the generate-brief queue (`variants.generate`). Client only.
125
+ * with a switcher and agent scores from the storage seam. `pages` adds the
126
+ * variant bar, which steps through them and records picks and notes. Picks
127
+ * need `variants.decide` and `variantsServer()` from
128
+ * `@hansenexus/hud/plugins/design/server`. The adapter fields add the app's
129
+ * own variant registry and the generate-brief queue (`variants.generate`).
130
+ * Client only.
109
131
  */
110
- declare function variants(adapter?: HudVariantsAdapter): {
111
- readonly id: "variants";
112
- readonly title: "Variants";
132
+ declare function variants(options?: HudVariantsOptions): {
133
+ id: string;
134
+ title: string;
135
+ icon: import("react").ComponentType;
136
+ panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
137
+ } | {
138
+ readonly id: string;
139
+ readonly title: string;
113
140
  readonly icon: import("react").ComponentType;
114
141
  readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
142
+ readonly overlay: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
115
143
  };
116
144
  /**
117
145
  * Forces the page's `StateBoundary`s (`@hansenexus/hud/state-boundary`) to
@@ -132,4 +160,4 @@ declare function forceState(): {
132
160
  }];
133
161
  };
134
162
  //#endregion
135
- export { HudGenerateResult as a, HudTokenDescriptor as c, HudTokensAdapter as d, HudGenerateRequest as i, HudTokenGroup as l, tokens as n, HudVariantCategory as o, variants as r, HudVariantsAdapter as s, forceState as t, HudTokenScope as u };
163
+ export { HudGenerateRequest as a, HudVariantsAdapter as c, HudTokenGroup as d, HudTokenScope as f, variants as i, HudVariantPage as l, forceState as n, HudGenerateResult as o, HudTokensAdapter as p, tokens as r, HudVariantCategory as s, HudVariantsOptions as t, HudTokenDescriptor as u };
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
2
  import { s as HudMockScenario } from "./mocks-CA-wM2SB.js";
3
3
  import { n as HudMockWorkerModule, r as MockWorkerOptions } from "./msw-browser-wjaYgkB7.js";
4
4
  //#region src/plugins/data/data-panel.d.ts
@@ -1,5 +1,5 @@
1
- import { l as HudPluginContext, r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
2
- import "./index-C3wzZS3o.js";
1
+ import { l as HudPluginContext, r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
+ import "./index-5B7foZut.js";
3
3
  //#region src/plugins/a11y/axe.d.ts
4
4
  type AxeImpact = "critical" | "serious" | "moderate" | "minor";
5
5
  /** Element path as axe reports it: selectors per shadow-DOM or frame hop. */
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  import { a as CaptureOptions, t as InspectRequest } from "./requests-CJrUf465.js";
3
3
  import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
4
4
  //#region src/plugins/observe/redact.d.ts
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
2
  import { a as CaptureOptions } from "./requests-CJrUf465.js";
3
3
  //#region src/plugins/observe/info-tab.d.ts
4
4
  /** The signed-in user as the app knows it. Every field is optional. */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as GrabScreenshotImage, i as GrabScreenshot, n as GrabAnchor, o as matchComponentHints, r as GrabPayload, s as GrabComponent, t as ComponentHint } from "./payload-MUQ9ciER.js";
2
- import { _ as HudGrab, a as HudCapability, b as useGrab, c as HudPlugin, g as ratingTone, h as definePlugin, i as HudBadgeTone, l as HudPluginContext, m as PinEdge, n as HudApiError, o as HudCommand, r as HudBadge, t as HudAccessControl, u as HudPluginProps, v as HudGrabState, y as HudHighlight } from "./plugins-BZT-1LBe.js";
3
- import { a as DockSide, i as defineHud, n as HudAutoPlugins, o as HudDock, r as HudMountProps, t as DefineHudOptions } from "./define-hud-DTv3njuU.js";
4
- import { a as hudIcon, c as PICKER_CSS, d as ElementOutlineProps, i as HudIconName, l as PickPoint, n as HudProps, o as ElementPicker, r as HUD_ICON_NAMES, s as ElementPickerProps, t as Hud, u as ElementOutline } from "./index-C3wzZS3o.js";
2
+ import { _ as HudGrab, a as HudCapability, b as useGrab, c as HudPlugin, g as ratingTone, h as definePlugin, i as HudBadgeTone, l as HudPluginContext, m as PinEdge, n as HudApiError, o as HudCommand, r as HudBadge, t as HudAccessControl, u as HudPluginProps, v as HudGrabState, y as HudHighlight } from "./plugins-pL2CoWzI.js";
3
+ import { a as DockSide, i as defineHud, n as HudAutoPlugins, o as HudDock, r as HudMountProps, t as DefineHudOptions } from "./define-hud-B0aFXrcK.js";
4
+ import { a as hudIcon, c as PICKER_CSS, d as ElementOutlineProps, i as HudIconName, l as PickPoint, n as HudProps, o as ElementPicker, r as HUD_ICON_NAMES, s as ElementPickerProps, t as Hud, u as ElementOutline } from "./index-5B7foZut.js";
5
5
  import { n as HUD_HOST_TAG, t as HUD_DEV_MARKER } from "./marker-CMrvxPmS.js";
6
6
  export { type ComponentHint, type DefineHudOptions, type DockSide, ElementOutline, type ElementOutlineProps, ElementPicker, type ElementPickerProps, type GrabAnchor, type GrabComponent, type GrabPayload, type GrabScreenshot, type GrabScreenshotImage, HUD_DEV_MARKER, HUD_HOST_TAG, HUD_ICON_NAMES, Hud, type HudAccessControl, HudApiError, type HudAutoPlugins, type HudBadge, type HudBadgeTone, type HudCapability, type HudCommand, type HudDock, type HudGrab, type HudGrabState, type HudHighlight, type HudIconName, type HudMountProps, type HudPlugin, type HudPluginContext, type HudPluginProps, type HudProps, PICKER_CSS, type PickPoint, type PinEdge, defineHud, definePlugin, hudIcon, matchComponentHints, ratingTone, useGrab };