opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: support plural directory names in command/agent name extraction

Open yanmxa opened this issue 4 days ago • 2 comments

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)

yanmxa avatar Jan 10 '26 17:01 yanmxa