Skip to content

refactor: flatten plugin structure to match Claude Code naming convention#47

Merged
chen201724 merged 1 commit into
mainfrom
refactor/flatten-plugin-structure
Mar 5, 2026
Merged

refactor: flatten plugin structure to match Claude Code naming convention#47
chen201724 merged 1 commit into
mainfrom
refactor/flatten-plugin-structure

Conversation

@chen201724
Copy link
Copy Markdown
Member

Problem

Fixes #42 (final fix after PR#44, PR#45, and PR#46)

Even after fixing the source path format with ./ prefix, users still report installation errors:

Error: Failed to install: Source path does not exist:
/Users/jichu/.claude/plugins/marketplaces/yuque/plugins/yuque-personal

Root Cause

Claude Code has a strict naming convention: the plugin's name field must match the last segment of the source path.

Previous (incorrect):

{
  "name": "yuque-personal",                    // ❌ Name is yuque-personal
  "source": "./plugins/claude-code/personal"   // ❌ Last segment is personal (mismatch!)
}

Claude Code was looking for plugins/yuque-personal (based on the name), but the actual path was plugins/claude-code/personal.

Correct format (from official marketplace):

{
  "name": "typescript-lsp",           // ✅ Name
  "source": "./plugins/typescript-lsp" // ✅ Last segment matches name
}

Changes

Directory Structure Refactoring

  • ✅ Moved plugins/claude-code/personal/plugins/yuque-personal/
  • ✅ Moved plugins/claude-code/group/plugins/yuque-group/
  • ✅ Updated marketplace.json source paths:
    • "./plugins/claude-code/personal""./plugins/yuque-personal"
    • "./plugins/claude-code/group""./plugins/yuque-group"
  • ✅ Updated documentation references in AGENT-INSTALL.md

New Structure

plugins/
├── yuque-personal/          # ✅ Name matches last segment
│   ├── .claude-plugin/
│   │   └── plugin.json
│   ├── .mcp.json
│   └── skills/
└── yuque-group/             # ✅ Name matches last segment
    ├── .claude-plugin/
    │   └── plugin.json
    ├── .mcp.json
    └── skills/

marketplace.json (after this PR)

{
  "plugins": [
    {
      "name": "yuque-personal",           // ✅ Matches last segment
      "source": "./plugins/yuque-personal" // ✅ Last segment is yuque-personal
    },
    {
      "name": "yuque-group",              // ✅ Matches last segment
      "source": "./plugins/yuque-group"    // ✅ Last segment is yuque-group
    }
  ]
}

Verification

Compared with official Claude Code marketplace structure:

# Official marketplace follows the same pattern
cat ~/.claude/plugins/marketplaces/claude-plugins-official/.claude-plugin/marketplace.json | jq '.plugins[0]'
# {
#   "name": "typescript-lsp",
#   "source": "./plugins/typescript-lsp"  # ✅ Last segment matches name
# }

How to Use (After Merge)

  1. Remove the broken marketplace:

    rm -rf ~/.claude/plugins/marketplaces/yuque-yuque-ecosystem
  2. Add the marketplace:

    /plugin marketplace add yuque/yuque-ecosystem
  3. Install plugins:

    /plugin install yuque-personal@yuque
    # or
    /plugin install yuque-group@yuque

Both commands should now work correctly! 🎉

Breaking Changes

⚠️ Directory structure changed — if anyone was referencing the old paths (plugins/claude-code/personal), they need to update to plugins/yuque-personal.

However, this is unlikely to affect users since:

  • The marketplace installation uses the source field (now updated)
  • Direct plugin installation via path was already broken
  • This is the first public release of the marketplace

Related

  • PR#44: Fixed pluginRoot issue
  • PR#45: Attempted to fix source paths (reverted)
  • PR#46: Added ./ prefix to source paths
  • This PR: Flattens structure to match Claude Code naming convention (final fix)

…tion

- Move plugins/claude-code/personal -> plugins/yuque-personal
- Move plugins/claude-code/group -> plugins/yuque-group
- Update marketplace.json source paths accordingly
- Update AGENT-INSTALL.md documentation

This fixes the plugin installation error where Claude Code expects
the plugin name to match the last segment of the source path.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-03-05 06:05 UTC

@chen201724 chen201724 merged commit 971c354 into main Mar 5, 2026
1 check passed
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.

claude code 添加不了plugin

1 participant