From f9eb04ead2e5be160e39d31bab0ac61aa7071ef2 Mon Sep 17 00:00:00 2001 From: Sohan Kshirsagar Date: Wed, 25 Mar 2026 11:41:33 -0700 Subject: [PATCH] docs: simplify ESM init file in SDK instrumentation prompt --- .../agent/prompts/phase_instrument_sdk.md | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/internal/agent/prompts/phase_instrument_sdk.md b/internal/agent/prompts/phase_instrument_sdk.md index 798f3ea..58426b3 100644 --- a/internal/agent/prompts/phase_instrument_sdk.md +++ b/internal/agent/prompts/phase_instrument_sdk.md @@ -102,7 +102,7 @@ IMPORTANT: All code files must end with a trailing newline. NOTE: This is LOCAL setup - do NOT use any API keys. Leave apiKey undefined for local mode. -**For CommonJS (module_system = "cjs"):** +The init file is the same for both CommonJS and ESM projects. The SDK automatically registers ESM loader hooks when needed. ```typescript import { TuskDrift } from "@use-tusk/drift-node-sdk"; @@ -115,25 +115,6 @@ TuskDrift.initialize({ export { TuskDrift }; ``` -**For ESM (module_system = "esm"):** - -```typescript -import { register } from "node:module"; -import { pathToFileURL } from "node:url"; - -// Register the ESM loader - MUST be before importing the SDK -register("@use-tusk/drift-node-sdk/hook.mjs", pathToFileURL("./")); - -import { TuskDrift } from "@use-tusk/drift-node-sdk"; - -TuskDrift.initialize({ - env: process.env.NODE_ENV, - logLevel: "debug", -}); - -export { TuskDrift }; -``` - #### Step 3: Import SDK at Entry Point **For CommonJS:** Add as the FIRST import in the entry file: