pyright-envslisted
Install: claude install-skill lucas-lima-s/claude-skill-pyright-envs
## The problem
In a monorepo where several packages each vendor their own copy of the same third-party
module, a single flat Pylance/Pyright index cannot tell which copy a given file should
resolve against. Picture two packages, `alpha` and `beta`, each with their own
`vendor/sharedlib/` directory containing a different build of the same library. Without
per-package isolation, Ctrl+click (Go to Definition) from a file in `alpha` can just as
easily land in `beta`'s copy — whichever one the editor happened to index first. The bug
is silent: imports still resolve, autocomplete still works, but they point at the wrong
file, and refactors made through "Go to Definition" edit the wrong package.
Pyright's `executionEnvironments` setting fixes this: each package gets its own `root`
and its own `extraPaths`, so Pyright resolves imports for a file against that package's
paths only. Hand-writing dozens of these entries for a real monorepo is not something
anyone wants to do by hand, or keep in sync as packages come and go. This tool generates
the whole `executionEnvironments` list from a small config file.
## How the fix works
1. Every discovered package becomes one entry: `{"root": "<package>", "extraPaths": [...]}`.
2. `extraPaths` are ordered source dirs, then vendor dirs, then shared roots, then test
dirs, deduplicated.
3. A path is only emitted if it exists on disk. A configured shared root that does not
exist is dropped and reported once on stderr, never silently swallow