@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).
99 lines (98 loc) • 3.07 kB
TypeScript
import type { GetContextToolInput, GetContextToolResponse } from '../../schemas/get-context.js';
/**
* Task YAML file structure type
*/
interface ContextYaml {
version: number;
kind: string;
name: string;
description: string;
context: {
workflow?: string;
rules?: string[];
mcps?: string[];
[key: string]: string | string[] | undefined;
};
prompt?: string;
}
/**
* Workflow/Rule/MCP YAML file structure type
*/
interface ComponentYaml {
version: number;
kind: string;
name: string;
description: string;
prompt: string;
'prompt-enhanced'?: string;
}
/**
* Get Context tool core logic
*/
/**
* Context ID formatting (preserve hyphens and handle context- prefix)
*/
declare function formatContextId(contextId: string): string;
/**
* Read and parse YAML file
*/
declare function readYamlFile<T = ComponentYaml>(filePath: string): T;
/**
* Read context file
*/
declare function readContextFile(projectRoot: string, contextId: string): ContextYaml;
/**
* Read workflow file
*/
declare function readWorkflowFile(projectRoot: string, workflowPath: string): ComponentYaml;
/**
* Read rules files
*/
declare function readRulesFiles(projectRoot: string, rulesPaths: string[]): ComponentYaml[];
/**
* Read MCPs files
*/
declare function readMcpsFiles(projectRoot: string, mcpsPaths: string[]): ComponentYaml[];
/**
* Read component files (generic)
*/
declare function readComponentFiles(projectRoot: string, filePaths: string[]): ComponentYaml[];
/**
* Read single component file (generic)
*/
declare function readComponentFile(projectRoot: string, filePath: string): ComponentYaml;
/**
* Process Jobs section - dynamically handle all sections
*/
declare function processJobsSection(projectRoot: string, context: ContextYaml['context']): Record<string, ComponentYaml[]>;
/**
* Combine all prompts (with dynamic section support)
*/
declare function combinePrompts(contextYaml: ContextYaml, processedSections: Record<string, ComponentYaml[]>, useEnhancedPrompt?: boolean): string;
/**
* Convert section name to user-friendly title
*/
declare function getSectionTitle(sectionName: string): string;
/**
* Get Context core logic
*/
export declare function executeGetContext(input: GetContextToolInput): Promise<GetContextToolResponse>;
/**
* Get Context tool execution function
*/
export declare function executeGetContextTool(args: unknown): Promise<GetContextToolResponse>;
export declare const GetContextTool: {
formatContextId: typeof formatContextId;
readYamlFile: typeof readYamlFile;
readContextFile: typeof readContextFile;
readWorkflowFile: typeof readWorkflowFile;
readRulesFiles: typeof readRulesFiles;
readMcpsFiles: typeof readMcpsFiles;
readComponentFiles: typeof readComponentFiles;
readComponentFile: typeof readComponentFile;
processJobsSection: typeof processJobsSection;
combinePrompts: typeof combinePrompts;
getSectionTitle: typeof getSectionTitle;
execute: typeof executeGetContext;
};
export {};