fix(skill): make /understand work on Windows + pnpm 10#124
Merged
Conversation
Two bugs blocked /understand from running properly: 1. extract-structure.mjs:34,37 — `await import()` was called with raw absolute paths returned by `require.resolve()` and `path.resolve()`. On Windows those start with "C:\..." which Node 24's ESM loader parses as URL scheme "C:" and rejects with ERR_UNSUPPORTED_ESM_URL_SCHEME. Wrap both with `pathToFileURL().href` so the loader receives a proper file:// URL. 2. tree-sitter native build scripts were skipped at install time because pnpm 10 blocks postinstall scripts by default. Added the parser packages plus esbuild and sharp to `pnpm.onlyBuiltDependencies` so they compile during `pnpm install` and `analyzeFile` / fingerprint generation actually work. Without these, file-analyzer subagents fall back to direct file reads and the importMap stays empty across all batches, which forces assemble-reviewer to grep-recover hundreds of cross-batch edges by hand. They also block the incremental update path entirely because fingerprint generation crashes inside `buildFingerprintStore`. Verified end-to-end on a 1190-file Laravel codebase: tree-sitter PHP parses Booking.php into 18 typed functions, fingerprint baseline builds in 1.56s, change detection correctly classifies cosmetic vs structural diffs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
c2e4c75 to
366368f
Compare
Owner
|
@codex review this |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Lum1104
approved these changes
May 10, 2026
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.
Summary
Fixes two bugs that block
/understandfrom running properly on common modern dev setups (Windows + pnpm 10):extract-structure.mjs:34,37— Windows ESM URL bug.await import()was called with raw absolute paths returned byrequire.resolve()andpath.resolve(). On Windows those start withC:\..., which Node 24's ESM loader parses as URL schemeC:and rejects withERR_UNSUPPORTED_ESM_URL_SCHEME. Wrap both withpathToFileURL().hrefso the loader receives a properfile://URL. POSIX systems are unaffected (their absolute paths start with/, which Node ESM accepts).pnpm.onlyBuiltDependenciesmissing frompackage.json. pnpm 10 (released ~2024-09) changed the default to block all postinstall scripts unless explicitly approved. Without this allowlist,pnpm installskips the native build for tree-sitter parsers, esbuild, and sharp — which meansregistry.analyzeFile()returnsundefinedand any code path that calls it (includingbuildFingerprintStore) crashes. Cross-platform issue, not Windows-specific.Why both matter
Without these, on a clean Windows + pnpm 10 install:
extract-structure.mjs→ fall back to manual file reads →importMapstays empty across all batches → assemble-reviewer has to grep-recover hundreds of cross-batch edges by handbuildFingerprintStorecrashes → nofingerprints.jsonbaseline gets generated → the incremental update path described inSKILL.mdPhase 0 step 7 doesn't work at all, every/understandis a full rebuildVerification
End-to-end on a 1190-file Laravel codebase:
extract-structure.mjsresolves@understand-anything/corecleanly viapathToFileURLpnpm install(visiblenode-gyp-buildDone lines)buildFingerprintStore(ROOT, 1190 files, registry, hash)builds the baseline in 1.56sextractFileFingerprintcorrectly extracts 18 typed functions fromBooking.phpTest plan
/understandon a small Windows project to confirm extract-structure no longer falls backpnpm installon a fresh Windows + pnpm 10 clone produces compiled tree-sitter parsers without manualpnpm approve-buildsbuildFingerprintStoreno longer crashes when called per the pattern inSKILL.mdPhase 7 step 2.5🤖 Generated with Claude Code