Skip to content

feat: ship a Claude Code plugin marketplace - #37

Closed
J-MaFf wants to merge 2 commits into
1Password:mainfrom
J-MaFf:feat/claude-code-plugin-marketplace
Closed

feat: ship a Claude Code plugin marketplace#37
J-MaFf wants to merge 2 commits into
1Password:mainfrom
J-MaFf:feat/claude-code-plugin-marketplace

Conversation

@J-MaFf

@J-MaFf J-MaFf commented Aug 24, 2026

Copy link
Copy Markdown

Closes #34

Summary

Ships the 1Password validator as a proper Claude Code plugin, distributed from a marketplace hosted in this repo, alongside (not replacing) the existing install.sh --agent claude-code copy-paste bundle.

  • .claude-plugin/marketplace.json — declares an agent-hooks marketplace with one plugin (1password) sourced from the repo root.
  • .claude-plugin/plugin.json — plugin metadata (name, version, author, license, etc). No hooks field needed since hooks/hooks.json is auto-discovered at its default path.
  • hooks/hooks.json — the PreToolUse/Bash hook entry, using "${CLAUDE_PLUGIN_ROOT}"/bin/run-hook.sh 1password-validate-mounted-env-files instead of a project-root-relative path.
  • README.md — documents the new install flow (/plugin marketplace add 1Password/agent-hooks + /plugin install 1password@agent-hooks) as the recommended path for Claude Code, and links to it from the Available Hooks table.

Why

Fixes both problems from #34:

  1. No update mechanism. The install.sh bundle vendors a static copy of bin/, lib/, adapters/, and hooks/ into .claude/ with no way to know it's stale. Plugin installs update via /plugin marketplace update.
  2. Relative-path hook error. The generated .claude/settings.json uses a path relative to the project root, which breaks with No such file or directory when Claude Code runs hooks from a non-root cwd. ${CLAUDE_PLUGIN_ROOT} resolves to an absolute path reliably for plugin-scoped hooks, sidestepping this and the separate $CLAUDE_PROJECT_DIR bug referenced in the issue ([BUG] $CLAUDE_PROJECT_DIR is empty/unset in hook and Bash tool execution (v2.1.74) anthropics/claude-code#33815).

No changes to adapters/claude-code.sh, install.sh, or the .claude/settings.json template logic — kept scoped to the new plugin files and docs since #28 (in progress) touches the adapter and hook-matcher code for a different reason.

Testing

  • claude plugin validate . and claude plugin validate ./.claude-plugin/plugin.json both pass, including with --strict.
  • JSON syntax validated for all three new files.
  • Manually simulated a plugin-style invocation: copied bin/, lib/, adapters/, hooks/, VERSION to a temp dir, set CLAUDE_PLUGIN_ROOT to that dir, ran bin/run-hook.sh via the absolute ${CLAUDE_PLUGIN_ROOT} path from an unrelated working directory. Exits 0 with no path-resolution error — confirms the fix for the reported bug.
  • bats isn't installed in this environment so the existing suite wasn't run locally; changes are additive only (new files + README) and don't touch any script the existing tests exercise, so I'd expect CI's tests.yml to pass unchanged.

Not in this PR

  • No change to install.sh or the bundle flow — still supported for other agents (Cursor, GitHub Copilot, Windsurf) and for Claude Code users who prefer a vendored copy.
  • No change to lib/telemetry.sh's detect_install_method (plugin-cache installs currently fall through to manual there); the README's telemetry section already anticipates plugin distributions reporting installs separately, but wiring that up felt like a separate, telemetry-focused change rather than part of shipping the plugin scaffolding itself. Happy to file a follow-up issue if maintainers agree it's worth tracking.

J-MaFf added 2 commits August 24, 2026 02:55
Adds .claude-plugin/marketplace.json and .claude-plugin/plugin.json so
this repo can be installed as a proper Claude Code plugin via
`/plugin marketplace add 1Password/agent-hooks` +
`/plugin install 1password@agent-hooks`, instead of only the
copy-paste install.sh bundle.

Adds hooks/hooks.json using ${CLAUDE_PLUGIN_ROOT} for the hook
command path, which Claude Code resolves to an absolute path
reliably for plugin-scoped hooks. This sidesteps the two problems
described in 1Password#34: the vendored install.sh bundle has no update
mechanism, and its generated .claude/settings.json uses a path
relative to the project root that breaks with a "No such file or
directory" hook error when Claude Code runs hooks from a non-root
working directory.

Verified: `claude plugin validate .` and `claude plugin validate
./.claude-plugin/plugin.json` both pass (including --strict); a
manual simulation invoking bin/run-hook.sh via an absolute
CLAUDE_PLUGIN_ROOT-style path from an unrelated cwd exits 0 with no
path-resolution error, confirming the fix for the reported bug.

Documents the new install flow in README.md as the recommended path
for Claude Code, alongside (not replacing) the existing
`install.sh --agent claude-code` flow for other agents and for users
who prefer a vendored copy.

- Added: .claude-plugin/marketplace.json, .claude-plugin/plugin.json, hooks/hooks.json
- Modified: README.md (Available Hooks table + new "Claude Code plugin (recommended)" section)
- Out of scope (left untouched): adapters/claude-code.sh, .claude/settings.json template logic — overlaps with 1Password#28, being worked concurrently
- Tested: JSON syntax validated; `claude plugin validate` clean with --strict; manual run-hook.sh path-resolution simulation from a non-root cwd

Closes 1Password#34
"Replaces" read as contradicting the next paragraph, which says the
install.sh bundle flow still works and is unaffected. Reworded to
"in place of" to make clear the plugin is the recommended path
without implying the bundle option is being removed.
@J-MaFf

J-MaFf commented Aug 24, 2026

Copy link
Copy Markdown
Author

Self-review: re-read the diff after opening this PR.

Found and fixed one issue in a follow-up commit (81c7dda): the new "Claude Code plugin (recommended)" README section originally said the plugin "replaces" the copy-paste bundle for Claude Code, but the very next paragraph said the install.sh --agent claude-code flow "still works and is unaffected by this option" — those two statements contradicted each other. Reworded "replaces" to "in place of" so it's clear the plugin is the recommended default without implying the bundle option is being removed (it isn't — this PR is additive only).

Everything else checked out:

@J-MaFf

J-MaFf commented Aug 24, 2026

Copy link
Copy Markdown
Author

Closing — this was opened as part of an automated exploration and isn't something I should be maintaining upstream. Apologies for the noise.

@J-MaFf J-MaFf closed this Aug 24, 2026
@J-MaFf
J-MaFf deleted the feat/claude-code-plugin-marketplace branch August 24, 2026 03:26
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.

Ship a proper Claude Code plugin (marketplace) instead of the copy-paste bundle

1 participant