Refactor CLI output formatting in cli.js to enhance readability by adding line breaks. Comment out verbose logging for OpenAI calls and error handling to reduce console clutter. Update patch_files.js description for clarity on functionality.
This commit is contained in:
27
tools/wget.js
Normal file
27
tools/wget.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
module.exports = async function wget(params) {
|
||||
const { url } = params;
|
||||
if (!url) throw new Error('missing url');
|
||||
const res = await fetch(url);
|
||||
const buffer = await res.buffer();
|
||||
const filename = url.split('/').filter(Boolean).pop() || 'index.html';
|
||||
const content = buffer.slice(0, 500).toString('utf8');
|
||||
return { filename, content };
|
||||
};
|
||||
|
||||
// metadata for the tool runner
|
||||
module.exports.meta = {
|
||||
type: 'function',
|
||||
name: 'wget',
|
||||
description: 'Download URL to filesystem',
|
||||
strict: true,
|
||||
parameters: {
|
||||
type: 'object',
|
||||
required: ['url'],
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
url: { type: 'string', description: 'The url to get.' }
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user