diff --git a/.github/plugin/marketplace.json b/.github/plugin/marketplace.json index 40c04ba..a97962d 100644 --- a/.github/plugin/marketplace.json +++ b/.github/plugin/marketplace.json @@ -11,7 +11,11 @@ "plugins": [ { "name": "agentcouncil", - "source": "./", + "source": { + "source": "github", + "repo": "Sentry01/AgentCouncil", + "ref": "v2.0.0" + }, "description": "Multi-model council for Copilot CLI. Three subagents on different model families answer independently, then build on each other or attack the leading answer before an orchestrator writes the final result.", "version": "2.0.0" } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c37bf86..3f69184 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,8 @@ name: Release # Publishes a GitHub release when plugin.json on main carries a version that # has no release yet. Notes come from the matching CHANGELOG.md section. +# Marketplace installs are pinned to the vX.Y.Z tag this creates, so users +# receive the new version only once this workflow has published it. on: push: branches: [main] diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 58c91c8..6430516 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -18,3 +18,5 @@ jobs: node-version: 22 - name: Validate plugin, skill, agent and docs run: node scripts/validate.mjs + - name: Check release notes build + run: node scripts/release-notes.mjs > /dev/null diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d7f0c..56b36e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ All notable changes to this project are documented here. Versions follow [Semant ### Added - Release workflow: merging a version bump to `main` tags it and publishes a GitHub release, with notes built from this changelog by `scripts/release-notes.mjs`. +- `scripts/bump-version.mjs` sets a new version in every manifest and moves the Unreleased notes under it. + +### Changed + +- Marketplace installs are pinned to the release tag (`vX.Y.Z`) instead of `main`, so `copilot plugin update` delivers published releases only. `validate.mjs` checks that the tag matches `plugin.json`, and CI now checks that release notes build. ## [2.0.0] - 2026-10-17 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ab69d4..5a49122 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,7 @@ | `scripts/validate.mjs` | Static checks, run in CI | | `scripts/eval-routing.mjs` | Routing eval, run locally | | `scripts/release-notes.mjs` | Builds release notes from `CHANGELOG.md` | +| `scripts/bump-version.mjs` | Sets the release version everywhere and dates the changelog | | `.github/workflows/release.yml` | Publishes a GitHub release when the version changes | ## Making a change @@ -34,9 +35,12 @@ Documentation style: plain ASCII punctuation, no emoji, no em dashes. `validate. ## Releasing -1. In your PR, bump the version in `plugin.json` and in both places in `.github/plugin/marketplace.json` (`metadata.version` and the plugin entry). Use semver; a version with a suffix such as `2.1.0-rc.1` is published as a prerelease. -2. Move the Unreleased changelog notes under a `## [X.Y.Z] - YYYY-MM-DD` heading. -3. Run `node scripts/validate.mjs` and preview the notes with `node scripts/release-notes.mjs`. -4. Merge to `main`. The Release workflow (`.github/workflows/release.yml`) sees the new version in `plugin.json`, validates, creates the `vX.Y.Z` tag on the merge commit and publishes a GitHub release with the changelog section as notes. If a run fails, fix the cause and re-run it from the Actions tab (it has a manual trigger); it skips versions that are already released. +Marketplace installs are pinned to a release tag: the plugin entry in `.github/plugin/marketplace.json` has `"source": {"source": "github", "repo": "Sentry01/AgentCouncil", "ref": "vX.Y.Z"}`. Merging to `main` without a version bump does not change what users get; publishing a release does. + +1. In your PR, run `node scripts/bump-version.mjs X.Y.Z` (or `patch`, `minor`, `major`). It sets the version in `plugin.json`, sets `metadata.version`, the plugin entry `version` and `source.ref` in `marketplace.json`, and moves the Unreleased changelog notes under a `## [X.Y.Z] - YYYY-MM-DD` heading. Use semver; a version with a suffix such as `2.1.0-rc.1` is published as a GitHub prerelease, but marketplace users still receive it, so test prereleases with `copilot --plugin-dir .` before merging. +2. Run `node scripts/validate.mjs` (it fails if any of those fields disagree) and preview the notes with `node scripts/release-notes.mjs`. +3. Merge to `main`. The Release workflow (`.github/workflows/release.yml`) sees the new version in `plugin.json`, validates, creates the `vX.Y.Z` tag on the merge commit and publishes a GitHub release with the changelog section as notes. Until the tag exists, `copilot plugin update` reports that the ref is missing and leaves the installed version in place. If a run fails, fix the cause and re-run it from the Actions tab (it has a manual trigger); it skips versions that are already released. + +Do not move or delete a published tag; installs of that version resolve it. Users pick up the release with `copilot plugin marketplace update agentcouncil` and `copilot plugin update agentcouncil@agentcouncil`. Listings that pin a tag, such as an awesome-copilot external entry, need their ref bumped separately. diff --git a/README.md b/README.md index 1408103..4bb8bfc 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ copilot plugin marketplace add Sentry01/AgentCouncil copilot plugin install agentcouncil@agentcouncil ``` -Update to the latest release ([release notes](https://github.com/Sentry01/AgentCouncil/releases)): +Update to the latest release ([release notes](https://github.com/Sentry01/AgentCouncil/releases)). The marketplace pins each version to its release tag, so you only receive published releases, never unreleased work on `main`: ```bash copilot plugin marketplace update agentcouncil @@ -36,7 +36,7 @@ Remove: copilot plugin uninstall agentcouncil@agentcouncil ``` -You can also install straight from the repository with `copilot plugin install Sentry01/AgentCouncil` and update it with `copilot plugin update agentcouncil`. The marketplace route above makes new versions easier to discover. +You can also install straight from the repository with `copilot plugin install Sentry01/AgentCouncil` and update it with `copilot plugin update agentcouncil`. That route tracks `main`, including unreleased changes. Use the marketplace route above to stay on releases. ### Upgrading from 1.x diff --git a/scripts/bump-version.mjs b/scripts/bump-version.mjs new file mode 100644 index 0000000..1400949 --- /dev/null +++ b/scripts/bump-version.mjs @@ -0,0 +1,62 @@ +#!/usr/bin/env node +// Prepares a release: sets the version in plugin.json and marketplace.json +// (including the release tag that installs are pinned to) and moves the +// Unreleased changelog notes under a new version heading. +// Usage: node scripts/bump-version.mjs + +import { readFileSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const paths = { plugin: join(root, "plugin.json"), market: join(root, ".github/plugin/marketplace.json"), changelog: join(root, "CHANGELOG.md") }; +const die = (msg) => { + console.error(msg); + process.exit(1); +}; +const readJson = (p) => JSON.parse(readFileSync(p, "utf8")); +const writeJson = (p, data) => writeFileSync(p, `${JSON.stringify(data, null, 2)}\n`); + +const arg = process.argv[2]; +if (!arg) die("Usage: node scripts/bump-version.mjs "); + +const plugin = readJson(paths.plugin); +const current = plugin.version; +let version = arg; +if (["major", "minor", "patch"].includes(arg)) { + if (current.includes("-")) die(`${current} is a prerelease; pass an explicit version instead of ${arg}.`); + const [major, minor, patch] = current.split(".").map(Number); + version = { major: `${major + 1}.0.0`, minor: `${major}.${minor + 1}.0`, patch: `${major}.${minor}.${patch + 1}` }[arg]; +} +// Strict SemVer prerelease identifiers, plus Git's rule that a ref cannot end in ".lock", so v is always a valid tag. +const ID = "(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)"; +if (!new RegExp(`^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-${ID}(?:\\.${ID})*)?$`).test(version) || version.endsWith(".lock")) { + die(`Not a semver version usable as a Git tag: ${version}`); +} +if (version === current) die(`plugin.json is already at ${version}.`); + +// Prepare every change before writing, so a rejected bump leaves all files untouched. +const market = readJson(paths.market); +const entry = (market.plugins || []).find((p) => p.name === plugin.name); +if (!entry) die(`marketplace.json has no plugins[] entry named ${plugin.name}`); +if (!market.metadata || typeof entry.source !== "object") die("marketplace.json needs a metadata object and an object plugin source; run node scripts/validate.mjs."); + +const lines = readFileSync(paths.changelog, "utf8").split("\n"); +if (lines.some((l) => l.startsWith(`## [${version}]`))) die(`CHANGELOG.md already has a ${version} section.`); +const start = lines.findIndex((l) => l.startsWith("## [Unreleased]")); +if (start < 0) die('CHANGELOG.md has no "## [Unreleased]" section.'); +const next = lines.findIndex((l, i) => i > start && l.startsWith("## [")); +if (!lines.slice(start + 1, next < 0 ? undefined : next).join("").trim()) die("The Unreleased section of CHANGELOG.md is empty. Add release notes first."); +const date = new Date().toLocaleDateString("en-CA"); +lines.splice(start + 1, 0, "", `## [${version}] - ${date}`); +plugin.version = version; +market.metadata.version = version; +entry.version = version; +entry.source.ref = `v${version}`; + +writeFileSync(paths.changelog, lines.join("\n")); +writeJson(paths.plugin, plugin); +writeJson(paths.market, market); + +console.log(`Bumped ${current} to ${version}. Installs will follow tag v${version} once the release is published. +Next: node scripts/validate.mjs && node scripts/release-notes.mjs, then open a PR and merge it.`); diff --git a/scripts/validate.mjs b/scripts/validate.mjs index 8d88355..8cc5903 100644 --- a/scripts/validate.mjs +++ b/scripts/validate.mjs @@ -25,7 +25,9 @@ const SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"; const PLUGIN_FIELDS = new Set(["$schema", "name", "version", "description", "author", "homepage", "repository", "license", "keywords", "extensions"]); const PLUGIN_NAME = /^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/; const SKILL_NAME = /^[a-z0-9-]{1,64}$/; -const SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/; +// Strict SemVer (no build metadata); with the .lock check below, v is always a valid Git tag. +const SEMVER_ID = "(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)"; +const SEMVER = new RegExp(`^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-${SEMVER_ID}(?:\\.${SEMVER_ID})*)?$`); const MODEL_ID = /\b(?:claude|gpt|gemini|grok)-[a-z0-9]+(?:[.-][a-z0-9]+)*\b/g; const SHIPPED_DOCS = ["README.md", "CONTRIBUTING.md", "CHANGELOG.md"]; @@ -62,7 +64,7 @@ const plugin = readJson(pluginPath); if (plugin.$schema !== SCHEMA) fail(pluginPath, `$schema must be ${SCHEMA}`); for (const key of Object.keys(plugin)) if (!PLUGIN_FIELDS.has(key)) fail(pluginPath, `field not allowed by Agent Plugins 1.0: ${key}`); if (!PLUGIN_NAME.test(plugin.name || "") || plugin.name.length > 64) fail(pluginPath, "name must be lowercase letters, digits, dots or hyphens, 1-64 chars"); -if (!SEMVER.test(plugin.version || "")) fail(pluginPath, "version must be semver"); +if (!SEMVER.test(plugin.version || "") || plugin.version.endsWith(".lock")) fail(pluginPath, "version must be semver and usable as a Git tag"); if (!plugin.description || plugin.description.length > 500) fail(pluginPath, "description must be 1-500 chars"); if (!plugin.license) fail(pluginPath, "license is required"); if (!plugin.author?.name) fail(pluginPath, "author.name is required"); @@ -80,6 +82,12 @@ if (!entry) fail(marketPath, `no plugins[] entry named ${plugin.name}`); else { if (entry.version !== plugin.version) fail(marketPath, `plugin version ${entry.version} != plugin.json ${plugin.version}`); if (!entry.description) fail(marketPath, "plugin entry needs a description"); + // Installs are pinned to the release tag, so users only receive published releases. + const repo = (plugin.repository || "").replace(/^https:\/\/github\.com\//, ""); + const src = entry.source || {}; + if (src.source !== "github" || src.repo !== repo || src.ref !== `v${plugin.version}` || src.path || src.sha) { + fail(marketPath, `plugin source must be {"source": "github", "repo": "${repo}", "ref": "v${plugin.version}"} so installs follow the release tag`); + } } if (market.metadata?.version !== plugin.version) fail(marketPath, `metadata.version must equal plugin.json version ${plugin.version}`);