Skip to content

Commit 4e87a47

Browse files
KebooCopilot
andauthored
Enforce plugin version sync between plugin.json and marketplace.json (#2)
* Add plugin version sync validation and Copilot instructions - Add CI step to validate plugin.json versions match marketplace.json - Add Copilot instructions for JSON files to keep versions in sync - Add Copilot instructions for plugin edits to prompt for version bumps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Expand semver guidance in plugin-editing instructions Add concrete examples for patch, minor, and major version bumps specific to the plugin content model (instructions, agents, naming). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 751b9bd commit 4e87a47

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
applyTo: "plugins/**"
3+
---
4+
5+
# Plugin Editing — Version Bump Reminder
6+
7+
Whenever you edit any file inside a `plugins/<name>/` directory, remind the user to bump the plugin version before committing:
8+
9+
1. Increment the `version` field in `plugins/<name>/plugin.json` using the semver rules below.
10+
2. Update the matching entry's `version` in `.github/plugin/marketplace.json` to the same value.
11+
12+
## Semver guidance for plugins
13+
14+
**Patch** (`1.0.x`) — backward-compatible fixes and clarifications with no change in scope:
15+
- Fixing typos, grammar, or unclear wording in instructions
16+
- Rewording guidance to improve clarity without changing intent
17+
- Adding or improving examples that illustrate existing rules
18+
19+
**Minor** (`1.x.0`) — backward-compatible additions that expand what the plugin covers:
20+
- Adding new instruction files or new sections to existing ones
21+
- Adding a new agent, prompt, or capability to the plugin
22+
- Extending keywords or categories in `plugin.json`
23+
24+
**Major** (`x.0.0`) — changes that alter existing behavior in a way users may need to adapt to:
25+
- Removing or renaming instruction files referenced by the plugin
26+
- Fundamentally changing the guidance or recommendations in a way that conflicts with prior versions
27+
- Changing the plugin `name` field (affects install commands and `@` references)
28+
29+
The CI workflow enforces that these two versions match, so both files must be updated together.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
applyTo: "plugins/**/plugin.json,.github/plugin/marketplace.json"
3+
---
4+
5+
# Plugin Version Sync
6+
7+
The `version` field in every `plugins/<name>/plugin.json` **must always match** the corresponding entry's `version` in `.github/plugin/marketplace.json`.
8+
9+
When editing either file:
10+
- If you change the `version` in a `plugin.json`, update the matching entry in `.github/plugin/marketplace.json` to the same value.
11+
- If you change a plugin's `version` in `marketplace.json`, update the corresponding `plugin.json` to the same value.
12+
13+
Both files must be committed together so the CI version-sync check passes.

.github/workflows/validate-plugins.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,46 @@ jobs:
7373
7474
print("✓ All plugin names are unique")
7575
EOF
76+
77+
- name: Validate plugin versions match marketplace.json
78+
run: |
79+
python3 << 'EOF'
80+
import json
81+
import glob
82+
import sys
83+
84+
with open(".github/plugin/marketplace.json", "r") as f:
85+
marketplace = json.load(f)
86+
87+
marketplace_versions = {
88+
p["name"]: p["version"] for p in marketplace.get("plugins", [])
89+
}
90+
91+
errors = []
92+
for plugin_file in glob.glob("plugins/**/plugin.json", recursive=True):
93+
with open(plugin_file, "r") as f:
94+
plugin = json.load(f)
95+
96+
name = plugin.get("name")
97+
plugin_version = plugin.get("version")
98+
marketplace_version = marketplace_versions.get(name)
99+
100+
if marketplace_version is None:
101+
errors.append(
102+
f"❌ {plugin_file}: plugin '{name}' not found in marketplace.json"
103+
)
104+
elif plugin_version != marketplace_version:
105+
errors.append(
106+
f"❌ {plugin_file}: version '{plugin_version}' does not match "
107+
f"marketplace.json version '{marketplace_version}' for plugin '{name}'"
108+
)
109+
else:
110+
print(f"✓ {plugin_file}: version '{plugin_version}' matches marketplace.json")
111+
112+
if errors:
113+
for error in errors:
114+
print(error)
115+
sys.exit(1)
116+
117+
print("\n✓ All plugin versions match marketplace.json")
118+
EOF

0 commit comments

Comments
 (0)