Skip to content

fix(path-utils): deduplicate subdirectory agent names#1428

Closed
ZvoneO wants to merge 1 commit intobmad-code-org:mainfrom
ZvoneO:fix/deduplicate-subdirectory-agent-names
Closed

fix(path-utils): deduplicate subdirectory agent names#1428
ZvoneO wants to merge 1 commit intobmad-code-org:mainfrom
ZvoneO:fix/deduplicate-subdirectory-agent-names

Conversation

@ZvoneO
Copy link
Copy Markdown

@ZvoneO ZvoneO commented Jan 27, 2026

Summary

Fixes #1422 - Redundant agent skill names for subdirectory agents

When agents live in subdirectories where the folder name matches the filename (e.g., tech-writer/tech-writer.md), the current toDashPath() function produces redundant names like bmad-bmm-tech-writer-tech-writer.agent.

Changes

  1. Deduplication fix - When the last two path segments are identical, collapse them to one
  2. YAML extension support - Handle .yaml files in addition to .md
  3. Comprehensive test suite - Added 40 unit tests for path-utils.js

Before/After

Path Before (Bug) After (Fixed)
bmm/agents/tech-writer/tech-writer.md bmad-bmm-tech-writer-tech-writer.agent.md bmad-bmm-tech-writer.agent.md
cis/agents/storyteller/storyteller.md bmad-cis-storyteller-storyteller.agent.md bmad-cis-storyteller.agent.md
bmm/agents/dev.md bmad-bmm-dev.agent.md bmad-bmm-dev.agent.md (unchanged)
bmm/agents/dev.yaml bmad-bmm-dev.yaml.agent.md bmad-bmm-dev.agent.md (fixed)

Edge Cases Handled

  • ✅ Flat files unchanged
  • ✅ Non-matching folder/file names preserved (e.g., create-prd/workflow.mdcreate-prd-workflow)
  • ✅ Deep nesting with match at end (e.g., a/b/writer/writer.mda-b-writer)
  • ✅ Case-sensitive comparison (different cases NOT deduplicated)
  • ✅ Windows path separators (backslashes)
  • ✅ Input validation (null, undefined, non-strings)

Test Plan

  • All 40 new unit tests pass (node test/test-path-utils.js)
  • Manual verification with installed BMAD modules
  • Verify skill names in Claude Code after installation

🤖 Generated with Claude Code

…1422)

Fixes redundant skill names for agents in subdirectories where the
folder name matches the filename (e.g., tech-writer/tech-writer.md).

Changes:
- Deduplicate when last two path segments are identical
- Handle .yaml extension in addition to .md
- Add comprehensive test suite (40 tests)

Before: bmad-bmm-tech-writer-tech-writer.agent
After:  bmad-bmm-tech-writer.agent

Closes bmad-code-org#1422

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Adds comprehensive unit tests for path-utils.js functions and modifies path-utils.js to handle .yaml file extensions and deduplicate agent skill names when folder and file names match, addressing issue #1422.

Changes

Cohort / File(s) Summary
Test Suite
test/test-path-utils.js
New unit test file with 368 lines covering toDashPath, toDashName, parseDashName, and isDashFormat functions. Tests include flat/nested paths, deduplication behavior, .yaml/.md extensions, case sensitivity, special characters, Windows paths, and edge cases. Uses simple test helpers and console-based reporting.
Path Utilities Enhancement
tools/cli/installers/lib/ide/shared/path-utils.js
Extended toDashPath to handle both .md and .yaml extensions. Added deduplication logic to collapse redundant folder-name occurrences (e.g., tech-writer/tech-writer becomes tech-writer), preventing duplicate naming in slash commands.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • alexeyv
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change—fixing redundant agent names through deduplication of subdirectory path segments.
Linked Issues check ✅ Passed The code changes fully satisfy issue #1422 requirements: deduplication of matching folder/filename pairs [#1422], YAML extension support [#1422], and comprehensive test coverage [#1422].
Out of Scope Changes check ✅ Passed All changes are within scope: path-utils.js modifications address the deduplication requirement, test-path-utils.js validates the fix, with no unrelated alterations.
Description check ✅ Passed The pull request description clearly describes the changeset: fixing redundant agent skill names through deduplication and adding YAML support, with comprehensive test coverage and concrete before/after examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ZvoneO
Copy link
Copy Markdown
Author

ZvoneO commented Jan 27, 2026

Tech writer successfully tested in Claude Code as /bmad-bmm-tech-writer.agent

@ZvoneO ZvoneO closed this Jan 31, 2026
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.

Redundant agent skill names for subdirectory agents (tech-writer-tech-writer, storyteller-storyteller)

1 participant