fix: make the Claude Code plugin installable and loadable#2
Merged
renezander030 merged 5 commits intoMay 29, 2026
Merged
Conversation
…ame+owner Claude Code resolves a marketplace manifest at `.claude-plugin/marketplace.json`, not the repo root, and requires top-level `name` and `owner` fields. The previous root-level marketplace.json was never found, so `/plugin marketplace add https://github.com/renezander030/capcut-cli` failed with "Marketplace file not found at .../.claude-plugin/marketplace.json". The plugin lives at the repo root, so the plugin entry uses `"source": "./"`.
hooks/hooks.json used the legacy array form and a non-existent `on_plugin_enable` event, so Claude Code rejected the plugin on load: "Hook load failed: expected record, received array (path: hooks)" Claude Code auto-discovers hooks/hooks.json by convention, so the file is removed in this PR and the `hooks` field is dropped here. CLI provisioning is already covered by the README (`npm install -g capcut-cli`) and `npx capcut-cli`.
Superseded by .claude-plugin/marketplace.json. The root copy was never read by Claude Code and also lacked the required name/owner fields.
Invalid hook schema (array form + non-existent on_plugin_enable event) made Claude Code reject the whole plugin on load. The bash redirect in the command (`>/dev/null 2>&1`) is also non-portable on Windows. CLI provisioning is handled by the README and npx, so the hook is removed rather than rewritten.
…hema Supersedes the earlier deletion: keep the "ensure capcut-cli is installed" intent but make it actually load. Three fixes vs the original: - schema: `hooks` must be a record keyed by event, not an array (Claude Code rejected the array: "expected record, received array") - event: `on_plugin_enable` does not exist; use `SessionStart` - command: replace the bash-only `>/dev/null 2>&1 || ...` with a shell-agnostic `node -e` one-liner (Node >=18 is already required) that checks via `npm ls -g` and installs only when missing — works on Windows, macOS, Linux. Note: the standard hooks/hooks.json is auto-loaded by Claude Code, so plugin.json must NOT also reference it (doing so errors with "Duplicate hooks file detected"). That reference is removed in the plugin.json change of this PR. Verified: `claude plugin list` -> Status: enabled; details -> Hooks (1) SessionStart.
Owner
|
Hi @Wladefant, Thank you so much for this — merged! 🙏 You fixed something I'd actually advertised in the README but was quietly broken: the First outside contribution to capcut-cli, and a genuinely useful one. Really appreciate you taking the time to track it down and write it up so clearly. If you end up using the CLI for anything, I'd love to hear how it goes — and PRs are always welcome. Cheers, |
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.
Problem
/plugin marketplace add https://github.com/renezander030/capcut-clifails today, and even after a manual install the plugin won't load. Two root causes:1. Marketplace manifest is in the wrong place and missing required fields.
Claude Code resolves the marketplace catalog at
.claude-plugin/marketplace.json(not the repo root) and requires top-levelnameandowner. The repo shippedmarketplace.jsonat the root with neither field, so adding the marketplace fails:2.
hooks/hooks.jsonis invalid, which blocks the whole plugin from loading.Claude Code auto-discovers
hooks/hooks.jsonby convention, validates it, and rejects the plugin:The hook was broken three ways: (a)
hookswas an array but must be a record keyed by event; (b) it used a non-existenton_plugin_enableevent; (c) the commandnpm list -g capcut-cli >/dev/null 2>&1 || ...uses bash redirects that fail on Windows.Changes
.claude-plugin/marketplace.jsonwith the requiredname+owner. The plugin lives at the repo root, so the plugin entry uses"source": "./". Remove the misplaced rootmarketplace.json.hooks/hooks.json(kept, not removed — the "ensure capcut-cli is installed" intent is preserved):hooksis now a record keyed by event;on_plugin_enable→SessionStart;node -eone-liner (Node ≥18 is already required) that checks withnpm ls -gand installs only when missing — works on Windows, macOS and Linux.hooksfield fromplugin.json. Claude Code auto-loadshooks/hooks.json, so an explicit reference double-loads it and errors withDuplicate hooks file detected.Verification
Minor doc note (not in this PR)
The README's "Claude Code plugin" section says
/plugin enable capcut-cli; after this fix the correct second step is/plugin install capcut-cli@capcut-cli(install auto-enables). Happy to add that one-line README tweak if you'd like it here.