Recognize the function-returned slash command list of Claude Code 2.1.227+ - #953
Merged
bl-ue merged 1 commit intoAug 17, 2026
Merged
Conversation
….227+ Claude Code moved the built-in slash command list out of an arrow-returned array into a named function body, so the `=>[` scan in findSlashCommandListEndPosition found no candidate at all and every patch that registers a command failed with "failed to find arrayStartPattern". Accept `return[` alongside `=>[`. The >= 30 item count and the name/description anchor still select a single candidate: on the 2.1.195, 2.1.204, 2.1.214 and 2.1.219 bundles the new scan returns the exact same closing bracket as before, and on 2.1.233 it finds the 130-item list.
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. 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. Comment |
bl-ue
enabled auto-merge (squash)
August 17, 2026 17:50
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.
Addresses the clear-screen half of #942.
Problem
Every patch that registers a slash command —
clear-screen,conversation-title,toolsets— fails on recent Claude Code releases:findSlashCommandListEndPositiononly scanned=>[candidates. Claude Code moved the built-in command list out of an arrow-returned array and into the body of a named function (which abuiltinCommandTablecache then memoizes), so there is no arrow-return candidate left to find. On 2.1.233 the list reads:Per #942 the failure starts with Claude Code 2.1.227; I verified the new shape on 2.1.233.
Fix
Accept
return[alongside=>[as a candidate opener. Everything downstream is unchanged: the candidate still has to sit within 12k characters ofname:"…" … description:and still has to contain at least 30 top-level items.Verification
Ran the old and the new scan over every extracted bundle I have (2.1.88, 2.1.89, 2.1.92, 2.1.98, 2.1.113, 2.1.126, 2.1.144, 2.1.183, 2.1.195, 2.1.201, 2.1.204, 2.1.214, 2.1.219, 2.1.233):
null; the new one finds the 130-item list.Applied to a real 2.1.233 native binary:
clear-screenand a local command-registering patch both apply, and the resulting binary runs (2.1.233 (Claude Code)) with the new commands resolving.New
src/patches/slashCommands.test.tscovers both shapes, the small-array and no-anchor rejections, largest-candidate selection, and insertion throughwriteSlashCommandDefinition. Full suite,tsc, ESLint and Prettier are clean.