UNPKG

contaigents

Version:

Modular AI Content Ecosystem with Audio Generation

48 lines (47 loc) • 1.95 kB
import { ToolManager } from '../services/tools/ToolManager.js'; import fs from 'fs/promises'; async function manualWriteTest() { console.log('šŸ”§ Manual Write Test - Adding "hey sooraj2" to README.md\n'); try { // Read current content console.log('šŸ“– Current README.md content:'); const currentContent = await fs.readFile('README.md', 'utf-8'); console.log('─'.repeat(30)); console.log(currentContent); console.log('─'.repeat(30)); // Use ToolManager to add the new line const toolManager = new ToolManager(process.cwd()); console.log('\n⚔ Executing write_file tool to add "hey sooraj2"...'); const result = await toolManager.executeTool({ tool_name: 'write_file', parameters: { operation_type: 'partial', file_path: 'README.md', content: currentContent + '\nhey sooraj2', start_line: 1, end_line: 4, create_backup: true } }); console.log('Tool execution result:'); console.log('Success:', result.success); console.log('Message:', result.message); console.log('Error:', result.error); // Read updated content console.log('\nšŸ“– Updated README.md content:'); const updatedContent = await fs.readFile('README.md', 'utf-8'); console.log('─'.repeat(30)); console.log(updatedContent); console.log('─'.repeat(30)); console.log('\nāœ… Manual write test completed!'); console.log('The file should now contain "hey sooraj2" at the bottom.'); } catch (error) { console.error('āŒ Manual write test failed:', error); } } // Run the test if this file is executed directly if (import.meta.url === `file://${process.argv[1]}`) { manualWriteTest().catch(console.error); } export { manualWriteTest };