fix(mcp): wire sema_pull + flip sema_mint to opt-out (0.2.2)#34
Merged
fix(mcp): wire sema_pull + flip sema_mint to opt-out (0.2.2)#34
Conversation
0.2.0's CHANGELOG, SKILL, and tests all claimed `sema_pull` was an MCP tool and `sema_mint` was exposed by default, but the server module still only registered `sema_mint` behind `SEMA_ALLOW_MINT=true` and had no `sema_pull` at all. This release lands the code that matches the claims. - Add `_sema_pull` MCP tool (wrapper over `cli.main.update_db`), exposed by default. Hide with `SEMA_DISABLE_PULL=true`. - Flip `_sema_mint` registration: exposed by default. Hide with `SEMA_DISABLE_MINT=true`. The old `SEMA_ALLOW_MINT` gate is removed entirely (no legacy honour). - Refactor `update_db()` to return a structured dict instead of a bare bool. CLI callers read `result["success"]` for the exit code; the MCP tool serializes the whole dict. Stats include `added`, `updated`, `skipped`, `cascaded_user`, `superseded_removed`, `superseded_kept_orphan`, `upstream_removed`, `vocabulary_root_before`, `vocabulary_root_after`, and `dry_run`/`error` when applicable. - Register `src/sema/mcp/tests/` in `pytest` testpaths so the 6 tests for pull / mint registration + structured output now run in the default suite (all passing). - Drop the stale "legacy SEMA_ALLOW_MINT" mention from SKILL and the old conditional-registration test class that asserted the opt-in behaviour. 237/237 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add header referencing Keep a Changelog and SemVer specs. - Add `[Unreleased]` section at the top (per-spec accumulator for the next release). - Use standard `### Added / ### Changed / ### Removed` subsections in the 0.2.1 and 0.2.2 entries. - Normalize release headers to `## [X.Y.Z] - YYYY-MM-DD` (ISO 8601 date, hyphen separator). Fix the stale `[Unreleased] — 0.2.0 — …` header on the 0.2.0 section — it shipped, it's no longer unreleased. The 0.2.0 body is left as-is (already shipped); only its header was touched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tomatically Release-surface files drift silently: the MCP Registry entry in server.json was still on 0.1.4 even though PyPI had shipped 0.2.0, and the description claimed 453 patterns when the DB had 452. We've been catching these by hand, one file at a time, every release — easy to forget one. - `scripts/sync_release_metadata.py` — single source of truth is `pyproject.toml` (version) and `data/taxonomy.db` (pattern count). Fixes drift in `.claude-plugin/plugin.json` and `server.json` in place. Idempotent. `--check` mode exits 1 on drift for CI. - Wired into `.pre-commit-config.yaml` as the `sync-release-metadata` hook. Fires when `pyproject.toml`, `data/taxonomy.db`, `.claude-plugin/plugin.json`, or `server.json` is staged, auto-fixes drift, and re-stages the corrected files so the commit goes through clean. Now we literally can't forget. - Ran it once as part of this commit: `server.json` 0.1.4 → 0.2.2, pattern count 453 → 452 in the description. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Runs from main, single command, gated by pre-flight checks and confirmation prompts. Wraps the four manual steps we've been doing by hand after each version-bump merge: 1. git tag vX.Y.Z + push 2. gh release create (triggers publish.yml → PyPI via trusted publish) 3. mcp-publisher publish server.json (MCP Registry) 4. print verification URLs Version comes from pyproject.toml (single source of truth). Release notes body is auto-extracted from the matching CHANGELOG.md section. Supports --dry-run for a preview and --yes for non-interactive use. CONTRIBUTING.md gets a new "Cutting a release" section so the flow is discoverable without reading the script. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0.2.0's CHANGELOG, SKILL, and test file all claimed
sema_pullwas exposed as an MCP tool andsema_mintwas on by default, but the server module had neither. This PR lands the code that matches the claims, plus the release-surface sync infrastructure so we never ship doc-vs-code drift like that again.Replaces #33 (closed when its base branch
chore/0.2.1-post-release-cleanupwas deleted after #32 merged).What changed
MCP behaviour (
e5a1c8c):sema_pullMCP tool — wrapscli.main.update_db. Returns structured JSON (success,added,updated,skipped,cascaded_user,superseded_removed,superseded_kept_orphan,upstream_removed,vocabulary_root_before,vocabulary_root_after,dry_run/errorwhen applicable).sema_mintflipped to opt-out. Exposed by default; hide withSEMA_DISABLE_MINT=true. OldSEMA_ALLOW_MINTgate removed — clean break.SEMA_DISABLE_PULL=truematching opt-out forsema_pull.update_db()now returns a dict; CLI callers readresult["success"].src/sema/mcp/tests/added topytesttestpaths.CHANGELOG format (
4d84dfb):### Added / ### Changed / ### Removedsubsections and ISO 8601 dates. Stale[Unreleased] — 0.2.0header fixed.Release-surface sync (
3629ebc):scripts/sync_release_metadata.pykeeps.claude-plugin/plugin.jsonandserver.jsonin sync withpyproject.toml(version) anddata/taxonomy.db(pattern count). Idempotent,--checkmode for CI..pre-commit-config.yamlso drift is auto-fixed on any commit touching the relevant files.Release script (
c268415):scripts/release.sh— single command that pre-flights, tags, pushes, creates GH release (→ PyPI via trusted publish), and pushes server.json to the MCP Registry.--dry-run/--yessupported.CONTRIBUTING.mdgains a "Cutting a release" section.Test plan
pytest— 237/237 green (was 6 failures pre-PR)ruff+ruff-formatcleansync-release-metadata --check— no driftscripts/release.sh --dry-runfrommain— runs through all phases as expectedscripts/release.shcuts the 0.2.2 release end-to-end🤖 Generated with Claude Code