fix(hashline-edit): stabilize TUI diff metadata and output flow
Align edit/write hashline handling with TUI expectations by preserving metadata through tool execution, keeping unified diff raw to avoid duplicated line numbers, and tightening read/write/edit outputs plus tests for reliable agent operation.
This commit is contained in:
@@ -52,6 +52,14 @@ function transformOutput(output: string): string {
|
||||
return result.join("\n")
|
||||
}
|
||||
|
||||
function transformWriteOutput(output: string): string {
|
||||
if (!output) {
|
||||
return output
|
||||
}
|
||||
const lines = output.split("\n")
|
||||
return lines.map((line) => (READ_LINE_PATTERN.test(line) ? transformLine(line) : line)).join("\n")
|
||||
}
|
||||
|
||||
export function createHashlineReadEnhancerHook(
|
||||
_ctx: PluginInput,
|
||||
config: HashlineReadEnhancerConfig
|
||||
@@ -70,7 +78,7 @@ export function createHashlineReadEnhancerHook(
|
||||
if (!shouldProcess(config)) {
|
||||
return
|
||||
}
|
||||
output.output = transformOutput(output.output)
|
||||
output.output = input.tool.toLowerCase() === "write" ? transformWriteOutput(output.output) : transformOutput(output.output)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user