Repository navigation
fix: recommend the CLI invocation that reaches the running build - #898
Merged
Merged
Conversation
sync's outdated/drift warnings and doctor's Skills Version check all
hardcoded `npx sequant`. That is correct for the documented install path
(`npm install sequant`, then `npx sequant ...`), where npx resolves the
project's node_modules/.bin/sequant and a bare `sequant` is not on PATH.
It is wrong for a global or npm-linked install with no local dependency.
There npx cannot resolve locally and falls through to the npx cache,
which can hold an older *published* copy than the build that just printed
the warning -- so the drift warning's own remediation reinstalls the
stale content that raised it and re-arms the warning next run.
resolveCliInvocation() picks per install shape: project-local dependency
or npx cache -> `npx sequant`; global, linked, or dev checkout ->
`sequant`. A linked checkout resolves through its realpath, so it matches
neither the global nor the local pattern and lands on the bare form.
isNpxCacheInstall is split out rather than reusing
isLocalNodeModulesInstall, which deliberately excludes the cache because
it answers a different question ("is this a dependency the user can npm
update"). Its Windows path is pinned by a test: the sibling predicate
checks a `\.npm\_npx\` variant after normalizing separators, where it can
never match.
Mutation-verified, both directions. Forcing the helper to always return
`npx sequant` fails exactly the two bare-form tests (global install,
linked dev checkout) and nothing else; forcing `sequant` fails exactly
the two npx-form tests (project-local dependency, npx cache).
Verified end-to-end against the linked build: a project with one drifted
file now prints `Run: sequant sync --force (or sequant update)`.
Full suite green: 235 files, 4943 passed.
Entire-Checkpoint: b0ecacbf37b4
6 tasks
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.
Problem
A drift warning whose remediation makes the drift worse:
npx sequantis hardcoded. That's correct for the documented install path — README saysnpm install sequantthennpx sequant init, and with a local dependency npx resolvesnode_modules/.bin/sequantwhile a baresequantisn't on PATH.It's wrong for a global or
npm linked install with no local dependency. Observed in a real project:With nothing local to resolve,
npx sequantfalls through to those cached published copies — older than the linked build that just printed the warning. Following the message literally would have written the stale templates back over the current ones and re-armed the same warning on the next run. The remediation fights itself.Fix
resolveCliInvocation()picks the form that actually reaches this build:npx sequantnpx sequantnpm linked / dev checkoutsequantThree messages consume it:
sync's outdated-skills and content-drift warnings, anddoctor's Skills Version check.A linked checkout resolves through its realpath (Node resolves symlinks unless
--preserve-symlinksis set), so it matches neither the global nor the local pattern and correctly lands on the bare form.isNpxCacheInstallis split out rather than reusingisLocalNodeModulesInstall— that one deliberately excludes the cache because it answers a different question ("is this a dependency the user cannpm update"). Its Windows path is pinned by a test, since the sibling predicate checks a\.npm\_npx\variant after normalizing separators, where it can never match.What this deliberately does not do
It does not strip
npxglobally. 13 other call sites keep it, and they're right to — for the documented install shapenpx sequantis the only invocation that works.Verification
Mutation-verified, both directions. Forcing the helper to always return
npx sequant:Forcing it to always return
sequant:Each mutation fails exactly the tests that gate it and nothing else.
End-to-end against the linked build — a project with one drifted file:
Full suite: 235 files, 4943 passed, 1 expected fail, 2 skipped. Lint and
tsc --noEmitclean.Note for the reviewer
package-lock.jsonpicked up two unrelated changes locally and is excluded from this PR: a legitimateengines.nodesync (>=22.12.0→>=22.13.0, which the lockfile mirror still lags on main) and the known local-npm corruption that stripslibcfields from optional deps (documented atworktree-manager.ts:563). The engine-floor lag looks like a real follow-up worth its own change.