readLease
uses node:fs
A session's lease (leaseFile), if it has one.
import { leaseFile } from "#codebase/tcmts/cli/mcp"; import fs from "node:fs"; export function readLease( root: string, branch: string, ): { client: string; at: number } | undefined { try { const l = JSON.parse(fs.readFileSync(leaseFile(root, branch), "utf8")) as { client?: unknown; at?: unknown; }; return typeof l.client === "string" && typeof l.at === "number" ? { client: l.client, at: l.at } : undefined; } catch { return undefined; } }