Skip to content

Commit 1b2f114

Browse files
mdedianaclaude
andauthored
fix(hooks): replace lib symlinks with real file copies (#82)
## Summary - Replace `lib` symlinks in all 4 editor plugin `hooks/prevent/` directories with real file copies - The relative symlink (`../../../shared/prevent/lib`) breaks when the plugin cache is rebuilt on `/clear` or `/reload-plugins` — the flat cache directory structure can't resolve it, causing `ModuleNotFoundError: No module named 'lib'` - `plugins/shared/prevent/lib/` remains as the canonical source; `bump-version.sh` now syncs it to all plugins at release time - Updated docs (CONTRIBUTING.md, architecture guide, cursor README) and codex install script to reflect the new approach Fixes: Zendesk #27286 ## Test plan - [ ] Install plugin fresh via marketplace — hooks should work - [ ] Run `/clear` — hooks should still work (no `ModuleNotFoundError`) - [ ] Run `/reload-plugins` — hooks should still work - [ ] Verify `bump-version.sh --dry-run` shows the new sync step - [ ] Verify codex `install.sh` still works with updated `SHARED_LIB` path 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 39c4dd6 commit 1b2f114

29 files changed

Lines changed: 3406 additions & 11 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ mc-agent-toolkit/
2020
│ └── remediation/
2121
2222
├── plugins/
23-
│ ├── shared/ # Platform-agnostic hook logic
24-
│ │ └── prevent/lib/ # Business logic (symlinked by editor plugins)
23+
│ ├── shared/ # Canonical hook logic (source of truth)
24+
│ │ └── prevent/lib/ # Business logic (copied into each editor plugin's hooks/prevent/lib/)
2525
│ │
2626
│ ├── claude-code/ # Unified mc-agent-toolkit plugin
2727
│ │ ├── .claude-plugin/plugin.json
@@ -50,7 +50,7 @@ mc-agent-toolkit/
5050
└── SECURITY.md
5151
```
5252

53-
Plugins reference skills via symlinks so that skills are authored once and shared across all editor plugins. Shared hook logic in `plugins/shared/<skill>/lib/` is also symlinked into editor-specific adapter directories.
53+
Plugins reference skills via symlinks so that skills are authored once and shared across all editor plugins. Shared hook logic lives in `plugins/shared/<skill>/lib/` as the canonical source and is **copied** (not symlinked) into each editor plugin's `hooks/<skill>/lib/` directory. The `bump-version.sh` script syncs these copies automatically at release time. If you edit shared hook logic, edit it in `plugins/shared/` and run `./scripts/bump-version.sh` to propagate.
5454

5555
## Adding a new skill
5656

@@ -192,7 +192,8 @@ Setup and agent-routing skills are exempt from this rule. Setup skills are invok
192192
- Include a clear description of what the skill/plugin does and when it should activate.
193193
- For new skills: include example prompts that should trigger the skill.
194194
- For bug fixes: describe the incorrect behavior and how to reproduce.
195-
- Ensure symlinks are relative and resolve correctly (CI will verify this).
195+
- Ensure skill symlinks are relative and resolve correctly (CI will verify this).
196+
- If you changed files in `plugins/shared/prevent/lib/`, run `./scripts/bump-version.sh` to sync copies to all editor plugins.
196197
- Run `git log --follow` on any moved files to confirm history is preserved.
197198

198199
## Version bumping

docs/plugin-architecture-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ mc-agent-toolkit/
9595
│ │ ├── .claude-plugin/plugin.json
9696
│ │ ├── .mcp.json
9797
│ │ ├── hooks/
98-
│ │ │ └── prevent/ # Thin adapters → plugins/shared/prevent/lib/
98+
│ │ │ └── prevent/ # Adapters + lib/ (copied from plugins/shared/prevent/lib/)
9999
│ │ ├── skills/ # One symlink per skill → ../../../skills/<name>
100100
│ │ └── commands/
101101
│ │ ├── prevent/

plugins/claude-code/hooks/prevent/lib

Lines changed: 0 additions & 1 deletion
This file was deleted.

plugins/claude-code/hooks/prevent/lib/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)