Update tools to allow reading any VFS path, writing to /tmp

This commit is contained in:
Alex Gleason committed 2025-09-14 12:31:23 -05:00
1 parent f23b92c79f
commit be8309b503
17 files changed
+356 -60

No files matched your search

+13 -2
View File
@@ -124,11 +124,22 @@ describe('TextEditorWriteTool', () => {
expect(mockFS.getFileContent('/project/src/test.ts')).toBe('console.log("test");');
});
it('should reject absolute paths with helpful error message', async () => {
it('should reject absolute paths outside allowed directories', async () => {
await expect(tool.execute({
path: '/absolute/path/test.ts',
file_text: 'test content'
})).rejects.toThrow('❌ Absolute paths are not supported');
})).rejects.toThrow('Write access denied');
});
it('should allow writes to /tmp/ directory', async () => {
const result = await tool.execute({
path: '/tmp/temp-file.txt',
file_text: 'temporary content'
});
expect(result).toContain('File successfully written to /tmp/temp-file.txt');
expect(mockFS.hasFile('/tmp/temp-file.txt')).toBe(true);
expect(mockFS.getFileContent('/tmp/temp-file.txt')).toBe('temporary content');
});
it('should reject package.json writes', async () => {