Files
oh-my-opencode-free-fork/src/tools/glob/utils.ts
YeonGyu-Kim ed3d7a55f4 feat(tools): add glob tool with timeout protection
- Override OpenCode's built-in glob with 60s timeout
- Kill process on expiration to prevent indefinite hanging
- Reuse grep's CLI resolver for ripgrep detection

Generated by [OpenCode](https://opencode.ai/)
2025-12-08 17:00:02 +09:00

27 lines
572 B
TypeScript

import type { GlobResult } from "./types"
export function formatGlobResult(result: GlobResult): string {
if (result.error) {
return `Error: ${result.error}`
}
if (result.files.length === 0) {
return "No files found"
}
const lines: string[] = []
lines.push(`Found ${result.totalFiles} file(s)`)
lines.push("")
for (const file of result.files) {
lines.push(file.path)
}
if (result.truncated) {
lines.push("")
lines.push("(Results are truncated. Consider using a more specific path or pattern.)")
}
return lines.join("\n")
}