@sdsrs/code-graph 0.179.0 → 0.179.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.179.0",
7
+ "version": "0.179.2",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -203,9 +203,14 @@ const bodyOnly = newStr.includes(headerAt(scanned, symbolAt));
203
203
  // The pick is no definition when its line opens a comment that has not closed
204
204
  // before it, or, in Rust and Python, when its name does not follow `fn` /
205
205
  // `def`. A comment here is not stop-impact.js's COMMENT_LINE, which takes any
206
- // line opening with `*` or `#`: `*entries(prefix) {` is a JS generator method,
207
- // `#[inline] pub fn` a Rust definition; a doc comment's `*` is followed by a
208
- // space, a `/` or the line's end.
206
+ // line opening with `*` or `#`: `*entries(prefix) {` and StandardJS's
207
+ // `* entries (prefix) {` are JS generator methods, `#[inline] pub fn` and
208
+ // `#![allow(…)] fn` Rust definitions; a doc comment's `*` is followed by a
209
+ // space, a `/` or the line's end, and never directly by the pick. A JS line
210
+ // opening with `#` or `;` is taken for a comment too, though it opens none:
211
+ // the pick there is no definition the index knows by that name (it names a
212
+ // private method `#parse`, so asking for `parse` finds nothing or another
213
+ // `parse`; `;(function main (` names a function expression, which has no node).
209
214
  //
210
215
  // Only in the extensions of the reader's languages that corpus had hunks in
211
216
  // (not C: 2 hunks). Elsewhere the reader misread shapes no hunk there had
@@ -215,10 +220,12 @@ const bodyOnly = newStr.includes(headerAt(scanned, symbolAt));
215
220
  // own verdict, as in 0.178.0; so does a hunk the reader has no reading of (a
216
221
  // header past its cap).
217
222
  const READER_MEASURED = new Set(['.rs', '.py', '.js', '.mjs', '.cjs', '.ts']);
218
- const OPENS_A_COMMENT = /^\s*(?:\/\/|\/\*|\*(?=\s|\/|$)|#(?!\[)|--|;)/;
223
+ const OPENS_A_COMMENT = /^\s*(?:\/\/|\/\*|\*(?=\s|\/|$)|#(?!!?\[)|--|;)/;
219
224
  function onComment(line, nameCol) {
220
225
  const closed = /^\s*(?:\/\*.*?\*\/\s*)+/.exec(line.slice(0, nameCol));
221
- return OPENS_A_COMMENT.test(closed ? line.slice(closed[0].length) : line);
226
+ const from = closed ? closed[0].length : 0;
227
+ if (/^\s*\*\s+$/.test(line.slice(from, nameCol))) return false; // `* entries (`
228
+ return OPENS_A_COMMENT.test(line.slice(from));
222
229
  }
223
230
  function changedDefinition() {
224
231
  const ext = path.extname(editedAbs).toLowerCase();
@@ -115,11 +115,25 @@ function escapeRe(s) {
115
115
  return String(s).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
116
116
  }
117
117
 
118
+ // Two kinds of run made a read quadratic and are bounded: a bracket's contents
119
+ // (`[^)\n]*`, and Kotlin's `<[^>\n]*>`, re-scanned the rest of a line from
120
+ // every `const a = (`, Go `func (` and Kotlin `fun <` on it), and a modifier
121
+ // run crossing newlines (it re-read every following line from each line of a
122
+ // run of `async` lines; D#572: 100 KB took 2.8 s per read; pre-edit-guide
123
+ // reads a hunk twice within a 4 s budget). A bracket's contents stop at
124
+ // MAX_SIGNATURE_CHARS, readHeader's own cap: a definition with a longer run is
125
+ // not found. What 0.179.0 read for it varied: no header, a header cut short
126
+ // before its name, or, on a line over MAX_DEFINITION_LINE_CHARS, nothing in
127
+ // the whole file.
128
+ // Methods take at most four modifiers, as many as a valid TypeScript method
129
+ // has (an access modifier, `static`, `override`, `async` or `get`/`set`).
130
+ const BRACKETED = `{0,${MAX_SIGNATURE_CHARS}}`;
131
+
118
132
  // What comes before a definition's name: the keyword, Go's receiver, Kotlin's
119
133
  // type parameters.
120
134
  function keywordLead(lang) {
121
- const receiver = lang.receiver ? '(?:\\([^)\\n]*\\)\\s*)?' : '';
122
- const typeParams = lang.typeParams ? '(?:<[^>\\n]*>\\s*)?' : '';
135
+ const receiver = lang.receiver ? `(?:\\([^)\\n]${BRACKETED}\\)\\s*)?` : '';
136
+ const typeParams = lang.typeParams ? `(?:<[^>\\n]${BRACKETED}>\\s*)?` : '';
123
137
  return `\\b(?:${lang.keyword})\\s+${receiver}${typeParams}`;
124
138
  }
125
139
 
@@ -129,8 +143,8 @@ function definitionPatterns(S, lang) {
129
143
  out.push({ re: new RegExp(`${keywordLead(lang)}${S}\\b`, 'g') });
130
144
  }
131
145
  if (lang.jsForms) {
132
- out.push({ re: new RegExp(`\\b(?:const|let|var)\\s+${S}\\s*=\\s*(?:async\\s+)?(?:function\\b|\\([^)\\n]*\\)\\s*=>|[A-Za-z_$][\\w$]*\\s*=>)`, 'g') });
133
- out.push({ re: new RegExp(`^[ \\t]*(?:(?:async|static|get|set|public|private|protected|readonly|override)\\s+)*\\*?${S}\\s*\\([^()\\n]*\\)\\s*(?::\\s*[^{;=\\n]+)?\\{[ \\t]*$`, 'gm') });
146
+ out.push({ re: new RegExp(`\\b(?:const|let|var)\\s+${S}\\s*=\\s*(?:async\\s+)?(?:function\\b|\\([^)\\n]${BRACKETED}\\)\\s*=>|[A-Za-z_$][\\w$]*\\s*=>)`, 'g') });
147
+ out.push({ re: new RegExp(`^[ \\t]*(?:(?:async|static|get|set|public|private|protected|readonly|override)\\s+){0,4}\\*?${S}\\s*\\([^()\\n]*\\)\\s*(?::\\s*[^{;=\\n]+)?\\{[ \\t]*$`, 'gm') });
134
148
  }
135
149
  if (lang.typed) {
136
150
  out.push({ re: new RegExp(`^[ \\t]*((?:[A-Za-z_][\\w<>\\[\\],.*&:?]*[ \\t]+)+)${S}[ \\t]*\\(`, 'gm'), typed: true });
@@ -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.179.0 code-graph-mcp snapshot create --out "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
44
+ npx -y -p @sdsrs/code-graph@0.179.2 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.179.0",
3
+ "version": "0.179.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.179.0",
39
- "@sdsrs/code-graph-linux-arm64": "0.179.0",
40
- "@sdsrs/code-graph-darwin-x64": "0.179.0",
41
- "@sdsrs/code-graph-darwin-arm64": "0.179.0",
42
- "@sdsrs/code-graph-win32-x64": "0.179.0"
38
+ "@sdsrs/code-graph-linux-x64": "0.179.2",
39
+ "@sdsrs/code-graph-linux-arm64": "0.179.2",
40
+ "@sdsrs/code-graph-darwin-x64": "0.179.2",
41
+ "@sdsrs/code-graph-darwin-arm64": "0.179.2",
42
+ "@sdsrs/code-graph-win32-x64": "0.179.2"
43
43
  }
44
44
  }