Repository navigation
fix(catalog): install-unpinned reads pnpm and counts each once (#946) - #1046
vchamarthi merged 13 commits into
Conversation
…#946) install-unpinned read only pip, npm and npx, so a skill running `pnpm add -D parcel html-inline` got no finding where the same line with npm got one for two names. pnpm add, install and i are now read like npm, with pnpm's own options before the subcommand and its value options (--filter, -F, --dir, -C, --store-dir, --save-catalog-name) left out. The same install shown twice, in one file or across files, is now one package, and a command inside the quoted text of echo or printf is not an install. A quoted command that runs (bash -c "...") still counts. Refs intel#946: scenarios 1 and 2, and the echo case of 3; the code spans that quote a command in prose are not changed. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
intel#946) The fenced blocks and code spans were joined into one text, so an apostrophe in one echo (echo Don't panic) opened a quote that closed in a later block and hid the real installs between them. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The scanner still misses executable installs in command substitutions and pnpm commands with attached quoted option values, allowing unpinned dependencies to go unreported.
5 open issues
Handle quoted values in attached pnpm options · New Handle independent quote scopes inside command substitutions · New Determine substitution escaping from backslash parity · New Track command-substitution delimiters in quote context · New Scan executable substitutions even when an earlier match spans them · New
What changed in this PR
5 new findings and 1 pre-existing issue.
This PR improves catalog check’s unpinned-install warnings for external skill content, addressing pnpm support, repeated installs, and echoed commands from #946.
Changes:
- Recognizes
pnpm add,install, andi, including options before the subcommand. - Counts distinct manager/package pairs across skill files and filters quoted echo/printf text.
- Adds regression tests and documents the revised counting rules.
| File | Description |
|---|---|
dokimi/tests/test_catalog_command_checks.py |
Adds pnpm, deduplication, quoting, and substitution cases. |
dokimi/dokimi/external/command_checks.py |
Implements pnpm detection, distinct counts, and echoed-text filtering. |
dokimi/docs/external-content.md |
Documents supported managers and counting behavior. |
dokimi/changelog.d/20261119_120000_install-unpinned-pnpm.md |
Records the catalog-check changes for #946. |
Review effort: Balanced
|
OpenCodeReview: Commit 1338b31 was not reviewed. This PR has reached its review limit (6 reviews). CI at `1338b31`: 3 still running, 14 passing, 3 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. <details><summary>Last review (4708b65): 1 medium</summary> Open threads from the bot: 0 </details> |
Replaces the echoed-span regex with a scan that follows quotes and
substitutions in order. Fixes:
- install in a substitution inside echo text hidden (nested quotes, a
literal ')' before '$(', double backslash, an echoed install beside it)
- echo/printf after command, builtin, exec or NAME=value not recognised
- '>&2' read as a separator
- 'echo' inside a quoted argument opening a spurious span
- echo output piped to a shell treated as text
- pnpm --opt="quoted value" hiding the subcommand
Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
|
🟢 Ready for re-review · 1 commit on Next: a re-review of the new head. PR description updated
Threads and comments
Verified on the new head: ✅ 1/1 tests fail before the fix, pass after · ✅ full suite with main merged in: 23989 passed · ✅ second reader: nothing raised What each test shows
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1046 +/- ##
==========================================
- Coverage 96.07% 96.06% -0.02%
==========================================
Files 475 475
Lines 62953 63117 +164
Branches 10899 10935 +36
==========================================
+ Hits 60483 60632 +149
- Misses 1524 1533 +9
- Partials 946 952 +6
🚀 New features to boost your workflow:
|
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
Review at 7824b65. The pnpm reading, the distinct count and the echo blanking work for the cases in the tests, but the new shell scanner is unbounded: a short crafted string takes exponential time, and deep nesting raises RecursionError. Details are in the line comments.
Agreed with @exai-bot: the newline after | (I added more forms in its thread); the RecursionError on deep $( nesting; a quote in a # comment after an echo hiding the next installs.
What I ran, at 7824b65:
make ci-local --offline: 23,772 passed, 0 failed, 72 skipped; mutation run of the changed lines passed.- Repros via
_unpinned_installs:'"$(' * ntakes 0.2 s at n=18, 0.8 s at 20, 3.4 s at 22;'$(' * 600raises RecursionError; the cases in the line comments give the results quoted there.
Checked, no issues
- Block ends: a quote opened in one fenced block or code span does not run into the next one, so an apostrophe in one block does not hide an install in another.
- Bundled code files: quotes in Python (
os.system('pip install requests')after"don't") do not hide the install. - Earlier threads: the nine resolved threads (substitutions, escapes, prefixes, redirections, same-line pipe to a shell) are fixed at this head.
- Docs and changelog: the fragment is under Fixed and matches the docs page and the module docstring.
Fixes the echo scanner and pnpm reading in install-unpinned: - a newline, continuation, sudo flags, env or a path after the pipe still feeds a shell, as in pipe-to-shell - substitution nesting is capped and each substitution is scanned once, so deep or unclosed $( input is linear and does not raise - a # comment is skipped before its quotes are read, and after an echo its text is not read as an install - pnpm --reporter, --modules-dir, --virtual-store-dir, --lockfile-dir and --global-dir take a value - pnpm dlx and pnpx are read as npx; a --package selection before dlx is judged as one after it Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
🟢 Ready for re-review · 1 commit on Next: @vlad-perevezentsev: re-review the new head. Changes
PR description updated
Threads and comments
Verified on the new head: What each test shows
|
…ntel#946) - PIPED_SHELL accepts fish, as PIPE_TO_SHELL does. - pnpm dlx and pnpx read options with pnpm's value options, so 'pnpm dlx --reporter silent create-vite@5.0.0' is pinned. - text printed by an echo inside a substitution is blanked with the enclosing command, so 'echo "$(echo ...)" | sh' still counts. - an echo or printf whose stdout is redirected (>f, >>f, >&2) feeds a shell nothing, so 'echo "$(echo x >/dev/null)" | sh' is not an install. - _blank takes a Sequence of tuples, so mypy accepts the piece lists. - 2>>file, >&1 and 1>&1 keep stdout, so 'echo x 2>>/dev/null | sh' and 'echo x >&1 | sh' are still installs. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
🟢 Ready for re-review · 1 commit on Next: a re-review of the new head. Changes
Threads and comments
Verified on the new head: What each test shows
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 07a7201)
- Contract: changed. errors dokimi/dokimi/external/command_checks.py:253
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Two existing review threads remain open on how printed shell text is classified.
This change and #1047 both edit the command scanner. A trial merge conflicts in its implementation, tests and guide. Reconcile package deduplication across both paths when rebasing.
One Python 3.14 job reported a runner shutdown. The wheels job reports a timing failure in the reference-check tests.
Existing open threads: T19, T20.
Checked the pnpm options and the code that distinguishes printed text, shell substitutions and pipelines. Existing open threads track comment and descriptor handling. The focused suite reported 10 passed, 189 deselected in 0.56s.
CI on head 07a7201: 2 failing Actions jobs; merge base d2790e1 is behind base tip 36075a0.
…intel#946) - A comment inside a substitution echoed to a shell is blanked, not read as an install. - echo 'pip install x' 2>&1 >&2 | sh keeps its install: stdout is still the pipe. - 2>&1 2>/dev/null >&2 | sh feeds the shell nothing: the later 2> drops the 2>&1. - 12>&1 is descriptor 12, not stderr. - 2>&10 is a duplicate of descriptor 10, not 2>&1. - _2>&1 is an argument followed by >&1, not stderr onto stdout. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Ready for re-review: 1 commit on Changes:
Threads and comments:
Checked on the new head:
What each test shows
|
An argument ending in 2 (example-2>&1) is no longer taken for descriptor 2, and 2>&2 no longer drops the saved 2>&1, so the piped install is still seen. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Ready for re-review: 1 commit on Changes:
Threads and comments:
Checked on the new head: 2 of 2 tests fail before the fix and pass after; full suite with main merged in: 24642 passed, 1 failure that main has too. What each test shows
|
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Pins that 2000 nested brackets in --baseline raise InputError (exit 2), not RecursionError. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Ready for re-review: 2 commits on Checked on the new head: tests of the fix: 2 passed; full suite with main merged in: 31323 passed, 1 failure that main has too. What each test shows
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 327329b)
- Contract: changed. errors dokimi/dokimi/external/command_checks.py:274
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The guide still contains three merge-conflict markers, and the new baseline test expects an error conversion missing from this head. The earlier scanner threads about comments and ordered redirections have corresponding fixes and regression cases.
Reviewed the scanner and regression fixtures statically, including shell comments, pnpm option parsing and stream redirection. Confirmed the conflict markers in the guide. A stubbed decoder limit raised RecursionError on both trees, and raised InputError on sibling #1050.
Still open on this head: T23.
Removes the merge-conflict markers left in external-content.md, keeping both the pnpm/echo text and main's look-alike and inline-program text. baseline_from catches RecursionError, and the test nests 200000 levels so it fails without the catch. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Ready for re-review, @napetrov: 2 commits on Threads and comments:
Checked on the new head: 1 of 1 tests fail before the fix and pass after; full suite with main merged in: 31420 passed, 1 failure that main has too. What each test shows
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 9425321)
- Contract: changed. errors dokimi/dokimi/external/command_checks.py:274
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The guide’s conflict markers are gone and the current baseline reader converts decoder RecursionError to InputError. Checked pnpm option handling, deduplication and the earlier comment and descriptor cases in the scanner. The focused run covered package names and repeated installs. Reviewed shell parsing and the nesting-limit case statically.
Coverage: 4 passed, 104 deselected in 0.57s. CI reported no failing or pending jobs on 94253210d.
The reviewed change passes its focused checks. This branch conflicts with current main in dokimi/dokimi/external/command_checks.py. Please resolve the conflict so the combined change can be reviewed.
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · re-checked 9425321 · nothing required from @vchamarthi beyond the rebase
🔀 Merge: after a rebase · it conflicts with current main in command_checks.py (_code_text: #1118's code_spans() and this PR's BLOCK_END, both needed), 36 commits behind · after it, #849 and #804 need a rebase (command_checks.py)
✅ make ci-local --offline: 26,152 passed · ResourceWarning in _pytest/pathlib.py), not from this PR; seed 8 passes on replay · ✅ '"$(' * 16000: 0.012 s (was 3.4 s at 22) · ✅ '$(' * 5000: no RecursionError
The earlier points are fixed, and the scan now stays linear on unclosed and deeply nested openers.
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Ready for re-review, @vlad-perevezentsev: 2 commits on Changes:
Threads and comments:
Not the PR's:
Checked on the new head: tests of the fix: 1 passed; full suite with main merged in: 32802 passed, 1 failure that main has too. What each test shows
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 1338b31)
- Contract: changed. errors dokimi/dokimi/external/command_checks.py:274
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The rebase resolves the conflict in command_checks.py and uses the shared code span scanner. I checked package-name deduplication, pnpm value options, separation between prose examples and the baseline error handler. Five focused scanner tests passed locally. GitHub CI passed. The full suite ran in CI.

Summary
Fixes scenario 1 of #946 and scenario 2, and the echo case of scenario 3. Input: a fenced
pnpm add -D parcel html-inline. Observed on main: noinstall-unpinned. Expected: 2 names, as withnpm install -D. Input:pip install anthropicthree times acrossa.mdandb.md. Observed on main:3 installs. Expected: 1. Input:echo "pnpm add lodash". Observed on main: counted. Expected: not an install.Changes
dokimi/external/command_checks.py:PNPMpattern foradd,install,iwith options before the subcommand,PNPM_DLXforpnpm dlxandpnpx;PNPM_VALUE_OPTIONS;_unpinned_npmtakesvalue_options;_without_printedblanks the quoted text ofechoorprintf, over several lines, before matching, unless a$(or backtick substitution in it runs the command or the output is piped to a shell.;PNPMis built fromPNPM_VALUE_OPTIONS;_unpinned_installsandcommand_findingscount distinct<manager> <name>; docstring updated.dokimi/docs/external-content.md: namespnpm, the distinct count and the echo rule.dokimi/tests/test_catalog_command_checks.py: pnpm, echo and duplicate cases.Risk
Counts drop for skills that show an install more than once, and rise for skills that run
pnpm add <name>without a version. A quoted command that runs, such asbash -c "pip install x", still counts.yarnandbunare still not read.Testing
python -m pytest -q -p no:cacheprovider tests/test_catalog_command_checks.py tests/test_growth_ratchet.py tests/test_catalog_command.pypasses (217 passed). Removing the echo check and the cross-file deduplication fails 5 cases.python -m ruff checkon the two changed.pyfiles passes.Open questions
Should a code span in prose that quotes a command not to run, such as
pip install torchinskills/torch-xpu-run/SKILL.md, be skipped? It is the rest of scenario 3 and needs a rule for telling a quoted command from an instruction.Revert
Revert the commit. Nothing is stored.
Checklist
See boxes.
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)Checklist evidence
pytestpasses: 1 test file(s) changed; suite: 23840 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 15 of 21 proof(s) fail before the change; 6 pin behaviour the base code already hadruff,mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR basedokimi/docs/external-content.mdAGENTS.md: second reader: 2 round(s), nothing left open; mutation of changed lines ranraise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue.github/.licenserc.yaml): no new source fileRefs #946.