Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:04:17 +08:00
commit 652915e226
62 changed files with 8212 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Virtual Environment
venv/
ENV/
env/
.venv
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# Logs
*.log
# Environment variables
.env
.env.local
# Testing
.pytest_cache/
.coverage
htmlcov/
# Node.js
node_modules/
npm-debug.log
yarn-error.log
# MCP
.mcp_cache/

View File

@@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - {{DATE}}
### Added
- Initial plugin scaffold
- Plugin directory structure
- Plugin manifest (plugin.json)

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Plugin Builder
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,167 @@
# Plugin.json Configuration Guide
## Critical Rule: Auto-Discovery vs Custom Paths
**Auto-Discovered (DO NOT list in plugin.json):**
- `commands/` directory → All `.md` files auto-discovered
- `agents/` directory → All `.md` files auto-discovered
- `skills/` directory → All `SKILL.md` files auto-discovered
**Only List in plugin.json IF using custom/non-standard locations**
---
## Example 1: Standard Structure (Most Common)
**Directory structure:**
```
my-plugin/
├── .claude-plugin/
│ └── plugin.json
├── commands/
│ ├── deploy.md
│ └── validate.md
├── agents/
│ ├── orchestrator.md
│ └── validator.md
└── skills/
└── deployment-skill/
└── SKILL.md
```
**plugin.json (NO commands/agents/skills fields):**
```json
{
"name": "my-plugin"
"version": "1.0.0"
"description": "Deployment automation"
"author": {
"name": "Dev Team"
"email": "dev@example.com"
}
"license": "MIT"
"keywords": ["deployment"]
}
```
**Why:** Everything is in default directories - auto-discovered automatically.
---
## Example 2: Custom Locations (Rare)
**Directory structure:**
```
my-plugin/
├── .claude-plugin/
│ └── plugin.json
├── commands/ ← Auto-discovered (default)
│ └── deploy.md
├── specialized/ ← Custom location
│ └── advanced-deploy.md
└── custom-agents/ ← Custom location
└── reviewer.md
```
**plugin.json (List ONLY custom paths):**
```json
{
"name": "my-plugin"
"version": "1.0.0"
"description": "Deployment automation"
"author": {
"name": "Dev Team"
"email": "dev@example.com"
}
"license": "MIT"
"keywords": ["deployment"]
"commands": ["./specialized/advanced-deploy.md"]
"agents": ["./custom-agents/reviewer.md"]
}
```
**Result:**
- `commands/deploy.md` loaded (auto-discovered)
- `specialized/advanced-deploy.md` loaded (from plugin.json)
- `custom-agents/reviewer.md` loaded (from plugin.json)
---
## ❌ WRONG: Duplication Error
**Directory structure:**
```
my-plugin/
├── commands/
│ └── deploy.md
└── agents/
└── orchestrator.md
```
**plugin.json (CAUSES DUPLICATION):**
```json
{
"name": "my-plugin"
"commands": ["./commands/deploy.md"], WRONG
"agents": ["./agents/orchestrator.md"] WRONG
}
```
**Why wrong:**
- `deploy.md` loaded from auto-discovery
- `deploy.md` loaded AGAIN from plugin.json listing
- **Result: Command appears TWICE**
---
## Template Default
Our `plugin.json.template` defaults to:
```json
{
"name": "{{PLUGIN_NAME}}"
"version": "{{VERSION}}"
"description": "{{DESCRIPTION}}"
"author": {
"name": "{{AUTHOR_NAME}}"
"email": "{{AUTHOR_EMAIL}}"
}
"homepage": "{{HOMEPAGE_URL}}"
"repository": "{{REPOSITORY_URL}}"
"license": "{{LICENSE}}"
"keywords": {{KEYWORDS}}
}
```
**No `commands`, `agents`, or `skills` fields** - assumes standard structure.
---
## When Building Plugins
**For /build-lifecycle-plugin:**
1. Creates standard structure (commands/, agents/, skills/)
2. Generates plugin.json WITHOUT component fields
3. Everything auto-discovered
4. No duplication issues
**Only add component fields manually if:**
- You have scripts in non-standard locations
- You're organizing differently for a specific reason
- You understand the supplemental (not replacement) behavior
---
## Quick Reference
| Scenario | Include in plugin.json? |
|:---------|:------------------------|
| Component in `commands/` | ❌ No (auto-discovered) |
| Component in `agents/` | ❌ No (auto-discovered) |
| Component in `skills/` | ❌ No (auto-discovered) |
| Component in `custom-dir/` | ✅ Yes (must specify path) |
| Both default AND custom | ✅ List only custom paths |
---
**Rule of thumb:** If you're using standard directories, leave `commands`, `agents`, `skills` out of plugin.json entirely.

View File

@@ -0,0 +1,107 @@
# Plugin Templates
This directory contains templates for creating Claude Code plugins.
## Files
- `plugin.json.template` - Plugin manifest template
- `example-plugin/` - Complete working example plugin
## Template Variables
| Variable | Purpose | Example |
|:---------|:--------|:--------|
| `{{PLUGIN_NAME}}` | Unique identifier (kebab-case) | `deployment-tools` |
| `{{VERSION}}` | Semantic version | `1.0.0` |
| `{{DESCRIPTION}}` | Plugin purpose | `Deployment automation` |
| `{{AUTHOR_NAME}}` | Author name | `Dev Team` |
| `{{AUTHOR_EMAIL}}` | Author email | `dev@company.com` |
| `{{HOMEPAGE_URL}}` | Documentation URL | `https://docs.example.com` |
| `{{REPOSITORY_URL}}` | Source code URL | `https://github.com/org/plugin` |
| `{{LICENSE}}` | License identifier | `MIT`, `Apache-2.0` |
| `{{KEYWORDS}}` | Discovery tags (array) | `["deployment", "ci-cd"]` |
## Plugin Structure
```
plugin-name/
├── .claude-plugin/ # Metadata directory
│ └── plugin.json # Required: plugin manifest
├── commands/ # Slash commands (auto-discovered)
│ ├── deploy.md
│ └── status.md
├── agents/ # Subagents for multi-step tasks (auto-discovered)
│ ├── deployment-orchestrator.md
│ └── validator.md
├── skills/ # Background skills (auto-discovered)
│ ├── deployment-skill/
│ │ ├── SKILL.md
│ │ ├── scripts/
│ │ └── templates/
│ └── monitoring-skill/
│ └── SKILL.md
├── hooks/ # Event hooks (optional)
│ └── pre-deploy.hook.md
├── docs/ # Documentation (optional)
│ ├── guide.md
│ ├── examples.md
│ └── api.md
├── memory/ # Persistent state (optional)
│ ├── state.json
│ └── cache/
├── LICENSE # License file (optional)
└── README.md # Plugin overview (optional)
```
**Critical**:
- All directories at plugin root, NOT inside `.claude-plugin/`
- `commands/`, `agents/`, `skills/` are auto-discovered if present
- Only list in plugin.json if using custom locations
## Usage
### Creating from Template
```bash
# Create plugin structure
mkdir -p my-plugin/.claude-plugin
# Copy and fill manifest
cp plugin.json.template my-plugin/.claude-plugin/plugin.json
# Edit plugin.json and replace {{VARIABLES}}
# Add components
mkdir my-plugin/commands
mkdir my-plugin/skills
```
### Using Build Command
```bash
# Let build system create it for you
/build:plugin my-plugin "Description" --components=cmd,skill
```
## Best Practices
1. **Use ${CLAUDE_PLUGIN_ROOT}**:
- For all paths in hooks and MCP servers
- Ensures portability across installations
2. **Semantic Versioning**:
- Major: Breaking changes
- Minor: New features (backwards-compatible)
- Patch: Bug fixes
3. **Complete Metadata**:
- Author, repository, license
- Helps users understand plugin origin
4. **Test Locally**:
- Use local marketplace for testing
- Uninstall/reinstall to test updates
---
**Purpose**: Templates for creating plugins
**Used by**: plugin-builder agent

View File

@@ -0,0 +1,24 @@
# {{PLUGIN_NAME}}
{{DESCRIPTION}}
## Installation
```bash
/plugin install {{PLUGIN_NAME}}@marketplace-name
```
## Usage
[Add usage instructions]
## Components
- **Commands**: Available slash commands
- **Agents**: Specialized AI agents
- **Skills**: Reusable capabilities
- **Hooks**: Event-driven automation
## License
MIT

View File

@@ -0,0 +1,16 @@
{
"name": "example-plugin",
"version": "1.0.0",
"description": "Example plugin demonstrating structure and components",
"author": {
"name": "Framework Team"
},
"license": "MIT",
"keywords": ["example", "template"],
"commands": [
"./commands/greet.md"
],
"skills": [
"./skills/hello-skill/SKILL.md"
]
}

View File

@@ -0,0 +1,8 @@
{
"PreToolUse": [],
"PostToolUse": [],
"UserPromptSubmit": [],
"SessionStart": [],
"SessionEnd": [],
"PreCompact": []
}

View File

@@ -0,0 +1,23 @@
{
"name": "{{PLUGIN_NAME}}",
"version": "1.0.0",
"description": "{{DESCRIPTION}}",
"owner": {
"name": "Plugin Developer",
"email": "noreply@{{PLUGIN_NAME}}.dev"
},
"plugins": [
{
"name": "{{PLUGIN_NAME}}",
"description": "{{DESCRIPTION}}",
"version": "1.0.0",
"author": {
"name": "Plugin Developer",
"email": "noreply@{{PLUGIN_NAME}}.dev"
},
"source": "./plugins/{{PLUGIN_NAME}}",
"category": "development",
"keywords": []
}
]
}

View File

@@ -0,0 +1,3 @@
{
"mcpServers": {}
}

View File

@@ -0,0 +1,13 @@
{
"name": "{{PLUGIN_NAME}}",
"version": "{{VERSION}}",
"description": "{{DESCRIPTION}}",
"author": {
"name": "{{AUTHOR_NAME}}",
"email": "{{AUTHOR_EMAIL}}"
},
"homepage": "{{HOMEPAGE_URL}}",
"repository": "{{REPOSITORY_URL}}",
"license": "{{LICENSE}}",
"keywords": {{KEYWORDS}}
}