mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-21 00:21:30 +00:00
* fix(hooks): silence MCP-owned-DB augment skip for strict hook runners
The PreToolUse augment-skip path wrote `[GitNexus] augment skipped: MCP
server owns DB` to stderr unconditionally on a normal (non-error) skip.
Strict hook runners that validate hook output (e.g. Codex `PreToolUse`)
treat that as noisy / "invalid pre-tool-use JSON output".
Gate the diagnostic behind GITNEXUS_DEBUG via a shared `isDebugEnabled()`
helper, so normal skips are silent by default (empty stdout AND stderr,
exit 0) and the reason stays recoverable with `GITNEXUS_DEBUG=1`. Applied
consistently to all three hand-maintained hook copies (claude,
antigravity, claude-plugin).
Tests:
- Unit (claude CJS + plugin): assert default-silent and debug-on behavior
for the MCP-owned-DB skip and for the fail-closed (lsof ETIMEDOUT) skip
that routes through the same gated line; the owner-detection tests run
with GITNEXUS_DEBUG=1 so the skip discriminator stays observable.
- e2e (antigravity): the antigravity adapter shares the identical gated
skip but only runs from its install dir, so cover it through the install
pipeline with a faked DB-owner probe (strict empty-stdout/stderr +
debug-on). Promote the fake-probe helpers (createHookToolDir / hookEnv,
plus a module-private writeExecutable) into shared hook-test-helpers so
unit + e2e reuse them.
Fixes #1913
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(hooks): unify GITNEXUS_DEBUG gating in main() catch handlers
The main() catch-handler in all three hook copies still gated its crash
log on truthy `if (process.env.GITNEXUS_DEBUG)`, while the skip diagnostic
the #1913 fix added is gated on the strict `isDebugEnabled()` helper
(=== '1' || === 'true'). That split meant GITNEXUS_DEBUG=0 or =false
suppressed the skip line yet still enabled crash logging — two conflicting
contract signals in the same file.
Switch the three catch handlers to isDebugEnabled() so GITNEXUS_DEBUG has
one strict meaning everywhere: exactly '1' or 'true' enables all
diagnostics; everything else (incl. '0', 'false', empty, unset) is silent.
Add boundary tests asserting the MCP-owner skip stays silent with
GITNEXUS_DEBUG='0' and 'false' (CJS + Plugin), pinning the strict contract.
Refs #1913
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(hooks): gate antigravity stale-index hint stderr behind GITNEXUS_DEBUG
The antigravity AfterTool handler mirrored the stale-index hint to stderr
unconditionally on a normal (non-error) success path — the last ungated
stderr write of the class issue #1913 targets, and a divergence from the
claude hook, which never mirrors this hint to stderr.
Gate the stderr mirror behind isDebugEnabled(). The hint still reaches the
agent via additionalContext (stdout JSON) — parts.push(hint) stays
unconditional — so there is no functional loss; only the by-default
terminal mirror moves behind GITNEXUS_DEBUG=1. This knowingly changes the
#1730 terminal-mirror behavior in favor of strict-runner cleanliness and
parity with the claude adapter.
Split the e2e assertion into a default-silent test (hint in
additionalContext, absent from stderr) and a GITNEXUS_DEBUG=1 test (hint
mirrored to stderr).
Refs #1913
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(hooks): document GITNEXUS_DEBUG=1 for hook diagnostics
GITNEXUS_DEBUG was documented only in the cursor integration README, so
the diagnostic escape hatch for the Claude Code / Antigravity hooks was
undiscoverable. Operators hitting a silent hook skip (MCP server owns the
DB, fail-closed probe timeout, or an already-current index) had no
documented way to surface the reason.
Add a Troubleshooting subsection explaining that the hooks stay silent on
normal skip paths for strict runners, that GITNEXUS_DEBUG=1 surfaces the
reason on stderr, and that only '1'/'true' enable diagnostics (stdout JSON
the agent consumes is unaffected).
Refs #1913
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(hooks): update setup-antigravity unit test for gated stale-index hint
U2 (
|
||
|---|---|---|
| .. | ||
| cli | ||
| group | ||
| mcp | ||
| optional-grammars | ||
| resolvers | ||
| analyze-heap-oom-e2e.test.ts | ||
| analyze-wal-checkpoint-failure.test.ts | ||
| antigravity-hook-e2e.test.ts | ||
| api-impact-e2e.test.ts | ||
| api-query.test.ts | ||
| ast-helpers-object-literal-binding.test.ts | ||
| augmentation.test.ts | ||
| basicblock-roundtrip.test.ts | ||
| c-cpp-typedef-legacy-parse.test.ts | ||
| class-impact-all-languages.test.ts | ||
| cli-e2e.test.ts | ||
| cobol-pipeline-benchmark.test.ts | ||
| context-typed-property.test.ts | ||
| cpp-adl-benchmark.test.ts | ||
| cpp-pipeline-benchmark.test.ts | ||
| cross-file-binding.test.ts | ||
| csharp-pipeline-benchmark.test.ts | ||
| csharp-scope-capture-tripwire.test.ts | ||
| csv-pipeline.test.ts | ||
| enrichment.test.ts | ||
| expo-routes.test.ts | ||
| fastapi-prefix-pipeline.test.ts | ||
| filesystem-walker.test.ts | ||
| go-multi-name-worker-metadata.test.ts | ||
| go-pipeline-benchmark.test.ts | ||
| grammar-introspection.test.ts | ||
| grammar-literal-validation.test.ts | ||
| has-method.test.ts | ||
| hooks-e2e.test.ts | ||
| ignore-and-skip-e2e.test.ts | ||
| java-class-impact.test.ts | ||
| js-array-method-callback-attribution.test.ts | ||
| lbug-close-handle-release.test.ts | ||
| lbug-core-adapter.test.ts | ||
| lbug-lock-retry.test.ts | ||
| lbug-non-ascii-path.test.ts | ||
| lbug-open-retry.test.ts | ||
| lbug-orphan-sidecar-recovery.test.ts | ||
| lbug-pool-stability.test.ts | ||
| lbug-pool.test.ts | ||
| lbug-readonly-init.test.ts | ||
| lbug-vector-extension.test.ts | ||
| literal-collectors.test.ts | ||
| local-backend-calltool.test.ts | ||
| local-backend.test.ts | ||
| local-symbol-pruner-pipeline.test.ts | ||
| markdown-processor-crlf.test.ts | ||
| object-literal-method-exports.test.ts | ||
| object-literal-owner-resolution.test.ts | ||
| orm-dataflow.test.ts | ||
| parse-impl-chunk-concurrency.test.ts | ||
| parse-impl-env-reads.test.ts | ||
| parse-impl-large-fixture.test.ts | ||
| parse-impl-progress-monotonic.test.ts | ||
| parse-impl-quarantine-cache-skip.test.ts | ||
| parsing.test.ts | ||
| php-pipeline-benchmark.test.ts | ||
| php-scope-capture-tripwire.test.ts | ||
| pipeline-graph-golden.test.ts | ||
| pipeline.test.ts | ||
| python-import-index-reuse.test.ts | ||
| python-scope-capture-tripwire.test.ts | ||
| qualified-class-lookups.test.ts | ||
| query-compilation.test.ts | ||
| ruby-pipeline-benchmark.test.ts | ||
| ruby-scope-capture-tripwire.test.ts | ||
| rust-pipeline-benchmark.test.ts | ||
| rust-scope-capture-tripwire.test.ts | ||
| search-core.test.ts | ||
| search-pool.test.ts | ||
| server-analyze.test.ts | ||
| server-http-startup.test.ts | ||
| setup-antigravity.test.ts | ||
| setup-skills.test.ts | ||
| setup-uninstall-roundtrip.test.ts | ||
| shape-check-regression.test.ts | ||
| skills-e2e.test.ts | ||
| staleness-and-stability.test.ts | ||
| swift-scope-capture-tripwire.test.ts | ||
| tree-sitter-languages.test.ts | ||
| vue-pipeline-benchmark.test.ts | ||
| worker-pool.test.ts | ||