Plan: brush leaves the distribution
Closes: #907. Relates to: #884 (the audit that ruled it), #782 (the upstream patches, which stay parked and open), #652 and #772 (the plans this reverses), #650 (the Git Bash start cost, which stays open). Branch: refactor/remove-brush. Status: Done (2026-11-24) — brush removed; Windows rows on #907 (branch equal to main in every suite, PI_WINDOWS_SHELL unread)
Context
The operator ruled on #907 (2026-11-22): "We are going to drop brush as not ready for primetime (not even opt-in) so brush language can come out everywhere." On 2026-11-24 he ruled the two things #907 left open:
-
The 19 in-tree brush issues (#755, #759, #777, #781, #796, #805, #806, #809, #810, #815, #818 to #826, #829) close as not planned, each pointing at #907. #782 stays open and parked: its patches are for brush’s upstream and do not depend on this distribution.
-
A box that had opted in gets no transitional code. The two variables stop being read and Git Bash runs. The release note says what to remove by hand.
brush was opt-in (PI_WINDOWS_SHELL=brush or PI_BRUSH=<path>) and never the default. The one seat known to have run it is panther.
Design
One rule decides every edit: after this change the tree knows one shell for the bash tool on Windows, Git Bash, as a box that never opted in has today. Where a function took a shell and branched, it keeps the "git-bash" branch as its whole behaviour.
pi-workspace
Deleted whole: windows-shell.ts, brush-shell-dir.ts, brush-refusals.ts, brush-prelude.ts, and their tests test/windows-shell.test.ts, test/brush-shell-dir.test.ts, test/brush-refusals.test.ts, test/brush-prelude.test.ts.
Four names other code needs are moved first, each into the one file that uses it:
-
bashQuoted(exported fromwindows-shell.ts) moves intocommand-file.ts, which imports it at line 29, and is no longer exported. -
ListDirectory,listDirectoryandpathDirectories(exported frombrush-prelude.ts) move intoreal-git.ts, which imports them at line 17.index.tsre-exports the three fromreal-git.ts, under the same names. Their tests move with them: the twopathDirectoriescases (brush-prelude.test.tslines 90 to 92) and the twolistDirectorycases (lines 159, 160) go intoreal-git.test.ts, unchanged in what they assert.real-git.test.tsalso importspreludeKeyandpreludeTextfrombrush-prelude.ts(line 4) for a brush case; that case and the import go.
command-file.ts: withCommandFile loses its fourth parameter (shell?: ShellChoice), the brush branch, BrushWithoutShellDirError and shellDirOf. Its body becomes: return options when needsCommandFile(platform, local.config(options.shellPath)) is false, else { …options, operations: sourcingFromFile(local.operations(options.shellPath)) }. sourcingFromFile, needsCommandFile and withBasicRepl are unchanged.
bash.ts: BASH_SHELL_CHANNEL, claimBashShell, bashShell and the ShellQuery interface go. claimBash, bashOwner and shellOptions stay.
output-cap.ts: the SHIM_PRELUDE pattern (line 30) and its clause in maxAgeOf (line 87) go, so that line reads if (COMMAND_SCRIPT.test(name)) return SCRIPT_MAX_AGE_MS;. The sweeps of pi’s output logs and the transport’s scripts stay.
index.ts: the export blocks for brush-prelude.ts (except the three moved names), brush-refusals.ts, brush-shell-dir.ts and windows-shell.ts go, with BrushWithoutShellDirError, BASH_SHELL_CHANNEL, bashShell and claimBashShell.
pinned-binary.ts keeps its code: pi-ssh’s rg and fd and pi-shellcheck’s shellcheck use it. Its header comment (line 4) stops naming brush.
The guards' shell switch (pi-modes, pi-workflow)
The type ShellKind ("git-bash" | "brush") goes with windows-shell.ts. Every parameter and field that carried it is removed, and each condition shell === "git-bash" (or shellKind === "git-bash") is deleted from its expression, leaving the rest of the condition:
-
pi-modes/authorize.ts: theshellparameter ofwritesAtHome(line 334),readAtHome(356) andshellTarget(394); theshellfield of the deps (471); the arguments at lines 268, 339, 358, 821 and 824.shellTargetbecomesplatform === "win32" ? gitBashPath(target, temp) : target, and its doc comment (lines 385 to 389) loses the sentence that begins "Under brush". -
pi-modes/judge-wiring.ts: theshelldep (line 385), its wiring (1620) and the import ofbashShellKindandShellKind(14). -
pi-workflow/commit-message.ts: theshellparameters at lines 471, 545, 591 and 639. The function at 591 becomesplatform === "win32" && !isRemote ? gitBashPath(raw, temp) : raw. -
pi-workflow/commit-pause.ts: theshellfield (line 131) and `commitShape’s parameter (229). -
pi-workflow/git-guard.ts:shellKindat lines 494 and 517 and theshellfield at 729. Line 522 becomesprocess.platform === "win32" && !ws.isRemote. -
pi-workflow/index.ts(lines 35, 170) andpi-modes/index.ts(34, 79): thebashShellKind(pi.events)calls and imports.
pi-modes/mode-policy.ts destinationSpellings (line 388) keeps its behaviour: a redirect to f::$DATA is still read as f too. The rule also holds under Git Bash, where it only restricts. Its doc comment (lines 385 to 387) and modes.adoc line 431 lose the sentence that names brush as the reason.
The bash tool’s registration (pi-workflow, pi-ssh)
pi-workflow/batch-order.ts sequentialBash (line 154): the coreutils parameter, the registerBashShell call and the BRUSH_DESCRIPTION spread go; withCommandFile is called with three arguments. registerBatchOrder, which calls it (line 186), loses its own coreutils parameter (line 182) and the doc line about it (176); only batch-order.test.ts passes that argument. The imports of BashShellDeps, BRUSH_DESCRIPTION and registerBashShell go.
pi-ssh/extension.ts: switchedBash (line 295) drops the registerBashShell call and the description spread; localBash (283) loses its shell parameter; the bashShell field of RemoteToolsDeps (82) goes. Line 380 reads the platform from process.platform. pi-ssh/remote-tools.ts line 18’s comment stops naming brush. pi-ssh/test/brush-shell.test.ts is deleted.
Erratum (2026-11-24): line 380 reads deps.platform ?? process.platform, bashShell giving way to a platform field, because tools.test.ts registers for win32 and linux on one host to cover both PowerShell branches.
pi-shellcheck
The refused-tool rule goes:
-
table.ts:REFUSED_TOOL(line 17) is removed, and with it its entries inOWN_RULES(18),ID_FORM(21) andDEFAULT_BLOCK(27). -
rules.ts:refusedTools(line 258) and the import ofREFUSED_TOOL(19). -
extension.ts: theshelldep (line 45), its use at 167, its wiring at 252, the imports ofbashShellKindandrefusalLine(20) and ofrefusedTools(24), and the waiver note’s mention ofrefused-tool.
The two delete rules and the shellcheck codes are unchanged. A settings file (gadhs-pi-shellcheck.json) naming refused-tool is then refused by config.ts idList (line 34), whose message already says what an id is: "which is not an id (SC and four digits, delete-variable or cd-then-delete)". The guard then runs on its defaults, as for any bad settings file.
The recap (pi-modes)
recap.ts: the shell?: "brush" field (line 75), the ledger’s shellOf field and constructor parameter (149 to 157), line 237, and the on brush part of formatRecap (340) go. In recapOf, the shell read (282) and the clause (shell === undefined || shell === "brush") (289) go, so a stored record that carries shell: "brush" passes the check as any record with an extra field does, and renders without the part.
Tooling, tests and CI
Deleted whole: tools/brush/ (pin.json, ci-setup.sh, 23 files in patches/, 3 in crate-patches/), tools/brush-build.mjs, tools/shell-spike/, tools/lib/suite-env.mjs with its type file tools/lib/suite-env.d.mts, and the tests tools/lib/test/brush-build.test.mjs, brush-build-crates.test.mjs, shell-field.test.mjs and suite-env.test.mjs.
tools/lib/shell-field.mjs is deleted too, after two of its five exports move: tools/lib/plain-line-field.mjs (line 17) imports bashCalls and sessionFiles from it for #888’s field count. Both, with the private resultText that bashCalls uses, move into a new tools/lib/session-calls.mjs (same names, same bodies, an SPDX header, and a header comment saying they read a session file’s bash calls), and plain-line-field.mjs imports them from there. The other three exports (sessionCounts, refusalCounts, shellFieldReport) are brush telemetry and go with the file.
-
tools/task.mjs: theshell-fieldverb (line 582), its import (38) and its header line (25). -
vitest.config.ts: the import ofsuite-env.mjs(line 3), themsysconstant, the loop overexportedFunctionNames, and thePI_WINDOWS_SHELLandMSYSentries oftest.env.suite-env.mjsexports exactly three names (msysWithoutNoglob,SUITE_WINDOWS_SHELL,exportedFunctionNames), each for a test run started from a brush session, andvitest.config.tsis their only user. -
.gitlab-ci.yml: thebrush-buildjob (lines 234 to 255) with its comment. TheRUNNER_2XLARGEvariable stays: four other jobs use it. -
packages/pi/test/distribution.test.ts: thedescribeblock "CI builds the pinned brush only when asked to (#772)" (from line 327). -
packages/pi-bash/test/bash-oracle.ts:BRUSHandBRUSH_PRESENT(lines 20, 21) and their comment.differential.test.ts: the seconddifferentialSuitecall (110), the import, the comment at 23, and the half of `differentialSuite’s doc comment (lines 74, 75) that names brush as a second oracle.
Tests that mix brush cases with others lose the brush cases and keep the rest:
-
pi-workspace:
command-file.test.ts,bash.test.ts,output-cap.test.ts,real-git.test.ts,pinned-binary.test.ts(one mention, a comment). -
pi-shellcheck:
extension.test.ts,rules.test.tsandtable.test.ts(therefused-toolcases). -
pi-modes:
recap.test.ts,authorize.test.ts(theshellTargetbrush case at lines 1072 to 1075),rule-precedence.test.ts. -
pi-workflow:
batch-order.test.ts,git-guard.test.ts,git-guard-repo.test.ts.commit-message.tshas no test file of its own; these suites cover it. -
pi-ssh:
tools.test.ts,connection.test.ts. -
tools:
tools/lib/test/public-surface.test.mjs.
Docs
-
workflow-guards.adoc: the passage from the[#windows-shell]anchor (line 48) to the line before "Monitors, jobs and!keep Git Bash" (about line 338) is replaced, under the same anchor, by: "On Windows the bash tool runs Git Bash. From #652 to #907 a box could opt in to brush, a native bash-compatible shell; it was removed as not ready." The sentence before the anchor ends at "and pays its start." The "Monitors, jobs" paragraph stays without "keep". -
tuning.adoc: the section "The bash tool’s shell on Windows" (lines 1242 to 1263) keeps its anchor and heading and the same two sentences. -
ssh.adoc(line 159) andtools.adoc(line 177): each sentence that says "where the bash tool runs brush" is cut to what holds under Git Bash; their links to#windows-shellgo with the clause.ssh.adocline 173 loses "and brush’s shim preludes (#757)", as the sweep no longer removes them. -
shell-guard.adoc: therefused-toolrow (line 75) and its two other mentions. -
session.adoc: theon brushclause. -
security.adoc(lines 356 to about 391): the brush build’s paragraphs; the pinned-release sentence names rg, fd and shellcheck. -
testing.adoc(lines 204 to 216): the brush differential andbrush-shell.test.ts. -
packages.adoc(lines 127 to 132),public-surface.adoc(thePI_BRUSHandPI_WINDOWS_SHELLrows;MSYSandPI_OFFLINElose theirwindows-shell.tsmention; pi-workspace’s export list),modes.adoc(line 431),vertex.adoc(line 20, "brush not tried"). -
local-dev.adoc: no brush mention; unchanged. -
Plans are records.
plans/brush-windows-shell.adocandplans/brush-own-build.adoceach get StatusN/Aand a first line "Erratum (date): brush was removed by #907."nav.adockeeps listing them.plans/shell-guard.adocandplans/public-surface.adocmention brush in passing and are not edited.
What the release note says
Under Removed: brush is gone; the bash tool on Windows runs Git Bash. A box that had opted in should unset PI_WINDOWS_SHELL and PI_BRUSH, which are no longer read, and may delete <agentDir>/gadhs-pi-shell/. A gadhs-pi-shellcheck.json that names refused-tool must drop it. The shell-field task verb is gone.
Scope
One branch, one MR, five commits. Each leaves the tree passing validate.
-
pi-workspace: move the four names; delete the four files and their tests; trim
command-file.ts,bash.ts,output-cap.ts,index.ts. In the same commit, because they import the removed names: the shell switch in pi-modes and pi-workflow, the registration inbatch-order.tsand pi-ssh,refused-toolin pi-shellcheck,on brushin the recap, and each package’s tests. -
Tooling:
tools/brush/,tools/brush-build.mjs,tools/shell-spike/,shell-field(aftersession-calls.mjstakes its two shared exports),suite-envand its type file,vitest.config.ts, pi-bash’s second oracle. -
CI: the
brush-buildjob and `distribution.test.ts’s block. -
Docs, the two plans' Status, the release note.
-
This plan’s Status to Done.
Erratum (2026-11-24): the CI commit comes before the tooling commit, because distribution.test.ts reads tools/brush/pin.json.
Erratum (2026-11-24): public-surface.adoc’s rows for `PI_BRUSH, PI_WINDOWS_SHELL, MSYS (read only by windows-shell.ts) and gadhs:bash-shell move into the first commit, because public-surface.test.mjs fails while the page names what the code no longer reads.
After the merge: close the 19 issues, each with one line pointing at #907.
Risks
| Risk | Mode | Mitigation |
|---|---|---|
A Git Bash path stops being translated on Windows, because a removed |
fail-open |
Each edit deletes only the |
A box with |
silent |
Accepted by the operator’s ruling (no transitional code). The release note names the variables; panther, the one known seat, is told on the bus. |
A |
fail-closed |
|
A stored recap with |
silent |
|
A moved helper is missed and a package fails to load after install, or a tool imports a deleted file |
fail-closed |
tsc over every package, then consumer-sim, which loads every extension from the installed tree. For the tools, which tsc does not cover: the search for imports of each deleted file named under Tests, and |
Deleting |
silent |
Its three guards existed for a run started from a brush session. With no brush there is no such session; |
The redirect rule for |
fail-open |
The plan keeps |
Tests
-
Regression:
-
a recap record stored with
shell: "brush"is accepted byrecapOfand rendered without an "on brush" part (recap.test.ts); -
parseConfig({ block: ["refused-tool"] })is refused, with"refused-tool"in the message (pi-shellcheck/test/extension.test.ts, beside its otherparseConfigcases); -
withCommandFileon win32 with Git Bash’s config returns operations that source from a file, and on linux returns the options as given (command-file.test.ts).
-
-
Contract:
-
public-surface.test.mjs: the page and the code agree, and neither listsPI_BRUSHorPI_WINDOWS_SHELL; -
distribution.test.tsholds nobrush-buildexpectation, and.gitlab-ci.ymlno such job; -
listDirectoryandpathDirectorieskeep their behaviour: their four cases, moved intoreal-git.test.ts, pass unchanged; -
plain-line-field.test.mjspasses unchanged, importing nothing from a deleted file: its two session-file rows ("3 bash call(s)", "1 bash call(s)") are whatbashCallsandsessionFilesproduce from their new home; -
no import in the tree names a deleted file: a search for
shell-field,suite-env,windows-shell,brush-prelude,brush-refusalsandbrush-shell-dirfinds no import line, and tsc and the tools' suites agree.
-
-
Unchanged, the proof nothing else moved: the Git Bash cases of
authorize.test.ts,git-guard.test.ts,git-guard-repo.test.ts,batch-order.test.ts, pi-ssh’stools.test.ts, the::$DATAcases, and pi-bash’s bash differential. -
Removed with the feature: the brush-only suites named under Design. Each tested brush itself, so none is a weakened test.
-
Windows: pi-win runs pi-workspace, pi-modes, pi-workflow, pi-ssh and pi-shellcheck on panther, main against the branch, and one real session’s
bashcall on a staged install. -
Whole: validate (both runs) and consumer-sim, 27 rows.
-
The one-shell rule, checked by a search after the change:
brushappears in the tree only inCHANGELOG.adoc, the plans directory,nav.adoc’s two plan lines, and the two-sentence note under `#windows-shellinworkflow-guards.adocandtuning.adoc.
Erratum (2026-11-24): the recap regression above stores shell: "brush" by its nature, so recap.test.ts is a sixth place the search finds it.
Delivery
-
Canonical page:
workflow-guards.adoc(the#windows-shellanchor), with the pages listed under Docs. -
CHANGELOG, Removed: the release note above.
-
The plan is committed to
docs/modules/ROOT/pages/plans/remove-brush.adocon approval and listed innav.adoc. -
MR with
Closes #907; the merge SHA noted on #907; then the 19 issues closed with a pointer. Released as a minor: pi-workspace, pi-modes, pi-workflow, pi-ssh and pi-shellcheck change, and their dependents move with them.