[PR #7668] fix: support plural directory names in command/agent name extraction #12472

Closed
opened 2026-02-16 18:17:22 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7668

State: closed
Merged: No


Summary

Fixes #7667

Commit b9ef09a0 added glob pattern support for plural directory names (commands/, agents/) but did not update the name extraction logic. This caused nested command/agent names to lose their prefix when using plural directory names.

Changes

  • Added plural patterns (/.opencode/commands/, /commands/, /.opencode/agents/, /agents/) to the name extraction logic in loadCommand and loadAgent functions
  • Added test cases to verify nested commands/agents in plural directories preserve their path prefix

Test Plan

  • All existing tests pass (44 tests in config.test.ts)
  • New test cases added for:
    • Nested commands in commands/ directory
    • Nested agents in agents/ directory

Example

When using OPENCODE_CONFIG_DIR with structure commands/email/digest.md:

  • Before: command name = digest (prefix lost)
  • After: command name = email/digest (prefix preserved)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7668 **State:** closed **Merged:** No --- ## Summary Fixes #7667 Commit b9ef09a0 added glob pattern support for plural directory names (`commands/`, `agents/`) but did not update the name extraction logic. This caused nested command/agent names to lose their prefix when using plural directory names. ## Changes - Added plural patterns (`/.opencode/commands/`, `/commands/`, `/.opencode/agents/`, `/agents/`) to the name extraction logic in `loadCommand` and `loadAgent` functions - Added test cases to verify nested commands/agents in plural directories preserve their path prefix ## Test Plan - [x] All existing tests pass (44 tests in config.test.ts) - [x] New test cases added for: - Nested commands in `commands/` directory - Nested agents in `agents/` directory ## Example When using `OPENCODE_CONFIG_DIR` with structure `commands/email/digest.md`: - Before: command name = `digest` (prefix lost) - After: command name = `email/digest` (prefix preserved)
yindo added the pull-request label 2026-02-16 18:17:22 -05:00
yindo closed this issue 2026-02-16 18:17:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12472