Files
hyperframes/packages/cli/src/utils/textFile.ts
T
Miguel Ángel 4178a8f95d fix(cli): reject extra positional arguments on every command (#4905)
* fix(cli): reject extra positional arguments on every command

* fix(cli): read the command name without assuming a resolved meta

* fix(cli): join free-text words for catalog and tts, reject a bad repo root

* test(cli): load the listed commands through static imports

* fix(cli): keep a tts file path out of the word join and read the parsed json flag

* fix(cli): apply the file exception only to a tts .txt path

* fix(cli): keep usageLine private and test the json fallback for undeclared json

* fix(cli): keep extra arguments and the repo root value out of telemetry

* test(cli): type the skills update lookup

* fix(cli): read json mode from the parsed flag, reject tts words with --text-file, restore add's hint

* fix(cli): check tts words with --text-file before --list and test --json=false
2026-10-02 18:34:53 +00:00

9 lines
344 B
TypeScript

import { existsSync } from "node:fs";
import { extname, resolve } from "node:path";
/** True when `input` names an existing `.txt` file, which `tts` reads instead of speaking the path. */
export function isTextFile(input: string): boolean {
const path = resolve(input);
return existsSync(path) && extname(path).toLowerCase() === ".txt";
}