Skip to content

feat(compression): composite-command splitter for RTK detection — roadmap #16 - #5283

Merged
diegosouzapw merged 3 commits into
release/v3.8.40from
feat/compression-cmd-splitter
Jun 29, 2026
Merged

diegosouzapw merged 3 commits into
release/v3.8.40from
feat/compression-cmd-splitter

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

What

cd /x && git status now detects as git-status. RTK command detection only matched the command prefix (cd), so any RTK filter/renderer missed commands wrapped in cd … &&/||/; 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 into commandDetector.ts at both the tool-use command arg 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 in rtk-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.

Note: check:cycles is red on release/v3.8.40 (pre-existing tools.ts↔toolSearch.ts SCC, not from this branch) — fixed by #5282; merge that first.

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.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit f862074 into release/v3.8.40 Jun 29, 2026
7 checks passed
@diegosouzapw
diegosouzapw deleted the feat/compression-cmd-splitter branch June 29, 2026 04:26
@diegosouzapw diegosouzapw mentioned this pull request Jun 29, 2026
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.
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.

1 participant