From 1a042724cbb88de9b290903885b8ef93b774162a Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 23 Mar 2026 19:23:42 -0700 Subject: [PATCH] docs: add refactors section with non-lint use case examples Show how sweeper handles refactoring large files, resolving TODOs, cyclomatic complexity, and failing tests via piped input. --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index edebd16..8b5ce79 100644 --- a/README.md +++ b/README.md @@ -176,12 +176,39 @@ sweeper run --provider ollama --model qwen2.5-coder:7b sweeper run --provider ollama --model codellama --api-base http://gpu-server:11434 ``` +### Refactors + +Sweeper fixes anything you can express as `file:line: message` output. Pipe the output of any detection command and agents will work on each file in parallel. + +```bash +# Refactor files over 1000 lines +find . -name '*.go' -exec wc -l {} + \ + | awk '$1 > 1000 {print $2":1: file exceeds 1000 lines"}' \ + | sweeper run + +# Resolve TODO comments across the codebase +grep -rn 'TODO\|FIXME\|HACK' --include='*.go' . | sweeper run + +# Find and fix functions exceeding cyclomatic complexity +gocyclo -over 15 ./... | sweeper run + +# Split oversized React components +find src -name '*.tsx' -exec wc -l {} + \ + | awk '$1 > 500 {print $2":1: component exceeds 500 lines"}' \ + | sweeper run + +# Fix failing tests by feeding test output to agents +go test ./... 2>&1 | sweeper run +``` + When using sweeper as a skill, you can pass arbitrary goals to the agent: - "Run sweeper on this project" — default lint-fix loop - "Run sweeper to clean up AI slop — remove verbose comments, unnecessary null checks, filler docstrings, and over-abstractions" - "Run sweeper to fix all failing tests" - "Run sweeper to migrate deprecated API calls" +- "Run sweeper to refactor files over 1000 lines" +- "Run sweeper to resolve all TODOs" The agent will pick the right command and flags based on your goal.