@sdsrs/code-graph 0.74.2 → 0.74.3

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.74.2",
7
+ "version": "0.74.3",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -2,11 +2,25 @@
2
2
  'use strict';
3
3
  const { execFileSync } = require('child_process');
4
4
  const fs = require('fs');
5
+ const os = require('os');
5
6
  const path = require('path');
6
7
  const { findBinary } = require('./find-binary');
7
8
  const lifecycle = require('./lifecycle');
8
9
  const cleanupDisabledStatusline = lifecycle.cleanupDisabledStatusline || (() => ({ cleaned: false }));
9
10
 
11
+ // True when auto-update has a newer release queued or in flight (the background
12
+ // downloader in session-init.js hasn't promoted the new binary yet). Used to show
13
+ // a transient "updating" state instead of the alarming "offline" during that window.
14
+ function updatePending() {
15
+ try {
16
+ const st = JSON.parse(fs.readFileSync(
17
+ path.join(os.homedir(), '.cache', 'code-graph', 'update-state.json'), 'utf8'));
18
+ if (st.updateAvailable) return true;
19
+ if (st.latestVersion && st.installedVersion && st.latestVersion !== st.installedVersion) return true;
20
+ } catch { /* no state file or unreadable — treat as no pending update */ }
21
+ return false;
22
+ }
23
+
10
24
  const disabledCleanup = cleanupDisabledStatusline();
11
25
  if (disabledCleanup.cleaned) process.exit(0);
12
26
 
@@ -38,7 +52,9 @@ if (!fs.existsSync(path.join(codeGraphDir, 'index.db'))) {
38
52
 
39
53
  const bin = findBinary();
40
54
  if (!bin) {
41
- process.stdout.write('code-graph: offline');
55
+ // No usable binary yet. If an update is queued, the background downloader is
56
+ // still fetching it \u2014 that is "updating", not a broken "offline" state.
57
+ process.stdout.write(updatePending() ? 'code-graph: \u21bb updating' : 'code-graph: offline');
42
58
  process.exit(0);
43
59
  }
44
60
 
@@ -53,6 +69,13 @@ try {
53
69
  `code-graph: ${icon} ${s.nodes} nodes | ${s.files} files` +
54
70
  (s.watching ? ' | watching' : '')
55
71
  );
56
- } catch {
57
- process.stdout.write('code-graph: offline');
72
+ } catch (e) {
73
+ // A schema-too-new error means the resolved binary is OLDER than the index it
74
+ // is reading \u2014 the classic post-update window where the new binary is still
75
+ // downloading. That, or any pending update, is transient: show "updating" so
76
+ // the user knows it self-heals, rather than the misleading "offline".
77
+ const errOut = ((e && (e.stderr || e.stdout)) || '').toString();
78
+ const binaryOutdated = /schema version/i.test(errOut);
79
+ process.stdout.write(
80
+ (binaryOutdated || updatePending()) ? 'code-graph: \u21bb updating' : 'code-graph: offline');
58
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.74.2",
3
+ "version": "0.74.3",
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.74.2",
39
- "@sdsrs/code-graph-linux-arm64": "0.74.2",
40
- "@sdsrs/code-graph-darwin-x64": "0.74.2",
41
- "@sdsrs/code-graph-darwin-arm64": "0.74.2",
42
- "@sdsrs/code-graph-win32-x64": "0.74.2"
38
+ "@sdsrs/code-graph-linux-x64": "0.74.3",
39
+ "@sdsrs/code-graph-linux-arm64": "0.74.3",
40
+ "@sdsrs/code-graph-darwin-x64": "0.74.3",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.74.3",
42
+ "@sdsrs/code-graph-win32-x64": "0.74.3"
43
43
  }
44
44
  }