Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/hooked-worktrees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@northguild/worktree": minor
---

Add `worktree claude-hook`, so Claude Code's `--worktree`, subagent isolation and background sessions can create and remove worktrees through this tool (the `WorktreeCreate` and `WorktreeRemove` hooks), and copy the gitignored files a root `.worktreeinclude` names.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ That will:

1. create a new branch from your configured source branch
2. add a Git worktree under `<repo>.worktrees/feature/improve-readme`
3. copy the gitignored env files from the main repository — `.env*`, `.dev.vars*` and `.envrc` — and any gitignored file `.worktree.yml` lists under `copy`
3. copy the gitignored env files from the main repository — `.env*`, `.dev.vars*` and `.envrc` — any gitignored file `.worktree.yml` lists under `copy`, and any gitignored file a root `.worktreeinclude` matches
4. install dependencies — by default when non-interactive, and on a terminal when `postCreate` is set or `--install` is given (`--no-install` skips it); the command is your `postCreate`, else the steps under `postCreate` in `.worktree.yml` (run in order, after you approve them: checked before anything is created, asked on a terminal, exit `2` with `missing_value` when nothing can be asked, so approve with `worktree config --approve` or skip with `--no-install`), else the `postCreate` steps in your user config file (no approval), else inferred from the lockfile (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lock`); a failure stops the remaining steps, keeps the worktree, opens nothing and exits `1`
5. open the new worktree in your configured editor, if one is set — or as a Herdr space when `opener` is `herdr`, or as a Rex session when it is `rex`; with `auto`, in the Herdr or Rex the command runs inside, else the editor

Expand Down Expand Up @@ -263,6 +263,7 @@ Only the owner of `linear.apiKey` (or the ids in `linear.agentAllow`) can start
| `worktree remove [branch]` | Remove one or more worktrees |
| `worktree cleanup` | Remove stale worktrees that are safe to delete |
| `worktree linear-listen` | Start a worktree for each Linear agent delegation |
| `worktree claude-hook` | Make Claude Code create and remove worktrees with this tool |

For command help at any time:

Expand Down
4 changes: 2 additions & 2 deletions context/stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ scripts/ version-sync script, run by `pnpm sync-version`; `release-
.changeset/ Changesets config and pending release notes (`.changeset/<name>.md`)
skills/ the usage skill, `skills/worktree/SKILL.md`; hand-written, shipped inside the npm package (package.json `files`) and installable with `npx skills add`. Nothing on npm discovers it since TanStack Intent went (`skills add` reads GitHub); it stays in `files` so an `npm i -g` install has a copy matching its own version on disk
docs/ Astro 7 + Starlight docs site, React 19 islands, Base UI; own package.json, `astro.config.mjs`
docs/src/content/docs/ Starlight pages (29 pages: `index.mdx` is the landing at `/worktree/`, `getting-started.mdx` is Getting Started at `/worktree/getting-started/`, plus `commands/` (9 command pages and an index), `guides/` (12 guides and an index), `configuration`, `project-configuration`, `faq` and `changelog`)
docs/src/content/docs/ Starlight pages (30 pages: `index.mdx` is the landing at `/worktree/`, `getting-started.mdx` is Getting Started at `/worktree/getting-started/`, plus `commands/` (10 command pages and an index), `guides/` (12 guides and an index), `configuration`, `project-configuration`, `faq` and `changelog`)
docs/src/ chat client, site metadata, styles; the chat is the page `/dox` (`pages/dox.astro`, one React island, `chat/components/DoxPage.tsx`), reached by plain links only: the header's "Chat with Dox" crystal (`components/Header.astro`, repeated in the mobile menu by `components/MobileMenuFooter.astro`) and the landing's "Ask Dox" (`components/Hero.astro`); `components/DoxMark.astro` draws the crystal, and no page but `/dox` loads chat code; the header's right group ends with the settings gear (`components/SettingsControl.astro`, wired by `lib/settings-control.ts`: a native `[popover]` holding the "Dark theme" switch, whose rule is `lib/theme.ts`; it shows at every width, below 50rem as the only chip of the right group that does, and the mobile menu has no copy); sound is `lib/sound/` (GMT's engine, cut down: `settings.ts` is the reader's choice in the `dox:sound` key shared with GMT and northguild.dev, `cue.ts` is loaded on every page by `components/Head.astro`, and the engine is a chunk only its dynamic `import()` reaches, once a reader has unmuted, and on the landing alone it imports `lib/sound/leaves.ts`, the leaves' voices, driven by the last landing and the sampled landing places `hero/flight.ts` computes, only while sound is on, from the particles' own timings; no press makes a sound but the chat's Send and "Try again"); `components/Hero.astro` puts the landing's copy beside `HeroLeaves.astro` (the leaf-particle hero: a still SVG, a canvas and a small loader script; the effect itself, in `hero/` with OGL, is a chunk only the loader's dynamic `import()` reaches, so the landing alone ships hero script; its CSS is in the shared stylesheet); the share cards are made in the build: `pages/og/[...route].ts` writes `dist/og/site.png` and one PNG per page, `lib/og-cards.ts` decides the cards and their alt text, `lib/og-art.ts` draws one with CanvasKit (`lib/og-canvaskit.ts` loads it) over the committed `assets/og-art.png` in the Michroma TTF of `assets/og-fonts/`, `components/Head.astro` writes each page's share tags, and `lib/og-image-version.ts` is the integration that appends `?v=<hash>` to them after the build
docs/src/styles/northguild/ the NorthGuild theme, vendored unedited from `northguild/northguild.dev` `packages/theme/` (each file's header names the commit); `docs/src/styles/theme.css` is this site's own `--gmt-*` → `--sl-*` mapping. To refresh, see `docs/README.md` (Theme)
docs/wrangler.jsonc the docs site's Worker config (assets from `docs/.deploy`, the build staged under `worktree/` and `docs/deploy/_headers` at its root by `stage:deploy`); `docs/scripts/` holds `audit-dist.mjs`, `build-og-art.mjs` (draws the share cards' art into `docs/src/assets/og-art.png` by hand, never in the build), `theme-contrast.mjs` (measures the theme's contrast pairs), `build-legacy-pages.mjs` (writes the gitignored `docs/legacy/`), `deploy-smoke.mjs` and `web-vitals.mjs` (measures Core Web Vitals by hand, not a gate)
Expand Down Expand Up @@ -86,7 +86,7 @@ untrue on one of these surfaces is fixed by the phase that makes it untrue, not
| Surface | Who reads it | What has to reach it |
|---|---|---|
| [`README.md`](../README.md) | someone deciding whether to install; npm renders it as the package page | the fast path — a new command, a renamed flag, a change to what the tool is for |
| `docs/src/content/docs/` | users looking something up, at https://northguild.dev/worktree/ | any user-visible CLI behaviour. One page per command under `commands/` (9), plus `configuration.mdx`, `project-configuration.mdx`, `index.mdx` (the landing), `getting-started.mdx`, `faq.mdx`, and `guides/` (12) |
| `docs/src/content/docs/` | users looking something up, at https://northguild.dev/worktree/ | any user-visible CLI behaviour. One page per command under `commands/` (10), plus `configuration.mdx`, `project-configuration.mdx`, `index.mdx` (the landing), `getting-started.mdx`, `faq.mdx`, and `guides/` (12) |
| [`docs/README.md`](../docs/README.md) | someone working on the docs app | how the docs app is run or built |
| [`docs/worker/README.md`](../docs/worker/README.md) | someone working on the chat proxy | the Worker's routes, secrets or deploy |
| [`docs/evals/README.md`](../docs/evals/README.md) | someone changing the Dox chat's docs, retrieval or prompt, or adding an eval case | how the offline evals run, how `baseline.json` is rewritten, how a case is added, and how to run the live evals, what they cost and which changes need a live run |
Expand Down
8 changes: 4 additions & 4 deletions context/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ pnpm docs:audit-dist
```

Runs after `pnpm docs:build` (Build above), because it reads `docs/dist/`; with no build it exits 1 saying it
cannot audit the directory (ENOENT). It asserts the SEO requirements of #235 over the built site: on each of the 29 pages a
cannot audit the directory (ENOENT). It asserts the SEO requirements of #235 over the built site: on each of the 30 pages a
unique meta description of at most 155 characters, one canonical link in the form
`https://northguild.dev/worktree/<path>/`, Open Graph and Twitter tags, JSON-LD of the right types, and a "Last updated" date equal to `git log --follow -1` for the page's source file (as a UTC
date) — except the landing, which has no footer and so must carry no date; no page may carry an "Edit page" link into
GitHub's editor (removed 2026-11-04; gmt's docs have none); no page
may carry the project line the footer once had (licence, CLI version, maintainers); no page may show the northguild
organisation's GitHub avatar (`github.com/northguild.png`), the second logo the footer once had, and no id may appear
twice on a page; across the site, a sitemap and an `llms.txt` (llmstxt.org format) each listing exactly those 29
twice on a page; across the site, a sitemap and an `llms.txt` (llmstxt.org format) each listing exactly those 30
URLs, a `404.html` (with the site's search, a link to Getting Started at `/worktree/getting-started/`, and no canonical link or JSON-LD), a landing at the root (a heading, a "Get started" link to `/worktree/getting-started/`, one "Ask Dox" link to `/worktree/dox/` and no "Ask Dox" button, no second action and no section below the hero; the root alone may carry the site default description), and no `shuding/nextra` string. The date rule is only meaningful on
full git history (CI uses `fetch-depth: 0`): on a shallow clone Starlight and the oracle both read the same truncated log. A page whose source file has no commit yet (a new or just-renamed one) fails the date rule with "no git history", so run the audit after committing it. It prints every failed rule, one line each, and
exits 1 on any. To run it by hand: `pnpm docs:build && pnpm docs:audit-dist`, or point it at another build with
`node docs/scripts/audit-dist.mjs <dir>`. It also checks accessible names on every page and the 404 (each button named, a name beside visible text containing it, each `<select>` labelled, the search button) and that the built CSS gives `[role=tab]` a minimum height of at least 44px; the search *input* is made in the browser and is checked there. Every file under `dist/_astro/` must carry a hash of five or more characters in its name (`name.hash.ext`), because `docs/deploy/_headers` serves that folder `immutable` for a year; the failure names the file.
#287 Phase 3 (2026-11-08) added: in `llms.txt` the changelog alone sits under `## Optional` and the other 28 pages under `## Documentation`; on each of the 29 pages exactly one `<link rel="describedby" type="text/plain" href="https://northguild.dev/worktree/llms.txt">` whose target is a file in the build, and none on `404.html`.
#287 Phase 3 (2026-11-08) added: in `llms.txt` the changelog alone sits under `## Optional` and the other 29 pages under `## Documentation`; on each of the 30 pages exactly one `<link rel="describedby" type="text/plain" href="https://northguild.dev/worktree/llms.txt">` whose target is a file in the build, and none on `404.html`.
#287 Phase 4 (2026-11-08) added: every built `index.html` and `404.html` must be at most 1,048,576 bytes on disk (Apple TN3156 limits a link preview's main resource to "1 MB", read as 1 MiB); the failure names the page and its size in bytes.
Phase 13 added: on every page and the 404, the header's two NorthGuild links (`https://northguild.dev/` reading "NorthGuild", `/worktree/` reading
"worktree"), each named by its own visible text, and the GitHub and Discord links (new tab, `rel=noopener`, "(opens in a new tab)" in the name); every `<svg>`
Expand All @@ -137,7 +137,7 @@ Rewritten for #352 (the settings gear replaces the theme toggle; the audit's hea
Reading and keyboard order in the built `<header>`: the Dox link, then GitHub, then Discord, then the gear (Dox < GitHub < Discord < gear). No page, the 404 included, names the sound engine's chunk (`engine.*`) up front, whether by a script, a modulepreload or a static import; `cue.ts`'s dynamic `import()` is the only way to it. `theme-contrast.mjs` measures the gear's icon beside the GitHub and Discord icons (the same chip), the settings panel's pairs (the switch's track edge and leaf edge in the state each theme shows, the switches' focus ring, the mute speaker, the reached stem and the unreached rail, each against the panel) and the Dox link's icon and current-page bar.
Added 2026-11-06 for #266 and amended by #352 (D16), the landing header's entrance: in the built `<header>`, the entrance marker (`data-landing-entrance`) is on the landing's alone (not any other page's, nor the 404's), and the landing's header holds the internal-arrival script inline (no `src`, reading `document.referrer` and setting `data-entrance-off`); in the built CSS (stylesheets and `<style>`) the `header-entrance-*` keyframes exist, and they and every rule that names one in an `animation` sit under `@media (prefers-reduced-motion: no-preference)` alone; and no rule outside a keyframe gives a header item `opacity: 0`, and no header element carries `style="opacity: 0"`. Every rule that animates an entrance keyframe is scoped to `[data-landing-entrance]` and gated by `:not([data-entrance-off])`; none uses a `forwards` or `both` fill; the keyframes animate only `opacity`, `transform` and `color`; and the fade never targets the wordmark (`.wordmark`), the whole title (`.title-wrapper`) or a `header-chip` as such, and on search only the open button (`site-search > button[data-open-modal]`), not the dialog's buttons. The chips (D16): the Dox link (`a.dox-link`) fades and takes the colour pass; GitHub, Discord and the gear take the colour pass and the gear has no fade (GitHub and Discord are northguild.dev's, there from the first paint); every colour pass starts from `--gmt-ice-dim` (the `header-entrance-ink` keyframe's first frame); and the passes' delays rise Dox < GitHub < Discord < gear. `theme-contrast.mjs` measures the pass's start colour, `--gmt-ice-dim`, on the header glass (3:1).
Added 2026-11-08 for #287: the sitemap's `<lastmod>` on each page but the landing equals the datetime of that page's built footer `<time>` and is a W3C Datetime, and the landing's entry has none (a missing, an extra or a differing `lastmod` fails).
Added 2026-11-08 for #309 (phases 1 and 4), the Dox page and the links to it. `/dox/` is not one of the 29 pages and gets rules of its own: `dox/index.html` is built; it is `noindex`; it is in neither the sitemap nor `llms.txt`; it has the inline script that sets `data-dox-shell`, exactly one `astro-island`, the `<title>` `Dox · @northguild/worktree`, the site header, named controls and hidden or named graphics, no footer, and no id twice; and no other page or the 404 loads Dox code (the island's chunk, however referenced, or the stylesheet that carries the hive: "Dox code on `/dox/` alone"). The chat is a page and its entry points are plain links, so the launcher, the bubble and the shortcut have no rules: on every page and the 404 the `<header>` has one link to `/worktree/dox/` named "Chat with Dox", before GitHub, Discord and the gear (first in the right group), carrying `aria-current="page"` on `/dox/` and on no other page; every page with a sidebar (the 29 but the landing) has a mobile menu (`mobile-preferences`, matched as a class token), and the menu has the same link, named alike, before the social icons; and the landing has one "Ask Dox" link to `/worktree/dox/` and no "Ask Dox" button. `theme-contrast.mjs` measures its icon like the gear's, on the header glass and (the mobile menu's copy) on the page background the phone menu sits on, and the current-page bar and the landing's "Ask Dox" text and border.
Added 2026-11-08 for #309 (phases 1 and 4), the Dox page and the links to it. `/dox/` is not one of the 30 pages and gets rules of its own: `dox/index.html` is built; it is `noindex`; it is in neither the sitemap nor `llms.txt`; it has the inline script that sets `data-dox-shell`, exactly one `astro-island`, the `<title>` `Dox · @northguild/worktree`, the site header, named controls and hidden or named graphics, no footer, and no id twice; and no other page or the 404 loads Dox code (the island's chunk, however referenced, or the stylesheet that carries the hive: "Dox code on `/dox/` alone"). The chat is a page and its entry points are plain links, so the launcher, the bubble and the shortcut have no rules: on every page and the 404 the `<header>` has one link to `/worktree/dox/` named "Chat with Dox", before GitHub, Discord and the gear (first in the right group), carrying `aria-current="page"` on `/dox/` and on no other page; every page with a sidebar (the 30 but the landing) has a mobile menu (`mobile-preferences`, matched as a class token), and the menu has the same link, named alike, before the social icons; and the landing has one "Ask Dox" link to `/worktree/dox/` and no "Ask Dox" button. `theme-contrast.mjs` measures its icon like the gear's, on the header glass and (the mobile menu's copy) on the page background the phone menu sits on, and the current-page bar and the landing's "Ask Dox" text and border.
Added 2026-11-04 for #235 and run from the repo root of a worktree that day, exiting 0. CI runs `pnpm docs:build` then
`pnpm docs:audit-dist` after `pnpm build`, and `docs-deploy.yml` runs the same pair before it deploys anything.

Expand Down
Loading