@sdsrs/code-graph 0.165.0 → 0.165.2

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.165.0",
7
+ "version": "0.165.2",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -573,8 +573,10 @@ function samePath(a, b) {
573
573
  * exists — creating it would put an unexcluded directory in `git status`, the
574
574
  * side effect D3/D4 removed. Anything unrecordable (no fingerprint, no
575
575
  * directory, a failed write) shows the notice: a failure must never silence it.
576
+ * `record: false` reads the record and never creates or writes it, for a
577
+ * session nobody attends.
576
578
  */
577
- function staleNoticeDue(cwd, fingerprint) {
579
+ function staleNoticeDue(cwd, fingerprint, { record = true } = {}) {
578
580
  if (!fingerprint) return true;
579
581
  const dir = path.join(cwd, '.code-graph');
580
582
  const marker = path.join(dir, 'stale-block-notice');
@@ -590,13 +592,17 @@ function staleNoticeDue(cwd, fingerprint) {
590
592
  let fd;
591
593
  try {
592
594
  fd = openOwned(marker,
593
- fs.constants.O_RDWR | fs.constants.O_CREAT | (fs.constants.O_NONBLOCK || 0), what);
595
+ (record ? fs.constants.O_RDWR | fs.constants.O_CREAT : fs.constants.O_RDONLY)
596
+ | (fs.constants.O_NONBLOCK || 0), what);
594
597
  } catch { return true; }
595
598
  if (fd === null) return true;
596
599
  try {
600
+ // A read that fills the buffer (64 bytes or more) is not a record this
601
+ // plugin wrote, whatever its first bytes.
597
602
  const buf = Buffer.alloc(64);
598
603
  const n = fs.readSync(fd, buf, 0, buf.length, 0);
599
- if (buf.toString('utf8', 0, n).trim() === fingerprint) return false;
604
+ if (n < buf.length && buf.toString('utf8', 0, n).trim() === fingerprint) return false;
605
+ if (!record) return true;
600
606
  fs.ftruncateSync(fd, 0);
601
607
  fs.writeSync(fd, fingerprint + '\n', 0);
602
608
  } catch { /* unrecorded: shown again next session */ }
@@ -723,7 +729,13 @@ function runSessionInit({ source } = {}) {
723
729
  autoAdopt = { attempted: false, reason: 'threw', error: (e && e.message) || String(e) };
724
730
  }
725
731
  }
726
- if (autoAdopt.reason === 'stale' && staleNoticeDue(process.cwd(), autoAdopt.fingerprint)) {
732
+ // `claude -p` and SDK sessions run this hook too, and nobody reads their
733
+ // notice. Claude Code sets CLAUDE_CODE_SESSION_ATTENDED to '0' for them ('1'
734
+ // in the terminal UI, the IDE and desktop apps), so they read the record but
735
+ // never write it. Unset (an older Claude Code): recorded, as before.
736
+ const attended = process.env.CLAUDE_CODE_SESSION_ATTENDED !== '0';
737
+ if (autoAdopt.reason === 'stale'
738
+ && staleNoticeDue(process.cwd(), autoAdopt.fingerprint, { record: attended })) {
727
739
  notices.push(
728
740
  "[code-graph] This project's CLAUDE.md carries an out-of-date code-graph block.\n" +
729
741
  ` Refresh it: ${adoptCommand()}\n` +
@@ -35,7 +35,7 @@ jobs:
35
35
  node-version: '20'
36
36
  - name: Build snapshot
37
37
  run: |
38
- npx -y -p @sdsrs/code-graph@0.165.0 code-graph-mcp snapshot create --out snapshot.db
38
+ npx -y -p @sdsrs/code-graph@0.165.2 code-graph-mcp snapshot create --out snapshot.db
39
39
  zstd -9 snapshot.db -o snapshot.db.zst
40
40
  mv snapshot.db.zst "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
41
41
  - name: Upload to release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.165.0",
3
+ "version": "0.165.2",
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.165.0",
39
- "@sdsrs/code-graph-linux-arm64": "0.165.0",
40
- "@sdsrs/code-graph-darwin-x64": "0.165.0",
41
- "@sdsrs/code-graph-darwin-arm64": "0.165.0",
42
- "@sdsrs/code-graph-win32-x64": "0.165.0"
38
+ "@sdsrs/code-graph-linux-x64": "0.165.2",
39
+ "@sdsrs/code-graph-linux-arm64": "0.165.2",
40
+ "@sdsrs/code-graph-darwin-x64": "0.165.2",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.165.2",
42
+ "@sdsrs/code-graph-win32-x64": "0.165.2"
43
43
  }
44
44
  }