Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
v1.92.48.0 fix(windows): review-scope summary runs gstack-review-read through Git Bash; jsonl-merge writes UTF-8 with LF (#3541, #3659) (#3714)
Garry Tan0000b49ebebe
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dab48b0c1..8b7b4b6d1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,18 @@# Changelog+## [1.92.48.0] - 2026-11-01++**On Windows, `gstack-review-scope summary` works again, and the JSONL merge driver no longer fails on non-English text or rewrites files with CRLF.** Before, the summary started the bash script `gstack-review-read` directly, which Windows cannot run, so it always refused with an empty "gstack-review-read failed:" message and /ship could not write its review-loop file (#3541). The `jsonl-append` merge driver wrote its result with Python's `print()`, so a line the console code page could not encode (Cyrillic text under cp1250, for example) made it exit 1 and git reported a conflict with no markers, and every merge on Windows turned LF files into CRLF (#3659).++### Fixed+- **`gstack-review-scope summary`** runs `gstack-review-read` through `lib/script-invocation.ts` (Git Bash on Windows). When the helper cannot start, the refusal names the launch error instead of an empty string.+- **`gstack-jsonl-merge`** writes UTF-8 bytes with LF line endings on every platform and code page.++### Tests+- `test/review-scope-windows-launch.test.ts` runs the summary against a seeded review log through the same launcher; it runs on windows-latest.+- `test/jsonl-merge-encoding.test.ts` merges a Cyrillic line with `PYTHONIOENCODING=cp1252` and checks the bytes are UTF-8 with no CR. It failed before the fix on Linux too.+- `test/script-invocation-tripwire.test.ts` now also catches a bin spawned through `path.join(path.dirname(...import.meta.url...), ...)` or `import.meta.dir`, the shape that hid #3541. `bin/gstack-ship-receipt`'s `gstack-session-kind` spawn is listed as a known site until its own follow-up.+## [1.92.47.0] - 2026-11-01- **`/ship` Step 5 runs its test lanes one at a time on machines with 4 or fewer cores, and `--lanes serial|parallel` picks the mode by hand** (`gstack-ship-preflight`, GST-851). Preflight used to start every `--lane` at once. On garrytan/gstack-evals#115 six lanes (a 1,451-test bun suite, tsc, a Docker tier and an arm tarball trial) started within 60 ms of each other on a 4-core, 16 GB machine, and running lanes together has taken machines down before (gstack-evals #101, #106, #107). Now, with no flag, preflight runs one lane at a time when `os.availableParallelism()` is 4 or less and all of them at once above that. `--lanes serial` or `--lanes parallel` overrides the default, and any other value, or `--lanes` with no value, is a usage error (exit 2). A new `LANES: serial|parallel (--lanes|<n> cores)` line before the `LANE` lines says which mode ran and why. Each lane still prints its own `LANE` line with its own `tests_ran` count, in the order the lanes were given. Serial runs take the sum of the lane times instead of the longest one. There is no ship-policy key for this: a new key needs key versioning and a `min_gstack_version` bump, and the core-count default already covers the 4-core case.diff --git a/VERSION b/VERSIONindex f0f525626..c8b62ecd0 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.92.47.0+1.92.48.0diff --git a/agents-digest/gstack-AGENTS.md b/agents-digest/gstack-AGENTS.mdindex f4e17a48a..7572774f2 100644--- a/agents-digest/gstack-AGENTS.md+++ b/agents-digest/gstack-AGENTS.md@@ -1,4 +1,4 @@-# gstack digest v1.92.47.0 — regenerate/re-copy after upgrading gstack+# gstack digest v1.92.48.0 — regenerate/re-copy after upgrading gstackBehavioral rules from gstack (https://github.com/garrytan/gstack), compressedfor agent hosts without a full skill install. The full skills add workflows,diff --git a/bin/gstack-jsonl-merge b/bin/gstack-jsonl-mergeindex ce439d2ac..4a7074186 100755--- a/bin/gstack-jsonl-merge+++ b/bin/gstack-jsonl-merge@@ -91,8 +91,12 @@ for path in paths:sys.exit(1)# Timestamp-ordered entries first (group 0), then hash-ordered (group 1).+# UTF-8 bytes and LF on every platform: print() encodes with the stdout code+# page and writes CRLF on Windows (#3659).+out = sys.stdout.bufferfor line, _ in sorted(seen.items(), key=lambda item: item[1]):- print(line)+ out.write(line.encode('utf-8') + b'\n')+out.flush()PYEOF_PYEXIT=$?diff --git a/bin/gstack-review-scope b/bin/gstack-review-scopeindex 3d4c843b6..fb2f2388e 100755--- a/bin/gstack-review-scope+++ b/bin/gstack-review-scope@@ -23,6 +23,7 @@ import * as fs from 'node:fs';import * as path from 'node:path';import { EXIT, exitTableHelp } from '../lib/headless-artifacts';import { resultLineWithDocs } from '../lib/result-codes';+import { runScriptSync } from '../lib/script-invocation';import { isUnavailable, loadPolicyFromBase, policyUnavailableLine, resolveBaseBranch } from '../lib/ship-policy';import { EXIT as POST_EXIT, runPost } from '../lib/gstack-post';import {@@ -237,8 +238,8 @@ function cmdRender(rest: string[]): number {function cmdSummary(rest: string[], json: boolean): number {const since = flag(rest, '--since');if (!since || !Number.isFinite(Date.parse(since))) return refuse('summary', 'REVIEW_SCOPE_INPUT', '--since <ISO-8601 timestamp> (the invocation\'s first Step 9 entry) is required');- const read = spawnSync(path.join(path.dirname(Bun.fileURLToPath(import.meta.url)), 'gstack-review-read'), [], { encoding: 'utf8', timeout: 60_000, maxBuffer: 64 * 1024 * 1024 });- if (read.status !== 0) return refuse('summary', 'REVIEW_SCOPE_INPUT', `gstack-review-read failed: ${(read.stderr ?? '').trim().split('\n')[0] ?? ''}`);+ const read = runScriptSync(path.join(path.dirname(Bun.fileURLToPath(import.meta.url)), 'gstack-review-read'), [], { encoding: 'utf8', timeout: 60_000, maxBuffer: 64 * 1024 * 1024 });+ if (read.status !== 0) return refuse('summary', 'REVIEW_SCOPE_INPUT', `gstack-review-read failed: ${read.error?.message ?? (read.stderr ?? '').trim().split('\n')[0] ?? ''}`);const rows: Record<string, unknown>[] = [];for (const line of (read.stdout ?? '').split('---CONFIG---')[0]!.split('\n')) {if (!line.trim() || line === 'NO_REVIEWS') continue;diff --git a/package.json b/package.jsonindex 6ede975a2..d1c96934b 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "gstack",- "version": "1.92.47",+ "version": "1.92.48","description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.","license": "MIT","type": "module",diff --git a/scripts/lib/windows-curation.ts b/scripts/lib/windows-curation.tsindex 04e37cac3..46331d6fd 100644--- a/scripts/lib/windows-curation.ts+++ b/scripts/lib/windows-curation.ts@@ -402,6 +402,8 @@ export const KNOWN_WINDOWS_SAFE: Array<{ file: string; reason: string }> = [{ file: 'test/cso-windows-docker.test.ts', reason: '/cso docker.exe discovery under known-folder roots (real path, no reparse points) and the native-transport-unsupported outcome; pure win32 path logic' },{ file: 'test/copilot-windows-bash.test.ts', reason: 'the Copilot glossary line that runs bash blocks in Git for Windows Bash; reads host config only' },{ file: 'test/ship-hook-windows-paths.test.ts', reason: 'runs bin/ helpers through explicit bash and Bun argv with forward-slash paths; never executes a shebang; the path-spelling simulation is skipIf win32' },+ { file: 'test/review-scope-windows-launch.test.ts', reason: '#3541: runs gstack-review-scope through lib/script-invocation.ts, which must reach the bash gstack-review-read through Git Bash (red at main: windows-free-shard 3, run 41228091417); os.tmpdir state only' },+ { file: 'test/jsonl-merge-encoding.test.ts', reason: '#3659: runs gstack-jsonl-merge through lib/script-invocation.ts (Git Bash on win32); the CRLF half of the bug only reproduces with a Windows Python' },{ file: 'test/gstack-wtree-windows-paths.test.ts', reason: '#3101: runs bin/gstack-wtree through explicit bash in an os.tmpdir linked worktree with forward-slash paths; never executes a shebang; the drive-letter simulation is skipIf win32' },{ file: 'test/setup-hook-syntax-gate.test.ts', reason: '#3088/#3100: runs bin/gstack-hook-check and the setup hook sections through explicit bash with forward-slash paths; never executes a shebang. Its Bun drive-path spelling is the Windows bug it guards' },{ file: 'test/bun-config-shell-bins.test.ts', reason: '#3415: runs the record bins through lib/script-invocation.ts (Git Bash on Windows) with MSYS path conversion off, the case it guards; its bun and cygpath stand-ins and simulated-OSTYPE cases are skipIf win32' },diff --git a/test/jsonl-merge-encoding.test.ts b/test/jsonl-merge-encoding.test.tsnew file mode 100644index 000000000..3728e9a23--- /dev/null+++ b/test/jsonl-merge-encoding.test.ts@@ -0,0 +1,41 @@+/**+ * #3659: gstack-jsonl-merge read its inputs as UTF-8 but wrote them with+ * print(), so a redirected stdout on a legacy code page (cp1250 on the+ * reporter's Windows) raised UnicodeEncodeError on a Cyrillic line, and any+ * Windows Python rewrote LF as CRLF. The driver must write UTF-8 with LF+ * whatever the platform and code page. PYTHONIOENCODING=cp1252 reproduces the+ * legacy code page on every OS.+ *+ * Windows-safe by construction: the driver launches through+ * lib/script-invocation.ts (Git Bash on win32), files live under os.tmpdir().+ */+import { afterEach, beforeEach, expect, test } from 'bun:test';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';+import { runScriptSync } from '../lib/script-invocation';++const ROOT = path.resolve(import.meta.dir, '..');+let tmp = '';++beforeEach(() => { tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-jsonl-enc-'))); });+afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }));++test('a line the stdout code page cannot encode merges as UTF-8 with LF endings (#3659)', () => {+ const base = '{"ts":"2026-01-01T00:00:00Z","note":"base"}\n';+ const ours = base + '{"ts":"2026-01-02T00:00:00Z","note":"ours"}\n';+ const theirsLine = '{"ts":"2026-01-03T00:00:00Z","note":"привет"}';+ const p = (n: string) => path.join(tmp, n);+ fs.writeFileSync(p('base'), base);+ fs.writeFileSync(p('ours'), ours);+ fs.writeFileSync(p('theirs'), base + theirsLine + '\n');+ const posix = (f: string) => f.replace(/\\/g, '/');+ const r = runScriptSync(path.join(ROOT, 'bin', 'gstack-jsonl-merge'), [posix(p('base')), posix(p('ours')), posix(p('theirs'))], {+ env: { ...process.env, PYTHONIOENCODING: 'cp1252', PYTHONUTF8: '0' }, encoding: 'utf8', timeout: 60_000,+ });+ expect(r.error).toBeUndefined();+ expect(r.status, r.stderr).toBe(0);+ const bytes = fs.readFileSync(p('ours'));+ expect(bytes.includes(0x0d)).toBe(false);+ expect(bytes.toString('utf8')).toBe(ours + theirsLine + '\n');+});diff --git a/test/review-scope-windows-launch.test.ts b/test/review-scope-windows-launch.test.tsnew file mode 100644index 000000000..68c077bd5--- /dev/null+++ b/test/review-scope-windows-launch.test.ts@@ -0,0 +1,60 @@+/**+ * #3541: `gstack-review-scope summary` reads the review log through+ * gstack-review-read, a bash script. Spawned by path it never starts on+ * Windows (no shebangs), so summary always refused with an empty+ * "gstack-review-read failed:" and /ship could not write its review-loop file.+ *+ * Windows-safe by construction: both bins launch through+ * lib/script-invocation.ts (Git Bash on win32), state lives under os.tmpdir().+ */+import { afterEach, beforeEach, expect, test } from 'bun:test';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';+import { spawnSync } from 'node:child_process';+import { runScriptSync } from '../lib/script-invocation';++const ROOT = path.resolve(import.meta.dir, '..');+const SLUG = 'review-scope-launch';++let tmp = '', repo = '', state = '', env: NodeJS.ProcessEnv = {};++beforeEach(() => {+ tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-rs-launch-')));+ repo = path.join(tmp, 'repo');+ state = path.join(tmp, 'state');+ fs.mkdirSync(repo);+ fs.mkdirSync(path.join(state, 'projects', SLUG), { recursive: true });+ const gitconfig = path.join(tmp, 'gitconfig');+ fs.writeFileSync(gitconfig, '');+ env = {+ ...process.env, HOME: tmp, USERPROFILE: tmp, GSTACK_STATE_ROOT: state, GSTACK_HOME: state, GSTACK_PROJECT_SLUG: SLUG,+ GIT_CONFIG_GLOBAL: gitconfig, GIT_CONFIG_NOSYSTEM: '1', GIT_DIR: undefined, GIT_WORK_TREE: undefined, GIT_INDEX_FILE: undefined,+ };+ const git = (...args: string[]) => {+ const r = spawnSync('git', args, { cwd: repo, env, encoding: 'utf8', timeout: 30_000 });+ expect(r.status, r.stderr).toBe(0);+ };+ git('init', '-q', '-b', 'feat');+ fs.writeFileSync(path.join(repo, 'a.txt'), 'a\n');+ git('add', 'a.txt');+ git('-c', '[email protected]', '-c', 'user.name=Fixture', '-c', 'commit.gpgsign=false', 'commit', '-qm', 'fixture');+});++afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }));++test('summary reads the review log through gstack-review-read (#3541)', () => {+ const rows = [+ { skill: 'review', via: 'ship', timestamp: '2026-10-26T10:00:00Z', review_scope: 'frozen', findings: [{ fingerprint: 'a:1:x', blocking: true, action: 'fixed' }] },+ { skill: 'review', via: 'ship', timestamp: '2026-10-26T10:30:00Z', review_scope: 'frozen', findings: [] },+ ];+ fs.writeFileSync(path.join(state, 'projects', SLUG, 'feat-reviews.jsonl'), rows.map(r => JSON.stringify(r)).join('\n') + '\n');+ const out = path.join(tmp, 'review-loop.json');+ const r = runScriptSync(path.join(ROOT, 'bin', 'gstack-review-scope'), ['summary', '--since', '2026-10-26T09:00:00Z', '--out', out, '--json'], {+ cwd: repo, env, encoding: 'utf8', timeout: 120_000,+ });+ expect(r.error).toBeUndefined();+ expect(r.status, r.stderr).toBe(0);+ const summary = JSON.parse(fs.readFileSync(out, 'utf8'));+ expect(summary).toMatchObject({ passes: 2, blocking_found: 1, fixed: 1, scope: 'frozen' });+}, 150_000);diff --git a/test/script-invocation-tripwire.test.ts b/test/script-invocation-tripwire.test.tsindex 3b14106d8..f7e0a2b2d 100644--- a/test/script-invocation-tripwire.test.ts+++ b/test/script-invocation-tripwire.test.ts@@ -18,7 +18,7 @@ import * as path from 'node:path';const ROOT = path.resolve(import.meta.dir, '..');-const SPAWN_BIN_BY_PATH = /\b(?:spawn|spawnSync|execFile|execFileSync)\(\s*(?:path\.)?join\(\s*(?:BIN_DIR|binDir|BIN|bin|binRoot|BIN_ROOT)\b/;+const SPAWN_BIN_BY_PATH = /\b(?:spawn|spawnSync|execFile|execFileSync)\(\s*(?:path\.)?join\(\s*(?:(?:BIN_DIR|binDir|BIN|bin|binRoot|BIN_ROOT)\b|(?:path\.)?dirname\(|import\.meta\.dir\b)/;const SPAWN_BARE_BASH = /\b(?:spawn|spawnSync|execFile|execFileSync|execSync)\(\s*['"]bash['"]|Bun\.spawn(?:Sync)?\(\s*\[\s*['"]bash['"]|\[\s*['"]bash['"]\s*,\s*['"]-l?c['"]/;const COMMENT = /^\s*(?:\/\/|\*|\/\*)/;/** `const X = path.resolve(…, 'bin', 'gstack-…')`: a bin path held in a constant, then spawned by name (#3190's gstack-config). */@@ -34,6 +34,8 @@ const KNOWN_SITES: Record<string, string> = {'bin/gstack-issue-links': 'outside this wave: the gstack-issue-guard spawn moves to runScriptSync',// Found when the bin-constant rule was added (fix wave PR 5, item 10b).'bin/gstack-brain-cache': 'outside this wave: the gstack-config salience read moves to runScriptSync',+ // Found when the scanner learned the import.meta.url bin path (#3541).+ 'bin/gstack-ship-receipt': 'the gstack-session-kind spawn moves to runScriptSync in the #3541 ship-receipt follow-up','lib/autoplan-admission.ts': 'returns before the spawn on win32; the bin/gstack-lease touch moves to runScriptSync with that bin\'s owner',};@@ -88,6 +90,8 @@ describe('#3197: shebang bins and bash go through lib/script-invocation.ts', ()test('the scanner catches both shapes', () => {expect(SPAWN_BIN_BY_PATH.test("spawnSync(path.join(BIN_DIR, 'gstack-wtree'), [], { timeout: 1 })")).toBe(true);expect(SPAWN_BIN_BY_PATH.test('spawnSync(join(BIN_DIR, "gstack-slug"), { timeout: 1 })')).toBe(true);+ expect(SPAWN_BIN_BY_PATH.test("spawnSync(path.join(path.dirname(Bun.fileURLToPath(import.meta.url)), 'gstack-review-read'), [], { timeout: 1 })")).toBe(true);+ expect(SPAWN_BIN_BY_PATH.test("spawnSync(join(import.meta.dir, 'gstack-slug'), [], { timeout: 1 })")).toBe(true);expect(SPAWN_BARE_BASH.test("spawnSync('bash', ['-c', cmd], { timeout: 1 })")).toBe(true);expect(SPAWN_BARE_BASH.test('const argv = ["bash", "-c", command];')).toBe(true);expect(SPAWN_BARE_BASH.test("spawnSync(process.execPath, [script], { timeout: 1 })")).toBe(false);