Skip to content

Commit 4eec8e9

Browse files
authored
docs: add refactors section with non-lint use case examples (#14)
Show how sweeper handles refactoring large files, resolving TODOs, cyclomatic complexity, and failing tests via piped input.
1 parent d77e83d commit 4eec8e9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,39 @@ sweeper run --provider ollama --model qwen2.5-coder:7b
176176
sweeper run --provider ollama --model codellama --api-base http://gpu-server:11434
177177
```
178178

179+
### Refactors
180+
181+
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.
182+
183+
```bash
184+
# Refactor files over 1000 lines
185+
find . -name '*.go' -exec wc -l {} + \
186+
| awk '$1 > 1000 {print $2":1: file exceeds 1000 lines"}' \
187+
| sweeper run
188+
189+
# Resolve TODO comments across the codebase
190+
grep -rn 'TODO\|FIXME\|HACK' --include='*.go' . | sweeper run
191+
192+
# Find and fix functions exceeding cyclomatic complexity
193+
gocyclo -over 15 ./... | sweeper run
194+
195+
# Split oversized React components
196+
find src -name '*.tsx' -exec wc -l {} + \
197+
| awk '$1 > 500 {print $2":1: component exceeds 500 lines"}' \
198+
| sweeper run
199+
200+
# Fix failing tests by feeding test output to agents
201+
go test ./... 2>&1 | sweeper run
202+
```
203+
179204
When using sweeper as a skill, you can pass arbitrary goals to the agent:
180205

181206
- "Run sweeper on this project" — default lint-fix loop
182207
- "Run sweeper to clean up AI slop — remove verbose comments, unnecessary null checks, filler docstrings, and over-abstractions"
183208
- "Run sweeper to fix all failing tests"
184209
- "Run sweeper to migrate deprecated API calls"
210+
- "Run sweeper to refactor files over 1000 lines"
211+
- "Run sweeper to resolve all TODOs"
185212

186213
The agent will pick the right command and flags based on your goal.
187214

0 commit comments

Comments
 (0)