Skip to content

Conversation

@oribarilan
Copy link
Contributor

@oribarilan oribarilan commented Jan 19, 2026

Summary

  • Fix personal skills directory to respect OPENCODE_CONFIG_DIR environment variable

Fixes #298

Problem

The plugin hardcodes ~/.config/opencode/skills for personal skills lookup, ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Solution

  • Use process.env.OPENCODE_CONFIG_DIR if set, falling back to the default ~/.config/opencode path
  • Normalize the path: trim whitespace, expand ~, resolve to absolute
  • Update help text to show the actual configured path dynamically

Testing

Verified that personal skills are now discovered when using a custom OPENCODE_CONFIG_DIR.

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

Adds a normalizePath helper and makes the personal skills directory configurable via the OPENCODE_CONFIG_DIR environment variable (normalized), defaulting to ~/.config/opencode; personalSkillsDir is now ${configDir}/skills. Updates all path references and user messages to use the new configDir-based path.

Changes

Cohort / File(s) Summary
Configuration Path Customization
\.opencode/plugin/superpowers.js
Added normalizePath helper; introduced configDir from OPENCODE_CONFIG_DIR (normalized) with fallback ~/.config/opencode; replaced hard-coded ~/.config/opencode/skills with ${configDir}/skills in logic and user-facing messages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 I hop where configs softly gleam,
Paths no longer fixed, they dream.
OPENCODE gives me room to play,
My skills now live another way.
Hooray — Rabbit 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: making the personal skills directory respect the OPENCODE_CONFIG_DIR environment variable instead of using a hard-coded path.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.opencode/plugin/superpowers.js:
- Around line 22-24: Update the help text that currently hardcodes
"~/.config/opencode/skills" to use the configurable path variable instead:
reference personalSkillsDir (or configDir) when building the help string so it
reflects OPENCODE_CONFIG_DIR if set; locate the help output near the
personalSkillsDir definition in .opencode/plugin/superpowers.js and replace the
hardcoded path literal with a formatted string that inserts personalSkillsDir.
- Around line 22-24: The OPENCODE_CONFIG_DIR env var may be empty, relative or
contain '~', so normalize it before use: read process.env.OPENCODE_CONFIG_DIR,
trim it, if it starts with '~' replace that prefix with homeDir, then ensure
it's absolute with path.isAbsolute and path.resolve; if after normalization it's
falsy fall back to path.join(homeDir, '.config/opencode'); assign the result to
configDir and continue to derive personalSkillsDir from configDir (use the
existing configDir, personalSkillsDir, homeDir and path symbols).

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.
Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.
@patrickhaahr
Copy link

Works for me. I had my directory named "skill" (singular) which OpenCode initially supported, they support both now. After renaming to "skills" (plural), the PR loads both personal and superpowers skills correctly

@oribarilan
Copy link
Contributor Author

This is unrelated. Opencode supports changing their entire config dir path (eg instead of ~/.config/opencode). This PR adds support for that. I have been using this for the past few days and figured it makes sense to contribute it.

@obra obra merged commit a01a135 into obra:main Jan 19, 2026
1 check passed
@obra
Copy link
Owner

obra commented Jan 19, 2026

Thanks so much. Merged

binbinao added a commit to binbinao/superpowers that referenced this pull request Jan 21, 2026
fix: respect OPENCODE_CONFIG_DIR for personal skills lookup (obra#297)
LouisHors pushed a commit to LouisHors/horspowers that referenced this pull request Jan 22, 2026
* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.

* fix: update help text to use dynamic paths

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.

* fix: normalize OPENCODE_CONFIG_DIR before use

Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.
obra pushed a commit that referenced this pull request Jan 22, 2026
* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.

* fix: update help text to use dynamic paths

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.

* fix: normalize OPENCODE_CONFIG_DIR before use

Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.
obra added a commit that referenced this pull request Jan 22, 2026
* fix use_skill agent context (#290)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup (#297)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.

* fix: update help text to use dynamic paths

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.

* fix: normalize OPENCODE_CONFIG_DIR before use

Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.

* feat(opencode): use native skills and fix agent reset bug (#226)

- Replace custom use_skill/find_skills tools with OpenCode's native skill tool
- Use experimental.chat.system.transform hook instead of session.prompt
  (fixes #226 agent reset on first message)
- Symlink skills directory into ~/.config/opencode/skills/superpowers/
- Update installation docs with comprehensive Windows support:
  - Command Prompt, PowerShell, and Git Bash instructions
  - Proper symlink vs junction handling
  - Reinstall safety with cleanup steps
  - Verification commands for each shell

* Add OpenCode native skills changes to release notes

Documents:
- Breaking change: switch to native skill tool
- Fix for agent reset bug (#226)
- Fix for Windows installation (#232)

---------

Co-authored-by: Vinicius da Motta <viniciusmotta8@gmail.com>
Co-authored-by: oribi <oribarilan@gmail.com>
obra added a commit that referenced this pull request Jan 23, 2026
* fix use_skill agent context (#290)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup (#297)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.

* fix: update help text to use dynamic paths

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.

* fix: normalize OPENCODE_CONFIG_DIR before use

Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.

* feat(opencode): use native skills and fix agent reset bug (#226)

- Replace custom use_skill/find_skills tools with OpenCode's native skill tool
- Use experimental.chat.system.transform hook instead of session.prompt
  (fixes #226 agent reset on first message)
- Symlink skills directory into ~/.config/opencode/skills/superpowers/
- Update installation docs with comprehensive Windows support:
  - Command Prompt, PowerShell, and Git Bash instructions
  - Proper symlink vs junction handling
  - Reinstall safety with cleanup steps
  - Verification commands for each shell

* Add OpenCode native skills changes to release notes

Documents:
- Breaking change: switch to native skill tool
- Fix for agent reset bug (#226)
- Fix for Windows installation (#232)

---------

Co-authored-by: Vinicius da Motta <viniciusmotta8@gmail.com>
Co-authored-by: oribi <oribarilan@gmail.com>
obra added a commit that referenced this pull request Jan 25, 2026
* fix use_skill agent context (#290)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup (#297)

* fix: respect OPENCODE_CONFIG_DIR for personal skills lookup

The plugin was hardcoded to look for personal skills in ~/.config/opencode/skills,
ignoring users who set OPENCODE_CONFIG_DIR to a custom path (e.g., for dotfiles management).

Now uses OPENCODE_CONFIG_DIR if set, falling back to the default path.

* fix: update help text to use dynamic paths

Use configDir and personalSkillsDir variables in help text so paths
are accurate when OPENCODE_CONFIG_DIR is set.

* fix: normalize OPENCODE_CONFIG_DIR before use

Handle edge cases where the env var might be:
- Empty or whitespace-only
- Using ~ for home directory (common in .env files)
- A relative path

Now trims, expands ~, and resolves to absolute path.

* feat(opencode): use native skills and fix agent reset bug (#226)

- Replace custom use_skill/find_skills tools with OpenCode's native skill tool
- Use experimental.chat.system.transform hook instead of session.prompt
  (fixes #226 agent reset on first message)
- Symlink skills directory into ~/.config/opencode/skills/superpowers/
- Update installation docs with comprehensive Windows support:
  - Command Prompt, PowerShell, and Git Bash instructions
  - Proper symlink vs junction handling
  - Reinstall safety with cleanup steps
  - Verification commands for each shell

* Add OpenCode native skills changes to release notes

Documents:
- Breaking change: switch to native skill tool
- Fix for agent reset bug (#226)
- Fix for Windows installation (#232)

---------

Co-authored-by: Vinicius da Motta <viniciusmotta8@gmail.com>
Co-authored-by: oribi <oribarilan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Personal skills not discovered when using OPENCODE_CONFIG_DIR

3 participants