Skip to content

Commit 7e2cd4b

Browse files
authored
Small tool usage cleanup (#203)
1 parent 03f93d6 commit 7e2cd4b

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

apps/web/src/lib/__tests__/toolUsageParser.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,16 @@ describe('toolUsageParser', () => {
188188
});
189189
});
190190

191-
it('should handle searchFiles tool with query fallback', () => {
191+
it('should handle searchFiles tool without regex', () => {
192192
const message = {
193193
ask: 'tool',
194-
text: '{"tool":"searchFiles","query":"test pattern"}',
194+
text: '{"tool":"searchFiles"}',
195195
};
196196

197197
const result = extractToolUsageFromAsk(message);
198198

199199
expect(result).toEqual({
200200
action: 'Grepped',
201-
details: 'test pattern',
202201
});
203202
});
204203

apps/web/src/lib/toolUsageParser.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export function extractToolUsageFromAsk(message: {
3232
case 'editedExistingFile':
3333
return {
3434
action: 'Edited',
35-
details: path || undefined,
35+
details: path,
3636
};
3737
case 'createdNewFile':
3838
return {
3939
action: 'Created',
40-
details: path || undefined,
40+
details: path,
4141
};
4242
case 'readFile':
4343
// Handle batch files (multiple reads)
@@ -59,32 +59,32 @@ export function extractToolUsageFromAsk(message: {
5959
// Handle single file read
6060
return {
6161
action: 'Read',
62-
details: path || undefined,
62+
details: path,
6363
};
6464
case 'searchFiles':
6565
return {
6666
action: 'Grepped',
67-
details: regex || query || 'pattern',
67+
details: regex,
6868
};
6969
case 'listFiles':
7070
return {
7171
action: 'Listed',
72-
details: path || undefined,
72+
details: path,
7373
};
7474
case 'listFilesTopLevel':
7575
return {
7676
action: 'Listed',
77-
details: path || undefined,
77+
details: path,
7878
};
7979
case 'listFilesRecursive':
8080
return {
8181
action: 'Listed',
82-
details: path || undefined,
82+
details: path,
8383
};
8484
case 'newFileCreated':
8585
return {
8686
action: 'Created',
87-
details: path || undefined,
87+
details: path,
8888
};
8989
case 'appliedDiff':
9090
// Handle batch diffs (multiple file edits)
@@ -106,7 +106,7 @@ export function extractToolUsageFromAsk(message: {
106106
// Handle single file diff
107107
return {
108108
action: 'Edited',
109-
details: path || undefined,
109+
details: path,
110110
};
111111
default:
112112
return null;

0 commit comments

Comments
 (0)