@scripting-bear/opencode-kit
v1.0.0
Published
Portable global opencode setup: vision + image-gen tools for a non-vision chat model, MCP roster, and interactive key setup.
Readme
opencode kit
Portable global opencode setup: one non-vision chat model (Nemotron) that can still see (vision via NVIDIA API), imagine (FLUX via Cloudflare), and drive devices/browsers/design/docs through MCP servers — in every project, on every machine.
What's inside
| Path | Purpose |
|------|---------|
| opencode.jsonc | Global config: model pin, provider whitelist, MCP servers (execbro, playwright, stitch, context7, discord-agent). Secrets referenced as {env:...} — never stored here. |
| tool/analyze_image.ts | Vision for the chat model — sends any image to an NVIDIA vision model, returns text. Auto-compresses to the API limit. |
| tool/generate_image.ts | Image generation — Cloudflare Workers AI FLUX.1 Schnell, Pollinations fallback. |
| lib/vision.ts | Shared NVIDIA vision client used by the tools. |
| skill/vision-handoff.md | Teaches the model when/how to use the tools (and to use execbro/playwright for screenshots instead of duplicating them). |
| agent/coder.md | Generic coder agent with the full tool roster. |
| setup.sh | Interactive setup: dependency install + paste keys + shell wiring + health checks. |
| secrets.env | Your keys (gitignored, chmod 600). Created by setup.sh. |
New machine (cross-system)
One-liner (npx):
npx @scripting-bear/opencode-kitThat downloads the published kit, copies it into ~/.config/opencode (asks before
overwriting; never touches secrets.env), installs tool dependencies, and drops you
into the interactive key setup. Flags: --yes (no overwrite prompt), --no-setup
(skip keys). New versions: bump version in package.json and npm publish from the
source checkout.
Or via git (keeps the machine syncable with git pull):
git clone <your-remote> ~/.config/opencode
~/.config/opencode/setup.sh # interactive: checks deps, prompts for keys
# open a new terminal, then:
opencode mcp list # every server should show ✓ connectedThat's the whole migration. Projects need no per-project setup; a project's own
opencode.json / .opencode/ merges on top of this if present.
Managing keys & customizations
- TUI/CLI:
~/.config/opencode/setup.sh— re-run any time; Enter keeps existing values, paste to replace. - Editor ("GUI"): edit
~/.config/opencode/secrets.envdirectly, then open a new terminal. - opencode's own TUI:
opencode auth loginfor chat-provider credentials (stored in~/.local/share/opencode/auth.json, separate from this repo);/modelsin the TUI to switch models. - Customizations: edit
opencode.jsonc(MCP servers, model),skill/,agent/,tool/— then commit & push; other machinesgit pull.
Keys used
| Env var | Used by | Where to get it |
|---------|---------|-----------------|
| NVIDIA_API_KEY | analyze_image (vision) | build.nvidia.com |
| STITCH_API_KEY | stitch MCP | stitch.withgoogle.com |
| CONTEXT7_API_KEY | context7 MCP | context7.com/dashboard |
| CLOUDFLARE_API_TOKEN | generate_image | Cloudflare dashboard → API tokens |
| CLOUDFLARE_ACCOUNT_ID | generate_image | Cloudflare dashboard / npx wrangler whoami |
Notes
secrets.envis sourced from your shell rc (setup.shadds the line), so keys reach both opencode's{env:...}config substitution and the custom tools'process.env.mcp.discord-agentpoints at a local build (machine-specific path) — fix the path or set"enabled": falseon machines without it.- Vision image compression uses macOS
sips; on Linux, swap it for ImageMagick inlib/vision.tsif you ever need it there.
