mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
refactor: unify skills install method across all platforms
Replace platform-specific install approaches with a consistent per-skill symlink pattern for OpenCode and Codex (both share ~/.agents/skills/), matching the OpenCode docs requirement of <name>/SKILL.md discovery. Changes: - OpenCode: migrate from opencode.json plugin config to direct skill symlinks in ~/.agents/skills/<name>/ - Codex: replace broken bundle symlink (understand-anything/ had no SKILL.md at root) with individual per-skill symlinks, matching OpenCode exactly - All platforms: add universal ~/.understand-anything-plugin symlink so understand-dashboard SKILL.md can reliably find packages/dashboard/ - All platforms: use idempotent [ -e ] || [ -L ] || ln -s guard to handle multi-platform installs on the same machine - All platforms: use ln -sf and rm -f for robust re-installs and partial uninstalls - understand-dashboard/SKILL.md: replace fragile dirname-based path resolution with a prioritized candidate loop with explicit error guard - Remove orphaned .opencode/plugins/understand-anything.js and its build scaffolding - Update all three README variants (en, zh-CN, ja-JP) to reflect new OpenCode AI-driven install method Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
d539fd45ba
commit
c8d92444e2
+53
-22
@@ -2,55 +2,86 @@
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [OpenCode.ai](https://opencode.ai) installed
|
||||
- Git
|
||||
- [OpenCode](https://opencode.ai) installed
|
||||
|
||||
## Installation
|
||||
|
||||
Add understand-anything to the `plugin` array in your `opencode.json` (global or project-level):
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://github.com/Lum1104/Understand-Anything.git ~/.opencode/understand-anything
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"plugin": ["understand-anything@git+https://github.com/Lum1104/Understand-Anything.git"]
|
||||
}
|
||||
```
|
||||
2. **Create the skills symlinks:**
|
||||
```bash
|
||||
mkdir -p ~/.agents/skills
|
||||
# Note: if Codex's Understand-Anything is already installed, these symlinks
|
||||
# already exist and the ln commands will safely fail — that is fine, the
|
||||
# existing symlinks work for OpenCode too.
|
||||
for skill in understand understand-chat understand-dashboard understand-diff understand-explain understand-onboard; do
|
||||
ln -sf ~/.opencode/understand-anything/understand-anything-plugin/skills/$skill ~/.agents/skills/$skill
|
||||
done
|
||||
# Universal plugin root symlink — lets the dashboard skill find packages/dashboard/
|
||||
# Skip if already exists (e.g. another platform was installed first)
|
||||
[ -e ~/.understand-anything-plugin ] || [ -L ~/.understand-anything-plugin ] || ln -s ~/.opencode/understand-anything/understand-anything-plugin ~/.understand-anything-plugin
|
||||
```
|
||||
|
||||
Restart OpenCode. The plugin auto-installs and registers all skills.
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.agents\skills"
|
||||
$skills = @("understand","understand-chat","understand-dashboard","understand-diff","understand-explain","understand-onboard")
|
||||
foreach ($skill in $skills) {
|
||||
cmd /c mklink /J "$env:USERPROFILE\.agents\skills\$skill" "$env:USERPROFILE\.opencode\understand-anything\understand-anything-plugin\skills\$skill"
|
||||
}
|
||||
# Universal plugin root symlink
|
||||
cmd /c mklink /J "$env:USERPROFILE\.understand-anything-plugin" "$env:USERPROFILE\.opencode\understand-anything\understand-anything-plugin"
|
||||
```
|
||||
|
||||
3. **Restart OpenCode** to discover the skills.
|
||||
|
||||
## Verify
|
||||
|
||||
Ask: "List available skills" — you should see understand, understand-chat, understand-dashboard, etc.
|
||||
```bash
|
||||
ls -la ~/.agents/skills/ | grep understand
|
||||
```
|
||||
|
||||
You should see symlinks for each skill pointing into the cloned repository.
|
||||
|
||||
## Usage
|
||||
|
||||
Skills activate automatically when relevant. You can also invoke directly:
|
||||
|
||||
```
|
||||
use skill tool to load understand-anything/understand
|
||||
use skill tool to load understand
|
||||
```
|
||||
|
||||
Or just ask: "Analyze this codebase and build a knowledge graph"
|
||||
|
||||
## Updating
|
||||
|
||||
Restart OpenCode — the plugin re-installs from git automatically.
|
||||
|
||||
To pin a specific version:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugin": ["understand-anything@git+https://github.com/Lum1104/Understand-Anything.git#v1.1.1"]
|
||||
}
|
||||
```bash
|
||||
cd ~/.opencode/understand-anything && git pull
|
||||
```
|
||||
|
||||
Skills update instantly through the symlinks.
|
||||
|
||||
## Uninstalling
|
||||
|
||||
Remove the plugin line from `opencode.json` and restart.
|
||||
```bash
|
||||
for skill in understand understand-chat understand-dashboard understand-diff understand-explain understand-onboard; do
|
||||
rm -f ~/.agents/skills/$skill
|
||||
done
|
||||
rm ~/.understand-anything-plugin
|
||||
rm -rf ~/.opencode/understand-anything
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Skills not found
|
||||
|
||||
1. Verify the plugin line in your `opencode.json`
|
||||
2. Check that `~/.cache/opencode/node_modules/understand-anything` exists after restart
|
||||
3. Use the `skill` tool to list discovered skills
|
||||
1. Check that the symlinks exist: `ls -la ~/.agents/skills/ | grep understand`
|
||||
2. Verify the clone succeeded: `ls ~/.opencode/understand-anything/understand-anything-plugin/skills/`
|
||||
3. Restart OpenCode
|
||||
|
||||
### Tool mapping
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Understand Anything plugin for OpenCode.ai
|
||||
*
|
||||
* Auto-registers the skills directory so OpenCode discovers all
|
||||
* understand-anything skills without manual symlinks or config edits.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export const UnderstandAnythingPlugin = async ({ client, directory }) => {
|
||||
const skillsDir = path.resolve(__dirname, '../../understand-anything-plugin/skills');
|
||||
|
||||
return {
|
||||
config: async (config) => {
|
||||
config.skills = config.skills || {};
|
||||
config.skills.paths = config.skills.paths || [];
|
||||
if (!config.skills.paths.includes(skillsDir)) {
|
||||
config.skills.paths.push(skillsDir);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user