Documentation
¶
Index ¶
- func ContainsFailure(result string) (bool, string)
- func ExtractPlanJSON(response string) string
- func FormatConflictWarning(c Conflict) string
- func FormatPlan(plan *Plan) string
- func HashToolCalls(toolCalls []*tools.ToolCall) string
- type Conflict
- type DependencyAnalyzer
- func (da *DependencyAnalyzer) Analyze(steps []PlanStep) *DependencyResult
- func (da *DependencyAnalyzer) AnalyzeAndWarn(steps []PlanStep, parallelStepIDs []int) ([]PlanStep, []string)
- func (da *DependencyAnalyzer) DetectConflicts(parallelStepIDs []int, steps []PlanStep) []Conflict
- func (da *DependencyAnalyzer) EnhanceWithLSP(steps []PlanStep) []PlanStep
- func (da *DependencyAnalyzer) ExtractFilesFromStep(step *PlanStep) (readFiles, writeFiles []string)
- func (da *DependencyAnalyzer) InferDependencies(steps []PlanStep) []PlanStep
- type DependencyResult
- type FailureAction
- type Plan
- func (p *Plan) CanExecute(stepID int) bool
- func (p *Plan) GetNextStep() int
- func (p *Plan) GetParallelSteps() []int
- func (p *Plan) GetStep(id int) *PlanStep
- func (p *Plan) GetToolsExecuted(stepID int) int
- func (p *Plan) HasFailed() bool
- func (p *Plan) IncrementToolsExecuted(stepID int)
- func (p *Plan) IsCompleted() bool
- func (p *Plan) UpdateStatus(stepID int, status, result string)
- type PlanStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsFailure ¶
ContainsFailure はツール結果に失敗パターンが含まれるか検出 失敗を検出した場合、(true, 理由) を返す
NOTE: "error:" や "Error:" のような汎用パターンは使用しない。 コード検索結果(例: t.Errorf)やログ出力に含まれる "Error" 文字列で 誤検知してしまうため。実際のコマンド失敗を示す具体的なパターンのみ使用。
func ExtractPlanJSON ¶
ExtractPlanJSON はレスポンスからPlan JSONを抽出 見つからない場合は空文字列を返す NOTE: ツール呼び出し JSON ({"tool": ...}) は plan ではないので除外する
func FormatConflictWarning ¶
FormatConflictWarning は競合情報を警告文字列に整形
func HashToolCalls ¶
HashToolCalls は toolCalls セットのハッシュを生成(ループ検知用)
Types ¶
type Conflict ¶
type Conflict struct {
StepIDs []int // 競合するステップID
ConflictType string // "write-write", "read-write", "write-read"
Files []string // 競合ファイル
Message string // 詳細メッセージ
}
Conflict は並列実行時の競合情報
type DependencyAnalyzer ¶
type DependencyAnalyzer struct {
// contains filtered or unexported fields
}
DependencyAnalyzer はプランステップ間の依存関係を解析
func NewDependencyAnalyzer ¶
func NewDependencyAnalyzer(lspClient *lsp.Client) *DependencyAnalyzer
NewDependencyAnalyzer は DependencyAnalyzer を作成
func (*DependencyAnalyzer) Analyze ¶
func (da *DependencyAnalyzer) Analyze(steps []PlanStep) *DependencyResult
Analyze はステップ間の依存関係を解析
func (*DependencyAnalyzer) AnalyzeAndWarn ¶
func (da *DependencyAnalyzer) AnalyzeAndWarn(steps []PlanStep, parallelStepIDs []int) ([]PlanStep, []string)
AnalyzeAndWarn は依存関係を解析し、競合があれば警告を返す
func (*DependencyAnalyzer) DetectConflicts ¶
func (da *DependencyAnalyzer) DetectConflicts(parallelStepIDs []int, steps []PlanStep) []Conflict
DetectConflicts は並列実行時の競合を検出
func (*DependencyAnalyzer) EnhanceWithLSP ¶
func (da *DependencyAnalyzer) EnhanceWithLSP(steps []PlanStep) []PlanStep
EnhanceWithLSP はLSPを使用して依存関係を強化 WriteFilesに含まれるファイルのシンボル参照を取得し、 参照元ファイルが他のステップで使用されていれば依存関係を追加
func (*DependencyAnalyzer) ExtractFilesFromStep ¶
func (da *DependencyAnalyzer) ExtractFilesFromStep(step *PlanStep) (readFiles, writeFiles []string)
ExtractFilesFromStep はステップからファイルパスを抽出
func (*DependencyAnalyzer) InferDependencies ¶
func (da *DependencyAnalyzer) InferDependencies(steps []PlanStep) []PlanStep
InferDependencies は依存関係を自動推論 RAW (Read After Write): BがAの書き込みファイルを読む WAW (Write After Write): 両方が同じファイルに書く WAR (Write After Read): BがAの読み取りファイルに書く
type DependencyResult ¶
type DependencyResult struct {
Steps []PlanStep // 依存関係が補完されたステップ
Conflicts []Conflict // 検出された競合
Warnings []string // 警告メッセージ
}
DependencyResult は依存関係解析の結果
type FailureAction ¶
type FailureAction string
FailureAction は失敗時のユーザー選択
const ( FailureActionRetry FailureAction = "retry" FailureActionComment FailureAction = "comment" FailureActionSkip FailureAction = "skip" FailureActionAbort FailureAction = "abort" )
type Plan ¶
Plan は実行計画を表す
func ParsePlan ¶
ParsePlan はJSON文字列からPlanを解析
互換対応: - V2形式: {"plan": {...}} - 旧形式: {"summary": "...", "steps": [...]}
func (*Plan) GetParallelSteps ¶
GetParallelSteps は並列実行可能なステップを取得 depends_on が同じステップは並列実行可能と判定
func (*Plan) GetToolsExecuted ¶
GetToolsExecuted は実行ツール数を取得
func (*Plan) IncrementToolsExecuted ¶
IncrementToolsExecuted は実行ツール数をインクリメント
func (*Plan) UpdateStatus ¶
UpdateStatus はステップのステータスを更新
type PlanStep ¶
type PlanStep struct {
ID int `json:"id"`
Description string `json:"description"`
Tools []string `json:"tools"` // 使用予定ツール
DependsOn []int `json:"depends_on"` // 依存するステップID
Status string `json:"status"` // "pending", "running", "completed", "failed"
Result string `json:"result"` // 実行結果
ToolsExecuted int `json:"-"` // 実際に実行されたツール数
// ファイルアクセス情報(依存関係解析で使用)
TargetFiles []string `json:"-"` // 操作対象ファイル(推論結果)
ReadFiles []string `json:"-"` // 読み取りファイル
WriteFiles []string `json:"-"` // 書き込みファイル
}
PlanStep は計画の1ステップを表す