@sdsrs/code-graph 0.93.0 → 0.94.0

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.
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "sdsrs"
6
6
  },
7
- "version": "0.93.0",
7
+ "version": "0.94.0",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -6,6 +6,23 @@ const os = require('os');
6
6
  const path = require('path');
7
7
  const crypto = require('crypto');
8
8
 
9
+ // Git plumbing env vars git(1) honors over cwd. A partial `git commit` runs the
10
+ // pre-commit hook with these exported, so any `git` this suite shells out to for
11
+ // its tempdir fixtures would operate on the REAL repo index instead of the
12
+ // fixture. Strip them from THIS process (covers the raw `git clone` + the node
13
+ // `-e` sub-spawns, which inherit env) and per-call in git() below (hermetic even
14
+ // if a test sets one). Sibling of the v0.80.3 pre-commit.sh cargo-path fix (H4).
15
+ const GIT_ENV_VARS = [
16
+ 'GIT_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE', 'GIT_OBJECT_DIRECTORY',
17
+ 'GIT_COMMON_DIR', 'GIT_NAMESPACE', 'GIT_PREFIX',
18
+ ];
19
+ for (const k of GIT_ENV_VARS) delete process.env[k];
20
+ function cleanGitEnv() {
21
+ const e = { ...process.env };
22
+ for (const k of GIT_ENV_VARS) delete e[k];
23
+ return e;
24
+ }
25
+
9
26
  const {
10
27
  commandExists,
11
28
  fetchLatestRelease,
@@ -331,9 +348,33 @@ const { refreshMarketplaceClone, downloadAndInstall } = require('./auto-update')
331
348
 
332
349
  function git(cwd, ...args) {
333
350
  return execGit('git', ['-C', cwd, '-c', 'user.email=t@t', '-c', 'user.name=t', ...args],
334
- { stdio: 'pipe', encoding: 'utf8' });
351
+ { stdio: 'pipe', encoding: 'utf8', env: cleanGitEnv() });
335
352
  }
336
353
 
354
+ test('git fixtures ignore inherited GIT_* env (H4 hermeticity)', (t) => {
355
+ // A partial `git commit` runs the pre-commit hook with GIT_DIR / GIT_INDEX_FILE
356
+ // exported into the environment. Every `git` this suite shells out to for its
357
+ // tempdir fixtures would otherwise inherit them and mutate the REAL repo index
358
+ // instead — v0.80.3 was this exact class, but that fix cleaned only the cargo
359
+ // path in pre-commit.sh; this JS test section was the sibling hole (H4). The
360
+ // git() helper must strip GIT_* so fixtures stay hermetic however the suite is
361
+ // launched (hook, CI, or a direct `node --test`).
362
+ const root = mkDir(t, 'code-graph-h4-');
363
+ const bogus = path.join(root, 'bogus-gitdir');
364
+ const saved = process.env.GIT_DIR;
365
+ process.env.GIT_DIR = bogus;
366
+ t.after(() => { if (saved === undefined) delete process.env.GIT_DIR; else process.env.GIT_DIR = saved; });
367
+
368
+ const repo = path.join(root, 'repo');
369
+ fs.mkdirSync(repo);
370
+ git(repo, 'init', '-q', '-b', 'main');
371
+
372
+ assert.ok(fs.existsSync(path.join(repo, '.git')),
373
+ 'git init must create repo/.git, not honor the inherited GIT_DIR');
374
+ assert.ok(!fs.existsSync(bogus),
375
+ 'the inherited GIT_DIR must be ignored (no repo created there)');
376
+ });
377
+
337
378
  test('refreshMarketplaceClone fast-forwards a stale clone', (t) => {
338
379
  const root = mkDir(t, 'code-graph-mp-');
339
380
  const remote = path.join(root, 'remote');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.93.0",
3
+ "version": "0.94.0",
4
4
  "description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,10 +35,10 @@
35
35
  "node": ">=16"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@sdsrs/code-graph-linux-x64": "0.93.0",
39
- "@sdsrs/code-graph-linux-arm64": "0.93.0",
40
- "@sdsrs/code-graph-darwin-x64": "0.93.0",
41
- "@sdsrs/code-graph-darwin-arm64": "0.93.0",
42
- "@sdsrs/code-graph-win32-x64": "0.93.0"
38
+ "@sdsrs/code-graph-linux-x64": "0.94.0",
39
+ "@sdsrs/code-graph-linux-arm64": "0.94.0",
40
+ "@sdsrs/code-graph-darwin-x64": "0.94.0",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.94.0",
42
+ "@sdsrs/code-graph-win32-x64": "0.94.0"
43
43
  }
44
44
  }