Skip to content

Conversation

@yanmxa
Copy link

@yanmxa yanmxa commented Jan 10, 2026

Summary

Fixes #7667

Commit b9ef09a 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)

Commit b9ef09a 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.

For example, when using OPENCODE_CONFIG_DIR pointing to a custom config
directory with structure `commands/email/digest.md`:
- Expected: email/digest
- Actual (before fix): digest

This fix adds plural patterns to the name extraction logic:
- For commands: adds "/.opencode/commands/" and "/commands/"
- For agents: adds "/.opencode/agents/" and "/agents/"

Also added test cases to verify nested commands/agents in plural
directories preserve their path prefix.

Ref: b9ef09a

Signed-off-by: Meng Yan <[email protected]>
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rekram1-node
Copy link
Collaborator

/review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Meng Yan <[email protected]>
@yanmxa yanmxa force-pushed the fix/plural-command-agent-patterns branch from 32ecd30 to 02f3308 Compare January 11, 2026 10:11
@yanmxa yanmxa requested a review from rekram1-node January 11, 2026 11:43
@yanmxa
Copy link
Author

yanmxa commented Jan 13, 2026

Closing this PR as the issue has been resolved by #8070.

Note: This PR was submitted two days earlier with proper issue linkage to #7667, but a maintainer chose to submit a parallel fix instead of collaborating on this PR. See my comment on #8070 for more details.

@yanmxa yanmxa closed this Jan 13, 2026
@rekram1-node
Copy link
Collaborator

yeah sorry, I didn't remember this one. Note that our issue and PR volume is getting insanely large so Im having a hard time keeping up and keeping track of all of these.

my bad

@yanmxa
Copy link
Author

yanmxa commented Jan 13, 2026

No worries @rekram1-node, totally understand! Managing a fast-growing project with high volume of issues and PRs is challenging work.

Thanks for the response and for all the effort you put into this project. Looking forward to contributing more in the future!

(Closing the related issue #7667 as well since it's been resolved.)

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.

fix: name extraction missing plural directory support (commands/, agents/)

2 participants