Commit a83f6df
fix: Copy plugin directories to package root for Claude Code discovery in UVX (#2214)
* fix: Copy plugin directories to package root for Claude Code discovery in UVX
Fixes plugin discovery when amplihack is installed via uvx from GitHub.
Root cause: Claude Code expects commands/, skills/, agents/ at plugin root,
but build process nested them inside .claude/ subdirectory.
Changes:
- Added pkg_root variable to simplify path definitions in __init__
- Extracted _get_ignore_patterns() for DRY ignore pattern handling
- Refactored directory copy methods to use new _copy_plugin_directory() helper
- Added _copy_plugin_discoverable_directories() to copy commands/skills/agents to root
- Added _cleanup_plugin_discoverable_directories() with git-aware cleanup
- Added _is_tracked_by_git() helper with path traversal protection
- Updated build_wheel() to copy discoverable directories before build
- Updated cleanup in finally block to remove temporary directories
- Simplified .github/ copy to use consolidated patterns
Impact:
- Plugin discovery now works when installed via uvx from GitHub
- Commands like /ultrathink, /fix available in UVX installations
- Skills and agents properly registered in Claude Code
- Backward compatible with local installations
Testing: Build verification completed, full UVX test in Step 19
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
* fix: Add path validation and update documentation per review feedback
Addresses review feedback from PR #2214:
- Added path validation to _copy_plugin_directory() for defense-in-depth security
- Updated build process diagram to show all 12 operations (6 copy + 6 cleanup)
Security improvement:
- Validates source paths are within repo root
- Validates dest paths are within src/amplihack/
- Prevents path traversal before copying
Documentation improvement:
- Diagram now shows _copy_plugin_discoverable_directories() step
- Complete picture of build hook workflow
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
* fix: Add commands/skills/agents to package-data for wheel inclusion
CRITICAL: build_hooks.py copies directories but setuptools wasn't including
them in wheel due to missing package-data declarations.
Root cause discovered in Step 19 testing:
- commands/ existed (pre-existing uvx_helper.py file kept it)
- skills/ and agents/ were copied then cleaned up, never in wheel
- setuptools only includes files declared in package-data
Changes:
- Added commands/**/* to package-data
- Added skills/**/* to package-data
- Added agents/**/* to package-data
This ensures all plugin-discoverable directories are in the final wheel.
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
* fix: Always use --plugin-dir for plugin discovery (remove conditional logic)
Simplifies plugin discovery by always passing --plugin-dir ~/.amplihack/.claude
instead of conditionally trying to use Claude Code's plugin installation.
Changes:
- Removed AMPLIHACK_PLUGIN_INSTALLED environment variable check
- Always pass --plugin-dir argument to Claude Code
- Removed complex conditional logic about plugin installation methods
- Simplified add_plugin_args_for_uvx() function
This ensures Claude Code always discovers plugins from ~/.amplihack/.claude
regardless of how they were installed.
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
* fix: Create symlinks at repo root and remove invalid path field from marketplace.json
The real fix for marketplace plugin discovery:
1. Removed invalid "path": ".claude" from marketplace.json
- This field is not supported for GitHub sources per Claude Code docs
- Claude Code expects plugin content at repository root
2. Created symlinks at repository root:
- commands -> .claude/commands
- skills -> .claude/skills
- agents -> .claude/agents
This enables Claude Code marketplace installations to discover plugin content
that lives in the .claude/ subdirectory, without duplicating files.
When cloned from GitHub via marketplace, Claude Code now finds:
- /commands/ (symlink to .claude/commands/)
- /skills/ (symlink to .claude/skills/)
- /agents/ (symlink to .claude/agents/)
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
* docs: Add outside-in TUI test scenario and comprehensive test results
Added gadugi-agentic-test TUI test scenario for plugin discovery verification.
Framework currently simulates execution but validates YAML structure.
Test results document comprehensive manual verification:
- Plugin installation from GitHub
- Staging to ~/.amplihack/.claude
- --plugin-dir argument passing
- Agent discovery confirmation
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <claude@anthropic.com>
Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>1 parent 59d4205 commit a83f6df
File tree
11 files changed
+778
-122
lines changed- .claude/tests/agentic
- docs
- build_system
- src/amplihack
11 files changed
+778
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments