fileName

tcmts.cli.files.fileName · #y54u2wd3 · term · runs anywhere

A file's name on disk: its name in the codebase, and its format as the extension (none for a file without one, like Dockerfile), after a dot for a hidden file (.gitignore, .mcp.json).

import { formatOf } from "#codebase/tcmts/cli/files";
import type { DefRecord } from "#codebase/tcmts/core/types";

export const fileName = (leaf: string, rec: DefRecord): string =>
  `${(JSON.parse(rec.ir) as string[])[1]!.startsWith(".") ? "." : ""}${leaf}${formatOf(rec) ? `.${formatOf(rec)}` : ""}`

uses

used by