diff --git a/example.js b/example.js new file mode 100644 index 0000000..aea01d3 --- /dev/null +++ b/example.js @@ -0,0 +1,36 @@ +// example.js +const LMStudioFileAgent = require('./agent'); + +async function example() { + const agent = new LMStudioFileAgent({ + workspaceDir: './my_project' + }); + + // Read a file + const content = await agent.readFile('example.js'); + console.log('File content:', content); + + // Create a new file + console.log(await agent.createFile('new_script.js', 'console.log("Hello World");', 'javascript')); + + // List directory + const items = await agent.listDirectory(); + console.log('Directory:', items); + + // Search for files + const files = await agent.searchFiles('*.js'); + console.log('JS files:', files); + + // Edit a file + console.log(await agent.editFile('new_script.js', 'Hello World', 'Hello Agent')); + + // Search content + const results = await agent.searchContent('console.log', '.'); + console.log('Search results:', results); + + // Process natural language request + const response = await agent.processRequest('Create a new JavaScript file called test.js with a main function'); + console.log('Agent response:', response); +} + +example().catch(console.error); \ No newline at end of file