@craftapit/tester
Version:
A focused, LLM-powered testing framework for natural language test scenarios
73 lines (72 loc) • 2.21 kB
TypeScript
import { BaseAdapter } from '../adapters/BaseAdapter';
export interface CraftACoderIntegrationConfig {
cliPath?: string;
workingDir?: string;
model?: string;
timeout?: number;
routerApiKey?: string;
routerUrl?: string;
}
/**
* Integration with CraftACoder CLI for passing test scenarios
* to the code generation tool
*/
export declare class CraftACoderIntegration extends BaseAdapter {
private cliPath;
private workingDir;
private logger;
private model;
private timeout;
private routerApiKey;
private routerUrl;
constructor(config?: CraftACoderIntegrationConfig);
initialize(): Promise<void>;
cleanup(): Promise<void>;
/**
* Create a prompt from a test scenario file
*/
private createPromptFromScenario;
/**
* Use craftacoder in non-interactive mode to process a prompt using the ask mode
*/
/**
* Clean up old temporary prompt files to avoid clutter
*/
private cleanupOldPromptFiles;
private runCraftacoderAskMode;
/**
* Use craftacoder in non-interactive mode to implement code using architect mode
*/
private runCraftacoderArchitectMode;
/**
* Pass a test scenario to CraftACoder for code generation using the two-step process:
* 1. Ask mode for planning
* 2. Architect mode for implementation
*/
generateFromTest(scenarioPath: string): Promise<string>;
/**
* Create a prompt for the ask mode (planning phase)
*/
private createAskPrompt;
/**
* Create a prompt for the architect mode (implementation phase)
*/
private createArchitectPrompt;
/**
* Run tests using command-line
*/
runTests(command: string): Promise<{
success: boolean;
output: string;
}>;
/**
* Extract and implement code suggestions from craftacoder output
* This is an optional helper method that can be used to automatically
* extract file content suggestions from the output and create/modify files
*/
extractAndImplementSuggestions(output: string): Promise<string[]>;
/**
* Extract file blocks from craftacoder output
*/
private extractFileBlocks;
}