@marcomigozzi/trailhead 0.13.0 → 0.15.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.
- package/README.it.md +142 -29
- package/README.md +141 -28
- package/bin/base-preflight-docs.test.js +65 -0
- package/bin/execute-split-docs.test.js +146 -0
- package/bin/isolation-answer-docs.test.js +41 -0
- package/bin/isolation-copy-docs.test.js +28 -0
- package/bin/lib/codex-projection.js +17 -10
- package/bin/lib/codex-projection.test.js +80 -11
- package/bin/lib/install-verify.js +10 -5
- package/bin/lib/install-verify.test.js +51 -0
- package/bin/report-status-docs.test.js +195 -0
- package/bin/resolve-helpers-docs.test.js +36 -0
- package/bin/scope-confirm-skip-docs.test.js +70 -0
- package/bin/trailhead.js +40 -28
- package/bin/trailhead.test.js +503 -6
- package/bin/uat-setup-docs.test.js +65 -0
- package/package.json +4 -1
- package/plugins/trailhead/.claude-plugin/plugin.json +3 -2
- package/plugins/trailhead/agents/trailhead-code-review.md +15 -2
- package/plugins/trailhead/agents/trailhead-codebase-map.md +20 -1
- package/plugins/trailhead/agents/trailhead-debug.md +20 -1
- package/plugins/trailhead/agents/trailhead-executor.md +29 -2
- package/plugins/trailhead/agents/trailhead-fix.md +29 -2
- package/plugins/trailhead/agents/trailhead-plan.md +20 -1
- package/plugins/trailhead/agents/trailhead-research.md +22 -3
- package/plugins/trailhead/agents/trailhead-verify.md +15 -2
- package/plugins/trailhead/commands/panel.md +10 -0
- package/plugins/trailhead/hooks/hooks.json +3 -18
- package/plugins/trailhead/hooks/lib/base-preflight.test.js +513 -0
- package/plugins/trailhead/hooks/lib/body-sources.js +795 -0
- package/plugins/trailhead/hooks/lib/commit-message-check.js +1 -1
- package/plugins/trailhead/hooks/lib/commit-message-check.test.js +3 -2
- package/plugins/trailhead/hooks/lib/commit-msg-module-repo.test.js +116 -0
- package/plugins/trailhead/hooks/lib/commit-msg-sync.test.js +100 -9
- package/plugins/trailhead/hooks/lib/dashboard.test.js +409 -0
- package/plugins/trailhead/hooks/lib/fixtures/commit-msg-legacy-js +104 -0
- package/plugins/trailhead/hooks/lib/gh-subcommand.js +92 -10
- package/plugins/trailhead/hooks/lib/gh-subcommand.test.js +55 -0
- package/plugins/trailhead/hooks/lib/isolation-answer.test.js +258 -0
- package/plugins/trailhead/hooks/lib/isolation-copy.test.js +298 -0
- package/plugins/trailhead/hooks/lib/issue-body.test.js +470 -0
- package/plugins/trailhead/hooks/lib/mockup-link.js +21 -5
- package/plugins/trailhead/hooks/lib/report-status.test.js +366 -0
- package/plugins/trailhead/hooks/lib/shell-scan.js +532 -65
- package/plugins/trailhead/hooks/lib/shell-scan.test.js +434 -0
- package/plugins/trailhead/hooks/lib/uat-backfill.test.js +150 -0
- package/plugins/trailhead/hooks/lib/uat-setup.test.js +340 -0
- package/plugins/trailhead/hooks/lib/unmodelled.js +345 -0
- package/plugins/trailhead/hooks/lib/unmodelled.test.js +173 -0
- package/plugins/trailhead/hooks/lib/work-state.test.js +297 -0
- package/plugins/trailhead/hooks/mod/README.md +219 -0
- package/plugins/trailhead/hooks/mod/map-pane-view.ts +606 -0
- package/plugins/trailhead/hooks/mod/map-pane.tsx +832 -0
- package/plugins/trailhead/hooks/mod/register.tsx +293 -0
- package/plugins/trailhead/hooks/mod/work-state-prompt.ts +69 -0
- package/plugins/trailhead/hooks/mod/work-state-view.ts +110 -0
- package/plugins/trailhead/hooks/trailhead-bash-guards.js +140 -0
- package/plugins/trailhead/hooks/trailhead-bash-guards.test.js +233 -0
- package/plugins/trailhead/hooks/trailhead-body-guard.js +145 -61
- package/plugins/trailhead/hooks/trailhead-body-guard.test.js +224 -3
- package/plugins/trailhead/hooks/trailhead-commit-guard.js +41 -14
- package/plugins/trailhead/hooks/trailhead-commit-guard.test.js +2 -1
- package/plugins/trailhead/hooks/trailhead-install-guard.js +187 -42
- package/plugins/trailhead/hooks/trailhead-install-guard.test.js +182 -2
- package/plugins/trailhead/hooks/trailhead-mockup-link-guard.js +48 -11
- package/plugins/trailhead/hooks/trailhead-mockup-link-guard.test.js +75 -3
- package/plugins/trailhead/hooks/trailhead-search-guard.js +59 -13
- package/plugins/trailhead/hooks/trailhead-search-guard.test.js +68 -3
- package/plugins/trailhead/hooks/trailhead-secret-guard.js +541 -57
- package/plugins/trailhead/hooks/trailhead-secret-guard.test.js +1000 -4
- package/plugins/trailhead/hooks/trailhead-secret-read-guard.js +171 -6
- package/plugins/trailhead/hooks/trailhead-secret-read-guard.test.js +170 -0
- package/plugins/trailhead/skills/_shared/choices.md +7 -3
- package/plugins/trailhead/skills/_shared/configuration-reference.md +15 -3
- package/plugins/trailhead/skills/_shared/load-first.md +3 -3
- package/plugins/trailhead/skills/_shared/multi-map.md +3 -3
- package/plugins/trailhead/skills/_shared/session-handoff.md +1 -1
- package/plugins/trailhead/skills/_shared/substrate-commands.md +22 -11
- package/plugins/trailhead/skills/_shared/substrate.md +6 -4
- package/plugins/trailhead/skills/_shared/teamwork.md +17 -6
- package/plugins/trailhead/skills/_shared/techniques/acceptance-testing.md +17 -9
- package/plugins/trailhead/skills/_shared/techniques/code-review.md +1 -1
- package/plugins/trailhead/skills/_shared/techniques/codebase-map.md +1 -1
- package/plugins/trailhead/skills/_shared/techniques/debug.md +2 -0
- package/plugins/trailhead/skills/_shared/techniques/prototype.md +1 -1
- package/plugins/trailhead/skills/_shared/techniques/research.md +4 -2
- package/plugins/trailhead/skills/_shared/techniques/verify.md +1 -1
- package/plugins/trailhead/skills/_shared/techniques.md +12 -2
- package/plugins/trailhead/skills/trailhead/SKILL.md +3 -3
- package/plugins/trailhead/skills/trailhead-capture/SKILL.md +1 -1
- package/plugins/trailhead/skills/trailhead-capture/references/capture.md +2 -2
- package/plugins/trailhead/skills/trailhead-chart/SKILL.md +1 -1
- package/plugins/trailhead/skills/trailhead-chart/references/charting.md +1 -1
- package/plugins/trailhead/skills/trailhead-manage/SKILL.md +1 -1
- package/plugins/trailhead/skills/trailhead-manage/references/auditing.md +1 -1
- package/plugins/trailhead/skills/trailhead-view/SKILL.md +8 -6
- package/plugins/trailhead/skills/trailhead-work/SKILL.md +16 -13
- package/plugins/trailhead/skills/trailhead-work/references/auto.md +6 -4
- package/plugins/trailhead/skills/trailhead-work/references/executor-brief.md +29 -0
- package/plugins/trailhead/skills/trailhead-work/references/ticket-engines.md +28 -10
- package/plugins/trailhead/templates/trailhead-base-preflight.js +305 -0
- package/plugins/trailhead/templates/trailhead-commit-msg +38 -102
- package/plugins/trailhead/templates/trailhead-commit-msg-sync.js +58 -27
- package/plugins/trailhead/templates/trailhead-commit-msg.cjs +114 -0
- package/plugins/trailhead/templates/trailhead-dashboard.js +340 -0
- package/plugins/trailhead/templates/trailhead-isolation-answer.js +227 -0
- package/plugins/trailhead/templates/trailhead-isolation-copy.js +239 -0
- package/plugins/trailhead/templates/trailhead-issue-body.js +459 -0
- package/plugins/trailhead/templates/trailhead-report-status.js +274 -0
- package/plugins/trailhead/templates/trailhead-uat-backfill.js +114 -0
- package/plugins/trailhead/templates/trailhead-uat-setup.js +385 -0
- package/plugins/trailhead/templates/trailhead-work-state.js +217 -0
- package/plugins/trailhead/tests/map-pane-ui.test.ts +1921 -0
- package/plugins/trailhead/tests/map-pane-view.test.ts +853 -0
- package/plugins/trailhead/tests/mod.test.ts +14 -0
- package/plugins/trailhead/tests/work-state-prompt-hook.test.ts +207 -0
- package/plugins/trailhead/tests/work-state-prompt.test.ts +109 -0
- package/plugins/trailhead/tests/work-state-ui.test.ts +365 -0
- package/plugins/trailhead/tests/work-state-view.test.ts +110 -0
- package/plugins/trailhead/types/index.d.ts +103 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
🇬🇧 **English** · 🇮🇹 [Italiano](README.it.md)
|
|
8
8
|
|
|
9
|
-
[](https://trailhead.marcomigozzi.it) [](https://github.com/ToRvaLDz/trailhead/actions/workflows/site-ci.yml) [](https://www.npmjs.com/package/@marcomigozzi/trailhead) [](LICENSE)  ](https://trailhead.marcomigozzi.it) [](https://github.com/ToRvaLDz/trailhead/actions/workflows/site-ci.yml) [](https://www.npmjs.com/package/@marcomigozzi/trailhead) [](LICENSE)   
|
|
10
10
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ Two approaches to agent-driven project work each nail one half of the problem:
|
|
|
26
26
|
|
|
27
27
|
Working across both, one pattern kept recurring: **use a Wayfinder-style map and onboarding to decide the shape of the work, then a GSD-style engine to build each piece, without ever leaving the issue tracker.** `trailhead` is that pattern made into a set of cohesion-clustered skills over a shared core, its own self-contained take on both ideas rather than a wrapper around either.
|
|
28
28
|
|
|
29
|
-
> **trailhead is self-contained** in the sense that it has **zero external-plugin dependencies**: trailhead-owned agents and the host's built-ins are fine, and no other skill or plugin is required. Wayfinder and GSD are *inspiration*, not dependencies. Every technique those systems package as a separate skill (grilling, TDD, systematic debugging, codebase mapping, code review) is **built in here as an inline protocol**. trailhead's core invokes no other skill; each engine technique dispatches to **trailhead's own `trailhead-*` agent** (`trailhead-executor`, `trailhead-plan`, `trailhead-research`, `trailhead-code-review`, `trailhead-debug`, plus `trailhead-fix` and `trailhead-codebase-map`), authored once as a committed `agents/trailhead-*.md` file and **projected to each host** (Codex gets `~/.codex/agents/trailhead-*.toml` generated from that same source). These agents are **thin** (identity + tool policy + a config-driven model, with the technique protocol injected at spawn) and run on the host's native subagent toolkit (Claude Code's built-in `Agent` tool, or Codex's `multi_agent` toolkit). The only thing to install is trailhead itself. There is one opt-in exception: hosted
|
|
29
|
+
> **trailhead is self-contained** in the sense that it has **zero external-plugin dependencies**: trailhead-owned agents and the host's built-ins are fine, and no other skill or plugin is required. Wayfinder and GSD are *inspiration*, not dependencies. Every technique those systems package as a separate skill (grilling, TDD, systematic debugging, codebase mapping, code review) is **built in here as an inline protocol**. trailhead's core invokes no other skill; each engine technique dispatches to **trailhead's own `trailhead-*` agent** (`trailhead-executor`, `trailhead-plan`, `trailhead-research`, `trailhead-code-review`, `trailhead-debug`, plus `trailhead-fix` and `trailhead-codebase-map`), authored once as a committed `agents/trailhead-*.md` file and **projected to each host** (Codex gets `~/.codex/agents/trailhead-*.toml` generated from that same source). These agents are **thin** (identity + tool policy + a config-driven model, with the technique protocol injected at spawn) and run on the host's native subagent toolkit (Claude Code's built-in `Agent` tool, or Codex's `multi_agent` toolkit). The only thing to install is trailhead itself. There is one opt-in exception: hosted mockups. `design: artifacts` uses Claude Code's built-in `Artifact` tool (nothing to install), and `design: stitch` uses the Google Stitch MCP (offered as a one-time install). See [Mockups before code](#-mockups-before-code).
|
|
30
30
|
|
|
31
31
|
The design choices that fall out of it:
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ The design choices that fall out of it:
|
|
|
36
36
|
|
|
37
37
|
- **Built for teams, because the plan is shared.** The tracker is the single source of truth, so the map is a **shared workspace**, not one person's local file. Many people (and their agents) work it at once, and the mechanics keep them from colliding:
|
|
38
38
|
- **Claiming.** You take a ticket by assigning it to yourself; the assignee *is* the lock. A collision stops you and asks, rather than clobbering someone else's work. Whoever claims a ticket owns it end to end and closes it, no separate approver.
|
|
39
|
-
- **A shared frontier, one ticket per session.** The **frontier** (open, unassigned, unblocked tickets) is the common queue of what's takeable now; each person picks a different one. Resolving a ticket ends the session, so work stays in reviewable, single-ticket chunks.
|
|
39
|
+
- **A shared frontier, one ticket per session.** The **frontier** (open, unassigned, unblocked, not paused tickets) is the common queue of what's takeable now; each person picks a different one. Resolving a ticket ends the session, so work stays in reviewable, single-ticket chunks.
|
|
40
40
|
- **Isolation for concurrent sessions on one machine.** Two agents editing one checkout corrupt each other, so the `isolation:` convention (default **`auto`**, which asks at each ticket's work-start whether you'll work more than one at once and then picks the right mode by repo shape) gives each in-flight ticket its own **`git worktree`** (or a full **`clone`** for path-bound apps, or repos with submodules, a worktree can't safely isolate) when you run more than one at once; disjoint `Scope:` lines let non-overlapping work run in parallel and serialise only where it truly overlaps.
|
|
41
41
|
- **Pause, resume, split.** Any ticket can be **paused** with a checkpoint comment and **resumed** later by anyone (once released), or **split** into children when it outgrows a session, with blockers re-pointed so the frontier stays honest.
|
|
42
42
|
- **Several maps at once.** A repo can carry **more than one live map** (parallel milestones or features), each with its own scoped frontier, so two people can drive two efforts on the same repo without stepping on each other, and you can park one map to work another.
|
|
@@ -68,14 +68,14 @@ npx @marcomigozzi/trailhead --symlink # dev install (Claude; symlink to the c
|
|
|
68
68
|
npx @marcomigozzi/trailhead --uninstall # remove everything it added (pair with --claude / --codex)
|
|
69
69
|
npx @marcomigozzi/trailhead --dir=<path> # target a specific config dir
|
|
70
70
|
```
|
|
71
|
-
On **Claude Code** it copies the skill (+ its `references/`), the `/trailhead:*` commands, the hooks (into `hooks/`, registered in `settings.json`) including a SessionStart **update check**, and the label-guard
|
|
71
|
+
On **Claude Code** it copies the skill (+ its `references/`), the `/trailhead:*` commands, the hooks (into `hooks/`, registered in `settings.json`) including a SessionStart **update check**, and the templates (label-guard workflow, statusline, the git `commit-msg` hook and the helper scripts the engine runs), idempotently.
|
|
72
72
|
|
|
73
|
-
On **Codex CLI** (`--codex`) it projects a native Codex skill invoked as **`$trailhead`** (`$trailhead work`, `$trailhead new "idea"`, …), one thin **`$trailhead-<verb>`** skill per verb for discoverability, the
|
|
73
|
+
On **Codex CLI** (`--codex`) it projects a native Codex skill invoked as **`$trailhead`** (`$trailhead work`, `$trailhead new "idea"`, …), one thin **`$trailhead-<verb>`** skill per verb for discoverability, the seven guardrails as native Codex **hooks** (`~/.codex/hooks.json`, enabling `features.hooks`; the four Bash guards share one process behind a single registration; the search guard is Claude-Code-only and isn't projected to Codex), and per-technique subagent model pins from **`models.codex.*`** into `~/.codex/agents/`. Codex **0.145.0+** is required (the installer gates on `codex --version`). The `artifacts` mockup mode (Claude Code's `Artifact` tool) isn't available on Codex; the cross-host `design: stitch` mode (Google Stitch MCP) is the hosted option there, with local disk as the fallback.
|
|
74
74
|
|
|
75
75
|
Re-run the install to update, or run **`/trailhead:update`** (Claude) / **`$trailhead update`** (Codex) from inside the agent: it detects how trailhead was installed and installs the newer version where that is safe (a `git pull` for a dev-symlink, an `npx` re-run for npm, or `/plugin update` for the plugin). When a newer version exists, the statusline shows a `⬆ trailhead <version>` flag (Claude).
|
|
76
76
|
|
|
77
77
|
### After installing
|
|
78
|
-
Restart or reload your agent so the commands register, then run **`/trailhead`** to start (smart entry), or `/trailhead:new "<idea>"` to chart a map. **On Codex** the surface is `$trailhead` instead: run **`$trailhead`** for smart entry, `$trailhead new "<idea>"` to chart, or a per-verb `$trailhead-<verb>` skill. Note: once installed, the **commit guard hook runs on every `git commit`** (enforcing Conventional Commits and blocking `Co-Authored-By`); disable the plugin's hooks in settings if you don't want that. Either way trailhead is self-contained: no external skill or plugin is required, no preflight, no version drift.
|
|
78
|
+
Restart or reload your agent so the commands register, then run **`/trailhead`** to start (smart entry), or `/trailhead:new "<idea>"` to chart a map. **On Codex** the surface is `$trailhead` instead: run **`$trailhead`** for smart entry, `$trailhead new "<idea>"` to chart, or a per-verb `$trailhead-<verb>` skill. Note: once installed, the **commit guard hook runs on every `git commit`** (enforcing Conventional Commits and blocking `Co-Authored-By`); disable the plugin's hooks in settings if you don't want that. Either way trailhead is self-contained: no external skill or plugin is required, no external-plugin preflight, no version drift.
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
@@ -87,7 +87,7 @@ A **map** is one GitHub issue labelled `trailhead:map`. It's an index, not a sto
|
|
|
87
87
|
|
|
88
88
|
What does **not** need its own map is a single, defined piece of work with no open questions, small enough to finish in one session. That is just **one ticket**, a direct `build` (or a `todo`): a *work* you take with `/trailhead:work` and resolve in a sitting, no charting required. **Rule of thumb: decisions to make, or too big for one sitting → a map; "just do X" → a single work.** A feature that starts as a lone work but turns out to need decisions gets promoted to its own map (or split); a map whose questions all evaporate collapses back to a handful of works. And a repo can hold **several maps at once** (parallel milestones or features), each with its own frontier, so you can park one and work another.
|
|
89
89
|
|
|
90
|
-
Each **ticket** is a child issue with a type label and a one-question body. The **frontier** is the set of open, unassigned tickets whose blockers are all closed: what's takeable right now. You claim a ticket by assigning it to yourself, resolve it with the engine for its type, then record the answer as a comment, close it, and gist it back onto the map.
|
|
90
|
+
Each **ticket** is a child issue with a type label and a one-question body. The **frontier** is the set of open, unassigned tickets whose blockers are all closed and that are not paused: what's takeable right now. You claim a ticket by assigning it to yourself, resolve it with the engine for its type, then record the answer as a comment, close it, and gist it back onto the map.
|
|
91
91
|
|
|
92
92
|
As tickets resolve, the fog clears: questions that were too vague to phrase become sharp enough to ticket, one at a time, until nothing is left to decide or build and the destination is reached.
|
|
93
93
|
|
|
@@ -106,7 +106,7 @@ These three fill GitHub's **3 pinned-issue slots**, so a repo's trailhead anchor
|
|
|
106
106
|
**The lifecycle.** Every project walks the same loop:
|
|
107
107
|
|
|
108
108
|
1. **Start**: `/trailhead:new "<idea>"` (greenfield) or `/trailhead:adopt` (existing code: map the codebase once, then go lean). This *charts the map*: name the destination, then map the frontier breadth-first into the first tickets and the fog.
|
|
109
|
-
2. **Work the frontier, one ticket per session**: `/trailhead:work` takes the next takeable ticket (or one you name) and runs the engine for its type: `research` gathers a fact · `decision` diverges options then grills to choose · `prototype` makes a rough artifact to react to · `build` runs discuss → plan → execute → verify · `bug` runs repro → diagnose → fix → verify · `task` is manual plumbing that unblocks a decision. `/trailhead:auto` chains the frontier unattended, one ticket after another, stopping only at the safety rail, fog, or a human-necessary decision.
|
|
109
|
+
2. **Work the frontier, one ticket per session**: `/trailhead:work` takes the next takeable ticket (or one you name) and runs the engine for its type: `research` gathers a fact · `decision` diverges options then grills to choose · `prototype` makes a rough artifact to react to · `build` runs discuss → plan → execute → verify · `bug` runs repro → diagnose → fix → verify · `task` is manual plumbing that unblocks a decision. `/trailhead:auto` chains the frontier unattended, one ticket after another, stopping only at the safety rail, fog, or a human-necessary decision. At a ticket's start, `work` and `quick` show a short brief with a **Proceed / Change something** choice; it is skipped (a one-line note instead) for a ticket you created or just settled in a grilling this session, and `auto` never asks.
|
|
110
110
|
3. **Close & unblock**: resolve the ticket (comment + close), gist it into `Decisions so far`, and drop `trailhead:blocked` from any dependent whose last blocker just closed, graduating it onto the frontier.
|
|
111
111
|
4. **Repeat** until the frontier is empty and the fog has cleared: the destination (a working artifact) is reached.
|
|
112
112
|
|
|
@@ -185,6 +185,27 @@ Every verb is also a namespaced command (`/trailhead:new`, `/trailhead:work`, `/
|
|
|
185
185
|
| `/trailhead:grill [topic]` | run a standalone grilling session on a decision/topic |
|
|
186
186
|
| `/trailhead:map` | show the low-res map (destination, decisions, frontier, fog) |
|
|
187
187
|
| `/trailhead:dashboard` | show the repo dashboard: the pinned index of every open map, the whiteboard, and live counts |
|
|
188
|
+
| `/trailhead:panel` | open or close the live map panel: the active map's open tickets by state, with a `work` button per frontier ticket (**Claude Code only**: needs the trailhead mod, 2.1.287+) |
|
|
189
|
+
|
|
190
|
+
### 🖥️ On screen in Claude Code
|
|
191
|
+
|
|
192
|
+
The trailhead mod (Claude Code 2.1.287+) ships inside the plugin and draws the work beside the conversation. Codex keeps the command hooks and has no panel.
|
|
193
|
+
|
|
194
|
+

|
|
195
|
+
|
|
196
|
+
The map panel lists the open maps to view, the frontier with a `work` button per ticket that clears the context and starts the ticket, who holds what (your own ticket is marked `this session`), the pending UAT follow-ups in a `UAT` group (each naming the ticket it tests), the paused ones in a `Paused` group, and what is blocked. The footer has `refresh` and `close`. `/trailhead:panel` toggles it, and it opens by itself once in fullscreen.
|
|
197
|
+
|
|
198
|
+

|
|
199
|
+
|
|
200
|
+
A click only views a map, and `back to active` returns to the active one. The active map changes when you work one of its tickets. A `Whiteboard` row above the maps list, with its `N open / M` counts, shows the repo index instead: every open map (a click opens it) and the whiteboard's loose tickets by state, each frontier one with its `work` button; `map` goes back.
|
|
201
|
+
|
|
202
|
+

|
|
203
|
+
|
|
204
|
+
The burn-down shows the open tickets over time, from the map's first ticket to now, with done and removed counted apart.
|
|
205
|
+
|
|
206
|
+

|
|
207
|
+
|
|
208
|
+
The pipeline band above the prompt and the status entry under it show the ticket in play and its step.
|
|
188
209
|
|
|
189
210
|
### Capture: zero friction, one confirmation line, resolves nothing
|
|
190
211
|
|
|
@@ -194,7 +215,7 @@ Every verb is also a namespaced command (`/trailhead:new`, `/trailhead:work`, `/
|
|
|
194
215
|
| `/trailhead:seed <text>` | a blocked ticket (trigger noted) | *I'll do it when X happens* |
|
|
195
216
|
| `/trailhead:idea <text>` | the fog (`Not yet specified`) | *maybe I'll do it*: graduates to a ticket if it sharpens |
|
|
196
217
|
| `/trailhead:note <text>` | verbatim text | *remember this*: not necessarily work |
|
|
197
|
-
| `/trailhead:bug [--of <ticket>] <text>` | a `bug` ticket | a defect; `--of` records it as a `Regression of:` a closed ticket |
|
|
218
|
+
| `/trailhead:bug [--of <ticket>] <text>` | a `bug` ticket | a defect; `--of` records it as a `Regression of:` a closed ticket and files it on that ticket's map (or the whiteboard) without asking |
|
|
198
219
|
|
|
199
220
|
The four fog/ticket captures form a spectrum of commitment and timing: **note < idea < seed < todo**.
|
|
200
221
|
|
|
@@ -217,6 +238,15 @@ The three that trip people up are **idea, seed, todo**, so here they are spelled
|
|
|
217
238
|
|
|
218
239
|
The two cuts that matter: **idea vs seed** is waiting on *clarity* vs waiting on a *condition* (both land "later", for different reasons); **seed vs todo** is committed *later* vs committed *now*. Below all three sits **`note`** (raw text to remember, maybe never work), and off to the side is **`bug`** (a defect, not a commitment tier). The test for idea vs ticket is always: **can you phrase the question precisely now?** Yes → a ticket (`todo` if takeable, `seed` if gated); no → the fog (`idea`).
|
|
219
240
|
|
|
241
|
+
### Manage: keep the install and the maps healthy
|
|
242
|
+
|
|
243
|
+
| Command | What it does |
|
|
244
|
+
|---|---|
|
|
245
|
+
| `/trailhead:config [get\|set …]` | guided menu setup; `get` prints the effective config, `set <key> <value>` writes one key (see Configuration below) |
|
|
246
|
+
| `/trailhead:update` | check for a newer trailhead and install it where that is safe |
|
|
247
|
+
| `/trailhead:prune [map]` | reclaim a map's sub-issue slots under GitHub's 100-cap (drops closed/orphan edges, keeps references) |
|
|
248
|
+
| `/trailhead:audit [map] [--all]` | audit closed tickets for regressions against today's code, plus duplicate and groupable open ones; read-only until you confirm |
|
|
249
|
+
|
|
220
250
|
---
|
|
221
251
|
|
|
222
252
|
## 🎫 Ticket types and their engines
|
|
@@ -230,7 +260,7 @@ Each type has its own inline engine: no external skill is invoked.
|
|
|
230
260
|
| 🧭 `decision` | a choice | HITL | diverge the options if unclear, then grill to converge on one |
|
|
231
261
|
| 🔬 `research` | a fact | AFK | a subagent on a throwaway branch (the only type run in parallel) |
|
|
232
262
|
| 🎨 `prototype` | an approved direction | HITL | a rough throwaway artifact to react to; UI screens go through this (disk, an Artifacts canvas, or Stitch) before UI code |
|
|
233
|
-
| 🔨 `build` | working code | HITL/AFK | `discuss → plan → execute → verify`: atomic commits, TDD at seams, **a mockup first for user-facing UI** (Prototype technique, gated by `design.approval`), code review + acceptance testing (asks who drives, AI or human, then browser-drive or conversational step-by-step UAT) |
|
|
263
|
+
| 🔨 `build` | working code | HITL/AFK | `discuss → plan → execute → verify`: atomic commits, TDD at seams, **[a mockup first](#-mockups-before-code) for user-facing UI** (Prototype technique, gated by `design.approval`), code review + [acceptance testing](#-acceptance-testing-uat) (asks who drives, AI or human, or skip to waive it, then browser-drive or conversational step-by-step UAT) |
|
|
234
264
|
| 🐛 `bug` | corrected code | HITL/AFK | `repro → diagnose → fix → verify`; a defect in closed work is a *new* ticket (`Regression of:`), not a reopen |
|
|
235
265
|
| 🔧 `task` | an external state change | HITL/AFK | manual work that unblocks a decision (provision access, move data, sign up) |
|
|
236
266
|
|
|
@@ -240,6 +270,80 @@ When trailhead puts a forced choice to you, an advisory one (not a decision that
|
|
|
240
270
|
|
|
241
271
|
---
|
|
242
272
|
|
|
273
|
+
## 🎨 Mockups before code
|
|
274
|
+
|
|
275
|
+
Every ticket that changes user-facing UI (a new screen, a redesign, a changed layout) is **mocked up before any UI code is written**. You react to the mockup, approve it, and the build reproduces it faithfully; acceptance testing later checks the result against it. Where the mockup lives is the `design` key:
|
|
276
|
+
|
|
277
|
+
| `design` | Where the mockup lives | Hosts |
|
|
278
|
+
|---|---|---|
|
|
279
|
+
| **`disk`** (default) | a throwaway static HTML file next to the code, linked from the ticket | any |
|
|
280
|
+
| `artifacts` | a **Design canvas Artifact** on claude.ai: edit it visually, comment on it, export it | Claude Code signed in with a claude.ai account |
|
|
281
|
+
| `stitch` | a **Google Stitch** project (or Stitch design system) | Claude Code and Codex |
|
|
282
|
+
|
|
283
|
+
A UI question that's still open gets **3 structurally different variants** (different layouts, not colours or copy) to pick from, not one take.
|
|
284
|
+
|
|
285
|
+
### What it looks like with `artifacts`
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
you › /trailhead:work # ⑤ build: "login screen"
|
|
289
|
+
trailhead › This ticket changes UI. Mock it up first? → yes
|
|
290
|
+
trailhead › No canvas for this map yet: pick one, paste a URL, or create one?
|
|
291
|
+
you › create one, "Acme app"
|
|
292
|
+
trailhead › Installed your design system "Acme DS" on the canvas.
|
|
293
|
+
Canvas: https://claude.ai/artifact/… · page "#42 Login"
|
|
294
|
+
Artboards: Login-A (split hero) · Login-B (centered card) · Login-C (stepper)
|
|
295
|
+
Which direction?
|
|
296
|
+
you › B, but with the social buttons above the form # or edit it on the canvas yourself
|
|
297
|
+
trailhead › Updated Login-B. Approve? → approve
|
|
298
|
+
trailhead › Re-read the approved artboard (your live edits included) → planning the build
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
- **One canvas per map**, cached in `design.project`; each ticket gets its own canvas page, each screen (and variant) its own artboard. App screens get a fixed frame (e.g. a 390×844 phone), web pages a fluid one.
|
|
302
|
+
- **Your design system on the canvas.** `design.system` (or your account's default) is installed, so the canvas editor offers its colours, type and components instead of look-alikes.
|
|
303
|
+
- **Approve with the link in front of you.** Every approval ask carries the canvas URL and the artboard names; the [mockup-link guard](#-hooks) blocks one that doesn't.
|
|
304
|
+
- **Edit freely.** Change the canvas directly or leave comments there; on approval trailhead **re-reads** the artboards and builds from *that* version, not from what it last published.
|
|
305
|
+
- **`design.approval`**: `explicit` (default) waits for your go-ahead before UI code; `auto` surfaces the mockup and proceeds.
|
|
306
|
+
|
|
307
|
+
### `stitch` and `disk`
|
|
308
|
+
|
|
309
|
+
`design: stitch` uses the **Google Stitch MCP**, Google's Gemini-powered UI generator, and is the hosted option that runs on **both Claude Code and Codex**. `design.surface` picks a Stitch project of screens (`canvas`, default) or a shared Stitch design system (`design-system`). If the MCP isn't connected, trailhead offers to install it once (decline and it falls back to disk):
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
claude mcp add --scope user --transport http stitch https://stitch.googleapis.com/mcp
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Where `artifacts` can't run (Codex, or an API-key session), trailhead offers to switch to `stitch` before falling back to disk, and says so: it never silently swaps a hosted mode for a local file.
|
|
316
|
+
|
|
317
|
+
**Moving from claude.ai/design.** The standalone Claude Design site closes on 2026-12-14 and its designs now live in Claude as Artifacts. A config that still says `design: claude.ai/design` keeps working as `artifacts` (trailhead tells you once and offers to rewrite the key), but a cached claude.ai/design project can't be reused: migrate your design systems from the Artifacts page banner and let trailhead attach a new canvas.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 🧪 Acceptance testing (UAT)
|
|
322
|
+
|
|
323
|
+
Passing tests prove the code does what the *code* intended; acceptance testing proves it does what *you* wanted. For anything you can see (a new screen, data that now appears, a changed flow), a green suite **does not close the ticket**: Verify runs a UAT too, after tests and code review.
|
|
324
|
+
|
|
325
|
+
Before it starts, trailhead **checks the base**: it measures how far your working branch is behind the trunk, syncs it (fast-forward, rebase or merge; a conflict aborts and restores), re-runs the tests and runs your `preflight.checks`, and the same check precedes integration; anything it cannot verify stops the ticket. Then it **prepares the environment**: the `uat.setup` steps (start the dev server, boot the emulator; a step whose `check` already passes is skipped) run before the ask below, a failed step stops with a clear reason, and `uat.accounts` names the test logins (only `$ENV` references are stored). With no setup configured it can probe the project and propose one to save. `/trailhead:auto` runs the configured setup only.
|
|
326
|
+
|
|
327
|
+
1. **It asks who drives.** Before any step runs: **AI-driven**, **human-driven** or **skip**. It waits for a clear answer (silence re-asks). If no step is something the agent can do this session (a device it can't reach, credentials it doesn't hold, a judgement of feel or sound), it drops the AI-driven option and asks **human-driven** or **skip**, telling you why in one line. **Skip is a waiver, not a deferral**: you forgo acceptance, the `VERIFY` comment records it as `waived by the user (unconfirmed)`, never as a pass, and no follow-up is opened. The agent never picks it for you, not even under `/trailhead:auto`.
|
|
328
|
+
2. **AI-driven: it drives the app itself.** For a web app it finds the target URL on its own (a running dev server, the `dev` script, the framework's configured port), proposes it for you to confirm, then navigates, fills, clicks and asserts what's on screen, with a **screenshot as evidence** in the ticket's `VERIFY` comment. **Beyond the browser, it drives whatever device the session can reach**: a phone or emulator over `adb`, an iOS simulator, a smart TV, a desktop app, through the commands and tools you have connected (a device MCP, computer use, the platform's CLI). Only the steps it truly can't do come back to you, one at a time.
|
|
329
|
+
3. **Human-driven, or what the agent can't reach: a guided walkthrough.** A device that isn't connected, an account it doesn't hold, a call on feel or sound: trailhead walks you through it **one step at a time in the chat** (what to do, where to tap, what you should see), waits for what you actually saw, then moves on. Never a checklist dumped on you to self-serve.
|
|
330
|
+
4. **Against the approved mockup.** When the ticket had one, the built screen is checked against it **element by element and state by state** (layout, spacing, colour, type, copy; empty, loading, error, disabled…), from the re-read mockup, never from memory. An unforced deviation is a finding, not "close enough".
|
|
331
|
+
5. **Failures become tickets on the spot.** A failed step records expected vs. seen and opens a `bug` follow-up (or a fix on this ticket) right away, then asks whether to carry on.
|
|
332
|
+
6. **Nothing slips through as "done".** If the UAT can't run now (the device isn't at hand, the backend isn't deployed), trailhead asks: run it now, or open a follow-up ticket, linked back with a `UAT of:` line and tagged with the `trailhead:uat` label so every pending UAT is findable by one label, that carries the full checklist. A user-facing ticket never closes on a UAT nobody ran unless you explicitly waive it, recorded as unconfirmed.
|
|
333
|
+
|
|
334
|
+
```text
|
|
335
|
+
trailhead › Tests and review are green. Who drives the UAT: AI or you? → AI
|
|
336
|
+
trailhead › Acceptance will run against http://localhost:5173, correct? → yes
|
|
337
|
+
trailhead › ✓ Sign in with GitHub → lands on /dashboard (screenshot)
|
|
338
|
+
✓ Login-B vs. the build: 14/14 elements, 4/4 states match
|
|
339
|
+
✓ Android app on the connected phone (adb): GitHub sign-in → home (screenshot)
|
|
340
|
+
? Step 6 is the haptic on "Signed in": does it buzz once, softly?
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Config: `acceptance.browser` (`auto` default, `on`, `off`) governs browser driving; `off` keeps AI-driven checks via commands and the suite, and still asks who drives. `testing.webapp` / `testing.url` say whether the app is browser-drivable and where. Under `/trailhead:auto`, it goes AI-driven; steps only you can do are never faked: the ticket is set aside and listed in the run's summary; `/trailhead:auto` never picks skip.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
243
347
|
## 🏷️ Labels
|
|
244
348
|
|
|
245
349
|
Everything the map needs is expressed as GitHub labels, so state is queryable in the tracker UI:
|
|
@@ -247,10 +351,11 @@ Everything the map needs is expressed as GitHub labels, so state is queryable in
|
|
|
247
351
|
- **Structural:** `trailhead:map`, `trailhead:ticket`
|
|
248
352
|
- **Repo-scoped anchors (one each per repo, pinned):** `trailhead:codebase` 🧱 (the distilled codebase map), `trailhead:conventions` 📜 (the way of working), `trailhead:dashboard` 📊 (the pinned index of maps + whiteboard + counts); each title carries its icon (like the map's 🗺) so the pinned anchors stand apart at a glance
|
|
249
353
|
- **Type (one per ticket):** 🧭 `trailhead:decision` · 🔬 `research` · 🎨 `prototype` · 🔨 `build` · 🐛 `bug` · 🔧 `task`
|
|
250
|
-
- **State:** `trailhead:blocked` (has an open blocker) · `seed` (parked on a trigger) · `out-of-scope` (closed, beyond the destination) · `superseded` (closed, split into children)
|
|
354
|
+
- **State:** `trailhead:blocked` (has an open blocker) · `seed` (parked on a trigger) · `out-of-scope` (closed, beyond the destination) · `superseded` (closed, split into children) · `paused` (checkpointed, off the frontier) · `unverified` (quarantined until a maintainer adopts it) · `fog` (kept open for clarification)
|
|
251
355
|
- **Container:** `trailhead:whiteboard` (a loose, map-less ticket, off every map's frontier, on the whiteboard's own)
|
|
356
|
+
- **Marker:** `trailhead:uat` (a pending UAT follow-up; never a frontier filter) · `trailhead:map-<n>` (scopes a ticket to its map)
|
|
252
357
|
|
|
253
|
-
The **frontier** is then a single query (open, unassigned, not `trailhead:blocked
|
|
358
|
+
The **frontier** is then a single query (open, unassigned, not `trailhead:blocked`, not paused), no body-parsing needed.
|
|
254
359
|
|
|
255
360
|
## 👥 Working as a team
|
|
256
361
|
|
|
@@ -258,10 +363,10 @@ Many people (and their agent sessions) share one map and work it concurrently:
|
|
|
258
363
|
|
|
259
364
|
- **Claim = assign to yourself.** The claimer owns the ticket end to end and closes it: there is no approver and no one to wait on. On a claim collision the session stops and asks you, rather than resolving it silently.
|
|
260
365
|
- **Split** an oversized ticket into children and supersede the original (`/trailhead:split`).
|
|
261
|
-
- **Pause/resume** via a `PAUSED` checkpoint comment, so any session can pick a ticket back up.
|
|
262
|
-
- **Isolate concurrent sessions with worktrees.** By default (`isolation: auto`) trailhead does this for you: at each ticket's work-start it asks whether you'll run more than one at once and picks the mode by repo shape. To force it eagerly, set `isolation: worktree` in the conventions header, and each executing ticket runs in its own `git worktree` on a `trailhead/t<n>` branch, integrated back to the trunk at Resolve. It implies a branch per ticket even under `git: main` (git won't check the trunk out twice), and it is the right posture for a **monorepo** (a worktree shares the object store, far cheaper than a second clone). One caveat: a worktree isolates *source* but is a fresh path with no installed deps, so a **path-bound package** (React Native/Expo, native toolchains, anything tied to a local `node_modules`) won't build from it. For those there's **`isolation: clone`**: a dedicated per-ticket clone that installs its own deps and builds/UATs like the real app (heavier than a worktree, and the right tool for an Expo/RN submodule). Or keep `isolation: none` and serialize. Otherwise run concurrent sessions in separate clones.
|
|
366
|
+
- **Pause/resume** via a `PAUSED` checkpoint comment and a `trailhead:paused` label (added by pause, removed by resume), so any session can pick a ticket back up. Paused tickets are listed under a `Paused` group in the map, whiteboard and dashboard views.
|
|
367
|
+
- **Isolate concurrent sessions with worktrees.** By default (`isolation: auto`) trailhead does this for you: at each ticket's work-start it asks whether you'll run more than one at once and picks the mode by repo shape. To force it eagerly, set `isolation: worktree` in the conventions header, and each executing ticket runs in its own `git worktree` on a `trailhead/t<n>` branch, integrated back to the trunk at Resolve. It implies a branch per ticket even under `git: main` (git won't check the trunk out twice), and it is the right posture for a **monorepo** (a worktree shares the object store, far cheaper than a second clone). One caveat: a worktree isolates *source* but is a fresh path with no installed deps, so a **path-bound package** (React Native/Expo, native toolchains, anything tied to a local `node_modules`) won't build from it. For those there's **`isolation: clone`**: a dedicated per-ticket clone that installs its own deps and builds/UATs like the real app (heavier than a worktree, and the right tool for an Expo/RN submodule). Or keep `isolation: none` and serialize. Otherwise run concurrent sessions in separate clones. A fresh worktree or clone has no `.env`: list the gitignored files it needs under `isolation.copy` in `.trailhead/config.json` and trailhead copies them in right after creating the workspace, never overwriting (see Configuration).
|
|
263
368
|
- **A session-ticket marker for your statusline.** When it starts working a ticket, trailhead drops a one-line, gitignored `.trailhead/session-ticket` (`#<n> <title>`) at the working root and clears it at handoff. It's a cheap, offline hint so a statusline (or any tool) can show *which ticket this session is on* without hitting the tracker; trailhead itself still treats the Issues as the source of truth. It also does more than that: while it's present, the git commit-msg hook requires every commit to carry a `Refs: #<n>` trailer matching it.
|
|
264
|
-
- **It picks isolation for you by default (`auto`).** With no explicit `isolation:` set (the default is `auto`),
|
|
369
|
+
- **It picks isolation for you by default (`auto`).** With no explicit `isolation:` set (the default is `auto`), at a ticket's work-start trailhead asks whether you'll work more than one at once on this machine this session; if so it uses a `git worktree` (plain repo) or a `clone` (submodule superrepo), otherwise it just works in the current checkout. Nothing is written into the conventions: the answer is remembered on this machine in the gitignored `.trailhead/isolation-answer.json` and reused, with a one-line note, while your other assigned tickets stay the same and the last work-start was under 8 hours ago; a change or an expired record re-asks. You can still force `none`/`worktree`/`clone` explicitly, and `/trailhead:auto` and explicit modes never use the remembered answer.
|
|
265
370
|
- **Scope tickets by path on a monorepo.** A ticket can carry a `Scope:` line naming the package/dir(s) it touches: disjoint scopes parallelize safely, and it scopes build/test and the worktree's commits to the affected package. `/trailhead:adopt` detects a monorepo and proposes both `isolation: worktree` and the `Scope:` convention. Under `isolation: none`, `Scope:` also **serializes** a shared area: at claim time a session holds off if another in-progress ticket's scope overlaps, so two tickets scoped to the same submodule/package can't run at once (how you keep two sessions off one path-bound app).
|
|
266
371
|
- **Git submodules are handled as separate repos.** Work that lands inside a submodule is committed *inside the submodule* (on a branch) and published before a gitlink bump in the parent points at it. Because superproject worktrees share one submodule git dir, a **submodule-bearing repo resolves to `clone`** (under the default `auto`, or by escalating an explicit `worktree`), so each ticket gets independent submodule state; the clone provisions its submodules at setup (`--recurse-submodules`) and Verify checks `git status` inside each touched submodule. A ticket spanning two submodules stays atomic via a single parent commit that bumps both gitlinks together; its `Scope:` names both, and the same submodule counts as overlapping scope, so two tickets on it serialise. `/trailhead:adopt` detects `.gitmodules` and writes the rule into the conventions.
|
|
267
372
|
- **State lives on the tickets** (claim, labels, comments; all conflict-free); the map body is a re-readable index, not the source of truth. The durable record of a resolution is the ticket's own comment.
|
|
@@ -290,7 +395,7 @@ Three layers: **nearest wins**, key by key (a key unset at one layer inherits th
|
|
|
290
395
|
- **Global**: `~/.claude/trailhead/config.json`: your standing defaults across every project.
|
|
291
396
|
- **Defaults**: the built-in values.
|
|
292
397
|
|
|
293
|
-
`/trailhead:config` runs a **guided, menu-driven setup**: pick the scope, then walk each setting (⚙️ way of working (git · release · isolation) · 🌐 ticket language · 🧠 models · 🎨 design + approval · 🧪 TDD · 🖥️ acceptance testing · 🧑⚖️ plan review · 📊 statusline) as an icon-labelled menu; no hand-editing JSON. Every step is asked (none skipped), and **plan and execute models are always two separate, version-pinned choices**. `config get` prints the effective merged config; `config set <key> <value>` writes one key.
|
|
398
|
+
`/trailhead:config` runs a **guided, menu-driven setup**: pick the scope, then walk each setting (⚙️ way of working (git · release · isolation) · 🌐 ticket language · 🧠 models (a High / Balanced / Low profile, or Manual) · 🎨 design + approval · 🧪 TDD · ⚖️ effort · 🖥️ acceptance testing (browser, UAT setup, a test account) · 🧑⚖️ plan review · 📊 statusline) as an icon-labelled menu; no hand-editing JSON. Every step is asked (none skipped), and **plan and execute models are always two separate, version-pinned choices**. `config get` prints the effective merged config; `config set <key> <value>` writes one key.
|
|
294
399
|
|
|
295
400
|
`/trailhead:prune [map]` reclaims a map's sub-issue slots under GitHub's 100-cap (drops closed/orphan edges, keeps every reference). Offered automatically when a map is near or at the cap, and runnable on demand.
|
|
296
401
|
|
|
@@ -303,25 +408,31 @@ The **📊 statusline** step offers to install trailhead's Claude Code status ba
|
|
|
303
408
|
| Key | Values (default **bold**) | Effect |
|
|
304
409
|
|---|---|---|
|
|
305
410
|
| `ticket.language` | an ISO 639-1 code (**`en`**) | the language trailhead **writes** its GitHub prose & commit descriptions in, decoupled from the language it converses in |
|
|
306
|
-
| `models.{plan,execute,research,review,debug,verify,codebase-map}` | a full **versioned** model id (**inherit session
|
|
411
|
+
| `models.{plan,execute,research,review,debug,verify,codebase-map}` | a full **versioned** model id (**Balanced-profile default**; `inherit session` is an explicit choice) | which model runs each activity; `plan` and `execute` are always set separately |
|
|
412
|
+
| `models.codex.{plan,execute,research,review,debug,verify,codebase-map}` | an OpenAI model id, or `{model, effort}` (**inherit session**) | the same per-activity split on Codex, independent of `models.*` (Claude ids); re-run the installer to project it into `~/.codex/agents/` |
|
|
307
413
|
| `design` | **`disk`** \| `artifacts` \| `stitch` | where UI mockups go: local throwaway HTML, a Design canvas **Artifact** on claude.ai (Claude Code only), or Google Stitch (cross-host, via the Stitch MCP). The legacy `claude.ai/design` value is read as `artifacts` |
|
|
414
|
+
| `design.project` | canvas Artifact URL / Stitch project id | `artifacts` and `stitch` only: the canvas or Stitch project the mockups land on; set at the first UI screen (pick, paste or create), not by hand. A leftover claude.ai/design project is not reused |
|
|
308
415
|
| `design.surface` | **`canvas`** \| `design-system` | `stitch` only: a Stitch project of screens (default) or a shared Stitch design system |
|
|
309
416
|
| `design.system` | Design System Artifact URL | `artifacts` only: the design system installed on the mockup canvas (asked at the first screen if unset) |
|
|
310
417
|
| `design.approval` | **`explicit`** \| `auto` | wait for mockup approval before UI code, or proceed without blocking |
|
|
311
418
|
| `tdd` | **`seams`** \| `on` \| `off` | how the `build` engine tests |
|
|
312
|
-
| `acceptance.browser` | **`auto`** \| `on` \| `off` | drive the browser in Verify (after asking who drives, AI or human); `off` still runs AI-driven checks via commands, and walks you through a conversational UAT for anything only you can do (step by step in chat, not a checklist to self-serve) |
|
|
419
|
+
| `acceptance.browser` | **`auto`** \| `on` \| `off` | drive the browser in Verify (after asking who drives, AI or human, or skip); `off` still runs AI-driven checks via commands, and walks you through a conversational UAT for anything only you can do (step by step in chat, not a checklist to self-serve) |
|
|
313
420
|
| `testing.webapp` / `testing.url` | bool / URL | is it browser-drivable, and where |
|
|
314
421
|
| `plan_review` | **`off`** \| `on` \| CLI list | send `build` PLANs to external AI CLIs (Gemini, Codex, …) for a second opinion and converge on their concerns |
|
|
315
422
|
| `plan_review.rounds` | integer (**`2`**) | max converge-and-re-review rounds |
|
|
316
423
|
| `code_review.rounds` | integer (**`2`**) | max fix-and-re-review rounds in Code review before its boundary HITL checkpoint |
|
|
317
424
|
| `effort` | **`standard`** \| `lean` | how hard the `build`/`bug` engine works a change: `standard` runs every step, `lean` size-triages small changes and offers to skip the heavy ones (plan pass, TDD, cross-AI review, full code review, goal-backward verify). Governs `build`/`bug` only: `quick` always size-triages regardless of this key |
|
|
425
|
+
| `isolation.copy` | array of repo-relative paths (**unset**) | gitignored files and directories (`.env`, `.npmrc`, local config) copied from the main checkout into every new `worktree`/`clone` workspace, never overwriting; unsafe paths (absolute, `..`, `.git`) are rejected. When unset, trailhead suggests the `.env` files that have a tracked `*.example` sibling |
|
|
426
|
+
| `preflight.checks` | array of shell commands (**unset**) | your own project checks, run by the base preflight before UAT and before integration; a non-zero exit stops the ticket (e.g. a check for duplicate migration timestamps) |
|
|
427
|
+
| `uat.setup` | array of `{name, run, check?, note?}` (**unset**) | ordered setup steps run at every UAT start, before the drive-mode ask (start the dev server, boot the emulator); a passing `check` skips a step; `[]` means no setup needed |
|
|
428
|
+
| `uat.accounts` | object of `role: {user, secret}` (**unset**) | named test accounts for UAT; `secret` is always a `$ENV` reference, never a value, so the committed config stays generic (the guided setup asks for the variable name only) |
|
|
318
429
|
|
|
319
430
|
**Models.** Each key runs its activity as a **subagent** on the model you name, so the whole per-activity split applies within a single work session, whatever model that session runs on:
|
|
320
431
|
|
|
321
432
|
- `plan` and `execute` are the build/bug engine's steps. Execute is a subagent too, and it commits to `main`.
|
|
322
433
|
- `research`, `review`, `debug`, `verify` (the goal-backward Verify check), and the codebase-map fan-out each run on their own key.
|
|
323
434
|
|
|
324
|
-
Choose `plan` and `execute` separately, each by **full versioned id** (never a bare `opus` or `sonnet`). A key
|
|
435
|
+
Choose `plan` and `execute` separately, each by **full versioned id** (never a bare `opus` or `sonnet`). A key left unset uses its Balanced-profile default, and one equal to the session model simply runs inline; set `inherit session` to use the session model.
|
|
325
436
|
|
|
326
437
|
The **main session stays the orchestrator**. It holds the interactive moments (a build's Discuss, and Verify's acceptance/UAT) and it does charting, grilling, and ticket-writing on its own model. No key governs ticket quality, so run charting sessions on your strong model.
|
|
327
438
|
|
|
@@ -331,13 +442,9 @@ Example config file (the same shape works for the project `.trailhead/config.jso
|
|
|
331
442
|
{ "ticket": { "language": "en" }, "models": { "plan": "claude-opus-5-5", "execute": "claude-sonnet-5-5" }, "tdd": "seams", "acceptance": { "browser": "auto" } }
|
|
332
443
|
```
|
|
333
444
|
|
|
334
|
-
**Design mockups
|
|
445
|
+
**Design mockups and acceptance testing.** How the `design.*` keys play out (canvas, design system, approval, moving from claude.ai/design) is in [Mockups before code](#-mockups-before-code); how `acceptance.browser` and `testing.*` drive Verify is in [Acceptance testing](#-acceptance-testing-uat).
|
|
335
446
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
With **`stitch`**, `design.surface` picks a Stitch project of screens (`canvas`, default) or a shared Stitch design system (`design-system`); trailhead picks, pastes or creates it the same way, and offers once to install the Stitch MCP if it isn't connected (decline and it falls back to local disk).
|
|
339
|
-
|
|
340
|
-
**Moving from claude.ai/design.** The standalone Claude Design site closes on 2026-12-14 and its designs now live in Claude as Artifacts. A config that still says `design: claude.ai/design` keeps working as `artifacts` (trailhead tells you once and offers to rewrite the key), but a cached claude.ai/design project can't be reused: migrate your design systems from the Artifacts page banner and let trailhead attach a new canvas. Where the `Artifact` tool isn't available (Codex, or an API-key session), trailhead offers to switch to `stitch` before falling to local disk. `design.approval` decides whether the build waits for your explicit go-ahead (`explicit`), or proceeds right after surfacing the mockup (`auto`).
|
|
447
|
+
**Nested or flat.** The list keys above (`isolation.copy`, `preflight.checks`, `uat.setup`, `uat.accounts`) can be written nested (`{"uat": {"setup": [...]}}`) or flat (`"uat.setup": [...]`); if a file has both, the nested form wins with a warning, and a project value replaces the global one as a whole (lists are not merged). `git`, `release` and the isolation *mode* stay in the conventions header; only `isolation.copy` lives in `config.json`.
|
|
341
448
|
|
|
342
449
|
---
|
|
343
450
|
|
|
@@ -347,13 +454,19 @@ Beyond the skill's instructions, trailhead ships eight of its own hooks (in `hoo
|
|
|
347
454
|
|
|
348
455
|
- **Commit guard** (`PreToolUse` on `git commit`): hard-blocks a commit whose subject isn't [Conventional Commits](https://www.conventionalcommits.org), and hard-blocks any `Co-Authored-By` trailer. This mirrors GSD's commit validation.
|
|
349
456
|
- **Secret guard** (`PreToolUse` on `gh` issue/PR writes): trailhead posts a lot to the tracker (ticket bodies, engine comments, codebase/conventions issues, resolutions). This scans what a `gh issue`/`gh pr`/`gh api` write is about to post (the inline `--body`, a heredoc, or a `--body-file`) and **hard-blocks** it if it matches a credential pattern (private keys, GitHub/AWS/OpenAI/Slack/Google/Stripe tokens, JWTs, or a hardcoded `password`/`secret`/`token=…`). The block is a **clean-and-retry cue, not a dead end**: trailhead redacts the flagged value in place (`<REDACTED>` or an env-var reference) and re-posts automatically, so the cleaned content still lands: the secret just never reaches the tracker. It stays a fail-safe *block* rather than a silent auto-rewrite on purpose: a block never leaks, whereas a redaction that quietly failed to apply would. It never scans reads, only outbound writes.
|
|
350
|
-
- **Install guard** (`PreToolUse` on package installs): a slopsquatting barrier. It hard-blocks a named public-registry install (npm / PyPI / crates.io / Go / RubyGems) until the package is vetted (typosquat similarity to popular names, age / first-seen date, download counts, repository metadata present and matching); once vetted, re-run the exact command prefixed with `TRAILHEAD_VERIFIED_INSTALL=1` to proceed. The Execute / Fix engine carries the same block-and-ask.
|
|
351
|
-
- **Search guard** (`PreToolUse` on `Bash`): structural backstop for the search-command-hygiene rule (never `cd` then read/search a relative path). It hard-blocks a single Bash command that both changes directory (`cd`/`pushd`/`env -C`) and, in a joined or later statement, reads/searches a relative path (`grep`/`rg`/`ag`/`cat`/`head`/`tail`/`wc`/`nl`/`sed`/`awk`/`less`/`more`, or `git grep`/`log`/`show`/`diff` without a `-C`), so the shape that trips a `Read()` deny rule under bypass permissions (falling back to a manual approval prompt instead of running headless) never runs at all, rather than merely being discouraged in the agent's own prose. Claude Code only; not projected to Codex, which has no such `Read()` deny rule.
|
|
457
|
+
- **Install guard** (`PreToolUse` on package installs): a slopsquatting barrier. It hard-blocks a named public-registry install (npm / PyPI / crates.io / Go / RubyGems) until the package is vetted (typosquat similarity to popular names, age / first-seen date, download counts, repository metadata present and matching); once vetted, re-run the exact command prefixed with `TRAILHEAD_VERIFIED_INSTALL=1` to proceed. The Execute / Fix engine carries the same block-and-ask. It reads commands the way a shell does: text inside quotes or a heredoc (an `echo`, a commit message) is not an install, lockfile installs pass, and wrappers such as `sudo`, `time`, `env` or `xargs` are seen through.
|
|
458
|
+
- **Search guard** (`PreToolUse` on `Bash`): structural backstop for the search-command-hygiene rule (never `cd` then read/search a relative path). It hard-blocks a single Bash command that both changes directory (`cd`/`pushd`/`env -C`) and, in a joined or later statement, reads/searches a relative path (`grep`/`rg`/`ag`/`cat`/`head`/`tail`/`wc`/`nl`/`sed`/`awk`/`less`/`more`, or `git grep`/`log`/`show`/`diff` without a `-C`), so the shape that trips a `Read()` deny rule under bypass permissions (falling back to a manual approval prompt instead of running headless) never runs at all, rather than merely being discouraged in the agent's own prose. Redirection targets (`2>/dev/null`) are not treated as reads, and a `cd` to the session's own directory does not arm it. Claude Code only; not projected to Codex, which has no such `Read()` deny rule.
|
|
352
459
|
- **Body guard** (`PreToolUse` on `gh` issue/PR body writes): hard-blocks a `gh issue edit` / `gh pr edit` / `gh api` write that would set an issue body to empty or whitespace-only, so a read-modify-write whose read returned an empty/degraded body (e.g. a transient HTTP 5xx on `gh issue view --json body`) can never clobber the existing body.
|
|
353
460
|
- **Secret-read guard** (`PreToolUse` on `Read|Bash`): denies reads of `.env`/`.env.*`/`.secrets`, whether via the Read tool or a Bash command (a file operand, an option value, or a `<` redirect target). This is a hook `deny` decision rather than a `Read()` permission rule, so secrets stay unreadable without arming Claude Code 2.1.259's `cd-compound-read` approval prompt.
|
|
354
|
-
- **Mockup-link guard** (`PreToolUse` on `AskUserQuestion`): structural backstop for the Prototype rule that a mockup approval ask carries the mockup's link. It hard-blocks an `AskUserQuestion` that asks to approve a mockup (or pick between mockup variants) when the reply text right before it holds
|
|
461
|
+
- **Mockup-link guard** (`PreToolUse` on `AskUserQuestion`): structural backstop for the Prototype rule that a mockup approval ask carries the mockup's link. It hard-blocks an `AskUserQuestion` that asks to approve a mockup (or pick between mockup variants) when neither the reply text right before it nor the approval question itself holds a URL or file path (when the current message is not yet in the transcript, the guard cannot judge and allows), so the agent puts the clickable link in the message before asking again. On Codex, which has no `AskUserQuestion` tool and asks as a plain-text numbered list, its twin `mockup-link-stop` runs on `Stop`: when the final reply asks for that approval without a link, Codex continues the turn so the agent rewrites the ask with it.
|
|
355
462
|
- **Issue injection scanner** (`PostToolUse` on `gh` reads): trailhead reads issue/PR/comment text written by anyone with repo access, i.e. untrusted input. When that text contains prompt-injection phrases, the hook injects an advisory reminding the agent to treat it as data, never as commands. Advisory only: it never blocks.
|
|
356
463
|
|
|
464
|
+
The commit, secret, install, search, and body guards run in **one process**: a single `trailhead-bash-guards.js` registration evaluates them in that order, so a Bash call pays one node start-up instead of five (three hook processes per Bash call in all: the merged hook, the secret-read guard, and the injection scanner). They remain five distinct guards with unchanged verdicts; the first block wins, and a guard that errors allows on its own without stopping the others. A guard whose module is missing or broken is skipped too, but never silently: the hook tells the session which guard did not check the command, so a partial install shows up. On Codex the same hook is registered with `--guards=commit,secret,install,body`, since there is no search guard there.
|
|
465
|
+
|
|
466
|
+
The secret, body, and secret-read guards also **fail closed on shell constructs they cannot interpret with certainty** (`eval`, `source` / `.`, a bash 5.3 `${ cmd; }`, `printf -v`, a function definition, an alias, a quoted `gh api` body key, a backslash-newline inside a word): when one can hide or precede a write (or sits next to a secret path), the command is blocked with a "rewrite it in a simple form" message instead of being emulated; the same constructs with no write or secret nearby pass.
|
|
467
|
+
|
|
468
|
+
Alongside them trailhead installs a git **`commit-msg` hook** (a POSIX `sh` wrapper, so it also works in `"type": "module"` repos) that enforces the same commit rules on every host, plus the `Refs: #<n>` trailer while a session ticket is active. If it cannot run (script missing, no `node`) it prints `trailhead: commit-msg hook inactive (<reason>); commit rules not enforced.` to stderr and lets the commit through; an installed hook is upgraded at the next ticket start.
|
|
469
|
+
|
|
357
470
|
All eight are crash-safe (any error → allow) and active whenever the plugin is installed. The commit, secret, install, search, body, and secret-read guards therefore apply in **every** repo, not only trailhead projects: intentional, since conventional commits, no `Co-Authored-By`, no leaked secrets, no unvetted installs, no `cd`-then-relative-read, no clobbered issue bodies, and no readable `.env`/`.secrets` are trailhead's standing rules. To opt out, disable the plugin's hooks in your Claude Code settings.
|
|
358
471
|
|
|
359
472
|
---
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Docs test for #243: the skill prose wires the stale-base preflight into UAT and
|
|
3
|
+
// integration, and documents the preflight.checks config key.
|
|
4
|
+
// Run: node base-preflight-docs.test.js
|
|
5
|
+
const assert = require('assert');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const skills = path.join(__dirname, '..', 'plugins', 'trailhead', 'skills');
|
|
10
|
+
const read = (rel) => fs.readFileSync(path.join(skills, rel), 'utf8');
|
|
11
|
+
|
|
12
|
+
let passed = 0;
|
|
13
|
+
const ok = (name, cond) => { assert.ok(cond, name); passed++; };
|
|
14
|
+
|
|
15
|
+
const HELPER = 'trailhead-base-preflight.js';
|
|
16
|
+
// file -> strings it must carry
|
|
17
|
+
const EXPECT = {
|
|
18
|
+
'_shared/teamwork.md': [
|
|
19
|
+
'**Stale-base preflight.**', HELPER, '--config-root', 'preflight -> sync -> checks -> tests -> Code review -> goal check -> UAT', 'preflight -> sync -> checks -> tests -> integration', 're-run the Code review on it before integrating', 'start of Verify',
|
|
20
|
+
'`git: pr` without isolation', 'immediately before the push and PR',
|
|
21
|
+
'`current`', '`synced`', '`conflict`', '`dirty`', '`unverified`', '`trunk-diverged`', '`sync-failed`', 'Fail closed',
|
|
22
|
+
'right before the trunk push', 'integration target', 'non-fast-forward', 'testsRequired', 'preflight.checks',
|
|
23
|
+
],
|
|
24
|
+
'_shared/configuration-reference.md': ['`preflight.checks`', '**Preflight checks.**', 'migration', 'uniq -d'],
|
|
25
|
+
'_shared/techniques/acceptance-testing.md': ['Stale-base preflight comes first', HELPER, 'already ran at the start of Verify'],
|
|
26
|
+
'trailhead-work/references/auto.md': ['stale-base preflight never auto-resolves', '`conflict`'],
|
|
27
|
+
};
|
|
28
|
+
for (const [rel, needles] of Object.entries(EXPECT)) {
|
|
29
|
+
const text = read(rel);
|
|
30
|
+
for (const needle of needles) ok(`${rel} names: ${needle}`, text.includes(needle));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Each engine call site names the preflight.
|
|
34
|
+
const engines = read('trailhead-work/references/ticket-engines.md');
|
|
35
|
+
const lines = engines.split('\n');
|
|
36
|
+
const step = (prefix, from = 0) => lines.findIndex((l, i) => i >= from && l.startsWith(prefix));
|
|
37
|
+
const buildVerify = step('4. **Verify**');
|
|
38
|
+
const buildResolve = step('5. **Resolve**', buildVerify + 1);
|
|
39
|
+
const bugVerify = step('4. **Verify**', buildResolve + 1);
|
|
40
|
+
const bugResolve = step('5. **Resolve**', bugVerify + 1);
|
|
41
|
+
for (const [name, idx] of [['build Verify', buildVerify], ['build Resolve', buildResolve], ['bug Verify', bugVerify], ['bug Resolve', bugResolve]]) {
|
|
42
|
+
ok(`${name} step found`, idx >= 0);
|
|
43
|
+
ok(`${name} names the stale-base preflight`, lines[idx].includes('Stale-base preflight'));
|
|
44
|
+
}
|
|
45
|
+
ok('build/bug Verify start with the preflight, before the tests and Code review',
|
|
46
|
+
[buildVerify, bugVerify].every((i) => {
|
|
47
|
+
const l = lines[i];
|
|
48
|
+
const p = l.indexOf('Stale-base preflight');
|
|
49
|
+
return p >= 0 && p < l.indexOf('**Code review**') && p < l.indexOf('**Goal-backward verification**') && p < l.indexOf('**Acceptance testing**');
|
|
50
|
+
}));
|
|
51
|
+
ok('Verify runs the tests after the sync, before the Code review',
|
|
52
|
+
[buildVerify, bugVerify].every((i) => lines[i].indexOf('then re-run the tests') > 0 && lines[i].indexOf('then re-run the tests') < lines[i].indexOf('**Code review**')));
|
|
53
|
+
ok('Resolve names git: pr without isolation',
|
|
54
|
+
[buildResolve, bugResolve].every((i) => lines[i].includes('`git: pr` without isolation: on the ticket branch, immediately before the push and PR')));
|
|
55
|
+
ok('Resolve runs it before the Pending-UAT guard',
|
|
56
|
+
[buildResolve, bugResolve].every((i) => lines[i].indexOf('Stale-base preflight') < lines[i].indexOf('Pending-UAT guard')));
|
|
57
|
+
ok('Pending-UAT option (a) runs the preflight first',
|
|
58
|
+
engines.split('with no ticket (the stale-base preflight first, then the UAT setup, then the drive-mode ask').length === 3);
|
|
59
|
+
ok('UAT follow-up starts with the preflight', engines.includes('starting with the stale-base preflight'));
|
|
60
|
+
|
|
61
|
+
for (const rel of ['_shared/teamwork.md', '_shared/configuration-reference.md', '_shared/techniques/acceptance-testing.md', 'trailhead-work/references/ticket-engines.md', 'trailhead-work/references/auto.md']) {
|
|
62
|
+
ok(`${rel} has no em-dash`, !read(rel).includes('—'));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log(`base-preflight-docs.test.js: ${passed} checks passed`);
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Pins the Execute/Fix split (#251): the executor-side text lives in
|
|
3
|
+
// trailhead-work/references/executor-brief.md (the one text injected at spawn),
|
|
4
|
+
// while the Execute (build) and Fix (bug) steps of ticket-engines.md keep only
|
|
5
|
+
// the orchestrator moves. Run: node execute-split-docs.test.js. No framework.
|
|
6
|
+
const assert = require('assert');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
let passed = 0;
|
|
11
|
+
const ok = (name, cond) => { assert.ok(cond, name); passed++; };
|
|
12
|
+
|
|
13
|
+
const plugin = path.join(__dirname, '..', 'plugins', 'trailhead');
|
|
14
|
+
const refs = path.join(plugin, 'skills', 'trailhead-work', 'references');
|
|
15
|
+
const briefPath = path.join(refs, 'executor-brief.md');
|
|
16
|
+
const exists = fs.existsSync(briefPath);
|
|
17
|
+
ok('executor-brief.md exists', exists);
|
|
18
|
+
const brief = fs.readFileSync(briefPath, 'utf8');
|
|
19
|
+
const lb = brief.toLowerCase();
|
|
20
|
+
const engines = fs.readFileSync(path.join(refs, 'ticket-engines.md'), 'utf8');
|
|
21
|
+
const lines = engines.split('\n');
|
|
22
|
+
|
|
23
|
+
const block = (startPrefix, from = 0) => {
|
|
24
|
+
const s = lines.findIndex((l, i) => i >= from && l.startsWith(startPrefix));
|
|
25
|
+
if (s === -1) return '';
|
|
26
|
+
const e = lines.findIndex((l, i) => i > s && l.startsWith('4. **Verify**'));
|
|
27
|
+
return lines.slice(s, e === -1 ? undefined : e).join('\n');
|
|
28
|
+
};
|
|
29
|
+
const execute = block('3. **Execute**');
|
|
30
|
+
const fix = block('3. **Fix**');
|
|
31
|
+
ok('the build Execute block was found', execute.length > 500);
|
|
32
|
+
ok('the bug Fix block was found', fix.length > 500);
|
|
33
|
+
|
|
34
|
+
// --- the brief: what the executor does ---------------------------------------------------
|
|
35
|
+
const has = (src, ...needles) => needles.every((n) => src.includes(n));
|
|
36
|
+
ok('brief: atomic conventional commits with a Refs trailer', has(lb, 'atomic', 'conventional', 'refs: #<n>'));
|
|
37
|
+
ok('brief: a fix takes the confirmed DIAGNOSIS as its spec', brief.includes('the confirmed `DIAGNOSIS` (bug)'));
|
|
38
|
+
ok('brief: a resumed spawn continues from the commits already made', has(brief, 'Resumed spawn', 'never redo or revert'));
|
|
39
|
+
ok('brief: stop and report finishes the unaffected work first', brief.includes('finish the work it does not affect'));
|
|
40
|
+
ok('Execute and Fix: inline, the session applies the brief and asks the user directly',
|
|
41
|
+
execute.includes('asking the user directly') && fix.includes('asking the user directly'));
|
|
42
|
+
ok('brief: one commit = one verifiable step', brief.includes('One commit = one verifiable step'));
|
|
43
|
+
ok('brief: TDD per the config.tdd value passed', has(brief, 'config.tdd', '`seams`', '`on`', '`off`'));
|
|
44
|
+
ok('brief: a fix gets a test that fails before and passes after', lb.includes('fails before and passes after'));
|
|
45
|
+
ok('brief: dependency vetting criteria', has(lb, 'typosquat', 'age', 'downloads', 'repository metadata'));
|
|
46
|
+
ok('brief: the sentinel re-run of the exact command', has(brief, 'TRAILHEAD_VERIFIED_INSTALL=1', 'exact'));
|
|
47
|
+
ok('brief: sentinel only when clean or passed as user-approved', lb.includes('user-approved') && lb.includes('clean'));
|
|
48
|
+
ok('brief: a suspicious package: stop and report, never install, never set the sentinel',
|
|
49
|
+
lb.includes('suspicious') && lb.includes('stop and report') && lb.includes('never install') && lb.includes('never set'));
|
|
50
|
+
ok('brief: 100% fidelity to a passed approved mockup', brief.includes('100% fidelity') && lb.includes('approved mockup'));
|
|
51
|
+
ok('brief: infeasible element: stop and report, never silently deviate',
|
|
52
|
+
lb.includes('infeasible') && lb.includes('never silently deviate'));
|
|
53
|
+
ok('brief: returns the enumerated fidelity list in its report', brief.includes('enumerated fidelity list'));
|
|
54
|
+
ok('brief: new scope is reported, not worked', lb.includes('scope') && lb.includes('reported, not worked'));
|
|
55
|
+
const report = brief.slice(brief.indexOf('## Report'));
|
|
56
|
+
ok('brief: has a Report section', brief.includes('## Report'));
|
|
57
|
+
ok('brief: Report names flagged packages with exact install command and evidence',
|
|
58
|
+
has(lb.slice(lb.indexOf('## report')), 'flagged package', 'exact install command', 'evidence'));
|
|
59
|
+
ok('brief: Report names the fidelity list as element/state -> reproduced or infeasible with why',
|
|
60
|
+
has(report, 'element/state', 'reproduced or infeasible', 'why'));
|
|
61
|
+
ok('brief: Report names surfaced scope', report.toLowerCase().includes('surfaced scope'));
|
|
62
|
+
ok('brief: the report takes the shape of the implementing Return contract',
|
|
63
|
+
has(report, 'implementing `Return contract`', 'status: done | partial | blocked', '`commits:`', '`blockers:`', '`fidelity:`', '`surfaced scope:`'));
|
|
64
|
+
ok('brief: no longer defers the report shape to a later ticket', !report.includes('#249'));
|
|
65
|
+
|
|
66
|
+
// --- the brief carries none of the orchestrator-only moves ---------------------------------
|
|
67
|
+
ok('brief: no AskUserQuestion', !brief.includes('AskUserQuestion'));
|
|
68
|
+
ok('brief: no "ask the user"', !lb.includes('ask the user'));
|
|
69
|
+
ok('brief: no config.design', !brief.includes('config.design'));
|
|
70
|
+
ok('brief: no Prototype technique instruction', !lb.includes('prototype technique'));
|
|
71
|
+
ok('brief: no gh issue / gh pr tracker write', !/gh (issue|pr)\b/.test(lb));
|
|
72
|
+
ok('brief: no branch or PR creation', !/(create|creates|creating|open|opens) (the |a )?(branch|pr\b|pull request)/.test(lb));
|
|
73
|
+
ok('brief: no em-dash', !brief.includes('—'));
|
|
74
|
+
|
|
75
|
+
// --- the build Execute block: the orchestrator part --------------------------------------------
|
|
76
|
+
const lx = execute.toLowerCase();
|
|
77
|
+
ok('Execute: Prototype FIRST', execute.includes('Prototype technique') && execute.includes('FIRST'));
|
|
78
|
+
ok('Execute: config.design routing, never a hosted mode to a local disk mockup',
|
|
79
|
+
has(execute, 'config.design', 'never shortcut a hosted mode to a local disk mockup'));
|
|
80
|
+
ok('Execute: config.design.approval gate', has(execute, 'config.design.approval', '`explicit`', '`auto`'));
|
|
81
|
+
ok('Execute: branch before the spawn and PR after under git: pr',
|
|
82
|
+
has(execute, 'git: pr', 'the orchestrator creates the branch before the spawn and opens the PR'));
|
|
83
|
+
ok('Execute: worktree under isolation: worktree', has(execute, 'isolation: worktree', 'git worktree'));
|
|
84
|
+
ok('Execute: posts the fidelity list as a ticket comment',
|
|
85
|
+
has(execute, 'returns the enumerated fidelity list in its report', 'the orchestrator posts it as a ticket comment'));
|
|
86
|
+
ok('Execute: an infeasible element is raised with the user and settled',
|
|
87
|
+
lx.includes('infeasible') && lx.includes('revise and re-approve the mockup') && lx.includes('accepts a named deviation'));
|
|
88
|
+
ok('Execute: re-spawns with the settled mockup and accepted deviations',
|
|
89
|
+
lx.includes('re-spawn') && lx.includes('accepted deviations'));
|
|
90
|
+
ok('Execute: block-and-ask on a flagged package', lx.includes('block-and-ask') && lx.includes('flagged package'));
|
|
91
|
+
ok('Execute: only on an explicit yes re-spawn with the package as user-approved',
|
|
92
|
+
lx.includes('explicit yes') && lx.includes('user-approved'));
|
|
93
|
+
ok('Execute: on a no the package is not installed and the plan is revisited',
|
|
94
|
+
lx.includes('not installed') && lx.includes('revisited with the user'));
|
|
95
|
+
ok('Execute: captures surfaced scope', lx.includes('surfaced scope') && lx.includes('captured'));
|
|
96
|
+
ok('Execute: dispatches trailhead-executor on config.models.execute',
|
|
97
|
+
has(execute, '`trailhead-executor`', 'config.models.execute'));
|
|
98
|
+
ok('Execute: the brief is the only protocol text', has(execute, 'executor-brief.md', 'only protocol text'));
|
|
99
|
+
ok('Execute: lists the runtime inputs',
|
|
100
|
+
has(lx, 'ticket number', 'plan', 'base sha', 'config.tdd', 'mockup link', 'accepted mockup deviations'));
|
|
101
|
+
ok('Execute: inline when the model is unset or equals the session model', lx.includes('inline') && lx.includes('session'));
|
|
102
|
+
|
|
103
|
+
// --- the bug Fix block: self-contained ------------------------------------------------------------
|
|
104
|
+
const lf = fix.toLowerCase();
|
|
105
|
+
ok('Fix: dispatches trailhead-fix on config.models.execute with the brief as the only protocol text',
|
|
106
|
+
has(fix, '`trailhead-fix`', 'config.models.execute', 'executor-brief.md', 'only protocol text'));
|
|
107
|
+
ok('Fix: lists the runtime inputs',
|
|
108
|
+
has(lf, 'ticket number', 'base sha', 'config.tdd', 'mockup link', 'accepted mockup deviations'));
|
|
109
|
+
ok('Fix: UI-fix Prototype + approval',
|
|
110
|
+
has(fix, 'Prototype technique', 'config.design', 'config.design.approval') && lf.includes('ui'));
|
|
111
|
+
ok('Fix: posts the fidelity list as a ticket comment',
|
|
112
|
+
has(fix, 'enumerated fidelity list', 'the orchestrator posts it as a ticket comment'));
|
|
113
|
+
ok('Fix: infeasible element settle-and-re-spawn loop',
|
|
114
|
+
lf.includes('infeasible') && lf.includes('revise and re-approve the mockup') && lf.includes('accepts a named deviation') && lf.includes('re-spawn'));
|
|
115
|
+
ok('Fix: block-and-ask on a flagged package with explicit-yes resume',
|
|
116
|
+
lf.includes('block-and-ask') && lf.includes('flagged package') && lf.includes('explicit yes') && lf.includes('user-approved'));
|
|
117
|
+
ok('Fix: captures surfaced scope', lf.includes('surfaced scope') && lf.includes('captured'));
|
|
118
|
+
ok('Fix: branch before the spawn and PR under git: pr',
|
|
119
|
+
has(fix, 'git: pr', 'the orchestrator creates the branch before the spawn and opens the PR'));
|
|
120
|
+
ok('Fix: worktree under isolation: worktree', has(fix, 'isolation: worktree', 'git worktree'));
|
|
121
|
+
|
|
122
|
+
// --- agents point to the brief -----------------------------------------------------------------------------
|
|
123
|
+
for (const a of ['trailhead-executor', 'trailhead-fix']) {
|
|
124
|
+
const md = fs.readFileSync(path.join(plugin, 'agents', `${a}.md`), 'utf8');
|
|
125
|
+
ok(`${a}.md points to executor-brief.md`, md.includes('trailhead-work/references/executor-brief.md'));
|
|
126
|
+
}
|
|
127
|
+
const techniques = fs.readFileSync(path.join(plugin, 'skills', '_shared', 'techniques.md'), 'utf8');
|
|
128
|
+
ok('techniques.md: Execute and Fix inject executor-brief.md, not the whole step',
|
|
129
|
+
techniques.includes('trailhead-work/references/executor-brief.md'));
|
|
130
|
+
|
|
131
|
+
// --- no behaviour lost from the pre-split Execute paragraph ------------------------------------------------------
|
|
132
|
+
const both = execute + '\n' + brief;
|
|
133
|
+
for (const needle of [
|
|
134
|
+
'Prototype technique', 'FIRST', 'config.design', 'never shortcut a hosted mode to a local disk mockup',
|
|
135
|
+
'config.design.approval', '100% fidelity', 'fidelity list', 'Acceptance testing', 'Goal-backward verification',
|
|
136
|
+
'atomic commits', 'Refs: #<n>', '`git:`', 'git worktree', 'config.models.execute', '`trailhead-executor`',
|
|
137
|
+
'verify-before-install', 'TRAILHEAD_VERIFIED_INSTALL', 'block-and-ask', 'captured',
|
|
138
|
+
]) {
|
|
139
|
+
ok(`no behaviour lost: "${needle}" is in the Execute block or the brief`, both.includes(needle));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
for (const [label, src] of [['executor-brief.md', brief], ['ticket-engines.md', engines], ['techniques.md', techniques]]) {
|
|
143
|
+
ok(`${label}: no em-dash`, !src.includes('—'));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log(`execute-split-docs.test.js: ${passed} checks passed`);
|