feat: wire headroom token-saving into gx (advisory part + GUARDEX_COMPRESS_CMD)#649
Merged
NagyVikt merged 1 commit intoJun 18, 2026
Conversation
…PRESS_CMD) Two backward-compatible layers, both graceful when headroom is absent (gitguardex is published, so headroom is never a hard dependency): Advisory: add a prompt-only 'headroom' part to AI_SETUP_PARTS (mirrors the rtk part) + compress/compression/headroom-mcp aliases, and a headroom bullet in the managed AGENTS companion-tooling block. Teaches agents to route large gx output / logs / dumps through headroom_compress (reversible) when present. Runtime: src/output gains resolveCompressCommand/compressBlock/printCompressible; gx prompt --snippet now routes through compressBlock. When GUARDEX_COMPRESS_CMD is set, gx pipes large narrative output through that filter (shell:false argv, timeout, fail-open). Gated on terse/non-TTY mode + size threshold; never compresses machine-readable (JSON) output or the --exec path. Unset = output is byte-for-byte identical to today. Tests: 23 pass (compressBlock unit coverage incl. passthrough/transform/ fail-open/json-skip/threshold/terse-gate; prompt integration for the part, aliases, exec rejection, and snippet compression). OpenSpec: agent-claude-wire-headroom-token-saving-skills-into-g-2026-06-18-10-50
NagyVikt
added a commit
that referenced
this pull request
Jun 18, 2026
) resolveCompressCommand split the command on whitespace, so a value with quoted args (e.g. sh -c "tr a-z A-Z") was mis-split into broken argv. Add tokenizeCommand: honors single/double quotes + backslash escapes, returns null on malformed input (unterminated quote or dangling backslash) so the caller falls back to plain, uncompressed output. argv still runs via spawnSync shell:false (no shell injection). Unset/plain values unchanged. Tests: +5 (quoted parsing, malformed->null, quoted end-to-end transform, deterministic timeout/partial-stdout fallback). 28 pass, 0 fail. Follow-up to #649. Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
This was referenced Jun 19, 2026
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
…653) * chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
* chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(doctor): add token-compression health check Complements the gx status visibility (PR #653) on the diagnose-and-repair surface. gx doctor now reports the GUARDEX_COMPRESS_CMD setup: - Human output: a `Token compression` line after the system-tool status — a warn-colored advisory when the configured binary is not on PATH, otherwise a plain "configured" line. Silent when unset. - JSON payload (single-repo): new `compression` field via describeCompressor(); recursive runs inherit it through each child. - Advisory only: a missing compressor never changes doctor's safe/unsafe exit code (compression is an optimization, not a safety guarantee). Docs: SKILL/AGENTS note both `gx status` and `gx doctor` verify the wiring. Verified: 3 new tests (missing-binary advisory + non-gating exit, configured/unset, --json field); lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
* chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(doctor): add token-compression health check Complements the gx status visibility (PR #653) on the diagnose-and-repair surface. gx doctor now reports the GUARDEX_COMPRESS_CMD setup: - Human output: a `Token compression` line after the system-tool status — a warn-colored advisory when the configured binary is not on PATH, otherwise a plain "configured" line. Silent when unset. - JSON payload (single-repo): new `compression` field via describeCompressor(); recursive runs inherit it through each child. - Advisory only: a missing compressor never changes doctor's safe/unsafe exit code (compression is an optimization, not a safety guarantee). Docs: SKILL/AGENTS note both `gx status` and `gx doctor` verify the wiring. Verified: 3 new tests (missing-binary advisory + non-gating exit, configured/unset, --json field); lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * test(pr): cover the gx pr command layer (parse + format helpers) src/cli/commands/pr.js was ~9% covered — pr-module.test.js only exercises the gh-facing logic in src/pr.js. Adds network-free unit tests for the command layer's pure helpers: - parsePrArgs: defaults, value flags, --branch/--head alias, boolean toggles, and validation paths (--merge-strategy, --timeout, --interval reject bad values; seconds->ms conversion). - renderChecksLine: empty/zero, multi-bucket join, count fallback. - printUsage: lists all subcommands. 10 tests, all pass; lint clean. New isolated test file, no src changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
* chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(doctor): add token-compression health check Complements the gx status visibility (PR #653) on the diagnose-and-repair surface. gx doctor now reports the GUARDEX_COMPRESS_CMD setup: - Human output: a `Token compression` line after the system-tool status — a warn-colored advisory when the configured binary is not on PATH, otherwise a plain "configured" line. Silent when unset. - JSON payload (single-repo): new `compression` field via describeCompressor(); recursive runs inherit it through each child. - Advisory only: a missing compressor never changes doctor's safe/unsafe exit code (compression is an optimization, not a safety guarantee). Docs: SKILL/AGENTS note both `gx status` and `gx doctor` verify the wiring. Verified: 3 new tests (missing-binary advisory + non-gating exit, configured/unset, --json field); lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * test(pr): cover the gx pr command layer (parse + format helpers) src/cli/commands/pr.js was ~9% covered — pr-module.test.js only exercises the gh-facing logic in src/pr.js. Adds network-free unit tests for the command layer's pure helpers: - parsePrArgs: defaults, value flags, --branch/--head alias, boolean toggles, and validation paths (--merge-strategy, --timeout, --interval reject bad values; seconds->ms conversion). - renderChecksLine: empty/zero, multi-bucket join, count fallback. - printUsage: lists all subcommands. 10 tests, all pass; lint clean. New isolated test file, no src changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * fix(sandbox): recover stranded worktree dirs during cleanup instead of stranding the branch cleanupProtectedBaseSandbox (used by gx doctor + the shared sandbox finalizer — the recovery flows the README flags as rough) treated a `git worktree remove` non-zero exit as fatal. After a crash or partial manual cleanup, the path can exist on disk while git no longer tracks it as a worktree; `git worktree remove` then fails with "is not a working tree", the function throws, and the branch-delete step never runs — leaving a leaked branch and a half-finished cleanup. Now: on a non-spawn-failure remove error, prune stale worktree metadata, remove the leftover directory (both idempotent), set worktree='pruned', and continue to branch deletion. Spawn failures (missing git) still throw. Happy path is byte-for-byte unchanged. Tests: new test/sandbox-cleanup.test.js covers happy-path removal, stranded-dir recovery (threw before the fix), and missing-metadata no-op. Full suite: no new failures (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
* chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(doctor): add token-compression health check Complements the gx status visibility (PR #653) on the diagnose-and-repair surface. gx doctor now reports the GUARDEX_COMPRESS_CMD setup: - Human output: a `Token compression` line after the system-tool status — a warn-colored advisory when the configured binary is not on PATH, otherwise a plain "configured" line. Silent when unset. - JSON payload (single-repo): new `compression` field via describeCompressor(); recursive runs inherit it through each child. - Advisory only: a missing compressor never changes doctor's safe/unsafe exit code (compression is an optimization, not a safety guarantee). Docs: SKILL/AGENTS note both `gx status` and `gx doctor` verify the wiring. Verified: 3 new tests (missing-binary advisory + non-gating exit, configured/unset, --json field); lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * test(pr): cover the gx pr command layer (parse + format helpers) src/cli/commands/pr.js was ~9% covered — pr-module.test.js only exercises the gh-facing logic in src/pr.js. Adds network-free unit tests for the command layer's pure helpers: - parsePrArgs: defaults, value flags, --branch/--head alias, boolean toggles, and validation paths (--merge-strategy, --timeout, --interval reject bad values; seconds->ms conversion). - renderChecksLine: empty/zero, multi-bucket join, count fallback. - printUsage: lists all subcommands. 10 tests, all pass; lint clean. New isolated test file, no src changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * fix(sandbox): recover stranded worktree dirs during cleanup instead of stranding the branch cleanupProtectedBaseSandbox (used by gx doctor + the shared sandbox finalizer — the recovery flows the README flags as rough) treated a `git worktree remove` non-zero exit as fatal. After a crash or partial manual cleanup, the path can exist on disk while git no longer tracks it as a worktree; `git worktree remove` then fails with "is not a working tree", the function throws, and the branch-delete step never runs — leaving a leaked branch and a half-finished cleanup. Now: on a non-spawn-failure remove error, prune stale worktree metadata, remove the leftover directory (both idempotent), set worktree='pruned', and continue to branch deletion. Spawn failures (missing git) still throw. Happy path is byte-for-byte unchanged. Tests: new test/sandbox-cleanup.test.js covers happy-path removal, stranded-dir recovery (threw before the fix), and missing-metadata no-op. Full suite: no new failures (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * chore(openspec): archive 33 completed changes The openspec/changes/ directory had accumulated completed-but-unarchived changes — every one of these had all Specification + Implementation + Verification tasks checked, with only the cleanup/PR section outstanding, and spot-checks confirmed the work landed on main. A cluttered active- changes dir costs tokens for every agent that reads it. Moves each completed change to openspec/changes/archive/2026-06-20-<slug>/ (git renames; date prefix = archive date, matching the existing archive convention). Two changes are intentionally left active: - opt-in-merge-gate (Specification/Implementation/Verification unchecked). - codex-auto-bump (Verification 3.2 `npm test` unchecked — unconfirmed). Docs-only; no code or test references the moved slugs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
NagyVikt
added a commit
that referenced
this pull request
Jun 20, 2026
* chore: add Biome lint + coverage CI and frontend SEO/GEO CLI guardrails: - Add Biome 1.9.4 with a green-baseline config (recommended rules on, currently-violated stylistic rules disabled) so CI catches new issues without churning 85 existing files. Adds lint/format/format:check scripts. - Add test:coverage script (node --experimental-test-coverage) and wire Lint + coverage steps into the PR CI workflow. - Expand npm keywords for package discoverability. Frontend SEO/GEO: - Enrich root metadata: metadataBase, canonical, OpenGraph, Twitter card, robots directives, viewport, and SoftwareApplication JSON-LD. - Add robots.ts and sitemap.ts metadata routes. - Add public/llms.txt for generative-engine optimization. - Site origin is overridable via NEXT_PUBLIC_SITE_URL. Verified: biome lint clean, frontend tsc --noEmit clean. The 22 failing tests are pre-existing in this sandbox (env-specific) and unrelated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(prompt): compress full gx prompt narrative + document rtk wrapping Extends the existing GUARDEX_COMPRESS_CMD hook (which only covered `gx prompt --snippet`) to the rest of the narrative prompt surface: - `gx prompt` (default 3KB checklist) and the deprecated `copy-prompt` now route through compressBlock — the biggest blob agents read each session. - `gx prompt --exec` and `copy-commands` stay raw: they emit shell-ready commands a compressor would corrupt. status/doctor are left untouched (structured, colorized, line-by-line — not safe to bulk-compress). Instructions: add concrete rtk gx-command wrapping examples (rtk gx status / doctor) and the GUARDEX_COMPRESS_CMD self-compress note to the gitguardex SKILL and the managed AGENTS companion-tooling block. Tests: default-prompt compression + --exec-stays-raw regressions. Verified: targeted tests 58/58 pass, lint clean, codex/root SKILL parity held, no new failures in the full suite (22 pre-existing env-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(status): surface GUARDEX_COMPRESS_CMD token-compression health The compression hook (PR #649/#652) fails open: when GUARDEX_COMPRESS_CMD is set but the binary is missing/misconfigured, gx silently prints raw output and quietly wastes the tokens the feature was meant to save — with no way to notice. `gx status` now makes it observable. - New output helpers: `describeCompressor(env)` reports {configured, command, available}; `isExecutableOnPath` is a defensive, cross-platform (PATHEXT-aware) lookup that returns null on any error. - `gx status` adds a `compression` field to the JSON payload and, when configured, prints a `Token compression` line — degraded when the binary is not found on PATH. Silent (no line) when unset, so the common case stays noise-free. - SKILL/AGENTS docs note that `gx status` verifies the wiring. Verified: 6 new tests (output unit + status JSON/human), all pass; lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific to the sandbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * feat(doctor): add token-compression health check Complements the gx status visibility (PR #653) on the diagnose-and-repair surface. gx doctor now reports the GUARDEX_COMPRESS_CMD setup: - Human output: a `Token compression` line after the system-tool status — a warn-colored advisory when the configured binary is not on PATH, otherwise a plain "configured" line. Silent when unset. - JSON payload (single-repo): new `compression` field via describeCompressor(); recursive runs inherit it through each child. - Advisory only: a missing compressor never changes doctor's safe/unsafe exit code (compression is an optimization, not a safety guarantee). Docs: SKILL/AGENTS note both `gx status` and `gx doctor` verify the wiring. Verified: 3 new tests (missing-binary advisory + non-gating exit, configured/unset, --json field); lint clean; SKILL parity held; no new failures in the full suite (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * test(pr): cover the gx pr command layer (parse + format helpers) src/cli/commands/pr.js was ~9% covered — pr-module.test.js only exercises the gh-facing logic in src/pr.js. Adds network-free unit tests for the command layer's pure helpers: - parsePrArgs: defaults, value flags, --branch/--head alias, boolean toggles, and validation paths (--merge-strategy, --timeout, --interval reject bad values; seconds->ms conversion). - renderChecksLine: empty/zero, multi-bucket join, count fallback. - printUsage: lists all subcommands. 10 tests, all pass; lint clean. New isolated test file, no src changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * fix(sandbox): recover stranded worktree dirs during cleanup instead of stranding the branch cleanupProtectedBaseSandbox (used by gx doctor + the shared sandbox finalizer — the recovery flows the README flags as rough) treated a `git worktree remove` non-zero exit as fatal. After a crash or partial manual cleanup, the path can exist on disk while git no longer tracks it as a worktree; `git worktree remove` then fails with "is not a working tree", the function throws, and the branch-delete step never runs — leaving a leaked branch and a half-finished cleanup. Now: on a non-spawn-failure remove error, prune stale worktree metadata, remove the leftover directory (both idempotent), set worktree='pruned', and continue to branch deletion. Spawn failures (missing git) still throw. Happy path is byte-for-byte unchanged. Tests: new test/sandbox-cleanup.test.js covers happy-path removal, stranded-dir recovery (threw before the fix), and missing-metadata no-op. Full suite: no new failures (22 pre-existing, environment-specific). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * chore(openspec): archive 33 completed changes The openspec/changes/ directory had accumulated completed-but-unarchived changes — every one of these had all Specification + Implementation + Verification tasks checked, with only the cleanup/PR section outstanding, and spot-checks confirmed the work landed on main. A cluttered active- changes dir costs tokens for every agent that reads it. Moves each completed change to openspec/changes/archive/2026-06-20-<slug>/ (git renames; date prefix = archive date, matching the existing archive convention). Two changes are intentionally left active: - opt-in-merge-gate (Specification/Implementation/Verification unchecked). - codex-auto-bump (Verification 3.2 `npm test` unchecked — unconfirmed). Docs-only; no code or test references the moved slugs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw * docs: add GitGuardex video design brief Hand-off brief for a motion designer / AI video tool: narrative arc, visual style, motifs, hero shot, copy, paste-ready generator prompt, and deliverables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated by gx branch finish (PR flow).