Skip to content

refactor(tool): extract safety helpers into internal/toolsafety - #315

Merged
Patel230 merged 1 commit into
mainfrom
refactor/toolsafety-split
Sep 15, 2026
Merged

Patel230 merged 1 commit into
mainfrom
refactor/toolsafety-split

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

First cut of the internal/tool god-package split.

Moves the self-contained safety layer out of the 41k-LOC internal/tool package into a new low-level internal/toolsafety:

  • destructive-command detection, credential detection, binary detection, output truncation, per-tool timeouts
  • SSRF guards (ValidateURLPublic, SSRFSafeClient, WithSSRFSkip)
  • command segmentation (SegmentCommand)

tool re-exports the symbols so existing callers keep compiling, and internal/engine/search now imports toolsafety directly instead of the god package — a real decoupling, not just a re-export.

internal/tool loses ~500 lines of implementation and ~660 lines of tests.

Verified: go vet, golangci-lint (0 issues), full go test ./..., make boundaries, gofumpt clean.

Move the self-contained safety layer (destructive-command detection,
credential detection, binary detection, output truncation, SSRF guards,
command segmentation) out of the 41k-LOC internal/tool package into a new
low-level internal/toolsafety package. tool re-exports the symbols so existing
callers keep compiling, and internal/engine/search now imports toolsafety
directly instead of the god package.

internal/tool loses ~500 lines of implementation and ~660 lines of tests.
@Patel230
Patel230 merged commit 3058016 into main Sep 15, 2026
25 checks passed
@Patel230
Patel230 deleted the refactor/toolsafety-split branch September 15, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant