@posthog/wizard 2.35.0 → 2.36.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/dist/{add-mcp-server-to-clients-to65gLPl.js → add-mcp-server-to-clients-D5e3JbUC.js} +6 -6
- package/dist/{add-mcp-server-to-clients-to65gLPl.js.map → add-mcp-server-to-clients-D5e3JbUC.js.map} +1 -1
- package/dist/{agent-interface-CXL9i_vX.js → agent-interface-CPn9pZ8j.js} +171 -171
- package/dist/{agent-interface-CXL9i_vX.js.map → agent-interface-CPn9pZ8j.js.map} +1 -1
- package/dist/{agent-runner-CCTTG_Rn.js → agent-runner-Cic1uZZ8.js} +56 -40
- package/dist/agent-runner-Cic1uZZ8.js.map +1 -0
- package/dist/{analytics-DP_j88IC.js → analytics-Be_wRgxD.js} +2 -2
- package/dist/{analytics-DP_j88IC.js.map → analytics-Be_wRgxD.js.map} +1 -1
- package/dist/{api-Bdxv7mWH.js → api-C_R_ybiA.js} +3 -3
- package/dist/{api-Bdxv7mWH.js.map → api-C_R_ybiA.js.map} +1 -1
- package/dist/bin.js +267 -55
- package/dist/bin.js.map +1 -1
- package/dist/{ci-install-BO-KLPLD.js → ci-install-B0BHTkGI.js} +4 -4
- package/dist/{ci-install-BO-KLPLD.js.map → ci-install-B0BHTkGI.js.map} +1 -1
- package/dist/{debug-DXWxKT5f.js → debug-BpWrz3hX.js} +2 -2
- package/dist/{debug-DXWxKT5f.js.map → debug-BpWrz3hX.js.map} +1 -1
- package/dist/{debug-Clw8ctxh.js → debug-DJS2KPGb.js} +1 -1
- package/dist/{defaults-4rSse24X.js → defaults-UswXMiTx.js} +1 -1
- package/dist/{defaults-4rSse24X.js.map → defaults-UswXMiTx.js.map} +1 -1
- package/dist/{env-api-key-B3gE9Un0.js → env-api-key-Db-mNPK2.js} +1 -1
- package/dist/{env-api-key-B3gE9Un0.js.map → env-api-key-Db-mNPK2.js.map} +1 -1
- package/dist/{environment-C4HyCWTC.js → environment-Dc6VTWyK.js} +3 -3
- package/dist/{environment-C4HyCWTC.js.map → environment-Dc6VTWyK.js.map} +1 -1
- package/dist/{file-utils-CW8XbbZP.js → file-utils-Buj9-umf.js} +2 -2
- package/dist/{file-utils-CW8XbbZP.js.map → file-utils-Buj9-umf.js.map} +1 -1
- package/dist/{headless-ui-BoZYhNpE.js → headless-ui-BplqZRcO.js} +2 -2
- package/dist/{headless-ui-BoZYhNpE.js.map → headless-ui-BplqZRcO.js.map} +1 -1
- package/dist/{host-resolution-Dw0fS8h5.js → host-resolution-BD6TcZG0.js} +3 -3
- package/dist/{host-resolution-Dw0fS8h5.js.map → host-resolution-BD6TcZG0.js.map} +1 -1
- package/dist/{interactive-pwrc7QM-.js → interactive-BspTioP_.js} +2 -2
- package/dist/{interactive-pwrc7QM-.js.map → interactive-BspTioP_.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-DZjjoeu3.js → mcp-prompt-streaming-BCNzyL12.js} +4 -4
- package/dist/{mcp-prompt-streaming-DZjjoeu3.js.map → mcp-prompt-streaming-BCNzyL12.js.map} +1 -1
- package/dist/{non-interactive-BW-MZYrP.js → non-interactive-CFikUAzO.js} +2 -2
- package/dist/{non-interactive-BW-MZYrP.js.map → non-interactive-CFikUAzO.js.map} +1 -1
- package/dist/{package-manager-BgXgJ1Mu.js → package-manager-L7gsAbE0.js} +2 -2
- package/dist/{package-manager-BgXgJ1Mu.js.map → package-manager-L7gsAbE0.js.map} +1 -1
- package/dist/{playground-xuLBqzJM.js → playground-Bl2iPxdt.js} +7 -7
- package/dist/{playground-xuLBqzJM.js.map → playground-Bl2iPxdt.js.map} +1 -1
- package/dist/{posthog-integration-Bj9WmwDq.js → posthog-integration-B6pTHVcn.js} +29 -14
- package/dist/posthog-integration-B6pTHVcn.js.map +1 -0
- package/dist/{provisioning-BF2reo5_.js → provisioning-C9ts56R5.js} +4 -4
- package/dist/{provisioning-BF2reo5_.js.map → provisioning-C9ts56R5.js.map} +1 -1
- package/dist/{registry-Dj17F0a-.js → registry-DFazVUSE.js} +4 -4
- package/dist/{registry-Dj17F0a-.js.map → registry-DFazVUSE.js.map} +1 -1
- package/dist/{setup-utils-DyTlaGOV.js → setup-utils-BxdW2R0r.js} +9 -9
- package/dist/{setup-utils-DyTlaGOV.js.map → setup-utils-BxdW2R0r.js.map} +1 -1
- package/dist/{start-tui-S4fBBfmO.js → start-tui-oGWfxdTd.js} +374 -24
- package/dist/start-tui-oGWfxdTd.js.map +1 -0
- package/dist/{steps-CHgikk6q.js → steps-O0v5UU1G.js} +7 -7
- package/dist/{steps-CHgikk6q.js.map → steps-O0v5UU1G.js.map} +1 -1
- package/dist/{store-vr5j37CU.js → store-Di9OvMql.js} +55 -4
- package/dist/store-Di9OvMql.js.map +1 -0
- package/dist/{task-stream-BVF6gi8x.js → task-stream-DkbGqxZv.js} +2 -2
- package/dist/{task-stream-BVF6gi8x.js.map → task-stream-DkbGqxZv.js.map} +1 -1
- package/dist/{telemetry-CR-ilpWe.js → telemetry-D5WQ4-Ic.js} +3 -3
- package/dist/{telemetry-CR-ilpWe.js.map → telemetry-D5WQ4-Ic.js.map} +1 -1
- package/dist/{terminal-uzjco-wz.js → terminal-Bd-k7pCi.js} +13 -13
- package/dist/{terminal-uzjco-wz.js.map → terminal-Bd-k7pCi.js.map} +1 -1
- package/dist/{urls-ChWit8SE.js → urls-DpTCPWLD.js} +2 -2
- package/dist/{urls-ChWit8SE.js.map → urls-DpTCPWLD.js.map} +1 -1
- package/dist/{wizard-abort-CNYxdjJl.js → wizard-abort-C1t9M-JN.js} +1 -1
- package/dist/{wizard-abort-BE_j8xUt.js → wizard-abort-t41wO4Bh.js} +4 -4
- package/dist/{wizard-abort-BE_j8xUt.js.map → wizard-abort-t41wO4Bh.js.map} +1 -1
- package/dist/{wizard-session-BHoLQueN.js → wizard-session-CqihOtk3.js} +6 -1
- package/dist/wizard-session-CqihOtk3.js.map +1 -0
- package/dist/{wizard-session-D0PJ9lsl.js → wizard-session-xzqycI7i.js} +1 -1
- package/package.json +1 -1
- package/dist/agent-runner-CCTTG_Rn.js.map +0 -1
- package/dist/posthog-integration-Bj9WmwDq.js.map +0 -1
- package/dist/start-tui-S4fBBfmO.js.map +0 -1
- package/dist/store-vr5j37CU.js.map +0 -1
- package/dist/wizard-session-BHoLQueN.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as getSkillsBaseUrl, I as POSTHOG_DOCS_URL, Z as WIZARD_USER_AGENT, a as getLogFilePath, et as VERSION, h as LoggingUI, m as setUI, p as getUI, r as debug, s as logToFile } from "./debug-
|
|
3
|
-
import { t as analytics } from "./analytics-
|
|
4
|
-
import { r as setEntryCommand } from "./telemetry-
|
|
5
|
-
import { n as isUsingTypeScript } from "./setup-utils-
|
|
6
|
-
import { o as getUiHostFromHost } from "./urls-
|
|
7
|
-
import { t as HostResolution } from "./host-resolution-
|
|
8
|
-
import { o as handleApiError } from "./api-
|
|
9
|
-
import "./wizard-session-
|
|
10
|
-
import { r as runCleanups } from "./wizard-abort-
|
|
11
|
-
import { n as isNonInteractiveEnvironment } from "./environment-
|
|
12
|
-
import { D as AUDIT_CHECKS_KEY, E as AUDIT_CHECKS_FILE, O as AUDIT_REPORT_FILE, f as AgentSignals, l as recoverOrphanedSettingsBackups, v as SETUP_REPORT_FILE, x as fetchSkillMenu, y as WIZARD_TOOL_NAMES } from "./agent-interface-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
16
|
-
import { n as
|
|
2
|
+
import { $ as getSkillsBaseUrl, I as POSTHOG_DOCS_URL, Z as WIZARD_USER_AGENT, a as getLogFilePath, et as VERSION, h as LoggingUI, j as Integration, m as setUI, p as getUI, r as debug, s as logToFile } from "./debug-BpWrz3hX.js";
|
|
3
|
+
import { t as analytics } from "./analytics-Be_wRgxD.js";
|
|
4
|
+
import { r as setEntryCommand } from "./telemetry-D5WQ4-Ic.js";
|
|
5
|
+
import { n as isUsingTypeScript } from "./setup-utils-BxdW2R0r.js";
|
|
6
|
+
import { o as getUiHostFromHost } from "./urls-DpTCPWLD.js";
|
|
7
|
+
import { t as HostResolution } from "./host-resolution-BD6TcZG0.js";
|
|
8
|
+
import { o as handleApiError } from "./api-C_R_ybiA.js";
|
|
9
|
+
import "./wizard-session-CqihOtk3.js";
|
|
10
|
+
import { r as runCleanups } from "./wizard-abort-t41wO4Bh.js";
|
|
11
|
+
import { n as isNonInteractiveEnvironment } from "./environment-Dc6VTWyK.js";
|
|
12
|
+
import { D as AUDIT_CHECKS_KEY, E as AUDIT_CHECKS_FILE, O as AUDIT_REPORT_FILE, f as AgentSignals, l as recoverOrphanedSettingsBackups, v as SETUP_REPORT_FILE, x as fetchSkillMenu, y as WIZARD_TOOL_NAMES } from "./agent-interface-CPn9pZ8j.js";
|
|
13
|
+
import { n as runAgent, r as authenticate } from "./agent-runner-Cic1uZZ8.js";
|
|
14
|
+
import { i as SPINNER_MESSAGE, t as FRAMEWORK_REGISTRY } from "./registry-DFazVUSE.js";
|
|
15
|
+
import { _ as gatherFrameworkContext, a as LINE_CHART_BLOCK, b as parseRequirementsTxt, g as detectProjectsWithAgent, h as HEALTH_CHECK_STEP, i as FUNNEL_BLOCK, m as Icons, n as integrationRunStep, o as PRODUCT_SUITE_BLOCK, p as Colors, r as posthogIntegrationConfig, s as StatusPeekTrigger, u as isClearBlock, v as parsePipfile, y as parsePyprojectToml } from "./posthog-integration-B6pTHVcn.js";
|
|
16
|
+
import { n as safeReadFile, r as walkProjectFiles, t as IGNORED_DIRS } from "./file-utils-Buj9-umf.js";
|
|
17
|
+
import { n as readApiKeyFromEnv } from "./env-api-key-Db-mNPK2.js";
|
|
17
18
|
import { satisfies } from "semver";
|
|
18
19
|
import yargs from "yargs";
|
|
19
20
|
import { hideBin } from "yargs/helpers";
|
|
20
21
|
import fs, { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
21
|
-
import path, { join, relative } from "path";
|
|
22
|
+
import path, { join, relative, resolve } from "path";
|
|
22
23
|
import * as os from "node:os";
|
|
23
24
|
import * as path$1 from "node:path";
|
|
24
25
|
import { spawnSync } from "node:child_process";
|
|
@@ -234,7 +235,7 @@ function runProvision(argv) {
|
|
|
234
235
|
}
|
|
235
236
|
async function provision({ email, region, name, baseUrl, jsonMode }) {
|
|
236
237
|
try {
|
|
237
|
-
const { provisionNewAccount } = await import("./provisioning-
|
|
238
|
+
const { provisionNewAccount } = await import("./provisioning-C9ts56R5.js").then((n) => n.n);
|
|
238
239
|
if (!jsonMode) getUI().log.info(`Provisioning account for ${email} in ${region}...`);
|
|
239
240
|
emitResult(await provisionNewAccount(email, name, region, { baseUrl }), jsonMode);
|
|
240
241
|
process.exit(0);
|
|
@@ -299,22 +300,22 @@ const basicIntegrationCommand = {
|
|
|
299
300
|
setEntryCommand("integrate");
|
|
300
301
|
(async () => {
|
|
301
302
|
if (isHeadless(argv)) {
|
|
302
|
-
const { runHeadlessInstall } = await import("./ci-install-
|
|
303
|
+
const { runHeadlessInstall } = await import("./ci-install-B0BHTkGI.js");
|
|
303
304
|
return runHeadlessInstall(argv);
|
|
304
305
|
}
|
|
305
306
|
if (argv.ci) {
|
|
306
|
-
const { runCIInstall } = await import("./ci-install-
|
|
307
|
+
const { runCIInstall } = await import("./ci-install-B0BHTkGI.js");
|
|
307
308
|
return runCIInstall(argv);
|
|
308
309
|
}
|
|
309
310
|
if (isNonInteractiveEnvironment()) {
|
|
310
|
-
const { failNonInteractive } = await import("./non-interactive-
|
|
311
|
+
const { failNonInteractive } = await import("./non-interactive-CFikUAzO.js");
|
|
311
312
|
return failNonInteractive();
|
|
312
313
|
}
|
|
313
314
|
if (argv.playground) {
|
|
314
|
-
const { runPlayground } = await import("./playground-
|
|
315
|
+
const { runPlayground } = await import("./playground-Bl2iPxdt.js");
|
|
315
316
|
return runPlayground();
|
|
316
317
|
}
|
|
317
|
-
const { runInteractive } = await import("./interactive-
|
|
318
|
+
const { runInteractive } = await import("./interactive-BspTioP_.js");
|
|
318
319
|
runInteractive(argv);
|
|
319
320
|
})();
|
|
320
321
|
}
|
|
@@ -3277,6 +3278,48 @@ const errorTrackingUploadSourceMapsConfig = {
|
|
|
3277
3278
|
* PostHog-side flags (`product-autonomy`, `signals-scout`) are unchanged by
|
|
3278
3279
|
* the wizard-side "self-driving" rename.
|
|
3279
3280
|
*/
|
|
3281
|
+
/** frameworkContext key holding the deterministic PostHog-presence result. */
|
|
3282
|
+
const POSTHOG_PRESENT_KEY = "postHogPresent";
|
|
3283
|
+
/**
|
|
3284
|
+
* frameworkContext key holding the repo-relative path of the project the user
|
|
3285
|
+
* picked on the integration-detect screen ("." for the repo root). The
|
|
3286
|
+
* integrate-run phase scopes its install dir to this so a monorepo integrates
|
|
3287
|
+
* into the chosen sub-app, not the root.
|
|
3288
|
+
*/
|
|
3289
|
+
const SELF_DRIVING_INTEGRATE_PATH_KEY = "selfDrivingIntegratePath";
|
|
3290
|
+
const POSTHOG_PACKAGE_RE = /(^|["'\s/=])posthog/im;
|
|
3291
|
+
/**
|
|
3292
|
+
* Deterministic, offline check: does the project already have a PostHog SDK?
|
|
3293
|
+
* Scans the common dependency manifests at the install dir for a `posthog`
|
|
3294
|
+
* package — the same signal the agentic detector reports as `hasPostHog`, but
|
|
3295
|
+
* instant and credential-free. Drives whether self-driving asks to integrate
|
|
3296
|
+
* first ("not found") or proceeds straight to setup ("found").
|
|
3297
|
+
*/
|
|
3298
|
+
function detectPostHogPresent(installDir) {
|
|
3299
|
+
const manifests = [
|
|
3300
|
+
"package.json",
|
|
3301
|
+
"requirements.txt",
|
|
3302
|
+
"pyproject.toml",
|
|
3303
|
+
"Pipfile",
|
|
3304
|
+
"Gemfile",
|
|
3305
|
+
"go.mod",
|
|
3306
|
+
"composer.json",
|
|
3307
|
+
"pubspec.yaml"
|
|
3308
|
+
];
|
|
3309
|
+
for (const dir of [
|
|
3310
|
+
".",
|
|
3311
|
+
"app",
|
|
3312
|
+
"frontend",
|
|
3313
|
+
"backend"
|
|
3314
|
+
]) for (const name of manifests) {
|
|
3315
|
+
const path = join(installDir, dir, name);
|
|
3316
|
+
if (!existsSync(path)) continue;
|
|
3317
|
+
try {
|
|
3318
|
+
if (POSTHOG_PACKAGE_RE.test(readFileSync(path, "utf8"))) return true;
|
|
3319
|
+
} catch {}
|
|
3320
|
+
}
|
|
3321
|
+
return false;
|
|
3322
|
+
}
|
|
3280
3323
|
/**
|
|
3281
3324
|
* `[ABORT] <reason>` cases the self-driving skill can emit. The
|
|
3282
3325
|
* reason strings are part of the skill contract — the context-mill
|
|
@@ -3337,9 +3380,110 @@ function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
|
3337
3380
|
});
|
|
3338
3381
|
return;
|
|
3339
3382
|
}
|
|
3383
|
+
setFrameworkContext(POSTHOG_PRESENT_KEY, detectPostHogPresent(installDir));
|
|
3384
|
+
}
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region src/lib/programs/self-driving/detect-agentic.ts
|
|
3387
|
+
/**
|
|
3388
|
+
* Agentic (Haiku) detection for self-driving's integration phase.
|
|
3389
|
+
*
|
|
3390
|
+
* Mirrors source-maps: the integration-detect screen runs `detectSelfDriving-
|
|
3391
|
+
* IntegrationProjects` (the shared Haiku detector with the integration framework
|
|
3392
|
+
* targets), shows a project map, and the user picks one. This file supplies the
|
|
3393
|
+
* targets, maps the result back to `Integration`s, and classifies each project
|
|
3394
|
+
* as instrumentable (a framework the wizard supports that doesn't already have
|
|
3395
|
+
* PostHog). The screen writes the choice to the session; `prepSelfDriving-
|
|
3396
|
+
* Integration` then gathers the chosen project's framework context before the
|
|
3397
|
+
* integration agent runs (the runner scopes the install dir).
|
|
3398
|
+
*/
|
|
3399
|
+
/** Integration framework targets for the agentic detector (id → display name). */
|
|
3400
|
+
const INTEGRATION_TARGETS = Object.entries(FRAMEWORK_REGISTRY).map(([id, config]) => ({
|
|
3401
|
+
id,
|
|
3402
|
+
name: config.metadata.name
|
|
3403
|
+
}));
|
|
3404
|
+
const INTEGRATION_IDS = new Set(Object.values(Integration));
|
|
3405
|
+
function classify(integration, hasPostHog) {
|
|
3406
|
+
if (integration == null) return {
|
|
3407
|
+
instrumentable: false,
|
|
3408
|
+
reason: "Not a framework the wizard can set up yet"
|
|
3409
|
+
};
|
|
3410
|
+
if (hasPostHog) return {
|
|
3411
|
+
instrumentable: false,
|
|
3412
|
+
reason: "Already has the PostHog SDK"
|
|
3413
|
+
};
|
|
3414
|
+
return { instrumentable: true };
|
|
3415
|
+
}
|
|
3416
|
+
/** Map a generic detection report into classified integration projects. */
|
|
3417
|
+
function toIntegrationReport(report) {
|
|
3418
|
+
return {
|
|
3419
|
+
repoType: report.repoType,
|
|
3420
|
+
projects: report.projects.map((p) => {
|
|
3421
|
+
const integration = p.targetId && INTEGRATION_IDS.has(p.targetId) ? p.targetId : null;
|
|
3422
|
+
return {
|
|
3423
|
+
path: p.path,
|
|
3424
|
+
framework: p.framework,
|
|
3425
|
+
integration,
|
|
3426
|
+
hasPostHog: p.hasPostHog,
|
|
3427
|
+
...classify(integration, p.hasPostHog)
|
|
3428
|
+
};
|
|
3429
|
+
})
|
|
3430
|
+
};
|
|
3431
|
+
}
|
|
3432
|
+
/** Run the Haiku detector over the repo and classify projects for integration. */
|
|
3433
|
+
async function detectSelfDrivingIntegrationProjects(session, onEvent) {
|
|
3434
|
+
return toIntegrationReport(await detectProjectsWithAgent(session, {
|
|
3435
|
+
targets: INTEGRATION_TARGETS,
|
|
3436
|
+
purpose: "set up a PostHog SDK integration",
|
|
3437
|
+
onEvent
|
|
3438
|
+
}));
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* Prepare the integration phase after the user picked a project on the
|
|
3442
|
+
* integration-detect screen (which set `session.integration`, `frameworkConfig`,
|
|
3443
|
+
* and the chosen path). Scopes `installDir` to the chosen project — so a
|
|
3444
|
+
* monorepo integrates into the picked sub-app — and gathers that project's
|
|
3445
|
+
* framework context, mirroring posthog-integration's `ciPreRun`. Used as the
|
|
3446
|
+
* integrate-run step's `onRunPrep`.
|
|
3447
|
+
*/
|
|
3448
|
+
async function prepSelfDrivingIntegration(session) {
|
|
3449
|
+
const frameworkConfig = session.frameworkConfig;
|
|
3450
|
+
if (!frameworkConfig) return;
|
|
3451
|
+
const context = await gatherFrameworkContext(frameworkConfig, {
|
|
3452
|
+
installDir: session.installDir,
|
|
3453
|
+
debug: session.debug,
|
|
3454
|
+
default: false,
|
|
3455
|
+
signup: session.signup,
|
|
3456
|
+
localMcp: session.localMcp,
|
|
3457
|
+
ci: session.ci,
|
|
3458
|
+
benchmark: session.benchmark,
|
|
3459
|
+
yaraReport: session.yaraReport
|
|
3460
|
+
});
|
|
3461
|
+
for (const [key, value] of Object.entries(context)) if (!(key in session.frameworkContext)) session.frameworkContext[key] = value;
|
|
3340
3462
|
}
|
|
3341
3463
|
//#endregion
|
|
3342
3464
|
//#region src/lib/programs/self-driving/steps.ts
|
|
3465
|
+
/**
|
|
3466
|
+
* Self-driving program step list.
|
|
3467
|
+
*
|
|
3468
|
+
* detect → intro → integration-check → health-check → auth → integrate-detect →
|
|
3469
|
+
* integrate-run → self-driving-handoff → run → outro. A deterministic check in
|
|
3470
|
+
* `detect` decides whether PostHog is already in the project: found → the
|
|
3471
|
+
* integration screens are skipped and the integrate-run phase never shows; not
|
|
3472
|
+
* found → integration-check reports it and the only action sets up PostHog.
|
|
3473
|
+
* After auth, `integrate-detect` runs the Haiku detector and has the user pick
|
|
3474
|
+
* which project to set PostHog up in (a monorepo can have several);
|
|
3475
|
+
* `integrate-run` then runs the real integration program's agent (its own task
|
|
3476
|
+
* list) in that project. `self-driving-handoff` then bridges to Self-driving
|
|
3477
|
+
* ("PostHog is installed — now set up Self-driving") before the Self-driving
|
|
3478
|
+
* run. No keep-skills step: the setup skill is transient, so postRun removes it.
|
|
3479
|
+
*/
|
|
3480
|
+
/** True once detection found PostHog already present in the project. */
|
|
3481
|
+
const postHogPresent = (session) => session.frameworkContext[POSTHOG_PRESENT_KEY] === true;
|
|
3482
|
+
/** Absolute dir to integrate into: the picked sub-app, else the repo root. */
|
|
3483
|
+
const integrationDir = (session) => {
|
|
3484
|
+
const rel = session.frameworkContext[SELF_DRIVING_INTEGRATE_PATH_KEY];
|
|
3485
|
+
return typeof rel === "string" && rel !== "." ? resolve(session.installDir, rel) : session.installDir;
|
|
3486
|
+
};
|
|
3343
3487
|
const SELF_DRIVING_PROGRAM = [
|
|
3344
3488
|
{
|
|
3345
3489
|
id: "detect",
|
|
@@ -3352,6 +3496,14 @@ const SELF_DRIVING_PROGRAM = [
|
|
|
3352
3496
|
screenId: "self-driving-intro",
|
|
3353
3497
|
gate: (session) => session.setupConfirmed
|
|
3354
3498
|
},
|
|
3499
|
+
{
|
|
3500
|
+
id: "integration-check",
|
|
3501
|
+
label: "Integration",
|
|
3502
|
+
screenId: "self-driving-integration-check",
|
|
3503
|
+
show: (session) => !postHogPresent(session) && session.integrate === null,
|
|
3504
|
+
isComplete: (session) => postHogPresent(session) || session.integrate !== null,
|
|
3505
|
+
gate: (session) => postHogPresent(session) || session.integrate !== null
|
|
3506
|
+
},
|
|
3355
3507
|
HEALTH_CHECK_STEP,
|
|
3356
3508
|
{
|
|
3357
3509
|
id: "auth",
|
|
@@ -3359,6 +3511,28 @@ const SELF_DRIVING_PROGRAM = [
|
|
|
3359
3511
|
screenId: "auth",
|
|
3360
3512
|
isComplete: (session) => session.credentials !== null
|
|
3361
3513
|
},
|
|
3514
|
+
{
|
|
3515
|
+
id: "integrate-detect",
|
|
3516
|
+
label: "Detecting",
|
|
3517
|
+
screenId: "self-driving-integration-detect",
|
|
3518
|
+
show: (session) => session.integrate === true && session.integration == null,
|
|
3519
|
+
isComplete: (session) => session.integration != null
|
|
3520
|
+
},
|
|
3521
|
+
{
|
|
3522
|
+
...integrationRunStep,
|
|
3523
|
+
id: "integrate-run",
|
|
3524
|
+
onRunPrep: prepSelfDrivingIntegration,
|
|
3525
|
+
targetDir: integrationDir,
|
|
3526
|
+
show: (session) => session.integrate === true,
|
|
3527
|
+
isComplete: (session) => session.completedRuns.includes("integrate-run")
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
id: "self-driving-handoff",
|
|
3531
|
+
label: "Ready",
|
|
3532
|
+
screenId: "self-driving-handoff",
|
|
3533
|
+
show: (session) => session.integrate === true,
|
|
3534
|
+
isComplete: (session) => session.selfDrivingHandoffConfirmed
|
|
3535
|
+
},
|
|
3362
3536
|
{
|
|
3363
3537
|
id: "run",
|
|
3364
3538
|
label: "Self-driving",
|
|
@@ -3380,6 +3554,10 @@ const SELF_DRIVING_PROGRAM = [
|
|
|
3380
3554
|
* every step (which MCP tools to call, which sources/scouts apply, how
|
|
3381
3555
|
* to verify); this prompt carries the order, the wizard-specific
|
|
3382
3556
|
* mechanics (wizard_ask, abort signals), and the project URLs.
|
|
3557
|
+
*
|
|
3558
|
+
* Integration (when the project has no PostHog yet) runs as a separate phase
|
|
3559
|
+
* before this — the real integration program, with its own screens and task
|
|
3560
|
+
* list — so this prompt only covers the Self-driving steps.
|
|
3383
3561
|
*/
|
|
3384
3562
|
function buildSelfDrivingPrompt(ctx) {
|
|
3385
3563
|
const uiHost = getUiHostFromHost(ctx.host).replace(/\/$/, "");
|
|
@@ -3843,13 +4021,13 @@ const mcpAddCommand = {
|
|
|
3843
4021
|
function runMcpAdd(argv) {
|
|
3844
4022
|
const features = parseFeatures(argv.features);
|
|
3845
4023
|
(async () => {
|
|
3846
|
-
const { readApiKeyFromEnv } = await import("./env-api-key-
|
|
4024
|
+
const { readApiKeyFromEnv } = await import("./env-api-key-Db-mNPK2.js").then((n) => n.t);
|
|
3847
4025
|
const apiKey = argv.apiKey || readApiKeyFromEnv();
|
|
3848
4026
|
const debug = argv.debug;
|
|
3849
4027
|
const localMcp = argv.local;
|
|
3850
4028
|
try {
|
|
3851
|
-
const { startTUI } = await import("./start-tui-
|
|
3852
|
-
const { buildSession } = await import("./wizard-session-
|
|
4029
|
+
const { startTUI } = await import("./start-tui-oGWfxdTd.js");
|
|
4030
|
+
const { buildSession } = await import("./wizard-session-xzqycI7i.js");
|
|
3853
4031
|
const tui = startTUI(VERSION, Program.McpAdd);
|
|
3854
4032
|
tui.store.session = buildSession({
|
|
3855
4033
|
debug,
|
|
@@ -3861,7 +4039,7 @@ function runMcpAdd(argv) {
|
|
|
3861
4039
|
} catch (error) {
|
|
3862
4040
|
if (!isTUIUnavailable(error)) throw error;
|
|
3863
4041
|
setUI(new LoggingUI());
|
|
3864
|
-
const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-
|
|
4042
|
+
const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-D5e3JbUC.js").then((n) => n.r);
|
|
3865
4043
|
await addMCPServerToClientsStep({
|
|
3866
4044
|
local: localMcp,
|
|
3867
4045
|
features,
|
|
@@ -3900,8 +4078,8 @@ function runMcpRemove(argv) {
|
|
|
3900
4078
|
const debug = argv.debug;
|
|
3901
4079
|
const localMcp = argv.local;
|
|
3902
4080
|
try {
|
|
3903
|
-
const { startTUI } = await import("./start-tui-
|
|
3904
|
-
const { buildSession } = await import("./wizard-session-
|
|
4081
|
+
const { startTUI } = await import("./start-tui-oGWfxdTd.js");
|
|
4082
|
+
const { buildSession } = await import("./wizard-session-xzqycI7i.js");
|
|
3905
4083
|
const tui = startTUI(VERSION, Program.McpRemove);
|
|
3906
4084
|
tui.store.session = buildSession({
|
|
3907
4085
|
debug,
|
|
@@ -3910,7 +4088,7 @@ function runMcpRemove(argv) {
|
|
|
3910
4088
|
});
|
|
3911
4089
|
} catch {
|
|
3912
4090
|
setUI(new LoggingUI());
|
|
3913
|
-
const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-
|
|
4091
|
+
const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-D5e3JbUC.js").then((n) => n.r);
|
|
3914
4092
|
await removeMCPServerFromClientsStep({ local: localMcp });
|
|
3915
4093
|
}
|
|
3916
4094
|
})();
|
|
@@ -3932,8 +4110,8 @@ function runMcpTutorial(argv) {
|
|
|
3932
4110
|
const debug = argv.debug;
|
|
3933
4111
|
const localMcp = argv.local;
|
|
3934
4112
|
try {
|
|
3935
|
-
const { startTUI } = await import("./start-tui-
|
|
3936
|
-
const { buildSession } = await import("./wizard-session-
|
|
4113
|
+
const { startTUI } = await import("./start-tui-oGWfxdTd.js");
|
|
4114
|
+
const { buildSession } = await import("./wizard-session-xzqycI7i.js");
|
|
3937
4115
|
const tui = startTUI(VERSION, Program.McpTutorial);
|
|
3938
4116
|
tui.store.session = buildSession({
|
|
3939
4117
|
debug,
|
|
@@ -3975,6 +4153,31 @@ function resolveNoTelemetry(options) {
|
|
|
3975
4153
|
//#endregion
|
|
3976
4154
|
//#region src/lib/runners/run-wizard.ts
|
|
3977
4155
|
const WIZARD_VERSION = VERSION;
|
|
4156
|
+
/** The session a run step's agent runs in: scoped to the step's target dir
|
|
4157
|
+
* (e.g. a monorepo sub-app) with its own framework context, after any prep.
|
|
4158
|
+
* A step without `targetDir` runs in the live session, unchanged. */
|
|
4159
|
+
async function prepareRunSession(step, live) {
|
|
4160
|
+
const session = step.targetDir ? {
|
|
4161
|
+
...live,
|
|
4162
|
+
installDir: step.targetDir(live),
|
|
4163
|
+
frameworkContext: { ...live.frameworkContext }
|
|
4164
|
+
} : live;
|
|
4165
|
+
if (step.onRunPrep) await step.onRunPrep(session);
|
|
4166
|
+
return session;
|
|
4167
|
+
}
|
|
4168
|
+
/** Advance one step of a composed run to completion: the auth screen
|
|
4169
|
+
* authenticates (every later run reuses it); a step carrying its own `run`
|
|
4170
|
+
* thunk runs that agent in its dir and is recorded in `completedRuns`; the
|
|
4171
|
+
* host program's own run screen runs `config.run`; any other screen waits for
|
|
4172
|
+
* the user to satisfy `isComplete`. */
|
|
4173
|
+
async function advanceStep(step, store, config) {
|
|
4174
|
+
if (step.screenId === "auth") await authenticate(store.session, config.id);
|
|
4175
|
+
else if (step.run) {
|
|
4176
|
+
await step.run(await prepareRunSession(step, store.session));
|
|
4177
|
+
store.completeRunStep(step.id);
|
|
4178
|
+
} else if (step.screenId === "run") await runAgent(config, await prepareRunSession(step, store.session));
|
|
4179
|
+
else if (step.isComplete) await store.waitUntil(step.isComplete);
|
|
4180
|
+
}
|
|
3978
4181
|
/**
|
|
3979
4182
|
* Run a full wizard program in the TUI. Handles the full lifecycle: start TUI,
|
|
3980
4183
|
* build session, run detection, wait for intro gate, execute the
|
|
@@ -3988,9 +4191,9 @@ function runWizard(config, options) {
|
|
|
3988
4191
|
(async () => {
|
|
3989
4192
|
try {
|
|
3990
4193
|
const installDir = options.installDir || process.cwd();
|
|
3991
|
-
const { startTUI } = await import("./start-tui-
|
|
3992
|
-
const { buildSession, RunPhase } = await import("./wizard-session-
|
|
3993
|
-
const { TaskStreamPush } = await import("./task-stream-
|
|
4194
|
+
const { startTUI } = await import("./start-tui-oGWfxdTd.js");
|
|
4195
|
+
const { buildSession, RunPhase } = await import("./wizard-session-xzqycI7i.js");
|
|
4196
|
+
const { TaskStreamPush } = await import("./task-stream-DkbGqxZv.js");
|
|
3994
4197
|
const { PostHogDestination } = await import("./posthog-BrLFkaji.js");
|
|
3995
4198
|
tui = startTUI(WIZARD_VERSION, config.id);
|
|
3996
4199
|
const activeTui = tui;
|
|
@@ -4006,7 +4209,8 @@ function runWizard(config, options) {
|
|
|
4006
4209
|
baseUrl: options.baseUrl,
|
|
4007
4210
|
benchmark: options.benchmark,
|
|
4008
4211
|
yaraReport: options.yaraReport,
|
|
4009
|
-
noTelemetry: resolveNoTelemetry(options)
|
|
4212
|
+
noTelemetry: resolveNoTelemetry(options),
|
|
4213
|
+
integrate: options.integrate
|
|
4010
4214
|
});
|
|
4011
4215
|
session.programLabel = config.id;
|
|
4012
4216
|
if (options.skillId) session.skillId = options.skillId;
|
|
@@ -4042,10 +4246,16 @@ function runWizard(config, options) {
|
|
|
4042
4246
|
process.on("SIGTERM", onSignal);
|
|
4043
4247
|
await activeTui.store.runReadyHooks();
|
|
4044
4248
|
await activeTui.store.getGate("intro");
|
|
4249
|
+
await activeTui.store.getGate("integration-check");
|
|
4045
4250
|
await activeTui.store.getGate("health-check");
|
|
4046
4251
|
const skipAgent = config.run == null;
|
|
4047
|
-
|
|
4048
|
-
|
|
4252
|
+
const shown = (s) => !s.show || s.show(activeTui.store.session);
|
|
4253
|
+
if (config.steps.some((s) => s.run)) for (const step of config.steps) {
|
|
4254
|
+
if (step.screenId === "outro") break;
|
|
4255
|
+
if (shown(step)) await advanceStep(step, activeTui.store, config);
|
|
4256
|
+
}
|
|
4257
|
+
else if (skipAgent) {
|
|
4258
|
+
const { getOrAskForProjectData } = await import("./setup-utils-BxdW2R0r.js").then((n) => n.r);
|
|
4049
4259
|
const { projectApiKey, host, accessToken, projectId } = await getOrAskForProjectData({
|
|
4050
4260
|
signup: session.signup,
|
|
4051
4261
|
ci: session.ci,
|
|
@@ -4060,10 +4270,7 @@ function runWizard(config, options) {
|
|
|
4060
4270
|
host,
|
|
4061
4271
|
projectId
|
|
4062
4272
|
});
|
|
4063
|
-
} else
|
|
4064
|
-
const { runAgent } = await import("./agent-runner-CCTTG_Rn.js");
|
|
4065
|
-
await runAgent(config, activeTui.store.session);
|
|
4066
|
-
}
|
|
4273
|
+
} else await runAgent(config, activeTui.store.session);
|
|
4067
4274
|
const isDone = () => skipAgent ? activeTui.store.session.outroDismissed : activeTui.store.session.skillsComplete;
|
|
4068
4275
|
await new Promise((resolve) => {
|
|
4069
4276
|
const unsub = activeTui.store.subscribe(() => {
|
|
@@ -4150,11 +4357,11 @@ function runNonInteractive(config, options, mode) {
|
|
|
4150
4357
|
analytics.setTag("build", mode);
|
|
4151
4358
|
(async () => {
|
|
4152
4359
|
const path = await import("path");
|
|
4153
|
-
const { buildSession, RunPhase, OutroKind } = await import("./wizard-session-
|
|
4154
|
-
const { readEnvironment } = await import("./environment-
|
|
4155
|
-
const { readApiKeyFromEnv } = await import("./env-api-key-
|
|
4156
|
-
const { configureLogFileFromEnvironment, logToFile } = await import("./debug-
|
|
4157
|
-
const { wizardAbort, WizardError } = await import("./wizard-abort-
|
|
4360
|
+
const { buildSession, RunPhase, OutroKind } = await import("./wizard-session-xzqycI7i.js");
|
|
4361
|
+
const { readEnvironment } = await import("./environment-Dc6VTWyK.js").then((n) => n.t);
|
|
4362
|
+
const { readApiKeyFromEnv } = await import("./env-api-key-Db-mNPK2.js").then((n) => n.t);
|
|
4363
|
+
const { configureLogFileFromEnvironment, logToFile } = await import("./debug-DJS2KPGb.js");
|
|
4364
|
+
const { wizardAbort, WizardError } = await import("./wizard-abort-C1t9M-JN.js");
|
|
4158
4365
|
configureLogFileFromEnvironment();
|
|
4159
4366
|
const env = readEnvironment();
|
|
4160
4367
|
const apiKey = options.apiKey ?? readApiKeyFromEnv() ?? void 0;
|
|
@@ -4182,9 +4389,9 @@ function runNonInteractive(config, options, mode) {
|
|
|
4182
4389
|
let store = null;
|
|
4183
4390
|
let taskStream = null;
|
|
4184
4391
|
if (mode === "headless") {
|
|
4185
|
-
const { WizardStore } = await import("./store-
|
|
4186
|
-
const { HeadlessUI } = await import("./headless-ui-
|
|
4187
|
-
const { TaskStreamPush, PostHogDestination } = await import("./task-stream-
|
|
4392
|
+
const { WizardStore } = await import("./store-Di9OvMql.js").then((n) => n.n);
|
|
4393
|
+
const { HeadlessUI } = await import("./headless-ui-BplqZRcO.js");
|
|
4394
|
+
const { TaskStreamPush, PostHogDestination } = await import("./task-stream-DkbGqxZv.js");
|
|
4188
4395
|
store = new WizardStore(config.id);
|
|
4189
4396
|
store.session = session;
|
|
4190
4397
|
setUI(new HeadlessUI(store));
|
|
@@ -4239,7 +4446,7 @@ function runNonInteractive(config, options, mode) {
|
|
|
4239
4446
|
});
|
|
4240
4447
|
}
|
|
4241
4448
|
}
|
|
4242
|
-
const { runAgent } = await import("./agent-runner-
|
|
4449
|
+
const { runAgent } = await import("./agent-runner-Cic1uZZ8.js").then((n) => n.t);
|
|
4243
4450
|
await runAgent(config, session);
|
|
4244
4451
|
await settleStream(RunPhase.Completed);
|
|
4245
4452
|
} catch (error) {
|
|
@@ -5166,7 +5373,7 @@ async function runDoctorCI(options) {
|
|
|
5166
5373
|
getUI().intro("Welcome to the PostHog setup wizard");
|
|
5167
5374
|
getUI().log.info("Running posthog-doctor in CI mode");
|
|
5168
5375
|
try {
|
|
5169
|
-
const { getOrAskForProjectData } = await import("./setup-utils-
|
|
5376
|
+
const { getOrAskForProjectData } = await import("./setup-utils-BxdW2R0r.js").then((n) => n.r);
|
|
5170
5377
|
const { host, accessToken, projectId } = await getOrAskForProjectData({
|
|
5171
5378
|
signup: false,
|
|
5172
5379
|
ci: true,
|
|
@@ -5184,7 +5391,7 @@ async function runDoctorCI(options) {
|
|
|
5184
5391
|
for (const issue of sorted) getUI().log.info(` • [${issue.severity}] ${getKindMeta(issue.kind).title}`);
|
|
5185
5392
|
process.exit(1);
|
|
5186
5393
|
} catch (error) {
|
|
5187
|
-
const { ApiError } = await import("./api-
|
|
5394
|
+
const { ApiError } = await import("./api-C_R_ybiA.js").then((n) => n.n);
|
|
5188
5395
|
const message = error instanceof ApiError && error.statusCode === 401 ? "Your PostHog API key is invalid or expired." : error instanceof Error ? error.message : String(error);
|
|
5189
5396
|
getUI().log.error(`Doctor failed: ${message}`);
|
|
5190
5397
|
process.exit(1);
|
|
@@ -5228,6 +5435,11 @@ const selfDrivingCommand = {
|
|
|
5228
5435
|
description: selfDrivingConfig.description,
|
|
5229
5436
|
options: {
|
|
5230
5437
|
...skillProgramOptions,
|
|
5438
|
+
integrate: {
|
|
5439
|
+
describe: "Integrate the PostHog SDK first, then set up Self-driving — skips the \"do you already have PostHog?\" question. Use when the project isn't set up yet.",
|
|
5440
|
+
type: "boolean",
|
|
5441
|
+
default: false
|
|
5442
|
+
},
|
|
5231
5443
|
...selfDrivingConfig.cliOptions ?? {}
|
|
5232
5444
|
},
|
|
5233
5445
|
check: (argv) => {
|
|
@@ -5261,8 +5473,8 @@ function runSlackConnect(argv) {
|
|
|
5261
5473
|
(async () => {
|
|
5262
5474
|
const debug = argv.debug;
|
|
5263
5475
|
try {
|
|
5264
|
-
const { startTUI } = await import("./start-tui-
|
|
5265
|
-
const { buildSession } = await import("./wizard-session-
|
|
5476
|
+
const { startTUI } = await import("./start-tui-oGWfxdTd.js");
|
|
5477
|
+
const { buildSession } = await import("./wizard-session-xzqycI7i.js");
|
|
5266
5478
|
const tui = startTUI(VERSION, Program.SlackConnect);
|
|
5267
5479
|
tui.store.session = buildSession({
|
|
5268
5480
|
debug,
|
|
@@ -5643,6 +5855,6 @@ function resolveInstallDir() {
|
|
|
5643
5855
|
}
|
|
5644
5856
|
Wizard.use(basicIntegrationCommand).use(mcpCommand).use(mcpAnalyticsCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
|
|
5645
5857
|
//#endregion
|
|
5646
|
-
export {
|
|
5858
|
+
export { STRIPE_SDKS as C, POSTHOG_SDKS as S, SOURCE_MAPS_CONTEXT_KEYS as _, ConfirmButton as a, getDetectedWarehouseSources as b, runWizardCI as c, Program as d, getProgramConfig as f, DISPLAY_NAME as g, AUTOMATABLE_VARIANTS as h, useKeyboardHintsContext as i, runWizard as l, SELF_DRIVING_INTEGRATE_PATH_KEY as m, useKeyBindings as n, PromptLabel as o, detectSelfDrivingIntegrationProjects as p, KeyboardHintsProvider as r, runWizardHeadless as s, PickerMenu as t, PROGRAM_REGISTRY as u, getKindMeta as v, getContentBlocks$2 as x, fetchHealthIssues as y };
|
|
5647
5859
|
|
|
5648
5860
|
//# sourceMappingURL=bin.js.map
|