From 7b83f3ef74d660f6b4e88e778f09dc10afba194c Mon Sep 17 00:00:00 2001 From: Aviad Hadad Date: Mon, 16 Nov 2026 13:08:13 +0200 Subject: [PATCH 1/2] Move migration helper config root to ~/.tabnine/opencode/config Install and target paths for skills, agents, commands, opencode.json and AGENTS.md now use ~/.tabnine/opencode/config. Remove the OPENCODE_CONFIG_DIR caveats, which no longer apply. Co-Authored-By: Claude Sonnet 5.5 --- migration_helper/README.md | 26 +++++++++---------- migration_helper/install.sh | 8 +++--- .../skills/migrate-from-tabnine-cli/SKILL.md | 8 ++---- .../references/mapping.md | 6 ++--- .../references/verification-and-recovery.md | 2 +- .../skills/migrate-tabnine-context/SKILL.md | 10 +++---- 6 files changed, 25 insertions(+), 35 deletions(-) diff --git a/migration_helper/README.md b/migration_helper/README.md index 9919ee0..4782ede 100644 --- a/migration_helper/README.md +++ b/migration_helper/README.md @@ -49,7 +49,7 @@ cd tabnine-opencode-public/migration_helper ./install.sh ``` -By default this installs globally into `~/.config/opencode/`. To install into the current project instead: +By default this installs globally into `~/.tabnine/opencode/config/`. To install into the current project instead: ```bash ./install.sh --project @@ -70,9 +70,9 @@ Manual copy is a fully supported alternative. It is the recommended path on Wind For a global install on macOS or Linux: ```bash -mkdir -p ~/.config/opencode/skills ~/.config/opencode/commands -cp -r migration_helper/skills/migrate-from-tabnine-cli migration_helper/skills/migrate-tabnine-context ~/.config/opencode/skills/ -cp migration_helper/commands/migrate.md migration_helper/commands/migrate-context.md ~/.config/opencode/commands/ +mkdir -p ~/.tabnine/opencode/config/skills ~/.tabnine/opencode/config/commands +cp -r migration_helper/skills/migrate-from-tabnine-cli migration_helper/skills/migrate-tabnine-context ~/.tabnine/opencode/config/skills/ +cp migration_helper/commands/migrate.md migration_helper/commands/migrate-context.md ~/.tabnine/opencode/config/commands/ ``` For a project install on macOS or Linux: @@ -86,9 +86,9 @@ cp migration_helper/commands/migrate.md migration_helper/commands/migrate-contex For a global install on Windows (PowerShell): ```powershell -New-Item -ItemType Directory -Force "$env:USERPROFILE\.config\opencode\skills", "$env:USERPROFILE\.config\opencode\commands" | Out-Null -Copy-Item -Recurse migration_helper\skills\migrate-from-tabnine-cli, migration_helper\skills\migrate-tabnine-context "$env:USERPROFILE\.config\opencode\skills\" -Copy-Item migration_helper\commands\migrate.md, migration_helper\commands\migrate-context.md "$env:USERPROFILE\.config\opencode\commands\" +New-Item -ItemType Directory -Force "$env:USERPROFILE\.tabnine\opencode\config\skills", "$env:USERPROFILE\.tabnine\opencode\config\commands" | Out-Null +Copy-Item -Recurse migration_helper\skills\migrate-from-tabnine-cli, migration_helper\skills\migrate-tabnine-context "$env:USERPROFILE\.tabnine\opencode\config\skills\" +Copy-Item migration_helper\commands\migrate.md, migration_helper\commands\migrate-context.md "$env:USERPROFILE\.tabnine\opencode\config\commands\" ``` If any of the target files already exist, back them up first. The installer script does this automatically; the manual commands above do not. @@ -131,11 +131,11 @@ Context in a subdirectory is worth a moment's attention. Both tools read your gl Remove the paths the installer created: ```bash -rm -rf ~/.config/opencode/skills/migrate-from-tabnine-cli ~/.config/opencode/skills/migrate-tabnine-context -rm ~/.config/opencode/commands/migrate.md ~/.config/opencode/commands/migrate-context.md +rm -rf ~/.tabnine/opencode/config/skills/migrate-from-tabnine-cli ~/.tabnine/opencode/config/skills/migrate-tabnine-context +rm ~/.tabnine/opencode/config/commands/migrate.md ~/.tabnine/opencode/config/commands/migrate-context.md ``` -For a project install, replace `~/.config/opencode` with `.opencode`. Restart opencode after. +For a project install, replace `~/.tabnine/opencode/config` with `.opencode`. Restart opencode after. ## Troubleshooting @@ -157,11 +157,9 @@ If opencode fails to start after the migration with a `ConfigInvalidError`, one OPENCODE_DISABLE_PROJECT_CONFIG=1 opencode ``` -This does not bypass the global `~/.config/opencode/` config — for a global install, edit (or restore the timestamped backup of) the offending file directly, using the field-by-field rules in `skills/migrate-from-tabnine-cli/references/mapping.md` as a reference. +This does not bypass the global `~/.tabnine/opencode/config/` config — for a global install, edit (or restore the timestamped backup of) the offending file directly, using the field-by-field rules in `skills/migrate-from-tabnine-cli/references/mapping.md` as a reference. -A `duplicate skill name` warning (written to opencode's log, not shown in the UI) means two skills share the same `name` field under paths opencode scans (`~/.config/opencode/skills/`, `~/.claude/skills/`, `~/.agents/skills/`, the directory named by `OPENCODE_CONFIG_DIR` if it is set, and the equivalent workspace paths). opencode keeps the last copy it scans and silently shadows the other, so remove or rename one of them. The log line names both paths. - -If your launcher sets `OPENCODE_CONFIG_DIR`, as the Tabnine opencode wrapper does, that directory is read in addition to `~/.config/opencode` rather than instead of it. opencode loads skills, agents, and `opencode.json` from both. Installing into `~/.config/opencode` therefore works either way, but avoid installing the same item into both directories, since one copy will shadow the other. +A `duplicate skill name` warning (written to opencode's log, not shown in the UI) means two skills share the same `name` field under paths opencode scans (`~/.tabnine/opencode/config/skills/`, `~/.claude/skills/`, `~/.agents/skills/`, and the equivalent workspace paths). opencode keeps the last copy it scans and silently shadows the other, so remove or rename one of them. The log line names both paths. ## Reference documents diff --git a/migration_helper/install.sh b/migration_helper/install.sh index 1afa12f..a947370 100755 --- a/migration_helper/install.sh +++ b/migration_helper/install.sh @@ -4,7 +4,7 @@ # /migrate-context) into an opencode configuration directory. # # Usage: -# ./install.sh # install globally into ~/.config/opencode/ +# ./install.sh # install globally into ~/.tabnine/opencode/config/ # ./install.sh --project # install into ./.opencode/ in the current directory # ./install.sh --overwrite # skip diff prompts, overwrite existing files # ./install.sh --help # show usage @@ -34,7 +34,7 @@ Usage: Options: --project Install into ./.opencode/ (project scope) instead of - ~/.config/opencode/ (global scope, the default). + ~/.tabnine/opencode/config/ (global scope, the default). --overwrite Overwrite existing target files without prompting. --help, -h Show this message and exit. @@ -45,7 +45,7 @@ The installer copies: commands/migrate.md -> /commands/migrate.md commands/migrate-context.md -> /commands/migrate-context.md -Where is either ~/.config/opencode or ./.opencode. +Where is either ~/.tabnine/opencode/config or ./.opencode. You can also install manually. See the README for the copy commands. EOF @@ -93,7 +93,7 @@ fi # ----------------------------------------------------------------------------- if [[ "$TARGET_SCOPE" == "global" ]]; then - TARGET_DIR="$HOME/.config/opencode" + TARGET_DIR="$HOME/.tabnine/opencode/config" else TARGET_DIR="$PWD/.opencode" fi diff --git a/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md b/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md index 4abceb5..a92f101 100644 --- a/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md +++ b/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md @@ -63,9 +63,7 @@ Never list the built-in `tabnine-context` / `tabnine-coaching` servers as select Use the `question` tool. Order: -1. **Target scope for this session** — global (`~/.config/opencode/`) or project (`./.opencode/` in the current worktree). Ask once at the start of the session. If the user later says something like "put this one in the project instead", re-scope only that category and keep the session default for the rest. - - If `OPENCODE_CONFIG_DIR` is set, it does not redirect the global root — see Gotchas before choosing. +1. **Target scope for this session** — global (`~/.tabnine/opencode/config/`) or project (`./.opencode/` in the current worktree). Ask once at the start of the session. If the user later says something like "put this one in the project instead", re-scope only that category and keep the session default for the rest. 2. **MCP servers** — multi-select from the discovered list. Flag any name that already exists as `mcp.` in the target `opencode.json`. 3. **Skills** — multi-select. Flag any target-folder collision. @@ -83,7 +81,7 @@ Resolve every selected item to a concrete destination, print the plan, and stop: ``` Mode: plan (nothing written yet) -Target root: /Users/me/.config/opencode (OPENCODE_CONFIG_DIR is set elsewhere; not the target) +Target root: /Users/me/.tabnine/opencode/config MCP endpoints granted to your agent: github-mcp local npx -y @modelcontextprotocol/server-github @@ -206,8 +204,6 @@ After all writes succeed, run through this order — no step is skippable: Environment facts that defy reasonable assumptions. Read before Phase 1. -- **`OPENCODE_CONFIG_DIR` adds a config root, it does not move one.** The reported `config` root stays `~/.config/opencode`, and skills, agents, and `opencode.json` load from *both* it and the override (the Tabnine wrapper sets the override to `~/.tabnine/opencode/config`). Either is a valid target, but installing the same `name` into both shadows one silently. -- **`AGENTS.md` is the exception: it loads from the config root only.** So if the user targets the override root, their skills and agents work there but a global `AGENTS.md` written alongside them is never read — it belongs at `~/.config/opencode/AGENTS.md` regardless of target scope. Say so when the user picks the override root, since `/migrate-context` will not be able to follow their choice. - **opencode's MCP env key is `environment`.** An `env` key is accepted by the schema and then ignored, so the server starts with none of its variables and fails in a way that looks unrelated. - **MCP timeout defaults differ 120-fold.** Tabnine 600000 ms, opencode 5000 ms. - **Duplicate `name` is silent.** opencode logs `duplicate skill name` to the log only; the last copy scanned wins and the other never runs. diff --git a/migration_helper/skills/migrate-from-tabnine-cli/references/mapping.md b/migration_helper/skills/migrate-from-tabnine-cli/references/mapping.md index e39c9f5..ccbc766 100644 --- a/migration_helper/skills/migrate-from-tabnine-cli/references/mapping.md +++ b/migration_helper/skills/migrate-from-tabnine-cli/references/mapping.md @@ -110,7 +110,7 @@ Enablement (`~/.tabnine/agent/mcp-server-enablement.json`): { "playwright": { "enabled": false } } ``` -Target (`~/.config/opencode/opencode.json`): +Target (`~/.tabnine/opencode/config/opencode.json`): ```json { @@ -240,7 +240,7 @@ description: Manage Jira issues … You are a Jira and Confluence management specialist. … ``` -Target (`~/.config/opencode/agents/jira-issue-manager.md`), with the user picking `subagent` mode: +Target (`~/.tabnine/opencode/config/agents/jira-issue-manager.md`), with the user picking `subagent` mode: ```markdown --- @@ -276,7 +276,7 @@ Check @{README.md} for the runbook. """ ``` -Target (`~/.config/opencode/command/deploy.md`): +Target (`~/.tabnine/opencode/config/command/deploy.md`): ```markdown --- diff --git a/migration_helper/skills/migrate-from-tabnine-cli/references/verification-and-recovery.md b/migration_helper/skills/migrate-from-tabnine-cli/references/verification-and-recovery.md index 0813842..ed0aff0 100644 --- a/migration_helper/skills/migrate-from-tabnine-cli/references/verification-and-recovery.md +++ b/migration_helper/skills/migrate-from-tabnine-cli/references/verification-and-recovery.md @@ -6,7 +6,7 @@ Skip this entirely unless the user asks for it. These commands each start a fresh process and read config from disk, so they report the migrated state immediately — a restart is not needed for them to be accurate. The restart is needed for the user's own *running* session, which keeps the config it loaded at launch. So a green result here plus a still-broken session means "restart", not "migration failed". -Three commands settle whether opencode actually loaded the migration. Run them from the project directory, and export `OPENCODE_CONFIG_DIR` first if the user's launcher sets it, so you reproduce their real environment: +Three commands settle whether opencode actually loaded the migration. Run them from the project directory: ``` opencode debug paths # confirms which directory is the global config root diff --git a/migration_helper/skills/migrate-tabnine-context/SKILL.md b/migration_helper/skills/migrate-tabnine-context/SKILL.md index 206b5c0..39e5298 100644 --- a/migration_helper/skills/migrate-tabnine-context/SKILL.md +++ b/migration_helper/skills/migrate-tabnine-context/SKILL.md @@ -27,11 +27,7 @@ You are migrating the user's Tabnine CLI context/memory files into opencode's `A - **Downward**: `**/`, skipping `node_modules`, `.git`, `dist`, `build`, and other vendored or generated directories. Each file maps to a sibling `AGENTS.md` in its own directory. Ancestor and `` files migrate cleanly, since opencode loads them from the session directory upward. Files *below* the session directory do not — read "Subdirectory context loads differently" before planning those. - - **Global**: `~/.tabnine/agent/TABNINE.md`. Target: `~/.config/opencode/AGENTS.md`. Offer this only if it hasn't been migrated already — if the target exists and already contains the source content, report "already migrated" and skip. - - The global target is always `~/.config/opencode/AGENTS.md`, even when `OPENCODE_CONFIG_DIR` is set. opencode resolves the global instruction file from its config root only, so unlike skills and agents — which load from both directories — an `AGENTS.md` inside an `OPENCODE_CONFIG_DIR` such as `~/.tabnine/opencode/config` is never read. Never write one there. - - Check for that mistake while discovering. If `OPENCODE_CONFIG_DIR` is set and an `AGENTS.md` already exists inside it, report it as present but never loaded, and offer to move its content to `~/.config/opencode/AGENTS.md` — as a merge, through the normal plan and backup flow. It is the one case where this skill's source is an opencode file rather than a Tabnine one, so state plainly where the content came from and leave the original in place unless the user asks otherwise. + - **Global**: `~/.tabnine/agent/TABNINE.md`. Target: `~/.tabnine/opencode/config/AGENTS.md`. Offer this only if it hasn't been migrated already — if the target exists and already contains the source content, report "already migrated" and skip. 3. If a configured name is already `AGENTS.md`, opencode reads it natively — report it as "no migration needed" and skip. The sources this skill migrates are Tabnine CLI's context files: `TABNINE.md` by default, or whatever `context.fileName` specifies. Nothing else is in scope. @@ -55,7 +51,7 @@ After the user selects files, print the plan and stop for approval. One line per ``` Mode: plan (nothing written yet) create /Users/me/project/AGENTS.md (from TABNINE.md, 2.4 KB) - merge /Users/me/.config/opencode/AGENTS.md (append; backup .bak-20260823-181500) + merge /Users/me/.tabnine/opencode/config/AGENTS.md (append; backup .bak-20260823-181500) create /Users/me/project/packages/api/AGENTS.md (from packages/api/TABNINE.md) applies only to sessions started in packages/api skip /Users/me/project/docs/AGENTS.md (already contains this content) @@ -65,7 +61,7 @@ Nothing outside this list will be touched. Selecting files is not approval to write; only explicit plan approval is. If the user asks only for the plan, this is the whole deliverable — a dry run. -Once approved, for each selected source file the target is `AGENTS.md` in the same directory (project) or `~/.config/opencode/AGENTS.md` (global): +Once approved, for each selected source file the target is `AGENTS.md` in the same directory (project) or `~/.tabnine/opencode/config/AGENTS.md` (global): - **Target missing** → copy the content as-is. - **Target exists** → back it up, then merge or skip as the user chose. On merge, append to the existing `AGENTS.md`: From eabfc8b76a80d0d7f4208d4d37b710d0b8b8016a Mon Sep 17 00:00:00 2001 From: Aviad Hadad Date: Wed, 18 Nov 2026 10:55:14 +0200 Subject: [PATCH 2/2] Add config root gotchas to migrate-from-tabnine-cli skill Take the Gotchas bullets from PR #76: OPENCODE_CONFIG_DIR adds a root for skills, agents and opencode.json, and `tabnine debug paths` misreports the active config root. Co-Authored-By: Claude Sonnet 5.5 --- migration_helper/skills/migrate-from-tabnine-cli/SKILL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md b/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md index a92f101..f24f0a4 100644 --- a/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md +++ b/migration_helper/skills/migrate-from-tabnine-cli/SKILL.md @@ -204,6 +204,8 @@ After all writes succeed, run through this order — no step is skippable: Environment facts that defy reasonable assumptions. Read before Phase 1. +- **`OPENCODE_CONFIG_DIR` adds a config root for skills, agents and `opencode.json`.** They load from *both* `~/.config/opencode` and the override (the Tabnine wrapper sets the override to `~/.tabnine/opencode/config`). The global `AGENTS.md` does not work this way: it is read from the config root only, which under the launcher is the override. Installing the same `name` into both roots shadows one silently. +- **`tabnine debug paths` misreports the active config root.** It prints `config ~/.config/opencode` even when the launcher has redirected it, and disagrees with `tabnine debug config` on the same machine. Do not use it to decide where anything goes. - **opencode's MCP env key is `environment`.** An `env` key is accepted by the schema and then ignored, so the server starts with none of its variables and fails in a way that looks unrelated. - **MCP timeout defaults differ 120-fold.** Tabnine 600000 ms, opencode 5000 ms. - **Duplicate `name` is silent.** opencode logs `duplicate skill name` to the log only; the last copy scanned wins and the other never runs.