MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / compareDrafts

Function compareDrafts

graph-ui/src/compiler/card-compiler.ts:454–489  ·  view source on GitHub ↗
(packet: FactPacket, rank: number)

Source from the content-addressed store, hash-verified

452}
453
454function compareDrafts(packet: FactPacket, rank: number): Draft[] {
455 const other = packet.compareWith;
456 if (other === undefined) {
457 return [];
458 }
459 const ir = other.ir;
460 if (ir === undefined) {
461 return [{
462 kind: 'compare',
463 lines: [`${other.symbol.name} is in the index, but its facts could not be read.`],
464 source: { name: other.symbol.name, filePath: workspacePathOf(other.symbol.uri) },
465 rank,
466 }];
467 }
468 const source = sourceOfIr(ir);
469 const calls = ir.steps.value.map((call) => {
470 const line = call.line === undefined ? '' : ` [line ${call.line}]`;
471 return `${call.targetName}${line}`;
472 });
473 return [{
474 kind: 'compare',
475 lines: [
476 `${whereOf(source)} is a ${ir.symbol.kind}; it is called by `
477 + `${ir.calledBy.value.length} symbol(s).`,
478 calls.length === 0
479 ? `${ir.symbol.name} makes no call the index recorded.`
480 : `${ir.symbol.name} calls ${listOf(calls)}.`,
481 ir.throws.value.length === 0
482 ? `${ir.symbol.name} raises no error type the index recorded.`
483 : `${ir.symbol.name} can raise `
484 + `${listOf(raisedNames(ir))}.`,
485 ],
486 source,
487 rank,
488 }];
489}
490
491function raisedNames(ir: SemanticIR): string[] {
492 const seen = new Set<string>();

Callers 1

compileCardsFunction · 0.85

Calls 5

workspacePathOfFunction · 0.90
sourceOfIrFunction · 0.85
listOfFunction · 0.85
raisedNamesFunction · 0.85
whereOfFunction · 0.70

Tested by

no test coverage detected