@sdsrs/code-graph 0.29.0 → 0.30.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.29.0",
7
+ "version": "0.30.0",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -91,41 +91,61 @@ function runDiagnostics() {
91
91
  }).trim();
92
92
  const hc = JSON.parse(hcOutput);
93
93
 
94
- // Schema
95
- if (hc.issue && hc.issue.includes('schema')) {
96
- results.push({ name: 'Schema', status: 'warn', detail: hc.issue, fixId: 'schema-mismatch' });
94
+ // No-index short-circuit — binary deliberately returns a structured
95
+ // JSON with reason='no_index' instead of bailing, so we can route to
96
+ // the index-empty fix without grepping stderr. Falls through to the
97
+ // rest of runDiagnostics so Auto-update / Hooks still report.
98
+ if (hc.reason === 'no_index') {
99
+ results.push({ name: 'Schema', status: 'ok', detail: 'binary ok (no index yet)' });
100
+ results.push({ name: 'Index', status: 'warn', detail: 'missing — not indexed yet', fixId: 'index-empty' });
101
+ results.push({ name: 'Embeddings', status: 'skip', detail: 'no index' });
97
102
  } else {
98
- results.push({ name: 'Schema', status: 'ok', detail: `v${hc.schema_version}` });
99
- }
103
+ // Schema
104
+ if (hc.issue && hc.issue.includes('schema')) {
105
+ results.push({ name: 'Schema', status: 'warn', detail: hc.issue, fixId: 'schema-mismatch' });
106
+ } else {
107
+ results.push({ name: 'Schema', status: 'ok', detail: `v${hc.schema_version}` });
108
+ }
100
109
 
101
- // Index
102
- if (hc.nodes === 0) {
103
- results.push({ name: 'Index', status: 'warn', detail: 'empty', fixId: 'index-empty' });
104
- } else {
105
- const age = hc.index_age ? ` (${hc.index_age})` : '';
106
- results.push({
107
- name: 'Index',
108
- status: 'ok',
109
- detail: `${hc.nodes} nodes, ${hc.edges} edges, ${hc.files} files${age}`,
110
- });
111
- }
110
+ // Index
111
+ if (hc.nodes === 0) {
112
+ results.push({ name: 'Index', status: 'warn', detail: 'empty', fixId: 'index-empty' });
113
+ } else {
114
+ const age = hc.index_age ? ` (${hc.index_age})` : '';
115
+ results.push({
116
+ name: 'Index',
117
+ status: 'ok',
118
+ detail: `${hc.nodes} nodes, ${hc.edges} edges, ${hc.files} files${age}`,
119
+ });
120
+ }
112
121
 
113
- // Embeddings
114
- const ep = hc.embedding_progress || '0/0';
115
- const [done, total] = ep.split('/').map(Number);
116
- if (total > 0 && done < total) {
117
- const pct = Math.round((done / total) * 100);
118
- results.push({ name: 'Embeddings', status: 'ok', detail: `${pct}% (${done}/${total})` });
119
- } else if (total === 0) {
120
- results.push({ name: 'Embeddings', status: 'ok', detail: 'no embeddable nodes' });
121
- } else {
122
- results.push({ name: 'Embeddings', status: 'ok', detail: `100% (${done}/${total})` });
122
+ // Embeddings
123
+ const ep = hc.embedding_progress || '0/0';
124
+ const [done, total] = ep.split('/').map(Number);
125
+ if (total > 0 && done < total) {
126
+ const pct = Math.round((done / total) * 100);
127
+ results.push({ name: 'Embeddings', status: 'ok', detail: `${pct}% (${done}/${total})` });
128
+ } else if (total === 0) {
129
+ results.push({ name: 'Embeddings', status: 'ok', detail: 'no embeddable nodes' });
130
+ } else {
131
+ results.push({ name: 'Embeddings', status: 'ok', detail: `100% (${done}/${total})` });
132
+ }
123
133
  }
124
134
  } catch (e) {
125
- const msg = e.stderr ? e.stderr.toString().trim().slice(0, 100) : e.message.slice(0, 100);
126
- results.push({ name: 'Schema', status: 'error', detail: `health-check failed: ${msg}`, fixId: 'binary-broken' });
127
- results.push({ name: 'Index', status: 'skip', detail: 'health-check failed' });
128
- results.push({ name: 'Embeddings', status: 'skip', detail: 'health-check failed' });
135
+ const rawStderr = e.stderr ? e.stderr.toString() : '';
136
+ const msg = rawStderr ? rawStderr.trim().slice(0, 100) : e.message.slice(0, 100);
137
+ // "No index found" is a missing-index situation, not a broken binary —
138
+ // the index-empty fix path knows how to create one. Without this branch
139
+ // the fixId routes to nothing and the report shows "0/1 addressed".
140
+ if (rawStderr.includes('No index found')) {
141
+ results.push({ name: 'Schema', status: 'ok', detail: 'binary ok (no index yet)' });
142
+ results.push({ name: 'Index', status: 'warn', detail: 'missing — not indexed yet', fixId: 'index-empty' });
143
+ results.push({ name: 'Embeddings', status: 'skip', detail: 'no index' });
144
+ } else {
145
+ results.push({ name: 'Schema', status: 'error', detail: `health-check failed: ${msg}`, fixId: 'binary-broken' });
146
+ results.push({ name: 'Index', status: 'skip', detail: 'health-check failed' });
147
+ results.push({ name: 'Embeddings', status: 'skip', detail: 'health-check failed' });
148
+ }
129
149
  }
130
150
  } else {
131
151
  results.push({ name: 'Schema', status: 'skip', detail: 'binary not executable' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.29.0",
3
+ "version": "0.30.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.29.0",
39
- "@sdsrs/code-graph-linux-arm64": "0.29.0",
40
- "@sdsrs/code-graph-darwin-x64": "0.29.0",
41
- "@sdsrs/code-graph-darwin-arm64": "0.29.0",
42
- "@sdsrs/code-graph-win32-x64": "0.29.0"
38
+ "@sdsrs/code-graph-linux-x64": "0.30.0",
39
+ "@sdsrs/code-graph-linux-arm64": "0.30.0",
40
+ "@sdsrs/code-graph-darwin-x64": "0.30.0",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.30.0",
42
+ "@sdsrs/code-graph-win32-x64": "0.30.0"
43
43
  }
44
44
  }