fix(annotate): improve error message for unsupported file types (#870)

- When a file exists but has an unsupported type (.cs, .ts, .py, etc.),
  show 'File type not supported' instead of misleading 'File not found'
- Display supported file types (.md, .mdx, .html, .htm)
- Suggest using 'plannotator review' for code files
- Maintains backward compatibility for actual missing files

Fixes #757

Co-authored-by: ishowman <ishowman@users.noreply.github.com>
This commit is contained in:
Devin
2026-06-11 07:16:44 +08:00
committed by GitHub
parent 9b936aa299
commit 4b76db9396
+13
View File
@@ -902,7 +902,20 @@ if (args[0] === "sessions") {
process.exit(1);
}
if (resolved.kind === "not_found") {
// Check if file exists but has unsupported type
const resolvedPath = resolveUserPath(resolved.input, projectRoot);
const fileExists = existsSync(resolvedPath);
if (fileExists) {
const ext = path.extname(resolvedPath).toLowerCase();
console.error(
`File type not supported: ${ext}\n` +
`Only .md, .mdx, .html, .htm files are supported.\n` +
`For code review, use: plannotator review [file]`
);
} else {
console.error(`File not found: ${resolved.input}`);
}
process.exit(1);
}