Skip to content

Conversation

@obra
Copy link
Owner

@obra obra commented Jan 23, 2026

Summary

Cherry-picks two bug fixes from dev to main:

These are standalone fixes that don't depend on the larger feature work (visual companion, document review system) still on dev.

Test plan

  • Verify OpenCode bootstrap injects correctly via system prompt transform
  • Verify Windows hooks execute without CRLF issues
  • Verify Claude Code 2.1.x auto-detects .sh files correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Skills now use OpenCode's native skill tool. Update existing workflows to use the native tool instead of custom commands.
  • Bug Fixes

    • Fixed agent reset behavior in OpenCode.
    • Improved Windows installation and execution.
  • Documentation

    • Updated installation guide with platform-specific instructions (macOS/Linux, Windows, WSL).
    • Updated skill discovery and usage documentation.
  • Chores

    • Repository configuration updates for consistent line endings.

✏️ Tip: You can customize this high-level summary in your review settings.

obra and others added 2 commits January 23, 2026 03:56
* 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>
* fix: convert shell scripts from CRLF to LF line endings

Add .gitattributes to enforce LF line endings for shell scripts,
preventing bash errors like "/usr/bin/bash: line 1: : command not found"
when scripts are checked out on Windows with CRLF.

Fixes #317 (SessionStart hook fails due to CRLF line endings)

Files converted:
- hooks/session-start.sh
- lib/brainstorm-server/start-server.sh
- lib/brainstorm-server/stop-server.sh
- lib/brainstorm-server/wait-for-feedback.sh
- skills/systematic-debugging/find-polluter.sh

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update Windows hook execution for Claude Code 2.1.x

Claude Code 2.1.x changed the Windows execution model: it now auto-detects
.sh files in hook commands and prepends "bash " automatically. This broke
the polyglot wrapper because:

  Before: "run-hook.cmd" session-start.sh  (wrapper executes)
  After:  bash "run-hook.cmd" session-start.sh  (bash can't run .cmd)

Changes:
- hooks.json now calls session-start.sh directly (Claude Code handles bash)
- Added deprecation comment to run-hook.cmd explaining the change
- Updated RELEASE-NOTES.md

Fixes #317, #313, #275, #292

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

This PR refactors the Superpowers plugin's bootstrap injection mechanism by replacing session-based prompt injection with an experimental.chat.system.transform hook, removes legacy skill-loading tools, simplifies bootstrap content generation, updates hooks to directly invoke shell scripts instead of wrapper scripts, and refreshes installation documentation and release notes to reflect these architectural changes.

Changes

Cohort / File(s) Summary
Build & Configuration
.gitattributes
Enforces LF line endings for shell scripts and text files (*.sh, *.cmd, *.md, *.json, *.js, *.mjs, .ts); marks image formats (.png, *.jpg, *.gif) as binary.
Plugin Implementation
.opencode/plugin/superpowers.js
Replaces session-based bootstrap injection with experimental.chat.system.transform hook; removes use_skill and find_skills tool definitions; simplifies bootstrap to extract frontmatter from SKILL.md and return static message block; removes event-driven injection and skill resolution logic.
Hook Execution
hooks/hooks.json, hooks/run-hook.cmd
Changes SessionStart hook command to directly invoke shell script instead of wrapper batch script; marks run-hook.cmd as deprecated with explanatory comments while preserving legacy execution for backward compatibility.
Documentation & Release Notes
RELEASE-NOTES.md, docs/README.opencode.md
Documents breaking changes requiring migration from custom tools to OpenCode's native skill tool; updates installation steps to add skills symlink for macOS/Linux/Windows; refreshes Usage, Architecture, and Troubleshooting sections to reflect new system.transform hook and centralized skills discovery via symlinks.

Sequence Diagram

sequenceDiagram
    participant User as User/Client
    participant ChatSys as Chat System
    participant Plugin as Superpowers Plugin
    participant Output as Output Handler

    User->>ChatSys: Initiate chat session
    ChatSys->>Plugin: Trigger experimental.chat.system.transform hook
    Plugin->>Plugin: Extract frontmatter from SKILL.md
    Plugin->>Plugin: Generate bootstrap message with<br/>tool mappings & skills location
    Plugin->>Output: Append bootstrap to output.system
    Output->>ChatSys: Return modified output with<br/>injected bootstrap content
    ChatSys->>User: Render enriched chat with<br/>skills context available
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Whiskers twitch with joy!
A bootstrap springs anew,
No more tools cluttering the path—
The system transform hook now flows,
Skills symlink'd in harmony,
Magic simplified, pure and clean! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main fixes in the PR: switching to OpenCode native skills and fixing Windows hook execution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

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.

2 participants