/update-package
Mission
Update the specified package to its reasonably latest stable version or to the version specified by the user, ensuring builds and tests pass through automated fixing of breaking changes.
Process
Phase 1: Analysis & Update
- Identify: Read
package.json for current version (dependencies/devDependencies/resolutions)
- Research: Use
yarn npm info <package> --json | jq -r '.["dist-tags"].latest' to find latest version; compare with current version; determine if update is needed
- Interactive Gather: Ask user:
- "Do you have a migration guide URL for this update?" (optional)
- "Do you have a changelog/release notes URL?" (optional)
- "Any specific breaking changes you're aware of?" (optional)
- If provided, fetch and analyze these resources using WebFetch
- Update: Modify
package.json and resolutions; run yarn install; report peer dependency warnings
Phase 2: Build
- Build: Run
yarn build; capture all errors with file paths and line numbers
- Analyze: On success → Phase 3. On failure → categorize errors (TypeScript/import/API) → Phase 4
Phase 3: Test
- Test: Run
yarn test; capture failures, deprecations, stack traces
- Analyze: On success → Phase 5. On failure → identify API changes → Phase 4
Phase 4: Auto-Fix
- Fix Build Errors:
- For each error, read file and identify issue (import/type/API change)
- Use migration guide/changelog (if provided) to inform fixes
- Apply fixes: update imports, types, method calls
- If stuck, ask user: "I'm seeing error X in file Y. The migration guide doesn't cover this. Do you know the fix or have additional documentation?"
- Fix Tests: Read test files, update expectations/mocks for API changes
- Verify: Re-run build → tests. If new errors appear, repeat the full fix cycle (Phase 4 → verify). Max 3 complete cycles of fixing all errors → build → test (then ask user for guidance)
Phase 5: Complete
- Final Check: Run
yarn build and yarn test - verify both pass
- Report:
- Package:
<package> <old> → <new>
- Files modified, errors fixed, breaking changes
- Build ✓ | Tests ✓
- Commit:
Update <package> from <old> to <new>
- Updated package.json and yarn.lock
- Fixed <N> build errors
- Fixed <N> test failures
- Breaking changes: <summary>
Guidelines
Code Standards:
- For coding patterns and project structure: Read
STYLEGUIDE.md, AGENTS.md, and other relevant documentation
- Follow existing code patterns found in the codebase
Package Update Rules:
- Only update specified package; no unrelated changes
- Don't modify config files (.gitignore, eslintrc, tsconfig) unless required
- Never skip/suppress errors - address or document all
- All tests must pass; only change expectations if package behavior legitimately changed
- Interactive approach: Ask user for migration docs, changelogs, or specific fixes when needed
- Use WebFetch to analyze provided documentation URLs
- Provide progress updates during long operations (build: 2-5min, tests: 1-3min)
- Use TaskCreate/TaskUpdate to track phases (these are Claude Code tools for tracking workflow phases with states: pending, in_progress, completed)
Special Cases:
- PatternFly: May need coordinated @patternfly/* updates; check peer deps
- TypeScript: Update @types/* alongside runtime packages
- Workspace: Changes affect
packages/*; build from frontend directory
Success Criteria
✓ Package updated in package.json + yarn.lock
✓ yarn build passes
✓ yarn test passes
✓ Breaking changes fixed
✓ Committed with descriptive message
Failure After 3 Iterations
- Document issues with file paths and errors
- Provide manual fix recommendations
- List breaking changes needing review
- Suggest rollback if critical
Example: Interactive Flow
User: /update-package @patternfly/react-core
Assistant: Current version: 6.2.2, Latest: 6.3.0
Before I proceed, do you have:
1. Migration guide URL? (optional)
2. Changelog/release notes URL? (optional)
3. Known breaking changes? (optional)
User: Yes, https://github.com/patternfly/patternfly-react/releases/tag/v6.3.0
Assistant: [Fetches and analyzes release notes]
Found breaking changes:
- hideTitle prop → isHeaderHidden
- NavList moved to @patternfly/react-core/deprecated
Proceeding with update...
[Updates package, builds, fixes errors using migration info, tests, commits]
1---2name: update-package3description: Expert package update assistant for OpenShift Console. Update packages safely with automated testing, building, and fixing.4---56# /update-package78## Mission9Update the specified package to its reasonably latest stable version or to the version specified by the user, ensuring builds and tests pass through automated fixing of breaking changes.1011## Process1213### Phase 1: Analysis & Update141. **Identify**: Read `package.json` for current version (dependencies/devDependencies/resolutions)152. **Research**: Use `yarn npm info <package> --json | jq -r '.["dist-tags"].latest'` to find latest version; compare with current version; determine if update is needed163. **Interactive Gather**: Ask user:17 - "Do you have a migration guide URL for this update?" (optional)18 - "Do you have a changelog/release notes URL?" (optional)19 - "Any specific breaking changes you're aware of?" (optional)20 - If provided, fetch and analyze these resources using WebFetch214. **Update**: Modify `package.json` and resolutions; run `yarn install`; report peer dependency warnings2223### Phase 2: Build245. **Build**: Run `yarn build`; capture all errors with file paths and line numbers256. **Analyze**: On success → Phase 3. On failure → categorize errors (TypeScript/import/API) → Phase 42627### Phase 3: Test287. **Test**: Run `yarn test`; capture failures, deprecations, stack traces298. **Analyze**: On success → Phase 5. On failure → identify API changes → Phase 43031### Phase 4: Auto-Fix329. **Fix Build Errors**:33 - For each error, read file and identify issue (import/type/API change)34 - Use migration guide/changelog (if provided) to inform fixes35 - Apply fixes: update imports, types, method calls36 - If stuck, ask user: "I'm seeing error X in file Y. The migration guide doesn't cover this. Do you know the fix or have additional documentation?"3710. **Fix Tests**: Read test files, update expectations/mocks for API changes3811. **Verify**: Re-run build → tests. If new errors appear, repeat the full fix cycle (Phase 4 → verify). Max 3 complete cycles of fixing all errors → build → test (then ask user for guidance)3940### Phase 5: Complete4112. **Final Check**: Run `yarn build` and `yarn test` - verify both pass4213. **Report**:43 - Package: `<package>` `<old>` → `<new>`44 - Files modified, errors fixed, breaking changes45 - Build ✓ | Tests ✓4614. **Commit**:47 ```git48 Update <package> from <old> to <new>4950 - Updated package.json and yarn.lock51 - Fixed <N> build errors52 - Fixed <N> test failures53 - Breaking changes: <summary>54 ```55 - 🤖 Generated with [Claude Code](https://claude.com/claude-code)56 - Co-Authored-By: Claude <noreply@anthropic.com>5758## Guidelines5960**Code Standards**:61- For coding patterns and project structure: Read `STYLEGUIDE.md`, `AGENTS.md`, and other relevant documentation62- Follow existing code patterns found in the codebase6364**Package Update Rules**:65- Only update specified package; no unrelated changes66- Don't modify config files (.gitignore, eslintrc, tsconfig) unless required67- Never skip/suppress errors - address or document all68- All tests must pass; only change expectations if package behavior legitimately changed69- **Interactive approach**: Ask user for migration docs, changelogs, or specific fixes when needed70- Use WebFetch to analyze provided documentation URLs71- Provide progress updates during long operations (build: 2-5min, tests: 1-3min)72- Use TaskCreate/TaskUpdate to track phases (these are Claude Code tools for tracking workflow phases with states: pending, in_progress, completed)7374**Special Cases**:75- **PatternFly**: May need coordinated @patternfly/* updates; check peer deps76- **TypeScript**: Update @types/* alongside runtime packages77- **Workspace**: Changes affect `packages/*`; build from frontend directory7879## Success Criteria80✓ Package updated in package.json + yarn.lock81✓ `yarn build` passes82✓ `yarn test` passes83✓ Breaking changes fixed84✓ Committed with descriptive message8586## Failure After 3 Iterations871. Document issues with file paths and errors882. Provide manual fix recommendations893. List breaking changes needing review904. Suggest rollback if critical9192## Example: Interactive Flow93```text94User: /update-package @patternfly/react-core95Assistant: Current version: 6.2.2, Latest: 6.3.09697Before I proceed, do you have:981. Migration guide URL? (optional)992. Changelog/release notes URL? (optional)1003. Known breaking changes? (optional)101102User: Yes, https://github.com/patternfly/patternfly-react/releases/tag/v6.3.0103104Assistant: [Fetches and analyzes release notes]105Found breaking changes:106- hideTitle prop → isHeaderHidden107- NavList moved to @patternfly/react-core/deprecated108109Proceeding with update...110[Updates package, builds, fixes errors using migration info, tests, commits]111```