Small tool usage cleanup (#203)

This commit is contained in:
Matt Rubens 2025-07-04 11:30:52 -04:00 committed by GitHub
parent 03f93d6570
commit 7e2cd4b7b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 12 deletions

View file

@ -188,17 +188,16 @@ describe('toolUsageParser', () => {
});
});
it('should handle searchFiles tool with query fallback', () => {
it('should handle searchFiles tool without regex', () => {
const message = {
ask: 'tool',
text: '{"tool":"searchFiles","query":"test pattern"}',
text: '{"tool":"searchFiles"}',
};
const result = extractToolUsageFromAsk(message);
expect(result).toEqual({
action: 'Grepped',
details: 'test pattern',
});
});

View file

@ -32,12 +32,12 @@ export function extractToolUsageFromAsk(message: {
case 'editedExistingFile':
return {
action: 'Edited',
details: path || undefined,
details: path,
};
case 'createdNewFile':
return {
action: 'Created',
details: path || undefined,
details: path,
};
case 'readFile':
// Handle batch files (multiple reads)
@ -59,32 +59,32 @@ export function extractToolUsageFromAsk(message: {
// Handle single file read
return {
action: 'Read',
details: path || undefined,
details: path,
};
case 'searchFiles':
return {
action: 'Grepped',
details: regex || query || 'pattern',
details: regex,
};
case 'listFiles':
return {
action: 'Listed',
details: path || undefined,
details: path,
};
case 'listFilesTopLevel':
return {
action: 'Listed',
details: path || undefined,
details: path,
};
case 'listFilesRecursive':
return {
action: 'Listed',
details: path || undefined,
details: path,
};
case 'newFileCreated':
return {
action: 'Created',
details: path || undefined,
details: path,
};
case 'appliedDiff':
// Handle batch diffs (multiple file edits)
@ -106,7 +106,7 @@ export function extractToolUsageFromAsk(message: {
// Handle single file diff
return {
action: 'Edited',
details: path || undefined,
details: path,
};
default:
return null;