Switch OpenCode install from plugin to git clone + symlink

The opencode.json plugin mechanism was unverified and likely non-functional.
Replace with reliable git clone + symlink approach, and remove unused plugin JS.

Power by MiniMax
This commit is contained in:
akai
2026-03-17 18:43:30 +08:00
parent 1706804893
commit 76bd138fa4
4 changed files with 50 additions and 121 deletions

View File

@@ -6,15 +6,29 @@
## Installation ## Installation
Add minimax-skills to the `plugin` array in your `opencode.json` (global or project-level): ### macOS / Linux
```json ```bash
{ git clone https://github.com/MiniMax-AI/skills.git ~/.minimax-skills
"plugin": ["minimax-skills@git+https://github.com/MiniMax-AI/skills.git"]
mkdir -p ~/.config/opencode/skills
ln -s ~/.minimax-skills/skills/* ~/.config/opencode/skills/
```
### Windows (PowerShell)
```powershell
git clone https://github.com/MiniMax-AI/skills.git "$env:USERPROFILE\.minimax-skills"
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\skills"
Get-ChildItem "$env:USERPROFILE\.minimax-skills\skills" -Directory | ForEach-Object {
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.config\opencode\skills\$($_.Name)" -Target $_.FullName
} }
``` ```
Restart OpenCode. That's it — the plugin auto-installs and registers all skills. > **Note:** Creating symbolic links on Windows may require administrator privileges or Developer Mode enabled.
Restart OpenCode to discover the skills.
Verify by asking: "List available skills" Verify by asking: "List available skills"
@@ -26,47 +40,37 @@ Verify by asking: "List available skills"
- **ios-application-dev** — iOS application development with UIKit, SnapKit, and SwiftUI - **ios-application-dev** — iOS application development with UIKit, SnapKit, and SwiftUI
- **shader-dev** — GLSL shader techniques for stunning visual effects (ShaderToy-compatible) - **shader-dev** — GLSL shader techniques for stunning visual effects (ShaderToy-compatible)
## Usage
Use OpenCode's native `skill` tool:
```
use skill tool to list skills
use skill tool to load minimax-skills/frontend-dev
```
## Updating ## Updating
MiniMax Skills updates automatically when you restart OpenCode. ```bash
cd ~/.minimax-skills && git pull
```
To pin a specific version: Symlinks will automatically point to the updated content — no need to re-link.
```json ## Uninstalling
{
"plugin": ["minimax-skills@git+https://github.com/MiniMax-AI/skills.git#v1.0.0"] ### macOS / Linux
}
```bash
rm -rf ~/.config/opencode/skills
rm -rf ~/.minimax-skills
```
### Windows (PowerShell)
```powershell
Remove-Item -Recurse -Force "$env:USERPROFILE\.config\opencode\skills"
Remove-Item -Recurse -Force "$env:USERPROFILE\.minimax-skills"
``` ```
## Troubleshooting ## Troubleshooting
### Plugin not loading
1. Check logs: `opencode run --print-logs "hello" 2>&1 | grep -i minimax`
2. Verify the plugin line in your `opencode.json`
3. Make sure you're running a recent version of OpenCode
### Skills not found ### Skills not found
1. Use `skill` tool to list what's discovered 1. Verify symlinks exist: `ls -la ~/.config/opencode/skills/`
2. Check that the plugin is loading (see above) 2. Each skill folder should contain a `SKILL.md` file
3. Restart OpenCode after installation
### Tool mapping
When skills reference Claude Code tools:
- `TodoWrite``todowrite`
- `Task` with subagents → `@mention` syntax
- `Skill` tool → OpenCode's native `skill` tool
- File operations → your native tools
## Getting Help ## Getting Help

View File

@@ -1,73 +0,0 @@
/**
* MiniMax Skills plugin for OpenCode.ai
*
* Registers the skills directory and injects bootstrap context via system prompt transform.
*/
import path from 'path';
import fs from 'fs';
import os from 'os';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const MiniMaxSkillsPlugin = async () => {
const homeDir = os.homedir();
const skillsDir = path.resolve(__dirname, '../../skills');
const envConfigDir = process.env.OPENCODE_CONFIG_DIR
? path.resolve(process.env.OPENCODE_CONFIG_DIR.replace(/^~/, homeDir))
: null;
const configDir = envConfigDir || path.join(homeDir, '.config/opencode');
// Discover available skills by scanning the skills directory
const getAvailableSkills = () => {
if (!fs.existsSync(skillsDir)) return [];
return fs.readdirSync(skillsDir, { withFileTypes: true })
.filter(d => d.isDirectory() && fs.existsSync(path.join(skillsDir, d.name, 'SKILL.md')))
.map(d => d.name);
};
const getBootstrapContent = () => {
const skills = getAvailableSkills();
if (skills.length === 0) return null;
const skillList = skills.map(s => `- \`${s}\``).join('\n');
return `<IMPORTANT>
You have MiniMax Skills available.
**Available skills:**
${skillList}
**Tool Mapping for OpenCode:**
When skills reference tools you don't have, substitute OpenCode equivalents:
- \`TodoWrite\`\`todowrite\`
- \`Task\` tool with subagents → Use OpenCode's subagent system (@mention)
- \`Skill\` tool → OpenCode's native \`skill\` tool
- \`Read\`, \`Write\`, \`Edit\`, \`Bash\` → Your native tools
**Skills location:**
MiniMax skills are in \`${configDir}/skills/minimax-skills/\`
Use OpenCode's native \`skill\` tool to list and load skills.
</IMPORTANT>`;
};
return {
// Inject skills path into live config so OpenCode discovers skills
config: async (config) => {
config.skills = config.skills || {};
config.skills.paths = config.skills.paths || [];
if (!config.skills.paths.includes(skillsDir)) {
config.skills.paths.push(skillsDir);
}
},
// Use system prompt transform to inject bootstrap
'experimental.chat.system.transform': async (_input, output) => {
const bootstrap = getBootstrapContent();
if (bootstrap) {
(output.system ||= []).push(bootstrap);
}
}
};
};

View File

@@ -46,15 +46,14 @@ Restart Codex to discover the skills. See [`.codex/INSTALL.md`](.codex/INSTALL.m
### OpenCode ### OpenCode
Add to your `opencode.json`: ```bash
git clone https://github.com/MiniMax-AI/skills.git ~/.minimax-skills
```json mkdir -p ~/.config/opencode/skills
{ ln -s ~/.minimax-skills/skills/* ~/.config/opencode/skills/
"plugin": ["minimax-skills@git+https://github.com/MiniMax-AI/skills.git"]
}
``` ```
Restart OpenCode. See [`.opencode/INSTALL.md`](.opencode/INSTALL.md) for details. Restart OpenCode to discover the skills. See [`.opencode/INSTALL.md`](.opencode/INSTALL.md) for details.
## License ## License

View File

@@ -46,15 +46,14 @@ ln -s ~/.codex/minimax-skills/skills ~/.agents/skills/minimax-skills
### OpenCode ### OpenCode
`opencode.json` 中添加: ```bash
git clone https://github.com/MiniMax-AI/skills.git ~/.minimax-skills
```json mkdir -p ~/.config/opencode/skills
{ ln -s ~/.minimax-skills/skills/* ~/.config/opencode/skills/
"plugin": ["minimax-skills@git+https://github.com/MiniMax-AI/skills.git"]
}
``` ```
重启 OpenCode。详见 [`.opencode/INSTALL.md`](.opencode/INSTALL.md)。 重启 OpenCode 以发现技能。详见 [`.opencode/INSTALL.md`](.opencode/INSTALL.md)。
## 许可证 ## 许可证