Outfitter Upgrade
Upgrade @outfitter/* packages with structured migration — from version detection through codemod execution to test verification.
Steps
- Detect — Run
outfitter upgrade --jsonto discover installed versions and available updates. - Decide — Present findings. Choose interactive or autonomous mode based on scope.
- Apply — Run
outfitter upgradeto bump deps, install, and run mechanical codemods (interactive prompt by default; use--yesto skip). - Migrate — For remaining changes not covered by codemods, apply code transforms manually using structured change metadata.
- Verify — Run tests. If failures, diagnose using migration docs as context, fix, re-verify.
- Confirm — Load
outfitter-checkfor final compliance scan.
Mode Selection
| Condition | Mode | Rationale |
|---|---|---|
| No breaking changes | Auto | Bump, install, run tests — no code changes expected |
| Breaking changes with codemods | Autonomous | CLI handles mechanical transforms, agent verifies |
| Breaking changes, no codemods | Interactive | Agent needs judgment for code migration |
| Major version jump (>2 minor) | Interactive | Too many changes to auto-apply safely |
Autonomous Loop
When in autonomous mode, follow this cycle:
detect → apply → codemod → migrate → test → fix → repeat
↓
(green) → confirm → done
Step-by-step
- Run
outfitter upgrade --jsonto get structured output - Parse the
packagesarray for updates, checkhasBreaking - Run
outfitter upgrade --yes(or--all --yesif breaking changes are expected) - CLI bumps deps, installs, discovers codemods, runs them automatically
- Parse
codemodssummary from output — checkerrorsarray - Run
outfitter upgrade --guide --jsonto fetch structured migration guides - For each
guidein the guide output withchanges:- Skip changes where
change.codemodexists (already handled) - Apply remaining changes using the structured metadata (see Decision Framework)
- Skip changes where
- Run
bun test(orbun run testfrom repo root) - If tests fail:
a. Read failure output
b. Cross-reference with migration doc guidance (
outfitter upgrade --guide) c. Fix the issue d. Re-run tests e. If still failing after 3 attempts, escalate to user - When green: load
outfitter-checkskill for compliance verification
CLI Reference
# Check installed versions
outfitter upgrade
# JSON output for programmatic parsing
outfitter upgrade --json
# Show migration instructions
outfitter upgrade --guide
outfitter upgrade --guide @outfitter/cli # specific package
# Upgrade with interactive prompt (default)
outfitter upgrade
# Upgrade non-interactively (skip prompts)
outfitter upgrade --yes
# Include breaking changes
outfitter upgrade --all
# Preview without making changes
outfitter upgrade --dry-run
# Upgrade without running codemods
outfitter upgrade --no-codemods
JSON Output Shape
interface UpdateResult {
packages: PackageVersionInfo[];
total: number;
updatesAvailable: number;
hasBreaking: boolean;
applied: boolean;
appliedPackages: string[];
skippedBreaking: string[];
guides?: MigrationGuide[];
codemods?: CodemodSummary;
}
See references/structured-changes.md for full type definitions and parsing examples.
Decision Framework
By Change Type
change.type |
Agent Action |
|---|---|
moved |
Update import paths: from → to |
renamed |
Find-and-replace: from → to in imports and usages |
removed |
Find usages of from, replace with alternative from detail |
signature-changed |
Update call sites per detail description |
deprecated |
Optional: migrate now or add TODO for later |
added |
No action needed — informational |
By Update Type
| Update Type | Action |
|---|---|
| Patch (0.1.0 → 0.1.1) | Bump, test — no code changes expected |
| Minor (0.1.0 → 0.2.0) | Review migration doc for new APIs, adopt if beneficial |
| Breaking (flagged) | Follow migration guide, apply codemods, update code, test |
Dependency Order
When updating multiple packages, follow the tier order:
- Foundation: contracts, types
- Runtime: cli, mcp, config, logging, file-ops, state, index, daemon, schema, tui
- Tooling: testing, outfitter (umbrella CLI)
Update lower tiers first — runtime packages depend on foundation changes.
Migration Docs
Migration guides are at ${CLAUDE_PLUGIN_ROOT}/shared/migrations/ with naming:
outfitter-<package>-<version>.md
Each doc has YAML frontmatter with structured changes:
---
package: "@outfitter/cli"
version: 0.4.0
breaking: true
changes:
- type: moved
from: "@outfitter/cli/render"
to: "@outfitter/tui/render"
codemod: "cli/0.4.0-move-tui-imports.ts"
- type: renamed
from: "formatOutput"
to: "renderOutput"
---
Changes with a codemod field are handled automatically during upgrade. The remaining changes need manual migration.
Codemods
Codemod scripts live at ${CLAUDE_PLUGIN_ROOT}/shared/codemods/ organized by package:
codemods/
cli/
0.4.0-move-tui-imports.ts
contracts/
adopt-result-types.ts
Each exports a transform(options) function. The CLI discovers and runs them automatically during upgrade. Agents should not run codemods directly — let the CLI handle it.
Error Recovery
| Failure | Recovery |
|---|---|
| Upgrade fails on install | Check network, verify package exists on npm |
| Codemod reports errors | Read the errors array, fix manually, re-run |
| Tests fail after migration | Read failure, cross-reference migration doc, fix code |
| 3+ test fix attempts fail | Escalate to user with evidence |
Related Skills
outfitter-atlas— Patterns and templates for current package versionsoutfitter-check— Compliance verification after updatesoutfitter-start— Full adoption workflow (for new or first-time setup)tdd-fieldguide— Test-driven development methodology for the verify loop