Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/herdr-insights-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ and `insights.json`; the automated installer tests cover those boundaries.
## Sharing a build

Keep `herdr-insights/` self-contained, with `RECIPE.md`, `INSTALL.md`, `README.md`,
`preview.png`, `mods/insights/`, and `mods/insights-launcher/`. Do not ship layouts,
key snippets, developer tests/fixtures, or smoke-test tooling in that folder.
The installer preflights both mod trees, checks temporary buffered copies before
replacing either live mod, generates the dashboard's local Node path, and records
ownership separately for each mod. Install/uninstall share an exclusive lock;
`preview.png`, and `mods/insights/`. Do not ship layouts, key snippets, developer
tests/fixtures, or smoke-test tooling in that folder. One native mod serves both
views: `props.mode: "toolbar"` renders the button, and ordinary panes render the
dashboard. The installer preflights the mod tree, checks a temporary buffered copy
before replacing live files, generates the dashboard's local Node path, and records
ownership in `install-manifest.json`. Install/uninstall share an exclusive lock;
interrupted operations require confirming the process stopped before removing it.
The toolbar is a personal layout clone wrapping Herdr's original `tabs` block;
no built-in mod source is cloned, patched, or vendored. See
[INSTALL.md](../herdr-insights/INSTALL.md) for the clone, click-state, and
ownership rules. A clone does not inherit future structural changes to its
source layout. Validate both mods with `herdr-app check` and inspect the actual
source layout. A normal install has one `install-manifest.json` and the dashboard
`runtime.json`. Validate the mod with `herdr-app check` and inspect the actual
toolbar in the existing window; do not launch a second instance.

For Herdr Community discovery, publish the folder in a public GitHub repo and
Expand Down
22 changes: 10 additions & 12 deletions herdr-insights/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Requires **Node.js 22.15+** and a running Herdr. Never launch a second Herdr instance.
Follow Herdr's `AGENTS.md`; this guide does not override its review requirements.
Use the existing build, not `RECIPE.md` (rebuilding).
Use this existing build, not `RECIPE.md` (rebuilding).

## Install

Expand All @@ -12,20 +12,18 @@ From the parent of `herdr-insights/`; no `npm install` needed:
npm run install:local --prefix herdr-insights
```

App home defaults to `$HERDR_APP_HOME` or `~/.config/herdr-app`.
The installer checks temporary copies of both mods before replacing live files.
First install creates/selects `<current-layout>-insights` (suffixing collisions)
and adds **Insights** beside Files/Changes. Reinstall updates owned mods without
rewriting layouts or changing the selected layout. Shipped files, tabs, terminals,
keys, click state, and usage data are preserved.
The installer checks `mods/insights` before copying it to the app home, which
defaults to `$HERDR_APP_HOME` or `~/.config/herdr-app`. First install creates and
selects a personal layout whose **Insights** button sits beside the native tabs.
Reinstall updates owned files without rewriting layouts. Shipped tabs, keys, and
usage data are preserved.

Success requires two `herdr-app check passed` messages **and exit code 0**.
Success requires one `herdr-app check passed` message **and exit code 0**.
Do not run developer tests or change tabs during installation. Open the dashboard
only if requested: click **Insights**, or add `-- --open` to the install command.

## Errors

Stop and report; do not force overwrites or rebuild to bypass errors. The layout
must contain the native `tabs` block. Preserve local edits and any failed layout
clone. Remove the app home's `.insights-install.lock` directory only after
confirming no installer/uninstaller is running.
Stop and report; do not force overwrites or rebuild to bypass errors. Preserve
local edits and any failed layout clone. Remove the app home's
`.insights-install.lock` directory only after confirming no installer/uninstaller is running.
34 changes: 13 additions & 21 deletions herdr-insights/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ cd coding-agent-toolkit
npm run install:local --prefix herdr-insights
```

With Herdr running, the installer checks both mods and adds **Insights** beside
**Files / Changes**; clicking it reuses the current space's Insights tab, opening
one only when absent. It installs
`mods/insights/` and `mods/insights-launcher/`, records ownership in
`data/insights/`, and creates a personal layout clone for the button. Shipped
files, keys, terminals, and usage data are unchanged. See [INSTALL.md](INSTALL.md)
for the layout and click-state rules. Set `HERDR_APP_HOME` to use a different app home.
With Herdr running, the installer checks the `insights` mod and adds an
**Insights** button beside the native tabs; clicking it reuses the current
space's dashboard tab, opening one only when absent. It installs `mods/insights/`
and records ownership in `data/insights/`. Shipped files, tabs, keys, terminals,
and usage data are unchanged. See [INSTALL.md](INSTALL.md) for the layout and
click-state rules. Set `HERDR_APP_HOME` to use a different app home.

## Use

Expand All @@ -47,21 +46,14 @@ response text or modify source transcripts.

## Development

[RECIPE.md](RECIPE.md) is the self-contained rebuild brief required by Herdr.
The distribution folder is `herdr-insights`; its dashboard mod ID is `insights`
and its display name is **Insights**. `insights-launcher` is a separate, native
toolbar button that shows the space's existing Insights tab, opening one only
when absent; it has no polling, helper process, or overlays. No layouts or key
bindings ship; the button lives in a personal layout clone composed by the
installer (see [INSTALL.md](INSTALL.md)).
One native mod, `mods/insights`, provides both views. A pane whose content is
`{mod: "insights", props: {mode: "toolbar"}}` renders only the button; any other
pane shows the dashboard. Toolbar mode starts no Node helper, scans, tasks,
timers, or editors. No layouts or key bindings ship; the button lives in a
personal layout clone composed by the installer, which wraps the native tabs
without modifying them (see [INSTALL.md](INSTALL.md)).

[RECIPE.md](RECIPE.md) is the self-contained rebuild brief required by Herdr.
Developer tests, fixtures, and release validation live outside this distribution;
see the repo's [development guide](../docs/herdr-insights-development.md). They are
not installation steps.

With Herdr running, uninstall while keeping usage data and returning to the
original layout:

```sh
npm run uninstall:local --prefix herdr-insights
```
76 changes: 39 additions & 37 deletions herdr-insights/RECIPE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

A native Herdr dashboard for token usage across Pi, Codex, Claude Code, and
OpenCode. It reads existing local session data, shows model rankings and activity,
and opens in its own tab from an Insights button beside Files and Changes. No
built-in Herdr code, terminals, or keys are changed.
and opens in its own tab from an Insights button beside the native tabs. One mod
provides both the button and the dashboard; no built-in Herdr code, terminals, or
keys are changed.

![Insights](preview.png)

Expand All @@ -18,17 +19,18 @@ of 1180px. Use Herdr theme colors, 1px borders, 8px card corners, 6px control
corners, no decorative shadows, and 4/8/12/16/24px spacing. Page padding is 12px
below 620px, 16px below 900px, and 24px otherwise. Support light and dark themes.

A separate `insights-launcher` mod draws the **Insights** toolbar button after
Files and Changes. Match Herdr's panel controls: 26px height, 8px horizontal
padding, 5px icon/text gap, 6px corners, 12px type, 14px theme-tinted chart icon,
chrome background, muted text, and native hover colors. Its root matches the tab
bar's chrome background and 1px bottom border. Stop mouse-down propagation on
the button so it does not drag the window. Every click shows the current space's
existing Insights tab (the tab whose pane runs the `insights` mod) instead of
stacking duplicates. Focus its pane with `pane.focus`; if a different pane in
that tab is zoomed, unzoom it first so the dashboard is visible. It calls `tab.new` with `{name: "Insights", mod: "insights"}`
only when that space has none. No floating window, overlay, polling, file access,
or helper process.
The `insights` mod's toolbar mode draws the **Insights** button after the native
tabs. Match Herdr's panel controls: 26px height, 8px horizontal padding, 5px
icon/text gap, 6px corners, 12px type, 14px theme-tinted chart icon, chrome
background, muted text, and native hover colors. Its root matches the tab bar's
chrome background and 1px bottom border. Stop mouse-down propagation on the
button so it does not drag the window. Toolbar mode starts no Node helper, scans,
tasks, timers, or editors. Every click shows the current space's existing Insights
tab (the tab whose pane runs `insights` in dashboard mode) instead of stacking
duplicates. Focus its pane with `pane.focus`; if a different pane in that tab is
zoomed, unzoom it first so the dashboard is visible. Call `tab.new` with
`{name: "Insights", mod: "insights"}` only when that space has none. No floating
window, overlay, polling, file access, or helper process.

Dashboard, top to bottom:
- An Insights header with last-update status, Refresh, and Settings.
Expand Down Expand Up @@ -75,16 +77,17 @@ controls preserve custom mappings. Changing source configuration invalidates the
scan cache; palette/cache/week-start/refresh changes preserve collected history.

**Built from:** Put this distribution in `herdr-insights/`, with `RECIPE.md`,
`README.md`, `INSTALL.md`, `preview.png`, `mods/insights/`, and
`mods/insights-launcher/`. Keep developer
`README.md`, `INSTALL.md`, `preview.png`, and `mods/insights/`. Keep developer
tests, fixtures, and release-check tooling outside this distribution folder.
Do not include a `layouts/` folder or keys snippet: no bindings are needed.
The recipe heading and `mod.json` title are **Insights**; the native mod ID is `insights`.
The recipe heading and `mod.json` title are **Insights**; the native mod ID is
`insights`.

`mods/insights/mod.json` contains `{"place":"none","title":"Insights"}`.
`mods/insights-launcher/mod.json` also uses `place: "none"`, `title: "Insights"`.
Its `main.js` default-exports a small native View using gpui-base flex builders,
`theme()`, and `run()`; bundle its chart icon as `insights.svg`.
`main.js` default-exports one native View using gpui-base flex builders, `theme()`,
and `run()`. Read Herdr's `props()?.mode`: `"toolbar"` renders only the button and
its click handler; every other value renders the dashboard and runs its collectors. The
button's chart icon ships in the same tree.

`scripts/toolbar.mjs` integrates through layout composition, not source patching.
Use `layout.clone {name: current, as: current + "-insights"}` to preserve Herdr's
Expand All @@ -94,7 +97,8 @@ already exists. Never overwrite another layout's state, including leftover state
from uninstall. Do not edit or remove Herdr-managed click state. In the personal clone only, turn the existing `tabs`
block into a nonresizable row, keeping its ID, height, paint, and window-drag
attributes. Its first child is a weight-1 block with the original `content`
(including its props); its second is a 104px block with `insights-launcher`.
(including its props); its second is a 104px block whose content is
`{mod: "insights", props: {mode: "toolbar"}}`.
Do not copy or modify the shipped `tabs` mod. Refuse unsupported/ambiguous layouts.
Record the personal layout's name, source, and hash in `toolbar-install.json`.
Reinstall must not rewrite this layout or switch the user's selected layout.
Expand Down Expand Up @@ -136,17 +140,15 @@ and executable mappings. `core/config.mjs` defines and validates the full schema

Provide dependency-free Node install/uninstall scripts. The installer requires
Node >=22.15 and validates it before writing anything; the uninstaller intentionally
has no Node gate so it remains usable on older runtimes. Install only these two
mod trees (plus ownership manifests under `data/insights/`) and generate the dashboard's `runtime.json` with the
absolute installer Node path; the UI uses that path, falling back to `node` on PATH
only for manual copies. Track ownership/hashes in a separate install manifest.
Keep the existing dashboard manifest compatible and use
`launcher-install-manifest.json` for the launcher. Preflight both targets before
writing either. Refuse symlinks and unowned collisions; refuse edited owned files
unless explicitly forced. Preserve usage data and unrelated files. Check buffered
copies of both mods with `herdr-app check` in a temporary app home before replacing
either live mod; clean up on success or failure. Revalidate targets after checking
to preserve edits made during validation. Serialize install/uninstall with an
has no Node gate so it remains usable on older runtimes. Install only the `insights`
mod tree (plus ownership files under `data/insights/`) and generate the dashboard's
`runtime.json` with the absolute installer Node path; the UI uses that path, falling
back to `node` on PATH only for manual copies. Track ownership/hashes in
`install-manifest.json`. Preflight every target before writing. Refuse symlinks and
unowned collisions; refuse edited owned files unless explicitly forced. Preserve
usage data and unrelated files. Check a buffered copy of the mod with `herdr-app check`
in a temporary app home before replacing live files; clean up on success or failure.
Revalidate targets after checking to preserve edits made during validation. Serialize install/uninstall with an
exclusive `.insights-install.lock` directory for the full operation, and never
steal a lock automatically. Recheck clone destinations and source state just before
cloning, and recheck the active layout and clone hash before deleting on uninstall.
Expand All @@ -168,18 +170,18 @@ data. Write only the owned personal layout clone. Preserve collisions and local
edits. Do not copy an absolute runtime path from another machine.

**Done when:** For a new build or release (not an installation), package tests
and checks pass, including distribution naming, PNG preview, recipe structure,
and checks pass, including single-mod distribution, PNG preview, recipe structure,
no layouts, token accounting, deduplication, configuration validation, incremental
recovery, and safe installation/uninstallation.
Run `herdr-app check` on both installed mods. Inspect a real screenshot: Insights
must be in the same row as Files/Changes with matching button styling, no extra
Run `herdr-app check` on the installed mod. Inspect a real screenshot: Insights
must be in the same row as the native tabs with matching button styling, no extra
strip or floating window. Clicks reuse the current space's dashboard, including
when it is in a split behind another pane's zoom, without creating duplicates.
Confirm built-in
code/layouts are unchanged and reinstall does not duplicate the toolbar. Also run populated-render and asynchronous
native smoke checks in temporary app homes. Inspect a native screenshot and status
for render errors. Verify actual filters, heatmap modes, source settings, refresh,
and empty/error states. Reinstall without changing source transcripts, existing
layouts, keys, local edits, or `insights.json`. Keep the GitHub repo public and add topic
`herdr-mod` for Community discovery after merging to the default branch; allow
up to an hour for indexing and at least 24 hours for picture screening.
layouts, keys, local edits, or `insights.json`. Keep the GitHub repo public and add topic `herdr-mod` for Community discovery after merging to the
default branch; allow up to an hour for indexing and at least 24 hours for picture
screening.
36 changes: 0 additions & 36 deletions herdr-insights/mods/insights-launcher/main.js

This file was deleted.

1 change: 0 additions & 1 deletion herdr-insights/mods/insights-launcher/mod.json

This file was deleted.

Loading
Loading