Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(reference-source): recognize Kotlin files in imported inventories
morluto03ffb2c13dc6
diff --git a/src/application/ReferenceSourceImportEntries.test.ts b/src/application/ReferenceSourceImportEntries.test.tsnew file mode 100644index 000000000..387e2b70c--- /dev/null+++ b/src/application/ReferenceSourceImportEntries.test.ts@@ -0,0 +1,60 @@+import { createHash } from "node:crypto";++import { expect, it } from "vitest";++import { parseReferenceSourceEntries } from "./ReferenceSourceImportEntries.js";+import { historicalSourceLanguages } from "../domain/referenceSourceGraph.js";+import type { ReferenceSourceRead } from "../reference/ReferenceSourceReaderTypes.js";++it("retains Kotlin source identity and language across the inventory projection", () => {+ const files = [+ [+ "MainActivity.kt",+ "import android.app.Activity\nclass MainActivity : Activity()\n",+ ["source"],+ "Kotlin",+ ],+ ["task.kts", 'println("hello")\n', ["source"], "Kotlin"],+ [+ "build.gradle.kts",+ 'plugins { kotlin("jvm") version "2.3.0" }\n',+ ["manifest", "source"],+ "Kotlin",+ ],+ ["MainActivity.kt.backup", "backup\n", ["unknown"], null],+ ["Legacy.java", "class Legacy {}\n", ["source"], "Java"],+ ] as const;+ const read: ReferenceSourceRead = {+ root: "/selected/source",+ entries: files.map(([path, content]) => ({+ status: "read",+ kind: "file",+ path,+ bytes: Buffer.from(content),+ size: Buffer.byteLength(content),+ })),+ bytesRead: files.reduce(+ (sum, [, content]) => sum + Buffer.byteLength(content),+ 0,+ ),+ limitations: [],+ };+ const parsed = parseReferenceSourceEntries(+ read,+ new Set(files.map(([path]) => path)),+ );+ for (const [path, content, classifications, language] of files)+ expect(parsed.entries).toContainEqual({+ path,+ kind: "file",+ language,+ classifications,+ size: Buffer.byteLength(content),+ sha256: createHash("sha256").update(content).digest("hex"),+ content_state: "hashed",+ limitations: [],+ });+ expect(historicalSourceLanguages(parsed.entries)).toEqual(["Java", "Kotlin"]);+ expect(parsed.parseFailures).toEqual([]);+ expect(parsed.relationships).toEqual([]);+});diff --git a/src/domain/referenceSourceClassification.ts b/src/domain/referenceSourceClassification.tsindex 0c82cf6d6..fe8a6b28d 100644--- a/src/domain/referenceSourceClassification.ts+++ b/src/domain/referenceSourceClassification.ts@@ -27,6 +27,8 @@ const CODE_EXTENSIONS = new Set(["rs","go","java",+ "kt",+ "kts","c","h","cpp",@@ -54,6 +56,8 @@ const LANGUAGE_BY_EXTENSION = new Map<string, string>([["rs", "Rust"],["go", "Go"],["java", "Java"],+ ["kt", "Kotlin"],+ ["kts", "Kotlin"],["c", "C"],["h", "C"],["cpp", "C++"],