Project Files
src / agents / tester.ts
import type { BuildReview, FileSnapshot } from "../types";
export class Tester {
async run(snapshot: FileSnapshot[]): Promise<BuildReview> {
const byPath = new Map(snapshot.map((file) => [file.path, file.content]));
const issues: string[] = [];
const indexTs = byPath.get("src/index.ts") ?? "";
if (!/export\s+async\s+function\s+main\s*\(/.test(indexTs)) {
issues.push("src/index.ts must export async function main(context).");
}
if (!/withToolsProvider\s*\(/.test(indexTs)) {
issues.push("src/index.ts should register the tools provider.");
}
if (!/withPromptPreprocessor\s*\(/.test(indexTs)) {
issues.push("src/index.ts should register the prompt preprocessor.");
}
for (const required of [
"src/toolsProvider.ts",
"src/orchestrator.ts",
"src/workspace.ts",
"src/memory/store.ts",
"src/agents/planner.ts",
"src/agents/coder.ts",
"src/agents/reviewer.ts",
"src/agents/tester.ts",
"src/agents/optimizer.ts",
]) {
if (!byPath.has(required)) {
issues.push(`Missing ${required}.`);
}
}
const packageJson = byPath.get("package.json") ?? "";
if (!packageJson.includes("@lmstudio/sdk")) {
issues.push("package.json must include @lmstudio/sdk.");
}
const manifest = byPath.get("manifest.json") ?? "";
if (!manifest.includes('"type": "plugin"')) {
issues.push("manifest.json must declare type plugin.");
}
return {
passed: issues.length === 0,
issues,
};
}
}