From 498e09bb157d156700faf79b63bac008d16dd0a3 Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Wed, 14 Oct 2026 20:17:18 -0700 Subject: [PATCH] Run test fixtures' git under the scripts' scrubbed config, so a global core.autocrlf no longer fails git plan switch AI Assisted --- AGENTS.md | 1 + scripts/skill-script-helpers.mjs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c4e938c..b47892a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -98,4 +98,5 @@ When you make a mistake, get corrected, or discover something about this codebas - When a new first-run dialog is added to the web console, set its seen flag in `scripts/capture-screenshots.mjs`'s `looks.json` too: the Welcome dialog once covered the regenerated dashboard screenshots until `welcomeSeen: true` was added. - After a sync, grep for the upstream brand word on its own too, not only the full product name: the rebrand map misses a bare brand word inside identifiers and fixtures (a `KEPT__ENTRIES` constant, a `Dir` option, a `""` test folder, an owner slug in a git remote URL), and v2.7.0's sync let all four through until the residual grep caught them. - After a sync, grep for the upstream ticket key followed by anything, not only by digits: v2.8.0's git board fixtures built branch names as `` `feature/-${11000 + i}-…` `` template literals, which a digits-only rewrite to `ABC-` misses. +- Build test git fixtures with `gitIn` / `scrubbedEnv` from `scripts/skill-script-helpers.mjs`, never with the ambient git config: a global `core.autocrlf=true` checked fixtures out with CRLF that the scrubbed scripts then read as changed, failing `git plan switch` on Windows. - Before deleting a test file that upstream split or removed, diff plan2code's copy against the rebranded upstream base and port the plan2code-only tests: v2.7.0's split of the web console suite would otherwise have dropped seven hardening tests (now in `scripts/test-web-console-hardening.mjs`). diff --git a/scripts/skill-script-helpers.mjs b/scripts/skill-script-helpers.mjs index aba65ed..2fb3bd8 100644 --- a/scripts/skill-script-helpers.mjs +++ b/scripts/skill-script-helpers.mjs @@ -83,8 +83,12 @@ export function write(root, rel, content) { export const read = (root, rel) => fs.readFileSync(path.join(root, rel), "utf8"); -/** A git runner for `dir`. */ -export const gitIn = (dir) => (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", encoding: "utf8" }); +/** + * A git runner for `dir`, under the same scrubbed config the scripts get: with + * the ambient config, a global core.autocrlf=true checks files out with CRLF + * that the scripts (autocrlf off) then read as changed. + */ +export const gitIn = (dir) => (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", encoding: "utf8", env: scrubbedEnv() }); export function gitInit(dir, branch = "main") { const g = gitIn(dir);