@sdsrs/code-graph 0.172.0 → 0.174.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.172.0",
7
+ "version": "0.174.0",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -323,16 +323,39 @@ function readSettingsForWrite(pre) {
323
323
  // 2026-09-05 JS-01). Stat the original and restore its exact mode; when there
324
324
  // is no original, create owner-only rather than at whatever umask says.
325
325
  function writeJsonAtomic(filePath, data) {
326
- const dir = path.dirname(filePath);
326
+ // A symlinked file (a dotfiles checkout's settings.json) is written where
327
+ // the link points: the rename landed on the link, replaced it with a plain
328
+ // file and left the checkout's copy stale (audit 2026-09-07 JS-19). A new
329
+ // file, a dangling link or a link to anything but a file (a directory took
330
+ // the whole document beside it, then failed) is written at the path itself,
331
+ // as before.
332
+ let target = filePath;
333
+ try {
334
+ if (fs.lstatSync(filePath).isSymbolicLink() && fs.statSync(filePath).isFile()) {
335
+ target = fs.realpathSync(filePath);
336
+ }
337
+ } catch { /* new file, or a dangling link */ }
338
+ const dir = path.dirname(target);
327
339
  fs.mkdirSync(dir, { recursive: true });
340
+ // A file's own bits only: through a link to a directory the new file took
341
+ // the directory's 0755 for a document that holds secrets.
328
342
  let mode = null;
329
- try { mode = fs.statSync(filePath).mode & 0o777; } catch { /* new file */ }
330
- const tmp = filePath + '.tmp.' + process.pid;
331
- fs.writeFileSync(tmp, JSON.stringify(data, null, 2) + '\n', { mode: mode ?? SECRET_FILE_MODE });
332
- // umask can only have cleared bits the original had, so chmod is what makes
333
- // this preservation rather than tightening.
334
- restrictMode(tmp, mode ?? SECRET_FILE_MODE);
335
- fs.renameSync(tmp, filePath);
343
+ try {
344
+ const st = fs.statSync(target);
345
+ if (st.isFile()) mode = st.mode & 0o777;
346
+ } catch { /* new file */ }
347
+ const tmp = target + '.tmp.' + process.pid;
348
+ try {
349
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2) + '\n', { mode: mode ?? SECRET_FILE_MODE });
350
+ // umask can only have cleared bits the original had, so chmod is what makes
351
+ // this preservation rather than tightening.
352
+ restrictMode(tmp, mode ?? SECRET_FILE_MODE);
353
+ fs.renameSync(tmp, target);
354
+ } catch (err) {
355
+ // The temp file holds the whole document, `env` secrets included (JS-28).
356
+ try { fs.rmSync(tmp, { force: true }); } catch { /* best effort */ }
357
+ throw err;
358
+ }
336
359
  }
337
360
 
338
361
  // A settings.json we can READ but not WRITE (read-only ~/.claude, EROFS, a
@@ -41,7 +41,7 @@ jobs:
41
41
  # refuses a snapshot that has no checksum sidecar.
42
42
  - name: Build snapshot
43
43
  run: |
44
- npx -y -p @sdsrs/code-graph@0.172.0 code-graph-mcp snapshot create --out "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
44
+ npx -y -p @sdsrs/code-graph@0.174.0 code-graph-mcp snapshot create --out "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
45
45
  - name: Upload to release
46
46
  env:
47
47
  GH_TOKEN: ${{ github.token }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.172.0",
3
+ "version": "0.174.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.172.0",
39
- "@sdsrs/code-graph-linux-arm64": "0.172.0",
40
- "@sdsrs/code-graph-darwin-x64": "0.172.0",
41
- "@sdsrs/code-graph-darwin-arm64": "0.172.0",
42
- "@sdsrs/code-graph-win32-x64": "0.172.0"
38
+ "@sdsrs/code-graph-linux-x64": "0.174.0",
39
+ "@sdsrs/code-graph-linux-arm64": "0.174.0",
40
+ "@sdsrs/code-graph-darwin-x64": "0.174.0",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.174.0",
42
+ "@sdsrs/code-graph-win32-x64": "0.174.0"
43
43
  }
44
44
  }