Compare commits
18 Commits
v5.4.0
...
1b75b10fec
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b75b10fec | |||
| 45af713366 | |||
| 9550a85f4d | |||
| e925f80252 | |||
| e1d7ec46ae | |||
| c8b91f6a87 | |||
| b1070aac52 | |||
| ce106ace8a | |||
| afd4c44d11 | |||
| d2b6560fba | |||
| 7c3a2ac31c | |||
| e0ab4c2ddf | |||
| 4b1c561bb6 | |||
| 5f82f8ebbd | |||
| b492a13702 | |||
| 786d3c0013 | |||
| 5aaab4cb9a | |||
| 3c3b3b4575 |
@@ -20,7 +20,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/projman/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "development",
|
||||
"tags": ["sprint", "agile", "gitea", "project-management"],
|
||||
"license": "MIT"
|
||||
@@ -84,7 +83,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/cmdb-assistant/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "infrastructure",
|
||||
"tags": ["cmdb", "netbox", "dcim", "ipam", "data-quality", "validation"],
|
||||
"license": "MIT"
|
||||
@@ -145,7 +143,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/pr-review/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "development",
|
||||
"tags": ["code-review", "pull-requests", "security", "quality"],
|
||||
"license": "MIT"
|
||||
@@ -161,7 +158,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/data-platform/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "data",
|
||||
"tags": ["pandas", "postgresql", "postgis", "dbt", "data-engineering", "etl"],
|
||||
"license": "MIT"
|
||||
@@ -177,7 +173,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/viz-platform/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "visualization",
|
||||
"tags": ["dash", "plotly", "mantine", "charts", "dashboards", "theming", "dmc"],
|
||||
"license": "MIT"
|
||||
@@ -193,7 +188,6 @@
|
||||
},
|
||||
"homepage": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/src/branch/main/plugins/contract-validator/README.md",
|
||||
"repository": "https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace.git",
|
||||
"mcpServers": ["./.mcp.json"],
|
||||
"category": "development",
|
||||
"tags": ["validation", "contracts", "compatibility", "agents", "interfaces", "cross-plugin"],
|
||||
"license": "MIT"
|
||||
|
||||
24
.mcp.json
Normal file
24
.mcp.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"command": "/home/lmiranda/.claude/plugins/marketplaces/leo-claude-mktplace/mcp-servers/gitea/run.sh",
|
||||
"args": []
|
||||
},
|
||||
"netbox": {
|
||||
"command": "/home/lmiranda/.claude/plugins/marketplaces/leo-claude-mktplace/mcp-servers/netbox/run.sh",
|
||||
"args": []
|
||||
},
|
||||
"viz-platform": {
|
||||
"command": "/home/lmiranda/.claude/plugins/marketplaces/leo-claude-mktplace/mcp-servers/viz-platform/run.sh",
|
||||
"args": []
|
||||
},
|
||||
"data-platform": {
|
||||
"command": "/home/lmiranda/.claude/plugins/marketplaces/leo-claude-mktplace/mcp-servers/data-platform/run.sh",
|
||||
"args": []
|
||||
},
|
||||
"contract-validator": {
|
||||
"command": "/home/lmiranda/.claude/plugins/marketplaces/leo-claude-mktplace/mcp-servers/contract-validator/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
93
CLAUDE.md
93
CLAUDE.md
@@ -40,8 +40,76 @@ Run `./scripts/verify-hooks.sh`. If changes affect MCP servers or hooks, inform
|
||||
|
||||
**Valid hook events:** `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, `SessionStart`, `SessionEnd`, `Notification`, `Stop`, `SubagentStop`, `PreCompact`
|
||||
|
||||
### ⛔ MANDATORY: Before Any Code Change
|
||||
|
||||
**Claude MUST show this checklist BEFORE editing any file:**
|
||||
|
||||
#### 1. Impact Search Results
|
||||
Run and show output of:
|
||||
```bash
|
||||
grep -rn "PATTERN" --include="*.sh" --include="*.md" --include="*.json" --include="*.py" | grep -v ".git"
|
||||
```
|
||||
|
||||
#### 2. Files That Will Be Affected
|
||||
Numbered list of every file to be modified, with the specific change for each.
|
||||
|
||||
#### 3. Files Searched But Not Changed (and why)
|
||||
Proof that related files were checked and determined unchanged.
|
||||
|
||||
#### 4. Documentation That References This
|
||||
List of docs that mention this feature/script/function.
|
||||
|
||||
**User verifies this list before Claude proceeds. If Claude skips this, STOP IMMEDIATELY.**
|
||||
|
||||
#### After Changes
|
||||
Run the same grep and show results proving no references remain unaddressed.
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Development Context: We Build AND Use These Plugins
|
||||
|
||||
**This is a self-referential project.** We are:
|
||||
1. **BUILDING** a plugin marketplace (source code in `plugins/`)
|
||||
2. **USING** the installed marketplace to build it (dogfooding)
|
||||
|
||||
### Plugins ACTIVELY USED in This Project
|
||||
|
||||
These plugins are installed and should be used during development:
|
||||
|
||||
| Plugin | Used For |
|
||||
|--------|----------|
|
||||
| **projman** | Sprint planning, issue management, lessons learned |
|
||||
| **git-flow** | Commits, branch management |
|
||||
| **pr-review** | Pull request reviews |
|
||||
| **doc-guardian** | Documentation drift detection |
|
||||
| **code-sentinel** | Security scanning, refactoring |
|
||||
| **clarity-assist** | Prompt clarification |
|
||||
| **claude-config-maintainer** | CLAUDE.md optimization |
|
||||
| **contract-validator** | Cross-plugin compatibility |
|
||||
|
||||
### Plugins NOT Used Here (Development Only)
|
||||
|
||||
These plugins exist in source but are **NOT relevant** to this project's workflow:
|
||||
|
||||
| Plugin | Why Not Used |
|
||||
|--------|--------------|
|
||||
| **data-platform** | For data engineering projects (pandas, PostgreSQL, dbt) |
|
||||
| **viz-platform** | For dashboard projects (Dash, Plotly) |
|
||||
| **cmdb-assistant** | For infrastructure projects (NetBox) |
|
||||
|
||||
**Do NOT suggest** `/ingest`, `/profile`, `/chart`, `/cmdb-*` commands - they don't apply here.
|
||||
|
||||
### Key Distinction
|
||||
|
||||
| Context | Path | What To Do |
|
||||
|---------|------|------------|
|
||||
| **Editing plugin source** | `~/claude-plugins-work/plugins/` | Modify code, add features |
|
||||
| **Using installed plugins** | `~/.claude/plugins/marketplaces/` | Run commands like `/sprint-plan` |
|
||||
|
||||
When user says "run /sprint-plan", use the INSTALLED plugin.
|
||||
When user says "fix the sprint-plan command", edit the SOURCE code.
|
||||
|
||||
---
|
||||
|
||||
## Project Overview
|
||||
|
||||
@@ -76,7 +144,7 @@ A plugin marketplace for Claude Code containing:
|
||||
./scripts/post-update.sh # Rebuild venvs, verify symlinks
|
||||
```
|
||||
|
||||
### Plugin Commands by Category
|
||||
### Plugin Commands - USE THESE in This Project
|
||||
|
||||
| Category | Commands |
|
||||
|----------|----------|
|
||||
@@ -88,12 +156,19 @@ A plugin marketplace for Claude Code containing:
|
||||
| **Docs** | `/doc-audit`, `/doc-sync`, `/changelog-gen`, `/doc-coverage`, `/stale-docs` |
|
||||
| **Security** | `/security-scan`, `/refactor`, `/refactor-dry` |
|
||||
| **Config** | `/config-analyze`, `/config-optimize`, `/config-diff`, `/config-lint` |
|
||||
| **Data** | `/ingest`, `/profile`, `/schema`, `/explain`, `/lineage`, `/lineage-viz`, `/run`, `/dbt-test`, `/data-quality` |
|
||||
| **Visualization** | `/component`, `/chart`, `/chart-export`, `/dashboard`, `/theme`, `/theme-new`, `/theme-css`, `/accessibility-check`, `/breakpoints` |
|
||||
| **Validation** | `/validate-contracts`, `/check-agent`, `/list-interfaces`, `/dependency-graph` |
|
||||
| **CMDB** | `/cmdb-search`, `/cmdb-device`, `/cmdb-ip`, `/cmdb-site`, `/cmdb-audit`, `/cmdb-register`, `/cmdb-sync`, `/cmdb-topology`, `/change-audit`, `/ip-conflicts` |
|
||||
| **Debug** | `/debug-report`, `/debug-review` |
|
||||
|
||||
### Plugin Commands - NOT RELEVANT to This Project
|
||||
|
||||
These commands are being developed but don't apply to this project's workflow:
|
||||
|
||||
| Category | Commands | For Projects Using |
|
||||
|----------|----------|-------------------|
|
||||
| **Data** | `/ingest`, `/profile`, `/schema`, `/lineage`, `/dbt-test` | pandas, PostgreSQL, dbt |
|
||||
| **Visualization** | `/component`, `/chart`, `/dashboard`, `/theme` | Dash, Plotly dashboards |
|
||||
| **CMDB** | `/cmdb-search`, `/cmdb-device`, `/cmdb-sync` | NetBox infrastructure |
|
||||
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
@@ -108,7 +183,7 @@ leo-claude-mktplace/
|
||||
├── plugins/
|
||||
│ ├── projman/ # Sprint management
|
||||
│ │ ├── .claude-plugin/plugin.json
|
||||
│ │ ├── .mcp.json
|
||||
│ │ # .mcp.json removed - now at marketplace root
|
||||
│ │ ├── mcp-servers/gitea -> ../../../mcp-servers/gitea # SYMLINK
|
||||
│ │ ├── commands/ # 14 commands (incl. setup, debug, suggest-version)
|
||||
│ │ ├── hooks/ # SessionStart: mismatch detection + sprint suggestions
|
||||
@@ -120,7 +195,7 @@ leo-claude-mktplace/
|
||||
│ │ └── agents/
|
||||
│ ├── pr-review/ # Multi-agent PR review
|
||||
│ │ ├── .claude-plugin/plugin.json
|
||||
│ │ ├── .mcp.json
|
||||
│ │ # .mcp.json removed - now at marketplace root
|
||||
│ │ ├── mcp-servers/gitea -> ../../../mcp-servers/gitea # SYMLINK
|
||||
│ │ ├── commands/ # 6 commands (incl. setup)
|
||||
│ │ ├── hooks/ # SessionStart mismatch detection
|
||||
@@ -131,14 +206,14 @@ leo-claude-mktplace/
|
||||
│ │ └── agents/
|
||||
│ ├── data-platform/ # Data engineering (NEW v4.0.0)
|
||||
│ │ ├── .claude-plugin/plugin.json
|
||||
│ │ ├── .mcp.json
|
||||
│ │ # .mcp.json removed - now at marketplace root
|
||||
│ │ ├── mcp-servers/ # pandas, postgresql, dbt MCPs
|
||||
│ │ ├── commands/ # 7 commands
|
||||
│ │ ├── hooks/ # SessionStart PostgreSQL check
|
||||
│ │ └── agents/ # 2 agents
|
||||
│ ├── viz-platform/ # Visualization (NEW v4.0.0)
|
||||
│ │ ├── .claude-plugin/plugin.json
|
||||
│ │ ├── .mcp.json
|
||||
│ │ # .mcp.json removed - now at marketplace root
|
||||
│ │ ├── mcp-servers/ # viz-platform MCP
|
||||
│ │ ├── commands/ # 7 commands
|
||||
│ │ ├── hooks/ # SessionStart DMC check
|
||||
@@ -354,4 +429,4 @@ The script will:
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2026-01-28
|
||||
**Last Updated:** 2026-01-30
|
||||
|
||||
@@ -163,12 +163,11 @@ leo-claude-mktplace/
|
||||
│ └── claude-md-integration.md
|
||||
├── scripts/ # Setup and maintenance scripts
|
||||
│ ├── setup.sh # Initial setup (create venvs, config templates)
|
||||
│ ├── post-update.sh # Post-update (rebuild venvs, verify symlinks)
|
||||
│ ├── check-venv.sh # Check if venvs exist (for hooks)
|
||||
│ ├── post-update.sh # Post-update (clear cache, show changelog)
|
||||
│ ├── check-venv.sh # Check if venvs exist (read-only)
|
||||
│ ├── validate-marketplace.sh # Marketplace compliance validation
|
||||
│ ├── verify-hooks.sh # Verify all hooks use correct event types
|
||||
│ ├── setup-venvs.sh # Setup/repair MCP server venvs
|
||||
│ ├── venv-repair.sh # Repair broken venv symlinks
|
||||
│ ├── setup-venvs.sh # Setup MCP server venvs (create only, never delete)
|
||||
│ └── release.sh # Release automation with version bumping
|
||||
├── CLAUDE.md
|
||||
├── README.md
|
||||
|
||||
@@ -501,9 +501,8 @@ If you get 401, regenerate your token in Gitea.
|
||||
# Check venv exists
|
||||
ls /path/to/mcp-servers/gitea/.venv
|
||||
|
||||
# Reinstall if missing
|
||||
# If missing, create venv (do NOT delete existing venvs)
|
||||
cd /path/to/mcp-servers/gitea
|
||||
rm -rf .venv
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
@@ -132,10 +132,8 @@ When updating, review if changes affect the setup workflow:
|
||||
### Dependencies fail to install
|
||||
|
||||
```bash
|
||||
# Rebuild virtual environment
|
||||
# Install missing dependencies (do NOT delete .venv)
|
||||
cd mcp-servers/gitea
|
||||
rm -rf .venv
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
deactivate
|
||||
|
||||
@@ -144,7 +144,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -189,7 +189,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue number"
|
||||
},
|
||||
"title": {
|
||||
@@ -211,7 +211,7 @@ class GiteaMCPServer:
|
||||
"description": "New labels"
|
||||
},
|
||||
"milestone": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Milestone ID to assign"
|
||||
},
|
||||
"repo": {
|
||||
@@ -229,7 +229,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue number"
|
||||
},
|
||||
"comment": {
|
||||
@@ -424,7 +424,7 @@ class GiteaMCPServer:
|
||||
"description": "Tags to filter by (optional)"
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"default": 20,
|
||||
"description": "Maximum results"
|
||||
},
|
||||
@@ -462,7 +462,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"milestone_id": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Milestone ID"
|
||||
},
|
||||
"repo": {
|
||||
@@ -506,7 +506,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"milestone_id": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Milestone ID"
|
||||
},
|
||||
"title": {
|
||||
@@ -541,7 +541,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"milestone_id": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Milestone ID"
|
||||
},
|
||||
"repo": {
|
||||
@@ -560,7 +560,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -578,11 +578,11 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue that will depend on another"
|
||||
},
|
||||
"depends_on": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue that blocks issue_number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -600,11 +600,11 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"issue_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue that depends on another"
|
||||
},
|
||||
"depends_on": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Issue being depended on"
|
||||
},
|
||||
"repo": {
|
||||
@@ -782,7 +782,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pr_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Pull request number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -800,7 +800,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pr_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Pull request number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -818,7 +818,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pr_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Pull request number"
|
||||
},
|
||||
"repo": {
|
||||
@@ -836,7 +836,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pr_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Pull request number"
|
||||
},
|
||||
"body": {
|
||||
@@ -855,7 +855,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {"type": "string"},
|
||||
"position": {"type": "integer"},
|
||||
"position": {"type": ["integer", "string"]},
|
||||
"body": {"type": "string"}
|
||||
}
|
||||
},
|
||||
@@ -876,7 +876,7 @@ class GiteaMCPServer:
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pr_number": {
|
||||
"type": "integer",
|
||||
"type": ["integer", "string"],
|
||||
"description": "Pull request number"
|
||||
},
|
||||
"body": {
|
||||
|
||||
@@ -277,6 +277,39 @@ Every CLAUDE.md should have:
|
||||
1. **Project Overview** - What is this?
|
||||
2. **Quick Start** - How do I build/test/run?
|
||||
3. **Important Rules** - What must I NOT do?
|
||||
4. **Pre-Change Protocol** - Mandatory dependency check before code changes
|
||||
|
||||
### Pre-Change Protocol Section (MANDATORY)
|
||||
|
||||
**This section is REQUIRED in every CLAUDE.md.** It ensures Claude performs comprehensive dependency analysis before making any code changes.
|
||||
|
||||
```markdown
|
||||
## ⛔ MANDATORY: Before Any Code Change
|
||||
|
||||
**Claude MUST show this checklist BEFORE editing any file:**
|
||||
|
||||
### 1. Impact Search Results
|
||||
Run and show output of:
|
||||
```bash
|
||||
grep -rn "PATTERN" --include="*.sh" --include="*.md" --include="*.json" --include="*.py" | grep -v ".git"
|
||||
```
|
||||
|
||||
### 2. Files That Will Be Affected
|
||||
Numbered list of every file to be modified, with the specific change for each.
|
||||
|
||||
### 3. Files Searched But Not Changed (and why)
|
||||
Proof that related files were checked and determined unchanged.
|
||||
|
||||
### 4. Documentation That References This
|
||||
List of docs that mention this feature/script/function.
|
||||
|
||||
**User verifies this list before Claude proceeds. If Claude skips this, stop immediately.**
|
||||
|
||||
### After Changes
|
||||
Run the same grep and show results proving no references remain unaddressed.
|
||||
```
|
||||
|
||||
**When analyzing a CLAUDE.md, flag as HIGH priority issue if this section is missing.**
|
||||
|
||||
### Optional Sections (as needed)
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ Analyze the CLAUDE.md file in this project
|
||||
- Quick start commands documented
|
||||
- Critical rules highlighted
|
||||
- Key workflows covered
|
||||
- **Pre-Change Protocol section present** (MANDATORY - see below)
|
||||
|
||||
### Conciseness (25 points)
|
||||
- No unnecessary repetition
|
||||
@@ -66,6 +67,42 @@ Analyze the CLAUDE.md file in this project
|
||||
- Appropriate length for project size
|
||||
- No generic filler content
|
||||
|
||||
## Pre-Change Protocol Check (MANDATORY)
|
||||
|
||||
**This check is CRITICAL.** The Pre-Change Protocol section ensures Claude performs comprehensive dependency analysis before making any code changes, preventing missed references and incomplete updates.
|
||||
|
||||
### What to Check
|
||||
|
||||
Search CLAUDE.md for:
|
||||
- Section header containing "Pre-Change" or "Before Any Code Change"
|
||||
- References to `grep -rn` or impact search
|
||||
- Checklist with "Files That Will Be Affected"
|
||||
- Requirement for user verification before proceeding
|
||||
|
||||
### If Missing
|
||||
|
||||
**Flag as HIGH PRIORITY issue:**
|
||||
|
||||
```
|
||||
1. [HIGH] Missing Pre-Change Protocol section
|
||||
CLAUDE.md lacks mandatory dependency-check protocol.
|
||||
Impact: Claude may miss file references when making changes,
|
||||
leading to broken dependencies and incomplete updates.
|
||||
|
||||
Recommendation: Add Pre-Change Protocol section immediately.
|
||||
This is the #1 cause of cascading bugs from incomplete changes.
|
||||
```
|
||||
|
||||
### Required Section Content
|
||||
|
||||
The Pre-Change Protocol section must include:
|
||||
1. Requirement to run grep search and show results
|
||||
2. List of files that will be affected
|
||||
3. List of files searched but not changed (with reasoning)
|
||||
4. Documentation that references the change target
|
||||
5. User verification checkpoint before proceeding
|
||||
6. Post-change verification step
|
||||
|
||||
## Plugin Integration Analysis
|
||||
|
||||
After the content analysis, the command detects and analyzes marketplace plugin integration:
|
||||
|
||||
@@ -139,6 +139,7 @@ For small projects or when starting fresh:
|
||||
- Project Overview (required)
|
||||
- Quick Start (required)
|
||||
- Critical Rules (required)
|
||||
- **Pre-Change Protocol (required)**
|
||||
|
||||
### Standard Template (default)
|
||||
For typical projects:
|
||||
@@ -146,6 +147,7 @@ For typical projects:
|
||||
- Quick Start
|
||||
- Architecture
|
||||
- Critical Rules
|
||||
- **Pre-Change Protocol**
|
||||
- Common Operations
|
||||
- File Structure
|
||||
|
||||
@@ -153,11 +155,44 @@ For typical projects:
|
||||
For large or complex projects:
|
||||
- All standard sections plus:
|
||||
- Detailed Architecture
|
||||
- **Pre-Change Protocol**
|
||||
- Troubleshooting
|
||||
- Integration Points
|
||||
- Development Workflow
|
||||
- Deployment Notes
|
||||
|
||||
### Pre-Change Protocol Section (MANDATORY in ALL templates)
|
||||
|
||||
**This section MUST be included in every generated CLAUDE.md:**
|
||||
|
||||
```markdown
|
||||
## ⛔ MANDATORY: Before Any Code Change
|
||||
|
||||
**Claude MUST show this checklist BEFORE editing any file:**
|
||||
|
||||
### 1. Impact Search Results
|
||||
Run and show output of:
|
||||
\`\`\`bash
|
||||
grep -rn "PATTERN" --include="*.sh" --include="*.md" --include="*.json" --include="*.py" | grep -v ".git"
|
||||
\`\`\`
|
||||
|
||||
### 2. Files That Will Be Affected
|
||||
Numbered list of every file to be modified, with the specific change for each.
|
||||
|
||||
### 3. Files Searched But Not Changed (and why)
|
||||
Proof that related files were checked and determined unchanged.
|
||||
|
||||
### 4. Documentation That References This
|
||||
List of docs that mention this feature/script/function.
|
||||
|
||||
**User verifies this list before Claude proceeds. If Claude skips this, stop immediately.**
|
||||
|
||||
### After Changes
|
||||
Run the same grep and show results proving no references remain unaddressed.
|
||||
```
|
||||
|
||||
**Rationale:** This protocol prevents incomplete changes where Claude modifies some files but misses others that reference the same code, causing cascading bugs.
|
||||
|
||||
## Auto-Detection
|
||||
|
||||
The command automatically detects:
|
||||
|
||||
@@ -56,6 +56,7 @@ Or specify specific optimizations:
|
||||
|
||||
### Enhance
|
||||
- Add missing essential sections
|
||||
- **Add Pre-Change Protocol if missing (HIGH PRIORITY)**
|
||||
- Improve unclear instructions
|
||||
- Add helpful examples
|
||||
- Highlight critical rules
|
||||
@@ -158,6 +159,49 @@ Backup saved to: .claude/backups/CLAUDE.md.2025-01-18
|
||||
| `--preserve-comments` | Keep all existing comments |
|
||||
| `--section=NAME` | Optimize specific section only |
|
||||
|
||||
## Pre-Change Protocol (Mandatory Addition)
|
||||
|
||||
**If CLAUDE.md is missing the Pre-Change Protocol section, optimization MUST add it.**
|
||||
|
||||
This is the highest priority enhancement because it prevents cascading bugs from incomplete code changes.
|
||||
|
||||
### Detection
|
||||
|
||||
Search CLAUDE.md for:
|
||||
- "Pre-Change" or "Before Any Code Change" in headers
|
||||
- References to impact search or grep verification
|
||||
- User verification checkpoint
|
||||
|
||||
### If Missing
|
||||
|
||||
Add this section (position: after Critical Rules, before Common Operations):
|
||||
|
||||
```markdown
|
||||
## ⛔ MANDATORY: Before Any Code Change
|
||||
|
||||
**Claude MUST show this checklist BEFORE editing any file:**
|
||||
|
||||
### 1. Impact Search Results
|
||||
Run and show output of:
|
||||
\`\`\`bash
|
||||
grep -rn "PATTERN" --include="*.sh" --include="*.md" --include="*.json" --include="*.py" | grep -v ".git"
|
||||
\`\`\`
|
||||
|
||||
### 2. Files That Will Be Affected
|
||||
Numbered list of every file to be modified, with the specific change for each.
|
||||
|
||||
### 3. Files Searched But Not Changed (and why)
|
||||
Proof that related files were checked and determined unchanged.
|
||||
|
||||
### 4. Documentation That References This
|
||||
List of docs that mention this feature/script/function.
|
||||
|
||||
**User verifies this list before Claude proceeds. If Claude skips this, stop immediately.**
|
||||
|
||||
### After Changes
|
||||
Run the same grep and show results proving no references remain unaddressed.
|
||||
```
|
||||
|
||||
## When to Use
|
||||
|
||||
Run `/config-optimize` when:
|
||||
|
||||
@@ -19,6 +19,5 @@
|
||||
"data-quality",
|
||||
"validation"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"netbox": {
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/netbox/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,5 @@
|
||||
"interfaces",
|
||||
"cross-plugin"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"contract-validator": {
|
||||
"type": "stdio",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/contract-validator/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,5 @@
|
||||
"etl",
|
||||
"dataframe"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"data-platform": {
|
||||
"type": "stdio",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/data-platform/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/bin/bash
|
||||
# doc-guardian notification hook
|
||||
# Tracks documentation dependencies and queues updates
|
||||
# This is a command hook - guaranteed not to block workflow
|
||||
#
|
||||
# IMPORTANT: Output is purely informational - uses passive language
|
||||
# to avoid triggering Claude to seek user confirmation.
|
||||
# Run /doc-sync to process the queue when ready.
|
||||
# SILENT BY DEFAULT - No output to avoid interrupting Claude's workflow.
|
||||
# Changes are queued to .doc-guardian-queue for later processing.
|
||||
# Run /doc-sync or /doc-audit to see and process pending updates.
|
||||
#
|
||||
# Set DOC_GUARDIAN_VERBOSE=1 to enable notification output.
|
||||
|
||||
# Read tool input from stdin (JSON with file_path)
|
||||
INPUT=$(cat)
|
||||
@@ -48,40 +49,26 @@ DEPENDENT_DOCS="${DOC_DEPS[$MODIFIED_TYPE]}"
|
||||
# Queue file for tracking pending updates
|
||||
QUEUE_FILE="${CLAUDE_PROJECT_ROOT:-.}/.doc-guardian-queue"
|
||||
|
||||
# Debounce: skip notification if same type was logged in last 5 seconds
|
||||
# This prevents 4+ rapid notifications during batch edits
|
||||
DEBOUNCE_SECONDS=5
|
||||
# Add to queue (always, for deduplication we check file+type combo)
|
||||
# Format: timestamp | type | file_path | dependent_docs
|
||||
QUEUE_ENTRY="$(date +%Y-%m-%dT%H:%M:%S) | $MODIFIED_TYPE | $FILE_PATH | $DEPENDENT_DOCS"
|
||||
|
||||
# Check if this exact file+type combo already exists in queue (dedup)
|
||||
if [ -f "$QUEUE_FILE" ]; then
|
||||
LAST_ENTRY=$(tail -1 "$QUEUE_FILE" 2>/dev/null || true)
|
||||
LAST_TYPE=$(echo "$LAST_ENTRY" | cut -d'|' -f2 | tr -d ' ')
|
||||
LAST_TIME=$(echo "$LAST_ENTRY" | cut -d'|' -f1 | tr -d ' ')
|
||||
|
||||
if [ "$LAST_TYPE" = "$MODIFIED_TYPE" ] && [ -n "$LAST_TIME" ]; then
|
||||
# Convert timestamps to seconds for comparison
|
||||
LAST_EPOCH=$(date -d "$LAST_TIME" +%s 2>/dev/null || echo "0")
|
||||
NOW_EPOCH=$(date +%s)
|
||||
DIFF=$((NOW_EPOCH - LAST_EPOCH))
|
||||
|
||||
if [ "$DIFF" -lt "$DEBOUNCE_SECONDS" ]; then
|
||||
# Still add to queue, but skip notification
|
||||
{
|
||||
echo "$(date +%Y-%m-%dT%H:%M:%S) | $MODIFIED_TYPE | $FILE_PATH | $DEPENDENT_DOCS"
|
||||
} >> "$QUEUE_FILE" 2>/dev/null || true
|
||||
exit 0
|
||||
fi
|
||||
if grep -qF "| $MODIFIED_TYPE | $FILE_PATH |" "$QUEUE_FILE" 2>/dev/null; then
|
||||
# Already queued, skip silently
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add to queue (create if doesn't exist, append if does)
|
||||
{
|
||||
echo "$(date +%Y-%m-%dT%H:%M:%S) | $MODIFIED_TYPE | $FILE_PATH | $DEPENDENT_DOCS"
|
||||
} >> "$QUEUE_FILE" 2>/dev/null || true
|
||||
# Add to queue
|
||||
echo "$QUEUE_ENTRY" >> "$QUEUE_FILE" 2>/dev/null || true
|
||||
|
||||
# Count pending updates
|
||||
PENDING_COUNT=$(wc -l < "$QUEUE_FILE" 2>/dev/null | tr -d ' ' || echo "1")
|
||||
|
||||
# Output passive notification (no action implied)
|
||||
# Uses "queued" instead of "update needed" to avoid triggering Claude to ask about it
|
||||
echo "[doc-guardian] drift queued: $MODIFIED_TYPE → $DEPENDENT_DOCS ($PENDING_COUNT total)"
|
||||
# SILENT by default - only output if DOC_GUARDIAN_VERBOSE is set
|
||||
# This prevents Claude from stopping to ask about documentation updates
|
||||
if [ "${DOC_GUARDIAN_VERBOSE:-0}" = "1" ]; then
|
||||
PENDING_COUNT=$(wc -l < "$QUEUE_FILE" 2>/dev/null | tr -d ' ' || echo "1")
|
||||
echo "[doc-guardian] queued: $MODIFIED_TYPE ($PENDING_COUNT pending)"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -17,6 +17,5 @@
|
||||
"performance",
|
||||
"multi-agent"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/gitea/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,5 @@
|
||||
"agile",
|
||||
"lessons-learned"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/gitea/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/projman/commands/clear-cache.md
Normal file
24
plugins/projman/commands/clear-cache.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# /clear-cache
|
||||
|
||||
Clear plugin cache to force fresh configuration reload. Run this after marketplace updates.
|
||||
|
||||
## When to Use
|
||||
|
||||
- After updating the marketplace (`git pull` or reinstall)
|
||||
- When MCP servers show stale configuration
|
||||
- When plugin changes don't take effect
|
||||
|
||||
## What It Does
|
||||
|
||||
1. Clears `~/.claude/plugins/cache/leo-claude-mktplace/`
|
||||
2. Forces Claude Code to re-read `.mcp.json` files on next session
|
||||
|
||||
## Instructions
|
||||
|
||||
Run this command, then **restart your Claude Code session** for changes to take effect.
|
||||
|
||||
```bash
|
||||
rm -rf ~/.claude/plugins/cache/leo-claude-mktplace/
|
||||
```
|
||||
|
||||
After clearing, inform the user: "Cache cleared. Restart Claude Code for changes to take effect."
|
||||
@@ -7,42 +7,6 @@ PREFIX="[projman]"
|
||||
|
||||
# Calculate paths
|
||||
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "$(realpath "$0")")")}"
|
||||
# Marketplace root is 2 levels up from plugin root (plugins/projman -> .)
|
||||
MARKETPLACE_ROOT="$(dirname "$(dirname "$PLUGIN_ROOT")")"
|
||||
VENV_REPAIR_SCRIPT="$MARKETPLACE_ROOT/scripts/venv-repair.sh"
|
||||
PLUGIN_CACHE="$HOME/.claude/plugins/cache/leo-claude-mktplace"
|
||||
|
||||
# ============================================================================
|
||||
# Clear stale plugin cache (MUST run before MCP servers load)
|
||||
# ============================================================================
|
||||
# The cache at ~/.claude/plugins/cache/ holds versioned .mcp.json files.
|
||||
# After marketplace updates, cached configs may point to old paths.
|
||||
# Clearing forces Claude to read fresh configs from installed marketplace.
|
||||
|
||||
if [[ -d "$PLUGIN_CACHE" ]]; then
|
||||
rm -rf "$PLUGIN_CACHE"
|
||||
# Don't output anything - this should be silent and automatic
|
||||
fi
|
||||
|
||||
# ============================================================================
|
||||
# Auto-repair MCP venvs (runs before other checks)
|
||||
# ============================================================================
|
||||
|
||||
if [[ -x "$VENV_REPAIR_SCRIPT" ]]; then
|
||||
# Run venv repair - this creates symlinks to cached venvs
|
||||
# Only outputs messages if something needed fixing
|
||||
"$VENV_REPAIR_SCRIPT" 2>/dev/null || {
|
||||
echo "$PREFIX MCP venv setup failed - run: cd $MARKETPLACE_ROOT && ./scripts/setup-venvs.sh"
|
||||
exit 0
|
||||
}
|
||||
else
|
||||
# Fallback: just check if venv exists
|
||||
VENV_PATH="$PLUGIN_ROOT/mcp-servers/gitea/.venv/bin/python"
|
||||
if [[ ! -f "$VENV_PATH" ]]; then
|
||||
echo "$PREFIX MCP venvs missing - run setup.sh from installed marketplace"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check git remote vs .env config (only if .env exists)
|
||||
if [[ -f ".env" ]]; then
|
||||
|
||||
@@ -20,6 +20,5 @@
|
||||
"visualization",
|
||||
"dmc"
|
||||
],
|
||||
"commands": ["./commands/"],
|
||||
"mcpServers": ["./.mcp.json"]
|
||||
"commands": ["./commands/"]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"viz-platform": {
|
||||
"type": "stdio",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/mcp-servers/viz-platform/run.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,10 @@
|
||||
#
|
||||
# This script:
|
||||
# 1. Clears Claude plugin cache (forces fresh .mcp.json reads)
|
||||
# 2. Restores MCP venv symlinks (instant if cache exists)
|
||||
# 3. Creates venvs in external cache if missing (first run only)
|
||||
# 4. Shows recent changelog updates
|
||||
# 2. Shows recent changelog updates
|
||||
#
|
||||
# NOTE: This script does NOT touch .venv directories.
|
||||
# If venvs are missing, run ./scripts/setup.sh manually.
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
@@ -22,13 +23,11 @@ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
check_changelog() {
|
||||
if [[ -f "$REPO_ROOT/CHANGELOG.md" ]]; then
|
||||
@@ -52,35 +51,21 @@ main() {
|
||||
|
||||
# Clear Claude plugin cache to force fresh .mcp.json reads
|
||||
# This cache holds versioned copies that become stale after updates
|
||||
# NOTE: This does NOT touch .venv directories
|
||||
if [[ -d "$CLAUDE_PLUGIN_CACHE" ]]; then
|
||||
log_info "Clearing Claude plugin cache..."
|
||||
rm -rf "$CLAUDE_PLUGIN_CACHE"
|
||||
log_success "Plugin cache cleared"
|
||||
fi
|
||||
|
||||
# Run venv-repair.sh to restore symlinks to external cache
|
||||
# This is instant if cache exists, or does full setup on first run
|
||||
if [[ -x "$SCRIPT_DIR/venv-repair.sh" ]]; then
|
||||
log_info "Restoring MCP venv symlinks..."
|
||||
if "$SCRIPT_DIR/venv-repair.sh"; then
|
||||
log_success "MCP venvs ready"
|
||||
else
|
||||
log_error "MCP venv setup failed"
|
||||
log_warn "Run: $SCRIPT_DIR/setup-venvs.sh for full setup"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log_error "venv-repair.sh not found at $SCRIPT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
check_changelog
|
||||
|
||||
echo ""
|
||||
log_success "Post-update complete!"
|
||||
echo ""
|
||||
echo "IMPORTANT: Restart Claude Code for changes to take effect."
|
||||
echo "MCP servers will work immediately on next session start."
|
||||
echo ""
|
||||
echo "If MCP servers are not working, run: ./scripts/setup.sh"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -158,9 +158,106 @@ for plugin_dir in "$PLUGINS_DIR"/*/; do
|
||||
echo "WARNING: Missing README.md in $plugin_name/"
|
||||
fi
|
||||
|
||||
# CRITICAL: Validate file references exist (mcpServers, hooks, commands)
|
||||
# This prevents broken references that silently break plugin loading
|
||||
|
||||
# Check mcpServers references
|
||||
mcp_servers=$(jq -r '.mcpServers // [] | .[]' "$plugin_json" 2>/dev/null)
|
||||
for mcp_ref in $mcp_servers; do
|
||||
mcp_path="$plugin_dir/$mcp_ref"
|
||||
if [[ ! -f "$mcp_path" ]]; then
|
||||
echo "ERROR: BROKEN REFERENCE in $plugin_name/plugin.json"
|
||||
echo " mcpServers references '$mcp_ref' but file does not exist at:"
|
||||
echo " $mcp_path"
|
||||
echo ""
|
||||
echo " FIX: Either create the file or remove the mcpServers entry"
|
||||
exit 1
|
||||
fi
|
||||
echo " ✓ mcpServers reference: $mcp_ref exists"
|
||||
done
|
||||
|
||||
# Check hooks references (can be array of file paths OR object with handlers)
|
||||
hooks_type=$(jq -r '.hooks | type' "$plugin_json" 2>/dev/null)
|
||||
if [[ "$hooks_type" == "array" ]]; then
|
||||
# Array format: ["./hooks/hooks.json"]
|
||||
hooks=$(jq -r '.hooks[]' "$plugin_json" 2>/dev/null)
|
||||
for hook_ref in $hooks; do
|
||||
hook_path="$plugin_dir/$hook_ref"
|
||||
if [[ ! -f "$hook_path" ]]; then
|
||||
echo "ERROR: BROKEN REFERENCE in $plugin_name/plugin.json"
|
||||
echo " hooks references '$hook_ref' but file does not exist at:"
|
||||
echo " $hook_path"
|
||||
echo ""
|
||||
echo " FIX: Either create the file or remove the hooks entry"
|
||||
exit 1
|
||||
fi
|
||||
echo " ✓ hooks reference: $hook_ref exists"
|
||||
done
|
||||
elif [[ "$hooks_type" == "object" ]]; then
|
||||
# Object format: { "PostToolUse": [...] } - inline hooks, no file reference to validate
|
||||
echo " ✓ hooks: inline object format (no file references)"
|
||||
fi
|
||||
|
||||
# Check commands directory references
|
||||
commands=$(jq -r '.commands // [] | .[]' "$plugin_json" 2>/dev/null)
|
||||
for cmd_ref in $commands; do
|
||||
cmd_path="$plugin_dir/$cmd_ref"
|
||||
if [[ ! -d "$cmd_path" ]] && [[ ! -f "$cmd_path" ]]; then
|
||||
echo "ERROR: BROKEN REFERENCE in $plugin_name/plugin.json"
|
||||
echo " commands references '$cmd_ref' but path does not exist at:"
|
||||
echo " $cmd_path"
|
||||
echo ""
|
||||
echo " FIX: Either create the path or remove the commands entry"
|
||||
exit 1
|
||||
fi
|
||||
echo " ✓ commands reference: $cmd_ref exists"
|
||||
done
|
||||
|
||||
echo "✓ $plugin_name valid"
|
||||
done
|
||||
|
||||
# CRITICAL: Validate marketplace.json file references
|
||||
echo ""
|
||||
echo "=== Validating Marketplace File References (CRITICAL) ==="
|
||||
|
||||
for i in $(seq 0 $((PLUGIN_COUNT - 1))); do
|
||||
PLUGIN_NAME=$(jq -r ".plugins[$i].name" "$MARKETPLACE_JSON")
|
||||
PLUGIN_SOURCE=$(jq -r ".plugins[$i].source" "$MARKETPLACE_JSON")
|
||||
PLUGIN_DIR="$ROOT_DIR/$PLUGIN_SOURCE"
|
||||
|
||||
# Check mcpServers in marketplace.json
|
||||
mcp_servers=$(jq -r ".plugins[$i].mcpServers // [] | .[]" "$MARKETPLACE_JSON" 2>/dev/null)
|
||||
for mcp_ref in $mcp_servers; do
|
||||
mcp_path="$PLUGIN_DIR/$mcp_ref"
|
||||
if [[ ! -f "$mcp_path" ]]; then
|
||||
echo "ERROR: BROKEN REFERENCE in marketplace.json for $PLUGIN_NAME"
|
||||
echo " mcpServers references '$mcp_ref' but file does not exist at:"
|
||||
echo " $mcp_path"
|
||||
echo ""
|
||||
echo " FIX: Either create the file or remove the mcpServers entry from marketplace.json"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ $PLUGIN_NAME: mcpServers reference $mcp_ref exists"
|
||||
done
|
||||
|
||||
# Check hooks in marketplace.json
|
||||
hooks=$(jq -r ".plugins[$i].hooks // [] | .[]" "$MARKETPLACE_JSON" 2>/dev/null)
|
||||
for hook_ref in $hooks; do
|
||||
hook_path="$PLUGIN_DIR/$hook_ref"
|
||||
if [[ ! -f "$hook_path" ]]; then
|
||||
echo "ERROR: BROKEN REFERENCE in marketplace.json for $PLUGIN_NAME"
|
||||
echo " hooks references '$hook_ref' but file does not exist at:"
|
||||
echo " $hook_path"
|
||||
echo ""
|
||||
echo " FIX: Either create the file or remove the hooks entry from marketplace.json"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ $PLUGIN_NAME: hooks reference $hook_ref exists"
|
||||
done
|
||||
done
|
||||
|
||||
echo "✓ All file references validated"
|
||||
|
||||
# v5.4.0: Validate agent model fields
|
||||
echo ""
|
||||
echo "=== Validating Agent Model Fields (v5.4.0+) ==="
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# venv-repair.sh - Fast MCP venv auto-repair for SessionStart hooks
|
||||
#
|
||||
# This script is designed to run at session start. It:
|
||||
# 1. Checks if venvs exist in external cache (~/.cache/claude-mcp-venvs/)
|
||||
# 2. Creates symlinks from marketplace to cache (instant operation)
|
||||
# 3. Only runs pip install if cache is missing (first install)
|
||||
#
|
||||
# Output format: All messages prefixed with [mcp-venv] for hook display
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/venv-repair.sh # Auto-repair (default)
|
||||
# ./scripts/venv-repair.sh --silent # Silent mode (no output unless error)
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ============================================================================
|
||||
# Configuration
|
||||
# ============================================================================
|
||||
|
||||
PREFIX="[mcp-venv]"
|
||||
VENV_CACHE_DIR="${HOME}/.cache/claude-mcp-venvs/leo-claude-mktplace"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# MCP servers
|
||||
MCP_SERVERS=(gitea netbox data-platform viz-platform contract-validator)
|
||||
|
||||
# Parse args
|
||||
SILENT=false
|
||||
[[ "${1:-}" == "--silent" ]] && SILENT=true
|
||||
|
||||
log() {
|
||||
[[ "$SILENT" == true ]] && return
|
||||
echo "$PREFIX $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo "$PREFIX ERROR: $1" >&2
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Check if all venvs exist in cache
|
||||
# ============================================================================
|
||||
|
||||
cache_complete() {
|
||||
for server in "${MCP_SERVERS[@]}"; do
|
||||
local venv_python="$VENV_CACHE_DIR/$server/.venv/bin/python"
|
||||
[[ ! -f "$venv_python" ]] && return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Create symlinks from marketplace to cache
|
||||
# ============================================================================
|
||||
|
||||
create_symlink() {
|
||||
local server_name="$1"
|
||||
local server_path="$REPO_ROOT/mcp-servers/$server_name"
|
||||
local venv_cache="$VENV_CACHE_DIR/$server_name/.venv"
|
||||
local venv_link="$server_path/.venv"
|
||||
|
||||
# Skip if server doesn't exist
|
||||
[[ ! -d "$server_path" ]] && return 0
|
||||
|
||||
# Skip if cache doesn't exist
|
||||
[[ ! -d "$venv_cache" ]] && return 1
|
||||
|
||||
# Already correct symlink?
|
||||
if [[ -L "$venv_link" ]]; then
|
||||
local target
|
||||
target=$(readlink "$venv_link")
|
||||
[[ "$target" == "$venv_cache" ]] && return 0
|
||||
rm "$venv_link"
|
||||
elif [[ -d "$venv_link" ]]; then
|
||||
# Old venv directory exists - back it up or remove
|
||||
rm -rf "$venv_link"
|
||||
fi
|
||||
|
||||
# Create symlink
|
||||
ln -s "$venv_cache" "$venv_link"
|
||||
return 0
|
||||
}
|
||||
|
||||
create_all_symlinks() {
|
||||
local created=0
|
||||
for server in "${MCP_SERVERS[@]}"; do
|
||||
if create_symlink "$server"; then
|
||||
((created++)) || true
|
||||
fi
|
||||
done
|
||||
[[ $created -gt 0 ]] && log "Restored $created venv symlinks"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Full setup (only if cache missing)
|
||||
# ============================================================================
|
||||
|
||||
setup_server() {
|
||||
local server_name="$1"
|
||||
local server_path="$REPO_ROOT/mcp-servers/$server_name"
|
||||
local venv_path="$VENV_CACHE_DIR/$server_name/.venv"
|
||||
|
||||
[[ ! -d "$server_path" ]] && return 0
|
||||
|
||||
mkdir -p "$VENV_CACHE_DIR/$server_name"
|
||||
|
||||
# Create venv
|
||||
if [[ ! -d "$venv_path" ]]; then
|
||||
python3 -m venv "$venv_path"
|
||||
fi
|
||||
|
||||
# Install dependencies
|
||||
# shellcheck disable=SC1091
|
||||
source "$venv_path/bin/activate"
|
||||
pip install -q --upgrade pip
|
||||
|
||||
if [[ -f "$server_path/requirements.txt" ]]; then
|
||||
pip install -q -r "$server_path/requirements.txt"
|
||||
fi
|
||||
|
||||
if [[ -f "$server_path/pyproject.toml" ]]; then
|
||||
pip install -q -e "$server_path"
|
||||
fi
|
||||
|
||||
deactivate
|
||||
|
||||
# Save hash for future quick checks
|
||||
local hash_file="$VENV_CACHE_DIR/$server_name/.requirements_hash"
|
||||
{
|
||||
if [[ -f "$server_path/requirements.txt" ]]; then
|
||||
cat "$server_path/requirements.txt"
|
||||
fi
|
||||
if [[ -f "$server_path/pyproject.toml" ]]; then
|
||||
cat "$server_path/pyproject.toml"
|
||||
fi
|
||||
echo "" # Ensure non-empty input for sha256sum
|
||||
} | sha256sum | cut -d' ' -f1 > "$hash_file"
|
||||
}
|
||||
|
||||
full_setup() {
|
||||
log "First run - setting up MCP venvs (this only happens once)..."
|
||||
for server in "${MCP_SERVERS[@]}"; do
|
||||
log " Setting up $server..."
|
||||
setup_server "$server"
|
||||
done
|
||||
log "Setup complete. Future sessions will be instant."
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Main
|
||||
# ============================================================================
|
||||
|
||||
main() {
|
||||
# Fast path: cache exists, just ensure symlinks
|
||||
if cache_complete; then
|
||||
create_all_symlinks
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Slow path: need to create venvs (first install)
|
||||
full_setup
|
||||
create_all_symlinks
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user