Repository navigation
refactor(junie): extract and harden subagent name normalization - #3948
Merged
Merged
Conversation
Extract normalizeJunieName() with a JSDoc link to the upstream rule, trim surrounding whitespace before normalizing, and document why whitespace runs collapse to one hyphen. JunieSubagent now uses the normalized name as its import identity, so two files that Junie resolves to the same name are reported by the existing duplicate warning instead of both being imported. Closes #3946 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
An empty or whitespace-only name normalized to an empty string and became a shared import identity, so a second such file was dropped as a duplicate. Fall back to the file-derived name instead, document trimming, whitespace-run collapsing and the duplicate warning in file-formats.md, and tighten the collision tests (kept file, cross-root case, blank names). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Owner
Author
|
@dyoshikawa Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3946
Summary
normalizeJunieName()next tonameFromFileNameinsrc/features/subagents/junie-subagent.ts, with a JSDoc comment linking https://junie.jetbrains.com/docs/junie-cli-subagents.html." Code Reviewer "(or a file namedReviewer.md) becomescode-reviewerinstead of-code-reviewer-, which Junie's[a-z0-9][a-z0-9_-]*rule rejects./\s+/g) and explain why in the JSDoc: Junie's docs only say it "replaces spaces with hyphens"; one hyphen per run gives the name a user would expect (code-reviewer, notcode--reviewer) and still matches the pattern.JunieSubagentnow overridesgetImportIdentity()to return the normalized name (as Claude Code and Qoder already return theirname). The processor's existing import de-duplication then warnsDuplicate junie subagent "code-reviewer" ...when e.g.Code Reviewer.mdandcode-reviewer.mdboth exist, and keeps the earlier one instead of writing two rulesync subagents with the same name. Deletion is unaffected, since it does not go through that pass.Tests
normalizeJunieName: consecutive spaces, tabs and mixed whitespace, leading and trailing whitespace, and already-normalized names left unchanged.fromFile: padded frontmatter names and padded file names import ascode-reviewer.subagents-processor: two Junie files that normalize to the same name produce one subagent and a duplicate warning.pnpm cicheckpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4