scratchShown
uses node:path
A scratch file as a command names it, to say how to save it: by its name alone when it's in a session's own
directory (sessionDir), where a name alone is looked for, or else as shownPath says it.
import { shownPath } from "#codebase/tcmts/cli/ui"; import path from "node:path"; export function scratchShown(file: string, sessionDir?: string): string { const abs = path.resolve(file); const name = path.basename(abs); return sessionDir && shownPath(abs, sessionDir) === name ? name : shownPath(abs); }