Repository navigation
Conversation
kindsFor() now returns null when any segment of a compound command that prints (not cd, export or an assignment) is not recognised, so filters no longer rewrite the output of commands like `cat m.py` in the same call.
Rewrite the assignment branch of SILENT so it cannot backtrack exponentially, treat backslash-newline as a continuation instead of a segment boundary (in kindsFor and filterCommand), and count true and : as silent. Tests cover ||, piped segments and the new cases.
|
@mccalpink is attempting to deploy a commit to the jaypokale35gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
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 & why
Command filters ran over the output of the whole call, so a segment they did not recognise was rewritten too:
git status && cat m.pylost the blank lines ofm.py. Now a call with an unrecognised segment that prints is not filtered at all.Refs #57 (not
Closes): this covers the five cases in the issue description. The follow-upgit status && git diffstill loses the diff's blank context lines, so the issue should stay open (or move to a new one).Root cause
kindsFor()collected the kinds of the segments it recognised and silently ignored the rest.filterCommand()then applied those filters to the combined output.git diff; cat fix.patchlost the patch file'sdiff --git/index/---/+++lines,npm test; cat old.taplost itsok Nlines, and so on, although the module header says "Only commands we recognise are touched".Fix
kindsFor()returnsnullas soon as a segment that is not silent is not recognised, so no filter runs. Silent segments, which do not count:cd,export X=…, plainVAR=value,trueand:.cd app && npm testis filtered as before.echoallowance.chisle-run.jsis unaffected: its runner filters one wrapped segment at a time (wrappable()).pytest tests/ \⏎ -k foo,git log \⏎ -n 5stay filtered), inkindsFor()and in the split infilterCommand().a=a=a=…token cannot backtrack.Total diff: hook, tests and one CHANGELOG entry, +67/-4.
Checklist
skills/chisle/SKILL.mdis the source of truth, with no rule logic duplicated into hooks (SKILL.mdis untouched; this is hook-side filtering only)npm run build:rules && npm run build:chart) (no rule or chart input changed;check:rules,check:chartandcheck:samplesreport in sync)O_NOFOLLOW,0600) (chisle-config.jsis untouched)npm testpasses (276 tests, Node 22.23.5 and Node 20.20.2)tests/test_command_filters.js)How I verified it
an unrecognised segment that prints disables filtering for the whole callfails onmain(git status && cat m.pywas filtered) and passes with the fix. It also pins||and piped segments:npm test || echo FAILED,cat f || true,npm i | grep WARN && git statusare not filtered,git status | head -5still is.segments that print nothing keep filtering oncoverscd,export, assignments,true,:and a trailing;.a backslash-newline continues the command…coverspytest,npm testandgit logsplit over two lines.SILENT matching is linear…runs a 5000-assignment token (< 200 ms; the earlier regex does not finish).node --test tests/*.js: 276 pass, 0 fail, on Node 22.23.5 and Node 20.20.2.npm run check:rules,check:chart,check:samples: all in sync.bash -n hooks/chisle-statusline.sh install.shand the installer--list/--helpsmoke test pass.Notes
npm test || true,git add -A && git status,source .venv/bin/activate && pytest,. venv/bin/activate && pytest,set -e; npm test,mkdir -p out && npm test,sleep 2; git status,npm run build && npm test, a# commentline before the command,X=$(git rev-parse HEAD) && git log -3. This follows directly from the rule in the issue, and the behaviour is conservative: no output is altered. It does cost token savings on those calls. On Claude Code with the wrapper on, test/build/install segments are still filtered bychisle-run.js; git commands and harnesses without the wrapper do not get that.trueand:are counted as silent.set,source,.,git addandmkdirare not: some of them can print, and which ones to allow is your call.git status && git diff. Both segments are recognised butshortStatusstill runs over the diff's output. Applying only the kinds common to all printing segments would cover it, but it would also stop filteringnpm ci && npm test(progress ∩ test = ∅), a design choice I left out. Also left out:echowith a fixed string as a silent segment, and a single&(git status & cat m.py) as a boundary.This PR was prepared with AI assistance (Claude Code). I have reviewed the change and the test results.