MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / languageForPath

Function languageForPath

dashboard/graph/src/types.ts:82–101  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

80
81/** Maps a file path to a coarse language bucket (mirrors the backend mapping). */
82export function languageForPath(path: string): string {
83 const dot = path.lastIndexOf(".");
84 if (dot < 0) return "unknown";
85 const ext = path.slice(dot + 1).toLowerCase();
86 const table: Record<string, string> = {
87 rs: "rust",
88 ts: "typescript", tsx: "typescript",
89 js: "javascript", jsx: "javascript", mjs: "javascript", cjs: "javascript",
90 py: "python", go: "go", java: "java", scala: "scala", sc: "scala",
91 c: "c", h: "c",
92 cc: "cpp", cpp: "cpp", cxx: "cpp", hpp: "cpp", hh: "cpp", hxx: "cpp",
93 kt: "kotlin", kts: "kotlin", cs: "csharp", swift: "swift", rb: "ruby",
94 php: "php", lua: "lua", zig: "zig",
95 sh: "shell", bash: "shell", zsh: "shell",
96 md: "markdown", mdx: "markdown",
97 json: "json", toml: "toml", yaml: "yaml", yml: "yaml", sql: "sql",
98 html: "web", css: "web",
99 };
100 return table[ext] || "other";
101}
102
103/** Buckets the many backend node kinds into a small set of visual families. */
104export function kindFamily(kind: string): string {

Callers 2

applyGraphFiltersFunction · 0.90
deriveChipOptionsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected