gitnexus 1.6.8-rc.3 → 1.6.8-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -436,6 +436,26 @@ After scope resolution, analyze prunes inert block-local value symbols (a functi
|
|
|
436
436
|
|
|
437
437
|
Programmatic callers can pass `keepLocalValueSymbols: true` in `PipelineOptions` instead of setting the env var.
|
|
438
438
|
|
|
439
|
+
### Hook augmentation/notifications are silently skipped
|
|
440
|
+
|
|
441
|
+
The Claude Code / Antigravity hooks intentionally stay **silent** on normal skip
|
|
442
|
+
paths so strict hook runners (e.g. Codex `PreToolUse`) never see unexpected
|
|
443
|
+
output. A search may not be augmented — or a stale-index reminder may not appear
|
|
444
|
+
on stderr — when the GitNexus MCP server owns the repo DB, when the DB-lock probe
|
|
445
|
+
times out and fails closed, or when the index is already current.
|
|
446
|
+
|
|
447
|
+
To see why a hook skipped, set `GITNEXUS_DEBUG=1` and re-run the action — the hook
|
|
448
|
+
writes the reason (e.g. `[GitNexus] augment skipped: MCP server owns DB`) and the
|
|
449
|
+
stale-index hint to its stderr:
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
GITNEXUS_DEBUG=1 <your command> # surfaces hook skip/diagnostic reasons on stderr
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Only `GITNEXUS_DEBUG=1` and `GITNEXUS_DEBUG=true` enable diagnostics; every other
|
|
456
|
+
value (including `0` and `false`) is treated as off. Diagnostics go to stderr
|
|
457
|
+
only — the hook's structured stdout (the JSON the agent consumes) is unaffected.
|
|
458
|
+
|
|
439
459
|
## Privacy
|
|
440
460
|
|
|
441
461
|
- All processing happens locally on your machine
|
|
@@ -91,10 +91,20 @@ function hasGitNexusServerOwner(gitNexusDir) {
|
|
|
91
91
|
return hasGitNexusDbLockedByGitNexusServer(path.join(gitNexusDir, 'lbug'), process.pid);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Whether opt-in diagnostics should be written to the hook's stderr. Strict
|
|
96
|
+
* hook runners validate hook output, so normal, non-error skip paths must stay
|
|
97
|
+
* silent unless the operator explicitly asks for diagnostics via GITNEXUS_DEBUG.
|
|
98
|
+
* See issue #1913.
|
|
99
|
+
*/
|
|
100
|
+
function isDebugEnabled() {
|
|
101
|
+
return process.env.GITNEXUS_DEBUG === '1' || process.env.GITNEXUS_DEBUG === 'true';
|
|
102
|
+
}
|
|
103
|
+
|
|
94
104
|
function extractAugmentContext(stderr) {
|
|
95
105
|
const output = (stderr || '').trim();
|
|
96
106
|
const marker = output.indexOf('[GitNexus]');
|
|
97
|
-
const debug =
|
|
107
|
+
const debug = isDebugEnabled();
|
|
98
108
|
if (debug && output.length > 0) {
|
|
99
109
|
// Emit the FULL discarded prefix (everything before the marker, or all of
|
|
100
110
|
// it when no marker is present) so suppressed diagnostics — LadybugDB lock
|
|
@@ -258,8 +268,14 @@ function buildAfterToolContext(input) {
|
|
|
258
268
|
if (/\bgit\s+(commit|merge|rebase|cherry-pick|pull)(\s|$)/.test(command)) {
|
|
259
269
|
const hint = buildStaleIndexHint(gitNexusDir, cwd);
|
|
260
270
|
if (hint) {
|
|
261
|
-
|
|
271
|
+
// The hint always reaches the agent via additionalContext (parts). Mirror
|
|
272
|
+
// it to stderr (for terminal users) only under GITNEXUS_DEBUG, so strict
|
|
273
|
+
// hook runners see no unexpected output on this normal path (#1913). The
|
|
274
|
+
// claude hook never mirrored this to stderr — this aligns the two adapters.
|
|
262
275
|
parts.push(hint);
|
|
276
|
+
if (isDebugEnabled()) {
|
|
277
|
+
process.stderr.write(`${hint}\n`);
|
|
278
|
+
}
|
|
263
279
|
}
|
|
264
280
|
}
|
|
265
281
|
}
|
|
@@ -269,7 +285,11 @@ function buildAfterToolContext(input) {
|
|
|
269
285
|
|
|
270
286
|
function runAugment(gitNexusDir, cwd, pattern) {
|
|
271
287
|
if (hasGitNexusServerOwner(gitNexusDir)) {
|
|
272
|
-
|
|
288
|
+
// Normal skip path: the MCP server owns the DB. Stay silent for strict
|
|
289
|
+
// hook runners (issue #1913); surface the reason only under GITNEXUS_DEBUG.
|
|
290
|
+
if (isDebugEnabled()) {
|
|
291
|
+
process.stderr.write('[GitNexus] augment skipped: MCP server owns DB\n');
|
|
292
|
+
}
|
|
273
293
|
return '';
|
|
274
294
|
}
|
|
275
295
|
const release = acquireHookSlot(gitNexusDir);
|
|
@@ -338,7 +358,7 @@ function main() {
|
|
|
338
358
|
const handler = handlers[input.hook_event_name || ''];
|
|
339
359
|
if (handler) handler(input);
|
|
340
360
|
} catch (err) {
|
|
341
|
-
if (
|
|
361
|
+
if (isDebugEnabled()) {
|
|
342
362
|
console.error('GitNexus antigravity hook error:', (err.message || '').slice(0, 200));
|
|
343
363
|
}
|
|
344
364
|
}
|
|
@@ -110,10 +110,20 @@ function hasGitNexusServerOwner(gitNexusDir) {
|
|
|
110
110
|
return hasGitNexusDbLockedByGitNexusServer(path.join(gitNexusDir, 'lbug'), process.pid);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Whether opt-in diagnostics should be written to the hook's stderr. Strict
|
|
115
|
+
* hook runners (e.g. Codex `PreToolUse`) validate hook output, so normal,
|
|
116
|
+
* non-error skip paths must stay silent unless the operator explicitly asks
|
|
117
|
+
* for diagnostics via GITNEXUS_DEBUG. See issue #1913.
|
|
118
|
+
*/
|
|
119
|
+
function isDebugEnabled() {
|
|
120
|
+
return process.env.GITNEXUS_DEBUG === '1' || process.env.GITNEXUS_DEBUG === 'true';
|
|
121
|
+
}
|
|
122
|
+
|
|
113
123
|
function extractAugmentContext(stderr) {
|
|
114
124
|
const output = (stderr || '').trim();
|
|
115
125
|
const marker = output.indexOf('[GitNexus]');
|
|
116
|
-
const debug =
|
|
126
|
+
const debug = isDebugEnabled();
|
|
117
127
|
if (debug && output.length > 0) {
|
|
118
128
|
// Emit the FULL discarded prefix (everything before the marker, or all of
|
|
119
129
|
// it when no marker is present) so suppressed diagnostics — KuzuDB lock
|
|
@@ -250,7 +260,12 @@ function handlePreToolUse(input) {
|
|
|
250
260
|
const pattern = extractPattern(toolName, toolInput);
|
|
251
261
|
if (!pattern || pattern.length < 3) return;
|
|
252
262
|
if (hasGitNexusServerOwner(gitNexusDir)) {
|
|
253
|
-
|
|
263
|
+
// Normal skip path: the MCP server owns the DB, so the CLI augment would
|
|
264
|
+
// contend on the lock. Stay silent for strict hook runners (issue #1913);
|
|
265
|
+
// surface the reason only when diagnostics are explicitly requested.
|
|
266
|
+
if (isDebugEnabled()) {
|
|
267
|
+
process.stderr.write('[GitNexus] augment skipped: MCP server owns DB\n');
|
|
268
|
+
}
|
|
254
269
|
return;
|
|
255
270
|
}
|
|
256
271
|
|
|
@@ -361,7 +376,7 @@ function main() {
|
|
|
361
376
|
const handler = handlers[input.hook_event_name || ''];
|
|
362
377
|
if (handler) handler(input);
|
|
363
378
|
} catch (err) {
|
|
364
|
-
if (
|
|
379
|
+
if (isDebugEnabled()) {
|
|
365
380
|
console.error('GitNexus hook error:', (err.message || '').slice(0, 200));
|
|
366
381
|
}
|
|
367
382
|
}
|
package/package.json
CHANGED