Merge commit '2f1d437723197f96dda0427b9a79dd747b776c45' as '.claude/llm-functions'

This commit is contained in:
2026-03-27 09:14:17 +01:00
80 changed files with 5498 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/**
* Execute the javascript code in node.js.
* @typedef {Object} Args
* @property {string} code - Javascript code to execute, such as `console.log("hello world")`
* @param {Args} args
*/
exports.run = function ({ code }) {
let output = "";
const oldStdoutWrite = process.stdout.write.bind(process.stdout);
process.stdout.write = (chunk, _encoding, callback) => {
output += chunk;
if (callback) callback();
};
const value = eval(code);
if (value !== undefined) {
output += value;
}
process.stdout.write = oldStdoutWrite;
return output;
}