Repository navigation
Make Lintel installable with npx - #3
Conversation
…ther Both throwaway databases start in parallel and each called ensureImage, so a first run started two pulls and printed the progress line twice. Concurrent callers now share one in-flight pull per image. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- engines: node >=22.12, the floor commander 15 requires (>=22 let 22.0-22.11 install and break); lintel doctor checks the same version. - prepack builds dist, so npm pack and npm publish always ship a fresh build. - publishConfig.access public, needed for a scoped package's first publish. Tested by installing the packed tarball in a fresh project and running `npx --package=<tarball> lintel migrations check` against demo/supabase. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Try it starts with `npx @amsozzer/lintel migrations check`; from source moves below the sample output. - The sample output is the real current output, including the P001 proof. - Replace the unreproducible "about 25 ms" with the measured 38 ms wall-clock (24 ms of it Node startup) and the machine it was measured on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewer's GuideThis PR makes Lintel directly usable through npx by enforcing the required Node.js version, rebuilding dist during packaging, and configuring scoped publication, while also deduplicating concurrent Supabase image pulls and updating documentation and diagnostics to reflect the published workflow and measured behavior. Sequence diagram for concurrent Supabase image setupsequenceDiagram
participant Base as Base database
participant Head as Head database
participant EnsureImage as ensureImage
participant Pulls as pulls map
participant Docker as Docker image
par Start base database
Base->>EnsureImage: ensureImage(image)
and Start head database
Head->>EnsureImage: ensureImage(image)
end
EnsureImage->>Pulls: pulls.get(image)
alt image pull is not in flight
EnsureImage->>Docker: pullImage(image)
Docker-->>EnsureImage: pull complete
EnsureImage->>Pulls: pulls.delete(image)
else image pull is already in flight
EnsureImage-->>EnsureImage: await shared pull
end
EnsureImage-->>Base: image ready
EnsureImage-->>Head: image ready
Flow diagram for npx package executionflowchart LR
User[Developer in Supabase project] --> Npx[npx @amsozzer/lintel migrations check]
Npx --> Package[Published package]
Package --> Bin[lintel bin]
Bin --> Check[migrations check]
Check --> Docker[Docker and Supabase database]
Check --> Result[Migration findings and exit status]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="package.json" line_range="29" />
<code_context>
},
"scripts": {
"build": "tsup",
+ "prepack": "pnpm build",
"typecheck": "tsc --noEmit",
"lint": "biome check .",
</code_context>
<issue_to_address>
**Packing requires pnpm**
When the package is packed or published with npm in an environment without pnpm on `PATH`, the `prepack` lifecycle command invokes `pnpm build`, so `npm pack` and `npm publish` fail with a command-not-found error when pnpm is not on `PATH`, even if npm and the build dependencies are available.
Use an npm-invocable build script such as `npm run build` for the `prepack` lifecycle hook.
</issue_to_address>
### Comment 2
<location path="src/core/replay/docker.ts" line_range="142-147" />
<code_context>
- opts.onProgress?.("pulling the Supabase Postgres image (one time, about 800 MB)…");
- await pullImage(image);
+ // Base and head start in parallel: share one pull (and one progress message) per image.
+ let pull = pulls.get(image);
+ if (!pull) {
+ opts.onProgress?.("pulling the Supabase Postgres image (one time, about 800 MB)…");
+ pull = pullImage(image).finally(() => pulls.delete(image));
+ pulls.set(image, pull);
+ }
+ await pull;
}
</code_context>
<issue_to_address>
**Image pulls run twice**
When the second image inspection returns after the first pull resolves, `ensureImage` uses the stale inspection result after `pulls` has been cleared, so it starts another `pullImage` and prints the progress line again even though the image is present.
Recheck whether the image is present before starting another pull.
</issue_to_address>| let pull = pulls.get(image); | ||
| if (!pull) { | ||
| opts.onProgress?.("pulling the Supabase Postgres image (one time, about 800 MB)…"); | ||
| pull = pullImage(image).finally(() => pulls.delete(image)); | ||
| pulls.set(image, pull); | ||
| } |
There was a problem hiding this comment.
🟡 Medium · Image pulls run twice
When the second image inspection returns after the first pull resolves, ensureImage uses the stale inspection result after pulls has been cleared, so it starts another pullImage and prints the progress line again even though the image is present.
Recheck whether the image is present before starting another pull.
Prompt for AI agents
In `src/core/replay/docker.ts` at lines 142-147:
**Image pulls run twice**
When the second image inspection returns after the first pull resolves, `ensureImage` uses the stale inspection result after `pulls` has been cleared, so it starts another `pullImage` and prints the progress line again even though the image is present.
Recheck whether the image is present before starting another pull.Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Goal:
npx @amsozzer/lintel migrations checkworks on a machine with Docker and the Supabase CLI, with no clone or build step.Changes
engines.nodeis now>=22.12. commander 15 requires>=22.12.0, so>=22let Node 22.0–22.11 install and then break.lintel doctorchecks the same floor.prepack: pnpm build, sonpm packandnpm publishalways ship a freshdist/.publishConfig.access: public, required for a scoped package's first publish.binand thefilesallowlist were already correct and are unchanged.Testing
npm pack --dry-run: 28 files, 27.2 kB (dist, schemas, README, LICENSE, package.json).npm initproject; thelintelbin resolves.npx --package=<tarball> lintel migrations checkin a throwaway repo built fromdemo/supabase, with RLS removed frommessagesin the working tree. The image pulled once, the run reported 3 new errors includingP001 [proven]and exited 1, in 47 s. No containers were left behind.--help: 38 ms median wall-clock for both the installed tarball and unmodified HEAD, against 24 ms for barenode -e 0(Apple M4, Node 24.21). Packaging doesn't slow startup.pnpm check:allandpnpm test:e2epass.Not included:
npm publish, which will be run manually.🤖 Generated with Claude Code
Summary by Sourcery
Make Lintel installable via npx with reliable packaging, compatible Node.js checks, and streamlined first-run database setup.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation: