[Feature Request] Import workspace packages by name, and audit the packages an app imports
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 39/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- bun, node.js, typescript
Research direction
Start by reading the monorepo guide and tracing how @import() resolves paths, how varlock audit scans directories, and how varlock flatten rewrites imports. The issue names Bun's Bun.Transpiler.scanImports and Bun.resolveSync as examples for workspace graph discovery. Done means package-name imports resolve from the importing file and audit can report env reads from imported workspace packages against the app schema.
Written by the indexing model from the issue text.
Description
Description
Two related gaps for monorepos where packages own their env vars (the per-package schema layout from the monorepo guide):
@import()only takes file paths, so an app imports each workspace package's schema by relative path:# @import(../../packages/db/).varlock auditonly scans the directories it is given. An app whose code reaches a package's code through a workspace import has no way to audit that package's env reads against the app's schema, so a package schema the app forgot to import goes unnoticed.
Motivation
In a Bun monorepo with several apps and packages, each package declares its own vars and each app imports the schemas of the packages it uses. The relative paths duplicate what package.json already says (the app depends on @acme/db), and break when a package moves. For the audit we wrote a 78-line script that walks each app's module graph (Bun.Transpiler.scanImports, Bun.resolveSync), collects the workspace packages it reaches, and runs varlock audit <app> <package dirs...> per app. That script is the one piece of custom env tooling left.
Proposed Solution
- Let
@import()take a package name and resolve it the way the runtime would, from the importing file:# @import(@acme/db)imports that package's directory (its.env.schemaplus env files), the same as@import(../../packages/db/)today.pick/omit/enabled/allowMissingwork as for paths. - With that,
varlock auditknows which package directories belong to a schema and can scan them alongside the app's own code, so a var read in@acme/dbbut missing from the app's resolved schema is reported. A flag or root decorator could turn this on (for examplevarlock audit --imports).
Alternatives
- Keep relative paths and a hand-written import-graph script per repo (what we do now).
package.jsonvarlock.loadPathwith tags from a single root schema; this loses per-package ownership of vars.
Additional Information
varlock flatten already rewrites import paths for container builds, so package-name imports would need the same treatment there.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 140
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 35
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dmno-dev/varlock
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dmno-dev/varlock#1279 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
dmno-dev/varlock#1100 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
dmno-dev/varlock#1278 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
dmno-dev/varlock#1275 · 1 comment ·
Maintainers usually reply within 1 day
-
core:varlock RFC
Difficulty 5/5 Over a week Newbie friendliness 28/100
dmno-dev/varlock#1258 · 1 comment ·
Maintainers usually reply within 1 day
All issues in dmno-dev/varlock
Similar issues
-
documentation good first issue roadmap
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
resend/react-email#3876 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
siyuan-note/siyuan#21324 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
himynameisdave/bsky-profanity-counter#59 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100