hashOf
uses node:sqlite
The full hash a name points to (tcm ls shows short ones).
import path from "node:path"; import { DatabaseSync } from "node:sqlite"; export function hashOf(dir: string, name: string): string { const db = new DatabaseSync(path.join(dir, ".tcm", "codebase.sqlite"), { readOnly: true }); try { return (db.prepare("SELECT hash FROM names WHERE path = ?").get(name) as { hash: string }).hash; } finally { db.close(); } }