Skip to content

fix: make the Claude Code plugin installable and loadable#2

Merged
renezander030 merged 5 commits into
renezander030:masterfrom
Wladefant:fix/claude-code-plugin-loads
May 29, 2026
Merged

fix: make the Claude Code plugin installable and loadable#2
renezander030 merged 5 commits into
renezander030:masterfrom
Wladefant:fix/claude-code-plugin-loads

Conversation

@Wladefant
Copy link
Copy Markdown
Contributor

@Wladefant Wladefant commented May 28, 2026

Problem

/plugin marketplace add https://github.com/renezander030/capcut-cli fails 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-level name and owner. The repo shipped marketplace.json at the root with neither field, so adding the marketplace fails:

Error: Marketplace file not found at ...\.claude-plugin\marketplace.json

2. hooks/hooks.json is invalid, which blocks the whole plugin from loading.
Claude Code auto-discovers hooks/hooks.json by convention, validates it, and rejects the plugin:

Status: ✘ failed to load
Error: Hook load failed: expected record, received array (path: hooks)

The hook was broken three ways: (a) hooks was an array but must be a record keyed by event; (b) it used a non-existent on_plugin_enable event; (c) the command npm list -g capcut-cli >/dev/null 2>&1 || ... uses bash redirects that fail on Windows.

Changes

  • Add .claude-plugin/marketplace.json with the required name + owner. The plugin lives at the repo root, so the plugin entry uses "source": "./". Remove the misplaced root marketplace.json.
  • Fix hooks/hooks.json (kept, not removed — the "ensure capcut-cli is installed" intent is preserved):
    • hooks is now a record keyed by event;
    • event changed on_plugin_enableSessionStart;
    • command is now a shell-agnostic node -e one-liner (Node ≥18 is already required) that checks with npm ls -g and installs only when missing — works on Windows, macOS and Linux.
  • Remove the hooks field from plugin.json. Claude Code auto-loads hooks/hooks.json, so an explicit reference double-loads it and errors with Duplicate hooks file detected.

Verification

claude plugin validate <repo>                 # ✔ Validation passed
claude plugin marketplace add <repo>
claude plugin install capcut-cli@capcut-cli
claude plugin list
#   ❯ capcut-cli@capcut-cli   Status: ✔ enabled
claude plugin details capcut-cli
#   Skills (1)  capcut-edit
#   Hooks (1)   SessionStart  (harness-only — no model context cost)

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.

Wladefant added 5 commits May 28, 2026 20:46
…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.
@renezander030 renezander030 merged commit a32f380 into renezander030:master May 29, 2026
@renezander030
Copy link
Copy Markdown
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 /plugin marketplace add flow. Spot-on diagnosis on both counts — the manifest needing to live at .claude-plugin/marketplace.json with name/owner, and the old on_plugin_enable hook shape being invalid and silently blocking the whole plugin from loading. The portable node -e install check on SessionStart is a nice touch too.

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,
Rene

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants