Skip to content

feat(hooks): harden plugin-staleness check — scan marketplaces dir, semver-aware compare, coverage #788

Closed

Description

@admarble

Problem

Follow-up to #784 (merged in #787). The plugin-staleness warning in pre-tool.sh shipped with four known, non-blocking gaps flagged during QA. This issue hardens the check and closes the test-coverage holes.

Gaps

  1. Hardcoded marketplace directory name. The check derives the clone path as …/plugins/marketplaces/sequant/.claude-plugin/marketplace.json, assuming Claude Code names the marketplace dir sequant. If a given Claude Code version names it differently (e.g. after the source slug), the check silently no-ops. The existing test stages that exact name, so it passes by construction and cannot catch a divergent real-world name.

  2. String-inequality version compare, not semver. The check warns whenever installed != marketplace. A cache that is ahead of the marketplace would print "is stale," which is wrong. Warn only when the installed version is strictly behind.

  3. Zero-network is by construction, not asserted. No test guards against a future edit introducing curl/gh/git/nc into the staleness block.

  4. prepare-marketplace.ts no-auto-update note has no regression guard. The generated marketplace README note (added in feat(#784): warn when the installed plugin cache is stale #787) is verified only by manual regeneration; nothing prevents the template from silently dropping it.

Acceptance Criteria

  • AC-1: The check locates the marketplace clone by scanning plugins/marketplaces/*/.claude-plugin/marketplace.json and selecting the one whose JSON declares the sequant plugin — no hardcoded directory name. Still zero-network, grep/sed only, and a no-op when no matching clone exists.
  • AC-2: The warning fires only when the installed version is strictly behind the marketplace version (semver-aware numeric compare, pure awk — no sort -V dependency). Equal or ahead → silent no-op.
  • AC-3: A test asserts the staleness block contains no network-invoking commands (curl, wget, gh, git, nc, ping), across all three hook mirrors.
  • AC-4: A test asserts the generated marketplace README (from prepare-marketplace.ts) contains the no-auto-update note and the claude plugin update command.
  • AC-5: Existing feat(hooks): warn when the installed plugin cache is stale — plugin-channel installs never auto-update #784 behavior preserved: warn-once/day via stamp, exit code unchanged, repo-local dev copies never warn, all three hook mirrors byte-identical.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions