Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | "use strict";
import bag from 'bagofcli';
import fs from 'fs';
import Convo from './convo.js';
import p from 'path';
/**
*
* @param {String} appDir: application directory which is the location of the node.js module file which uses convo-node
* this directory should be on directory lower than where package.json is located
* @param {Array} tools: array of MCP tools to be registered
* @param {Function} toolOptsCb: callback function to create custom tool options
* @returns {Function} exec function that runs command via bagofcli
*/
function exec(appDir, tools, toolOptsCb) {
function _run(args) {
const pkgFile = p.join(appDir, '..', 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgFile));
const toolOpts = toolOptsCb(args);
const convo = new Convo(pkg.name, pkg.version, tools, toolOpts);
bag.logStepHeading(`Running Convo MCP server ${pkg.name} ${pkg.version}`);
convo.run();
}
/**
* Execute Convo CLI run command.
*/
function _exec() {
const actions = {
commands: {
run : { action: _run }
}
};
bag.command(appDir, actions);
}
return _exec;
}
const exports = {
exec: exec
};
export {
exports as default
}; |