Avoid SQLite warning for CLI version output#138
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 5423e4e)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 5423e4e)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 7dcc347)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by kimi-k2.6-20260420 · Input: 55.2K · Output: 13.9K · Cached: 116.1K |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent node:sqlite from being loaded (and emitting warnings) when the CLI is invoked only for version output (-v/--version/version), by moving the node:sqlite load behind a lazy runtime boundary and extending regression coverage to lock the behavior in.
Changes:
- Refactors the SQLite driver to lazy-load the
node:sqliteruntime (while keeping SQLite symbols as type-only imports). - Replaces the static read-only authorizer action set with a constants-driven predicate evaluated after loading SQLite.
- Expands CLI regression tests to assert that version output does not statically load SQLite.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/sqlite-driver.ts |
Lazily loads node:sqlite at runtime and avoids touching SQLite constants during module initialization. |
tests/cli-regressions.test.ts |
Adds a regression assertion that version output does not statically load SQLite (including the SQLite driver’s runtime import path). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Addressed Copilot feedback in 5423e4e: replaced the type-only namespace import with explicit type-only imports and named module/constant types. Verified with npm run build, targeted Vitest suites, ESLint, and node --trace-warnings ./dist/cli.js -v. |
| type SqliteConstants = typeof sqliteConstants; | ||
| type NodeSqliteModule = { | ||
| DatabaseSync: typeof DatabaseSync; | ||
| constants: SqliteConstants; | ||
| }; |
| expect(sqliteDriverSource).not.toContain('import { constants, DatabaseSync'); | ||
| expect(sqliteDriverSource).toContain('requireNodeModule("node:sqlite")'); |
|
Addressed the new comments in 2c598de:
Verified:
|
Summary
Verification