miyabi-agent-sdk
Version:
Miyabi Autonomous Agent SDK - 7 Agents based on Shikigaku Theory with 100% cost reduction mode
103 lines • 2.67 kB
TypeScript
/**
* CodeGenAgent - コード生成Agent
*
* 識学理論適用:
* - 責任: タスクに対してコードを生成
* - 権限: ファイル作成・変更・削除、テストコード生成、品質スコア自己評価
* - 階層: Specialist Layer
*
* Phase 8-2: Real API Integration
*/
import type { GeneratedFile, AgentInput, AgentOutput } from "../types.js";
import { AnthropicClient } from "../clients/AnthropicClient.js";
import { ClaudeCodeClient } from "../clients/ClaudeCodeClient.js";
import { GitHubClient } from "../clients/GitHubClient.js";
export interface CodeGenInput extends AgentInput {
taskId: string;
requirements: string;
context: {
repository: string;
owner: string;
baseBranch: string;
relatedFiles: string[];
};
language?: "typescript" | "rust" | "python" | "go";
useRealAPI?: boolean;
anthropicClient?: AnthropicClient;
claudeCodeClient?: ClaudeCodeClient;
githubClient?: GitHubClient;
}
export interface CodeGenOutput extends AgentOutput {
data?: {
files: GeneratedFile[];
tests: GeneratedFile[];
qualityScore: number;
tokensUsed?: {
input: number;
output: number;
};
cost?: number;
};
}
/**
* CodeGenAgent実装
*
* 既存コード読み込み → Claude生成 → テスト生成 → 品質自己評価
*/
export declare class CodeGenAgent {
private anthropicClient?;
private claudeCodeClient?;
private githubClient?;
constructor(config?: {
anthropicApiKey?: string;
githubToken?: string;
useClaudeCode?: boolean;
});
/**
* メイン実行ロジック
*/
generate(input: CodeGenInput): Promise<CodeGenOutput>;
/**
* 既存コンテキスト読み込み
*
* Phase 8: Real GitHub API integration
*/
private loadContext;
/**
* コード生成(Claude Sonnet 4使用)
*
* Phase 8: Real Claude API integration
*/
private generateCode;
/**
* Claude用プロンプト生成
*
* TODO: Claude統合時に使用
*/
private buildCodeGenPrompt;
/**
* テストコード生成
*/
private generateTests;
/**
* Mock test生成
*/
private generateMockTest;
/**
* 品質スコア自己評価
*/
private evaluateQuality;
/**
* Mock code生成
*/
private generateMockCode;
/**
* ファイル名サニタイズ
*/
private sanitizeFilename;
/**
* 言語別拡張子取得
*/
private getExtension;
}
//# sourceMappingURL=CodeGenAgent.d.ts.map