@noanswer/context-compose
Version:
Orchestrate complex AI interactions with Context Compose. A powerful CLI and server for building, validating, and managing context for large language models using the Model Context Protocol (MCP).
36 lines • 1.54 kB
JavaScript
import { Command } from 'commander';
import { executeGetContextTool } from '../../core/tools/get-context.js';
/**
* Create Get Context CLI command
*/
export function createGetContextCommand() {
const getContextCommand = new Command('get-context');
getContextCommand
.description('Get context for a task. Reads <context-id>-context.yaml file from the .contextcompose directory. Combines prompts from all files in the jobs section (workflow, rules, mcps, notify, issue, and other custom sections).')
.argument('<contextId>', 'Context ID')
.option('-e, --enhanced-prompt', 'Use detailed enhanced prompt (default: simple prompt)')
.action(async (contextId, options) => {
try {
const input = {
contextId,
projectRoot: process.cwd(), // Use current working directory in CLI
enhancedPrompt: options.enhancedPrompt || false,
};
const result = await executeGetContextTool(input);
if (result.success) {
console.log(result.message);
console.log(result.combinedPrompt);
}
else {
console.error(result.message);
process.exit(1);
}
}
catch (error) {
console.error(`❌ Error executing Get Context: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}
});
return getContextCommand;
}
//# sourceMappingURL=get-context.js.map