@posthog/wizard 2.82.0 → 2.84.0
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 +1 -29
- package/dist/{PickerMenu-BGGeYqd-.js → PickerMenu-BtheKi1o.js} +1 -1
- package/dist/{PickerMenu-BGGeYqd-.js.map → PickerMenu-BtheKi1o.js.map} +1 -1
- package/dist/_dev-only-stub-B0db0Klc.js +1 -0
- package/dist/{agent-interface-3YfIWZmY.js → agent-interface-BNssNetq.js} +86 -32
- package/dist/agent-interface-BNssNetq.js.map +1 -0
- package/dist/{agent-prompt-loader-hOHONY7u.js → agent-prompt-loader-iV11XVEF.js} +16 -8
- package/dist/agent-prompt-loader-iV11XVEF.js.map +1 -0
- package/dist/{analytics-B_xFshPY.js → analytics-Drox5LSW.js} +7 -5
- package/dist/analytics-Drox5LSW.js.map +1 -0
- package/dist/analytics-Ix9HEra3.js +2 -0
- package/dist/{api-C_9KsN-7.js → api-Dfu655Qt.js} +2 -2
- package/dist/{api-C_9KsN-7.js.map → api-Dfu655Qt.js.map} +1 -1
- package/dist/api-H2UaPgjv.js +2 -0
- package/dist/{api-key-login-oUJQDmOV.js → api-key-login-BgwfAXfv.js} +5 -5
- package/dist/{api-key-login-oUJQDmOV.js.map → api-key-login-BgwfAXfv.js.map} +1 -1
- package/dist/api-key-login-Cow3UDAN.js +2 -0
- package/dist/bin.js +1 -1
- package/dist/{bounded-fs-iRaQcKYL.js → bounded-fs-TRL6IsoU.js} +32 -16
- package/dist/bounded-fs-TRL6IsoU.js.map +1 -0
- package/dist/{ci-install-BGlijoTo.js → ci-install-nc1IKuX2.js} +6 -6
- package/dist/{ci-install-BGlijoTo.js.map → ci-install-nc1IKuX2.js.map} +1 -1
- package/dist/{console-log-DJiTqYT2.js → console-log-BMhBoX-o.js} +2 -2
- package/dist/{console-log-DJiTqYT2.js.map → console-log-BMhBoX-o.js.map} +1 -1
- package/dist/{debug-BvEbemym.js → debug-BfO_Txo8.js} +3 -3
- package/dist/debug-BfO_Txo8.js.map +1 -0
- package/dist/{defaults-DDVl3tKN.js → defaults-BWLIffh5.js} +1 -1
- package/dist/{defaults-DDVl3tKN.js.map → defaults-BWLIffh5.js.map} +1 -1
- package/dist/{errors-DhFeR8Sp.js → errors-BXlWujEw.js} +1 -1
- package/dist/{errors-DhFeR8Sp.js.map → errors-BXlWujEw.js.map} +1 -1
- package/dist/{family-picker-BKs-tTyu.js → family-picker-CAW_VtYf.js} +2 -2
- package/dist/{family-picker-BKs-tTyu.js.map → family-picker-CAW_VtYf.js.map} +1 -1
- package/dist/{gateway-CWoYlPz7.js → gateway-CLQQb96F.js} +39 -9
- package/dist/{gateway-CWoYlPz7.js.map → gateway-CLQQb96F.js.map} +1 -1
- package/dist/headless-CHGNEzO3.js +3 -0
- package/dist/{headless-Bfi950Qh.js → headless-DMO8N_FD.js} +2 -2
- package/dist/{headless-Bfi950Qh.js.map → headless-DMO8N_FD.js.map} +1 -1
- package/dist/{host-resolution-BxnNn8Jm.js → host-resolution-DftfSjJD.js} +4 -4
- package/dist/{host-resolution-BxnNn8Jm.js.map → host-resolution-DftfSjJD.js.map} +1 -1
- package/dist/{install-CDVeUT_5.js → install-C9FPM37m.js} +6 -6
- package/dist/{install-CDVeUT_5.js.map → install-C9FPM37m.js.map} +1 -1
- package/dist/{install-CX65IxGa.js → install-MWoo1hXL.js} +1 -1
- package/dist/{interactive-5-Numwwb.js → interactive-DOnolJHB.js} +3 -3
- package/dist/{interactive-5-Numwwb.js.map → interactive-DOnolJHB.js.map} +1 -1
- package/dist/{links-Dmj3Wj9X.js → links-CatXPRxH.js} +3 -3
- package/dist/{links-Dmj3Wj9X.js.map → links-CatXPRxH.js.map} +1 -1
- package/dist/{main-5KNn80Vt.js → main-CINmZtoW.js} +27 -24
- package/dist/main-CINmZtoW.js.map +1 -0
- package/dist/{mcp-Buf9sfFm.js → mcp-KVV6Z_bq.js} +3 -3
- package/dist/{mcp-Buf9sfFm.js.map → mcp-KVV6Z_bq.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-DHPxJK-F.js → mcp-prompt-streaming-M6UnLgGX.js} +5 -5
- package/dist/{mcp-prompt-streaming-DHPxJK-F.js.map → mcp-prompt-streaming-M6UnLgGX.js.map} +1 -1
- package/dist/{mode-label-DB3ol_sj.js → mode-label--bJuXny5.js} +1 -1
- package/dist/{mode-label-DB3ol_sj.js.map → mode-label--bJuXny5.js.map} +1 -1
- package/dist/{models-C9rjXPZ6.js → models-B0huHItG.js} +6 -2
- package/dist/models-B0huHItG.js.map +1 -0
- package/dist/{non-interactive-DkldwWDM.js → non-interactive-DiEu4_6l.js} +3 -3
- package/dist/{non-interactive-DkldwWDM.js.map → non-interactive-DiEu4_6l.js.map} +1 -1
- package/dist/{oauth-session-Bi1MLRCC.js → oauth-session-9EU3ky0v.js} +2 -2
- package/dist/{oauth-session-Bi1MLRCC.js.map → oauth-session-9EU3ky0v.js.map} +1 -1
- package/dist/{orchestrator-tools-DyKws92o.js → orchestrator-tools-QWyDLu_7.js} +3 -3
- package/dist/{orchestrator-tools-DyKws92o.js.map → orchestrator-tools-QWyDLu_7.js.map} +1 -1
- package/dist/package-json-BAtJRHSq.js +2 -0
- package/dist/{package-json-2UrhE6kP.js → package-json-z1agAYXs.js} +1 -1
- package/dist/{package-json-2UrhE6kP.js.map → package-json-z1agAYXs.js.map} +1 -1
- package/dist/{package-manager-DpCdmMmB.js → package-manager-B-9I_fAT.js} +4 -4
- package/dist/{package-manager-DpCdmMmB.js.map → package-manager-B-9I_fAT.js.map} +1 -1
- package/dist/{pi-DTj1hsJe.js → pi-BSnSk6rv.js} +50 -31
- package/dist/pi-BSnSk6rv.js.map +1 -0
- package/dist/{playground-CiH6zZPb.js → playground-Drz1qszs.js} +4 -4
- package/dist/{playground-CiH6zZPb.js.map → playground-Drz1qszs.js.map} +1 -1
- package/dist/{posthog-integration-CpinLWNO.js → posthog-integration-mIQGBc1f.js} +883 -2513
- package/dist/posthog-integration-mIQGBc1f.js.map +1 -0
- package/dist/programs-Bv0_YHzE.js +3 -0
- package/dist/{programs-Bq9Ju9xk.js → programs-mxhRXwP-.js} +306 -125
- package/dist/programs-mxhRXwP-.js.map +1 -0
- package/dist/provisioning-BVsxSNve.js +2 -0
- package/dist/{provisioning-D-AM_7DG.js → provisioning-CHUjae9V.js} +4 -4
- package/dist/{provisioning-D-AM_7DG.js.map → provisioning-CHUjae9V.js.map} +1 -1
- package/dist/{queue-tools-BoIITT7w.js → queue-tools-PFG6H93Q.js} +14 -5
- package/dist/queue-tools-PFG6H93Q.js.map +1 -0
- package/dist/{results-CDqlHogZ.js → results-5yCKf2cI.js} +2 -2
- package/dist/{results-CDqlHogZ.js.map → results-5yCKf2cI.js.map} +1 -1
- package/dist/{run-CfMArkpV.js → run-D5TKJuSL.js} +10 -10
- package/dist/{run-CfMArkpV.js.map → run-D5TKJuSL.js.map} +1 -1
- package/dist/{run-DcaVJSeI.js → run-W03b6jNM.js} +12 -12
- package/dist/{run-DcaVJSeI.js.map → run-W03b6jNM.js.map} +1 -1
- package/dist/{run-tool-DJZWnnR9.js → run-tool-DTQF8mmI.js} +17 -17
- package/dist/{run-tool-DJZWnnR9.js.map → run-tool-DTQF8mmI.js.map} +1 -1
- package/dist/run-tool-DjERhu7G.js +2 -0
- package/dist/{runners-Cvnk9BcA.js → runners-B_84kPyf.js} +11 -11
- package/dist/{runners-Cvnk9BcA.js.map → runners-B_84kPyf.js.map} +1 -1
- package/dist/{security-Cz3a-d7r.js → security-pApVawYb.js} +6 -5
- package/dist/{security-Cz3a-d7r.js.map → security-pApVawYb.js.map} +1 -1
- package/dist/{setup-utils-C7kaDP5X.js → setup-utils-CQY8PHjR.js} +3 -3
- package/dist/{setup-utils-C7kaDP5X.js.map → setup-utils-CQY8PHjR.js.map} +1 -1
- package/dist/{start-playground-B62_pYfu.js → start-playground-DAw1GbLt.js} +8 -8
- package/dist/{start-playground-B62_pYfu.js.map → start-playground-DAw1GbLt.js.map} +1 -1
- package/dist/{subagent-BBfETG17.js → subagent-YLGSvgoZ.js} +13 -5
- package/dist/subagent-YLGSvgoZ.js.map +1 -0
- package/dist/{task-CmNe3xeg.js → task-3hRSovmK.js} +39 -29
- package/dist/task-3hRSovmK.js.map +1 -0
- package/dist/{tasks-BfJhVky2.js → tasks-C03QbXTx.js} +1 -1
- package/dist/{tasks-BfJhVky2.js.map → tasks-C03QbXTx.js.map} +1 -1
- package/dist/{telemetry-DKM7VGuJ.js → telemetry-BPBzqsb_.js} +2 -2
- package/dist/{telemetry-DKM7VGuJ.js.map → telemetry-BPBzqsb_.js.map} +1 -1
- package/dist/{terminal-Bkxwzkhn.js → terminal-DZsYFbm9.js} +471 -81
- package/dist/terminal-DZsYFbm9.js.map +1 -0
- package/dist/{tools-DZCEvDv9.js → tools-D_AtrhbO.js} +15 -15
- package/dist/{tools-DZCEvDv9.js.map → tools-D_AtrhbO.js.map} +1 -1
- package/dist/{tools-Bm0FDT6f.js → tools-DyzRi_dQ.js} +8 -8
- package/dist/{tools-Bm0FDT6f.js.map → tools-DyzRi_dQ.js.map} +1 -1
- package/dist/{tui-B56jvkbi.js → tui-CRp0iCuT.js} +5 -5
- package/dist/tui-CRp0iCuT.js.map +1 -0
- package/dist/{tui-tKI95MSr.js → tui-UI6ctBQJ.js} +1 -1
- package/dist/{upload-step-DqTgn6UB.js → upload-step-DrYXnpzI.js} +3 -3
- package/dist/{upload-step-DqTgn6UB.js.map → upload-step-DrYXnpzI.js.map} +1 -1
- package/dist/{urls-B82v7gfO.js → urls-WeqfBLP4.js} +2 -2
- package/dist/{urls-B82v7gfO.js.map → urls-WeqfBLP4.js.map} +1 -1
- package/dist/{wizard-abort-Cd-7sfCw.js → wizard-abort-BwEefm6P.js} +5 -5
- package/dist/{wizard-abort-Cd-7sfCw.js.map → wizard-abort-BwEefm6P.js.map} +1 -1
- package/dist/yara-hooks-MDtFbuoM.js +2 -0
- package/dist/{yara-hooks-BS0n3ekf.js → yara-hooks-aDbdsitJ.js} +41 -5
- package/dist/{yara-hooks-BS0n3ekf.js.map → yara-hooks-aDbdsitJ.js.map} +1 -1
- package/package.json +9 -7
- package/dist/agent-interface-3YfIWZmY.js.map +0 -1
- package/dist/agent-prompt-loader-hOHONY7u.js.map +0 -1
- package/dist/analytics-B_xFshPY.js.map +0 -1
- package/dist/analytics-DGDr6-iD.js +0 -2
- package/dist/api-DhLSO3ai.js +0 -2
- package/dist/api-key-login-DiRuZ8Lm.js +0 -2
- package/dist/bounded-fs-iRaQcKYL.js.map +0 -1
- package/dist/debug-BvEbemym.js.map +0 -1
- package/dist/headless-Gisv3faN.js +0 -3
- package/dist/main-5KNn80Vt.js.map +0 -1
- package/dist/models-C9rjXPZ6.js.map +0 -1
- package/dist/package-json-Dblip2_X.js +0 -2
- package/dist/pi-DTj1hsJe.js.map +0 -1
- package/dist/posthog-integration-CpinLWNO.js.map +0 -1
- package/dist/programs-Bq9Ju9xk.js.map +0 -1
- package/dist/programs-CnOSdQo1.js +0 -3
- package/dist/provisioning-D6Cqbc36.js +0 -2
- package/dist/queue-tools-BoIITT7w.js.map +0 -1
- package/dist/run-tool-zMLQroVh.js +0 -2
- package/dist/subagent-BBfETG17.js.map +0 -1
- package/dist/task-CmNe3xeg.js.map +0 -1
- package/dist/terminal-Bkxwzkhn.js.map +0 -1
- package/dist/tui-B56jvkbi.js.map +0 -1
- package/dist/yara-hooks-CxksH-GZ.js +0 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as ErrorCodes } from "./emit-BqLCdV8Y.js";
|
|
2
|
-
import { f as VERSION, l as WIZARD_TASK_STREAM_FILE, o as logToFile, p as HEADLESS_FLAG } from "./debug-
|
|
3
|
-
import {
|
|
4
|
-
import { a as WizardError, n as sanitizeErrorDetail, t as classifyRunFailure } from "./errors-
|
|
5
|
-
import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-
|
|
6
|
-
import { n as isUsingTypeScript } from "./setup-utils-
|
|
7
|
-
import { l as markGrantRevoked, r as currentCredentials, s as rotateAfterUnauthorized, t as configureOAuthSession } from "./oauth-session-
|
|
8
|
-
import {
|
|
9
|
-
import { R as WIZARD_TOOL_NAMES, c as checkAllSettingsConflicts, d as restoreClaudeSettings, l as classifySettingsConflicts, nt as LONGER_ASK_TIMEOUT_MS, p as registerCleanup, s as backupAndFixClaudeSettings } from "./agent-interface-
|
|
10
|
-
import { a as getOAuthUrl, s as resolveBaseUrl } from "./urls-
|
|
11
|
-
import {
|
|
12
|
-
import { m as appendStatus } from "./pi-
|
|
13
|
-
import {
|
|
14
|
-
import { C as
|
|
15
|
-
import { t as resolveApiKeyProject } from "./api-key-login-
|
|
2
|
+
import { f as VERSION, l as WIZARD_TASK_STREAM_FILE, o as logToFile, p as HEADLESS_FLAG } from "./debug-BfO_Txo8.js";
|
|
3
|
+
import { C as GPT5_6_TERRA_MODEL, H as REPLAY_VISION_SUPPORTED, N as POSTHOG_DEV_CLIENT_ID, O as ISSUES_URL, P as POSTHOG_DOCS_URL, R as POSTHOG_PROXY_CLIENT_ID, X as WIZARD_OAUTH_SCOPES, at as getSkillsBaseUrl, et as WIZARD_PROVISIONING_SCOPES, g as EVENTS_AUDIT_REPORT_FILE, it as WIZARD_USER_AGENT, n as analytics, o as mayReportScanResults, p as DEFAULT_AGENT_MODEL, pt as resolveLocalDev, q as WIZARD_CONTACT_EMAIL, r as groupsFromUser, w as GPT6_SOL_MODEL, z as POSTHOG_STATUS_PAGE_URL } from "./analytics-Drox5LSW.js";
|
|
4
|
+
import { a as WizardError, n as sanitizeErrorDetail, t as classifyRunFailure } from "./errors-BXlWujEw.js";
|
|
5
|
+
import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-TRL6IsoU.js";
|
|
6
|
+
import { n as isUsingTypeScript } from "./setup-utils-CQY8PHjR.js";
|
|
7
|
+
import { l as markGrantRevoked, r as currentCredentials, s as rotateAfterUnauthorized, t as configureOAuthSession } from "./oauth-session-9EU3ky0v.js";
|
|
8
|
+
import { c as AgentSignals, g as checkSkillsOriginHealth } from "./gateway-CLQQb96F.js";
|
|
9
|
+
import { R as WIZARD_TOOL_NAMES, c as checkAllSettingsConflicts, d as restoreClaudeSettings, l as classifySettingsConflicts, nt as LONGER_ASK_TIMEOUT_MS, p as registerCleanup, s as backupAndFixClaudeSettings } from "./agent-interface-BNssNetq.js";
|
|
10
|
+
import { a as getOAuthUrl, s as resolveBaseUrl } from "./urls-WeqfBLP4.js";
|
|
11
|
+
import { D as FRAMEWORK_REGISTRY, E as detectFramework, M as DEFAULT_BINDING, O as SPINNER_MESSAGE, S as tagScanResults, T as gatherFrameworkContext, _ as scopeInstallDirToProject, a as detectPostHogIntegration, b as resolveProjectDir, d as scanCodebaseFor, f as scannedWarehouseSources, g as detectIntegrationProjects, h as workspaceFingerprint, i as ProgramAbort, j as runAgent, l as findPackageJsons, m as getDetectedWarehouseSources, n as WAREHOUSE_SOURCE_SCOPE_ADDITIONS, o as reportWarehouseSourcesDetected, p as DETECTED_WAREHOUSE_SOURCES_KEY, r as abortNoFrameworkDetected, t as config$14, u as getCodebaseScan, v as toIntegrationCandidates, w as noteDetectedFramework, x as applyScanTags, y as detectProjectsWithAgent } from "./posthog-integration-mIQGBc1f.js";
|
|
12
|
+
import { m as appendStatus } from "./pi-BSnSk6rv.js";
|
|
13
|
+
import { y as writeJsonAtomic } from "./queue-tools-PFG6H93Q.js";
|
|
14
|
+
import { C as AUDIT_REPORT_FILE, S as AUDIT_CHECKS_FILE, w as coerceAuditChecks } from "./yara-hooks-aDbdsitJ.js";
|
|
15
|
+
import { t as resolveApiKeyProject } from "./api-key-login-BgwfAXfv.js";
|
|
16
16
|
import { valid } from "semver";
|
|
17
17
|
import * as fs$1 from "fs";
|
|
18
18
|
import fs, { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -248,20 +248,23 @@ const MCP_ANALYTICS_ABORT_CASES = [
|
|
|
248
248
|
* 'mcp-analytics'` from context-mill — a deliberate breaking change, done then,
|
|
249
249
|
* not pre-emptively.
|
|
250
250
|
*/
|
|
251
|
-
const config$
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
251
|
+
const config$13 = {
|
|
252
|
+
decisions: ["is_mcp_server"],
|
|
253
|
+
...createSkillProgram({
|
|
254
|
+
skillId: "mcp-analytics",
|
|
255
|
+
command: "mcp-analytics",
|
|
256
|
+
id: "mcp-analytics",
|
|
257
|
+
description: "Add PostHog MCP Analytics to your MCP server",
|
|
258
|
+
integrationLabel: "mcp-analytics",
|
|
259
|
+
customPrompt: `Instrument this project's MCP server with PostHog MCP analytics. Run the \`mcp-analytics\` skill end-to-end: detect the language and server style, install the PostHog MCP SDK for that language (\`@posthog/mcp\` for TypeScript, \`posthog\` for Python, \`posthogmcpsdk\` for Go, \`posthog-ruby\` for Ruby), wrap the server (or use the custom-dispatcher client where the skill says so), wire the project API key and host, and verify. Make only additive changes — do not alter tool behavior. For a Ruby server, the report must open by saying the Ruby SDK is experimental and not officially supported. The final report is written to ./${MCP_ANALYTICS_REPORT_FILE}.`,
|
|
260
|
+
successMessage: `MCP analytics configured! View the report at ./${MCP_ANALYTICS_REPORT_FILE}`,
|
|
261
|
+
reportFile: MCP_ANALYTICS_REPORT_FILE,
|
|
262
|
+
docsUrl: "https://posthog.com/docs/mcp-analytics",
|
|
263
|
+
spinnerMessage: "Setting up MCP analytics...",
|
|
264
|
+
estimatedDurationMinutes: 5,
|
|
265
|
+
abortCases: MCP_ANALYTICS_ABORT_CASES
|
|
266
|
+
})
|
|
267
|
+
};
|
|
265
268
|
//#endregion
|
|
266
269
|
//#region src/programs/replay-vision/scopes.ts
|
|
267
270
|
/**
|
|
@@ -295,7 +298,7 @@ const REPLAY_VISION_SCOPE_ADDITIONS = [
|
|
|
295
298
|
//#endregion
|
|
296
299
|
//#region src/programs/replay-vision/index.ts
|
|
297
300
|
const REPLAY_VISION_REPORT_FILE = "posthog-replay-vision-report.md";
|
|
298
|
-
function abortUnsupportedPlatform$
|
|
301
|
+
function abortUnsupportedPlatform$2(integration) {
|
|
299
302
|
const name = FRAMEWORK_REGISTRY[integration]?.metadata.name ?? integration;
|
|
300
303
|
analytics.wizardCapture("replay-vision unsupported platform", { integration });
|
|
301
304
|
throw new ProgramAbort({
|
|
@@ -333,7 +336,7 @@ const REPLAY_VISION_ABORT_CASES = [{
|
|
|
333
336
|
async function detectReplayVisionProject(ctx) {
|
|
334
337
|
const integration = await detectFramework(ctx.session.installDir);
|
|
335
338
|
if (!integration) abortNoFrameworkDetected(NO_FRAMEWORK_GUIDANCE);
|
|
336
|
-
if (!REPLAY_VISION_SUPPORTED.has(integration)) abortUnsupportedPlatform$
|
|
339
|
+
if (!REPLAY_VISION_SUPPORTED.has(integration)) abortUnsupportedPlatform$2(integration);
|
|
337
340
|
await detectPostHogIntegration(ctx);
|
|
338
341
|
}
|
|
339
342
|
/**
|
|
@@ -356,7 +359,12 @@ async function detectReplayVisionProject(ctx) {
|
|
|
356
359
|
* to the right project (monorepos), then detect the framework — the
|
|
357
360
|
* headless equivalent of `onReady`.
|
|
358
361
|
*/
|
|
359
|
-
const config$
|
|
362
|
+
const config$12 = {
|
|
363
|
+
decisions: [
|
|
364
|
+
"framework",
|
|
365
|
+
"web_frontend",
|
|
366
|
+
"primary_user_flow"
|
|
367
|
+
],
|
|
360
368
|
...createSkillProgram({
|
|
361
369
|
skillId: "replay-vision-setup",
|
|
362
370
|
command: "replay-vision",
|
|
@@ -373,8 +381,8 @@ const config$11 = {
|
|
|
373
381
|
}),
|
|
374
382
|
binding: {
|
|
375
383
|
sequence: "orchestrator",
|
|
376
|
-
harness: "
|
|
377
|
-
model:
|
|
384
|
+
harness: "pi",
|
|
385
|
+
model: GPT6_SOL_MODEL
|
|
378
386
|
},
|
|
379
387
|
agentFlow: "replay-vision",
|
|
380
388
|
onReady: detectReplayVisionProject,
|
|
@@ -383,7 +391,7 @@ const config$11 = {
|
|
|
383
391
|
await scopeInstallDirToProject(session, runner);
|
|
384
392
|
const integration = await detectFramework(session.installDir);
|
|
385
393
|
if (!integration) abortNoFrameworkDetected(NO_FRAMEWORK_GUIDANCE);
|
|
386
|
-
if (!REPLAY_VISION_SUPPORTED.has(integration)) abortUnsupportedPlatform$
|
|
394
|
+
if (!REPLAY_VISION_SUPPORTED.has(integration)) abortUnsupportedPlatform$2(integration);
|
|
387
395
|
session.integration = integration;
|
|
388
396
|
analytics.setTag("integration", integration);
|
|
389
397
|
const frameworkConfig = FRAMEWORK_REGISTRY[integration];
|
|
@@ -414,7 +422,8 @@ const AI_OBSERVABILITY_REPORT_FILE = "posthog-ai-observability-report.md";
|
|
|
414
422
|
* the right variant itself (see `customPrompt`). Stays flat while a single
|
|
415
423
|
* "add AIO to a project" flow is the only action.
|
|
416
424
|
*/
|
|
417
|
-
const config$
|
|
425
|
+
const config$11 = {
|
|
426
|
+
decisions: ["calls_llm_api"],
|
|
418
427
|
binding: {
|
|
419
428
|
sequence: "linear",
|
|
420
429
|
harness: "pi",
|
|
@@ -473,7 +482,7 @@ const METRICS_REPORT_FILE = "posthog-metrics-report.md";
|
|
|
473
482
|
* `customPrompt` both pick from the menu and install it. Stays flat while a
|
|
474
483
|
* single "add metrics to a project" flow is the only action.
|
|
475
484
|
*/
|
|
476
|
-
const config$
|
|
485
|
+
const config$10 = {
|
|
477
486
|
command: "metrics",
|
|
478
487
|
description: "Add PostHog application metrics to your project",
|
|
479
488
|
id: "metrics",
|
|
@@ -783,7 +792,7 @@ const DOCS_URL$3 = "https://posthog.com/docs/product-analytics/best-practices";
|
|
|
783
792
|
* skill (whose id AuditRunScreen keys its slides on), not to this config.
|
|
784
793
|
* Registered so its id stays resolvable; nothing dispatches to it today.
|
|
785
794
|
*/
|
|
786
|
-
const config$
|
|
795
|
+
const config$9 = {
|
|
787
796
|
description: "Audit PostHog event tracking in this project",
|
|
788
797
|
id: "events-audit",
|
|
789
798
|
skillId: "events-audit",
|
|
@@ -1036,7 +1045,7 @@ const configs = [{
|
|
|
1036
1045
|
...headlessOption,
|
|
1037
1046
|
...regionOption
|
|
1038
1047
|
}
|
|
1039
|
-
}, config$
|
|
1048
|
+
}, config$9];
|
|
1040
1049
|
//#endregion
|
|
1041
1050
|
//#region src/shared/oauth-scopes.ts
|
|
1042
1051
|
/**
|
|
@@ -1122,7 +1131,7 @@ function detectWebAnalyticsPrerequisites(session, setFrameworkContext) {
|
|
|
1122
1131
|
}
|
|
1123
1132
|
setFrameworkContext("detectedPosthogSdks", sdks);
|
|
1124
1133
|
}
|
|
1125
|
-
const config$
|
|
1134
|
+
const config$8 = {
|
|
1126
1135
|
...createSkillProgram({
|
|
1127
1136
|
skillId: "web-analytics-doctor",
|
|
1128
1137
|
command: "web-analytics",
|
|
@@ -1150,7 +1159,7 @@ const MIGRATION_ABORT_CASES = [{
|
|
|
1150
1159
|
body: "The migration needs an existing third-party SDK to migrate from. No calls to the source SDK appear anywhere in this project. If you haven't installed PostHog yet, you don't need this command — run `npx @posthog/wizard@latest` to add PostHog from scratch."
|
|
1151
1160
|
}];
|
|
1152
1161
|
const DEFAULT_MIGRATE_SKILL_ID = "migrate-statsig";
|
|
1153
|
-
const config$
|
|
1162
|
+
const config$7 = {
|
|
1154
1163
|
command: "migrate",
|
|
1155
1164
|
description: "Migrate to PostHog from another analytics provider",
|
|
1156
1165
|
id: "migration",
|
|
@@ -1266,7 +1275,8 @@ function detectRevenuePrerequisites(session, setFrameworkContext) {
|
|
|
1266
1275
|
}
|
|
1267
1276
|
//#endregion
|
|
1268
1277
|
//#region src/programs/revenue-analytics/index.ts
|
|
1269
|
-
const config$
|
|
1278
|
+
const config$6 = {
|
|
1279
|
+
decisions: ["billing_code"],
|
|
1270
1280
|
command: "revenue-analytics",
|
|
1271
1281
|
description: "Set up PostHog for Revenue Analytics",
|
|
1272
1282
|
id: "revenue-analytics-setup",
|
|
@@ -1292,7 +1302,7 @@ const config$5 = {
|
|
|
1292
1302
|
/**
|
|
1293
1303
|
* Warehouse-source program detection step.
|
|
1294
1304
|
*
|
|
1295
|
-
*
|
|
1305
|
+
* Reads the run's codebase scan and writes a `detectError` into
|
|
1296
1306
|
* frameworkContext for the intro screen, plus the `[ABORT]` cases the
|
|
1297
1307
|
* data-warehouse-source-setup skill can emit.
|
|
1298
1308
|
*/
|
|
@@ -1309,10 +1319,10 @@ const WAREHOUSE_ABORT_CASES = [{
|
|
|
1309
1319
|
docsUrl: "https://posthog.com/docs/data-warehouse"
|
|
1310
1320
|
}];
|
|
1311
1321
|
/**
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1322
|
+
* Check the run's codebase scan for warehouse sources. Writes a `detectError`
|
|
1323
|
+
* into frameworkContext for the intro screen when there is nothing to set up.
|
|
1314
1324
|
*/
|
|
1315
|
-
function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
1325
|
+
async function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
1316
1326
|
const fail = (error) => setFrameworkContext("detectError", error);
|
|
1317
1327
|
const installDir = session.installDir;
|
|
1318
1328
|
if (!existsSync(installDir)) {
|
|
@@ -1344,14 +1354,16 @@ function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
|
1344
1354
|
});
|
|
1345
1355
|
return;
|
|
1346
1356
|
}
|
|
1347
|
-
const sources =
|
|
1357
|
+
const sources = await scannedWarehouseSources(session);
|
|
1348
1358
|
if (sources.length === 0) {
|
|
1349
1359
|
fail({ kind: "no-sources" });
|
|
1350
1360
|
return;
|
|
1351
1361
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1362
|
+
tagScanResults(session, setFrameworkContext, {
|
|
1363
|
+
warehouse_source_kinds: sources.map((s) => s.kind).join(","),
|
|
1364
|
+
warehouse_source_modes: sources.map((s) => `${s.kind}:${s.mode}`).join(","),
|
|
1365
|
+
warehouse_source_count: sources.length
|
|
1366
|
+
});
|
|
1355
1367
|
setFrameworkContext(DETECTED_WAREHOUSE_SOURCES_KEY, sources);
|
|
1356
1368
|
}
|
|
1357
1369
|
//#endregion
|
|
@@ -1374,11 +1386,13 @@ function buildPrompt(session) {
|
|
|
1374
1386
|
"Use the `kind` string exactly as printed above for `source_type` — PostHog rejects the display label."
|
|
1375
1387
|
].join("\n");
|
|
1376
1388
|
}
|
|
1377
|
-
const config$
|
|
1389
|
+
const config$5 = {
|
|
1390
|
+
decisions: ["owns_database"],
|
|
1378
1391
|
command: "warehouse",
|
|
1379
1392
|
description: "Detect and connect Data Warehouse sources",
|
|
1380
1393
|
id: "warehouse-source",
|
|
1381
1394
|
skillId: "data-warehouse-source-setup",
|
|
1395
|
+
scansCodebase: true,
|
|
1382
1396
|
onReady: (ctx) => detectWarehousePrerequisites(ctx.session, ctx.setFrameworkContext),
|
|
1383
1397
|
oauthScopeAdditions: WAREHOUSE_SOURCE_SCOPE_ADDITIONS,
|
|
1384
1398
|
healthCheck: false,
|
|
@@ -1585,6 +1599,11 @@ const SELF_DRIVING_ABORT_CASES = [
|
|
|
1585
1599
|
message: "Interactive terminal required",
|
|
1586
1600
|
body: "Self-driving setup asks questions along the way (GitHub and issue trackers), so it needs an interactive terminal. Run the wizard outside CI / non-interactive mode."
|
|
1587
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
match: /^wrong-project$/i,
|
|
1604
|
+
message: "This repo uses a different PostHog project",
|
|
1605
|
+
body: "Nothing was changed. Run the wizard again with --project-id set to the project this repo sends events to. The id is the number after /project/ in that project's PostHog URL."
|
|
1606
|
+
},
|
|
1588
1607
|
{
|
|
1589
1608
|
match: /^requirements-incomplete$/i,
|
|
1590
1609
|
message: "Setup needs your input",
|
|
@@ -1596,7 +1615,7 @@ const SELF_DRIVING_ABORT_CASES = [
|
|
|
1596
1615
|
* `SelfDrivingDetectError` to frameworkContext on failure — the intro
|
|
1597
1616
|
* screen renders it and blocks.
|
|
1598
1617
|
*/
|
|
1599
|
-
function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
1618
|
+
async function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
1600
1619
|
const fail = (error) => setFrameworkContext("detectError", error);
|
|
1601
1620
|
const installDir = session.installDir;
|
|
1602
1621
|
if (!existsSync(installDir)) {
|
|
@@ -1625,9 +1644,9 @@ function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
|
1625
1644
|
return;
|
|
1626
1645
|
}
|
|
1627
1646
|
setFrameworkContext(POSTHOG_PRESENT_KEY, detectPostHogPresent(installDir));
|
|
1628
|
-
detectConnectedTools(
|
|
1647
|
+
await detectConnectedTools(session, setFrameworkContext);
|
|
1629
1648
|
}
|
|
1630
|
-
/** Step 5's ask options intersected with
|
|
1649
|
+
/** Step 5's ask options intersected with the tool catalog's kinds. Reconcile when the skill's catalog grows. */
|
|
1631
1650
|
const SELF_DRIVING_TOOL_KINDS = new Set([
|
|
1632
1651
|
"Github",
|
|
1633
1652
|
"GitLab",
|
|
@@ -1651,18 +1670,21 @@ const SELF_DRIVING_TOOL_KINDS = new Set([
|
|
|
1651
1670
|
"Productboard",
|
|
1652
1671
|
"GoogleSearchConsole"
|
|
1653
1672
|
]);
|
|
1654
|
-
/**
|
|
1655
|
-
function detectConnectedTools(
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
setFrameworkContext(SELF_DRIVING_DETECTED_TOOLS_KEY, tools);
|
|
1662
|
-
} catch (error) {
|
|
1663
|
-
analytics.setTag("connected_tools_detected_count", -1);
|
|
1664
|
-
analytics.captureException(error instanceof Error ? error : new Error(String(error)), { step: "detectConnectedTools" });
|
|
1673
|
+
/** Pick the inbox-connectable tools out of the run's codebase scan so STEP 5 can surface them first. */
|
|
1674
|
+
async function detectConnectedTools(session, setFrameworkContext) {
|
|
1675
|
+
const scan = getCodebaseScan(session);
|
|
1676
|
+
if (!scan) return;
|
|
1677
|
+
if (scan.failed) {
|
|
1678
|
+
tagScanResults(session, setFrameworkContext, { connected_tools_detected_count: -1 });
|
|
1679
|
+
return;
|
|
1665
1680
|
}
|
|
1681
|
+
const tools = (await scannedWarehouseSources(session)).filter((s) => SELF_DRIVING_TOOL_KINDS.has(s.kind));
|
|
1682
|
+
tagScanResults(session, setFrameworkContext, {
|
|
1683
|
+
connected_tools_detected_count: tools.length,
|
|
1684
|
+
...tools.length > 0 && { connected_tools_detected: tools.map((s) => s.kind).join(",") }
|
|
1685
|
+
});
|
|
1686
|
+
if (tools.length === 0) return;
|
|
1687
|
+
setFrameworkContext(SELF_DRIVING_DETECTED_TOOLS_KEY, tools);
|
|
1666
1688
|
}
|
|
1667
1689
|
//#endregion
|
|
1668
1690
|
//#region src/programs/self-driving/prompt.ts
|
|
@@ -1776,6 +1798,19 @@ STEP 1 — Check Self-driving access. (skill: "Check access")
|
|
|
1776
1798
|
and halt.
|
|
1777
1799
|
|
|
1778
1800
|
STEP 2 — Read project and current Signals state. (skill: "Read context")
|
|
1801
|
+
First confirm that this repo sends events to project ${ctx.projectId}.
|
|
1802
|
+
The user picked that project on the PostHog login screen, and that
|
|
1803
|
+
screen preselects the last project they opened in the browser, so it
|
|
1804
|
+
can be the wrong one. Find the project token in this repo's PostHog
|
|
1805
|
+
client setup (the init call, its env var, and that env var's value in
|
|
1806
|
+
any .env file). This project's token is ${ctx.projectApiKey}. If the
|
|
1807
|
+
repo's token is a different phc_ token, STOP before any write and ask
|
|
1808
|
+
ONE wizard_ask: continue with project ${ctx.projectId}, or stop so they
|
|
1809
|
+
can run the wizard again for the repo's project. Say which token the
|
|
1810
|
+
repo uses and where. If they stop, emit
|
|
1811
|
+
${AgentSignals.ABORT} wrong-project
|
|
1812
|
+
and halt. If the tokens match, or the repo has no literal token, go on.
|
|
1813
|
+
|
|
1779
1814
|
If ./posthog-setup-report.md exists, read it as a strong hint for what
|
|
1780
1815
|
THIS repo instruments — but it is often absent (users frequently don't
|
|
1781
1816
|
commit it), so do NOT depend on it. Combine whatever you find with the
|
|
@@ -2136,7 +2171,8 @@ const buildRun = (session) => Promise.resolve({
|
|
|
2136
2171
|
};
|
|
2137
2172
|
}
|
|
2138
2173
|
});
|
|
2139
|
-
const config$
|
|
2174
|
+
const config$4 = {
|
|
2175
|
+
decisions: ["primary_user_flow", "user_login"],
|
|
2140
2176
|
...createSkillProgram({
|
|
2141
2177
|
skillId: SELF_DRIVING_SKILL_ID,
|
|
2142
2178
|
command: "self-driving",
|
|
@@ -2151,6 +2187,7 @@ const config$3 = {
|
|
|
2151
2187
|
requires: ["posthog-integration"],
|
|
2152
2188
|
abortCases: SELF_DRIVING_ABORT_CASES
|
|
2153
2189
|
}),
|
|
2190
|
+
scansCodebase: true,
|
|
2154
2191
|
onReady: (ctx) => detectSelfDrivingPrerequisites(ctx.session, ctx.setFrameworkContext),
|
|
2155
2192
|
oauthScopeAdditions: SELF_DRIVING_SCOPE_ADDITIONS,
|
|
2156
2193
|
runSteps: { "integrate-run": {
|
|
@@ -2719,7 +2756,12 @@ const DOCS_URL = "https://posthog.com/docs/error-tracking/upload-source-maps";
|
|
|
2719
2756
|
function ensurePostHogCli(variant, log) {
|
|
2720
2757
|
preinstallPostHogCliOnce("source maps posthog-cli preinstall failed", { variant }, log);
|
|
2721
2758
|
}
|
|
2722
|
-
const config$
|
|
2759
|
+
const config$3 = {
|
|
2760
|
+
decisions: [
|
|
2761
|
+
"ships_minified_js",
|
|
2762
|
+
"build_tool",
|
|
2763
|
+
"deploy_platform"
|
|
2764
|
+
],
|
|
2723
2765
|
command: "upload-source-maps",
|
|
2724
2766
|
description: "Upload source maps to PostHog Error Tracking",
|
|
2725
2767
|
id: "error-tracking-upload-source-maps",
|
|
@@ -2845,7 +2887,7 @@ const SYMBOL_UPLOAD_CLI_FRAMEWORKS = new Set([
|
|
|
2845
2887
|
"go",
|
|
2846
2888
|
"rust"
|
|
2847
2889
|
]);
|
|
2848
|
-
function abortUnsupportedPlatform(integration) {
|
|
2890
|
+
function abortUnsupportedPlatform$1(integration) {
|
|
2849
2891
|
const name = FRAMEWORK_REGISTRY[integration]?.metadata.name ?? integration;
|
|
2850
2892
|
analytics.wizardCapture("error tracking unsupported platform", { integration });
|
|
2851
2893
|
throw new ProgramAbort({
|
|
@@ -2931,7 +2973,8 @@ const ERROR_TRACKING_RUN = {
|
|
|
2931
2973
|
* project (monorepos), then detect the framework — the headless equivalent
|
|
2932
2974
|
* of the project picker.
|
|
2933
2975
|
*/
|
|
2934
|
-
const config$
|
|
2976
|
+
const config$2 = {
|
|
2977
|
+
decisions: ["web_frontend", "server_runtime"],
|
|
2935
2978
|
binding: {
|
|
2936
2979
|
sequence: "orchestrator",
|
|
2937
2980
|
harness: "pi",
|
|
@@ -2951,7 +2994,7 @@ const config$1 = {
|
|
|
2951
2994
|
await scopeInstallDirToProject(session, runner);
|
|
2952
2995
|
const integration = await detectFramework(session.installDir);
|
|
2953
2996
|
if (!integration) abortNoFrameworkDetected();
|
|
2954
|
-
if (ERROR_TRACKING_UNSUPPORTED.has(integration)) abortUnsupportedPlatform(integration);
|
|
2997
|
+
if (ERROR_TRACKING_UNSUPPORTED.has(integration)) abortUnsupportedPlatform$1(integration);
|
|
2955
2998
|
session.integration = integration;
|
|
2956
2999
|
analytics.setTag("integration", integration);
|
|
2957
3000
|
session.frameworkConfig = FRAMEWORK_REGISTRY[integration];
|
|
@@ -2960,6 +3003,79 @@ const config$1 = {
|
|
|
2960
3003
|
}
|
|
2961
3004
|
};
|
|
2962
3005
|
//#endregion
|
|
3006
|
+
//#region src/programs/feature-flags/scopes.ts
|
|
3007
|
+
const FEATURE_FLAGS_SCOPE_ADDITIONS = ["feature_flag:read", "feature_flag:write"];
|
|
3008
|
+
//#endregion
|
|
3009
|
+
//#region src/programs/feature-flags/index.ts
|
|
3010
|
+
const FEATURE_FLAGS_REPORT_FILE = "posthog-feature-flags-report.md";
|
|
3011
|
+
const FEATURE_FLAGS_DOCS_URL = "https://posthog.com/docs/feature-flags";
|
|
3012
|
+
const FEATURE_FLAGS_STEP_SKILL_ID = "integration-v2-feature-flags-step";
|
|
3013
|
+
/** KMP skill variants carry no `framework` tag, so orchestrator preflight aborts every KMP run. */
|
|
3014
|
+
const FEATURE_FLAGS_UNSUPPORTED = new Set(["kmp"]);
|
|
3015
|
+
function abortUnsupportedPlatform(integration) {
|
|
3016
|
+
const name = FRAMEWORK_REGISTRY[integration]?.metadata.name ?? integration;
|
|
3017
|
+
analytics.wizardCapture("feature flags unsupported platform", { integration });
|
|
3018
|
+
throw new ProgramAbort({
|
|
3019
|
+
code: ErrorCodes.DetectUnsupportedPlatform,
|
|
3020
|
+
message: `The wizard cannot set up feature flags for ${name} projects yet.\n\nSet them up manually:\n ${FEATURE_FLAGS_DOCS_URL}`
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
const config$1 = {
|
|
3024
|
+
command: "feature-flags",
|
|
3025
|
+
description: "Set up example PostHog feature flags",
|
|
3026
|
+
id: "feature-flags",
|
|
3027
|
+
binding: {
|
|
3028
|
+
sequence: "orchestrator",
|
|
3029
|
+
harness: "pi",
|
|
3030
|
+
model: DEFAULT_AGENT_MODEL
|
|
3031
|
+
},
|
|
3032
|
+
agentFlow: "feature-flags",
|
|
3033
|
+
handoffNotebook: true,
|
|
3034
|
+
onReady: (ctx) => detectPostHogIntegration(ctx),
|
|
3035
|
+
oauthScopeAdditions: FEATURE_FLAGS_SCOPE_ADDITIONS,
|
|
3036
|
+
cliOptions: {
|
|
3037
|
+
...headlessOption,
|
|
3038
|
+
...regionOption
|
|
3039
|
+
},
|
|
3040
|
+
run: {
|
|
3041
|
+
integrationLabel: "feature-flags",
|
|
3042
|
+
successMessage: "Feature flags wired in!",
|
|
3043
|
+
reportFile: FEATURE_FLAGS_REPORT_FILE,
|
|
3044
|
+
docsUrl: FEATURE_FLAGS_DOCS_URL,
|
|
3045
|
+
spinnerMessage: "Setting up your first feature flags...",
|
|
3046
|
+
estimatedDurationMinutes: 5,
|
|
3047
|
+
buildOutroNextSteps: () => ({
|
|
3048
|
+
heading: "Next steps",
|
|
3049
|
+
items: [
|
|
3050
|
+
"Open your app and load the page or endpoint that evaluates each flag",
|
|
3051
|
+
"Find the evaluation on each flag's page in PostHog (it can take a few minutes to show up)",
|
|
3052
|
+
"Turn the flags on when you're ready"
|
|
3053
|
+
]
|
|
3054
|
+
})
|
|
3055
|
+
},
|
|
3056
|
+
ciPreRun: async (session, runner) => {
|
|
3057
|
+
await scopeInstallDirToProject(session, runner);
|
|
3058
|
+
const integration = await detectFramework(session.installDir);
|
|
3059
|
+
if (!integration) abortNoFrameworkDetected();
|
|
3060
|
+
if (FEATURE_FLAGS_UNSUPPORTED.has(integration)) abortUnsupportedPlatform(integration);
|
|
3061
|
+
session.integration = integration;
|
|
3062
|
+
analytics.setTag("integration", integration);
|
|
3063
|
+
const frameworkConfig = FRAMEWORK_REGISTRY[integration];
|
|
3064
|
+
session.frameworkConfig = frameworkConfig;
|
|
3065
|
+
session.skillId = integration;
|
|
3066
|
+
const context = await gatherFrameworkContext(frameworkConfig, {
|
|
3067
|
+
installDir: session.installDir,
|
|
3068
|
+
debug: session.debug,
|
|
3069
|
+
signup: session.signup,
|
|
3070
|
+
ci: true,
|
|
3071
|
+
benchmark: session.benchmark,
|
|
3072
|
+
yaraReport: session.yaraReport
|
|
3073
|
+
});
|
|
3074
|
+
for (const [key, value] of Object.entries(context)) if (!(key in session.frameworkContext)) session.frameworkContext[key] = value;
|
|
3075
|
+
noteDetectedFramework(session, frameworkConfig, context, runner.log);
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
//#endregion
|
|
2963
3079
|
//#region src/programs/agent-skill/index.ts
|
|
2964
3080
|
const config = {
|
|
2965
3081
|
id: "agent-skill",
|
|
@@ -2989,20 +3105,21 @@ const config = {
|
|
|
2989
3105
|
const [audit, eventsAudit] = configs;
|
|
2990
3106
|
/** Every program entry, one line each. */
|
|
2991
3107
|
const PROGRAM_REGISTRY = [
|
|
2992
|
-
config$
|
|
3108
|
+
config$14,
|
|
3109
|
+
config$6,
|
|
2993
3110
|
config$5,
|
|
2994
|
-
config$
|
|
3111
|
+
config$3,
|
|
2995
3112
|
config$2,
|
|
2996
3113
|
config$1,
|
|
2997
3114
|
...configs,
|
|
3115
|
+
config$8,
|
|
2998
3116
|
config$7,
|
|
2999
|
-
config$
|
|
3000
|
-
config$3,
|
|
3117
|
+
config$4,
|
|
3001
3118
|
config,
|
|
3119
|
+
config$13,
|
|
3002
3120
|
config$12,
|
|
3003
3121
|
config$11,
|
|
3004
|
-
config$10
|
|
3005
|
-
config$9
|
|
3122
|
+
config$10
|
|
3006
3123
|
];
|
|
3007
3124
|
/**
|
|
3008
3125
|
* Typed program names. Values come from each config's `id`, so there's
|
|
@@ -3010,21 +3127,22 @@ const PROGRAM_REGISTRY = [
|
|
|
3010
3127
|
* just exposing that config's `id` under a friendly name for call sites.
|
|
3011
3128
|
*/
|
|
3012
3129
|
const Program = {
|
|
3013
|
-
PostHogIntegration: config$
|
|
3014
|
-
RevenueAnalyticsSetup: config$
|
|
3015
|
-
WarehouseSource: config$
|
|
3016
|
-
ErrorTrackingUploadSourceMaps: config$
|
|
3017
|
-
ErrorTracking: config$
|
|
3018
|
-
|
|
3130
|
+
PostHogIntegration: config$14.id,
|
|
3131
|
+
RevenueAnalyticsSetup: config$6.id,
|
|
3132
|
+
WarehouseSource: config$5.id,
|
|
3133
|
+
ErrorTrackingUploadSourceMaps: config$3.id,
|
|
3134
|
+
ErrorTracking: config$2.id,
|
|
3135
|
+
FeatureFlags: config$1.id,
|
|
3136
|
+
Migration: config$7.id,
|
|
3019
3137
|
Audit: audit.id,
|
|
3020
3138
|
EventsAudit: eventsAudit.id,
|
|
3021
|
-
WebAnalyticsDoctor: config$
|
|
3022
|
-
SelfDriving: config$
|
|
3139
|
+
WebAnalyticsDoctor: config$8.id,
|
|
3140
|
+
SelfDriving: config$4.id,
|
|
3023
3141
|
AgentSkill: config.id,
|
|
3024
|
-
McpAnalytics: config$
|
|
3025
|
-
ReplayVision: config$
|
|
3026
|
-
AiObservability: config$
|
|
3027
|
-
Metrics: config$
|
|
3142
|
+
McpAnalytics: config$13.id,
|
|
3143
|
+
ReplayVision: config$12.id,
|
|
3144
|
+
AiObservability: config$11.id,
|
|
3145
|
+
Metrics: config$10.id
|
|
3028
3146
|
};
|
|
3029
3147
|
/**
|
|
3030
3148
|
* Look up a program config by its id. Callers pass ids from `Program` or
|
|
@@ -3043,7 +3161,6 @@ function getSubcommandPrograms() {
|
|
|
3043
3161
|
function getCommandPath(config) {
|
|
3044
3162
|
return config.parentCommand ? `${config.parentCommand} ${config.command}` : config.command;
|
|
3045
3163
|
}
|
|
3046
|
-
/** The program with this id, or undefined for a tool's id or none. */
|
|
3047
3164
|
function findProgramConfig(programId) {
|
|
3048
3165
|
return programId ? PROGRAM_REGISTRY.find((c) => c.id === programId) : void 0;
|
|
3049
3166
|
}
|
|
@@ -3064,6 +3181,45 @@ function getProvisioningScopesForProgram(programId) {
|
|
|
3064
3181
|
return withScopeAdditions(WIZARD_PROVISIONING_SCOPES, findProgramConfig(programId)?.oauthScopeAdditions);
|
|
3065
3182
|
}
|
|
3066
3183
|
//#endregion
|
|
3184
|
+
//#region src/programs/codebase-scan/report.ts
|
|
3185
|
+
/**
|
|
3186
|
+
* The one place a codebase scan is cleared to leave the machine. Runs only
|
|
3187
|
+
* when the user granted sharing (CI and headless runs grant it) and telemetry
|
|
3188
|
+
* is on.
|
|
3189
|
+
*
|
|
3190
|
+
* Called when consent resolves (the intro's Continue) and again after login,
|
|
3191
|
+
* because either can happen first. Each part latches, so a run reports once:
|
|
3192
|
+
* - the `warehouse sources detected` event, which needs no login
|
|
3193
|
+
* - the scan, which needs the login for its fingerprint. This hands it to
|
|
3194
|
+
* the task stream, which attaches it to the run's wizard session.
|
|
3195
|
+
*/
|
|
3196
|
+
function buildScanReport(scan, projectId) {
|
|
3197
|
+
return {
|
|
3198
|
+
program: scan.program,
|
|
3199
|
+
wizard_version: VERSION,
|
|
3200
|
+
workspace_fingerprint: workspaceFingerprint(projectId, scan.scannedDir),
|
|
3201
|
+
scanned_at: scan.scannedAt,
|
|
3202
|
+
complete: scan.complete,
|
|
3203
|
+
tools: scan.tools.map((tool) => ({
|
|
3204
|
+
kind: tool.kind,
|
|
3205
|
+
signals: tool.signals
|
|
3206
|
+
}))
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
function reportCodebaseScan(store) {
|
|
3210
|
+
const { session } = store;
|
|
3211
|
+
if (session.noTelemetry) return;
|
|
3212
|
+
applyScanTags(session);
|
|
3213
|
+
store.markWarehouseSourcesReportedIfNeeded();
|
|
3214
|
+
if (!mayReportScanResults(session)) return;
|
|
3215
|
+
const { credentials } = session;
|
|
3216
|
+
if (!credentials) return;
|
|
3217
|
+
if (session.codebaseScanReport) return;
|
|
3218
|
+
const scan = getCodebaseScan(session);
|
|
3219
|
+
if (!scan || scan.failed) return;
|
|
3220
|
+
store.shareCodebaseScan(buildScanReport(scan, credentials.projectId));
|
|
3221
|
+
}
|
|
3222
|
+
//#endregion
|
|
3067
3223
|
//#region src/programs/detect-map.ts
|
|
3068
3224
|
const DETECT_CODES = {
|
|
3069
3225
|
"bad-directory": ErrorCodes.DetectBadDirectory,
|
|
@@ -3094,6 +3250,7 @@ function detectErrorCode(kind) {
|
|
|
3094
3250
|
* when it has one, anything else its `onReady`. Marks detection complete.
|
|
3095
3251
|
*/
|
|
3096
3252
|
async function detectProgram(config, store, runner) {
|
|
3253
|
+
await scanCodebaseFor(config, store.readyContext());
|
|
3097
3254
|
const ciPreRun = config.ciPreRun;
|
|
3098
3255
|
if (store.session.ci && ciPreRun) await store.edit((draft) => ciPreRun(draft, {
|
|
3099
3256
|
...runner,
|
|
@@ -3660,9 +3817,10 @@ var SessionStore = class {
|
|
|
3660
3817
|
markWarehouseSourcesReportedIfNeeded() {
|
|
3661
3818
|
if (reportWarehouseSourcesDetected(this.session)) this.set("warehouseSourcesReported", true);
|
|
3662
3819
|
}
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
this.
|
|
3820
|
+
/** Hand the scan to the task stream. First one wins: a run shares one scan. */
|
|
3821
|
+
shareCodebaseScan(report) {
|
|
3822
|
+
if (this.session.codebaseScanReport) return;
|
|
3823
|
+
this.set("codebaseScanReport", report);
|
|
3666
3824
|
}
|
|
3667
3825
|
setReadinessResult(result) {
|
|
3668
3826
|
this.$session.setKey("readinessResult", result);
|
|
@@ -4033,15 +4191,7 @@ async function invokeProgram(programId, callerInput, options) {
|
|
|
4033
4191
|
plainSettings = settings;
|
|
4034
4192
|
}
|
|
4035
4193
|
credentials = await login();
|
|
4036
|
-
|
|
4037
|
-
store.setAiSdkStampReported();
|
|
4038
|
-
stampAiSdkDetected({
|
|
4039
|
-
apiUser: credentials.apiUser,
|
|
4040
|
-
discoveredFeatures: store.session.discoveredFeatures,
|
|
4041
|
-
warehouseSources: getDetectedWarehouseSources(store.session),
|
|
4042
|
-
mayReportScanResults: mayReportScanResults(store.session)
|
|
4043
|
-
});
|
|
4044
|
-
}
|
|
4194
|
+
reportCodebaseScan(store);
|
|
4045
4195
|
if (needsAiApproval(store.session, credentials)) {
|
|
4046
4196
|
if (!options.workflow) return fail("AI processing approval is required before this program can run.");
|
|
4047
4197
|
if (!await park(options.workflow.confirmStep({
|
|
@@ -4114,6 +4264,7 @@ async function invokeProgram(programId, callerInput, options) {
|
|
|
4114
4264
|
agentFlow: planned.config.agentFlow,
|
|
4115
4265
|
excludedTaskTypes: planned.config.excludedTaskTypes,
|
|
4116
4266
|
seedTasks: planned.config.seedTasks ? () => planned.config.seedTasks(session()) : void 0,
|
|
4267
|
+
projectFacts: void 0,
|
|
4117
4268
|
hooks: sessionHooks(agentRun, session, (outcomes) => {
|
|
4118
4269
|
if (scoped) scoped.frameworkContext[TASK_OUTCOMES_KEY] = outcomes;
|
|
4119
4270
|
else store.setFrameworkContext(TASK_OUTCOMES_KEY, outcomes);
|
|
@@ -4529,7 +4680,7 @@ function buildSession(args) {
|
|
|
4529
4680
|
model: args.model,
|
|
4530
4681
|
scanConsent: args.ci ? "granted" : "undecided",
|
|
4531
4682
|
warehouseSourcesReported: false,
|
|
4532
|
-
|
|
4683
|
+
codebaseScanReport: null,
|
|
4533
4684
|
integration: args.integration ?? null,
|
|
4534
4685
|
frameworkContext: {},
|
|
4535
4686
|
typescript: false,
|
|
@@ -4679,11 +4830,22 @@ var PostHogDestination = class {
|
|
|
4679
4830
|
if (this.disabled) return;
|
|
4680
4831
|
const creds = this.getCredentials();
|
|
4681
4832
|
if (!creds) return;
|
|
4682
|
-
await this.
|
|
4833
|
+
if (await this.postSession(creds, toWirePayload(payload)) === "auth_rejected") this.disabled = true;
|
|
4834
|
+
}
|
|
4835
|
+
async sendScan(payload) {
|
|
4836
|
+
const creds = this.getCredentials();
|
|
4837
|
+
if (!creds) return;
|
|
4838
|
+
await this.postScan(creds, payload);
|
|
4839
|
+
}
|
|
4840
|
+
postSession(creds, body) {
|
|
4841
|
+
return this.postWithRetry(creds, "wizard/sessions", body);
|
|
4683
4842
|
}
|
|
4684
|
-
|
|
4843
|
+
postScan(creds, body) {
|
|
4844
|
+
return this.postWithRetry(creds, "wizard/scans", body);
|
|
4845
|
+
}
|
|
4846
|
+
buildRequest(creds, path, body) {
|
|
4685
4847
|
return {
|
|
4686
|
-
url: `${creds.host.apiHost.replace(/\/$/, "")}/api/projects/${creds.projectId}
|
|
4848
|
+
url: `${creds.host.apiHost.replace(/\/$/, "")}/api/projects/${creds.projectId}/${path}/`,
|
|
4687
4849
|
init: {
|
|
4688
4850
|
method: "POST",
|
|
4689
4851
|
headers: {
|
|
@@ -4694,8 +4856,9 @@ var PostHogDestination = class {
|
|
|
4694
4856
|
}
|
|
4695
4857
|
};
|
|
4696
4858
|
}
|
|
4697
|
-
|
|
4698
|
-
|
|
4859
|
+
/** POST with the retry policy above. Never throws. */
|
|
4860
|
+
async postWithRetry(creds, path, body) {
|
|
4861
|
+
const { url, init } = this.buildRequest(creds, path, body);
|
|
4699
4862
|
let attempt = 0;
|
|
4700
4863
|
let backoff = BASE_BACKOFF_MS;
|
|
4701
4864
|
let retriedAfter429 = false;
|
|
@@ -4707,26 +4870,25 @@ var PostHogDestination = class {
|
|
|
4707
4870
|
} catch (err) {
|
|
4708
4871
|
if (attempt >= MAX_ATTEMPTS) {
|
|
4709
4872
|
this.onError(err instanceof Error ? err : new Error(String(err)));
|
|
4710
|
-
return;
|
|
4873
|
+
return "gave_up";
|
|
4711
4874
|
}
|
|
4712
4875
|
await this.sleep(backoff);
|
|
4713
4876
|
backoff = Math.min(backoff * 2, MAX_BACKOFF_MS);
|
|
4714
4877
|
continue;
|
|
4715
4878
|
}
|
|
4716
4879
|
if (response.ok) {
|
|
4717
|
-
logToFile(`[task-stream]
|
|
4718
|
-
return;
|
|
4880
|
+
logToFile(`[task-stream] ${path} push ok: ${response.status}`);
|
|
4881
|
+
return "sent";
|
|
4719
4882
|
}
|
|
4720
4883
|
const status = response.status;
|
|
4721
4884
|
if (status === 401 || status === 403) {
|
|
4722
|
-
this.
|
|
4723
|
-
|
|
4724
|
-
return;
|
|
4885
|
+
this.onError(/* @__PURE__ */ new Error(`${path} auth failed: ${status}`));
|
|
4886
|
+
return "auth_rejected";
|
|
4725
4887
|
}
|
|
4726
4888
|
if (status === 429) {
|
|
4727
4889
|
if (retriedAfter429) {
|
|
4728
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4729
|
-
return;
|
|
4890
|
+
this.onError(/* @__PURE__ */ new Error(`${path} rate limited`));
|
|
4891
|
+
return "gave_up";
|
|
4730
4892
|
}
|
|
4731
4893
|
retriedAfter429 = true;
|
|
4732
4894
|
const wait = parseRetryAfter(response.headers.get("Retry-After"));
|
|
@@ -4736,8 +4898,8 @@ var PostHogDestination = class {
|
|
|
4736
4898
|
}
|
|
4737
4899
|
if (status >= 500) {
|
|
4738
4900
|
if (attempt >= MAX_ATTEMPTS) {
|
|
4739
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4740
|
-
return;
|
|
4901
|
+
this.onError(/* @__PURE__ */ new Error(`${path} server error: ${status}`));
|
|
4902
|
+
return "gave_up";
|
|
4741
4903
|
}
|
|
4742
4904
|
await this.sleep(backoff);
|
|
4743
4905
|
backoff = Math.min(backoff * 2, MAX_BACKOFF_MS);
|
|
@@ -4748,12 +4910,13 @@ var PostHogDestination = class {
|
|
|
4748
4910
|
try {
|
|
4749
4911
|
detail = await response.text();
|
|
4750
4912
|
} catch {}
|
|
4751
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4752
|
-
return;
|
|
4913
|
+
this.onError(/* @__PURE__ */ new Error(`${path} bad request (400): ${detail}`));
|
|
4914
|
+
return "gave_up";
|
|
4753
4915
|
}
|
|
4754
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4755
|
-
return;
|
|
4916
|
+
this.onError(/* @__PURE__ */ new Error(`${path} unexpected status: ${status}`));
|
|
4917
|
+
return "gave_up";
|
|
4756
4918
|
}
|
|
4919
|
+
return "gave_up";
|
|
4757
4920
|
}
|
|
4758
4921
|
};
|
|
4759
4922
|
//#endregion
|
|
@@ -4877,7 +5040,7 @@ var WizardRunSync = class {
|
|
|
4877
5040
|
type: "local_folder",
|
|
4878
5041
|
project_name: projectName
|
|
4879
5042
|
},
|
|
4880
|
-
...valid("2.
|
|
5043
|
+
...valid("2.84.0") ? { wizard_version: VERSION } : {},
|
|
4881
5044
|
idempotency_key: randomUUID()
|
|
4882
5045
|
});
|
|
4883
5046
|
const result = await this.request("POST", "", body, this.tasksAbort.signal);
|
|
@@ -5202,6 +5365,8 @@ var TaskStreamPush = class {
|
|
|
5202
5365
|
unsubscribe = null;
|
|
5203
5366
|
debounceTimer = null;
|
|
5204
5367
|
inFlight = null;
|
|
5368
|
+
/** The scan send, once the user agreed to share. Shutdown waits for it. */
|
|
5369
|
+
scanInFlight = null;
|
|
5205
5370
|
needsAnotherPush = false;
|
|
5206
5371
|
shuttingDown = false;
|
|
5207
5372
|
constructor(opts) {
|
|
@@ -5230,6 +5395,7 @@ var TaskStreamPush = class {
|
|
|
5230
5395
|
if (this.unsubscribe) return;
|
|
5231
5396
|
const target = store ?? this.store;
|
|
5232
5397
|
this.unsubscribe = target.subscribe(() => this.onStoreChange());
|
|
5398
|
+
this.sendScanIfShared();
|
|
5233
5399
|
}
|
|
5234
5400
|
/** Stop subscribing. Does not flush. */
|
|
5235
5401
|
detach() {
|
|
@@ -5260,8 +5426,8 @@ var TaskStreamPush = class {
|
|
|
5260
5426
|
this.detach();
|
|
5261
5427
|
if (!this.enabled) return;
|
|
5262
5428
|
const phase = this.store.session.runPhase;
|
|
5263
|
-
|
|
5264
|
-
const flush = this.flush();
|
|
5429
|
+
const isTerminal = phase === "completed" || phase === "error";
|
|
5430
|
+
const flush = Promise.all([isTerminal ? this.flush() : void 0, this.scanInFlight]);
|
|
5265
5431
|
if (timeoutMs <= 0) return;
|
|
5266
5432
|
let timer;
|
|
5267
5433
|
try {
|
|
@@ -5281,6 +5447,7 @@ var TaskStreamPush = class {
|
|
|
5281
5447
|
}
|
|
5282
5448
|
onStoreChange() {
|
|
5283
5449
|
if (!this.enabled || this.shuttingDown) return;
|
|
5450
|
+
this.sendScanIfShared();
|
|
5284
5451
|
const phase = this.store.session.runPhase;
|
|
5285
5452
|
if (phase === "idle") return;
|
|
5286
5453
|
this.selectRemoteSync();
|
|
@@ -5366,6 +5533,20 @@ var TaskStreamPush = class {
|
|
|
5366
5533
|
this.lastPushedQuestionId = payload.pending_input?.id ?? null;
|
|
5367
5534
|
await Promise.all(this.destinations.filter((d) => d.name !== "posthog" || this.remoteSync === "wizard-session").map((d) => d.send(event, payload).catch(() => {})));
|
|
5368
5535
|
}
|
|
5536
|
+
/**
|
|
5537
|
+
* Attach the shared scan to this session, once. It carries the stream's
|
|
5538
|
+
* `session_id`, so PostHog can join the scan to the session row.
|
|
5539
|
+
*/
|
|
5540
|
+
sendScanIfShared() {
|
|
5541
|
+
if (this.scanInFlight) return;
|
|
5542
|
+
const report = this.store.session.codebaseScanReport;
|
|
5543
|
+
if (!report) return;
|
|
5544
|
+
const payload = {
|
|
5545
|
+
...report,
|
|
5546
|
+
session_id: this.sessionId
|
|
5547
|
+
};
|
|
5548
|
+
this.scanInFlight = Promise.all(this.destinations.map((d) => d.sendScan?.(payload).catch(() => {}))).then(() => void 0);
|
|
5549
|
+
}
|
|
5369
5550
|
selectRemoteSync() {
|
|
5370
5551
|
if (this.remoteSync || !this.store.session.credentials) return;
|
|
5371
5552
|
if (this.store.session.runPhase === "idle") return;
|
|
@@ -5402,6 +5583,6 @@ function apiKeyCredentials(apiKey, options = {}) {
|
|
|
5402
5583
|
}) };
|
|
5403
5584
|
}
|
|
5404
5585
|
//#endregion
|
|
5405
|
-
export {
|
|
5586
|
+
export { SELF_DRIVING_INTEGRATE_PATH_KEY as $, getProgramConfig as A, config$3 as B, oauthErrorFromTokenBody as C, regionOption as Ct, findProgramConfig as D, Program as E, FEATURE_FLAGS_UNSUPPORTED as F, config$4 as G, DISPLAY_NAME as H, config$1 as I, PRICING_SHORT as J, NO_DEFAULT_LIMIT as K, config$2 as L, getSubcommandPrograms as M, config as N, getCommandPath as O, FEATURE_FLAGS_STEP_SKILL_ID as P, POSTHOG_PRESENT_KEY as Q, ERROR_TRACKING_PROJECT_PATH_KEY as R, oauthErrorFromCallbackParams as S, isHeadless as St, PROGRAM_REGISTRY as T, MANUAL_SDK_VARIANTS as U, detectSourceMapsProjects as V, SOURCE_MAPS_CONTEXT_KEYS as W, GITHUB_REQUIRED_BODY as X, detectSelfDrivingIntegrationProjects as Y, GITHUB_REQUIRED_MESSAGE as Z, missingOAuthScopes as _, detectTargets as _t, PostHogDestination as a, withScopeAdditions as at, buildCallbackErrorHtml as b, installSteeringSnippet as bt, buildSession as c, SIGNUP_WIZARD_READINESS_CONFIG as ct, SessionStore as d, config$10 as dt, config$5 as et, applyAgentProgress as f, config$11 as ft, getOAuthClientId as g, CLI_STEERING_TARGETS as gt, OAuthTokenResponseSchema as h, createSkillProgram as ht, createWizardRunSync as i, CONNECT_SLACK_SCOPE_ADDITIONS as it, getProvisioningScopesForProgram as j, getOAuthScopesForProgram as k, TASK_OUTCOMES_KEY as l, evaluateWizardReadiness as lt, logIn as m, config$13 as mt, resolveApiKeyLogin as n, config$7 as nt, createFileDestination as o, getAuditChecks as ot, TaskStatus as p, config$12 as pt, PRICING_LONG as q, TaskStreamPush as r, config$8 as rt, storeInteraction as s, SERVICE_LABELS as st, apiKeyCredentials as t, config$6 as tt, runProgram as u, getBlockingServiceKeys as ut, parseOAuthScopes as v, findTarget as vt, reportCodebaseScan as w, buildOAuthFailureMessage as x, headlessOption as xt, OAuthError as y, installOrUpdatePostHogCli as yt, detectErrorTrackingProjects as z };
|
|
5406
5587
|
|
|
5407
|
-
//# sourceMappingURL=programs-
|
|
5588
|
+
//# sourceMappingURL=programs-mxhRXwP-.js.map
|