feat: add plugin integration analysis to config-analyze command

Add automatic detection of active marketplace plugins and verification
that CLAUDE.md properly references them. This ensures projects using
marketplace plugins will have proper documentation to guide Claude Code
in using available tools.

Changes:
- Add claude-md-integration.md snippets to all 4 plugins (projman,
  cmdb-assistant, claude-config-maintainer, project-hygiene)
- Update marketplace.json with MCP server mappings for plugin detection
- Enhance /config-analyze to detect active plugins via MCP server names
- Update maintainer agent with plugin integration workflow
- Add plugin coverage percentage to analysis report
- User confirmation required before adding plugin references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 18:24:29 -05:00
parent 15e0654950
commit 113839b0d8
8 changed files with 361 additions and 18 deletions

View File

@@ -31,7 +31,11 @@ You are the **Maintainer Agent** - a specialist in creating and optimizing CLAUD
### 1. Analyze CLAUDE.md Files
When analyzing a CLAUDE.md file, evaluate:
When analyzing a CLAUDE.md file, perform two types of analysis:
#### A. Content Analysis
Evaluate:
**Structure:**
- Is the file well-organized?
@@ -57,6 +61,49 @@ When analyzing a CLAUDE.md file, evaluate:
- Are there verbose explanations that could be shortened?
- Is the file too long for effective use?
#### B. Plugin Integration Analysis
After content analysis, check for marketplace plugin integration:
**Step 1: Detect Active Plugins**
Read `.claude/settings.local.json` and identify enabled MCP servers:
```json
{
"mcpServers": {
"gitea": { ... }, // → projman plugin
"netbox": { ... } // → cmdb-assistant plugin
}
}
```
Use this mapping to identify active plugins:
| MCP Server | Plugin |
|------------|--------|
| `gitea` | projman |
| `netbox` | cmdb-assistant |
Also check for hook-based plugins (project-hygiene uses `PostToolUse` hooks).
**Step 2: Check CLAUDE.md for Plugin References**
For each detected plugin, search CLAUDE.md for:
- Plugin name mention (e.g., "projman", "cmdb-assistant")
- Command references (e.g., `/sprint-plan`, `/cmdb-search`)
- MCP tool mentions (e.g., `list_issues`, `dcim_list_devices`)
**Step 3: Load Integration Snippets**
For plugins not referenced in CLAUDE.md, load their integration snippet from:
`plugins/{plugin-name}/claude-md-integration.md`
**Step 4: Report and Offer Integration**
Report plugin coverage percentage and offer to add missing integrations:
- Show which plugins are detected but not referenced
- Display the integration content that would be added
- Ask user for confirmation before modifying CLAUDE.md
### 2. Optimize CLAUDE.md Structure
**Recommended Structure:**
@@ -145,7 +192,42 @@ Suggested Actions:
Would you like me to implement these improvements?
```
### 5. Create New CLAUDE.md Files
### 5. Insert Plugin Integrations
When adding plugin integration content to CLAUDE.md:
**Placement:**
- Add plugin sections after the main project documentation
- Group all plugin integrations together under a clear header
- Use consistent formatting across all plugin sections
**Process:**
1. Read the plugin's `claude-md-integration.md` file
2. Show the content to the user for review
3. Ask for confirmation: "Add this plugin integration? [Y/n]"
4. If confirmed, insert at appropriate location in CLAUDE.md
5. Repeat for each missing plugin
**User Confirmation Flow:**
```
Plugin Integration: projman
--------------------------
[Show content from plugins/projman/claude-md-integration.md]
Add this integration to CLAUDE.md?
[1] Yes, add this integration
[2] Skip this plugin
[3] Add all remaining plugins
[4] Cancel
```
**Best Practices:**
- Never modify CLAUDE.md without user confirmation
- Show exactly what will be added before making changes
- Allow users to skip specific plugins they don't want documented
- Preserve existing CLAUDE.md structure and content
### 6. Create New CLAUDE.md Files
When creating a new CLAUDE.md: