feat(hashline-read-enhancer): add write tool support and fix early termination

- Support write tool in addition to read tool

- Fix early termination when encountering non-matching lines

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-02-19 15:54:15 +09:00
parent 1a7efe594d
commit e6f73201ae
2 changed files with 63 additions and 29 deletions
+12 -2
View File
@@ -8,7 +8,8 @@ interface HashlineReadEnhancerConfig {
const READ_LINE_PATTERN = /^(\d+): (.*)$/
function isReadTool(toolName: string): boolean {
return toolName.toLowerCase() === "read"
const lower = toolName.toLowerCase()
return lower === "read" || lower === "write"
}
function shouldProcess(config: HashlineReadEnhancerConfig): boolean {
@@ -39,7 +40,16 @@ function transformOutput(output: string): string {
return output
}
const lines = output.split("\n")
return lines.map(transformLine).join("\n")
const result: string[] = []
for (const line of lines) {
if (!READ_LINE_PATTERN.test(line)) {
result.push(line)
result.push(...lines.slice(result.length))
break
}
result.push(transformLine(line))
}
return result.join("\n")
}
export function createHashlineReadEnhancerHook(