@posthog/wizard 2.78.0 → 2.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -11
- package/dist/PickerMenu-dG5DQCZA.js +758 -0
- package/dist/PickerMenu-dG5DQCZA.js.map +1 -0
- package/dist/{add-mcp-server-to-clients-JMv8LP-O.js → add-mcp-server-to-clients-DIaTRWMY.js} +7 -18
- package/dist/{add-mcp-server-to-clients-JMv8LP-O.js.map → add-mcp-server-to-clients-DIaTRWMY.js.map} +1 -1
- package/dist/add-mcp-server-to-clients-artmN7mz.js +2 -0
- package/dist/agent-BEjARD2a.js +6 -0
- package/dist/{agent-bCZ3i3fh.js → agent-BWFhuLgo.js} +131 -38
- package/dist/agent-BWFhuLgo.js.map +1 -0
- package/dist/{agent-interface-BAOIHuXS.js → agent-interface-FkbaBJwz.js} +66 -28
- package/dist/agent-interface-FkbaBJwz.js.map +1 -0
- package/dist/{agent-prompt-loader-7Pd4CfZO.js → agent-prompt-loader-D0weQ-7k.js} +5 -5
- package/dist/{agent-prompt-loader-7Pd4CfZO.js.map → agent-prompt-loader-D0weQ-7k.js.map} +1 -1
- package/dist/analytics-DFtbRjYh.js +2 -0
- package/dist/{analytics-CHCZ_qUR.js → analytics-DXK1gc12.js} +4 -4
- package/dist/{analytics-CHCZ_qUR.js.map → analytics-DXK1gc12.js.map} +1 -1
- package/dist/api-Cm9UtKZh.js +2 -0
- package/dist/{api-Diy_2fp8.js → api-CrbCIQOz.js} +4 -16
- package/dist/{api-Diy_2fp8.js.map → api-CrbCIQOz.js.map} +1 -1
- package/dist/bin.js +5 -2957
- package/dist/bin.js.map +1 -1
- package/dist/{bounded-fs-Bx9zTe6m.js → bounded-fs-vAq-T-K7.js} +3 -3
- package/dist/{bounded-fs-Bx9zTe6m.js.map → bounded-fs-vAq-T-K7.js.map} +1 -1
- package/dist/{ci-install-CDdQYsPe.js → ci-install-COcV8SY2.js} +8 -7
- package/dist/ci-install-COcV8SY2.js.map +1 -0
- package/dist/{constants-jFI2SaE1.js → constants-DHCBSfnx.js} +3 -3
- package/dist/{constants-jFI2SaE1.js.map → constants-DHCBSfnx.js.map} +1 -1
- package/dist/{debug-M2gV2iDq.js → debug-BuYHGr6_.js} +1 -1
- package/dist/{debug-Ch4BDOtD.js → debug-kAHwWGg7.js} +2 -2
- package/dist/{debug-Ch4BDOtD.js.map → debug-kAHwWGg7.js.map} +1 -1
- package/dist/{defaults-C6J7yL4O.js → defaults-a9TelDhJ.js} +1 -1
- package/dist/{defaults-C6J7yL4O.js.map → defaults-a9TelDhJ.js.map} +1 -1
- package/dist/emit-BSetXzDV.js +69 -0
- package/dist/emit-BSetXzDV.js.map +1 -0
- package/dist/{endpoints-DCVbM06L.js → endpoints-BVMYm9F4.js} +3 -3
- package/dist/{endpoints-DCVbM06L.js.map → endpoints-BVMYm9F4.js.map} +1 -1
- package/dist/{env-api-key-Qx8NnYHm.js → env-api-key-BP-NFFXt.js} +3 -5
- package/dist/{env-api-key-Qx8NnYHm.js.map → env-api-key-BP-NFFXt.js.map} +1 -1
- package/dist/env-api-key-CaWEDj_9.js +2 -0
- package/dist/{environment-B07Bmxae.js → environment-BATlQxcQ.js} +5 -10
- package/dist/{environment-B07Bmxae.js.map → environment-BATlQxcQ.js.map} +1 -1
- package/dist/environment-CwD8OPYj.js +2 -0
- package/dist/errors-C2domSkK.js +79 -0
- package/dist/errors-C2domSkK.js.map +1 -0
- package/dist/file-C5JMsyR1.js +2 -0
- package/dist/{file-BcLTjU16.js → file-DcRKycV8.js} +4 -4
- package/dist/file-DcRKycV8.js.map +1 -0
- package/dist/{file-watcher-DWc_bTs6.js → file-watcher-Brq2nnHV.js} +2 -2
- package/dist/{file-watcher-DWc_bTs6.js.map → file-watcher-Brq2nnHV.js.map} +1 -1
- package/dist/{gateway-CjoShdLa.js → gateway-C9-GlLO9.js} +39 -8
- package/dist/gateway-C9-GlLO9.js.map +1 -0
- package/dist/{headless-ui-BFFmYC4v.js → headless-ui-CqI2gXlD.js} +2 -2
- package/dist/{headless-ui-BFFmYC4v.js.map → headless-ui-CqI2gXlD.js.map} +1 -1
- package/dist/{interactive-D6zV7brJ.js → interactive-B_Ti_CsS.js} +3 -3
- package/dist/interactive-B_Ti_CsS.js.map +1 -0
- package/dist/{logging-ui-_TwoMNbG.js → logging-ui-Dza4D0MK.js} +5 -5
- package/dist/{logging-ui-_TwoMNbG.js.map → logging-ui-Dza4D0MK.js.map} +1 -1
- package/dist/main-CgKxbwMP.js +1396 -0
- package/dist/main-CgKxbwMP.js.map +1 -0
- package/dist/{mcp-DAgaoGk5.js → mcp-DnAyW0-w.js} +4 -4
- package/dist/{mcp-DAgaoGk5.js.map → mcp-DnAyW0-w.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-I2U_X7BC.js → mcp-prompt-streaming-DDWQ-FCA.js} +6 -6
- package/dist/mcp-prompt-streaming-DDWQ-FCA.js.map +1 -0
- package/dist/{mint-failure-D4nd2XmZ.js → mint-failure-u8xQKNOn.js} +689 -126
- package/dist/mint-failure-u8xQKNOn.js.map +1 -0
- package/dist/{models-DDdBJKwT.js → models-WcwUnSKb.js} +2 -2
- package/dist/{models-DDdBJKwT.js.map → models-WcwUnSKb.js.map} +1 -1
- package/dist/{non-interactive-Dzow7YKY.js → non-interactive-DyVC1AGc.js} +4 -3
- package/dist/{non-interactive-Dzow7YKY.js.map → non-interactive-DyVC1AGc.js.map} +1 -1
- package/dist/{oauth-session-DJ8h6GFa.js → oauth-session-DYM2Hrl2.js} +2 -2
- package/dist/{oauth-session-DJ8h6GFa.js.map → oauth-session-DYM2Hrl2.js.map} +1 -1
- package/dist/{orchestrator-tools-szcdscwn.js → orchestrator-tools-DbgNBFGA.js} +3 -3
- package/dist/{orchestrator-tools-szcdscwn.js.map → orchestrator-tools-DbgNBFGA.js.map} +1 -1
- package/dist/{package-json-DY70kkNp.js → package-json-Atg34fa4.js} +2 -8
- package/dist/{package-json-DY70kkNp.js.map → package-json-Atg34fa4.js.map} +1 -1
- package/dist/package-json-D8Ga03tK.js +2 -0
- package/dist/{pi-D3h5Ok0i.js → pi-8KsYsPmM.js} +145 -45
- package/dist/pi-8KsYsPmM.js.map +1 -0
- package/dist/{playground-5AB4WgNF.js → playground-BlYRBMj7.js} +11 -11
- package/dist/playground-BlYRBMj7.js.map +1 -0
- package/dist/{posthog-DNn574nW.js → posthog-Bt0Aplb8.js} +4 -9
- package/dist/posthog-Bt0Aplb8.js.map +1 -0
- package/dist/posthog-CUgCEhH0.js +2 -0
- package/dist/{provisioning-B8uSqRZk.js → provisioning-Bo2NRxFz.js} +5 -11
- package/dist/{provisioning-B8uSqRZk.js.map → provisioning-Bo2NRxFz.js.map} +1 -1
- package/dist/provisioning-OGFGlzf7.js +2 -0
- package/dist/{queue-tools-9OOVx5TE.js → queue-tools-C8mXOh7e.js} +3 -3
- package/dist/{queue-tools-9OOVx5TE.js.map → queue-tools-C8mXOh7e.js.map} +1 -1
- package/dist/registry-C06e_x-p.js +2 -0
- package/dist/{registry-8YG-kuXk.js → registry-CD5RQt38.js} +51 -53
- package/dist/registry-CD5RQt38.js.map +1 -0
- package/dist/run-agent-legacy-ChacZImU.js +2 -0
- package/dist/{run-agent-legacy-d7rWlzQR.js → run-agent-legacy-DOlM6DQu.js} +823 -1022
- package/dist/run-agent-legacy-DOlM6DQu.js.map +1 -0
- package/dist/runners-ov3EXF1n.js +834 -0
- package/dist/runners-ov3EXF1n.js.map +1 -0
- package/dist/{security-Cg_4a7vB.js → security-C71pkwqH.js} +16 -6
- package/dist/security-C71pkwqH.js.map +1 -0
- package/dist/{setup-utils-CmTCTPkX.js → setup-utils-B26Lf2yF.js} +12 -22
- package/dist/setup-utils-B26Lf2yF.js.map +1 -0
- package/dist/setup-utils-CVS86NYR.js +2 -0
- package/dist/{start-tui-CB2PZs1x.js → start-tui-Bo2L0bar.js} +30 -28
- package/dist/start-tui-Bo2L0bar.js.map +1 -0
- package/dist/{steps-BZcXRJNY.js → steps-BPcg3_3Q.js} +7 -7
- package/dist/{steps-BZcXRJNY.js.map → steps-BPcg3_3Q.js.map} +1 -1
- package/dist/{store-UN7c-ASf.js → store-BTzcvRGT.js} +12 -18
- package/dist/store-BTzcvRGT.js.map +1 -0
- package/dist/store-BpqySPXm.js +5 -0
- package/dist/{subagent-BofIDK-O.js → subagent-D1TrTchE.js} +3 -3
- package/dist/{subagent-BofIDK-O.js.map → subagent-D1TrTchE.js.map} +1 -1
- package/dist/{task-r9t1UhQP.js → task-DqRlQBfs.js} +18 -16
- package/dist/task-DqRlQBfs.js.map +1 -0
- package/dist/{task-stream-CMUilu54.js → task-stream-Bw6JaLCX.js} +10 -10
- package/dist/task-stream-Bw6JaLCX.js.map +1 -0
- package/dist/{tasks-Bbv_lOBG.js → tasks-ChWufsdO.js} +1 -1
- package/dist/{tasks-Bbv_lOBG.js.map → tasks-ChWufsdO.js.map} +1 -1
- package/dist/{telemetry-D6ruCtnv.js → telemetry-B7zJdRmA.js} +3 -3
- package/dist/{telemetry-D6ruCtnv.js.map → telemetry-B7zJdRmA.js.map} +1 -1
- package/dist/{terminal-DrGyci_a.js → terminal-zgkEfoCL.js} +17 -17
- package/dist/terminal-zgkEfoCL.js.map +1 -0
- package/dist/{tools-Dyfh9aCD.js → tools-CkJ2y9Wt.js} +9 -9
- package/dist/tools-CkJ2y9Wt.js.map +1 -0
- package/dist/{ui-BBVuTM1v.js → ui-Q6-RvERF.js} +3 -3
- package/dist/{ui-BBVuTM1v.js.map → ui-Q6-RvERF.js.map} +1 -1
- package/dist/{version-aXxpgRKx.js → version-CHhJjz_H.js} +2 -2
- package/dist/{version-aXxpgRKx.js.map → version-CHhJjz_H.js.map} +1 -1
- package/dist/{wizard-abort-BBkiUxfS.js → wizard-abort-BPdv07np.js} +7 -6
- package/dist/{wizard-abort-BBkiUxfS.js.map → wizard-abort-BPdv07np.js.map} +1 -1
- package/dist/wizard-abort-Br1qMDNa.js +3 -0
- package/dist/wizard-session-2w4Ru-Wz.js.map +1 -1
- package/dist/{wizard-ui-DoyOZxK8.js → wizard-ui-DVqrYaOM.js} +1 -1
- package/dist/{wizard-ui-DoyOZxK8.js.map → wizard-ui-DVqrYaOM.js.map} +1 -1
- package/dist/{yara-hooks-DCeMDd1o.js → yara-hooks-BnxejtXK.js} +5 -5
- package/dist/{yara-hooks-DCeMDd1o.js.map → yara-hooks-BnxejtXK.js.map} +1 -1
- package/dist/yara-hooks-DSuExwb4.js +2 -0
- package/package.json +2 -1
- package/dist/agent-bCZ3i3fh.js.map +0 -1
- package/dist/agent-interface-BAOIHuXS.js.map +0 -1
- package/dist/analytics-BcV-WCM4.js +0 -2
- package/dist/ci-install-CDdQYsPe.js.map +0 -1
- package/dist/errors-CQ9kttJD.js +0 -185
- package/dist/errors-CQ9kttJD.js.map +0 -1
- package/dist/file-BcLTjU16.js.map +0 -1
- package/dist/gateway-CjoShdLa.js.map +0 -1
- package/dist/interactive-D6zV7brJ.js.map +0 -1
- package/dist/mcp-prompt-streaming-I2U_X7BC.js.map +0 -1
- package/dist/mint-failure-D4nd2XmZ.js.map +0 -1
- package/dist/pi-D3h5Ok0i.js.map +0 -1
- package/dist/playground-5AB4WgNF.js.map +0 -1
- package/dist/posthog-DNn574nW.js.map +0 -1
- package/dist/registry-8YG-kuXk.js.map +0 -1
- package/dist/rolldown-runtime-B_-DWIq7.js +0 -15
- package/dist/run-agent-legacy-d7rWlzQR.js.map +0 -1
- package/dist/security-Cg_4a7vB.js.map +0 -1
- package/dist/setup-utils-CmTCTPkX.js.map +0 -1
- package/dist/start-tui-CB2PZs1x.js.map +0 -1
- package/dist/store-UN7c-ASf.js.map +0 -1
- package/dist/task-r9t1UhQP.js.map +0 -1
- package/dist/task-stream-CMUilu54.js.map +0 -1
- package/dist/terminal-DrGyci_a.js.map +0 -1
- package/dist/tools-Dyfh9aCD.js.map +0 -1
- package/dist/wizard-abort-BU4aLyvh.js +0 -3
- package/dist/yara-hooks-DSGuCU9A.js +0 -2
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __exportAll = (all, no_symbols) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
14
|
-
//#endregion
|
|
15
|
-
export { __require as n, __exportAll as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-agent-legacy-d7rWlzQR.js","names":["executeAgent","runAgent"],"sources":["../src/ui/agent-progress.ts","../src/lib/programs/program-step.ts","../src/lib/programs/authenticate.ts","../src/lib/detection/framework.ts","../src/lib/detection/features.ts","../src/lib/detection/context.ts","../src/lib/detection/agentic.ts","../src/lib/warehouse-sources/registry.ts","../src/lib/warehouse-sources/detect.ts","../src/lib/programs/warehouse-source/detect.ts","../src/lib/programs/shared/package-scanning.ts","../src/lib/programs/posthog-integration/detect.ts","../src/lib/programs/audit/types.ts","../src/lib/programs/audit/ledger-watcher.ts","../src/lib/programs/run-agent-legacy.ts"],"sourcesContent":["import type { WizardUI, SpinnerHandle } from './wizard-ui';\nimport type { AgentInteraction, AgentProgress } from '@agent/types';\nimport { logToFile } from '@utils/debug';\n\n// ── Progress → WizardUI, one call per event ───────────────────────────\n\n/**\n * The inverse of the agent's former `getUI()` calls: one event, one\n * `WizardUI` method, synchronous, in emission order. Because each case maps\n * back to exactly the call the agent used to make, the frame and flow goldens\n * hold without regeneration.\n */\nexport function createUiReducer(ui: WizardUI): (event: AgentProgress) => void {\n let spinner: SpinnerHandle | undefined;\n return (event) => {\n switch (event.kind) {\n case 'lifecycle':\n if (event.phase === 'started') ui.startRun();\n else ui.outro(event.message);\n break;\n case 'spinner': {\n const handle = (spinner ??= ui.spinner());\n handle[event.action](event.message);\n break;\n }\n case 'log':\n ui.log[event.level](event.message);\n break;\n case 'status':\n ui.pushStatus(event.message);\n break;\n case 'tasks':\n ui.syncTodos(event.tasks);\n break;\n case 'stage':\n ui.setStage(event.stage);\n break;\n case 'url':\n if (event.which === 'dashboard') ui.setDashboardUrl(event.url);\n else ui.setNotebookUrl(event.url);\n break;\n case 'usage':\n ui.addTokenUsage(event.delta);\n break;\n case 'finalCost':\n ui.setFinalTokenCostUsd(event.usd);\n break;\n case 'authError':\n ui.showAuthError(event.detail);\n break;\n case 'handoff':\n ui.setHandoffText(event.text);\n break;\n case 'completion':\n ui.setOutroData(event.outro);\n break;\n default: {\n const unhandled: never = event;\n throw new Error(\n `Unhandled agent progress: ${JSON.stringify(unhandled)}`,\n );\n }\n }\n };\n}\n\n/** The agent's questions, answered wherever `getUI()` answers them today. */\nexport function uiInteraction(ui: WizardUI): AgentInteraction {\n return {\n ask: (question, { signal }) =>\n dismissOnAbort(ui.requestQuestion(question), signal, () =>\n ui.cancelPendingQuestion(),\n ),\n taskNotice: (notice, { signal }) =>\n dismissOnAbort(ui.showTaskNotice(notice), signal, () =>\n ui.cancelTaskNotice(),\n ),\n };\n}\n\n/**\n * Dismiss one open request on abort; a settled one leaves the UI alone. A\n * throw inside an abort listener reaches no caller: Node rethrows it as an\n * uncaught exception, so a broken overlay is logged here instead.\n */\nfunction dismissOnAbort<T>(\n open: Promise<T>,\n signal: AbortSignal,\n dismiss: () => void,\n): Promise<T> {\n const onAbort = () => {\n try {\n dismiss();\n } catch (error) {\n logToFile('[agent-progress] dismissing an aborted request failed', error);\n }\n };\n // An abort listener added to an already aborted signal never fires.\n if (signal.aborted) onAbort();\n else signal.addEventListener('abort', onAbort, { once: true });\n return open.finally(() => signal.removeEventListener('abort', onAbort));\n}\n","import type {\n WizardSession,\n DiscoveredFeature,\n TaskNotice,\n} from '@lib/wizard-session';\nimport type { WizardReadinessResult } from '@shared/health-checks/readiness';\nimport type { ProgramRun } from '@lib/programs/program-run';\nimport type { Integration } from '@shared/constants';\nimport type { FrameworkConfig } from '@lib/framework-config';\nimport type { ContentBlock } from '@ui/tui/primitives/index';\nimport type { WizardStore } from '@ui/tui/store';\nimport type { Tip } from '@ui/tui/components/TipsCard';\n// Type-only — erased at compile time, so no runtime cycle with the\n// registry that imports `ProgramConfig` back from this module.\nimport type { ProgramId } from './program-registry.js';\n\n/**\n * A program step is the primary unit of the wizard's execution model.\n *\n * It can own:\n * - a screen in the TUI (optional — some steps are headless)\n * - agent work via a program reference (optional — some steps are UI-only)\n * - completion and visibility predicates\n *\n * The PostHog integration program is one ordered list of steps.\n * Other programs (e.g. revenue analytics) register a different step list.\n */\n/**\n * Context passed to onInit callbacks — fires when the TUI starts\n * rendering, before bin.ts has assigned the real session.\n */\nexport interface StoreInitContext {\n readonly session: WizardSession;\n readonly setReadinessResult: (result: WizardReadinessResult | null) => void;\n readonly setFrameworkContext: (key: string, value: unknown) => void;\n readonly emitChange: () => void;\n}\n\n/**\n * Context passed to onReady callbacks — fires after bin.ts has assigned\n * the real session, so reading `session.installDir` returns the target\n * project. Use for async pre-program work like prerequisite detection.\n */\nexport interface ProgramReadyContext {\n readonly session: WizardSession;\n readonly setFrameworkContext: (key: string, value: unknown) => void;\n\n // Detection-specific methods — used by core-integration's detect step\n readonly setFrameworkConfig: (\n integration: Integration,\n config: FrameworkConfig,\n ) => void;\n readonly setDetectedFramework: (label: string) => void;\n readonly setSkillId: (skillId: string | null) => void;\n readonly setUnsupportedVersion: (info: {\n current: string;\n minimum: string;\n docsUrl: string;\n }) => void;\n readonly addDiscoveredFeature: (feature: DiscoveredFeature) => void;\n readonly setDetectionComplete: () => void;\n readonly setPosthogSdkDetected: (detected: boolean) => void;\n}\n\nexport interface ProgramStep {\n /** Unique identifier for this step */\n id: string;\n\n /** Human-readable label for progress display */\n label: string;\n\n /**\n * TUI screen this step owns, if any.\n * Matches the ScreenId enum values (e.g. 'intro', 'run', 'outro').\n */\n screenId?: string;\n\n /**\n * For a run step (`screenId: 'run'`): runs this step's own agent. A program\n * exports a self-contained run step and another imports it into its step list\n * — e.g. posthog-integration exports a run step that runs its agent, and\n * self-driving imports it before its own run step. Omit to run the host\n * program's own agent (`config.run`).\n */\n run?: (session: WizardSession) => Promise<void>;\n\n /**\n * For a run step: prepare a derived session before its agent runs — e.g.\n * gather framework context for the chosen project. The session it receives is\n * the run's own, so writes don't leak into later runs.\n */\n onRunPrep?: (session: WizardSession) => Promise<void>;\n\n /**\n * For a run step: the working directory its agent runs in, resolved from the\n * session (e.g. self-driving's integration runs in the picked monorepo\n * sub-app, not the repo root). The runner scopes a derived session to this\n * dir for that run only. Defaults to `session.installDir`.\n */\n targetDir?: (session: WizardSession) => string;\n\n /**\n * Whether this step should be visible in the current program.\n * If omitted, the step is always visible.\n */\n show?: (session: WizardSession) => boolean;\n\n /**\n * Exit condition for the screen. Router advances when true.\n * Defaults to `gate` if unset.\n */\n isComplete?: (session: WizardSession) => boolean;\n\n /**\n * Define a gate if your screen needs to await user interactions.\n * bin.ts can `await store.getGate(stepId)` to pause until the\n * predicate becomes true.\n */\n gate?: (session: WizardSession) => boolean;\n\n /**\n * Called once when the TUI starts rendering, with the default\n * session. Use for session-independent fire-and-forget work that\n * should start as early as possible (e.g. health check kicked off\n * while the user is still reading the intro screen). Never fires for\n * a store that isn't rendering screens (tests, playground).\n */\n onInit?: (ctx: StoreInitContext) => void;\n\n /**\n * Called once after bin.ts has assigned the real session to the store,\n * before any gate is awaited. Awaited in sequence with other steps'\n * onReady callbacks. Use for session-dependent pre-program work like\n * scanning the installDir for prerequisites. May be sync or async.\n */\n onReady?: (ctx: ProgramReadyContext) => void | Promise<void>;\n\n /**\n * Report this step's analytics under a different program than its host, for\n * steps shared across programs (the MCP tutorial is all of `mcp-tutorial`\n * and the last step of `mcp-add`). Attribution only — scopes, bindings, and\n * sequences still follow the host. Matched by `screenId`, so headless steps\n * are unaffected.\n */\n reportsAsProgramId?: ProgramId;\n}\n\n/**\n * Declares a program's place in the wizard CLI surface.\n *\n * Mirrors the `cli:` block in context-mill skill configs so wizard-native\n * programs and skill-backed programs share one vocabulary. Field names\n * match `ProgramConfig.command` / `parentCommand` above, so contributors\n * only learn one set of words.\n *\n * - `role: 'command'` — appears as a normal wizard command.\n * - `role: 'skill'` — reachable only via `wizard skill <id>`.\n * - `role: 'internal'` — hidden everywhere, only reachable via the\n * `--skill=<id>` dev escape hatch.\n *\n * Mapping table — declaration on the left, registered command on the right:\n *\n * { role: 'command', → wizard revenue-analytics\n * command: 'revenue-analytics' }\n *\n * { role: 'command', → wizard audit feature-flags\n * parentCommand: 'audit',\n * command: 'feature-flags' }\n *\n * { role: 'skill' } → wizard skill <id>\n *\n * `cli` only configures the command shape — the verbs the user types.\n * Flags and positional args (e.g. `--since=30d`) are configured on\n * `cliOptions`, not here.\n *\n * Naming rule: commands use the full PostHog product name with hyphens\n * (`revenue-analytics`, `feature-flags`, `session-replay`), not\n * abbreviations like `revenue` or `flags`.\n */\nexport interface ProgramCliSurface {\n /** Where the program appears in the wizard CLI surface. */\n role: 'command' | 'skill' | 'internal';\n /**\n * The user-typed word that registers this program (e.g. `'feature-flags'`\n * in `wizard audit feature-flags`, or `'revenue-analytics'` in\n * `wizard revenue-analytics`). Required when `role` is `'command'`.\n */\n command?: string;\n /**\n * The command this program nests under (e.g. `'audit'` for\n * `wizard audit feature-flags`). Omit for flat / standalone commands.\n */\n parentCommand?: string;\n}\n\n/**\n * Uniform configuration for a wizard program.\n *\n * Each program directory exports one of these. The system uses it\n * for CLI registration, sequence/step wiring, and skill bootstrap.\n */\nexport interface ProgramConfig {\n /** CLI command name (e.g. 'revenue-analytics'). Omit for the default program. */\n command?: string;\n /**\n * Parent CLI command to nest this program under. When set, the program is\n * registered as `<parentCommand> <command>` instead of as a top-level\n * command. The parent must itself be a registered subcommand program. Omit\n * for top-level programs.\n */\n parentCommand?: string;\n /** CLI description shown in --help */\n description: string;\n /** Unique program id — matches the Program enum value */\n id: string;\n /**\n * Content-mill flow the orchestrator loads its agent prompts + step-skills\n * from (`agents/<flow>/` and `skills/<flow>/`). Defaults to `id`; set it when\n * the content-mill flow name diverges from the program id.\n */\n agentFlow?: string;\n /**\n * Whether this program's agent run requires third-party AI services.\n *\n * When true (the default), the wizard checks\n * `apiUser.organization.is_ai_data_processing_approved` after auth and\n * renders `AiOptInRequiredScreen` if the org has not opted in. Matches\n * Max's strict reading: only literal `true` proceeds.\n *\n * Opt out (set to `false`) for programs that don't run the agent —\n * doctor, mcp install/remove/tutorial, source-map upload. The safe\n * default is `true` so future programs gate by declaration.\n */\n requiresAi?: boolean;\n /**\n * Context-mill skill ID this program installs and runs. When present,\n * bin.ts seeds `session.skillId` with this value before the TUI renders\n * so intro screens can resolve skill metadata without waiting for the\n * agent run.\n */\n skillId?: string;\n /** The ordered step list */\n steps: ProgramStep[];\n /** Agent run config. Static object or async function for dynamic config. */\n run?: ProgramRun | ((session: WizardSession) => Promise<ProgramRun>);\n /**\n * CI-mode pre-run strategy. When set, runWizardCI awaits this after building\n * the ci:true session and before the agent runs, instead of walking step\n * onReady hooks. Use for headless prerequisite work (e.g. framework\n * detection) that the TUI performs via step onReady callbacks.\n */\n ciPreRun?: (session: WizardSession) => Promise<void>;\n /**\n * Tasks the orchestrator queues itself, before the planner runs, from what\n * the wizard detected. Their types are marked `runnerSeeded: true` in the\n * agent prompt, so the planner never sees them: whether such a task runs is\n * decided here, in code, not by a model that could invent it or forget it.\n * Return an empty list to queue none.\n */\n seedTasks?: (session: WizardSession) => Array<{\n type: string;\n label?: string;\n inputs?: Record<string, unknown>;\n /**\n * Shown before the run starts, letting the user decline the task. The\n * program owns the words — the runner and the modal only carry them. A\n * task without one is queued silently.\n */\n notice?: TaskNotice;\n }>;\n /**\n * Task types this run excludes, decided from the run's wizard flags. An\n * excluded type does not exist for the run: the planner cannot enqueue it\n * and no agent boots for it. The program owns the flag→type mapping; the\n * runner only applies it.\n */\n excludedTaskTypes?: (flags: Record<string, string>) => readonly string[];\n /** Prerequisites: other program ids that must have run first */\n requires?: string[];\n /**\n * Path (relative to installDir) of the report file the program writes.\n * Mirrors `run.reportFile` but lifted to the top level so UI screens can\n * read it synchronously without resolving a deferred `run` function.\n */\n reportFile?: string;\n /**\n * Agent-authored event-plan artifact to mirror into the wizard session.\n * Relative to `session.installDir`. Programs that do not produce an event\n * plan leave this unset, so generic runner machinery does not inspect a\n * stale or unrelated `.posthog-events.json` file.\n */\n eventPlanFile?: string;\n /** Audit ledger to mirror into the session and delete at run end, relative to `installDir`. */\n auditLedgerFile?: string;\n /**\n * Channel the task stream publishes this run under, when it differs from the\n * program id. A family leaf runs on the generic skill program, so without\n * this every `wizard audit <leaf>` would report as `agent-skill`.\n */\n streamWorkflowId?: string;\n /**\n * LearnCard deck rendered in the shared `RunScreen` while the agent\n * runs. Lives at `<program>/content/index.tsx` by convention.\n * Programs that ship a custom RunScreen variant (audit) or skip the\n * run step (posthog-doctor) leave this unset.\n */\n getContentBlocks?: (store?: WizardStore) => ContentBlock[];\n /**\n * Tips shown in the run screen's right pane (the `Tips` sidebar) once\n * the LearnCard finishes. Lets a program supply its own explainer copy\n * (e.g. self-driving explaining what signal sources and scouts are)\n * instead of the generic onboarding deck. Unset → `RunScreen` falls back\n * to `DEFAULT_TIPS`, so every other program is unaffected. Lives at\n * `<program>/content/tips.ts` by convention.\n */\n getTips?: (store?: WizardStore) => Tip[];\n /**\n * Subcommand-specific CLI options. Spread into yargs `.options(...)` when the\n * program's subcommand is registered. Program-specific knowledge stays in\n * the program config, not in bin.ts. Typed as `unknown` to avoid pulling a\n * yargs dependency into this module.\n */\n cliOptions?: Record<string, unknown>;\n /**\n * Translate parsed CLI argv into extra options the runner consumes. Runs\n * after yargs validation, before runWizard/runWizardCI. Use this when a flag\n * needs to derive another field (e.g. `--product=statsig` → `skillId:\n * 'migrate-statsig'`).\n */\n mapCliOptions?: (argv: Record<string, unknown>) => Record<string, unknown>;\n /**\n * Extra tool names added on top of BASE_ALLOWED_TOOLS for this program's\n * agent run. Use for tools that only this program needs.\n */\n allowedTools?: readonly string[];\n /**\n * Tool names removed from BASE_ALLOWED_TOOLS for this program's agent\n * run. Use to forbid a base tool — e.g. `['Agent']` to block subagent\n * dispatch in a program whose steps are explicitly single-agent.\n */\n disallowedTools?: readonly string[];\n /**\n * Declares this program's place in the wizard CLI surface. See\n * `ProgramCliSurface` for semantics.\n */\n cli?: ProgramCliSurface;\n}\n\n/**\n * Project program steps into the narrower Screen shape the router consumes.\n *\n * Two things happen here:\n * 1. Headless steps (no `screenId`) are filtered out. The router walks\n * visible screens; gate-only steps like `detect` are store concerns.\n * 2. The step is narrowed to just { id, show, isComplete } — the\n * router has no business touching gate, onInit, or label.\n *\n * This intentional separation keeps the router focused on one question:\n * \"Which screen should be rendered right now?\"\n */\n/**\n * The gated steps the agent runner awaits after `auth` and before `run`, in\n * step order. Empty when a program has no auth step or runs before it.\n */\nexport function postAuthGateSteps(steps: ProgramStep[]): ProgramStep[] {\n const authIndex = steps.findIndex((s) => s.screenId === 'auth');\n const runIndex = steps.findIndex((s) => s.screenId === 'run');\n if (authIndex === -1 || runIndex <= authIndex) return [];\n return steps.slice(authIndex + 1, runIndex).filter((s) => s.gate);\n}\n\nexport function createProgramSequence(steps: ProgramStep[]): Array<{\n id: string;\n show?: (session: WizardSession) => boolean;\n isComplete?: (session: WizardSession) => boolean;\n}> {\n const entries = steps\n .filter((step) => step.screenId != null)\n .map((step) => ({\n id: step.screenId!,\n show: step.show,\n // `isComplete` defaults to `gate` — for most steps they're the same\n // predicate (e.g. intro: setupConfirmed unblocks bin.ts AND finishes\n // the screen). Only override when the two conditions diverge.\n isComplete: step.isComplete ?? step.gate,\n }));\n\n // Every program ends with the exit screen.\n entries.push({ id: 'exit', show: undefined, isComplete: undefined });\n\n return entries;\n}\n","/**\n * Authenticate the wizard — once per invocation.\n *\n * Idempotent: when `session.credentials` is already set, this is a no-op. So a\n * second agent run in the same invocation (e.g. self-driving runs the\n * integration program as a phase, then the Self-driving run) reuses the first\n * login instead of launching another OAuth — a second OAuth re-prompts and\n * fails with a 400 (the first authorization code is already spent). The first\n * call stores the full result on the session so any later bootstrap reads it\n * back rather than fetching again.\n */\n\nimport type { Credentials, WizardSession } from '@lib/wizard-session';\nimport type { ProgramId } from '@lib/programs/program-registry';\nimport { getOrAskForProjectData } from '@utils/setup-utils';\nimport { refreshAccessToken, missingOAuthScopes } from '@utils/oauth';\nimport { WIZARD_OAUTH_SCOPES } from '@shared/constants';\nimport { OAuthError } from '@utils/oauth-errors';\nimport { markGrantRevoked } from '@shared/auth-session-state';\nimport { configureOAuthSession, oauthCredentials } from '@shared/oauth-session';\nimport { analytics, groupsFromUser } from '@utils/analytics';\nimport { getUI } from '@ui';\nimport { logToFile } from '@utils/debug';\n\nexport async function authenticate(\n session: WizardSession,\n programId: ProgramId,\n): Promise<void> {\n if (session.credentials) return;\n\n logToFile('[agent-runner] starting OAuth');\n const {\n projectApiKey,\n host,\n accessToken,\n refreshToken,\n expiresAt,\n oauthClientId,\n projectId,\n roleAtOrganization,\n user,\n project,\n missingScopes,\n } = await getOrAskForProjectData({\n signup: session.signup,\n ci: session.ci,\n apiKey: session.apiKey,\n projectId: session.projectId,\n email: session.email,\n region: session.region,\n baseUrl: session.baseUrl,\n localMcp: session.localMcp,\n programId,\n });\n\n session.credentials = {\n accessToken,\n refreshToken,\n expiresAt,\n oauthClientId,\n projectApiKey,\n host,\n projectId,\n missingScopes,\n };\n session.apiProject = project;\n session.roleAtOrganization = roleAtOrganization;\n session.apiUser = user;\n\n getUI().setCredentials(session.credentials);\n getUI().setRoleAtOrganization(roleAtOrganization);\n getUI().setApiUser(user);\n\n // Identify the user (email, name) before flags are evaluated, so flags can\n // target the individual user and not just $app_name.\n if (user) analytics.identifyUser(user);\n analytics.setGroups(groupsFromUser(user, host.apiHost));\n}\n\n/**\n * Grants the token endpoint refuses permanently. A dead grant means the login\n * is gone, not that the network blipped, so only these mark the session.\n */\nconst DEAD_GRANT_CODES = new Set(['invalid_grant', 'invalid_client']);\n\n// Pre-run refresh through the run's OAuth session, so every later reader shares its rotations.\nexport async function refreshAccessTokenIfNeeded(\n session: WizardSession,\n): Promise<void> {\n if (!session.credentials) return;\n configureOAuthSession(session.credentials, {\n rotate: (credentials) => rotateCredentials(credentials, session.baseUrl),\n onRefreshed: (refreshed) => {\n // Replaced, not mutated: keeps the store and the (possibly shallow-copied) session in step.\n session.credentials = refreshed;\n getUI().setAccessToken(refreshed);\n },\n });\n await oauthCredentials();\n}\n\n// One refresh-token grant. A failure returns the same credentials: the old token may still have minutes of life.\nasync function rotateCredentials(\n credentials: Credentials,\n baseUrl: string | undefined,\n): Promise<Credentials> {\n if (!credentials.refreshToken) return credentials;\n try {\n const token = await refreshAccessToken(\n credentials.refreshToken,\n baseUrl,\n credentials.oauthClientId,\n );\n return {\n ...credentials,\n accessToken: token.access_token,\n missingScopes: missingOAuthScopes(\n [...WIZARD_OAUTH_SCOPES, ...(credentials.missingScopes ?? [])],\n token.scope,\n ),\n // Rotation: keep the returned refresh token or the old one stops working.\n refreshToken: token.refresh_token ?? credentials.refreshToken,\n expiresAt: Date.now() + token.expires_in * 1000,\n };\n } catch (error) {\n // A dead grant is recorded but not thrown. If a 401 does follow, the auth-error screen can name the cause.\n if (error instanceof OAuthError && DEAD_GRANT_CODES.has(error.code)) {\n markGrantRevoked();\n analytics.wizardCapture('auth session expired', { reason: error.code });\n }\n logToFile(\n '[oauth] token refresh failed, continuing with the existing token:',\n error instanceof Error ? error.message : error,\n );\n return credentials;\n }\n}\n","/**\n * Framework detection — identify which PostHog-supported framework\n * is present in the project directory.\n *\n * Pure function: takes an install dir, returns the detected integration\n * (or undefined). No store mutations, no UI calls.\n */\n\nimport { Integration, DETECTION_TIMEOUT_MS } from '@shared/constants';\nimport { FRAMEWORK_REGISTRY } from '@lib/registry';\n\n/**\n * Loop through all registered frameworks and return the first one\n * whose `detect()` predicate matches the given directory.\n * Returns undefined if no framework is detected or detection times out.\n */\nexport async function detectFramework(\n installDir: string,\n): Promise<Integration | undefined> {\n for (const integration of Object.values(Integration)) {\n const config = FRAMEWORK_REGISTRY[integration];\n try {\n const detected = await Promise.race([\n config.detection.detect({ installDir }),\n new Promise<false>((resolve) =>\n setTimeout(() => resolve(false), DETECTION_TIMEOUT_MS),\n ),\n ]);\n if (detected) {\n return integration;\n }\n } catch {\n // Skip frameworks whose detection throws\n }\n }\n}\n","/**\n * Feature discovery — scan project dependencies for known SDK patterns\n * that indicate additional PostHog programs are relevant.\n *\n * Pure function: takes an install dir, returns a set of discovered features.\n * No store mutations, no UI calls.\n */\n\nimport { join } from 'path';\nimport { readProjectFile } from '@utils/bounded-fs';\nimport { DiscoveredFeature } from '@lib/wizard-session';\n\nconst STRIPE_PACKAGES = new Set(['stripe', '@stripe/stripe-js']);\n\nconst LLM_PACKAGES = new Set([\n 'openai',\n '@anthropic-ai/sdk',\n 'ai',\n '@ai-sdk/openai',\n 'langchain',\n '@langchain/openai',\n '@langchain/langgraph',\n '@google/generative-ai',\n '@google/genai',\n '@instructor-ai/instructor',\n '@mastra/core',\n 'portkey-ai',\n]);\n\n// PyPI normalizes `_` to `-` and is case-insensitive; compare via normalizePyName.\nconst PYTHON_LLM_PACKAGES = new Set([\n 'openai',\n 'anthropic',\n 'langchain',\n 'langchain-openai',\n 'langchain-anthropic',\n 'langchain-google-genai',\n 'langgraph',\n 'litellm',\n 'llama-index',\n 'pydantic-ai',\n 'crewai',\n 'instructor',\n 'dspy-ai',\n 'mistralai',\n 'cohere',\n 'google-generativeai',\n 'google-genai',\n 'portkey-ai',\n]);\n\nexport function discoverFeatures(installDir: string): DiscoveredFeature[] {\n const features: DiscoveredFeature[] = [];\n discoverNodeFeatures(installDir, features);\n discoverPythonFeatures(installDir, features);\n return features;\n}\n\nfunction discoverNodeFeatures(\n installDir: string,\n features: DiscoveredFeature[],\n): void {\n const packageJsonText = safeRead(installDir, 'package.json');\n if (!packageJsonText) return;\n\n let packageJson: {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n try {\n packageJson = JSON.parse(packageJsonText);\n } catch {\n return;\n }\n\n const depNames = Object.keys({\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n });\n\n if (depNames.some((depName) => STRIPE_PACKAGES.has(depName))) {\n features.push(DiscoveredFeature.Stripe);\n }\n if (depNames.some((depName) => LLM_PACKAGES.has(depName))) {\n features.push(DiscoveredFeature.LLM);\n }\n}\n\nfunction discoverPythonFeatures(\n installDir: string,\n features: DiscoveredFeature[],\n): void {\n if (features.includes(DiscoveredFeature.LLM)) return;\n\n const depNames: string[] = [];\n\n const requirementsTxt = safeRead(installDir, 'requirements.txt');\n if (requirementsTxt) depNames.push(...parseRequirementsTxt(requirementsTxt));\n\n const pyprojectToml = safeRead(installDir, 'pyproject.toml');\n if (pyprojectToml) depNames.push(...parsePyprojectToml(pyprojectToml));\n\n const pipfile = safeRead(installDir, 'Pipfile');\n if (pipfile) depNames.push(...parsePipfile(pipfile));\n\n if (depNames.some((depName) => PYTHON_LLM_PACKAGES.has(depName))) {\n features.push(DiscoveredFeature.LLM);\n }\n}\n\n// Manifests over MAX_PROJECT_FILE_BYTES are skipped, not parsed.\nfunction safeRead(installDir: string, file: string): string | null {\n return readProjectFile(join(installDir, file));\n}\n\nfunction normalizePyName(name: string): string {\n return name.toLowerCase().replace(/_/g, '-');\n}\n\nexport function parseRequirementsTxt(content: string): string[] {\n return content\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#') && !line.startsWith('-'))\n .map((line) => line.replace(/\\[[^\\]]*\\]/, ''))\n .map((line) => line.split(/[<>=!~;\\s]/)[0])\n .filter(Boolean)\n .map(normalizePyName);\n}\n\n// Pragmatic, not a full TOML parser — only the dep shapes we care about.\nexport function parsePyprojectToml(content: string): string[] {\n const depNames: string[] = [];\n\n for (const arrayMatch of content.matchAll(\n /dependencies\\s*=\\s*\\[([^\\]]*)\\]/g,\n )) {\n const arrayBody = arrayMatch[1];\n for (const quotedMatch of arrayBody.matchAll(/[\"']([^\"']+)[\"']/g)) {\n const depSpec = quotedMatch[1];\n const name = depSpec.replace(/\\[[^\\]]*\\]/, '').split(/[<>=!~;\\s]/)[0];\n if (name) depNames.push(normalizePyName(name));\n }\n }\n\n const poetrySectionRe =\n /\\[tool\\.poetry\\.(?:dev-dependencies|dependencies|group\\.[^.\\]]+\\.dependencies)\\]([\\s\\S]*?)(?=\\n\\[|$)/g;\n for (const sectionMatch of content.matchAll(poetrySectionRe)) {\n const sectionBody = sectionMatch[1];\n depNames.push(...extractTomlSectionKeys(sectionBody, { skip: ['python'] }));\n }\n\n return depNames;\n}\n\nexport function parsePipfile(content: string): string[] {\n const depNames: string[] = [];\n const sectionRe = /\\[(packages|dev-packages)\\]([\\s\\S]*?)(?=\\n\\[|$)/g;\n for (const sectionMatch of content.matchAll(sectionRe)) {\n const sectionBody = sectionMatch[2];\n depNames.push(...extractTomlSectionKeys(sectionBody));\n }\n return depNames;\n}\n\nfunction extractTomlSectionKeys(\n sectionBody: string,\n opts: { skip?: string[] } = {},\n): string[] {\n const skipNames = new Set(opts.skip ?? []);\n const depNames: string[] = [];\n for (const line of sectionBody.split('\\n')) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n const equalsIndex = trimmed.indexOf('=');\n if (equalsIndex <= 0) continue;\n const name = trimmed.slice(0, equalsIndex).trim();\n if (!/^[a-zA-Z0-9._-]+$/.test(name)) continue;\n if (skipNames.has(name.toLowerCase())) continue;\n depNames.push(normalizePyName(name));\n }\n return depNames;\n}\n","/**\n * Framework context gathering — run gatherContext and version checks\n * for a detected framework.\n *\n * Pure functions: take a framework config and options, return results.\n * No store mutations, no UI calls.\n */\n\nimport * as semver from 'semver';\nimport { DETECTION_TIMEOUT_MS } from '@shared/constants';\nimport type { FrameworkConfig } from '@lib/framework-config';\nimport type { WizardRunOptions } from '@utils/types';\n\n/**\n * Run a framework's `gatherContext()` to collect variant-specific\n * metadata (e.g., router type for Next.js, Expo vs bare for React Native).\n *\n * Returns the gathered context, or an empty object on failure/timeout.\n */\nexport async function gatherFrameworkContext(\n config: FrameworkConfig,\n options: WizardRunOptions,\n): Promise<Record<string, unknown>> {\n if (!config.metadata.gatherContext) return {};\n\n try {\n return await Promise.race([\n config.metadata.gatherContext(options),\n new Promise<Record<string, never>>((resolve) =>\n setTimeout(() => resolve({}), DETECTION_TIMEOUT_MS),\n ),\n ]);\n } catch {\n return {};\n }\n}\n\nexport interface VersionCheckResult {\n /** Whether the installed version is supported */\n supported:\n | true\n | {\n current: string;\n minimum: string;\n docsUrl: string;\n };\n}\n\n/**\n * Check whether the installed framework version meets the minimum requirement.\n *\n * Returns `{ supported: true }` if the version is fine (or no check is needed).\n * Returns the version details if unsupported.\n */\nexport async function checkFrameworkVersion(\n config: FrameworkConfig,\n options: WizardRunOptions,\n): Promise<VersionCheckResult> {\n if (\n !config.detection.minimumVersion ||\n !config.detection.getInstalledVersion\n ) {\n return { supported: true };\n }\n\n const version = await config.detection.getInstalledVersion(options);\n if (!version) return { supported: true };\n\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n return {\n supported: {\n current: version,\n minimum: config.detection.minimumVersion,\n docsUrl:\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl,\n },\n };\n }\n\n return { supported: true };\n}\n","/**\n * Agentic project detection.\n *\n * A reusable detection tool that drives a Haiku agent over the repo: it finds\n * project roots, resolves monorepo/workspace markers, reads package manifests,\n * classifies each project against a caller-supplied set of targets, and reports\n * which projects already have a PostHog SDK installed.\n *\n * Product-knowledge-free by design — the caller passes the targets to classify\n * into (e.g. source-map skill variants) and maps the result back. Sits next to\n * the other detection tools (framework, features, package-manager) so it's\n * discoverable. Runs AFTER auth: it uses the same agent loop every program\n * uses, which needs credentials.\n */\n\nimport {\n initializeAgent,\n executeAgent,\n buildRunTags,\n AgentSignals,\n AgentErrorType,\n} from '@agent';\nimport { isAbsolute, resolve, sep } from 'path';\nimport { detectNodePackageManagers } from './package-manager.js';\nimport {\n AGENTIC_DETECTION_FIRST_ATTEMPT_TIMEOUT_MS,\n AGENTIC_DETECTION_RETRY_TIMEOUT_MS,\n CallType,\n getSkillsBaseUrl,\n HAIKU_MODEL,\n} from '@shared/constants';\nimport { analytics } from '@utils/analytics';\nimport type { WizardSession } from '@lib/wizard-session';\nimport type { WizardRunOptions } from '@utils/types';\nimport { getUI, type SpinnerHandle } from '@ui';\nimport { createUiReducer } from '@ui/agent-progress';\n\n/** A category the agent classifies each project into (id the agent returns). */\nexport type DetectTarget = { id: string; name: string };\n\n/** One project the agent found in the repo. */\nexport type AgenticProject = {\n /** Path relative to the working directory (\".\" for the repo root). */\n path: string;\n /** Human-readable framework the agent detected (e.g. \"Next.js\"). */\n framework: string;\n /** A target id when the project matches one of the supplied targets, else null. */\n targetId: string | null;\n /** Whether a PostHog SDK is already installed in this project. */\n hasPostHog: boolean;\n /** True on the one project picked as the main user-facing app; only present when the scan set `recommend`. */\n recommended?: boolean;\n};\n\nexport type AgenticDetectionReport = {\n repoType: 'monorepo' | 'single';\n projects: AgenticProject[];\n};\n\nexport class AgenticDetectionTimeoutError extends Error {\n constructor(attempt: number, timeoutMs: number) {\n super(\n `Project scan attempt ${attempt} timed out after ${timeoutMs / 1000}s`,\n );\n this.name = 'AgenticDetectionTimeoutError';\n }\n}\n\n/** Streaming progress callback — one short activity line per agent step. */\nexport type DetectEvent = (line: string) => void;\n\n/**\n * Every project-manifest / workspace-marker filename the wizard's frameworks\n * are identified by. One brace-expansion Glob over all of these locates every\n * project root in the repo in a single call, regardless of language.\n *\n * Counterpart: POSTHOG_MANIFESTS in @lib/programs/self-driving/detect (SDK\n * grep); keep the two in sync.\n */\nexport const PROJECT_MANIFESTS: readonly string[] = [\n // JS/TS + workspace markers\n 'package.json',\n 'pnpm-workspace.yaml',\n 'turbo.json',\n 'nx.json',\n 'lerna.json',\n // Python\n 'requirements.txt',\n 'pyproject.toml',\n 'setup.py',\n 'Pipfile',\n 'manage.py',\n // Ruby / PHP\n 'Gemfile',\n 'composer.json',\n // Java\n 'pom.xml',\n // Rust\n 'Cargo.toml',\n // Elixir\n 'mix.exs',\n // Go\n 'go.mod',\n // .NET: no framework targets yet, but found so\n // an existing PostHog SDK is reported (feeds self-driving's \"continue\" path).\n '*.csproj',\n // Mobile / native\n 'Package.swift',\n 'Podfile',\n 'project.yml',\n 'project.pbxproj',\n 'pubspec.yaml',\n 'build.gradle',\n 'build.gradle.kts',\n 'settings.gradle',\n 'settings.gradle.kts',\n // Gradle version catalog (holds dependency coordinates).\n 'gradle/libs.versions.toml',\n];\n\n/** The single brace-expansion glob covering every supported manifest. */\nexport function manifestGlob(): string {\n return `**/{${PROJECT_MANIFESTS.join(',')}}`;\n}\n\nexport type AgenticDetectOptions = {\n /**\n * Categories to classify each project into. Order matters: list targets by\n * priority, most specific first. When a project could match more than one,\n * the agent keeps the earliest — so the caller encodes precedence purely\n * through ordering (e.g. a bundler target before a generic framework target).\n */\n targets: readonly DetectTarget[];\n /** The program this scan bills to. Required, not optional: the scan drives a\n * real agent through the gateway, and a caller that forgets leaves that\n * spend unattributed. */\n programId: string;\n /** One short clause describing what the scan is for (frames the prompt). */\n purpose?: string;\n /** Ask the agent to label exactly one project `recommended` (the main client app). Off by default. */\n recommend?: boolean;\n /**\n * Target ids whose technologies co-occur in one manifest (e.g. the JS\n * family). Among these, the enumeration's priority winner overrides the\n * model's pick; elsewhere a valid pick always wins — see coerceAgenticReport.\n */\n rerankIds?: readonly string[];\n /** Streaming activity callback for the UI. */\n onEvent?: DetectEvent;\n};\n\nfunction buildPrompt(\n cwd: string,\n targets: readonly DetectTarget[],\n purpose: string,\n recommend: boolean,\n): string {\n const targetList = targets.map((t) => `- ${t.id} → ${t.name}`).join('\\n');\n // matchingTargets precedes targetId: the model enumerates before it picks.\n const projectShape = `{\"path\":string,\"framework\":string,\"matchingTargets\":string[],\"targetId\":string|null,\"hasPostHog\":boolean,\"evidence\":string${\n recommend ? ',\"recommended\":boolean' : ''\n }}`;\n return [\n `You are scanning a code repository to ${purpose}. Be fast and mechanical — do not over-explore. Keep any reasoning to one short sentence, then run the tool calls and output the JSON.`,\n '',\n `Working directory: ${cwd}`,\n '',\n 'A \"project\" is a directory containing one or more of the manifest files below. Find projects by their manifests, NOT by walking directories — never report a directory that has no manifest.',\n '',\n 'Do exactly this:',\n `1. Run Glob ONCE with this pattern to find every project manifest in the repo in a single call: \"${manifestGlob()}\". Discard any result whose path contains node_modules/, dist/, build/, .next/, out/, coverage/, vendor/, .venv/, site-packages/, target/, Pods/, Carthage/, or DerivedData/. Group the remaining results by directory — each directory is one project. Three exceptions to \"directory = project\": a project.pbxproj lives inside a \"<Name>.xcodeproj/\" wrapper, so the project root is the PARENT of that .xcodeproj directory; a project.yml at a directory root is an XcodeGen-generated Xcode app rooted at that directory; a gradle/libs.versions.toml is a version catalog belonging to the gradle project rooted at the PARENT of that gradle/ directory (read it alongside the build.gradle when deciding hasPostHog), never its own project.`,\n '2. Decide repoType: \"monorepo\" if the root package.json has a \"workspaces\" field OR a pnpm-workspace.yaml / turbo.json / nx.json / lerna.json was found at the root, else \"single\".',\n `3. For EACH project directory, ONE AT A TIME: Read its manifest(s) ONCE, decide the fields below, then IMMEDIATELY — before reading any other project — write that project's verdict as one JSON line of shape ${projectShape}. Never write a verdict from memory of an earlier Read; the manifest you just read is the only source. Decide from its dependency lists:`,\n ' - the human-readable framework name (e.g. \"Next.js\", \"Django\", \"Rails\"),',\n ' - matchingTargets: EVERY target id from the list below whose technology appears in THIS manifest, in the priority order of the list. An id belongs here only if you can point at the dependency or setting in the manifest you just read — never carry one over from another project,',\n ' - targetId: the FIRST entry of matchingTargets (the list is ordered by priority, most specific first). null when matchingTargets is empty,',\n ` - hasPostHog: true if any dependency is a PostHog SDK. This includes: a name containing \"posthog\" in any ecosystem (e.g. posthog-js, posthog-node, @posthog/*, posthog for pip/gem/hex, a com.posthog:* gradle/maven coordinate, a PostHog NuGet PackageReference); an SPM package named \"PostHog\" or a repositoryURL of github.com/PostHog/posthog-ios (in Package.swift or a .pbxproj); or a \"pod 'PostHog'\" line in a Podfile. Else false.`,\n ' - evidence: the manifest fact that decided targetId, with the file it came from (e.g. \"rollup in devDependencies of backend/package.json\"). When targetId is null, name the closest fact you saw. One short clause, quoted from the manifest you just read.',\n ' Do NOT read any file other than these manifests.',\n ...(recommend\n ? [\n '4. Pick exactly ONE project as recommended — the main user-facing client application. Prefer a frontend web app or a mobile app over backend servers/APIs, libraries, CLIs, tooling, and example/demo/docs apps. If several client apps exist, pick the primary production app; if no client app exists, pick the primary application project.',\n ]\n : []),\n '',\n 'Target ids (id → name), in priority order — most specific first; if several match a project, keep the one listed earliest:',\n targetList,\n '',\n 'Output requirements:',\n '- After the last verdict line, respond with ONLY a single JSON object assembling the verdict lines you wrote, copied VERBATIM — same path, framework, targetId and evidence per project. No prose, no markdown code fences.',\n `- Shape: {\"repoType\":\"monorepo\"|\"single\",\"projects\":[${projectShape}]}`,\n '- \"path\" is the project directory relative to the working directory; use \".\" for the repo root.',\n '- \"targetId\" MUST be exactly one of the target ids above when it matches; if several match, use the one listed earliest; otherwise null.',\n '- Include projects whose stack matches no target too (targetId: null).',\n ...(recommend\n ? [\n '- Exactly one project has \"recommended\": true; every other project has \"recommended\": false.',\n ]\n : []),\n `- If there are no manifests at all, respond with exactly: ${AgentSignals.ABORT} detection failed`,\n ].join('\\n');\n}\n\n/**\n * Build the detection report from the agent's output, or null when it holds\n * no verdicts. Exported for testing.\n *\n * The verdict lines are far more reliable than the model's final assembly\n * (prose, pretty-printing, per-object fences), so every parseable line\n * contributes: objects with a `path` merge by path (last wins), and a\n * one-line assembly's `projects` merge the same way. `repoType` is\n * approximated from the count — it only feeds telemetry and display.\n */\nexport function deriveReportJson(text: string): unknown | null {\n const byPath = new Map<string, Record<string, unknown>>();\n for (const line of text.split('\\n')) {\n const start = line.indexOf('{');\n const end = line.lastIndexOf('}');\n if (start === -1 || end <= start) continue;\n let parsed: unknown;\n try {\n parsed = JSON.parse(line.slice(start, end + 1));\n } catch {\n continue; // not JSON — prose, shape echoes, pretty-printed fragments\n }\n const obj = (parsed ?? {}) as Record<string, unknown>;\n const candidates = Array.isArray(obj.projects) ? obj.projects : [obj];\n for (const candidate of candidates) {\n const p = (candidate ?? {}) as Record<string, unknown>;\n if (typeof p.path === 'string') byPath.set(p.path, p);\n }\n }\n if (byPath.size === 0) return null;\n const projects = [...byPath.values()];\n return { repoType: projects.length > 1 ? 'monorepo' : 'single', projects };\n}\n\n/**\n * Clamp an agent-reported project path to a safe repo-relative dir. The path\n * is LLM output: absolute paths or `..` segments could steer later phases\n * (e.g. integrate-run's targetDir) outside the repo, so they clamp to '.'.\n */\nfunction coercePath(raw: unknown): string {\n if (typeof raw !== 'string' || raw.length === 0) return '.';\n if (isAbsolute(raw) || raw.split(/[\\\\/]/).includes('..')) return '.';\n return raw;\n}\n\n/** Resolve an agent-reported path to an absolute dir clamped to the root — the caller-side counterpart of coercePath. */\nexport function resolveProjectDir(installDir: string, rel: unknown): string {\n if (typeof rel !== 'string' || rel === '.') return installDir;\n const root = resolve(installDir);\n const dir = resolve(root, rel);\n return dir === root || dir.startsWith(root + sep) ? dir : root;\n}\n\n/**\n * Validate the agent's raw JSON into a report, clamping each targetId to the\n * supplied set and each path to a repo-relative dir. Exported for testing.\n * `recommended` is stripped unless requested; at most one (the first) survives.\n */\nexport function coerceAgenticReport(\n parsed: unknown,\n validTargetIds: readonly string[],\n options?: { recommend?: boolean; rerankIds?: readonly string[] },\n): AgenticDetectionReport {\n const recommend = options?.recommend === true;\n const rerankIds = options?.rerankIds ?? [];\n const obj = (parsed ?? {}) as Record<string, unknown>;\n const repoType = obj.repoType === 'monorepo' ? 'monorepo' : 'single';\n const rawProjects = Array.isArray(obj.projects) ? obj.projects : [];\n let recommendedSeen = false;\n const projects: AgenticProject[] = rawProjects.map((raw) => {\n const p = (raw ?? {}) as Record<string, unknown>;\n // Trust the model's pick; an invalid one falls back to the enumeration's\n // highest-priority member (validTargetIds IS the priority order). The\n // winner overrides a valid pick only when both sit in rerankIds — stacks\n // that co-occur in one manifest, where a misordered enumeration is the\n // common miss. Elsewhere enumerations are padded across exclusive stacks\n // (a Flutter app listing react-native) and must not beat a correct pick.\n const pick =\n typeof p.targetId === 'string' && validTargetIds.includes(p.targetId)\n ? p.targetId\n : null;\n const enumerated = Array.isArray(p.matchingTargets)\n ? validTargetIds.find((id) =>\n (p.matchingTargets as unknown[]).includes(id),\n ) ?? null\n : null;\n const targetId =\n pick === null\n ? enumerated\n : enumerated !== null &&\n rerankIds.includes(enumerated) &&\n rerankIds.includes(pick)\n ? enumerated\n : pick;\n const recommended = recommend && !recommendedSeen && p.recommended === true;\n recommendedSeen ||= recommended;\n return {\n path: coercePath(p.path),\n framework: typeof p.framework === 'string' ? p.framework : 'Unknown',\n targetId,\n hasPostHog: p.hasPostHog === true,\n ...(recommend ? { recommended } : {}),\n };\n });\n return { repoType, projects };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction formatToolUse(block: any): string {\n const name = typeof block?.name === 'string' ? block.name : 'tool';\n const input = (block?.input ?? {}) as Record<string, unknown>;\n const detail =\n (input.file_path as string) ||\n (input.pattern as string) ||\n (input.path as string) ||\n '';\n return detail ? `${name} ${detail}` : name;\n}\n\nfunction sessionToWizardOptions(session: WizardSession): WizardRunOptions {\n return {\n installDir: session.installDir,\n ci: session.ci,\n debug: session.debug,\n benchmark: session.benchmark,\n yaraReport: session.yaraReport,\n signup: session.signup,\n apiKey: session.apiKey,\n projectId: session.projectId,\n };\n}\n\nconst NOOP_SPINNER: SpinnerHandle = {\n start: () => undefined,\n stop: () => undefined,\n message: () => undefined,\n};\n\n/**\n * Drive the wizard's agent loop on HAIKU_MODEL to scan the repo and return a\n * structured detection report. Reuses the same setup every program uses, so\n * MCP, tools, and credentials are wired identically.\n */\nexport async function detectProjectsWithAgent(\n session: WizardSession,\n options: AgenticDetectOptions,\n): Promise<AgenticDetectionReport> {\n if (!session.credentials) {\n throw new Error('Detection requires authenticated credentials.');\n }\n const {\n targets,\n programId,\n purpose = 'set up a PostHog integration',\n recommend = false,\n rerankIds,\n onEvent,\n } = options;\n const { accessToken, host } = session.credentials;\n const cwd = session.installDir;\n const runOptions = sessionToWizardOptions(session);\n\n // Built here rather than inherited: this scan runs before\n // `bootstrapProgram`, so there's no `boot.wizardMetadata` yet.\n const wizardMetadata = {\n ...buildRunTags({\n programId,\n integration: 'agentic-detect',\n runId: analytics.runId,\n build: analytics.build,\n }),\n call_type: CallType.detection,\n };\n\n const prompt = buildPrompt(cwd, targets, purpose, recommend);\n for (let attempt = 0; attempt < 2; attempt++) {\n const timeoutMs =\n attempt === 0\n ? AGENTIC_DETECTION_FIRST_ATTEMPT_TIMEOUT_MS\n : AGENTIC_DETECTION_RETRY_TIMEOUT_MS;\n const agent = await initializeAgent(\n {\n emit: createUiReducer(getUI()),\n workingDirectory: cwd,\n posthogMcpUrl: host.mcpUrl,\n posthogApiKey: accessToken,\n host,\n detectPackageManager: detectNodePackageManagers,\n skillsBaseUrl: getSkillsBaseUrl(),\n programId,\n integrationLabel: 'agentic-detect',\n wizardMetadata,\n allowedTools: ['Read', 'Grep', 'Glob'],\n modelOverride: HAIKU_MODEL,\n },\n runOptions,\n );\n\n // Keeps only the transcript tail — the report JSON is the last output.\n const MAX_TRANSCRIPT_CHARS = 256 * 1024;\n const collected: string[] = [];\n let collectedChars = 0;\n const collect = (text: string): void => {\n collected.push(text);\n collectedChars += text.length;\n while (collectedChars > MAX_TRANSCRIPT_CHARS && collected.length > 1) {\n collectedChars -= collected.shift()!.length;\n }\n };\n let resultText = '';\n\n const middleware = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onMessage: (message: any): void => {\n if (message?.type === 'assistant') {\n for (const block of message.message?.content ?? []) {\n if (block?.type === 'text' && typeof block.text === 'string') {\n collect(block.text);\n const line = block.text.trim();\n if (line && onEvent) {\n onEvent(line.length > 100 ? `${line.slice(0, 100)}…` : line);\n }\n } else if (block?.type === 'tool_use') {\n onEvent?.(formatToolUse(block));\n }\n }\n } else if (\n message?.type === 'result' &&\n typeof message.result === 'string'\n ) {\n resultText = message.result;\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n finalize: (_resultMessage: any, _durationMs: number): unknown =>\n undefined,\n };\n\n const result = await executeAgent(\n agent,\n prompt,\n runOptions,\n NOOP_SPINNER,\n {\n spinnerMessage: 'Scanning the repo...',\n successMessage: 'Detection complete',\n errorMessage: 'Detection failed',\n requestRemark: false,\n timeoutMs,\n },\n middleware,\n );\n\n if (\n result.kind === 'failure' &&\n result.classification === AgentErrorType.AGENTIC_DETECTION_TIMEOUT\n ) {\n if (attempt === 0) {\n onEvent?.('Project scan timed out; retrying...');\n continue;\n }\n throw new AgenticDetectionTimeoutError(attempt + 1, timeoutMs);\n }\n if (result.kind !== 'success') {\n if (result.kind === 'decided_failure') {\n throw result.failure.error ?? new Error(result.failure.message);\n }\n throw (\n result.error ??\n new Error(result.message || `Agent error: ${result.classification}`)\n );\n }\n\n // Transcript first, final message last — its verdicts win path conflicts.\n const output = `${collected.join('\\n')}\\n${resultText}`;\n const derived = deriveReportJson(output);\n if (derived !== null) {\n return coerceAgenticReport(\n derived,\n targets.map((t) => t.id),\n { recommend, rerankIds },\n );\n }\n // No manifests are a valid empty scan, not a reason to retry.\n if (output.includes(AgentSignals.ABORT)) {\n return { repoType: 'single', projects: [] };\n }\n if (attempt === 0) onEvent?.('Retrying project scan...');\n }\n throw new Error('Agent did not return a JSON object after retry');\n}\n","/**\n * Registry of data warehouse source detectors.\n *\n * Each entry maps a codebase footprint to a PostHog source `kind`. The `kind`\n * strings are validated against the MCP `external-data-sources-wizard` tool —\n * keep them in sync with PostHog's released source types.\n *\n * `in-cli` sources are created from the terminal (databases + API-key SaaS).\n * `deep-link` sources have no safe terminal credential path (OAuth) but a\n * codebase footprint worth nudging the user about — we open the app instead.\n */\n\nimport type { SourceDetector } from './types.js';\n\nconst CORE_SOURCE_DETECTORS: SourceDetector[] = [\n {\n kind: 'Postgres',\n label: 'PostgreSQL',\n mode: 'in-cli',\n signals: {\n npm: ['pg', 'postgres', 'postgres.js', 'knex', 'sequelize'],\n python: ['psycopg', 'psycopg2', 'psycopg2-binary', 'asyncpg'],\n ruby: ['pg'],\n envKeys: [\n // NOTE: DATABASE_URL is ambiguous — MySQL/SQLite projects (Prisma,\n // Rails) use it too. We only read key NAMES, not the scheme, so this\n // is a deliberate precision/recall tradeoff biased toward the most\n // common convention (DATABASE_URL → Postgres).\n /^DATABASE_URL$/,\n /^POSTGRES_/,\n /^PG(HOST|DATABASE|USER|PORT)$/,\n ],\n },\n // Neon and Supabase are hosted Postgres, and a project on either still\n // names its connection with the generic signals above. Two sources over\n // one database import the same tables twice.\n supersededBy: ['Neon', 'Supabase'],\n },\n {\n kind: 'MySQL',\n label: 'MySQL',\n mode: 'in-cli',\n signals: {\n npm: ['mysql', 'mysql2'],\n python: ['pymysql', 'mysqlclient', 'mysql-connector-python'],\n ruby: ['mysql2'],\n envKeys: [/^MYSQL_/],\n },\n },\n {\n kind: 'MongoDB',\n label: 'MongoDB',\n mode: 'in-cli',\n signals: {\n npm: ['mongodb', 'mongoose'],\n python: ['pymongo', 'motor'],\n ruby: ['mongo', 'mongoid'],\n // Matches both MONGO_* and MONGODB_* prefixes (e.g. MONGO_HOST,\n // MONGODB_URI) in one pattern.\n envKeys: [/^MONGO(DB)?_/],\n },\n },\n {\n kind: 'Snowflake',\n label: 'Snowflake',\n mode: 'in-cli',\n signals: {\n npm: ['snowflake-sdk'],\n python: ['snowflake-connector-python', 'snowflake-sqlalchemy'],\n envKeys: [/^SNOWFLAKE_/],\n },\n },\n {\n // BigQuery authenticates with a Google Cloud service-account JSON key\n // file, like Firebase above — the source's only required credential field\n // is a file upload, and the terminal prompt collects single-line text, so\n // there is no in-cli path that can accept it. Deep-link to the app's\n // new-source form instead of dead-ending on an unpasteable credential.\n kind: 'BigQuery',\n label: 'BigQuery',\n mode: 'deep-link',\n signals: {\n npm: ['@google-cloud/bigquery'],\n python: ['google-cloud-bigquery'],\n envKeys: [/^BIGQUERY_/],\n },\n },\n {\n kind: 'Redshift',\n label: 'Redshift',\n mode: 'in-cli',\n signals: {\n npm: ['node-redshift'],\n python: ['redshift-connector'],\n envKeys: [/^REDSHIFT_/],\n },\n },\n {\n kind: 'MSSQL',\n label: 'SQL Server',\n mode: 'in-cli',\n signals: {\n npm: ['mssql', 'tedious'],\n python: ['pyodbc', 'pymssql'],\n envKeys: [/^MSSQL_/],\n },\n },\n {\n kind: 'Supabase',\n label: 'Supabase',\n mode: 'in-cli',\n signals: {\n npm: ['@supabase/supabase-js'],\n python: ['supabase'],\n envKeys: [/^SUPABASE_/],\n },\n },\n {\n kind: 'ClickHouse',\n label: 'ClickHouse',\n mode: 'in-cli',\n signals: {\n npm: ['@clickhouse/client'],\n python: ['clickhouse-connect', 'clickhouse-driver'],\n envKeys: [/^CLICKHOUSE_/],\n },\n },\n {\n kind: 'Convex',\n label: 'Convex',\n mode: 'in-cli',\n signals: {\n npm: ['convex'],\n python: ['convex'],\n envKeys: [/^CONVEX_/, /^NEXT_PUBLIC_CONVEX_URL$/],\n },\n },\n {\n // Firebase authenticates with a service-account JSON key file, not a\n // pasteable string. The terminal credential prompt only collects\n // single-line text, so there is no safe in-cli path: the file upload lives\n // in the app's new-source form. Deep-link there instead of dead-ending on a\n // credential the CLI cannot accept.\n kind: 'Firebase',\n label: 'Firebase',\n mode: 'deep-link',\n signals: {\n // NOTE: the `firebase` client SDK also covers auth-only projects, which\n // have no Firestore data to import. We accept the false positives — the\n // package is a strong signal for the common case.\n npm: ['firebase-admin', 'firebase'],\n python: ['firebase-admin'],\n envKeys: [/^FIREBASE_/, /^NEXT_PUBLIC_FIREBASE_/],\n },\n },\n {\n kind: 'Neon',\n label: 'Neon',\n mode: 'in-cli',\n signals: {\n npm: ['@neondatabase/serverless'],\n envKeys: [/^NEON_/],\n },\n },\n {\n kind: 'PlanetScaleMySQL',\n label: 'PlanetScale MySQL',\n mode: 'in-cli',\n signals: {\n npm: ['@planetscale/database'],\n envKeys: [/^PLANETSCALE_/],\n },\n },\n {\n kind: 'DynamoDB',\n label: 'DynamoDB',\n mode: 'in-cli',\n signals: {\n npm: ['@aws-sdk/client-dynamodb', '@aws-sdk/lib-dynamodb'],\n python: ['pynamodb'],\n },\n },\n {\n kind: 'Motherduck',\n label: 'MotherDuck',\n mode: 'in-cli',\n signals: {\n npm: ['@motherduck/wasm-client'],\n envKeys: [/^MOTHERDUCK_/],\n },\n },\n {\n kind: 'Databricks',\n label: 'Databricks',\n mode: 'in-cli',\n signals: {\n npm: ['@databricks/sql'],\n python: ['databricks-sql-connector', 'databricks-sdk'],\n envKeys: [/^DATABRICKS_/],\n },\n },\n {\n kind: 'Singlestore',\n label: 'SingleStore',\n mode: 'in-cli',\n signals: {\n python: ['singlestoredb'],\n envKeys: [/^SINGLESTORE_/],\n },\n },\n {\n kind: 'Stripe',\n label: 'Stripe',\n mode: 'in-cli',\n signals: {\n npm: ['stripe', '@stripe/stripe-js', '@stripe/react-stripe-js'],\n python: ['stripe'],\n ruby: ['stripe'],\n envKeys: [/^STRIPE_(SECRET|API)_KEY$/],\n },\n },\n {\n kind: 'Clerk',\n label: 'Clerk',\n mode: 'in-cli',\n signals: {\n npm: [\n '@clerk/nextjs',\n '@clerk/clerk-react',\n '@clerk/backend',\n '@clerk/express',\n '@clerk/fastify',\n '@clerk/remix',\n ],\n envKeys: [/^CLERK_SECRET_KEY$/, /^NEXT_PUBLIC_CLERK_/],\n },\n },\n {\n kind: 'Resend',\n label: 'Resend',\n mode: 'in-cli',\n signals: {\n npm: ['resend'],\n python: ['resend'],\n envKeys: [/^RESEND_API_KEY$/],\n },\n },\n {\n kind: 'Shopify',\n label: 'Shopify',\n mode: 'in-cli',\n signals: {\n npm: ['@shopify/shopify-api', 'shopify-api-node'],\n python: ['shopifyapi'],\n envKeys: [/^SHOPIFY_/],\n },\n },\n {\n kind: 'Klaviyo',\n label: 'Klaviyo',\n mode: 'in-cli',\n signals: {\n npm: ['klaviyo-api'],\n python: ['klaviyo-api'],\n envKeys: [/^KLAVIYO_/],\n },\n },\n {\n kind: 'Chargebee',\n label: 'Chargebee',\n mode: 'in-cli',\n signals: {\n npm: ['chargebee'],\n python: ['chargebee'],\n envKeys: [/^CHARGEBEE_/],\n },\n },\n {\n kind: 'Paddle',\n label: 'Paddle',\n mode: 'in-cli',\n signals: {\n npm: ['@paddle/paddle-node-sdk', '@paddle/paddle-js'],\n envKeys: [/^PADDLE_/],\n },\n },\n {\n kind: 'Polar',\n label: 'Polar',\n mode: 'in-cli',\n signals: {\n npm: ['@polar-sh/sdk', '@polar-sh/nextjs'],\n envKeys: [/^POLAR_/],\n },\n },\n {\n kind: 'Mailchimp',\n label: 'Mailchimp',\n mode: 'in-cli',\n signals: {\n npm: ['@mailchimp/mailchimp_marketing'],\n python: ['mailchimp-marketing'],\n envKeys: [/^MAILCHIMP_/],\n },\n },\n {\n kind: 'CustomerIO',\n label: 'Customer.io',\n mode: 'in-cli',\n signals: {\n npm: ['customerio-node'],\n python: ['customerio'],\n envKeys: [/^CUSTOMER_?IO_/],\n },\n },\n {\n kind: 'Typeform',\n label: 'Typeform',\n mode: 'in-cli',\n signals: {\n npm: ['@typeform/api-client'],\n envKeys: [/^TYPEFORM_/],\n },\n },\n {\n kind: 'Sentry',\n label: 'Sentry',\n mode: 'in-cli',\n signals: {\n npm: [\n '@sentry/node',\n '@sentry/browser',\n '@sentry/react',\n '@sentry/nextjs',\n ],\n python: ['sentry-sdk'],\n ruby: ['sentry-ruby'],\n },\n },\n {\n kind: 'Plaid',\n label: 'Plaid',\n mode: 'in-cli',\n signals: {\n npm: ['plaid'],\n python: ['plaid-python', 'plaid'],\n ruby: ['plaid'],\n envKeys: [/^PLAID_/],\n },\n },\n {\n kind: 'Braintree',\n label: 'Braintree',\n mode: 'in-cli',\n signals: {\n npm: ['braintree'],\n python: ['braintree'],\n ruby: ['braintree'],\n envKeys: [/^BRAINTREE_/],\n },\n },\n {\n kind: 'Square',\n label: 'Square',\n mode: 'in-cli',\n signals: {\n npm: ['square'],\n python: ['squareup'],\n ruby: ['square'],\n envKeys: [/^SQUARE_/],\n },\n },\n {\n kind: 'GoCardless',\n label: 'GoCardless',\n mode: 'in-cli',\n signals: {\n npm: ['gocardless-nodejs'],\n python: ['gocardless-pro'],\n ruby: ['gocardless_pro'],\n envKeys: [/^GOCARDLESS_/],\n },\n },\n {\n kind: 'Mollie',\n label: 'Mollie',\n mode: 'in-cli',\n signals: {\n npm: ['@mollie/api-client'],\n python: ['mollie-api-python'],\n envKeys: [/^MOLLIE_/],\n },\n },\n {\n kind: 'CheckoutCom',\n label: 'Checkout.com',\n mode: 'in-cli',\n signals: {\n npm: ['checkout-sdk-node'],\n python: ['checkout-sdk'],\n // Checkout.com's own convention is the CKO_ prefix.\n envKeys: [/^CKO_/, /^CHECKOUT_COM_/],\n },\n },\n {\n kind: 'Recurly',\n label: 'Recurly',\n mode: 'in-cli',\n signals: {\n npm: ['recurly'],\n python: ['recurly'],\n ruby: ['recurly'],\n envKeys: [/^RECURLY_/],\n },\n },\n {\n kind: 'RevenueCat',\n label: 'RevenueCat',\n mode: 'in-cli',\n signals: {\n npm: [\n '@revenuecat/purchases-js',\n 'react-native-purchases',\n '@revenuecat/purchases-capacitor',\n ],\n envKeys: [/^REVENUE_?CAT_/],\n },\n },\n {\n kind: 'Twilio',\n label: 'Twilio',\n mode: 'in-cli',\n signals: {\n npm: ['twilio'],\n python: ['twilio'],\n ruby: ['twilio-ruby'],\n envKeys: [/^TWILIO_/],\n },\n },\n {\n kind: 'SendGrid',\n label: 'SendGrid',\n mode: 'in-cli',\n signals: {\n npm: ['@sendgrid/mail', '@sendgrid/client'],\n python: ['sendgrid'],\n ruby: ['sendgrid-ruby'],\n envKeys: [/^SENDGRID_/],\n },\n },\n {\n kind: 'Mailgun',\n label: 'Mailgun',\n mode: 'in-cli',\n signals: {\n npm: ['mailgun.js', 'mailgun-js'],\n python: ['mailgun'],\n ruby: ['mailgun-ruby'],\n envKeys: [/^MAILGUN_/],\n },\n },\n {\n kind: 'Postmark',\n label: 'Postmark',\n mode: 'in-cli',\n signals: {\n npm: ['postmark'],\n python: ['postmarker'],\n ruby: ['postmark'],\n envKeys: [/^POSTMARK_/],\n },\n },\n {\n kind: 'Brevo',\n label: 'Brevo',\n mode: 'in-cli',\n signals: {\n npm: ['@getbrevo/brevo', 'sib-api-v3-sdk'],\n python: ['sib-api-v3-sdk'],\n envKeys: [/^BREVO_/],\n },\n },\n {\n kind: 'MailerLite',\n label: 'MailerLite',\n mode: 'in-cli',\n signals: {\n npm: ['@mailerlite/mailerlite-nodejs'],\n python: ['mailerlite'],\n envKeys: [/^MAILERLITE_/],\n },\n },\n {\n kind: 'Mailjet',\n label: 'Mailjet',\n mode: 'in-cli',\n signals: {\n npm: ['node-mailjet'],\n python: ['mailjet-rest'],\n // Mailjet's documented env convention is MJ_APIKEY_PUBLIC / *_PRIVATE.\n envKeys: [/^MAILJET_/, /^MJ_APIKEY_/],\n },\n },\n {\n kind: 'LaunchDarkly',\n label: 'LaunchDarkly',\n mode: 'in-cli',\n signals: {\n npm: [\n 'launchdarkly-node-server-sdk',\n '@launchdarkly/node-server-sdk',\n 'launchdarkly-js-client-sdk',\n 'launchdarkly-react-client-sdk',\n ],\n python: ['launchdarkly-server-sdk'],\n ruby: ['launchdarkly-server-sdk'],\n envKeys: [/^LAUNCHDARKLY_/, /^LD_SDK_KEY$/],\n },\n },\n {\n kind: 'Optimizely',\n label: 'Optimizely',\n mode: 'in-cli',\n signals: {\n npm: ['@optimizely/optimizely-sdk'],\n python: ['optimizely-sdk'],\n envKeys: [/^OPTIMIZELY_/],\n },\n },\n {\n kind: 'Braze',\n label: 'Braze',\n mode: 'in-cli',\n signals: {\n npm: ['@braze/web-sdk', '@braze/react-native-sdk'],\n python: ['braze-client'],\n envKeys: [/^BRAZE_/],\n },\n },\n {\n kind: 'Rollbar',\n label: 'Rollbar',\n mode: 'in-cli',\n signals: {\n npm: ['rollbar'],\n python: ['rollbar', 'pyrollbar'],\n ruby: ['rollbar'],\n envKeys: [/^ROLLBAR_/],\n },\n },\n {\n kind: 'Okta',\n label: 'Okta',\n mode: 'in-cli',\n signals: {\n npm: ['@okta/okta-sdk-nodejs', '@okta/okta-auth-js', '@okta/okta-react'],\n python: ['okta'],\n envKeys: [/^OKTA_/],\n },\n },\n {\n kind: 'WorkOS',\n label: 'WorkOS',\n mode: 'in-cli',\n signals: {\n npm: ['@workos-inc/node'],\n python: ['workos'],\n envKeys: [/^WORKOS_/],\n },\n },\n {\n kind: 'Notion',\n label: 'Notion',\n mode: 'in-cli',\n signals: {\n npm: ['@notionhq/client'],\n python: ['notion-client'],\n envKeys: [/^NOTION_/],\n },\n },\n {\n kind: 'FullStory',\n label: 'FullStory',\n mode: 'in-cli',\n signals: {\n npm: ['@fullstory/browser', '@fullstory/react-native'],\n envKeys: [/^FULLSTORY_/],\n },\n },\n {\n kind: 'Amplitude',\n label: 'Amplitude',\n mode: 'in-cli',\n signals: {\n npm: [\n '@amplitude/analytics-browser',\n '@amplitude/analytics-node',\n '@amplitude/analytics-react-native',\n 'amplitude-js',\n ],\n python: ['amplitude-analytics'],\n envKeys: [/^AMPLITUDE_/],\n },\n },\n {\n kind: 'Mixpanel',\n label: 'Mixpanel',\n mode: 'in-cli',\n signals: {\n npm: ['mixpanel', 'mixpanel-browser'],\n python: ['mixpanel'],\n ruby: ['mixpanel-ruby'],\n envKeys: [/^MIXPANEL_/],\n },\n },\n {\n kind: 'Pendo',\n label: 'Pendo',\n mode: 'in-cli',\n signals: {\n npm: ['@pendo/agent'],\n envKeys: [/^PENDO_/],\n },\n },\n {\n kind: 'Salesforce',\n label: 'Salesforce',\n mode: 'deep-link',\n signals: {\n npm: ['jsforce'],\n python: ['simple-salesforce'],\n envKeys: [/^SALESFORCE_/],\n },\n },\n {\n kind: 'Hubspot',\n label: 'HubSpot',\n mode: 'deep-link',\n signals: {\n npm: ['@hubspot/api-client'],\n python: ['hubspot-api-client'],\n envKeys: [/^HUBSPOT_/],\n },\n },\n {\n kind: 'Zendesk',\n label: 'Zendesk',\n mode: 'deep-link',\n signals: {\n npm: ['node-zendesk'],\n python: ['zenpy'],\n envKeys: [/^ZENDESK_/],\n },\n },\n {\n kind: 'Intercom',\n label: 'Intercom',\n mode: 'deep-link',\n signals: {\n npm: ['intercom-client', '@intercom/messenger-js-sdk'],\n python: ['python-intercom'],\n envKeys: [/^INTERCOM_/],\n },\n },\n {\n kind: 'Linear',\n label: 'Linear',\n mode: 'deep-link',\n signals: {\n npm: ['@linear/sdk'],\n envKeys: [/^LINEAR_API_KEY$/],\n },\n },\n {\n // OAuth-only in PostHog (Slack app integration), so deep-link.\n kind: 'Slack',\n label: 'Slack',\n mode: 'deep-link',\n signals: {\n npm: ['@slack/web-api', '@slack/bolt'],\n python: ['slack-sdk', 'slack-bolt'],\n envKeys: [/^SLACK_(BOT|APP|SIGNING|CLIENT)_/],\n },\n },\n {\n // 'Github' (not 'GitHub') — matches the ExternalDataSourceType value.\n // Default auth is the GitHub App integration (OAuth), so deep-link.\n kind: 'Github',\n label: 'GitHub',\n mode: 'deep-link',\n signals: {\n npm: ['@octokit/rest', '@octokit/core', '@octokit/graphql', 'octokit'],\n python: ['pygithub'],\n ruby: ['octokit'],\n },\n },\n];\n\n// ============================================================\n// Additional released source types (see PostHog data-warehouse\n// source catalog). Detected by SDK package or .env key convention.\n// ============================================================\n// ---- LLM / AI ----\nconst LLM_SOURCE_DETECTORS: SourceDetector[] = [\n {\n kind: 'OpenAI',\n label: 'OpenAI',\n mode: 'in-cli',\n signals: {\n npm: ['openai'],\n python: ['openai'],\n envKeys: [/^OPENAI_/],\n },\n },\n {\n kind: 'Anthropic',\n label: 'Anthropic',\n mode: 'in-cli',\n signals: {\n npm: ['@anthropic-ai/sdk'],\n python: ['anthropic'],\n envKeys: [/^ANTHROPIC_/],\n },\n },\n {\n kind: 'Cohere',\n label: 'Cohere',\n mode: 'in-cli',\n signals: {\n npm: ['cohere-ai'],\n python: ['cohere'],\n envKeys: [/^COHERE_/],\n },\n },\n {\n kind: 'MistralAI',\n label: 'Mistral AI',\n mode: 'in-cli',\n signals: {\n npm: ['@mistralai/mistralai'],\n python: ['mistralai'],\n envKeys: [/^MISTRAL_/],\n },\n },\n {\n kind: 'Groq',\n label: 'Groq',\n mode: 'in-cli',\n signals: {\n npm: ['groq-sdk'],\n python: ['groq'],\n envKeys: [/^GROQ_/],\n },\n },\n {\n kind: 'TogetherAI',\n label: 'Together AI',\n mode: 'in-cli',\n signals: {\n npm: ['together-ai'],\n python: ['together'],\n envKeys: [/^TOGETHER_/],\n },\n },\n {\n kind: 'FireworksAI',\n label: 'Fireworks AI',\n mode: 'in-cli',\n signals: {\n python: ['fireworks-ai'],\n envKeys: [/^FIREWORKS_/],\n },\n },\n {\n kind: 'Replicate',\n label: 'Replicate',\n mode: 'in-cli',\n signals: {\n npm: ['replicate'],\n python: ['replicate'],\n envKeys: [/^REPLICATE_/],\n },\n },\n {\n kind: 'HuggingFace',\n label: 'Hugging Face',\n mode: 'in-cli',\n signals: {\n npm: ['@huggingface/inference'],\n python: ['huggingface-hub'],\n envKeys: [/^HUGGINGFACE_/, /^HF_TOKEN$/],\n },\n },\n {\n kind: 'ElevenLabs',\n label: 'ElevenLabs',\n mode: 'in-cli',\n signals: {\n npm: ['@elevenlabs/elevenlabs-js', 'elevenlabs'],\n python: ['elevenlabs'],\n envKeys: [/^ELEVENLABS_/, /^ELEVEN_LABS_/],\n },\n },\n {\n kind: 'Deepgram',\n label: 'Deepgram',\n mode: 'in-cli',\n signals: {\n npm: ['@deepgram/sdk'],\n python: ['deepgram-sdk'],\n envKeys: [/^DEEPGRAM_/],\n },\n },\n {\n kind: 'AssemblyAI',\n label: 'AssemblyAI',\n mode: 'in-cli',\n signals: {\n npm: ['assemblyai'],\n python: ['assemblyai'],\n envKeys: [/^ASSEMBLYAI_/],\n },\n },\n {\n kind: 'Langfuse',\n label: 'Langfuse',\n mode: 'in-cli',\n signals: {\n npm: ['langfuse'],\n python: ['langfuse'],\n envKeys: [/^LANGFUSE_/],\n },\n },\n {\n kind: 'LangSmith',\n label: 'LangSmith',\n mode: 'in-cli',\n signals: {\n npm: ['langsmith'],\n python: ['langsmith'],\n envKeys: [/^LANGSMITH_/, /^LANGCHAIN_API_KEY$/],\n },\n },\n {\n kind: 'Firecrawl',\n label: 'Firecrawl',\n mode: 'in-cli',\n signals: {\n npm: ['@mendable/firecrawl-js'],\n python: ['firecrawl-py'],\n envKeys: [/^FIRECRAWL_/],\n },\n },\n {\n kind: 'Mem0',\n label: 'Mem0',\n mode: 'in-cli',\n signals: {\n npm: ['mem0ai'],\n python: ['mem0ai'],\n envKeys: [/^MEM0_/],\n },\n },\n {\n kind: 'Vellum',\n label: 'Vellum',\n mode: 'in-cli',\n signals: {\n npm: ['vellum-ai'],\n python: ['vellum-ai'],\n envKeys: [/^VELLUM_/],\n },\n },\n {\n kind: 'Helicone',\n label: 'Helicone',\n mode: 'in-cli',\n signals: {\n npm: ['@helicone/helpers'],\n envKeys: [/^HELICONE_/],\n },\n },\n {\n kind: 'OpenRouter',\n label: 'OpenRouter',\n mode: 'in-cli',\n signals: {\n npm: ['@openrouter/ai-sdk-provider'],\n envKeys: [/^OPENROUTER_/],\n },\n },\n {\n kind: 'Browserbase',\n label: 'Browserbase',\n mode: 'in-cli',\n signals: {\n npm: ['@browserbasehq/sdk', '@browserbasehq/stagehand'],\n python: ['browserbase'],\n envKeys: [/^BROWSERBASE_/],\n },\n },\n {\n kind: 'E2B',\n label: 'E2B',\n mode: 'in-cli',\n signals: {\n npm: ['e2b', '@e2b/code-interpreter'],\n python: ['e2b', 'e2b-code-interpreter'],\n envKeys: [/^E2B_/],\n },\n },\n {\n kind: 'WeightsAndBiases',\n label: 'Weights & Biases',\n mode: 'in-cli',\n signals: {\n python: ['wandb'],\n envKeys: [/^WANDB_/],\n },\n },\n {\n kind: 'LlamaCloud',\n label: 'LlamaCloud',\n mode: 'in-cli',\n signals: {\n npm: ['llama-cloud-services'],\n python: ['llama-cloud-services'],\n envKeys: [/^LLAMA_CLOUD_/],\n },\n },\n {\n kind: 'Zep',\n label: 'Zep',\n mode: 'in-cli',\n signals: {\n npm: ['@getzep/zep-cloud'],\n python: ['zep-cloud'],\n envKeys: [/^ZEP_API_KEY$/],\n },\n },\n];\n\nconst OTHER_SOURCE_DETECTORS: SourceDetector[] = [\n // ---- Payments / billing ----\n {\n kind: 'Paystack',\n label: 'Paystack',\n mode: 'in-cli',\n signals: {\n python: ['paystackapi'],\n envKeys: [/^PAYSTACK_/],\n },\n },\n {\n kind: 'Orb',\n label: 'Orb',\n mode: 'in-cli',\n signals: {\n npm: ['orb-billing'],\n python: ['orb-billing'],\n envKeys: [/^ORB_/],\n },\n },\n {\n kind: 'Lago',\n label: 'Lago',\n mode: 'in-cli',\n signals: {\n npm: ['lago-javascript-client'],\n python: ['lago-python-client'],\n envKeys: [/^LAGO_/],\n },\n },\n {\n kind: 'Zuora',\n label: 'Zuora',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ZUORA_/],\n },\n },\n {\n kind: 'Stigg',\n label: 'Stigg',\n mode: 'in-cli',\n signals: {\n npm: ['@stigg/node-server-sdk'],\n envKeys: [/^STIGG_/],\n },\n },\n {\n kind: 'Ramp',\n label: 'Ramp',\n mode: 'in-cli',\n signals: {\n envKeys: [/^RAMP_/],\n },\n },\n {\n kind: 'Brex',\n label: 'Brex',\n mode: 'in-cli',\n signals: {\n envKeys: [/^BREX_/],\n },\n },\n {\n kind: 'Tremendous',\n label: 'Tremendous',\n mode: 'in-cli',\n signals: {\n envKeys: [/^TREMENDOUS_/],\n },\n },\n {\n kind: 'Maxio',\n label: 'Maxio',\n mode: 'in-cli',\n signals: {\n envKeys: [/^MAXIO_/],\n },\n },\n {\n kind: 'Chargify',\n label: 'Chargify',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CHARGIFY_/],\n },\n },\n {\n kind: 'Invoiced',\n label: 'Invoiced',\n mode: 'in-cli',\n signals: {\n npm: ['invoiced'],\n python: ['invoiced'],\n envKeys: [/^INVOICED_/],\n },\n },\n {\n kind: 'LemonSqueezy',\n label: 'Lemon Squeezy',\n mode: 'in-cli',\n signals: {\n npm: ['@lemonsqueezy/lemonsqueezy.js'],\n envKeys: [/^LEMONSQUEEZY_/, /^LEMON_SQUEEZY_/],\n },\n },\n {\n kind: 'Razorpay',\n label: 'Razorpay',\n mode: 'in-cli',\n signals: {\n npm: ['razorpay'],\n python: ['razorpay'],\n ruby: ['razorpay'],\n envKeys: [/^RAZORPAY_/],\n },\n },\n {\n kind: 'Adyen',\n label: 'Adyen',\n mode: 'in-cli',\n signals: {\n npm: ['@adyen/api-library'],\n python: ['adyen'],\n envKeys: [/^ADYEN_/],\n },\n },\n {\n kind: 'ChartMogul',\n label: 'ChartMogul',\n mode: 'in-cli',\n signals: {\n npm: ['chartmogul-node'],\n python: ['chartmogul'],\n envKeys: [/^CHARTMOGUL_/],\n },\n },\n {\n kind: 'Airwallex',\n label: 'Airwallex',\n mode: 'in-cli',\n signals: {\n npm: ['airwallex-payment-elements'],\n envKeys: [/^AIRWALLEX_/],\n },\n },\n {\n kind: 'Flutterwave',\n label: 'Flutterwave',\n mode: 'in-cli',\n signals: {\n npm: ['flutterwave-node-v3'],\n python: ['flutterwave'],\n envKeys: [/^FLUTTERWAVE_/, /^FLW_(PUBLIC|SECRET)_KEY$/],\n },\n },\n {\n kind: 'DodoPayments',\n label: 'Dodo Payments',\n mode: 'in-cli',\n signals: {\n npm: ['dodopayments'],\n python: ['dodopayments'],\n envKeys: [/^DODO_PAYMENTS_/],\n },\n },\n {\n kind: 'Whop',\n label: 'Whop',\n mode: 'in-cli',\n signals: {\n npm: ['@whop/api', '@whop-apps/sdk'],\n envKeys: [/^WHOP_/],\n },\n },\n // ---- Email / marketing ----\n {\n kind: 'SparkPost',\n label: 'SparkPost',\n mode: 'in-cli',\n signals: {\n npm: ['sparkpost'],\n python: ['sparkpost'],\n envKeys: [/^SPARKPOST_/],\n },\n },\n {\n kind: 'MailerSend',\n label: 'MailerSend',\n mode: 'in-cli',\n signals: {\n npm: ['mailersend'],\n python: ['mailersend'],\n envKeys: [/^MAILERSEND_/],\n },\n },\n {\n kind: 'Iterable',\n label: 'Iterable',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ITERABLE_/],\n },\n },\n {\n kind: 'ConvertKit',\n label: 'ConvertKit',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CONVERTKIT_/],\n },\n },\n {\n kind: 'Drip',\n label: 'Drip',\n mode: 'in-cli',\n signals: {\n npm: ['drip-nodejs'],\n envKeys: [/^DRIP_/],\n },\n },\n {\n kind: 'Omnisend',\n label: 'Omnisend',\n mode: 'in-cli',\n signals: {\n envKeys: [/^OMNISEND_/],\n },\n },\n {\n kind: 'EmailOctopus',\n label: 'EmailOctopus',\n mode: 'in-cli',\n signals: {\n envKeys: [/^EMAILOCTOPUS_/, /^EMAIL_OCTOPUS_/],\n },\n },\n {\n kind: 'Elasticemail',\n label: 'Elastic Email',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ELASTICEMAIL_/, /^ELASTIC_EMAIL_/],\n },\n },\n {\n kind: 'CampaignMonitor',\n label: 'Campaign Monitor',\n mode: 'in-cli',\n signals: {\n npm: ['createsend-node'],\n envKeys: [/^CAMPAIGN_MONITOR_/, /^CREATESEND_/],\n },\n },\n {\n kind: 'Lemlist',\n label: 'Lemlist',\n mode: 'in-cli',\n signals: {\n envKeys: [/^LEMLIST_/],\n },\n },\n {\n kind: 'Loops',\n label: 'Loops',\n mode: 'in-cli',\n signals: {\n npm: ['loops'],\n envKeys: [/^LOOPS_/],\n },\n },\n {\n kind: 'Knock',\n label: 'Knock',\n mode: 'in-cli',\n signals: {\n npm: ['@knocklabs/node', '@knocklabs/client'],\n python: ['knockapi'],\n envKeys: [/^KNOCK_/],\n },\n },\n {\n kind: 'AwsSes',\n label: 'Amazon SES',\n mode: 'in-cli',\n signals: {\n npm: ['@aws-sdk/client-ses', '@aws-sdk/client-sesv2'],\n // A bare /^AWS_/ would fire on every AWS project, so we match only\n // the SES-specific prefix.\n envKeys: [/^AWS_SES_/],\n },\n },\n {\n kind: 'Beehiiv',\n label: 'beehiiv',\n mode: 'in-cli',\n signals: {\n envKeys: [/^BEEHIIV_/],\n },\n },\n {\n kind: 'Mailtrap',\n label: 'Mailtrap',\n mode: 'in-cli',\n signals: {\n npm: ['mailtrap'],\n python: ['mailtrap'],\n envKeys: [/^MAILTRAP_/],\n },\n },\n {\n kind: 'Plunk',\n label: 'Plunk',\n mode: 'in-cli',\n signals: {\n npm: ['@plunk/node'],\n envKeys: [/^PLUNK_/],\n },\n },\n {\n kind: 'Ortto',\n label: 'Ortto',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ORTTO_/],\n },\n },\n {\n kind: 'Postscript',\n label: 'Postscript',\n mode: 'in-cli',\n signals: {\n envKeys: [/^POSTSCRIPT_/],\n },\n },\n {\n kind: 'Marketo',\n label: 'Marketo',\n mode: 'in-cli',\n signals: {\n python: ['marketorestpython'],\n envKeys: [/^MARKETO_/],\n },\n },\n {\n kind: 'Lob',\n label: 'Lob',\n mode: 'in-cli',\n signals: {\n npm: ['lob'],\n python: ['lob'],\n envKeys: [/^LOB_API_KEY$/],\n },\n },\n // ---- Product analytics / CDP ----\n {\n kind: 'Segment',\n label: 'Segment',\n mode: 'in-cli',\n signals: {\n npm: ['@segment/analytics-node', 'analytics-node'],\n python: ['segment-analytics-python', 'analytics-python'],\n envKeys: [/^SEGMENT_/],\n },\n },\n {\n kind: 'Snowplow',\n label: 'Snowplow Analytics',\n mode: 'in-cli',\n signals: {\n npm: ['@snowplow/node-tracker'],\n python: ['snowplow-tracker'],\n envKeys: [/^SNOWPLOW_/],\n },\n },\n {\n kind: 'Matomo',\n label: 'Matomo',\n mode: 'in-cli',\n signals: {\n npm: ['matomo-tracker'],\n envKeys: [/^MATOMO_/],\n },\n },\n {\n kind: 'Plausible',\n label: 'Plausible',\n mode: 'in-cli',\n signals: {\n npm: ['plausible-tracker'],\n envKeys: [/^PLAUSIBLE_/],\n },\n },\n // ---- Feature flags / experimentation ----\n {\n kind: 'ConfigCat',\n label: 'ConfigCat',\n mode: 'in-cli',\n signals: {\n npm: ['configcat-node', 'configcat-js'],\n python: ['configcat-client'],\n envKeys: [/^CONFIGCAT_/],\n },\n },\n {\n kind: 'Flagsmith',\n label: 'Flagsmith',\n mode: 'in-cli',\n signals: {\n npm: ['flagsmith-nodejs', 'flagsmith'],\n python: ['flagsmith'],\n envKeys: [/^FLAGSMITH_/],\n },\n },\n {\n kind: 'Unleash',\n label: 'Unleash',\n mode: 'in-cli',\n signals: {\n npm: ['unleash-client'],\n python: ['unleashclient'],\n envKeys: [/^UNLEASH_/],\n },\n },\n {\n kind: 'SplitIo',\n label: 'Split.io',\n mode: 'in-cli',\n signals: {\n npm: ['@splitsoftware/splitio'],\n python: ['splitio-client'],\n envKeys: [/^SPLITIO_/, /^SPLIT_IO_/],\n },\n },\n // ---- Auth / secrets ----\n {\n kind: 'Stytch',\n label: 'Stytch',\n mode: 'in-cli',\n signals: {\n npm: ['stytch'],\n python: ['stytch'],\n envKeys: [/^STYTCH_/],\n },\n },\n {\n kind: 'Doppler',\n label: 'Doppler',\n mode: 'in-cli',\n signals: {\n npm: ['@dopplerhq/node-sdk'],\n envKeys: [/^DOPPLER_/],\n },\n },\n {\n kind: 'Infisical',\n label: 'Infisical',\n mode: 'in-cli',\n signals: {\n npm: ['@infisical/sdk'],\n python: ['infisicalsdk'],\n envKeys: [/^INFISICAL_/],\n },\n },\n {\n kind: 'OnePassword',\n label: '1Password',\n mode: 'in-cli',\n signals: {\n npm: ['@1password/sdk'],\n python: ['onepassword-sdk'],\n envKeys: [/^ONEPASSWORD_/, /^OP_SERVICE_ACCOUNT_TOKEN$/],\n },\n },\n {\n kind: 'Persona',\n label: 'Persona',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PERSONA_/],\n },\n },\n // ---- Comms / webhooks / voice ----\n {\n kind: 'Svix',\n label: 'Svix',\n mode: 'in-cli',\n signals: {\n npm: ['svix'],\n python: ['svix'],\n envKeys: [/^SVIX_/],\n },\n },\n {\n kind: 'Mux',\n label: 'Mux',\n mode: 'in-cli',\n signals: {\n npm: ['@mux/mux-node'],\n python: ['mux-python'],\n envKeys: [/^MUX_/],\n },\n },\n {\n kind: 'Vapi',\n label: 'Vapi',\n mode: 'in-cli',\n signals: {\n npm: ['@vapi-ai/server-sdk'],\n python: ['vapi-server-sdk'],\n envKeys: [/^VAPI_/],\n },\n },\n {\n kind: 'Aircall',\n label: 'Aircall',\n mode: 'in-cli',\n signals: {\n envKeys: [/^AIRCALL_/],\n },\n },\n {\n kind: 'JustCall',\n label: 'JustCall',\n mode: 'in-cli',\n signals: {\n envKeys: [/^JUSTCALL_/],\n },\n },\n {\n kind: 'Telnyx',\n label: 'Telnyx',\n mode: 'in-cli',\n signals: {\n npm: ['telnyx'],\n python: ['telnyx'],\n envKeys: [/^TELNYX_/],\n },\n },\n {\n kind: 'Plivo',\n label: 'Plivo',\n mode: 'in-cli',\n signals: {\n npm: ['plivo'],\n python: ['plivo'],\n envKeys: [/^PLIVO_/],\n },\n },\n {\n kind: 'Courier',\n label: 'Courier',\n mode: 'in-cli',\n signals: {\n npm: ['@trycourier/courier'],\n python: ['trycourier'],\n // COURIER_ is a generic shipping word, so we match the exact key.\n envKeys: [/^COURIER_AUTH_TOKEN$/],\n },\n },\n // ---- E-commerce / logistics ----\n {\n kind: 'WooCommerce',\n label: 'WooCommerce',\n mode: 'in-cli',\n signals: {\n npm: ['@woocommerce/woocommerce-rest-api'],\n python: ['woocommerce'],\n envKeys: [/^WOOCOMMERCE_/],\n },\n },\n {\n kind: 'Recharge',\n label: 'Recharge',\n mode: 'in-cli',\n signals: {\n envKeys: [/^RECHARGE_/],\n },\n },\n {\n kind: 'Commercetools',\n label: 'commercetools',\n mode: 'in-cli',\n signals: {\n npm: ['@commercetools/platform-sdk'],\n python: ['commercetools'],\n envKeys: [/^CTP_/, /^COMMERCETOOLS_/],\n },\n },\n {\n kind: 'Webflow',\n label: 'Webflow',\n mode: 'in-cli',\n signals: {\n npm: ['webflow-api'],\n envKeys: [/^WEBFLOW_/],\n },\n },\n {\n kind: 'Easypost',\n label: 'EasyPost',\n mode: 'in-cli',\n signals: {\n npm: ['@easypost/api'],\n python: ['easypost'],\n envKeys: [/^EASYPOST_/],\n },\n },\n {\n kind: 'Shippo',\n label: 'Shippo',\n mode: 'in-cli',\n signals: {\n npm: ['shippo'],\n python: ['shippo'],\n envKeys: [/^SHIPPO_/],\n },\n },\n {\n kind: 'ShipStation',\n label: 'ShipStation',\n mode: 'in-cli',\n signals: {\n envKeys: [/^SHIPSTATION_/],\n },\n },\n {\n kind: 'Squarespace',\n label: 'Squarespace',\n mode: 'in-cli',\n signals: {\n envKeys: [/^SQUARESPACE_/],\n },\n },\n {\n kind: 'Printify',\n label: 'Printify',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PRINTIFY_/],\n },\n },\n {\n kind: 'BigCommerce',\n label: 'BigCommerce',\n mode: 'in-cli',\n signals: {\n npm: ['node-bigcommerce'],\n envKeys: [/^BIGCOMMERCE_/],\n },\n },\n // ---- Support / helpdesk ----\n {\n kind: 'Freshdesk',\n label: 'Freshdesk',\n mode: 'in-cli',\n signals: {\n python: ['python-freshdesk'],\n envKeys: [/^FRESHDESK_/],\n },\n },\n {\n kind: 'Front',\n label: 'Front',\n mode: 'in-cli',\n signals: {\n envKeys: [/^FRONTAPP_/, /^FRONT_API_/],\n },\n },\n {\n kind: 'Gorgias',\n label: 'Gorgias',\n mode: 'in-cli',\n signals: {\n envKeys: [/^GORGIAS_/],\n },\n },\n {\n kind: 'Chatwoot',\n label: 'Chatwoot',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CHATWOOT_/],\n },\n },\n {\n kind: 'Kustomer',\n label: 'Kustomer',\n mode: 'in-cli',\n signals: {\n envKeys: [/^KUSTOMER_/],\n },\n },\n {\n kind: 'Plain',\n label: 'Plain',\n mode: 'in-cli',\n signals: {\n npm: ['@team-plain/typescript-sdk'],\n envKeys: [/^PLAIN_/],\n },\n },\n {\n kind: 'Canny',\n label: 'Canny',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CANNY_/],\n },\n },\n {\n kind: 'Pylon',\n label: 'Pylon',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PYLON_/],\n },\n },\n // ---- Dev / infra / observability ----\n {\n kind: 'GitLab',\n label: 'GitLab',\n mode: 'in-cli',\n signals: {\n npm: ['@gitbeaker/rest'],\n python: ['python-gitlab'],\n ruby: ['gitlab'],\n envKeys: [/^GITLAB_/],\n },\n },\n {\n kind: 'Bitbucket',\n label: 'Atlassian Bitbucket Cloud',\n mode: 'in-cli',\n signals: {\n npm: ['bitbucket'],\n envKeys: [/^BITBUCKET_/],\n },\n },\n {\n kind: 'Gitea',\n label: 'Gitea',\n mode: 'in-cli',\n signals: {\n npm: ['gitea-js'],\n envKeys: [/^GITEA_/],\n },\n },\n {\n kind: 'Datadog',\n label: 'Datadog',\n mode: 'in-cli',\n signals: {\n npm: ['@datadog/datadog-api-client', 'dd-trace'],\n python: ['datadog', 'datadog-api-client'],\n ruby: ['dogapi'],\n envKeys: [/^DATADOG_/, /^DD_API_KEY$/, /^DD_APP_KEY$/],\n },\n },\n {\n kind: 'NewRelic',\n label: 'New Relic',\n mode: 'in-cli',\n signals: {\n npm: ['newrelic'],\n python: ['newrelic'],\n ruby: ['newrelic_rpm'],\n envKeys: [/^NEW_RELIC_/, /^NEWRELIC_/],\n },\n },\n {\n kind: 'Cloudflare',\n label: 'Cloudflare',\n mode: 'in-cli',\n signals: {\n npm: ['cloudflare'],\n python: ['cloudflare'],\n envKeys: [/^CLOUDFLARE_/, /^CF_API_TOKEN$/],\n },\n },\n {\n kind: 'Elasticsearch',\n label: 'Elasticsearch',\n mode: 'in-cli',\n signals: {\n npm: ['@elastic/elasticsearch'],\n python: ['elasticsearch'],\n ruby: ['elasticsearch'],\n envKeys: [/^ELASTICSEARCH_/],\n },\n },\n {\n kind: 'Snyk',\n label: 'Snyk',\n mode: 'in-cli',\n signals: {\n npm: ['snyk'],\n python: ['pysnyk'],\n envKeys: [/^SNYK_/],\n },\n },\n {\n kind: 'PagerDuty',\n label: 'PagerDuty',\n mode: 'in-cli',\n signals: {\n npm: ['@pagerduty/pdjs'],\n python: ['pdpyras'],\n envKeys: [/^PAGERDUTY_/, /^PD_API_KEY$/],\n },\n },\n {\n kind: 'Opsgenie',\n label: 'Opsgenie',\n mode: 'in-cli',\n signals: {\n envKeys: [/^OPSGENIE_/],\n },\n },\n {\n kind: 'IncidentIo',\n label: 'incident.io',\n mode: 'in-cli',\n signals: {\n envKeys: [/^INCIDENT_IO_/, /^INCIDENTIO_/],\n },\n },\n {\n kind: 'Bugsnag',\n label: 'Bugsnag',\n mode: 'in-cli',\n signals: {\n npm: ['@bugsnag/js'],\n python: ['bugsnag'],\n ruby: ['bugsnag'],\n envKeys: [/^BUGSNAG_/],\n },\n },\n {\n kind: 'Honeybadger',\n label: 'Honeybadger',\n mode: 'in-cli',\n signals: {\n npm: ['@honeybadger-io/js'],\n python: ['honeybadger'],\n ruby: ['honeybadger'],\n envKeys: [/^HONEYBADGER_/],\n },\n },\n {\n kind: 'Raygun',\n label: 'Raygun',\n mode: 'in-cli',\n signals: {\n npm: ['raygun'],\n python: ['raygun4py'],\n ruby: ['raygun4ruby'],\n envKeys: [/^RAYGUN_/],\n },\n },\n {\n kind: 'CircleCI',\n label: 'CircleCI',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CIRCLECI_/, /^CIRCLE_TOKEN$/],\n },\n },\n {\n kind: 'Upstash',\n label: 'Upstash',\n mode: 'in-cli',\n signals: {\n npm: ['@upstash/redis'],\n python: ['upstash-redis'],\n envKeys: [/^UPSTASH_/],\n },\n },\n {\n kind: 'Vercel',\n label: 'Vercel',\n mode: 'in-cli',\n signals: {\n npm: ['@vercel/sdk'],\n envKeys: [/^VERCEL_API_TOKEN$/],\n },\n },\n {\n kind: 'Algolia',\n label: 'Algolia',\n mode: 'in-cli',\n signals: {\n npm: ['algoliasearch'],\n python: ['algoliasearch'],\n ruby: ['algolia'],\n envKeys: [/^ALGOLIA_/],\n },\n },\n {\n kind: 'Inngest',\n label: 'Inngest',\n mode: 'in-cli',\n signals: {\n npm: ['inngest'],\n python: ['inngest'],\n envKeys: [/^INNGEST_/],\n },\n },\n {\n kind: 'TriggerDev',\n label: 'Trigger.dev',\n mode: 'in-cli',\n signals: {\n npm: ['@trigger.dev/sdk'],\n // TRIGGER_ alone is a common app-domain prefix, so we match only the\n // three keys Trigger.dev actually documents.\n envKeys: [/^TRIGGER_(SECRET_KEY|API_KEY|PROJECT_ID)$/],\n },\n },\n {\n kind: 'Ably',\n label: 'Ably',\n mode: 'in-cli',\n signals: {\n npm: ['ably'],\n python: ['ably'],\n envKeys: [/^ABLY_/],\n },\n },\n {\n kind: 'Netlify',\n label: 'Netlify',\n mode: 'in-cli',\n signals: {\n npm: ['@netlify/functions'],\n envKeys: [/^NETLIFY_/],\n },\n },\n {\n kind: 'Railway',\n label: 'Railway',\n mode: 'in-cli',\n signals: {\n envKeys: [/^RAILWAY_/],\n },\n },\n {\n kind: 'Render',\n label: 'Render',\n mode: 'in-cli',\n signals: {\n // RENDER_ is a generic word in front-end code — exact key only.\n envKeys: [/^RENDER_API_KEY$/],\n },\n },\n {\n kind: 'FlyIo',\n label: 'Fly.io',\n mode: 'in-cli',\n signals: {\n // `fly.toml` is not one of the manifests we read, so env keys are the\n // only signal available.\n envKeys: [/^FLY_API_TOKEN$/, /^FLY_APP_NAME$/],\n },\n },\n {\n kind: 'Heroku',\n label: 'Heroku',\n mode: 'in-cli',\n signals: {\n envKeys: [/^HEROKU_/],\n },\n },\n {\n kind: 'DigitalOcean',\n label: 'DigitalOcean',\n mode: 'in-cli',\n signals: {\n // DO_ is too short to be safe, so we match the full product name.\n envKeys: [/^DIGITALOCEAN_/],\n },\n },\n {\n kind: 'Grafana',\n label: 'Grafana',\n mode: 'in-cli',\n signals: {\n python: ['grafana-client'],\n envKeys: [/^GRAFANA_/],\n },\n },\n {\n kind: 'BetterStack',\n label: 'Better Stack',\n mode: 'in-cli',\n signals: {\n // Logtail is Better Stack's log product — same account, same source.\n npm: ['@logtail/node', '@logtail/js'],\n envKeys: [/^BETTERSTACK_/, /^BETTER_STACK_/, /^LOGTAIL_/],\n },\n },\n {\n kind: 'Honeycomb',\n label: 'Honeycomb',\n mode: 'in-cli',\n signals: {\n npm: ['@honeycombio/opentelemetry-node', 'honeycomb-beeline'],\n python: ['honeycomb-beeline', 'libhoney'],\n envKeys: [/^HONEYCOMB_/],\n },\n },\n {\n kind: 'Descope',\n label: 'Descope',\n mode: 'in-cli',\n signals: {\n npm: ['@descope/node-sdk', '@descope/nextjs-sdk', '@descope/react-sdk'],\n python: ['descope'],\n envKeys: [/^DESCOPE_/],\n },\n },\n {\n kind: 'FusionAuth',\n label: 'FusionAuth',\n mode: 'in-cli',\n signals: {\n npm: ['@fusionauth/typescript-client'],\n python: ['fusionauth-client'],\n envKeys: [/^FUSIONAUTH_/, /^FUSION_AUTH_/],\n },\n },\n {\n kind: 'Hookdeck',\n label: 'Hookdeck',\n mode: 'in-cli',\n signals: {\n npm: ['@hookdeck/sdk'],\n envKeys: [/^HOOKDECK_/],\n },\n },\n {\n kind: 'N8n',\n label: 'n8n',\n mode: 'in-cli',\n signals: {\n npm: ['n8n'],\n envKeys: [/^N8N_/],\n },\n },\n {\n kind: 'Dbt',\n label: 'dbt',\n mode: 'in-cli',\n signals: {\n // NOTE: these signals prove the project uses dbt, not that it uses dbt\n // Cloud — the source needs dbt Cloud credentials. Local-only dbt users\n // are a known false positive.\n python: [\n 'dbt-core',\n 'dbt-snowflake',\n 'dbt-postgres',\n 'dbt-bigquery',\n 'dbt-redshift',\n 'dbt-databricks',\n ],\n envKeys: [/^DBT_/],\n },\n },\n {\n kind: 'Fastly',\n label: 'Fastly',\n mode: 'in-cli',\n signals: {\n npm: ['fastly'],\n python: ['fastly'],\n envKeys: [/^FASTLY_/],\n },\n },\n {\n kind: 'Bunny',\n label: 'Bunny.net',\n mode: 'in-cli',\n signals: {\n envKeys: [/^BUNNY_/],\n },\n },\n {\n kind: 'Codecov',\n label: 'Codecov',\n mode: 'in-cli',\n signals: {\n npm: ['codecov'],\n envKeys: [/^CODECOV_/],\n },\n },\n {\n kind: 'Sourcegraph',\n label: 'Sourcegraph',\n mode: 'in-cli',\n signals: {\n envKeys: [/^SOURCEGRAPH_/, /^SRC_ACCESS_TOKEN$/],\n },\n },\n {\n kind: 'TemporalIO',\n label: 'Temporal.io',\n mode: 'in-cli',\n signals: {\n // NOTE: these signals also match a self-hosted Temporal cluster, but the\n // source wants Temporal Cloud mTLS certificates.\n npm: ['@temporalio/client', '@temporalio/worker'],\n python: ['temporalio'],\n envKeys: [/^TEMPORAL_/],\n },\n },\n {\n kind: 'Hatchet',\n label: 'Hatchet',\n mode: 'in-cli',\n signals: {\n npm: ['@hatchet-dev/typescript-sdk'],\n python: ['hatchet-sdk'],\n envKeys: [/^HATCHET_/],\n },\n },\n // ---- CRM / sales ----\n {\n kind: 'Pipedrive',\n label: 'Pipedrive',\n mode: 'in-cli',\n signals: {\n npm: ['pipedrive'],\n envKeys: [/^PIPEDRIVE_/],\n },\n },\n {\n kind: 'Close',\n label: 'Close',\n mode: 'in-cli',\n signals: {\n python: ['closeio'],\n envKeys: [/^CLOSE_API_KEY$/],\n },\n },\n {\n kind: 'Copper',\n label: 'Copper',\n mode: 'in-cli',\n signals: {\n envKeys: [/^COPPER_/],\n },\n },\n {\n kind: 'Insightly',\n label: 'Insightly',\n mode: 'in-cli',\n signals: {\n envKeys: [/^INSIGHTLY_/],\n },\n },\n {\n kind: 'Salesflare',\n label: 'Salesflare',\n mode: 'in-cli',\n signals: {\n envKeys: [/^SALESFLARE_/],\n },\n },\n {\n kind: 'SalesLoft',\n label: 'Salesloft',\n mode: 'in-cli',\n signals: {\n envKeys: [/^SALESLOFT_/],\n },\n },\n {\n kind: 'Attio',\n label: 'Attio',\n mode: 'in-cli',\n signals: {\n npm: ['attio'],\n envKeys: [/^ATTIO_/],\n },\n },\n {\n kind: 'ActiveCampaign',\n label: 'ActiveCampaign',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ACTIVECAMPAIGN_/, /^ACTIVE_CAMPAIGN_/],\n },\n },\n {\n kind: 'Vitally',\n label: 'Vitally',\n mode: 'in-cli',\n signals: {\n envKeys: [/^VITALLY_/],\n },\n },\n {\n kind: 'Docusign',\n label: 'DocuSign',\n mode: 'in-cli',\n signals: {\n npm: ['docusign-esign'],\n python: ['docusign-esign'],\n envKeys: [/^DOCUSIGN_/],\n },\n },\n {\n kind: 'PandaDoc',\n label: 'PandaDoc',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PANDADOC_/],\n },\n },\n {\n kind: 'Gong',\n label: 'Gong',\n mode: 'in-cli',\n signals: {\n envKeys: [/^GONG_/],\n },\n },\n // ---- PM / productivity ----\n {\n kind: 'Asana',\n label: 'Asana',\n mode: 'in-cli',\n signals: {\n npm: ['asana'],\n python: ['asana'],\n envKeys: [/^ASANA_/],\n },\n },\n {\n kind: 'Trello',\n label: 'Trello',\n mode: 'in-cli',\n signals: {\n npm: ['trello'],\n envKeys: [/^TRELLO_/],\n },\n },\n {\n kind: 'Todoist',\n label: 'Todoist',\n mode: 'in-cli',\n signals: {\n npm: ['@doist/todoist-api-typescript'],\n python: ['todoist-api-python'],\n envKeys: [/^TODOIST_/],\n },\n },\n {\n kind: 'Monday',\n label: 'monday.com',\n mode: 'in-cli',\n signals: {\n npm: ['@mondaydotcomorg/api'],\n envKeys: [/^MONDAY_/],\n },\n },\n {\n kind: 'ClickUp',\n label: 'ClickUp',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CLICKUP_/],\n },\n },\n {\n kind: 'Height',\n label: 'Height',\n mode: 'in-cli',\n signals: {\n envKeys: [/^HEIGHT_API_KEY$/],\n },\n },\n {\n kind: 'Shortcut',\n label: 'Shortcut',\n mode: 'in-cli',\n signals: {\n npm: ['@shortcut/client'],\n envKeys: [/^SHORTCUT_/],\n },\n },\n {\n kind: 'Jira',\n label: 'Jira',\n mode: 'in-cli',\n signals: {\n npm: ['jira-client'],\n python: ['jira', 'atlassian-python-api'],\n envKeys: [/^JIRA_/],\n },\n },\n {\n kind: 'Confluence',\n label: 'Confluence',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CONFLUENCE_/],\n },\n },\n {\n kind: 'Airtable',\n label: 'Airtable',\n mode: 'in-cli',\n signals: {\n npm: ['airtable'],\n python: ['pyairtable'],\n envKeys: [/^AIRTABLE_/],\n },\n },\n {\n kind: 'Smartsheet',\n label: 'Smartsheet',\n mode: 'in-cli',\n signals: {\n npm: ['smartsheet'],\n python: ['smartsheet-python-sdk'],\n envKeys: [/^SMARTSHEET_/],\n },\n },\n {\n kind: 'Coda',\n label: 'Coda',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CODA_API_/],\n },\n },\n {\n kind: 'Productboard',\n label: 'Productboard',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PRODUCTBOARD_/],\n },\n },\n {\n kind: 'GoogleSheets',\n label: 'Google Sheets',\n mode: 'in-cli',\n signals: {\n npm: ['google-spreadsheet'],\n python: ['gspread'],\n envKeys: [/^GOOGLE_SHEETS_/],\n },\n },\n {\n kind: 'Formbricks',\n label: 'Formbricks',\n mode: 'in-cli',\n signals: {\n npm: ['@formbricks/js'],\n envKeys: [/^FORMBRICKS_/],\n },\n },\n {\n kind: 'Tally',\n label: 'Tally',\n mode: 'in-cli',\n signals: {\n // Tally is also an accounting product, so we match the exact key.\n envKeys: [/^TALLY_API_KEY$/],\n },\n },\n {\n kind: 'Jotform',\n label: 'Jotform',\n mode: 'in-cli',\n signals: {\n python: ['jotform'],\n envKeys: [/^JOTFORM_/],\n },\n },\n {\n kind: 'GitBook',\n label: 'GitBook',\n mode: 'in-cli',\n signals: {\n npm: ['@gitbook/api'],\n envKeys: [/^GITBOOK_/],\n },\n },\n {\n kind: 'Wordpress',\n label: 'WordPress',\n mode: 'in-cli',\n signals: {\n // NOTE: recall is low here. Most WordPress projects are PHP, and\n // `composer.json` is not one of the manifests we read.\n npm: ['wpapi'],\n envKeys: [/^WORDPRESS_/],\n },\n },\n {\n kind: 'Clockify',\n label: 'Clockify',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CLOCKIFY_/],\n },\n },\n // ---- Scheduling / events ----\n {\n kind: 'Calendly',\n label: 'Calendly',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CALENDLY_/],\n },\n },\n {\n kind: 'CalCom',\n label: 'Cal.com',\n mode: 'in-cli',\n signals: {\n envKeys: [/^CALCOM_/, /^CAL_API_KEY$/],\n },\n },\n {\n kind: 'Eventbrite',\n label: 'Eventbrite',\n mode: 'in-cli',\n signals: {\n python: ['eventbrite'],\n envKeys: [/^EVENTBRITE_/],\n },\n },\n // ---- HR / people ----\n {\n kind: 'BambooHR',\n label: 'BambooHR',\n mode: 'in-cli',\n signals: {\n python: ['pybamboohr'],\n envKeys: [/^BAMBOOHR_/, /^BAMBOO_HR_/],\n },\n },\n {\n kind: 'Personio',\n label: 'Personio',\n mode: 'in-cli',\n signals: {\n envKeys: [/^PERSONIO_/],\n },\n },\n {\n kind: 'Rippling',\n label: 'Rippling',\n mode: 'in-cli',\n signals: {\n envKeys: [/^RIPPLING_/],\n },\n },\n {\n kind: 'Greenhouse',\n label: 'Greenhouse',\n mode: 'in-cli',\n signals: {\n envKeys: [/^GREENHOUSE_/],\n },\n },\n {\n kind: 'Ashby',\n label: 'Ashby',\n mode: 'in-cli',\n signals: {\n envKeys: [/^ASHBY_/],\n },\n },\n {\n kind: 'Workable',\n label: 'Workable',\n mode: 'in-cli',\n signals: {\n envKeys: [/^WORKABLE_/],\n },\n },\n // ---- Ads / marketing analytics (OAuth-first -> deep-link) ----\n {\n kind: 'GoogleAds',\n label: 'Google Ads',\n mode: 'deep-link',\n signals: {\n npm: ['google-ads-api'],\n python: ['google-ads'],\n envKeys: [/^GOOGLE_ADS_/],\n },\n },\n {\n kind: 'MetaAds',\n label: 'Meta Ads',\n mode: 'deep-link',\n signals: {\n npm: ['facebook-nodejs-business-sdk'],\n python: ['facebook-business'],\n envKeys: [/^META_ADS_/, /^FACEBOOK_ADS_/],\n },\n },\n {\n kind: 'LinkedinAds',\n label: 'LinkedIn Ads',\n mode: 'deep-link',\n signals: {\n envKeys: [/^LINKEDIN_ADS_/],\n },\n },\n {\n kind: 'TikTokAds',\n label: 'TikTok Ads',\n mode: 'deep-link',\n signals: {\n envKeys: [/^TIKTOK_ADS_/],\n },\n },\n {\n kind: 'RedditAds',\n label: 'Reddit Ads',\n mode: 'deep-link',\n signals: {\n envKeys: [/^REDDIT_ADS_/],\n },\n },\n {\n kind: 'PinterestAds',\n label: 'Pinterest Ads',\n mode: 'deep-link',\n signals: {\n envKeys: [/^PINTEREST_ADS_/],\n },\n },\n {\n kind: 'BingAds',\n label: 'Bing Ads',\n mode: 'deep-link',\n signals: {\n python: ['bingads'],\n envKeys: [/^BING_ADS_/, /^MICROSOFT_ADS_/],\n },\n },\n {\n kind: 'AmazonAds',\n label: 'Amazon Ads',\n mode: 'deep-link',\n signals: {\n envKeys: [/^AMAZON_ADS_/],\n },\n },\n {\n kind: 'GoogleAnalytics',\n label: 'Google Analytics',\n mode: 'deep-link',\n signals: {\n npm: ['react-ga4'],\n python: ['google-analytics-data'],\n envKeys: [/^GOOGLE_ANALYTICS_/, /^GA4_/],\n },\n },\n {\n kind: 'GoogleSearchConsole',\n label: 'Google Search Console',\n mode: 'deep-link',\n signals: {\n envKeys: [/^SEARCH_CONSOLE_/, /^GSC_/],\n },\n },\n {\n kind: 'AppsFlyer',\n label: 'AppsFlyer',\n mode: 'in-cli',\n signals: {\n npm: ['react-native-appsflyer'],\n envKeys: [/^APPSFLYER_/],\n },\n },\n {\n kind: 'Dub',\n label: 'Dub',\n mode: 'in-cli',\n signals: {\n npm: ['dub'],\n python: ['dub'],\n envKeys: [/^DUB_API_KEY$/],\n },\n },\n];\n\nexport const SOURCE_DETECTORS: SourceDetector[] = [\n ...CORE_SOURCE_DETECTORS,\n ...LLM_SOURCE_DETECTORS,\n ...OTHER_SOURCE_DETECTORS,\n];\n\n/** Kinds from the LLM / AI section above — the only ones that may set `wizard_ai_sdk_detected`. */\nexport const AI_SOURCE_KINDS: ReadonlySet<string> = new Set(\n LLM_SOURCE_DETECTORS.map((detector) => detector.kind),\n);\n","/**\n * Data warehouse source detection.\n *\n * Scans a project for codebase signals (npm/python/ruby deps, `.env` key\n * names) and matches them against the `SOURCE_DETECTORS` registry. Pure\n * function: no store mutations, no UI calls. Reads files locally — only the\n * wizard process does this; the agent never sees secret values.\n *\n * Note we only read `.env` KEY NAMES, never values.\n */\n\nimport { analytics } from '@utils/analytics';\nimport { walkProjectFiles, safeReadFile } from '@utils/bounded-fs';\nimport {\n ENV_SCAN_MAX_DEPTH,\n MAX_ENV_KEY_SET,\n isEnvFileName,\n parseEnvKeyNames,\n toPromptSafeRelativePath,\n} from '@utils/env-scan';\nimport type { PackageJson } from '@utils/package-json';\nimport {\n parseRequirementsTxt,\n parsePyprojectToml,\n parsePipfile,\n} from '@lib/detection/features';\nimport { SOURCE_DETECTORS } from './registry.js';\nimport type { DetectedSource, SourceDetector } from './types.js';\n\ninterface ProjectSignals {\n npm: Set<string>;\n python: Set<string>;\n ruby: Set<string>;\n /**\n * Key NAME → the project-relative `.env*` file that first defined it. The\n * path is sanitised on the way in, so nothing here can reach a prompt raw.\n */\n envKeys: Map<string, string>;\n}\n\n// Shared with `check_env_keys` so the tool scans exactly what the detector\n// scanned — see `@utils/env-scan`.\nconst MAX_DEPTH = ENV_SCAN_MAX_DEPTH;\n\n// Each signal Set retains at most this many entries.\nconst MAX_SIGNAL_SET = MAX_ENV_KEY_SET;\n\nfunction addCapped(set: Set<string>, value: string): void {\n if (set.size < MAX_SIGNAL_SET) set.add(value);\n}\n\n/**\n * Detect which warehouse sources the project at `installDir` appears to use.\n * Returns one `DetectedSource` per matched registry entry (kinds are unique,\n * so the result is naturally deduped), minus the entries a more specific\n * match supersedes.\n */\nexport function detectWarehouseSources(installDir: string): DetectedSource[] {\n // No directory guard here: walkProjectFiles is best-effort and yields no\n // signals for a missing/unreadable dir (→ []). The program-level detect\n // step is responsible for surfacing a structured `bad-directory` error.\n const signals = collectSignals(installDir);\n\n const matched: { detector: SourceDetector; signal: string }[] = [];\n for (const detector of SOURCE_DETECTORS) {\n const signal = matchDetector(detector, signals);\n if (signal) matched.push({ detector, signal });\n }\n\n const kinds = new Set(matched.map((m) => m.detector.kind));\n return matched\n .filter(({ detector }) => !isSuperseded(detector, kinds))\n .map(({ detector, signal }) => ({\n kind: detector.kind,\n label: detector.label,\n mode: detector.mode,\n matchedSignal: signal,\n }));\n}\n\n/**\n * Whether a more specific match covers this detector's data. Every consumer\n * treats a detected kind as a source to create, so a project whose Postgres\n * lives on Neon or Supabase would otherwise be offered both and end up with\n * the same tables imported twice.\n */\nfunction isSuperseded(\n detector: SourceDetector,\n detectedKinds: ReadonlySet<string>,\n): boolean {\n return (detector.supersededBy ?? []).some((kind) => detectedKinds.has(kind));\n}\n\n/** Returns a human-readable description of the first matching signal, or null. */\nfunction matchDetector(\n detector: SourceDetector,\n signals: ProjectSignals,\n): string | null {\n const { npm, python, ruby, envKeys } = detector.signals;\n\n const npmHit = npm?.find((dep) => signals.npm.has(dep));\n if (npmHit) return `found \\`${npmHit}\\` in package.json`;\n\n const pyHit = python?.find((dep) => signals.python.has(dep));\n if (pyHit) return `found \\`${pyHit}\\` in Python dependencies`;\n\n const rubyHit = ruby?.find((gem) => signals.ruby.has(gem));\n if (rubyHit) return `found \\`${rubyHit}\\` in Gemfile`;\n\n if (envKeys) {\n // Name the file that actually matched. The agent acts on this string, so\n // pointing it at `.env` when the key lives in `apps/api/.env.local` sends\n // it to look in the wrong place and conclude the credential is absent.\n //\n // Both interpolated parts are repository-derived, so both are quoted as\n // code and both are constrained. `parseEnvKeyNames` limits the key to\n // `[A-Za-z_][A-Za-z0-9_]*`. The path is the unconstrained part: the\n // repository names its own directories, so it arrives already sanitised\n // from `toPromptSafeRelativePath` and cannot break out of the code span.\n for (const [key, file] of signals.envKeys) {\n if (envKeys.some((re) => re.test(key))) {\n return `found \\`${key}\\` in \\`${file}\\``;\n }\n }\n }\n\n return null;\n}\n\nfunction collectSignals(installDir: string): ProjectSignals {\n const signals: ProjectSignals = {\n npm: new Set(),\n python: new Set(),\n ruby: new Set(),\n envKeys: new Map(),\n };\n\n walkProjectFiles(\n installDir,\n (name, fullPath) => ingestFile(installDir, name, fullPath, signals),\n MAX_DEPTH,\n );\n\n return signals;\n}\n\n/**\n * Route a file to the right parser BY NAME, reading its contents only when the\n * name matches one of the ~6 manifests we care about. Checking the name first\n * avoids slurping every file in the tree (lockfiles, binaries, assets) into\n * memory just to discard it.\n */\nfunction ingestFile(\n installDir: string,\n name: string,\n fullPath: string,\n signals: ProjectSignals,\n): void {\n const ingest = ingestorFor(name);\n if (!ingest) return;\n\n const content = safeReadFile(fullPath);\n if (content === null) return;\n\n ingest(content, signals, toPromptSafeRelativePath(installDir, fullPath));\n}\n\ntype Ingestor = (\n content: string,\n signals: ProjectSignals,\n relativePath: string,\n) => void;\n\n/** Pick the parser for a manifest filename, or null if it's not one we read. */\nfunction ingestorFor(name: string): Ingestor | null {\n if (name === 'package.json') return addNpmDeps;\n if (name === 'requirements.txt')\n return (c, s) =>\n parseRequirementsTxt(c).forEach((d) => addCapped(s.python, d));\n if (name === 'pyproject.toml')\n return (c, s) =>\n parsePyprojectToml(c).forEach((d) => addCapped(s.python, d));\n if (name === 'Pipfile')\n return (c, s) => parsePipfile(c).forEach((d) => addCapped(s.python, d));\n if (name === 'Gemfile')\n return (c, s) => parseGemfile(c).forEach((g) => addCapped(s.ruby, g));\n if (isEnvFileName(name))\n return (c, s, relativePath) => addEnvKeys(c, s, relativePath);\n return null;\n}\n\n/**\n * Record each key NAME against the file that defined it. The first file wins,\n * so the reported signal stays stable when several `.env*` files repeat a key.\n * Values are never read.\n */\nfunction addEnvKeys(\n content: string,\n signals: ProjectSignals,\n relativePath: string,\n): void {\n for (const key of parseEnvKeyNames(content)) {\n if (signals.envKeys.has(key)) continue;\n if (signals.envKeys.size >= MAX_SIGNAL_SET) return;\n signals.envKeys.set(key, relativePath);\n }\n}\n\nfunction addNpmDeps(content: string, signals: ProjectSignals): void {\n try {\n const pkg = JSON.parse(content) as PackageJson;\n for (const dep of Object.keys({\n ...pkg.dependencies,\n ...pkg.devDependencies,\n })) {\n addCapped(signals.npm, dep);\n }\n } catch (error) {\n // Malformed package.json — skip it, but record that we hit it.\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step: 'detectWarehouseSources.parsePackageJson' },\n );\n }\n}\n\n/** Extract gem names from `gem 'name'` declarations. */\nexport function parseGemfile(content: string): string[] {\n const gems: string[] = [];\n for (const match of content.matchAll(/^\\s*gem\\s+['\"]([^'\"]+)['\"]/gm)) {\n gems.push(match[1]);\n }\n return gems;\n}\n\n/**\n * Extract KEY NAMES from a dotenv file. Values are intentionally discarded.\n * Re-exported from `@utils/env-scan`, which `check_env_keys` shares, so the\n * detector and the tool cannot disagree about what counts as a key.\n */\nexport { parseEnvKeyNames as parseEnvKeys } from '@utils/env-scan';\n","/**\n * Warehouse-source program detection step.\n *\n * Thin adapter over `detectWarehouseSources` that writes results into\n * frameworkContext for the intro screen, plus the `[ABORT]` cases the\n * data-warehouse-source-setup skill can emit.\n */\n\nimport { existsSync, statSync } from 'fs';\nimport { analytics } from '@utils/analytics';\nimport type { WizardSession } from '@lib/wizard-session';\nimport type { AbortCase } from '@agent/types';\nimport { detectWarehouseSources } from '@lib/warehouse-sources/detect';\nimport type { DetectedSource } from '@lib/warehouse-sources/types';\n\n/** Structured detection errors rendered by the intro screen. */\nexport type WarehouseDetectError =\n | {\n kind: 'bad-directory';\n path: string;\n reason: 'missing' | 'not-dir' | 'unreadable';\n }\n | { kind: 'no-sources' };\n\n/** frameworkContext key holding the detected sources (set on success). */\nexport const DETECTED_WAREHOUSE_SOURCES_KEY = 'detectedWarehouseSources';\n\n/**\n * Read the detected sources out of frameworkContext. Single accessor shared by\n * the intro screen and the prompt builder so the key + cast live in one place.\n */\nexport function getDetectedWarehouseSources(\n session: WizardSession,\n): DetectedSource[] {\n return (\n (session.frameworkContext[DETECTED_WAREHOUSE_SOURCES_KEY] as\n | DetectedSource[]\n | undefined) ?? []\n );\n}\n\n/** `[ABORT] <reason>` cases the skill can emit. */\nexport const WAREHOUSE_ABORT_CASES: AbortCase[] = [\n {\n // Skill emits: [ABORT] No data source detected\n // Tolerant of plural (\"sources\") and a trailing period.\n match: /^no data sources? detected\\.?$/i,\n message: 'No data source detected',\n body:\n 'The agent could not confirm a data warehouse source to connect. ' +\n 'Run this command from a project that uses a supported source ' +\n '(a database, Stripe, etc.).',\n docsUrl: 'https://posthog.com/docs/data-warehouse',\n },\n {\n // Skill emits: [ABORT] Source creation failed\n match: /^source creation failed\\.?$/i,\n message: 'Source creation failed',\n body:\n 'PostHog could not create the data warehouse source with the ' +\n 'credentials provided. Double-check the connection details and try ' +\n 'again, or set the source up directly in the PostHog app.',\n docsUrl: 'https://posthog.com/docs/data-warehouse',\n },\n];\n\n/**\n * Scan `session.installDir` for warehouse-source signals. Writes the detected\n * sources (or a `detectError`) into frameworkContext for the intro screen.\n */\nexport function detectWarehousePrerequisites(\n session: WizardSession,\n setFrameworkContext: (key: string, value: unknown) => void,\n): void {\n const fail = (error: WarehouseDetectError) =>\n setFrameworkContext('detectError', error);\n\n const installDir = session.installDir;\n\n if (!existsSync(installDir)) {\n fail({ kind: 'bad-directory', path: installDir, reason: 'missing' });\n return;\n }\n try {\n if (!statSync(installDir).isDirectory()) {\n fail({ kind: 'bad-directory', path: installDir, reason: 'not-dir' });\n return;\n }\n } catch (error) {\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step: 'detectWarehousePrerequisites.stat', path: installDir },\n );\n fail({ kind: 'bad-directory', path: installDir, reason: 'unreadable' });\n return;\n }\n\n const sources = detectWarehouseSources(installDir);\n\n if (sources.length === 0) {\n fail({ kind: 'no-sources' });\n return;\n }\n\n // Tag every subsequent event (agent started/completed, setup wizard\n // finished, …) with what was detected — without this the analytics can't\n // say which source types a run attempted, only that a run happened.\n analytics.setTag(\n 'warehouse_source_kinds',\n sources.map((s) => s.kind).join(','),\n );\n analytics.setTag(\n 'warehouse_source_modes',\n sources.map((s) => `${s.kind}:${s.mode}`).join(','),\n );\n analytics.setTag('warehouse_source_count', sources.length);\n\n setFrameworkContext(DETECTED_WAREHOUSE_SOURCES_KEY, sources);\n}\n","import { relative } from 'path';\nimport { safeReadFile, walkProjectFiles } from '@utils/bounded-fs';\n\nexport const POSTHOG_SDKS = new Set([\n 'posthog-js',\n 'posthog-node',\n 'posthog-react-native',\n 'posthog-android',\n 'posthog-ios',\n]);\n\nexport const STRIPE_SDKS = new Set([\n 'stripe',\n '@stripe/stripe-js',\n '@stripe/react-stripe-js',\n]);\n\nexport interface PackageMatch {\n /** Path to the package.json relative to installDir */\n path: string;\n posthogSdks: string[];\n stripeSdks: string[];\n}\n\n// At most this many matches retained, regardless of monorepo package count.\nconst MAX_PACKAGE_MATCHES = 500;\n\n/**\n * Find all package.json files under installDir via the shared bounded walk\n * (depth cap, ignored dirs, symlink-loop protection, per-dir entry cap).\n * Returns matches with detected SDKs.\n */\nexport function findPackageJsons(\n installDir: string,\n maxDepth = 3,\n): PackageMatch[] {\n const matches: PackageMatch[] = [];\n\n walkProjectFiles(\n installDir,\n (name, fullPath) => {\n if (name !== 'package.json' || matches.length >= MAX_PACKAGE_MATCHES) {\n return;\n }\n const content = safeReadFile(fullPath);\n if (content === null) return;\n try {\n const pkg = JSON.parse(content) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n const depNames = [\n ...Object.keys(pkg.dependencies ?? {}),\n ...Object.keys(pkg.devDependencies ?? {}),\n ];\n const posthogSdks = depNames.filter((d) => POSTHOG_SDKS.has(d));\n const stripeSdks = depNames.filter((d) => STRIPE_SDKS.has(d));\n matches.push({\n path: relative(installDir, fullPath) || 'package.json',\n posthogSdks,\n stripeSdks,\n });\n } catch {\n // Skip malformed package.json\n }\n },\n maxDepth,\n );\n\n return matches;\n}\n","/**\n * Core integration detection step.\n *\n * Runs framework detection, context gathering, version checking,\n * and feature discovery. Writes results to the store via the\n * ProgramReadyContext so the IntroScreen can display them.\n *\n * This is the same work that bin.ts $0 handler does inline —\n * extracted here so the `integrate` subcommand can reuse it.\n */\n\nimport type { ProgramReadyContext } from '@lib/programs/program-step';\nimport {\n DiscoveredFeature,\n mayReportScanResults,\n ScanConsent,\n type WizardSession,\n} from '@lib/wizard-session';\nimport { FRAMEWORK_REGISTRY } from '@lib/registry';\nimport {\n detectFramework,\n discoverFeatures,\n gatherFrameworkContext,\n checkFrameworkVersion,\n} from '@lib/detection/index';\nimport { analytics } from '@utils/analytics';\nimport { detectWarehouseSources } from '@lib/warehouse-sources/detect';\nimport { AI_SOURCE_KINDS } from '@lib/warehouse-sources/registry';\nimport type { DetectedSource } from '@lib/warehouse-sources/types';\nimport {\n DETECTED_WAREHOUSE_SOURCES_KEY,\n getDetectedWarehouseSources,\n} from '@lib/programs/warehouse-source/detect';\nimport { findPackageJsons } from '@lib/programs/shared/package-scanning';\n\nexport async function detectPostHogIntegration(\n ctx: ProgramReadyContext,\n): Promise<void> {\n const session = ctx.session;\n const installDir = session.installDir;\n\n const detectedIntegration = await detectFramework(installDir);\n\n if (detectedIntegration) {\n const config = FRAMEWORK_REGISTRY[detectedIntegration];\n\n const sessionOptions = {\n installDir,\n debug: session.debug,\n signup: session.signup,\n ci: session.ci,\n benchmark: session.benchmark,\n yaraReport: session.yaraReport,\n };\n\n // Gather framework-specific context (e.g., router type)\n const context = await gatherFrameworkContext(config, sessionOptions);\n for (const [key, value] of Object.entries(context)) {\n if (!(key in session.frameworkContext)) {\n ctx.setFrameworkContext(key, value);\n }\n }\n\n ctx.setFrameworkConfig(detectedIntegration, config);\n // Must go through the store setter: setFrameworkConfig (above) calls\n // nanostore setKey, which replaces the session with a shallow copy —\n // a direct `session.skillId = ...` here would write to the stale\n // pre-copy object and the live session would never see it.\n ctx.setSkillId(detectedIntegration);\n\n if (!session.detectedFrameworkLabel) {\n ctx.setDetectedFramework(config.metadata.name);\n }\n\n // Version check\n const versionResult = await checkFrameworkVersion(config, sessionOptions);\n if (versionResult.supported !== true) {\n ctx.setUnsupportedVersion(versionResult.supported);\n }\n }\n\n // Feature discovery\n for (const feature of discoverFeatures(installDir)) {\n ctx.addDiscoveredFeature(feature);\n }\n\n detectWarehouseSourcesForSuggestion(ctx, installDir);\n detectExistingPostHog(ctx, installDir);\n\n ctx.setDetectionComplete();\n}\n\n/**\n * How the scan went, for the reporter to read later. Three states, and the\n * absent one carries the most weight:\n *\n * absent this program never scanned. Only `posthog-integration` runs the\n * scan below, but every program's intro screen resolves consent\n * through the same store method, so the reporter is reached on runs\n * where no scan ever happened.\n * 'failed' the scan threw. A zero-count row would read as \"scanned, found\n * nothing\", which is a different fact.\n * 'ok' the scan ran. Zero sources is a real result and gets reported.\n */\nconst WAREHOUSE_SCAN_STATE_KEY = 'warehouseScanState';\ntype WarehouseScanState = 'ok' | 'failed';\n\n/**\n * Scan for data warehouse source signals (Postgres, Stripe, Hubspot, …) and,\n * when found, stash them for a `wizard warehouse` suggestion on the outro.\n * Runs unconditionally during `detect`, before the intro screen has asked\n * about sharing. Reporting what this finds is a separate, later concern.\n * See `reportWarehouseSourcesDetected` below.\n *\n * Deliberately a suggestion, not an inline agent run: a second credential-\n * collecting agent run before the outro could `process.exit()` on any of its\n * failure paths and cost the user the success outro on a run where PostHog\n * installed fine.\n *\n * Calls `detectWarehouseSources` (a pure scan) rather than the warehouse\n * program's `detectWarehousePrerequisites`, which writes a `detectError` when\n * it finds nothing — that's right for `wizard warehouse` but here would show a\n * spurious error and trip the CI prerequisites abort. No sources is a no-op.\n *\n * Best-effort: never let a scan failure break the wizard flow.\n */\nfunction detectWarehouseSourcesForSuggestion(\n ctx: ProgramReadyContext,\n installDir: string,\n): void {\n try {\n const sources = detectWarehouseSources(installDir);\n // Before the empty-list return: a scan that found nothing still ran, and\n // those rows are the denominator.\n ctx.setFrameworkContext(WAREHOUSE_SCAN_STATE_KEY, 'ok');\n if (sources.length === 0) return;\n ctx.setFrameworkContext(DETECTED_WAREHOUSE_SOURCES_KEY, sources);\n } catch (error) {\n ctx.setFrameworkContext(WAREHOUSE_SCAN_STATE_KEY, 'failed');\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step: 'detectWarehouseSourcesForSuggestion' },\n );\n }\n}\n\nfunction hasAiSdkEvidence(\n session: WizardSession,\n sources: DetectedSource[],\n): boolean {\n return (\n sources.some((s) => AI_SOURCE_KINDS.has(s.kind)) ||\n session.discoveredFeatures.includes(DiscoveredFeature.LLM)\n );\n}\n\n/**\n * Boolean only, on the org, never the list of kinds or any non-AI tool: a\n * decline must not leak even the shape of what local detection saw.\n */\nfunction stampAiSdkDetected(\n session: WizardSession,\n sources: DetectedSource[],\n): void {\n const organizationId = session.apiUser?.organization?.id;\n if (!organizationId) return;\n if (!hasAiSdkEvidence(session, sources)) return;\n\n analytics.groupIdentify('organization', organizationId, {\n wizard_ai_sdk_detected: true,\n });\n}\n\n/**\n * Fires the org stamp once per session, right after `authenticate()` succeeds\n * — never from the consent path, since consent on the intro screen resolves\n * before login and `session.apiUser` is unset there. Called right after\n * `authenticate()` from run-wizard.ts's auth step and from bootstrap.ts,\n * whichever completes it first for a given program; a no-op on every call\n * after that. In the `--ci` path, project-scope.ts authenticates first as a\n * prerequisite (no evidence gathered yet, so nothing would stamp there\n * anyway) and this only ever runs from the later, idempotent bootstrap.ts\n * call — still correctly finding no evidence, since CI skips the detect step.\n */\nexport function maybeStampAiSdkDetected(session: WizardSession): void {\n // Direct mutation, not a store setter: unlike `warehouseSourcesReported`\n // (latched only from TUI-only consent screens), this runs from\n // `authenticate()`, which also fires in `--ci` mode, where the session is a\n // plain object with no nanostore — see run-non-interactive.ts. A setter\n // routed through WizardStore would silently never latch there.\n //\n // Depends on consent resolving before auth, same as every program's step\n // list orders 'intro' before 'auth' today; a program that reversed that\n // would latch this before consent exists and never stamp even once granted.\n if (session.aiSdkStampReported) return;\n session.aiSdkStampReported = true;\n if (!mayReportScanResults(session)) return;\n\n stampAiSdkDetected(session, getDetectedWarehouseSources(session));\n}\n\n/**\n * The single place scan results become telemetry. Called from\n * `WizardStore.completeSetup()`, the point consent becomes final — the privacy\n * panel's choice is reversible until then, so nothing may report earlier.\n * The org stamp is a separate concern: see `maybeStampAiSdkDetected`, which\n * runs post-auth rather than at consent resolution.\n *\n * Returns true when consent has resolved and the caller should latch\n * `warehouseSourcesReported`, which is not the same as \"this sent something\":\n * a decline, a failed scan, and a program that never scanned all resolve\n * without sending.\n */\nexport function reportWarehouseSourcesDetected(\n session: WizardSession,\n): boolean {\n if (session.warehouseSourcesReported) return false;\n // 'undecided' means come back later, not no.\n if (session.scanConsent === ScanConsent.Undecided) return false;\n\n if (mayReportScanResults(session)) {\n const sources = getDetectedWarehouseSources(session);\n\n // Only an 'ok' scan has something to say. Absent means this program never\n // scanned, and reporting a zero count there would invent a scan that never\n // ran; 'failed' already fired captureException.\n const scanState = session.frameworkContext[WAREHOUSE_SCAN_STATE_KEY] as\n | WarehouseScanState\n | undefined;\n if (scanState !== 'ok') return true;\n\n // Captured on every run, including the empty case. The denominator is\n // the whole point: without the zero rows, \"20% of runs have a Postgres\"\n // is unanswerable.\n analytics.wizardCapture('warehouse sources detected', {\n warehouse_source_count: sources.length,\n warehouse_source_kinds: sources.map((s) => s.kind),\n warehouse_source_modes: sources.map((s) => s.mode),\n });\n\n if (sources.length > 0) {\n // Tag subsequent events too, so any downstream funnel can slice on what the\n // project had available without re-joining to the event above.\n analytics.setTag(\n 'warehouse_source_kinds',\n sources.map((s) => s.kind).join(','),\n );\n analytics.setTag('warehouse_source_count', sources.length);\n }\n }\n // Nothing on 'declined': saved insights read every row of this event as a\n // scan that ran. Decline rate comes from 'intro menu selected' instead.\n\n return true;\n}\n\n/** Dependency-level signal, not a verified install. A failed scan reports false. */\nexport function detectExistingPostHog(\n ctx: Pick<ProgramReadyContext, 'setPosthogSdkDetected'>,\n installDir: string,\n): void {\n try {\n const pkgJsons = findPackageJsons(installDir);\n ctx.setPosthogSdkDetected(pkgJsons.some((p) => p.posthogSdks.length > 0));\n } catch (error) {\n analytics.captureException(\n error instanceof Error ? error : new Error(String(error)),\n { step: 'detectExistingPosthog' },\n );\n ctx.setPosthogSdkDetected(false);\n }\n}\n","import type { WizardSession } from '@lib/wizard-session';\nimport {\n AUDIT_CHECKS_FILE,\n AUDIT_REPORT_FILE,\n coerceAuditChecks,\n type AuditCheck,\n type AuditStatus,\n} from '@shared/audit-ledger';\n\n// The ledger contract lives in `@lib/audit-ledger`; re-exported so the audit\n// views and the ledger watcher keep their import path.\nexport { AUDIT_CHECKS_FILE, AUDIT_REPORT_FILE, coerceAuditChecks };\nexport type { AuditCheck, AuditStatus };\n\nexport interface AuditSeverityStyle {\n glyph: string;\n color: string;\n}\n\n/** Single source of truth for status glyph + color across audit views. */\nexport const AUDIT_SEVERITY_STYLE: Record<AuditStatus, AuditSeverityStyle> = {\n pending: { glyph: '◌', color: 'gray' },\n pass: { glyph: '✔', color: 'green' },\n error: { glyph: '✘', color: 'red' },\n warning: { glyph: '⚠', color: 'yellow' },\n suggestion: { glyph: '•', color: 'cyan' },\n};\n\nexport const AUDIT_CHECKS_KEY = 'auditChecks';\n\nexport function getAuditChecks(session: WizardSession): AuditCheck[] {\n const raw = session.frameworkContext[AUDIT_CHECKS_KEY];\n return Array.isArray(raw) ? (raw as AuditCheck[]) : [];\n}\n","/**\n * Mirrors the agent's `.posthog-audit-checks.json` into the session, so the TUI\n * screens and the task stream read one value. `runProgramAgent` owns the\n * lifecycle and removes the file at run end, so every path gets it — including\n * the e2e host, which builds no task stream.\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { getUI } from '@ui';\nimport {\n startFileWatcher,\n type FileWatcherHandle,\n type FileWatcherOptions,\n} from '@lib/file-watcher';\nimport { logToFile } from '@utils/debug';\nimport { AUDIT_CHECKS_KEY, coerceAuditChecks } from './types.js';\n\nconst MAX_LEDGER_FILE_BYTES = 256 * 1024;\n\nexport function startAuditLedgerWatcher(\n installDir: string,\n file: string,\n options: FileWatcherOptions = {},\n): FileWatcherHandle {\n const target = path.join(installDir, file);\n logToFile(`[audit-ledger] watching ${target}`);\n\n return startFileWatcher(\n target,\n (parsed) =>\n getUI().setFrameworkContext(AUDIT_CHECKS_KEY, coerceAuditChecks(parsed)),\n {\n // A ledger an earlier run left behind stays ignored until this run writes.\n ignoreInitialFile: true,\n maxFileSizeBytes: MAX_LEDGER_FILE_BYTES,\n ...options,\n },\n );\n}\n\n/** The program declared the ledger, so it removes it, agent `rm` step or not. */\nexport function removeAuditLedger(installDir: string, file: string): void {\n const target = path.join(installDir, file);\n try {\n fs.rmSync(target, { force: true });\n } catch (error) {\n logToFile(`[audit-ledger] could not remove ${target}: ${String(error)}`);\n }\n}\n","/**\n * The session-driven agent runner every existing caller uses.\n *\n * `runProgramAgent(programConfig, session)` rebuilds today's behavior on top of the\n * functional `runAgent(config, input, options)` in `@lib/agent/runner`: it\n * runs the gates the TUI owns (health, settings, AI opt-in, post-auth steps),\n * authenticates, resolves the program's binding, builds the agent's inputs\n * from the session, maps every progress event back onto `getUI()` one call\n * per event, answers the agent's questions through `getUI()`, and applies the\n * result — `wizardAbort` with the outcome's terminal status for a decided\n * failure, the terminal analytics event for a finished top-level run.\n *\n * This is the only file that knows about `getUI()`, the session and\n * `wizardAbort` on the agent's behalf. Programs replace it in Release B.\n */\n\nimport type { WizardSession } from '@lib/wizard-session';\nimport { analytics } from '@utils/analytics';\nimport { getUI } from '@ui';\nimport { createUiReducer, uiInteraction } from '@ui/agent-progress';\nimport {\n buildRunTags,\n flushScanReport,\n resolveBinding,\n runAgent,\n RunOutcome,\n TASK_OUTCOMES_KEY,\n} from '@agent';\nimport type {\n ProgramBinding,\n RunConfig,\n RunInput,\n SwitchboardCtx,\n} from '@agent/types';\nimport type { ProgramRun } from './program-run';\nimport {\n backupAndFixClaudeSettings,\n checkAllSettingsConflicts,\n classifySettingsConflicts,\n restoreClaudeSettings,\n} from '@shared/claude-settings';\nimport {\n evaluateWizardReadiness,\n WizardReadiness,\n SIGNUP_WIZARD_READINESS_CONFIG,\n getBlockingServiceKeys,\n SERVICE_LABELS,\n} from '@shared/health-checks/readiness';\nimport { enableDebugLogs, logToFile, initLogFile } from '@utils/debug';\nimport { registerCleanup, wizardAbort } from '@utils/wizard-abort';\nimport { ErrorCodes } from '@shared/errors';\nimport { isNonInteractiveEnvironment } from '@utils/environment';\nimport {\n getSkillsBaseUrl,\n Sequence,\n WIZARD_ORCHESTRATOR_FLAG_KEY,\n WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY,\n type Integration,\n} from '@shared/constants';\nimport { FRAMEWORK_REGISTRY } from '@lib/registry';\nimport { postAuthGateSteps, type ProgramConfig } from './program-step';\nimport { authenticate, refreshAccessTokenIfNeeded } from './authenticate';\nimport { maybeStampAiSdkDetected } from './posthog-integration/detect';\nimport {\n removeAuditLedger,\n startAuditLedgerWatcher,\n} from './audit/ledger-watcher';\n\n/**\n * Resolve a ProgramConfig's agent run definition and execute the pipeline.\n * Entry point for the runners and for composed run steps.\n */\nexport async function runProgramAgent(\n programConfig: ProgramConfig,\n session: WizardSession,\n options: { composed?: boolean } = {},\n): Promise<void> {\n if (!programConfig.run) {\n throw new Error(`Program \"${programConfig.id}\" has no run configuration.`);\n }\n\n // Before `run()` resolves: an audit seeds the ledger from inside its recipe,\n // and a watcher started later would ignore that write as pre-existing.\n const ledgerFile = programConfig.auditLedgerFile;\n const ledger = ledgerFile\n ? startAuditLedgerWatcher(session.installDir, ledgerFile)\n : null;\n const releaseLedger = () => {\n // Read a last write the watch debounce hasn't picked up before stopping.\n ledger?.refresh();\n ledger?.stop();\n if (ledgerFile) removeAuditLedger(session.installDir, ledgerFile);\n };\n if (ledger) registerCleanup(releaseLedger);\n\n try {\n const runDef =\n typeof programConfig.run === 'function'\n ? await programConfig.run(session)\n : programConfig.run;\n\n await runProgram(session, runDef, programConfig, options.composed ?? false);\n } finally {\n releaseLedger();\n }\n}\n\n/**\n * Gates → authenticate → flags → binding → the functional run → apply result.\n * Every step happens in the order it did inside the agent's bootstrap.\n */\nasync function runProgram(\n session: WizardSession,\n run: ProgramRun,\n programConfig: ProgramConfig,\n composed: boolean,\n): Promise<void> {\n // 1. Init logging + debug\n initLogFile();\n session.skillId = run.skillId ?? run.integrationLabel;\n logToFile(\n `[agent-runner] START ${run.integrationLabel} build=${analytics.build}` +\n `${session.ci ? ' (non-interactive)' : ''}`,\n );\n if (session.debug) {\n enableDebugLogs();\n }\n\n // 2. Health check (guarded — skip if TUI already ran it). Only\n // programs that declare a health-check screen get pre-flight checks;\n // for everything else the checks never fire and never block.\n await runHealthGate(session, programConfig);\n\n // 3. Settings conflicts\n await runSettingsGate(session);\n\n analytics.wizardCapture('agent started', {\n integration: run.integrationLabel,\n program_id: programConfig.id,\n skill_id: run.skillId ?? null,\n });\n\n // 4. Authenticate — idempotent within a run (see authenticate()). A second\n // agent run in the same invocation (self-driving's integration phase) reuses\n // the first login; it does not launch another OAuth. authenticate() also\n // identifies the user and sets analytics groups.\n await authenticate(session, programConfig.id);\n maybeStampAiSdkDetected(session);\n\n // 4.5. AI opt-in enforcement. Parks here while AiOptInRequiredScreen is\n // up if the org hasn't approved third-party AI — BEFORE the skill\n // install and agent start, so no source leaves the machine. The screen\n // alone is cosmetic; this await is the actual gate. Resolves\n // immediately when the program declared requiresAi: false or in CI.\n logToFile('[agent-runner] checking AI opt-in gate');\n await getUI().waitForAiOptIn();\n logToFile('[agent-runner] AI opt-in gate cleared');\n\n // Park for any interactive step the user must complete AFTER authenticating\n // but BEFORE the agent runs — e.g. the source-maps project picker, which\n // needs credentials to scan and writes its choice to frameworkContext that\n // the run prompt reads. Generic: await every gated step between auth and run.\n for (const step of postAuthGateSteps(programConfig.steps)) {\n logToFile(`[agent-runner] awaiting post-auth gate: ${step.id}`);\n await getUI().waitForGate(step.id);\n logToFile(`[agent-runner] post-auth gate cleared: ${step.id}`);\n }\n\n // Feature flags. Both arms need these, and the routing decision reads them.\n const wizardFlags = await analytics.getAllFlagsForWizard();\n const wizardFlagPayloads = analytics.getWizardFlagPayloads();\n\n // Gateway trace tags for this run; the binding below stamps its axes on.\n const wizardMetadata = buildRunTags({\n programId: programConfig.id,\n integration: run.integrationLabel,\n runId: analytics.runId,\n build: analytics.build,\n skillId: run.skillId,\n });\n\n // The agent can't swap tokens mid-run, so freshness is measured after every\n // park above, right before the agent mints.\n await refreshAccessTokenIfNeeded(session);\n\n // Credentials (incl. the resolved host family and its MCP url) live on\n // `session.credentials`; narrow once at this boundary — `authenticate` above\n // set them — so downstream readers get a non-null type without asserting.\n const credentials = session.credentials!;\n\n // Resolve which sequence and harness will run a program (CLI → PostHog flag →\n // per-program binding → default), tag both axes onto analytics, and hand the\n // binding to the agent for dispatch.\n const switchboard: SwitchboardCtx = {\n program: programConfig.id,\n composed,\n flags: wizardFlags,\n flagPayloads: wizardFlagPayloads,\n cliHarness: session.harness,\n cliSequence: session.sequence,\n cliModel: session.model,\n };\n const binding = resolveBinding(switchboard);\n analytics.setTag('sequence', binding.sequence);\n analytics.setTag('harness', binding.harness);\n wizardMetadata.SEQUENCE = binding.sequence;\n wizardMetadata.HARNESS = binding.harness;\n captureSwitchboardDecision(switchboard, binding);\n\n const ui = getUI();\n\n // Cleanup coverage for the abort/cancel path: `wizardAbort` runs the\n // registered cleanups, and the agent's own `finally` covers completion.\n // flushScanReport is idempotent, so the overlap is a harmless no-op.\n registerCleanup(() => {\n const report = flushScanReport({ yaraReport: session.yaraReport });\n if (report) ui.log.info(report);\n });\n\n // Linear settings restoration fires on entry to the outro screen, so it\n // is registered before the run can reach that screen. Same owner, same\n // timing as before; the abort path still restores through the cleanup\n // `backupAndFixClaudeSettings` registered.\n if (binding.sequence === Sequence.linear) {\n ui.onEnterScreen('outro', () => restoreClaudeSettings(session.installDir));\n }\n\n const framework = session.integration ?? session.skillId ?? undefined;\n const config: RunConfig = {\n programId: programConfig.id,\n run,\n composed,\n binding,\n switchboard,\n skillsBaseUrl: getSkillsBaseUrl(),\n wizardFlags,\n wizardFlagPayloads,\n wizardMetadata,\n allowedTools: programConfig.allowedTools,\n disallowedTools: programConfig.disallowedTools,\n agentFlow: programConfig.agentFlow,\n excludedTaskTypes: programConfig.excludedTaskTypes,\n seedTasks: programConfig.seedTasks\n ? () => programConfig.seedTasks!(session)\n : undefined,\n hooks: {\n postRun: run.postRun\n ? (creds) => run.postRun!(session, creds)\n : undefined,\n buildOutroData: run.buildOutroData\n ? (creds) => run.buildOutroData!(session, creds) ?? undefined\n : undefined,\n buildOutroNextSteps: run.buildOutroNextSteps\n ? (creds, completed) =>\n run.buildOutroNextSteps!(session, creds, completed)\n : undefined,\n recordTaskOutcomes: (outcomes) => {\n session.frameworkContext[TASK_OUTCOMES_KEY] = outcomes;\n },\n },\n };\n const input: RunInput = {\n installDir: session.installDir,\n credentials,\n project: session.apiProject,\n apiUser: session.apiUser,\n skillId: session.skillId ?? undefined,\n integration: session.integration,\n frameworkDocsUrl: framework\n ? FRAMEWORK_REGISTRY[framework as Integration]?.metadata.docsUrl\n : undefined,\n flags: {\n ci: session.ci,\n signup: session.signup,\n debug: session.debug,\n e2eAsk: session.e2eAsk,\n localMcp: session.localMcp,\n captureAio: session.captureAio,\n benchmark: session.benchmark,\n yaraReport: session.yaraReport,\n },\n host: {\n baseUrl: session.baseUrl,\n region: session.region,\n email: session.email,\n projectId: session.projectId,\n apiKey: session.apiKey,\n },\n };\n\n const result = await runAgent(config, input, {\n onProgress: createUiReducer(ui),\n interaction: uiInteraction(ui),\n });\n\n // The host owns process exits, terminal analytics and rethrowing crashes.\n if (result.outcome === RunOutcome.Crashed) {\n throw result.failure.error;\n }\n if (result.outcome !== RunOutcome.Success) {\n if (result.failure.authErrorDetail) {\n ui.showAuthError(result.failure.authErrorDetail);\n }\n // The terminal status follows how the run ended, not whether an Error came back.\n await wizardAbort({\n ...result.failure,\n status: result.outcome === RunOutcome.Aborted ? 'cancelled' : 'error',\n });\n } else if (!composed) {\n // A composed sub-run leaves the terminal event to its host program's run.\n // The run already succeeded: a failed flush is logged, never the outcome.\n try {\n await analytics.shutdown('success');\n } catch (error) {\n logToFile('[agent-runner] analytics shutdown failed:', error);\n }\n }\n}\n\n// ── Gates ─────────────────────────────────────────────────────────────\n\nasync function runHealthGate(\n session: WizardSession,\n programConfig: ProgramConfig,\n): Promise<void> {\n const hasHealthCheckScreen = programConfig.steps.some(\n (s) => s.screenId === 'health-check',\n );\n if (session.readinessResult) {\n logToFile(\n `[agent-runner] readiness pre-computed by TUI: decision=${session.readinessResult.decision}` +\n `${\n session.outageDismissed ? ' (outage dismissed by user)' : ''\n } — skipping re-check`,\n );\n }\n if (!hasHealthCheckScreen || session.readinessResult) return;\n\n logToFile('[agent-runner] evaluating wizard readiness');\n const readinessConfig = session.signup\n ? SIGNUP_WIZARD_READINESS_CONFIG\n : undefined;\n const readiness = await evaluateWizardReadiness(readinessConfig);\n logToFile(`[agent-runner] readiness=${readiness.decision}`);\n if (readiness.decision === WizardReadiness.No) {\n const blockingKeys = getBlockingServiceKeys(\n readiness.health,\n readinessConfig,\n );\n const blockingLabels = blockingKeys.map(\n (k) => `${SERVICE_LABELS[k]} (${readiness.health[k].status})`,\n );\n logToFile(`[agent-runner] blocked by: ${blockingLabels.join(', ')}`);\n\n await getUI().showBlockingOutage(readiness);\n\n // The TUI lets the user continue past an outage; non-interactive runs\n // (CI) do the same automatically — the degraded services are reported\n // above, but we proceed rather than aborting on a transient upstream blip.\n if (!isNonInteractiveEnvironment()) {\n await wizardAbort({\n code: ErrorCodes.EnvServiceOutage,\n message:\n 'Cannot start — external services are down:\\n' +\n blockingLabels.map((l) => ` - ${l}`).join('\\n') +\n '\\n\\nPlease try again later.',\n });\n }\n } else if (readiness.decision === WizardReadiness.YesWithWarnings) {\n getUI().setReadinessWarnings(readiness);\n }\n}\n\nasync function runSettingsGate(session: WizardSession): Promise<void> {\n const settingsConflicts = checkAllSettingsConflicts(session.installDir);\n logToFile(\n `[agent-runner] settings conflicts: ${\n settingsConflicts.length > 0\n ? settingsConflicts\n .map((c) => `${c.source}(${c.keys.join(',')})`)\n .join('; ')\n : 'none'\n }`,\n );\n if (settingsConflicts.length === 0) return;\n\n for (const conflict of settingsConflicts) {\n const level = conflict.source === 'managed' ? 'org' : conflict.source;\n analytics.wizardCapture('settings conflict detected', {\n level,\n keys: conflict.keys,\n });\n }\n\n const { autoFix, failClosed, warnOnly } =\n classifySettingsConflicts(settingsConflicts);\n\n // User-global and project-local files are already neutralized — the agent\n // runs with settingSources:['project'], so the SDK never reads them. Record\n // it and move on; don't make the user act on a setting that can't bite.\n for (const conflict of warnOnly) {\n logToFile(\n `[agent-runner] settings conflict in ${conflict.source} (${conflict.path}) ` +\n `neutralized by settingSources:['project'] — not blocking`,\n );\n analytics.wizardCapture('settings conflict neutralized', {\n level: conflict.source,\n keys: conflict.keys,\n });\n }\n\n // Writable project settings.json — the SDK *does* read it, but we can back\n // it up and remove it (restored at outro). Neutralize without prompting.\n let unfixable = failClosed;\n if (autoFix.length > 0) {\n const fixed = backupAndFixClaudeSettings(session.installDir);\n if (fixed) {\n logToFile('[agent-runner] auto-neutralized writable settings conflict');\n analytics.wizardCapture('settings conflict auto-neutralized', {\n keys: autoFix.flatMap((c) => c.keys),\n });\n } else {\n // Couldn't remove it — don't run into the redirect; fail closed instead.\n logToFile(\n '[agent-runner] could not back up writable settings conflict — failing closed',\n );\n unfixable = [...failClosed, ...autoFix];\n }\n }\n\n // What we cannot neutralize (org-managed, always read by the SDK; or a\n // writable file we failed to back up) must be fixed by the user. Fail\n // closed: the screen names the file + keys and exits.\n if (unfixable.length > 0) {\n if (isNonInteractiveEnvironment()) {\n await wizardAbort({\n code: ErrorCodes.SettingsUnfixableConflict,\n message:\n 'Cannot start — a Claude settings file redirects the agent away ' +\n 'from the PostHog gateway and cannot be neutralized automatically:\\n' +\n unfixable\n .map((c) => ` - ${c.source} (${c.path}): ${c.keys.join(', ')}`)\n .join('\\n') +\n '\\n\\nRemove the conflicting keys and re-run the wizard.',\n });\n }\n await getUI().showSettingsOverride(unfixable, () =>\n backupAndFixClaudeSettings(session.installDir),\n );\n logToFile('[agent-runner] settings override resolved');\n }\n}\n\n// ── Switchboard telemetry ─────────────────────────────────────────────\n\n/**\n * One event + one log line per run: what entered the switchboard, which\n * precedence rung decided each axis, and the final pick.\n */\nfunction captureSwitchboardDecision(\n ctx: SwitchboardCtx,\n binding: ProgramBinding,\n): void {\n const trace = ctx.trace ?? {};\n // Unpinned orchestrator runs choose a model per task from the context-mill agent prompts; the orchestrator logs that map once the prompts load.\n const perTaskModel =\n binding.sequence === Sequence.orchestrator && trace.model === 'binding';\n const model = perTaskModel ? 'chosen-per-task' : binding.model;\n const modelSource = perTaskModel ? 'agent-prompts' : trace.model;\n analytics.wizardCapture('switchboard resolved', {\n program: ctx.program,\n flag_self_driving_use_pi_harness:\n ctx.flags[WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY],\n flag_self_driving_pi_payload: JSON.stringify(\n ctx.flagPayloads?.[WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY] ?? null,\n ),\n flag_orchestrator: ctx.flags[WIZARD_ORCHESTRATOR_FLAG_KEY],\n cli_harness: ctx.cliHarness,\n cli_sequence: ctx.cliSequence,\n cli_model: ctx.cliModel,\n harness_source: trace.harness,\n model_source: modelSource,\n sequence_source: trace.sequence,\n harness: binding.harness,\n model,\n thinking_level: binding.thinkingLevel,\n sequence: binding.sequence,\n });\n logToFile(\n `[switchboard] decision: program=${ctx.program}` +\n ` in(orchestrator=${ctx.flags[WIZARD_ORCHESTRATOR_FLAG_KEY] ?? '-'},` +\n ` cli=${ctx.cliHarness ?? '-'}/${ctx.cliSequence ?? '-'}/${\n ctx.cliModel ?? '-'\n })` +\n ` → harness=${binding.harness} (${trace.harness ?? '?'})` +\n ` model=${model} (${modelSource ?? '?'})` +\n ` sequence=${binding.sequence} (${trace.sequence ?? '?'})`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,gBAAgB,IAA8C;CAC5E,IAAI;AACJ,SAAQ,UAAU;AAChB,UAAQ,MAAM,MAAd;GACE,KAAK;AACH,QAAI,MAAM,UAAU,UAAW,IAAG,UAAU;QACvC,IAAG,MAAM,MAAM,QAAQ;AAC5B;GACF,KAAK;AAEH,KADgB,YAAY,GAAG,SAAS,EACjC,MAAM,QAAQ,MAAM,QAAQ;AACnC;GAEF,KAAK;AACH,OAAG,IAAI,MAAM,OAAO,MAAM,QAAQ;AAClC;GACF,KAAK;AACH,OAAG,WAAW,MAAM,QAAQ;AAC5B;GACF,KAAK;AACH,OAAG,UAAU,MAAM,MAAM;AACzB;GACF,KAAK;AACH,OAAG,SAAS,MAAM,MAAM;AACxB;GACF,KAAK;AACH,QAAI,MAAM,UAAU,YAAa,IAAG,gBAAgB,MAAM,IAAI;QACzD,IAAG,eAAe,MAAM,IAAI;AACjC;GACF,KAAK;AACH,OAAG,cAAc,MAAM,MAAM;AAC7B;GACF,KAAK;AACH,OAAG,qBAAqB,MAAM,IAAI;AAClC;GACF,KAAK;AACH,OAAG,cAAc,MAAM,OAAO;AAC9B;GACF,KAAK;AACH,OAAG,eAAe,MAAM,KAAK;AAC7B;GACF,KAAK;AACH,OAAG,aAAa,MAAM,MAAM;AAC5B;GACF,QAEE,OAAM,IAAI,MACR,6BAA6B,KAAK,UAFX,MAE+B,GACvD;;;;;AAOT,SAAgB,cAAc,IAAgC;AAC5D,QAAO;EACL,MAAM,UAAU,EAAE,aAChB,eAAe,GAAG,gBA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N,SAAS,EACP,SAAS,CAAC,gBAAgB,EAC3B;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,aAAa,EACxB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS;GACP,KAAK,CAAC,mBAAmB;GACzB,SAAS,CAAC,gBAAgB;GAC3B;EACF;CAED;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS;GACP,QAAQ,CAAC,mBAAmB;GAC5B,SAAS,CAAC,cAAc;GACzB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,cAAc,cAAc,EACvC;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,YAAY,EACvB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,aAAa,EACxB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,aAAa,EACxB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS;GACP,KAAK,CAAC,6BAA6B;GACnC,SAAS,CAAC,UAAU;GACrB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,UAAU,EACrB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS,EACP,SAAS,CAAC,UAAU,EACrB;EACF;CAED;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS;GACP,KAAK,CAAC,kBAAkB;GACxB,QAAQ,CAAC,gBAAgB;GACzB,MAAM,CAAC,SAAS;GAChB,SAAS,CAAC,WAAW;GACtB;EACF;CACD;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,SAAS;GACP,KAAK,CAAC,YAAY;GAClB,SAAS,CAAC,cAAc;GACzB;EACF;CACD;EACE,M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