summaryrefslogtreecommitdiff
path: root/packages/core/src/utils/fileUtils.ts
diff options
context:
space:
mode:
authorCastor Regex <[email protected]>2025-10-22 05:31:24 -0500
committerJeff Carr <[email protected]>2025-10-22 05:31:24 -0500
commita0c590944ff82d3584a532cd7400689297735757 (patch)
tree60ba1506f7ea2ec2aaa630e2ab4abfa16681f950 /packages/core/src/utils/fileUtils.ts
parent1799aac8ae4355bf912238c650856e82da641f6d (diff)
feat: add support for .proto files
Diffstat (limited to 'packages/core/src/utils/fileUtils.ts')
-rw-r--r--packages/core/src/utils/fileUtils.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/core/src/utils/fileUtils.ts b/packages/core/src/utils/fileUtils.ts
index f0b491ed..009a4d72 100644
--- a/packages/core/src/utils/fileUtils.ts
+++ b/packages/core/src/utils/fileUtils.ts
@@ -121,7 +121,9 @@ export async function isBinaryFile(filePath: string): Promise<boolean> {
*/
export async function detectFileType(
filePath: string,
-): Promise<'text' | 'image' | 'pdf' | 'audio' | 'video' | 'binary' | 'svg'> {
+): Promise<
+ 'text' | 'image' | 'pdf' | 'audio' | 'video' | 'binary' | 'svg' | 'proto'
+> {
const ext = path.extname(filePath).toLowerCase();
// The mimetype for various TypeScript extensions (ts, mts, cts, tsx) can be
@@ -135,6 +137,10 @@ export async function detectFileType(
return 'svg';
}
+ if (ext === '.proto') {
+ return 'proto';
+ }
+
const lookedUpMimeType = mime.lookup(filePath); // Returns false if not found, or the mime type string
if (lookedUpMimeType) {
if (lookedUpMimeType.startsWith('image/')) {
@@ -280,6 +286,13 @@ export async function processSingleFileContent(
returnDisplay: `Read SVG as text: ${relativePathForDisplay}`,
};
}
+ case 'proto': {
+ const content = await fileSystemService.readProtoFile(filePath);
+ return {
+ llmContent: content,
+ returnDisplay: `Read proto file: ${relativePathForDisplay}`,
+ };
+ }
case 'text': {
const content = await fileSystemService.readTextFile(filePath);
const lines = content.split('\n');