opencode
opencode copied to clipboard
fix: support plural directory names in command/agent name extraction
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 inloadCommandandloadAgentfunctions - 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
- Nested commands in
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)