fix(cli): classify ENOTDIR JSON input failures (#1000)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
This commit is contained in:
morluto
2026-10-08 01:06:31 +08:00
committed by GitHub
co-authored by Cursor Agent morluto
parent cbc0dd1e7c
commit a6132be054
2 changed files with 71 additions and 2 deletions
+3 -1
View File
@@ -72,7 +72,9 @@ const cannotBeAnExistingFile = (cause: unknown): boolean =>
typeof cause === "object" &&
cause !== null &&
"code" in cause &&
(cause.code === "ENOENT" || cause.code === "ENAMETOOLONG");
(cause.code === "ENOENT" ||
cause.code === "ENAMETOOLONG" ||
cause.code === "ENOTDIR");
const hasExplicitJsonFileExtension = (value: string): boolean =>
value.toLowerCase().endsWith(".json");