Skip to content

fix(opencode): rename .opencode/command/ → .opencode/commands/ to match OpenCode's discovery convention#130

Open
fcmfcm01 wants to merge 1 commit into
DietrichGebert:mainfrom
fcmfcm01:fix/opencode-command-directory-name
Open

fix(opencode): rename .opencode/command/ → .opencode/commands/ to match OpenCode's discovery convention#130
fcmfcm01 wants to merge 1 commit into
DietrichGebert:mainfrom
fcmfcm01:fix/opencode-command-directory-name

Conversation

@fcmfcm01

Copy link
Copy Markdown

Problem

OpenCode auto-discovers custom commands from .opencode/commands/ (plural), per the official docs:

You can also define commands using markdown files. Place them in:

  • Global: ~/.config/opencode/commands/
  • Per-project: .opencode/commands/

Ponytail shipped them in .opencode/command/ (singular), so the slash commands (/ponytail, /ponytail-audit, /ponytail-review, /ponytail-debt, /ponytail-help) were never auto-loaded by OpenCode. The plugin's experimental.chat.system.transform hook correctly injected the ruleset and persisted /ponytail mode switches, but typing any of those commands in the TUI produced no completion and no execution — the entire string was passed through as a user message.

The README's claim that the plugin "adds the /ponytail commands" was effectively false for everyone except someone running OpenCode from inside this repo's checkout (and even then, only by accident of the plugin-relative path).

Fix

Rename the directory to match OpenCode's convention:

  • git mv .opencode/command .opencode/commands (rename detected by git, file history preserved at 100% similarity)
  • tests/commands.test.js: path assertion updated to .opencode/commands/
  • docs/agent-portability.md: OpenCode row updated to .opencode/commands/
  • README.md: add a paragraph in the OpenCode install section documenting how to use the commands globally across projects (symlink into ~/.config/opencode/commands/), since the plugin path only auto-discovers commands when running OpenCode from this repo's root

Verification

$ npm test
# tests 51
# pass 50
# fail 1   ← pre-existing: `csv: correct pandas one-liner passes`, unrelated (pandas not installed locally)

The 5 commands tests in tests/commands.test.js all pass after the path update. The single failure is a pre-existing CSV benchmark env issue (same # fail 1 on main without my changes).

Notes

  • The directory name was singular by ponytail's own convention (hooks/, skills/, command/ — all singular), but OpenCode's spec requires plural commands/. Aligning to the spec is the smaller change than asking OpenCode to accept both forms.
  • Cross-project global install is now a one-liner documented in README:
mkdir -p ~/.config/opencode/commands
ln -s "$PWD"/.opencode/commands/*.md ~/.config/opencode/commands/

Run once from the repo root; rerun if a new command is added; restart OpenCode.

…tch OpenCode's discovery convention

OpenCode auto-discovers commands from .opencode/commands/ (plural, per the official docs at https://opencode.ai/docs/commands), but ponytail shipped them in .opencode/command/ (singular), so the slash commands (/ponytail, /ponytail-audit, /ponytail-review, /ponytail-debt, /ponytail-help) were never auto-loaded. The plugin's system-prompt injection worked, but the README claim 'adds the /ponytail commands' was effectively false for everyone except someone running OpenCode from inside this repo's checkout with manual discovery.

Changes:
- git mv .opencode/command .opencode/commands (rename detected, history preserved)
- tests/commands.test.js: update path assertion to .opencode/commands/
- docs/agent-portability.md: update OpenCode row to .opencode/commands/
- README.md: add global install instructions (symlink into ~/.config/opencode/commands/) for cross-project use
Comment thread README.md

```bash
mkdir -p ~/.config/opencode/commands
ln -s "$PWD"/.opencode/commands/*.md ~/.config/opencode/commands/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

$PWD extends to where you run it, not to the root of the repository, it's easy to miss it even if it's written a few lines above. Instead, in the README we could write:

mkdir -p ~/.config/opencode/commands
ln -sf /path/to/ponytail/.opencode/commands/*.md ~/.config/opencode/commands/

I added the -f , because rerunning fails with "File exists" on existing symlinks

/cc @fcmfcm01

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

And thanks for the patch! it works in my install

Image

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