MCPcopy
hub / github.com/colbymchenry/codegraph / updateNode

Method updateNode

src/db/queries.ts:322–382  ·  view source on GitHub ↗

* Update an existing node

(node: Node)

Source from the content-addressed store, hash-verified

320 * Update an existing node
321 */
322 updateNode(node: Node): void {
323 if (!this.stmts.updateNode) {
324 this.stmts.updateNode = this.db.prepare(`
325 UPDATE nodes SET
326 kind = @kind,
327 name = @name,
328 qualified_name = @qualifiedName,
329 file_path = @filePath,
330 language = @language,
331 start_line = @startLine,
332 end_line = @endLine,
333 start_column = @startColumn,
334 end_column = @endColumn,
335 docstring = @docstring,
336 signature = @signature,
337 visibility = @visibility,
338 is_exported = @isExported,
339 is_async = @isAsync,
340 is_static = @isStatic,
341 is_abstract = @isAbstract,
342 decorators = @decorators,
343 type_parameters = @typeParameters,
344 return_type = @returnType,
345 updated_at = @updatedAt
346 WHERE id = @id
347 `);
348 }
349
350 // Invalidate cache before update
351 this.nodeCache.delete(node.id);
352
353 // Validate required fields
354 if (!node.id || !node.kind || !node.name || !node.filePath || !node.language) {
355 console.error('[CodeGraph] Skipping node update with missing required fields:', node.id);
356 return;
357 }
358
359 this.stmts.updateNode.run({
360 id: node.id,
361 kind: node.kind,
362 name: node.name,
363 qualifiedName: node.qualifiedName ?? node.name,
364 filePath: node.filePath,
365 language: node.language,
366 startLine: node.startLine ?? 0,
367 endLine: node.endLine ?? 0,
368 startColumn: node.startColumn ?? 0,
369 endColumn: node.endColumn ?? 0,
370 docstring: node.docstring ?? null,
371 signature: node.signature ?? null,
372 visibility: node.visibility ?? null,
373 isExported: node.isExported ? 1 : 0,
374 isAsync: node.isAsync ? 1 : 0,
375 isStatic: node.isStatic ? 1 : 0,
376 isAbstract: node.isAbstract ? 1 : 0,
377 decorators: node.decorators ? JSON.stringify(node.decorators) : null,
378 typeParameters: node.typeParameters ? JSON.stringify(node.typeParameters) : null,
379 returnType: node.returnType ?? null,

Callers 1

runPostExtractMethod · 0.80

Calls 3

errorMethod · 0.80
prepareMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected