Skip to content

extraConfigPaths / extraSecretPaths relative paths resolve against CWD instead of configRoot #43

@doomsday616

Description

@doomsday616

Bug

Relative paths in extraConfigPaths and extraSecretPaths are resolved against the current working directory (process.cwd()) instead of the OpenCode config root (~/.config/opencode/). This means none of the extra paths actually get synced unless the user happens to launch OpenCode from the right directory.

Steps to reproduce

  1. Configure opencode-synced.jsonc with relative paths:
{
  "extraConfigPaths": [
    "skills/",
    "SOUL.md",
    "commands/"
  ]
}
  1. Run opencode_sync push from any directory

  2. Check the repo — the extra paths are missing. The extra-manifest.json shows incorrect source paths like /Users/username/skills instead of /Users/username/.config/opencode/skills.

Root cause

In dist/sync/paths.js, buildExtraPathPlan calls normalizePath on each entry:

const allowlist = (inputPaths ?? []).map((entry) => normalizePath(entry, locations.xdg.homeDir, platform));

normalizePath calls expandHome then path.resolve. For relative paths (no ~/ prefix), expandHome returns them unchanged, and path.resolve resolves them against process.cwd() — not against configRoot.

Expected behavior

Relative paths in extraConfigPaths/extraSecretPaths should resolve relative to the OpenCode config directory (e.g. ~/.config/opencode/), so that "skills/" maps to ~/.config/opencode/skills/.

Workaround

Use absolute paths with ~/ prefix:

{
  "extraConfigPaths": [
    "~/.config/opencode/skills/",
    "~/.config/opencode/SOUL.md",
    "~/.config/opencode/commands/"
  ]
}

Environment

  • opencode-synced: 0.9.0
  • OS: macOS 26.3 (arm64)
  • OpenCode: v1.2.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions