feat(compression): composite-command splitter for RTK detection — roadmap #16 - #5283
Merged
Merged
Conversation
Introduces lastCommandSegment() — an O(n) char-by-char tokenizer that splits on top-level &&, ||, ; (never inside quotes/subshells) and returns the last significant segment. Tests cover all edge cases incl. ReDoS guard.
Apply the splitter at both seams in commandDetector.ts: 1. detectCommandFromText: split matched line before returning 2. detectCommandType: split the resolved command arg before matching Integration tests confirm 'cd /x && git status' now detects as git-status.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…dmap diegosouzapw#16 (diegosouzapw#5283) roadmap diegosouzapw#16: composite-command splitter for RTK detection (opt-in, fail-open). Integrated into release/v3.8.40.
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.
What
cd /x && git statusnow detects asgit-status. RTK command detection only matched the command prefix (cd), so any RTK filter/renderer missed commands wrapped incd … &&/||/;chains. Tier-3 item of the compression roadmap (#16).How
New
engines/rtk/splitCompositeCommand.ts→lastCommandSegment(command): a quote-aware, char-by-char tokenizer that splits on top-level&&/||/;only (never inside'…'/"…"/backtick or$(…)) and returns the last significant segment. Wired intocommandDetector.tsat both the tool-usecommandarg path and the text-sniffed path. O(n), no RegExp over the command (ReDoS-safe — a 20k-char pathological string completes <15ms).Tests (TDD, node:test)
splitCompositeCommand.test.ts(13:&&/||/;, quoted, subshell, no-sep, empty, ReDoS) + integration cases inrtk-command-detector.test.ts. Full compression suite green (146 RTK + 13 new).Gates (local)
lint 0 errors · typecheck:core clean · check:complexity 1972 (baseline 1981, improved) · cognitive-complexity green.