mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #1599 from RooVetGit/diff_strategy_telemetry
Add diffStrategy name to telemetry
This commit is contained in:
commit
3cd6c7416a
7 changed files with 26 additions and 1 deletions
|
|
@ -33,6 +33,10 @@ export class MultiSearchReplaceDiffStrategy implements DiffStrategy {
|
|||
private fuzzyThreshold: number
|
||||
private bufferLines: number
|
||||
|
||||
getName(): string {
|
||||
return "MultiSearchReplace"
|
||||
}
|
||||
|
||||
constructor(fuzzyThreshold?: number, bufferLines?: number) {
|
||||
// Use provided threshold or default to exact matching (1.0)
|
||||
// Note: fuzzyThreshold is inverted in UI (0% = 1.0, 10% = 0.9)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import { DiffResult, DiffStrategy } from "../../types"
|
|||
export class NewUnifiedDiffStrategy implements DiffStrategy {
|
||||
private readonly confidenceThreshold: number
|
||||
|
||||
getName(): string {
|
||||
return "NewUnified"
|
||||
}
|
||||
|
||||
constructor(confidenceThreshold: number = 1) {
|
||||
this.confidenceThreshold = Math.max(confidenceThreshold, 0.8)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ export class SearchReplaceDiffStrategy implements DiffStrategy {
|
|||
private fuzzyThreshold: number
|
||||
private bufferLines: number
|
||||
|
||||
getName(): string {
|
||||
return "SearchReplace"
|
||||
}
|
||||
|
||||
constructor(fuzzyThreshold?: number, bufferLines?: number) {
|
||||
// Use provided threshold or default to exact matching (1.0)
|
||||
// Note: fuzzyThreshold is inverted in UI (0% = 1.0, 10% = 0.9)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ import { applyPatch } from "diff"
|
|||
import { DiffStrategy, DiffResult } from "../types"
|
||||
|
||||
export class UnifiedDiffStrategy implements DiffStrategy {
|
||||
getName(): string {
|
||||
return "Unified"
|
||||
}
|
||||
getToolDescription(args: { cwd: string; toolOptions?: { [key: string]: string } }): string {
|
||||
return `## apply_diff
|
||||
Description: Apply a unified diff to a file at the specified path. This tool is useful when you need to make specific modifications to a file based on a set of changes provided in unified diff format (diff -U3).
|
||||
|
|
|
|||
|
|
@ -19,8 +19,13 @@ export type DiffResult =
|
|||
}
|
||||
failParts?: DiffResult[]
|
||||
} & ({ error: string } | { failParts: DiffResult[] }))
|
||||
|
||||
export interface DiffStrategy {
|
||||
/**
|
||||
* Get the name of this diff strategy for analytics and debugging
|
||||
* @returns The name of the diff strategy
|
||||
*/
|
||||
getName(): string
|
||||
|
||||
/**
|
||||
* Get the tool description for this diff strategy
|
||||
* @param args The tool arguments including cwd and toolOptions
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ describe("getCapabilitiesSection", () => {
|
|||
const cwd = "/test/path"
|
||||
const mcpHub = undefined
|
||||
const mockDiffStrategy: DiffStrategy = {
|
||||
getName: () => "MockStrategy",
|
||||
getToolDescription: () => "apply_diff tool description",
|
||||
applyDiff: async (originalContent: string, diffContent: string): Promise<DiffResult> => {
|
||||
return { success: true, content: "mock result" }
|
||||
|
|
|
|||
|
|
@ -2704,6 +2704,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
}
|
||||
}
|
||||
|
||||
if (currentCline?.diffStrategy) {
|
||||
properties.diffStrategy = currentCline.diffStrategy.getName()
|
||||
}
|
||||
|
||||
return properties
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue