|
| 1 | +--- |
| 2 | +name: plugin-version |
| 3 | +description: Bump plugin versions in the OpenSaaS Stack monorepo. Invoke whenever any file under claude-plugins/* or .claude-plugin/ is modified — skills, commands, agents, or marketplace config. Plugin versions must be bumped before committing so users who install the plugin get the updated version. Note: this is separate from pr-changeset, which handles npm packages — plugin versions are managed directly in plugin.json and marketplace.json. |
| 4 | +allowed-tools: Read, Edit, Bash, Grep, Glob |
| 5 | +--- |
| 6 | + |
| 7 | +# Plugin Version Skill |
| 8 | + |
| 9 | +This skill bumps version numbers for Claude plugins and the marketplace manifest. Plugin versions live directly in JSON files (not changesets) — bumping them is what signals to the marketplace that something changed and triggers users to get the update. |
| 10 | + |
| 11 | +## Files This Skill Manages |
| 12 | + |
| 13 | +| Changed directory | Files to update | |
| 14 | +| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 15 | +| `claude-plugins/opensaas-stack/` | `claude-plugins/opensaas-stack/.claude-plugin/plugin.json` (version) AND `.claude-plugin/marketplace.json` (plugins[name="opensaas-stack"].version) | |
| 16 | +| `claude-plugins/opensaas-migration/` | `claude-plugins/opensaas-migration/.claude-plugin/plugin.json` (version) AND `.claude-plugin/marketplace.json` (plugins[name="opensaas-migration"].version) | |
| 17 | +| `.claude-plugin/` root files only | `.claude-plugin/marketplace.json` (metadata.version only) | |
| 18 | + |
| 19 | +## Versioning Rules |
| 20 | + |
| 21 | +### Patch (bug fixes only) |
| 22 | + |
| 23 | +- **Use for**: Bug fixes, typo corrections, documentation fixes, minor wording improvements in skill descriptions |
| 24 | +- **Bump**: `x.y.Z` → `x.y.Z+1` |
| 25 | +- **Description**: Maximum 2 lines |
| 26 | + |
| 27 | +### Minor (features or enhancements) |
| 28 | + |
| 29 | +- **Use for**: New skills, new commands, new agents, new MCP tools, enhancements to existing capabilities |
| 30 | +- **Bump**: `x.Y.z` → `x.Y+1.0` (reset patch to 0) |
| 31 | +- **Description**: Describe the new capability |
| 32 | + |
| 33 | +### Major (breaking changes) |
| 34 | + |
| 35 | +- **Use for**: Removed skills/commands/tools, changed invocation patterns, incompatible changes |
| 36 | +- **ONLY when explicitly requested by the user** |
| 37 | +- **Bump**: `X.y.z` → `X+1.0.0` (reset minor and patch to 0) |
| 38 | + |
| 39 | +## Instructions |
| 40 | + |
| 41 | +### Step 1: Identify Changed Plugin Directories |
| 42 | + |
| 43 | +Run git commands to detect which plugin areas changed: |
| 44 | + |
| 45 | +```bash |
| 46 | +git diff --name-only HEAD |
| 47 | +# or for staged changes: |
| 48 | +git diff --name-only --cached |
| 49 | +# or for all changes relative to main: |
| 50 | +git diff --name-only origin/main...HEAD |
| 51 | +``` |
| 52 | + |
| 53 | +Look for paths starting with: |
| 54 | + |
| 55 | +- `claude-plugins/opensaas-stack/` → opensaas-stack plugin changed |
| 56 | +- `claude-plugins/opensaas-migration/` → opensaas-migration plugin changed |
| 57 | +- `.claude-plugin/` → marketplace root changed (check if any file other than version fields changed) |
| 58 | + |
| 59 | +### Step 2: Determine Version Bump Type |
| 60 | + |
| 61 | +For each changed plugin: |
| 62 | + |
| 63 | +- **Is this a bug fix or correction?** → Use `patch` |
| 64 | +- **Is this a new skill, command, agent, or capability?** → Use `minor` |
| 65 | +- **Does this remove or rename something users depend on?** → Use `major` only if user explicitly requested it; otherwise ask |
| 66 | + |
| 67 | +### Step 3: Read Current Versions |
| 68 | + |
| 69 | +For each affected plugin, read the current version: |
| 70 | + |
| 71 | +``` |
| 72 | +Read: claude-plugins/<plugin-name>/.claude-plugin/plugin.json |
| 73 | +``` |
| 74 | + |
| 75 | +The version is in the top-level `"version"` field. |
| 76 | + |
| 77 | +For the marketplace: |
| 78 | + |
| 79 | +``` |
| 80 | +Read: .claude-plugin/marketplace.json |
| 81 | +``` |
| 82 | + |
| 83 | +The marketplace metadata version is at `metadata.version`. Each plugin's marketplace entry version is at `plugins[i].version` where `plugins[i].name` matches the plugin name. |
| 84 | + |
| 85 | +### Step 4: Calculate New Version |
| 86 | + |
| 87 | +Given the current version string `"x.y.z"`: |
| 88 | + |
| 89 | +- **patch**: increment z → `"x.y.(z+1)"` |
| 90 | + - `"0.2.0"` → `"0.2.1"` |
| 91 | + - `"1.3.4"` → `"1.3.5"` |
| 92 | +- **minor**: increment y, reset z to 0 → `"x.(y+1).0"` |
| 93 | + - `"0.2.0"` → `"0.3.0"` |
| 94 | + - `"1.3.4"` → `"1.4.0"` |
| 95 | +- **major**: increment x, reset y and z to 0 → `"(x+1).0.0"` |
| 96 | + - `"0.2.0"` → `"1.0.0"` |
| 97 | + - `"1.3.4"` → `"2.0.0"` |
| 98 | + |
| 99 | +### Step 5: Edit the JSON Files |
| 100 | + |
| 101 | +For each changed plugin, make two targeted edits using the Edit tool. |
| 102 | + |
| 103 | +**Edit 1 — The plugin's own plugin.json:** |
| 104 | + |
| 105 | +Find the `"version"` field near the top of the file and replace just that value. |
| 106 | + |
| 107 | +Example in `claude-plugins/opensaas-stack/.claude-plugin/plugin.json`: |
| 108 | + |
| 109 | +``` |
| 110 | +"version": "0.2.0", |
| 111 | +``` |
| 112 | + |
| 113 | +→ |
| 114 | + |
| 115 | +``` |
| 116 | +"version": "0.2.1", |
| 117 | +``` |
| 118 | + |
| 119 | +**Edit 2 — The matching entry in marketplace.json:** |
| 120 | + |
| 121 | +The `plugins` array in `.claude-plugin/marketplace.json` has one object per plugin. Find the object where `"name"` matches the plugin name and edit its `"version"` field. |
| 122 | + |
| 123 | +Example: find the block for `"name": "opensaas-stack"` and edit: |
| 124 | + |
| 125 | +``` |
| 126 | + "version": "0.2.0", |
| 127 | +``` |
| 128 | + |
| 129 | +→ |
| 130 | + |
| 131 | +``` |
| 132 | + "version": "0.2.1", |
| 133 | +``` |
| 134 | + |
| 135 | +**Edit 3 (conditional) — Marketplace metadata.version:** |
| 136 | + |
| 137 | +Only bump `metadata.version` if files in the `.claude-plugin/` root directory were directly changed (e.g., `MARKETPLACE.md`, new fields added to `marketplace.json` structure, owner/metadata fields edited). Do NOT bump it just because plugin versions changed. |
| 138 | + |
| 139 | +### Step 6: Verify the Edits |
| 140 | + |
| 141 | +After editing, read back the affected files to confirm: |
| 142 | + |
| 143 | +- The version field shows the new version |
| 144 | +- No other fields were accidentally changed |
| 145 | +- Both plugin.json and the matching marketplace.json entry show the same new version number |
| 146 | + |
| 147 | +## Examples |
| 148 | + |
| 149 | +### Example 1: Patch — Fix a typo in a skill description |
| 150 | + |
| 151 | +Changed files: `claude-plugins/opensaas-stack/skills/some-skill/SKILL.md` |
| 152 | + |
| 153 | +Current version: `"0.2.0"` → New version: `"0.2.1"` |
| 154 | + |
| 155 | +Edit `claude-plugins/opensaas-stack/.claude-plugin/plugin.json`: |
| 156 | + |
| 157 | +- `"version": "0.2.0"` → `"version": "0.2.1"` |
| 158 | + |
| 159 | +Edit `.claude-plugin/marketplace.json` (in the `opensaas-stack` plugins entry): |
| 160 | + |
| 161 | +- `"version": "0.2.0"` → `"version": "0.2.1"` |
| 162 | + |
| 163 | +Do NOT change `metadata.version` — the marketplace structure itself did not change. |
| 164 | + |
| 165 | +### Example 2: Minor — Add a new skill to opensaas-migration |
| 166 | + |
| 167 | +Changed files: `claude-plugins/opensaas-migration/skills/new-skill/SKILL.md` (new file) |
| 168 | + |
| 169 | +Current version: `"0.2.0"` → New version: `"0.3.0"` |
| 170 | + |
| 171 | +Edit `claude-plugins/opensaas-migration/.claude-plugin/plugin.json`: |
| 172 | + |
| 173 | +- `"version": "0.2.0"` → `"version": "0.3.0"` |
| 174 | + |
| 175 | +Edit `.claude-plugin/marketplace.json` (in the `opensaas-migration` plugins entry): |
| 176 | + |
| 177 | +- `"version": "0.2.0"` → `"version": "0.3.0"` |
| 178 | + |
| 179 | +### Example 3: Changes to both plugins |
| 180 | + |
| 181 | +Changed files include both `claude-plugins/opensaas-stack/...` and `claude-plugins/opensaas-migration/...` |
| 182 | + |
| 183 | +Determine bump type independently for each plugin based on the nature of its changes. They can be bumped to different versions. |
| 184 | + |
| 185 | +Edit `claude-plugins/opensaas-stack/.claude-plugin/plugin.json` with its new version. |
| 186 | +Edit `claude-plugins/opensaas-migration/.claude-plugin/plugin.json` with its new version. |
| 187 | +Edit `.claude-plugin/marketplace.json` twice — once for each plugin's entry. |
| 188 | + |
| 189 | +### Example 4: Marketplace-only change |
| 190 | + |
| 191 | +Changed files: `.claude-plugin/marketplace.json` (added a new top-level field) or `.claude-plugin/MARKETPLACE.md` |
| 192 | + |
| 193 | +The marketplace structure itself changed, so bump `metadata.version`. |
| 194 | + |
| 195 | +Current: `"version": "1.1.0"` → New: `"version": "1.1.1"` (patch) |
| 196 | + |
| 197 | +Edit `.claude-plugin/marketplace.json` `metadata.version` field only. |
| 198 | +Do NOT change any plugin.json files — no plugin logic changed. |
| 199 | + |
| 200 | +## Common Mistakes to Avoid |
| 201 | + |
| 202 | +1. **Don't bump metadata.version just because plugin versions changed** |
| 203 | + - Plugin version entries in marketplace.json are synced from plugin.json |
| 204 | + - Only bump metadata.version when the marketplace file's own structure changed |
| 205 | + |
| 206 | +2. **Don't forget the marketplace.json plugin entry** |
| 207 | + - When you bump a plugin.json, always also update the matching entry in marketplace.json |
| 208 | + - The two must stay in sync |
| 209 | + |
| 210 | +3. **Don't use major unless explicitly requested** |
| 211 | + - New skills and commands are minor, not major |
| 212 | + - Ask the user if you think a major bump is warranted |
| 213 | + |
| 214 | +4. **Don't reset patch to 0 on a patch bump** |
| 215 | + - patch: `0.2.3` → `0.2.4` (not `0.2.0`) |
| 216 | + - minor: `0.2.3` → `0.3.0` (reset patch) |
| 217 | + - major: `0.2.3` → `1.0.0` (reset both) |
| 218 | + |
| 219 | +5. **Don't edit unrelated fields** |
| 220 | + - Use Edit tool with precise old_string/new_string targeting just the version line |
| 221 | + - Verify after editing that only the version changed |
| 222 | + |
| 223 | +6. **Don't create changeset files** |
| 224 | + - This skill edits JSON files directly |
| 225 | + - Plugin versions are NOT managed by the npm changeset system |
| 226 | + |
| 227 | +## Workflow |
| 228 | + |
| 229 | +When working on plugin changes: |
| 230 | + |
| 231 | +1. Make your plugin code changes |
| 232 | +2. Before committing, invoke this skill to bump versions |
| 233 | +3. Verify the JSON files show the correct new versions |
| 234 | +4. Commit all changed files together (plugin code + plugin.json + marketplace.json) |
| 235 | + |
| 236 | +## Troubleshooting |
| 237 | + |
| 238 | +**Q: Both plugins changed but for very different reasons — do I use the same bump type?** |
| 239 | +A: No. Evaluate each plugin independently. One might be a patch and the other a minor bump. |
| 240 | + |
| 241 | +**Q: I added a new skill AND fixed a bug in the same plugin. Which bump type?** |
| 242 | +A: Use minor (the higher of the two). |
| 243 | + |
| 244 | +**Q: How do I know if marketplace metadata.version should be bumped?** |
| 245 | +A: Ask: "Did I change marketplace.json itself beyond just updating plugin version entries?" If you edited owner, metadata.description, added new top-level fields, or changed MARKETPLACE.md — yes. If you only updated plugin version numbers — no. |
| 246 | + |
| 247 | +**Q: What if I only changed README.md inside a plugin directory?** |
| 248 | +A: Still bump the plugin version (patch). Documentation is part of the plugin release. |
| 249 | + |
| 250 | +**Q: Should this skill be used alongside pr-changeset?** |
| 251 | +A: These are independent. `pr-changeset` handles npm packages in `packages/*`. This skill handles Claude plugins in `claude-plugins/*`. If a PR changes both, use both skills. |
| 252 | + |
| 253 | +## Important Notes |
| 254 | + |
| 255 | +- Plugin versions are semver strings stored directly in JSON — there is no automated tooling managing them |
| 256 | +- The marketplace.json `plugins[].version` fields must always match the corresponding plugin.json `version` fields |
| 257 | +- marketplace.json `metadata.version` is independent and tracks the marketplace manifest itself |
| 258 | +- Both plugin.json files and marketplace.json must be committed together in the same commit as the plugin changes |
0 commit comments