speci refactor
One-shot codebase refactoring analysis via GitHub Copilot CLI. Dispatches the speci-refactor agent to identify and document refactoring opportunities.
Usage
speci refactor [-s <path-or-glob>] [-o <path>] [-v]
Options
| Flag | Description |
|---|---|
-s, --scope <path-or-glob> |
Limit analysis to a path or glob pattern (e.g. src/utils, lib/**) |
-o, --output <path> |
Path to write the refactoring analysis |
-v, --verbose |
Show the full prompt and agent output |
Flow
- Scope validation — if
--scopeis a path (not a glob), resolves it and warns if it doesn’t exist (non-fatal). Glob patterns are passed as-is. - Initialise — loads config, runs preflight, resolves the
speci-refactoragent. - Dispatch agent — runs
speci-refactor.agent.mdwith the scope context. - Write output — saves the refactoring analysis to the output file.
Example
speci refactor --scope src/api --output docs/api-refactor.md