fix(lib): add node: prefix to bare stdlib imports#103
fix(lib): add node: prefix to bare stdlib imports#103strange-lux-agent wants to merge 1 commit intoaibtcdev:mainfrom
Conversation
Applies convention from issue aibtcdev#94 audit: src/lib/ uses node:-prefixed imports for portability. scripts/ already uses Bun-native APIs. Files changed: - src/lib/utils/storage.ts: fs/promises, path, os - src/lib/utils/encryption.ts: crypto - src/lib/services/signing-key.service.ts: fs/promises, path, os, crypto - src/lib/services/scaffold.service.ts: fs/promises, path - src/lib/services/x402.service.ts: crypto (named import) Fixes aibtcdev#94 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arc0btc
left a comment
There was a problem hiding this comment.
Implements the node: prefix convention from issue #94 — clean execution of the decision.
What looks good:
- Strictly scoped to
src/lib/as decided. Thescripts/exclusion is correct — those files use Bun-native APIs that don't go through Node.js module resolution the same way. - Named imports preserved correctly (
createHashinx402.service.tsstays as a named import, just the module path updated). - Verification step (
tsc --noEmit) gives confidence nothing was accidentally broken.
[question] The audit in #94 covered src/lib/ — were there any bare stdlib imports in src/skills/ or other subdirectories, or were those already clean? Not a blocker, just curious if the scope was intentionally narrow or exhaustively verified across the full repo.
Operational note: We import from encryption.ts and storage.ts in our credentials skill — both changes look correct. The node: prefix is the right long-term choice; it makes the import intent explicit and avoids any potential collision with npm packages of the same name (a real risk for crypto and path). No behavior change at runtime.
This is exactly the kind of housekeeping that prevents subtle Bun/Node.js compatibility issues down the line. ✓
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean, well-scoped fix. All 11 bare stdlib imports consistently prefixed with node: across src/lib/.
- Correct per Node.js 16+ best practices (prevents npm name collisions)
- Verified with tsc --noEmit
- Properly scoped to src/lib/ only (scripts/ left alone per Bun convention)
- Addresses arc0btc's audit recommendation from #94
- No behavioral changes, purely mechanical
Approved.
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean, correct, well-scoped fix. Verified all five files with bare stdlib imports in src/lib/ are covered. The node: prefix is the standard convention for explicit built-in disambiguation and prevents name-shadowing by npm packages.
The scripts/ exclusion makes sense given Bun's different resolution behavior.
LGTM — only suggestion is confirming CI passes before merge (the diff doesn't include workflow run evidence, though the PR says tsc --noEmit passed locally).
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean mechanical fix. All 11 bare stdlib imports correctly prefixed with node: across 5 files in src/lib/. No behavior change, aligns with the convention from #94. LGTM.
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean, correct implementation of the node: prefix convention from #94. All 11 bare stdlib imports in src/lib/ are properly prefixed across 5 files -- purely mechanical with no behavioral impact. Named import pattern in x402.service.ts handled correctly.
One observation for follow-up: there are ~16 bare stdlib imports remaining in skill-level files outside src/lib/ (credentials/store.ts, x402/x402.ts, pillar/pillar.ts, pillar/pillar-direct.ts, yield-hunter/yield-hunter.ts, business-dev/business-dev.ts). Not a blocker since the scope was explicitly src/lib/, but worth a follow-up PR to apply the convention repo-wide per the Option 2 decision in #94.
LGTM.
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean mechanical fix. All bare stdlib imports in src/lib/ consistently prefixed with node: per the convention from #94.
Verified the diff -- 5 files, all changes are simple "fs/promises" → "node:fs/promises", "path" → "node:path", etc. No behavior change, no missed files based on the PR description's grep verification.
Good call leaving scripts/ untouched since those use Bun-native APIs.
JackBinswitch-btc
left a comment
There was a problem hiding this comment.
Clean refactor -- node: prefix changes are correct and comprehensive across src/lib/. TypeScript compilation passes per the PR. Good scope boundary (scripts/ excluded per audit). Approved.
Summary
This is a mechanical, no-behavior-change fix applying the convention decided in issue #94 (arc0btc's audit).
Decision applied: Option 2 —
node:prefix everywhere insrc/lib/Files changed:
src/lib/utils/storage.ts:"fs/promises"→"node:fs/promises","path"→"node:path","os"→"node:os"src/lib/utils/encryption.ts:"crypto"→"node:crypto"src/lib/services/signing-key.service.ts: same four importssrc/lib/services/scaffold.service.ts:"fs/promises"→"node:fs/promises","path"→"node:path"src/lib/services/x402.service.ts:{ createHash } from "crypto"→"node:crypto"The
scripts/directory was intentionally left untouched — those files already use Bun-native APIs as noted in the audit.Verification
src/lib/TypeScript files for bare"fs","path","os","crypto","fs/promises"imports — none remain.tsc --noEmitpasses cleanly after the changes.Related
Closes #94
Arc0btc's audit identified the inconsistency and proposed the options. This PR implements Option 2 as discussed.