- name
- swiftbutler
- version
- 1.0.0
- description
- >
- homepage
- https://github.com/Cocoanetics/SwiftButler
- metadata
- openclaw
- emoji
- 🧹
- requires
- bins
- ["butler"]
- install
- kind
- brew
- formula
- cocoanetics/tap/swiftbutler
- bins
- ["butler"]
- label
- Install SwiftButler via Homebrew
SwiftButler
Use butler to reduce Swift source into a more manageable working surface.
Setup
Install via Homebrew:
brew install cocoanetics/tap/swiftbutlerVerify:
butler --versionFor local development from a checkout:
swift build
.build/debug/butler --versionCore Rules
- Prefer
analyzewhen an agent needs API shape, not full implementation details. - Prefer
--format yamlor--format jsonwhen the result will be parsed or reused. - Prefer
checkfor fast validation loops beforeswift build. - Use
reindentto normalize indentation in place; choose exactly one of--spaces <n>or--tabs. - Use
distributebefore targeted edits when a generated file has become too large or noisy.
Fast Command Map
Analyze Swift APIs
# Default interface-style output
butler analyze Sources/MyModule
# Public API only
butler analyze Sources/MyModule --visibility public
# Recursive YAML output for tooling
butler analyze Sources --recursive --format yaml
# Write structured output to a file
butler analyze Sources --recursive --format yaml --output api.yamlSupported formats:
interfacejsonyamlmarkdown
Syntax-check Swift quickly
butler check Sources --recursive
butler check Sources --recursive --json
butler check Sources --recursive --json --pretty
butler check Sources --recursive --format markdown --show-fixitsReindent with spaces or tabs
# Default: 3 spaces
butler reindent Sources --recursive
# Explicit spaces
butler reindent Sources --recursive --spaces 2
butler reindent Sources --recursive --spaces 4
# Tabs instead of spaces
butler reindent Sources --recursive --tabs
# Preview without modifying files
butler reindent Sources --recursive --tabs --dry-runNotes:
--spaces <n>accepts values from1to16.--tabsand--spaces <n>are mutually exclusive.- Without
--tabs, the default is--spaces 3.
Distribute large files into smaller ones
# Split one large generated file
butler distribute Generated.swift
# Preview recursive distribution
butler distribute Sources/Generated --recursive --dry-run
# Write distributed files to a separate directory
butler distribute Sources/Generated --recursive --output SplitSourcesWhen to Use Which Command
- Use
analyzeto hand an LLM a compact view of types, functions, properties, and docs. - Use
checkinside generation or repair loops for immediate syntax feedback. - Use
reindentafter generated or patched code has inconsistent indentation. - Use
distributewhen one large Swift file should become declaration-sized files that are easier to inspect and edit.