Skip to content

Commit 7a4b59b

Browse files
committed
feat(tools): 10 new native performance/parallelism tools
batch_patch — Apply up to 10 edits atomically (transactional early-stop). Replaces N serial patch calls with one batch call. parallel_shell — Run up to 8 shell commands concurrently with bounded goroutines. Each classified individually through the danger gate. Structured results with stdout, stderr, exit_code, duration_ms. http_batch — Fetch up to 10 URLs in parallel goroutines. Returns status, content_length, error per URL. ClassifyURL gated per URL. math_eval — Native arithmetic expression evaluator using go/parser + AST walk. Supports +, -, *, /, parentheses, decimals. Directly replaces bc/expr/python -c forks (hits quick_math benchmark). diff — LCS-based structured diff between two files or file-vs-string. Returns typed hunks (equal/added/removed) with line-by-line data. Zero dependencies, no diff fork. count_lines — Streaming line/byte/char counter for up to 20 files in parallel. Zero-alloc on content (bufio.Scanner). Replaces wc fork. multi_grep — Search for up to 10 regex patterns in parallel, each with its own goroutine directory walk. Directly targets multi_search benchmark — replaces N serial search_files calls. json_query — JSON path query engine using dot-path syntax with array indexing (key.sub[0].name). Go encoding/json decoder, no jq fork. tree — Structured directory tree listing with file counts, sizes, nesting. Configurable depth and hidden-file filtering. checksum — SHA-256/SHA-1/MD5 hashing using Go crypto stdlib. Up to 10 files in parallel. Replaces sha256sum/md5sum forks. Security: all tools gated through danger.ClassifyPath/ClassifyURL + CheckOperation. All file opens use O_NOFOLLOW. All registered in classifyToolCall() for batch approval gate. 25 new tests. 0 new dependencies.
1 parent 7644170 commit 7a4b59b

4 files changed

Lines changed: 2126 additions & 3 deletions

File tree

cmd/odek/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,16 @@ func builtinTools(dc danger.DangerousConfig, sm *skills.SkillManager, approver d
14001400
&batchReadTool{dangerousConfig: dc},
14011401
&globTool{dangerousConfig: dc},
14021402
&fileInfoTool{dangerousConfig: dc},
1403+
&batchPatchTool{dangerousConfig: dc},
1404+
&parallelShellTool{dangerousConfig: dc, approver: approver},
1405+
newHTTPBatchTool(dc),
1406+
&mathEvalTool{},
1407+
&diffTool{dangerousConfig: dc},
1408+
&countLinesTool{dangerousConfig: dc},
1409+
&multiGrepTool{dangerousConfig: dc},
1410+
&jsonQueryTool{dangerousConfig: dc},
1411+
&treeTool{dangerousConfig: dc},
1412+
&checksumTool{dangerousConfig: dc},
14031413
newBrowserTool(dc),
14041414
}
14051415

0 commit comments

Comments
 (0)