.vbw-planning/milestones/upgrade-assurance/phases/03-upgrade-skill-docs/PLAN-01.md
@lib/source_monitor/setup/cli.rb -- The Thor CLI that provides bin/source_monitor upgrade as the entry point. Also provides install and verify subcommands. The skill should reference all three commands in context (upgrade is primary, verify for post-upgrade checks, install for first-time setup).
@lib/source_monitor/setup/verification/runner.rb -- Runs 4 verifiers in sequence: PendingMigrationsVerifier, SolidQueueVerifier, RecurringScheduleVerifier, ActionCableVerifier. The upgrade command calls this automatically. The skill should explain what each verifier checks and how to interpret failures.
@lib/source_monitor/configuration/deprecation_registry.rb -- The deprecation framework built in Phase 2. When host apps upgrade and their initializer uses deprecated config options, they get :warning or :error messages. The skill must cover how to handle these: read the deprecation message, find the replacement option, update the initializer, re-run configure.
@CHANGELOG.md -- Keep a Changelog format with version sections. The skill should teach agents to parse this file to identify what changed between the user's current version and the target version. Each version section has Added/Changed/Fixed/Removed subsections.
@.claude/skills/sm-host-setup/SKILL.md -- Existing consumer skill for initial setup. Has a "When to Use" section that includes "Re-running setup after upgrading the gem" -- this should be updated to reference the sm-upgrade skill instead. Add a cross-reference in the References section pointing to sm-upgrade for upgrade workflows.
@lib/source_monitor/setup/skills_installer.rb -- The installer that copies sm-* skills to host apps. CONSUMER_SKILLS constant must include "sm-upgrade". The test file creates fake skills for each entry in CONSUMER_SKILLS, so updating the constant means the test will automatically include sm-upgrade in its assertions.
@test/lib/source_monitor/setup/skills_installer_test.rb -- Tests for the skills installer. Tests iterate CONSUMER_SKILLS and CONTRIBUTOR_SKILLS constants. Adding sm-upgrade to CONSUMER_SKILLS is enough -- existing test assertions use the constants dynamically. However, the first test "install defaults to consumer group" hardcodes specific skill names ("sm-dashboard-widget", "sm-host-setup") and should NOT need updating since it only checks a subset. Verify this after the change.
@docs/setup.md -- Existing setup documentation. The upgrade guide should cross-reference this for initial installation. The setup doc should NOT be modified (it already covers initial install).
@docs/troubleshooting.md -- Existing troubleshooting guide. The upgrade guide should link to this for common issues. The troubleshooting doc should NOT be modified.
@CLAUDE.md lines 182-209 -- Consumer and Contributor Skills tables. Add sm-upgrade row to the Consumer Skills table.
</context>
<tasks>
<task type="auto">
<name>create-sm-upgrade-skill</name>
<files>
.claude/skills/sm-upgrade/SKILL.md
</files>
<action>
Create .claude/skills/sm-upgrade/SKILL.md following the established skill file pattern (frontmatter with name, description, allowed-tools, then markdown body).
Frontmatter:
---
name: sm-upgrade
description: Use when upgrading SourceMonitor to a new gem version, including CHANGELOG review, running the upgrade command, interpreting verification results, and handling configuration deprecations.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---
Body sections (follow the pattern from sm-host-setup):
# sm-upgrade: Gem Upgrade Workflow
Brief intro: guides agents through upgrading SourceMonitor in a host Rails application after a new gem version is released.
## When to Use
## Prerequisites
Table: existing SourceMonitor installation (check .source_monitor_version or config/initializers/source_monitor.rb), access to CHANGELOG.md (bundled with gem).
## Upgrade Workflow
Step-by-step numbered workflow:
CHANGELOG.md in the gem source. Identify changes between the current installed version (from .source_monitor_version or Gemfile.lock) and the target version. Focus on Added, Changed, Fixed, Removed sections. Flag any breaking changes or deprecation notices.gem "source_monitor", "~> X.Y". Run bundle update source_monitor.bin/source_monitor upgrade. This automatically: detects the version change via .source_monitor_version marker, copies new migrations, re-runs the install generator (idempotent), runs the full verification suite.bin/rails db:migrate if the upgrade command copied new migrations.sm-configure skill for configuration reference.bin/source_monitor verify to confirm all checks pass.## Interpreting Upgrade Results
Table of verification check results and what they mean: | Check | OK | Warning | Failure | | PendingMigrations | All engine migrations present | - | Missing migrations need copying | | SolidQueue | Workers running | - | Start Solid Queue workers | | RecurringSchedule | Tasks registered | - | Re-run generator or check queue.yml | | ActionCable | Adapter configured | - | Configure Solid Cable or Redis |
## Handling Deprecation Warnings
Explain the two severity levels:
:warning -- Option renamed. The old name still works but logs a deprecation message. Update initializer to use the new option name. The message includes the replacement path.:error -- Option removed. Using the old name raises SourceMonitor::DeprecatedOptionError. You must remove or replace the option before the app can boot.Pattern for fixing:
config/initializers/source_monitor.rb## Edge Cases
## Key Source Files
Table mapping file to purpose:
| File | Purpose |
| lib/source_monitor/setup/upgrade_command.rb | Upgrade orchestrator |
| lib/source_monitor/setup/cli.rb | CLI entry point (bin/source_monitor upgrade) |
| lib/source_monitor/setup/verification/runner.rb | Verification runner (4 verifiers) |
| lib/source_monitor/configuration/deprecation_registry.rb | Deprecation framework |
| CHANGELOG.md | Version history (Keep a Changelog format) |
| .source_monitor_version | Version marker in host app root |
## References
docs/upgrade.md -- Human-readable upgrade guidedocs/setup.md -- Initial setup documentationdocs/troubleshooting.md -- Common issues and fixessm-host-setup skill -- Initial installation workflowsm-configure skill -- Configuration reference for updating deprecated options## Checklist
bundle update source_monitor runbin/source_monitor upgrade completed successfullybin/source_monitor verify passes all checksFile 1: upgrade-workflow.md
Detailed step-by-step reference that agents can follow mechanically. This is more prescriptive than the SKILL.md overview.
Title: "Upgrade Workflow Reference"
Sections:
## Pre-Upgrade Checklist
grep source_monitor Gemfile.lock or cat .source_monitor_versionbundle show source_monitor to find gem path, then read CHANGELOG.md)## CHANGELOG Parsing Guide
## [X.Y.Z] - YYYY-MM-DD header## Upgrade Command Internals
How bin/source_monitor upgrade works internally:
.source_monitor_version from host app root (nil if first run)SourceMonitor::VERSION (current gem version)MigrationInstaller.install -- copies new engine migrations to db/migrate/
b. InstallGenerator.run -- re-runs the install generator (idempotent: skips existing routes, initializer, etc.)
c. Verification::Runner.call -- runs all 4 verifiers
d. Writes current version to .source_monitor_version## Post-Upgrade Verification Detailed explanation of each verifier:
db/migrate/. Warns if any are missing or not yet run. Fix: bin/rails db:migrate.bin/rails solid_queue:start or ensure Procfile.dev has a jobs: entry.config/recurring.yml exists and config/queue.yml dispatchers have recurring_schedule: config/recurring.yml.## Troubleshooting Common Upgrade Issues
bundle update source_monitor actually pulled the new version. Verify Gemfile.lock shows the expected version.bin/rails db:migrate.bin/rails generate source_monitor:install. It is idempotent.File 2: version-history.md
Version-specific upgrade notes for each major/minor version transition.
Title: "Version-Specific Upgrade Notes"
## 0.3.x to 0.4.0 Released: 2026-02-12
Key changes:
Procfile.dev and queue.yml dispatcher configconfig.images.download_to_active_storage)Action items:
bin/source_monitor upgrade (or bin/rails generate source_monitor:install) to get Procfile.dev and queue.yml patchesconfig.images.download_to_active_storage = true to initializerconfig.http.ssl_* settings are available## 0.2.x to 0.3.0 Released: 2026-02-10
Key changes:
lib/source_monitor.rbsm-* skills)Action items:
bin/source_monitor upgrade to copy any new migrationsbin/rails source_monitor:skills:install## 0.1.x to 0.2.0 Released: 2025-11-25
Key changes:
Action items:
bin/rails railties:install:migrations FROM=source_monitor && bin/rails db:migrate## Future Versions Template for documenting future upgrades:
## X.Y.Z to A.B.C
Released: YYYY-MM-DD
Key changes:
- ...
Action items:
1. ...
Deprecations:
- `old_option` replaced by `new_option` (warning in A.B.C, removal planned for D.E.F)
Human-readable upgrade guide (REQ-30). This is for developers reading docs, not AI agents.
Title: "# SourceMonitor Upgrade Guide"
## General Upgrade Steps
Numbered list:
bundle update source_monitorbin/source_monitor upgradebin/rails db:migratebin/source_monitor verify## Quick Upgrade (Most Cases)
# 1. Update the gem
bundle update source_monitor
# 2. Run the upgrade command (handles migrations, generator, verification)
bin/source_monitor upgrade
# 3. Migrate if needed
bin/rails db:migrate
# 4. Restart
# (restart web server and Solid Queue workers)
## Deprecation Handling
When upgrading, you may see deprecation warnings in your Rails log:
[SourceMonitor] DEPRECATION: 'http.old_option' was deprecated in v0.5.0 and replaced by 'http.new_option'.
To resolve:
config/initializers/source_monitor.rbconfig.http.old_option = value)config.http.new_option = value)If a removed option raises an error (SourceMonitor::DeprecatedOptionError), you must update the initializer before the app can boot.
## Version-Specific Notes
Released: 2026-02-12
What changed:
Procfile.dev with a Solid Queue jobs: entryconfig/queue.yml dispatcher with recurring_schedule: config/recurring.ymlUpgrade steps:
bundle update source_monitor
bin/source_monitor upgrade
bin/rails db:migrate
Notes:
bin/rails generate source_monitor:install) will add missing Procfile.dev and queue.yml entries without overwriting existing config.config.images.download_to_active_storage = true, config.http.ssl_ca_file, config.http.ssl_ca_path, config.http.ssl_verify.Released: 2026-02-10
What changed:
sm-* Claude Code skills)Upgrade steps:
bundle update source_monitor
bin/source_monitor upgrade
bin/rails db:migrate
Notes:
SourceMonitor::FeedFetcher internals), verify your code against the new module structure.bin/rails source_monitor:skills:installReleased: 2025-11-25
What changed:
ImportHistory model and associated migrationsUpgrade steps:
bundle update source_monitor
bin/rails railties:install:migrations FROM=source_monitor
bin/rails db:migrate
Notes:
## Troubleshooting
bundle show source_monitorGemfile.lock for the resolved version.source_monitor_version marker was manually edited, delete it and re-run upgradedb/migrate/ (keep the newer one)bin/rails db:migratedocs/configuration.mdbin/rails db:migrateProcfile.dev for a jobs: entry.bin/rails generate source_monitor:install to patch config/queue.ymlFor additional help, see Troubleshooting.
## See Also
File 2: Update .claude/skills/sm-host-setup/SKILL.md
Make two changes:
In the "## When to Use" section, change the bullet "Re-running setup after upgrading the gem" to:
"Re-running setup after upgrading the gem (see also: sm-upgrade skill for full upgrade workflow)"
In the "## References" section at the bottom, add a new bullet:
"- sm-upgrade skill -- Upgrade workflow for gem version updates"
In the "## Testing" section, after item 3 ("Create a source and trigger..."), add item 4:
"4. For subsequent gem updates, use bin/source_monitor upgrade -- see the sm-upgrade skill"
Read .claude/skills/sm-host-setup/SKILL.md. Confirm: (a) "When to Use" bullet updated to reference sm-upgrade, (b) References section includes sm-upgrade, (c) Testing section includes item 4 referencing sm-upgrade.
</verify>
<done>
docs/upgrade.md created with general steps, quick upgrade commands, deprecation handling, version-specific notes for all 3 major transitions, and troubleshooting. sm-host-setup SKILL.md updated with 3 cross-references to sm-upgrade.
</done>
</task>
<task type="auto">
<name>update-skills-installer-and-catalog</name>
<files>
lib/source_monitor/setup/skills_installer.rb
test/lib/source_monitor/setup/skills_installer_test.rb
CLAUDE.md
</files>
<action>
File 1: Update lib/source_monitor/setup/skills_installer.rb
Add sm-upgrade to the CONSUMER_SKILLS constant. Insert it in alphabetical order within the array:
CONSUMER_SKILLS = %w[
sm-configure sm-dashboard-widget sm-event-handler
sm-host-setup sm-model-extension sm-scraper-adapter
sm-upgrade
].freeze
Note: the original order is not strictly alphabetical (sm-host-setup comes first). Maintain the existing grouping style but add sm-upgrade at the end of the array (after sm-dashboard-widget, before the closing bracket), keeping the same line-break pattern:
CONSUMER_SKILLS = %w[
sm-host-setup sm-configure sm-scraper-adapter
sm-event-handler sm-model-extension sm-dashboard-widget
sm-upgrade
].freeze
File 2: Update test/lib/source_monitor/setup/skills_installer_test.rb
The existing tests iterate SkillsInstaller::CONSUMER_SKILLS dynamically, so they will automatically pick up the new entry. However, the first test "install defaults to consumer group" only creates 3 fake skills ("sm-dashboard-widget", "sm-host-setup", "sm-domain-model"). It checks that consumer skills are installed and contributor skills are not. Since sm-upgrade is now in CONSUMER_SKILLS, the test might need adjustment if it checks the result count.
Review the test: it creates sm-dashboard-widget and sm-host-setup as consumer fakes, then asserts they are in result[:installed] and sm-domain-model is NOT. Since sm-upgrade is not created as a fake skill in this test, it simply will not appear in installed or skipped -- the installer only processes skills that exist on disk. So the test should still pass as-is.
However, add a NEW test to explicitly verify sm-upgrade is included in the consumer group:
test "sm-upgrade is included in consumer skills" do
assert_includes SkillsInstaller::CONSUMER_SKILLS, "sm-upgrade"
end
This is a simple, fast assertion that documents the requirement.
File 3: Update CLAUDE.md
In the Consumer Skills table (around line 188-195), add a new row after the sm-dashboard-widget row:
| `sm-upgrade` | Gem upgrade workflow with CHANGELOG parsing |
The updated table should read:
| Skill | Purpose |
|-------|---------|
| `sm-host-setup` | Full host app setup walkthrough |
| `sm-configure` | DSL configuration across all sub-sections |
| `sm-scraper-adapter` | Custom scraper inheriting `Scrapers::Base` |
| `sm-event-handler` | Lifecycle callbacks (after_item_created, etc.) |
| `sm-model-extension` | Extend engine models from host app |
| `sm-dashboard-widget` | Dashboard queries, presenters, Turbo broadcasts |
| `sm-upgrade` | Gem upgrade workflow with CHANGELOG parsing |
bin/rails test -- full test suite passes with 1002+ runs, 0 failuresbin/rubocop -- 0 offenses across all filesbin/brakeman --no-pager -- 0 warningsIf any failures:
After all gates pass, confirm all Phase 3 artifacts exist:
ls -la .claude/skills/sm-upgrade/SKILL.md -- file existsls -la .claude/skills/sm-upgrade/reference/upgrade-workflow.md -- file existsls -la .claude/skills/sm-upgrade/reference/version-history.md -- file existsls -la docs/upgrade.md -- file existsgrep 'sm-upgrade' lib/source_monitor/setup/skills_installer.rb -- match foundgrep 'sm-upgrade' CLAUDE.md -- match foundgrep 'sm-upgrade' .claude/skills/sm-host-setup/SKILL.md -- match found (cross-reference)grep 'sm-upgrade' test/lib/source_monitor/setup/skills_installer_test.rb -- match foundAll success criteria met:
bin/rails test exits 0 with 1002+ runs, 0 failures. bin/rubocop exits 0. bin/brakeman --no-pager exits 0. All 8 grep/ls checks return matches.
</verify>
<done>
Full suite green with 1002+ runs. RuboCop clean. Brakeman clean. All Phase 3 success criteria met. REQ-29 and REQ-30 implemented: sm-upgrade skill with comprehensive upgrade workflow, docs/upgrade.md with versioned instructions, skills installer updated, sm-host-setup cross-referenced.
</done>
</task>