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:
Lum1104
2026-03-23 16:41:29 +08:00
co-authored by Claude Sonnet 4.6
parent d539fd45ba
commit c8d92444e2
9 changed files with 123 additions and 79 deletions
+6 -1
View File
@@ -11,16 +11,20 @@
git clone https://github.com/Lum1104/Understand-Anything.git ~/.antigravity/understand-anything
```
2. **Create the skills symlink:**
2. **Create the skills symlinks:**
```bash
mkdir -p ~/.gemini/antigravity/skills
ln -s ~/.antigravity/understand-anything/understand-anything-plugin/skills ~/.gemini/antigravity/skills/understand-anything
# 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 ~/.antigravity/understand-anything/understand-anything-plugin ~/.understand-anything-plugin
```
**Windows (PowerShell):**
```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\antigravity\skills"
cmd /c mklink /J "$env:USERPROFILE\.gemini\antigravity\skills\understand-anything" "$env:USERPROFILE\.antigravity\understand-anything\understand-anything-plugin\skills"
cmd /c mklink /J "$env:USERPROFILE\.understand-anything-plugin" "$env:USERPROFILE\.antigravity\understand-anything\understand-anything-plugin"
```
3. **Restart the chat or IDE** so Antigravity can discover the skills.
@@ -52,5 +56,6 @@ Skills update instantly through the symlink.
```bash
rm ~/.gemini/antigravity/skills/understand-anything
rm ~/.understand-anything-plugin
rm -rf ~/.antigravity/understand-anything
```
+23 -7
View File
@@ -11,16 +11,29 @@
git clone https://github.com/Lum1104/Understand-Anything.git ~/.codex/understand-anything
```
2. **Create the skills symlink:**
2. **Create the skills symlinks:**
```bash
mkdir -p ~/.agents/skills
ln -s ~/.codex/understand-anything/understand-anything-plugin/skills ~/.agents/skills/understand-anything
# Note: if OpenCode'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 Codex too.
for skill in understand understand-chat understand-dashboard understand-diff understand-explain understand-onboard; do
ln -sf ~/.codex/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 ~/.codex/understand-anything/understand-anything-plugin ~/.understand-anything-plugin
```
**Windows (PowerShell):**
```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.agents\skills"
cmd /c mklink /J "$env:USERPROFILE\.agents\skills\understand-anything" "$env:USERPROFILE\.codex\understand-anything\understand-anything-plugin\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\.codex\understand-anything\understand-anything-plugin\skills\$skill"
}
# Universal plugin root symlink
cmd /c mklink /J "$env:USERPROFILE\.understand-anything-plugin" "$env:USERPROFILE\.codex\understand-anything\understand-anything-plugin"
```
3. **Restart Codex** to discover the skills.
@@ -28,10 +41,10 @@
## Verify
```bash
ls -la ~/.agents/skills/understand-anything
ls -la ~/.agents/skills/ | grep understand
```
You should see a symlink pointing to the skills directory.
You should see symlinks for each skill pointing into the cloned repository.
## Usage
@@ -45,11 +58,14 @@ Skills activate automatically when relevant. You can also invoke directly:
cd ~/.codex/understand-anything && git pull
```
Skills update instantly through the symlink.
Skills update instantly through the symlinks.
## Uninstalling
```bash
rm ~/.agents/skills/understand-anything
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 ~/.codex/understand-anything
```
+6 -1
View File
@@ -11,16 +11,20 @@
git clone https://github.com/Lum1104/Understand-Anything.git ~/.openclaw/understand-anything
```
2. **Create the skills symlink:**
2. **Create the skills symlinks:**
```bash
mkdir -p ~/.openclaw/skills
ln -s ~/.openclaw/understand-anything/understand-anything-plugin/skills ~/.openclaw/skills/understand-anything
# 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 ~/.openclaw/understand-anything/understand-anything-plugin ~/.understand-anything-plugin
```
**Windows (PowerShell):**
```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.openclaw\skills"
cmd /c mklink /J "$env:USERPROFILE\.openclaw\skills\understand-anything" "$env:USERPROFILE\.openclaw\understand-anything\understand-anything-plugin\skills"
cmd /c mklink /J "$env:USERPROFILE\.understand-anything-plugin" "$env:USERPROFILE\.openclaw\understand-anything\understand-anything-plugin"
```
3. **Restart OpenClaw** to discover the skills.
@@ -41,5 +45,6 @@ cd ~/.openclaw/understand-anything && git pull
```bash
rm ~/.openclaw/skills/understand-anything
rm ~/.understand-anything-plugin
rm -rf ~/.openclaw/understand-anything
```
+53 -22
View File
@@ -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
-25
View File
@@ -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);
}
},
};
};
+4 -6
View File
@@ -122,11 +122,9 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
### OpenCode
`opencode.json` に以下を追加
```json
{
"plugin": ["understand-anything@git+https://github.com/Lum1104/Understand-Anything.git"]
}
OpenCodeに以下を伝えてください
```
Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Understand-Anything/refs/heads/main/.opencode/INSTALL.md
```
### OpenClaw
@@ -153,7 +151,7 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
|----------|--------|----------------|
| Claude Code | ✅ ネイティブ | プラグインマーケットプレイス |
| Codex | ✅ サポート | AI駆動インストール |
| OpenCode | ✅ サポート | プラグイン設定 |
| OpenCode | ✅ サポート | AI駆動インストール |
| OpenClaw | ✅ サポート | AI駆動インストール |
| Cursor | ✅ サポート | 自動検出 |
| Antigravity | ✅ サポート | AI駆動インストール |
+4 -6
View File
@@ -122,11 +122,9 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
### OpenCode
Add to your `opencode.json`:
```json
{
"plugin": ["understand-anything@git+https://github.com/Lum1104/Understand-Anything.git"]
}
Tell OpenCode:
```
Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Understand-Anything/refs/heads/main/.opencode/INSTALL.md
```
### OpenClaw
@@ -153,7 +151,7 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
|----------|--------|----------------|
| Claude Code | ✅ Native | Plugin marketplace |
| Codex | ✅ Supported | AI-driven install |
| OpenCode | ✅ Supported | Plugin config |
| OpenCode | ✅ Supported | AI-driven install |
| OpenClaw | ✅ Supported | AI-driven install |
| Cursor | ✅ Supported | Auto-discovery |
| Antigravity | ✅ Supported | AI-driven install |
+4 -6
View File
@@ -121,11 +121,9 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
### OpenCode
添加到你的 `opencode.json` 文件:
```json
{
"plugin": ["understand-anything@git+https://github.com/Lum1104/Understand-Anything.git"]
}
告诉 OpenCode:
```
Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Understand-Anything/refs/heads/main/.opencode/INSTALL.md
```
### OpenClaw
@@ -152,7 +150,7 @@ Fetch and follow instructions from https://raw.githubusercontent.com/Lum1104/Und
|----------|--------|----------------|
| Claude Code | ✅ Native | 插件市场 |
| Codex | ✅ 支持 | AI驱动安装 |
| OpenCode | ✅ 支持 | 插件配置 |
| OpenCode | ✅ 支持 | AI驱动安装 |
| OpenClaw | ✅ 支持 | AI驱动安装 |
| Cursor | ✅ 支持 | 自动发现 |
| Antigravity | ✅ 支持 | AI驱动安装 |
@@ -19,13 +19,31 @@ Start the Understand Anything dashboard to visualize the knowledge graph for the
No knowledge graph found. Run /understand first to analyze this project.
```
3. Find the dashboard code. The dashboard is at `packages/dashboard/` relative to this plugin's root directory. Use the Bash tool to resolve the path:
3. Find the dashboard code. The dashboard is at `packages/dashboard/` relative to this plugin's root directory. Check these paths in order and use the first that exists:
- `~/.understand-anything-plugin/packages/dashboard/` (universal symlink, all installs)
- `${CLAUDE_PLUGIN_ROOT}/packages/dashboard/` (Claude Code plugin)
- Two levels up from this skill file's real path: `../../packages/dashboard/` (self-relative fallback)
Use the Bash tool to resolve:
```bash
PLUGIN_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
SKILL_REAL=$(realpath ~/.agents/skills/understand-dashboard 2>/dev/null || readlink -f ~/.agents/skills/understand-dashboard 2>/dev/null || echo "")
SELF_RELATIVE=$([ -n "$SKILL_REAL" ] && cd "$SKILL_REAL/../.." 2>/dev/null && pwd || echo "")
PLUGIN_ROOT=""
for candidate in \
"$HOME/.understand-anything-plugin" \
"${CLAUDE_PLUGIN_ROOT}" \
"$SELF_RELATIVE"; do
if [ -n "$candidate" ] && [ -d "$candidate/packages/dashboard" ]; then
PLUGIN_ROOT="$candidate"; break
fi
done
if [ -z "$PLUGIN_ROOT" ]; then
echo "Error: Cannot find the understand-anything plugin root. Make sure you followed the installation instructions and that ~/.understand-anything-plugin exists."
exit 1
fi
```
Or locate it by checking these paths in order:
- `${CLAUDE_PLUGIN_ROOT}/packages/dashboard/`
- The parent directory of this skill file, then `../../packages/dashboard/`
4. Install dependencies and build if needed:
```bash