Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
refactor(reference): share graph index projections
morluto6ee87fbf2def
diff --git a/src/application/ReferenceSourceImport.ts b/src/application/ReferenceSourceImport.tsindex 84153eda6..53a821404 100644--- a/src/application/ReferenceSourceImport.ts+++ b/src/application/ReferenceSourceImport.ts@@ -2,6 +2,8 @@ import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";import { isSecretLikePath } from "../domain/referenceSourceClassification.js";import {createHistoricalSourceGraph,+ historicalSourceLanguages,+ historicalSourceManifests,historicalSourceParseFailureKey,type HistoricalSourceGraph,type HistoricalSourceGraphInput,@@ -83,30 +85,6 @@ const buildProvenance = (caller: options.caller,});-const deriveLanguages = (- entries: HistoricalSourceGraphInput["entries"],-): string[] =>- [- ...new Set(- entries.flatMap((entry) =>- entry.kind === "file" && entry.language !== null- ? [entry.language]- : [],- ),- ),- ].sort(compareUnicodeCodePoints);--const deriveManifests = (- entries: HistoricalSourceGraphInput["entries"],-): string[] =>- entries- .flatMap((entry) =>- entry.kind === "file" && entry.classifications.includes("manifest")- ? [entry.path]- : [],- )- .sort(compareUnicodeCodePoints);-const deriveInventoryState = (input: Pick<HistoricalSourceGraphInput,@@ -229,8 +207,8 @@ export const importReferenceSource = async (),parse_failures: uniqueFailures,exclusions: sortedExclusions,- languages: deriveLanguages(sortedEntries),- manifests: deriveManifests(sortedEntries),+ languages: historicalSourceLanguages(sortedEntries),+ manifests: historicalSourceManifests(sortedEntries),vcs,provenance: buildProvenance(options),limitations: sortedLimitations,diff --git a/src/domain/referenceSourceGraph.ts b/src/domain/referenceSourceGraph.tsindex 8d2796b65..ea8d60efe 100644--- a/src/domain/referenceSourceGraph.ts+++ b/src/domain/referenceSourceGraph.ts@@ -255,7 +255,8 @@ const checkSortedUnique = (}};-const expectedLanguages = (+/** Derive the canonical language index from inventoried source files. */+export const historicalSourceLanguages = (entries: readonly z.infer<typeof sourceEntrySchema>[],): string[] =>[@@ -268,7 +269,8 @@ const expectedLanguages = (),].sort(compareUnicodeCodePoints);-const expectedManifests = (+/** Derive the canonical manifest path index from inventoried source files. */+export const historicalSourceManifests = (entries: readonly z.infer<typeof sourceEntrySchema>[],): string[] =>entries@@ -408,7 +410,7 @@ function checkGraphInvariants(if (canonicalJson(graph.languages) !==- canonicalJson(expectedLanguages(graph.entries))+ canonicalJson(historicalSourceLanguages(graph.entries)))context.addIssue({code: "custom",@@ -417,7 +419,7 @@ function checkGraphInvariants(});if (canonicalJson(graph.manifests) !==- canonicalJson(expectedManifests(graph.entries))+ canonicalJson(historicalSourceManifests(graph.entries)))context.addIssue({code: "custom",