Skip to content

feat(status): surface GUARDEX_COMPRESS_CMD token-compression health#653

Merged
NagyVikt merged 5 commits into
mainfrom
claude/repo-auto-suggestions-1wppv0
Jun 20, 2026
Merged

feat(status): surface GUARDEX_COMPRESS_CMD token-compression health#653
NagyVikt merged 5 commits into
mainfrom
claude/repo-auto-suggestions-1wppv0

Conversation

@NagyVikt

Copy link
Copy Markdown
Collaborator

Why (highest-ROI follow-through)

The GUARDEX_COMPRESS_CMD token-compression hook (PR #649/#652, now used by gx prompt) fails open by design — if it's set but the binary is missing or misconfigured, gx silently prints raw output and quietly wastes the tokens the feature exists to save, with no way for an operator to notice. This makes the feature trustworthy by making it observable, at near-zero risk.

(Security, release provenance, and gx status compaction are already handled in this repo — verified before picking this.)

What

  • src/output — two new helpers:
    • describeCompressor(env){ configured, command, available }
    • isExecutableOnPath(cmd, env) → defensive, cross-platform (PATHEXT-aware) PATH lookup; returns null (unknown) on any error, never throws.
  • gx status:
    • JSON payload gains a compression field (additive).
    • When configured, prints a Token compression line — degraded when the binary isn't on PATH, active otherwise. Silent when unset, so the common case stays noise-free.
  • Docs — SKILL + AGENTS note that gx status verifies the wiring (codex/root SKILL parity held).

Default behavior is unchanged: no compression line unless GUARDEX_COMPRESS_CMD is set; compression itself is untouched.

Verification

  • 6 new tests (output unit: isExecutableOnPath/describeCompressor; status: JSON payload + human degraded/active lines) — all pass.
  • npm run lint clean; SKILL parity test green.
  • Full suite: no new failures (the 22 failures are pre-existing and environment-specific to the sandbox; CI on Actions is green).

🤖 Generated with Claude Code

https://claude.ai/code/session_015Qyz9J4TivR9kJeAeETSUw


Generated by Claude Code

claude added 5 commits June 18, 2026 17:23
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
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
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
@NagyVikt NagyVikt marked this pull request as ready for review June 20, 2026 06:49
@NagyVikt NagyVikt merged commit 1c4e6f3 into main Jun 20, 2026
5 of 6 checks passed
@NagyVikt NagyVikt deleted the claude/repo-auto-suggestions-1wppv0 branch June 20, 2026 06:49
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants