import { R as Recipe } from './discover-DZbUSZkF.cjs'; export { A as AMENDABLE_CALLEES, a as AmendBlocked, c as AmendField, f as AmendOutcome, g as AmendableCallee, B as BuildPlanInput, h as BuildPlanOptions, C as CallSite, i as CandidateFlag, j as CandidateSource, k as DENO_UNSUPPORTED_REASON, l as DOCKER_COMING_SOON_NOTE, D as DetectResult, m as DiscoverDeps, E as ExecuteOptions, n as ExecuteResult, o as ExecutorIO, F as FIELD_NAMES, G as GitTargetStatus, I as InjectIO, p as InstrumentationClientLookup, q as IntegrationCheckInput, r as IntegrationHazard, s as IntegrationRequirement, t as IntegrationStatus, L as LibraryEvidence, M as MaterializedPlan, u as PROCESS_WRAPPER_REASON, P as PackageManager, v as PackageManagerResolution, w as PackageManagerSource, x as Plan, y as PlanIntegration, z as PlanKind, H as SERVERLESS_DETECTION_CONFIG_FILES, J as SOURCE_EXTENSIONS, S as ServiceCandidate, K as StaticHtmlEntry, W as WorkspacePackage, N as amendSource, b as buildPlan, O as defaultExecutorIO, Q as defaultInjectIO, T as detect, U as detectPackageManager, d as discoverServices, V as executableModuleSpecifiers, e as executePlan, X as findCallSites, Y as findInstrumentationClient, Z as findNearbyProjectDirs, _ as harvestEnvNames, $ as hasExecutableCrumbtrailReference, a0 as hasExecutableEarlyBrowserImport, a1 as hasExecutableModuleReference, a2 as inspectIntegration, a3 as isBuildOutputPath, a4 as isProcessWrapperSource, a5 as looksLikeLibrary, a6 as maskLiterals, a7 as matchRecipe, a8 as materializePlan, a9 as missingSdkPackages, aa as nodeEntryCandidatePaths, ab as packageDirFromRepoRoot, ac as parseNodeInvocation, ad as parseNodeInvocationChain, ae as parsePnpmWorkspace, af as reachableSourceFiles, ag as resolveAngularEntry, ah as resolveCraEntry, ai as resolveFlutterEntry, aj as resolveNestEntry, ak as resolveOtlpStack, al as resolveReactNativeEntry, am as resolveRemixEntry, an as resolveStaticHtmlEntry, ao as resolveViteEntry, ap as resolveWorkspacePackageManager, aq as serverlessDetectionSourceFiles, ar as sourceModulePath, as as supportsInstrumentationClient, at as workspacePatternsMatch } from './discover-DZbUSZkF.cjs'; import { Stack } from 'crumbtrail-core'; import { F as FileReader } from './types-Oq-S4_9j.cjs'; import 'crumbtrail-node'; /** Local synchronous implementation, bounded by the filesystem root. */ declare function localFsReader(root: string): FileReader; /** * The first coordinated SDK release that contains the browser bootstrap. * Missing or older CLI versions return null so setup never prints a URL for a * package artifact that is not available yet. */ declare function browserEarlyCaptureVersion(version?: string | null): string | null; /** * Client init block (Next / SvelteKit / Vite / …). Matches the README's init * shape, but reads the key from the environment via `keyExpr` (a code expression * such as `import.meta.env.VITE_CRUMBTRAIL_KEY` or * `process.env.NEXT_PUBLIC_CRUMBTRAIL_KEY`) rather than baking in the literal — * so nothing sensitive lands in version control. */ declare function clientInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null, backendOrigins?: readonly string[] | null, sdkVersion?: string | null): string; /** * Nuxt client plugin. Wraps the same init in `defineNuxtPlugin` (auto-imported * by Nuxt) so it runs client-side on startup. Reads the key from `keyExpr` * (Nuxt is Vite-based, so `import.meta.env.VITE_CRUMBTRAIL_KEY`). */ declare function nuxtPluginSnippet(endpoint: string, keyExpr: string, serviceName?: string | null, backendOrigins?: readonly string[] | null, sdkVersion?: string | null): string; /** * Node server init. Uses crumbtrail-node's `autoCapture`, which installs * best-effort backend crash, console and structured log capture (uncaught * exceptions, unhandled rejections, console.error, and pino/winston/bunyan * lines at warn and above) around a headless ingest session — AND inbound * request capture, which hooks `http.Server` rather than any one framework, so * hono, fastify, nest and a hand-written server all record the requests the * browser correlated without another line of app code. It is dynamically * imported so the block is valid whether the entry file is ESM, CommonJS, or * TypeScript, and it is a plain expression (no top-level await) so it is safe to * prepend at the very top of an entry file. The ingest key is read from * `keyExpr` (never inlined server-side) — one variable for the whole project, * with `service` naming which app in it this is. Express apps additionally get * `createCrumbtrailExpressMiddleware`, which claims the request so it is * recorded once, with its matched route. */ declare function nodeInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null): string; /** * Guarded `.env` load, emitted at the very top of every backend-JS entry, above * the capture init. * * Nothing has loaded the project's `.env` when an entry module starts * evaluating. On a hosted platform the key is a real environment variable so * every read works, which is exactly why this stays invisible until someone * reproduces a bug on their laptop — where the key lives in `.env` and every * read sees nothing. Capture is then silently off in the one place a person is * actually looking for it. * * Two distinct reads depend on this. The Express middleware options object * (`{ endpoint, authToken: process.env. }`) is built while the entry module * evaluates, so without this the middleware carries no token and every * `backend.req.*` event is rejected. `autoCapture` loads `.env` itself, but only * from the directory it is reached in and only after its dynamic import * resolves — an app that loads its own env file later in the entry, or from a * path of its own, still starts capture against an unset variable. * * Only fills the key in when it is absent, and Node's own loader never * overwrites a variable that is already set, so a real environment still wins. * `Reflect.get` rather than `process.loadEnvFile?.()` so the emitted line also * type checks in a TypeScript entry whose `@types/node` predates Node 20.12. * * `quote` matches the surrounding scaffold's Prettier config — Nest ships * `singleQuote: true`, everything else takes Prettier's double-quote default. * * `packageRelPath` is this package's directory relative to the repository root, * resolved when the block is written. A bare `.env` is read relative to the * working directory, so in a monorepo it only ever finds the file when the * process was started from inside the package. Starting it from the root — * `node services/gateway/src/boot/main.js`, which is also what a root Dockerfile * does — found nothing, and the user was told their key was missing when they * had set it. Listing `services/gateway/.env` alongside `.env` makes both ways * of starting the same process load the same file. */ declare function envPreloadSnippet(keyEnvVar: string, quote?: (value: string) => string, packageRelPath?: string | null): string; /** * Import line for the Express middleware pair, matched to the entry file's * module style (detected from how `express` itself is imported). ESM entries get * a static `import`; CommonJS entries get a `require` destructure. */ declare function expressMiddlewareImportSnippet(style: "esm" | "cjs"): string; /** * Request middleware registration, inserted immediately after * `const = express()`. Emits backend.req.* start/finish spans so * frontend sessions link to backend requests. Reads the same key expression the * autoCapture block uses. */ declare function expressRequestMiddlewareSnippet(appVar: string, endpoint: string, keyExpr: string): string; /** * Error middleware registration, inserted just above `.listen(...)` so * it lands after the routes (Express error middleware must be registered last). */ declare function expressErrorMiddlewareSnippet(appVar: string, endpoint: string, keyExpr: string): string; /** * Manual wiring TODO block, prepended when the entry file does not match the * common `const app = express()` / `app.listen(...)` shape. Carries exact copy * and paste lines so the user (or their coding agent) can finish the wiring. * Comment-only: safe to prepend anywhere. */ declare function expressManualWiringSnippet(endpoint: string, keyExpr: string): string; /** * NestJS server init. Byte-for-byte the same wiring as `nodeInitSnippet` — a * dynamically-imported `autoCapture` prepended into `src/main.ts` — but emitted * with SINGLE quotes to match Nest scaffolds' Prettier default * (`singleQuote: true`). Nest is the only backend-JS recipe that gets its own * snippet: its generator ships a `.prettierrc` with single quotes, so the * double-quoted `nodeInitSnippet` produces cosmetic diff/lint noise on the very * first commit. Every other backend-JS recipe (express/hono/fastify/node) keeps * the double-quoted snippet, which matches Prettier's own default. */ declare function nestInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null): string; /** * React Native / Expo init block. Imperative + prepend-safe: it calls * `createReactNativeCrumbtrailAsync` (which runs `Crumbtrail.init` and installs * the global ErrorUtils crash handler) — the same posture as the node recipe. We * do NOT wrap a ``, because the injection engine * only prepends a block or creates a file; it cannot transform JSX. The key is * read from `keyExpr` (Expo exposes `process.env.EXPO_PUBLIC_CRUMBTRAIL_KEY` to * the app bundle) rather than inlined, keeping it out of committed source. * * The AWAITED factory is the injected one on purpose, for the reason the * Capacitor and Flutter recipes give: with a store it restores the session id * persisted by the previous launch before init. The sync factory builds no * session store, and React Native has no backing store for the core default * `sessionPersistence: "session"`, so every cold start would open a fresh * session — on the one platform where cold starts are the norm — and a * once-a-day intermittent bug would never accumulate into one signature. * * `asyncStorage` says the app already depends on * `@react-native-async-storage/async-storage`. The import is emitted ONLY then: * Metro resolves every import at bundle time, even one inside a try, so * emitting it unconditionally would turn a missing optional peer into an app * that no longer builds. Without it the caller warns, and continuity waits for * the peer. * * `.catch(() => {})` because this is prepended at the very top of an entry file * — a rejected floating promise there would surface as an unhandled rejection * in the app's own error reporting, and telemetry setup must never do that. */ declare function reactNativeInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null, asyncStorage?: boolean, backendOrigins?: readonly string[] | null): string; /** * Capacitor / Ionic init block. Prepended into the web entry. * * Calls `createCapacitorCrumbtrailAsync`, which runs `Crumbtrail.init` for the * normal web capture and then attaches the native collectors. The async form is * the injected one on purpose: it restores a session id persisted by a previous * launch before init, and without that every cold start opens a fresh session, * so a once-a-day intermittent bug never accumulates into one signature. * * `.catch(() => {})` because this is prepended at the very top of an entry file * — a rejected floating promise there would surface as an unhandled rejection * in the app's own error reporting, and telemetry setup must never do that. */ declare function capacitorInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null, backendOrigins?: readonly string[] | null, sdkVersion?: string | null): string; /** The Dart import the Flutter recipe adds to `lib/main.dart`. */ declare const FLUTTER_IMPORT_LINE = "import 'package:crumbtrail_flutter/crumbtrail_flutter.dart';"; /** * The Flutter start call, as the lines that go inside `main`. * * Returned as lines rather than a block because this is the one recipe whose * code is inserted INSIDE a function, so the caller indents it to match the * `main` it found. * * Awaited on purpose: `Crumbtrail.start` reads the persisted session id before * it resolves, and a fire-and-forget call would let `runApp` race it, so every * cold start would open a fresh session and a once-a-day intermittent bug would * never accumulate into one signature. * * `const` is what makes the compile-time key work: `String.fromEnvironment` is * a const constructor, substituted from `--dart-define` at build time. Dart * apps have no runtime environment to read on iOS or Android. */ declare function flutterInitLines(endpoint: string, keyExpr: string, serviceName?: string | null): string[]; /** The same wiring as a whole-file example, for guidance when the transform bails. */ declare function flutterInitSnippet(endpoint: string, keyExpr: string, serviceName?: string | null): string; /** * Tauri init block. Prepended into the frontend entry. Uses the core * `transportInstance` override (NOT the `transport` string-mode field) with a * `TauriTransport`, which routes bug reports to the local Rust store via the * Tauri plugin — so no httpEndpoint / apiKey is needed in the block. */ declare function tauriInitSnippet(sdkVersion?: string | null): string; /** * Where a page with no bundler gets the SDK from. * * A bare `import "crumbtrail-core"` does not resolve in a browser, and a static * page has no build step to rewrite it, so the one honest answer is a URL. The * version is pinned rather than floating: an unpinned CDN URL hands every page * whatever ships next, and nothing in the page says which SDK it is running. * * `version` is this CLI's own release, which moves in lockstep with the SDKs. * A prerelease (or anything that is not an exact release) falls back to the * published capability floor, so the emitted URL is always a version that exists * on the registry. */ declare function browserModuleUrl(version?: string | null): string; /** * The published classic bootstrap that must run before every application * script. It is a package file rather than generated page code, so it has no * customer configuration, secrets, or module/network work of its own. */ declare function browserEarlyBootstrapUrl(version?: string | null): string | null; /** * Browser capture for a page with no framework and no bundler: one * classic bootstrap plus a `