@posthog/wizard 2.34.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-BjH4z7gH.js → add-mcp-server-to-clients-D5e3JbUC.js} +6 -6
- package/dist/{add-mcp-server-to-clients-BjH4z7gH.js.map → add-mcp-server-to-clients-D5e3JbUC.js.map} +1 -1
- package/dist/{agent-interface-BcUv1qeh.js → agent-interface-CPn9pZ8j.js} +204 -175
- package/dist/agent-interface-CPn9pZ8j.js.map +1 -0
- package/dist/{agent-runner-8g_pDAVs.js → agent-runner-Cic1uZZ8.js} +58 -41
- package/dist/agent-runner-Cic1uZZ8.js.map +1 -0
- package/dist/{analytics-DQ8IS1Hu.js → analytics-Be_wRgxD.js} +2 -2
- package/dist/{analytics-DQ8IS1Hu.js.map → analytics-Be_wRgxD.js.map} +1 -1
- package/dist/{api-EghEV_u9.js → api-C_R_ybiA.js} +3 -3
- package/dist/{api-EghEV_u9.js.map → api-C_R_ybiA.js.map} +1 -1
- package/dist/bin.js +297 -68
- package/dist/bin.js.map +1 -1
- package/dist/{ci-install-ouGSf4zp.js → ci-install-B0BHTkGI.js} +5 -5
- package/dist/ci-install-B0BHTkGI.js.map +1 -0
- package/dist/{debug-Cn4L5Ype.js → debug-BpWrz3hX.js} +3 -4
- package/dist/debug-BpWrz3hX.js.map +1 -0
- package/dist/{debug-BM7yop-T.js → debug-DJS2KPGb.js} +1 -1
- package/dist/{defaults-DII5CAog.js → defaults-UswXMiTx.js} +1 -1
- package/dist/{defaults-DII5CAog.js.map → defaults-UswXMiTx.js.map} +1 -1
- package/dist/{env-api-key-MlzJYAvt.js → env-api-key-Db-mNPK2.js} +1 -1
- package/dist/{env-api-key-MlzJYAvt.js.map → env-api-key-Db-mNPK2.js.map} +1 -1
- package/dist/{environment-D2WUIm8o.js → environment-Dc6VTWyK.js} +3 -3
- package/dist/{environment-D2WUIm8o.js.map → environment-Dc6VTWyK.js.map} +1 -1
- package/dist/{file-utils-CdQn6073.js → file-utils-Buj9-umf.js} +2 -2
- package/dist/{file-utils-CdQn6073.js.map → file-utils-Buj9-umf.js.map} +1 -1
- package/dist/{headless-ui-CSqtmW-d.js → headless-ui-BplqZRcO.js} +2 -2
- package/dist/{headless-ui-CSqtmW-d.js.map → headless-ui-BplqZRcO.js.map} +1 -1
- package/dist/host-resolution-BD6TcZG0.js +115 -0
- package/dist/host-resolution-BD6TcZG0.js.map +1 -0
- package/dist/{interactive-CFGcWw43.js → interactive-BspTioP_.js} +2 -2
- package/dist/{interactive-CFGcWw43.js.map → interactive-BspTioP_.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-XZSpcXkG.js → mcp-prompt-streaming-BCNzyL12.js} +5 -5
- package/dist/mcp-prompt-streaming-BCNzyL12.js.map +1 -0
- package/dist/{non-interactive-D6eksWIw.js → non-interactive-CFikUAzO.js} +2 -2
- package/dist/{non-interactive-D6eksWIw.js.map → non-interactive-CFikUAzO.js.map} +1 -1
- package/dist/{package-manager-Dozr4x6K.js → package-manager-L7gsAbE0.js} +2 -2
- package/dist/{package-manager-Dozr4x6K.js.map → package-manager-L7gsAbE0.js.map} +1 -1
- package/dist/{playground-BB2O8GyY.js → playground-Bl2iPxdt.js} +7 -7
- package/dist/{playground-BB2O8GyY.js.map → playground-Bl2iPxdt.js.map} +1 -1
- package/dist/{posthog-DU6JXG00.js → posthog-BrLFkaji.js} +1 -1
- package/dist/{posthog-DU6JXG00.js.map → posthog-BrLFkaji.js.map} +1 -1
- package/dist/{posthog-integration-C3m_uR5A.js → posthog-integration-B6pTHVcn.js} +32 -17
- package/dist/posthog-integration-B6pTHVcn.js.map +1 -0
- package/dist/{provisioning-wMzPfaaP.js → provisioning-C9ts56R5.js} +28 -9
- package/dist/provisioning-C9ts56R5.js.map +1 -0
- package/dist/{registry-BfTeAX2z.js → registry-DFazVUSE.js} +4 -4
- package/dist/{registry-BfTeAX2z.js.map → registry-DFazVUSE.js.map} +1 -1
- package/dist/{setup-utils-B0oz3raQ.js → setup-utils-BxdW2R0r.js} +56 -29
- package/dist/setup-utils-BxdW2R0r.js.map +1 -0
- package/dist/{start-tui-B9qDcoGA.js → start-tui-oGWfxdTd.js} +404 -35
- package/dist/start-tui-oGWfxdTd.js.map +1 -0
- package/dist/{steps-BhERMRRI.js → steps-O0v5UU1G.js} +7 -7
- package/dist/{steps-BhERMRRI.js.map → steps-O0v5UU1G.js.map} +1 -1
- package/dist/{store-J2Rv955W.js → store-Di9OvMql.js} +55 -4
- package/dist/store-Di9OvMql.js.map +1 -0
- package/dist/{task-stream-CPjpHFhI.js → task-stream-DkbGqxZv.js} +3 -3
- package/dist/{task-stream-CPjpHFhI.js.map → task-stream-DkbGqxZv.js.map} +1 -1
- package/dist/{telemetry-BTLJ-YnG.js → telemetry-D5WQ4-Ic.js} +3 -3
- package/dist/{telemetry-BTLJ-YnG.js.map → telemetry-D5WQ4-Ic.js.map} +1 -1
- package/dist/{terminal-UwqFnPrL.js → terminal-Bd-k7pCi.js} +14 -14
- package/dist/{terminal-UwqFnPrL.js.map → terminal-Bd-k7pCi.js.map} +1 -1
- package/dist/urls-DpTCPWLD.js +67 -0
- package/dist/urls-DpTCPWLD.js.map +1 -0
- package/dist/{wizard-abort-BAB8yvGF.js → wizard-abort-C1t9M-JN.js} +1 -1
- package/dist/{wizard-abort-DqeMgCVr.js → wizard-abort-t41wO4Bh.js} +4 -4
- package/dist/{wizard-abort-DqeMgCVr.js.map → wizard-abort-t41wO4Bh.js.map} +1 -1
- package/dist/{wizard-session-CN55LYyZ.js → wizard-session-CqihOtk3.js} +7 -1
- package/dist/wizard-session-CqihOtk3.js.map +1 -0
- package/dist/{wizard-session-BKEdX9mO.js → wizard-session-xzqycI7i.js} +1 -1
- package/package.json +1 -1
- package/dist/agent-interface-BcUv1qeh.js.map +0 -1
- package/dist/agent-runner-8g_pDAVs.js.map +0 -1
- package/dist/ci-install-ouGSf4zp.js.map +0 -1
- package/dist/debug-Cn4L5Ype.js.map +0 -1
- package/dist/mcp-prompt-streaming-XZSpcXkG.js.map +0 -1
- package/dist/posthog-integration-C3m_uR5A.js.map +0 -1
- package/dist/provisioning-wMzPfaaP.js.map +0 -1
- package/dist/setup-utils-B0oz3raQ.js.map +0 -1
- package/dist/start-tui-B9qDcoGA.js.map +0 -1
- package/dist/store-J2Rv955W.js.map +0 -1
- package/dist/urls-DAVzgHGZ.js +0 -35
- package/dist/urls-DAVzgHGZ.js.map +0 -1
- package/dist/wizard-session-CN55LYyZ.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Z as WIZARD_USER_AGENT } from "./debug-BpWrz3hX.js";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
//#region src/utils/urls.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a pinned PostHog base URL from an optional override. When present, it
|
|
6
|
+
* becomes the single source of truth for every PostHog origin — the
|
|
7
|
+
* API/ingestion host, the cloud/app URL, and the OAuth server — bypassing
|
|
8
|
+
* region resolution entirely.
|
|
9
|
+
*
|
|
10
|
+
* The override lives on the session (`session.baseUrl`, set by `--base-url`) and
|
|
11
|
+
* is threaded in by callers, so there is no hidden module-level state. A `--base-url`
|
|
12
|
+
* value wins; otherwise a dev/test build implies `localhost:8010`; otherwise the
|
|
13
|
+
* result is `undefined`, meaning region-based resolution applies.
|
|
14
|
+
*
|
|
15
|
+
* This is the runtime equivalent of the `IS_DEV` localhost routing: `IS_DEV` is a
|
|
16
|
+
* build-time constant that tsdown compiles out of production builds, so it can't
|
|
17
|
+
* point a shipped wizard at a local stack — `--base-url` can. Both feed this one
|
|
18
|
+
* resolver so every URL helper only asks the question once.
|
|
19
|
+
*/
|
|
20
|
+
const resolveBaseUrl = (override) => {
|
|
21
|
+
return override?.trim() || void 0;
|
|
22
|
+
};
|
|
23
|
+
const getUiHostFromHost = (host) => {
|
|
24
|
+
if (host.includes("us.i.posthog.com")) return "https://us.posthog.com";
|
|
25
|
+
if (host.includes("eu.i.posthog.com")) return "https://eu.posthog.com";
|
|
26
|
+
return host;
|
|
27
|
+
};
|
|
28
|
+
const getHost = (region, baseUrl) => {
|
|
29
|
+
const override = resolveBaseUrl(baseUrl);
|
|
30
|
+
if (override) return override;
|
|
31
|
+
if (region === "eu") return "https://eu.i.posthog.com";
|
|
32
|
+
return "https://us.i.posthog.com";
|
|
33
|
+
};
|
|
34
|
+
const getCloudUrl = (region, baseUrl) => {
|
|
35
|
+
const override = resolveBaseUrl(baseUrl);
|
|
36
|
+
if (override) return override;
|
|
37
|
+
if (region === "eu") return "https://eu.posthog.com";
|
|
38
|
+
return "https://us.posthog.com";
|
|
39
|
+
};
|
|
40
|
+
async function detectRegion(accessToken, baseUrl) {
|
|
41
|
+
if (resolveBaseUrl(baseUrl)) return "us";
|
|
42
|
+
const headers = {
|
|
43
|
+
Authorization: `Bearer ${accessToken}`,
|
|
44
|
+
"User-Agent": WIZARD_USER_AGENT
|
|
45
|
+
};
|
|
46
|
+
const [usResult, euResult] = await Promise.allSettled([axios.get("https://us.posthog.com/api/users/@me/", { headers }), axios.get("https://eu.posthog.com/api/users/@me/", { headers })]);
|
|
47
|
+
if (usResult.status === "fulfilled") return "us";
|
|
48
|
+
if (euResult.status === "fulfilled") return "eu";
|
|
49
|
+
throw new Error("Could not determine cloud region from access token. Please check your PostHog account.");
|
|
50
|
+
}
|
|
51
|
+
const getLlmGatewayUrl = (host) => {
|
|
52
|
+
if (host.includes("host.docker.internal")) return "http://host.docker.internal:3308/wizard";
|
|
53
|
+
if (host.includes("localhost")) return "http://localhost:3308/wizard";
|
|
54
|
+
if (host.includes("eu.posthog.com") || host.includes("eu.i.posthog.com")) return "https://gateway.eu.posthog.com/wizard";
|
|
55
|
+
return "https://gateway.us.posthog.com/wizard";
|
|
56
|
+
};
|
|
57
|
+
/** Region-agnostic prod OAuth server. Resolves to the right region server-side. */
|
|
58
|
+
const PROD_OAUTH_URL = "https://oauth.posthog.com";
|
|
59
|
+
/**
|
|
60
|
+
* OAuth server URL. Follows the base-URL override (and thus IS_DEV → localhost),
|
|
61
|
+
* otherwise the region-agnostic prod OAuth host.
|
|
62
|
+
*/
|
|
63
|
+
const getOAuthUrl = (baseUrl) => resolveBaseUrl(baseUrl) ?? PROD_OAUTH_URL;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { getOAuthUrl as a, getLlmGatewayUrl as i, getCloudUrl as n, getUiHostFromHost as o, getHost as r, resolveBaseUrl as s, detectRegion as t };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=urls-DpTCPWLD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urls-DpTCPWLD.js","names":[],"sources":["../src/utils/urls.ts"],"sourcesContent":["import axios from 'axios';\nimport { IS_DEV, WIZARD_USER_AGENT } from '@lib/constants';\nimport type { CloudRegion } from './types';\n\n/**\n * Resolve a pinned PostHog base URL from an optional override. When present, it\n * becomes the single source of truth for every PostHog origin — the\n * API/ingestion host, the cloud/app URL, and the OAuth server — bypassing\n * region resolution entirely.\n *\n * The override lives on the session (`session.baseUrl`, set by `--base-url`) and\n * is threaded in by callers, so there is no hidden module-level state. A `--base-url`\n * value wins; otherwise a dev/test build implies `localhost:8010`; otherwise the\n * result is `undefined`, meaning region-based resolution applies.\n *\n * This is the runtime equivalent of the `IS_DEV` localhost routing: `IS_DEV` is a\n * build-time constant that tsdown compiles out of production builds, so it can't\n * point a shipped wizard at a local stack — `--base-url` can. Both feed this one\n * resolver so every URL helper only asks the question once.\n */\nexport const resolveBaseUrl = (override?: string): string | undefined => {\n return override?.trim() || (IS_DEV ? 'http://localhost:8010' : undefined);\n};\n\nexport const getUiHostFromHost = (host: string) => {\n if (host.includes('us.i.posthog.com')) {\n return 'https://us.posthog.com';\n }\n\n if (host.includes('eu.i.posthog.com')) {\n return 'https://eu.posthog.com';\n }\n\n return host;\n};\n\nexport const getHost = (region: CloudRegion, baseUrl?: string) => {\n const override = resolveBaseUrl(baseUrl);\n if (override) {\n return override;\n }\n\n if (region === 'eu') {\n return 'https://eu.i.posthog.com';\n }\n\n return 'https://us.i.posthog.com';\n};\n\nexport const getCloudUrl = (region: CloudRegion, baseUrl?: string) => {\n const override = resolveBaseUrl(baseUrl);\n if (override) {\n return override;\n }\n\n if (region === 'eu') {\n return 'https://eu.posthog.com';\n }\n\n return 'https://us.posthog.com';\n};\n\nexport async function detectRegion(\n accessToken: string,\n baseUrl?: string,\n): Promise<CloudRegion> {\n // With a pinned base URL there is only one instance to talk to — skip the\n // us/eu probe and default the region label to 'us'. (Covers IS_DEV too, via\n // resolveBaseUrl.) The URLs themselves come from the override, not this label.\n if (resolveBaseUrl(baseUrl)) {\n return 'us';\n }\n\n const headers = {\n Authorization: `Bearer ${accessToken}`,\n 'User-Agent': WIZARD_USER_AGENT,\n };\n\n const [usResult, euResult] = await Promise.allSettled([\n axios.get('https://us.posthog.com/api/users/@me/', { headers }),\n axios.get('https://eu.posthog.com/api/users/@me/', { headers }),\n ]);\n\n if (usResult.status === 'fulfilled') return 'us';\n if (euResult.status === 'fulfilled') return 'eu';\n\n throw new Error(\n 'Could not determine cloud region from access token. Please check your PostHog account.',\n );\n}\n\nexport const getLlmGatewayUrl = (host: string) => {\n if (host.includes('host.docker.internal')) {\n return 'http://host.docker.internal:3308/wizard';\n }\n\n if (host.includes('localhost')) {\n return 'http://localhost:3308/wizard';\n }\n\n if (host.includes('eu.posthog.com') || host.includes('eu.i.posthog.com')) {\n return 'https://gateway.eu.posthog.com/wizard';\n }\n\n return 'https://gateway.us.posthog.com/wizard';\n};\n\n/** Region-agnostic prod OAuth server. Resolves to the right region server-side. */\nconst PROD_OAUTH_URL = 'https://oauth.posthog.com';\n\n/**\n * OAuth server URL. Follows the base-URL override (and thus IS_DEV → localhost),\n * otherwise the region-agnostic prod OAuth host.\n */\nexport const getOAuthUrl = (baseUrl?: string): string =>\n resolveBaseUrl(baseUrl) ?? PROD_OAUTH_URL;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAa,kBAAkB,aAA0C;AACvE,QAAO,UAAU,MAAM,IAAwC,KAAA;;AAGjE,MAAa,qBAAqB,SAAiB;AACjD,KAAI,KAAK,SAAS,mBAAmB,CACnC,QAAO;AAGT,KAAI,KAAK,SAAS,mBAAmB,CACnC,QAAO;AAGT,QAAO;;AAGT,MAAa,WAAW,QAAqB,YAAqB;CAChE,MAAM,WAAW,eAAe,QAAQ;AACxC,KAAI,SACF,QAAO;AAGT,KAAI,WAAW,KACb,QAAO;AAGT,QAAO;;AAGT,MAAa,eAAe,QAAqB,YAAqB;CACpE,MAAM,WAAW,eAAe,QAAQ;AACxC,KAAI,SACF,QAAO;AAGT,KAAI,WAAW,KACb,QAAO;AAGT,QAAO;;AAGT,eAAsB,aACpB,aACA,SACsB;AAItB,KAAI,eAAe,QAAQ,CACzB,QAAO;CAGT,MAAM,UAAU;EACd,eAAe,UAAU;EACzB,cAAc;EACf;CAED,MAAM,CAAC,UAAU,YAAY,MAAM,QAAQ,WAAW,CACpD,MAAM,IAAI,yCAAyC,EAAE,SAAS,CAAC,EAC/D,MAAM,IAAI,yCAAyC,EAAE,SAAS,CAAC,CAChE,CAAC;AAEF,KAAI,SAAS,WAAW,YAAa,QAAO;AAC5C,KAAI,SAAS,WAAW,YAAa,QAAO;AAE5C,OAAM,IAAI,MACR,yFACD;;AAGH,MAAa,oBAAoB,SAAiB;AAChD,KAAI,KAAK,SAAS,uBAAuB,CACvC,QAAO;AAGT,KAAI,KAAK,SAAS,YAAY,CAC5B,QAAO;AAGT,KAAI,KAAK,SAAS,iBAAiB,IAAI,KAAK,SAAS,mBAAmB,CACtE,QAAO;AAGT,QAAO;;;AAIT,MAAM,iBAAiB;;;;;AAMvB,MAAa,eAAe,YAC1B,eAAe,QAAQ,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as wizardAbort, t as WizardError } from "./wizard-abort-
|
|
1
|
+
import { i as wizardAbort, t as WizardError } from "./wizard-abort-t41wO4Bh.js";
|
|
2
2
|
export { WizardError, wizardAbort };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as getUI, s as logToFile } from "./debug-
|
|
2
|
-
import { t as analytics } from "./analytics-
|
|
3
|
-
import "./wizard-session-
|
|
1
|
+
import { p as getUI, s as logToFile } from "./debug-BpWrz3hX.js";
|
|
2
|
+
import { t as analytics } from "./analytics-Be_wRgxD.js";
|
|
3
|
+
import "./wizard-session-CqihOtk3.js";
|
|
4
4
|
//#region src/utils/wizard-abort.ts
|
|
5
5
|
/**
|
|
6
6
|
* Single exit point for the wizard. Use instead of process.exit() directly.
|
|
@@ -46,4 +46,4 @@ async function wizardAbort(options) {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
export { wizardAbort as i, registerCleanup as n, runCleanups as r, WizardError as t };
|
|
48
48
|
|
|
49
|
-
//# sourceMappingURL=wizard-abort-
|
|
49
|
+
//# sourceMappingURL=wizard-abort-t41wO4Bh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-abort-
|
|
1
|
+
{"version":3,"file":"wizard-abort-t41wO4Bh.js","names":[],"sources":["../src/utils/wizard-abort.ts"],"sourcesContent":["/**\n * Single exit point for the wizard. Use instead of process.exit() directly.\n *\n * Sequence: cleanup -> error capture (optional) -> analytics shutdown -> outro -> process.exit\n *\n * WizardError is a data carrier passed to wizardAbort() for analytics context, never thrown.\n * The legacy abort() in setup-utils.ts delegates here.\n */\nimport { analytics } from './analytics';\nimport { logToFile } from './debug';\nimport { getUI } from '@ui';\nimport { OutroKind, type OutroData } from '@lib/wizard-session';\n\nexport class WizardError extends Error {\n constructor(\n message: string,\n public readonly context?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'WizardError';\n }\n}\n\ninterface WizardAbortOptions {\n message?: string;\n /** Structured error data. Renders via `outroError` instead of `outro`. */\n outroData?: OutroData;\n error?: Error | WizardError;\n exitCode?: number;\n}\n\nconst cleanupFns: Array<() => void> = [];\n\nexport function registerCleanup(fn: () => void): void {\n cleanupFns.push(fn);\n}\n\nexport function clearCleanup(): void {\n cleanupFns.length = 0;\n}\n\n/** Runs all registered cleanup functions and drains the array. */\nexport function runCleanups(): void {\n const fns = cleanupFns.splice(0);\n for (const fn of fns) {\n try {\n fn();\n } catch {\n /* cleanup should not prevent exit */\n }\n }\n}\n\nexport async function wizardAbort(\n options?: WizardAbortOptions,\n): Promise<never> {\n const {\n message = 'Wizard setup cancelled.',\n outroData,\n error,\n exitCode = 1,\n } = options ?? {};\n\n logToFile(`[wizard-abort] exitCode=${exitCode}, message: ${message}`);\n if (error) {\n logToFile('[wizard-abort] error:', error);\n }\n\n // 1. Run registered cleanup functions\n runCleanups();\n\n // 2. Capture error in analytics (if provided)\n if (error) {\n analytics.captureException(error, {\n ...((error instanceof WizardError && error.context) || {}),\n });\n }\n\n // 3. Shutdown analytics\n await analytics.shutdown(error ? 'error' : 'cancelled');\n\n // 4. Render the error outro. Synthesize OutroData from `message`\n // when the caller didn't provide structured data.\n const ui = getUI();\n ui.outroError(outroData ?? { kind: OutroKind.Error, message });\n\n // 5. Wait for the user to dismiss the outro screen. In a TUI this gives\n // them time to read the error; in non-TUI environments it resolves\n // immediately.\n await ui.waitForOutroDismissed();\n\n // 6. Exit (fires 'exit' event so TUI cleanup runs)\n return process.exit(exitCode);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,cAAb,cAAiC,MAAM;CACrC,YACE,SACA,SACA;AACA,QAAM,QAAQ;AAFE,OAAA,UAAA;AAGhB,OAAK,OAAO;;;AAYhB,MAAM,aAAgC,EAAE;AAExC,SAAgB,gBAAgB,IAAsB;AACpD,YAAW,KAAK,GAAG;;;AAQrB,SAAgB,cAAoB;CAClC,MAAM,MAAM,WAAW,OAAO,EAAE;AAChC,MAAK,MAAM,MAAM,IACf,KAAI;AACF,MAAI;SACE;;AAMZ,eAAsB,YACpB,SACgB;CAChB,MAAM,EACJ,UAAU,2BACV,WACA,OACA,WAAW,MACT,WAAW,EAAE;AAEjB,WAAU,2BAA2B,SAAS,aAAa,UAAU;AACrE,KAAI,MACF,WAAU,yBAAyB,MAAM;AAI3C,cAAa;AAGb,KAAI,MACF,WAAU,iBAAiB,OAAO,EAChC,GAAK,iBAAiB,eAAe,MAAM,WAAY,EAAE,EAC1D,CAAC;AAIJ,OAAM,UAAU,SAAS,QAAQ,UAAU,YAAY;CAIvD,MAAM,KAAK,OAAO;AAClB,IAAG,WAAW,aAAa;EAAE,MAAA;EAAuB;EAAS,CAAC;AAK9D,OAAM,GAAG,uBAAuB;AAGhC,QAAO,QAAQ,KAAK,SAAS"}
|
|
@@ -41,6 +41,7 @@ function buildSession(args) {
|
|
|
41
41
|
apiKey: args.apiKey,
|
|
42
42
|
email: args.email,
|
|
43
43
|
region: args.region,
|
|
44
|
+
baseUrl: args.baseUrl,
|
|
44
45
|
benchmark: args.benchmark ?? false,
|
|
45
46
|
yaraReport: args.yaraReport ?? false,
|
|
46
47
|
projectId: parseProjectIdArg(args.projectId),
|
|
@@ -63,11 +64,16 @@ function buildSession(args) {
|
|
|
63
64
|
slackConnected: null,
|
|
64
65
|
skillsComplete: false,
|
|
65
66
|
outroDismissed: false,
|
|
67
|
+
integrate: args.integrate === true ? true : null,
|
|
68
|
+
completedRuns: [],
|
|
69
|
+
selfDrivingHandoffConfirmed: false,
|
|
66
70
|
loginUrl: null,
|
|
67
71
|
authorizeUrl: null,
|
|
68
72
|
credentials: null,
|
|
69
73
|
roleAtOrganization: null,
|
|
70
74
|
apiUser: null,
|
|
75
|
+
cloudRegion: null,
|
|
76
|
+
apiProject: null,
|
|
71
77
|
readinessResult: null,
|
|
72
78
|
outageDismissed: false,
|
|
73
79
|
settingsOverrideKeys: null,
|
|
@@ -87,4 +93,4 @@ function buildSession(args) {
|
|
|
87
93
|
//#endregion
|
|
88
94
|
export { buildSession as a, RunPhase as i, ADDITIONAL_FEATURE_PROMPTS as n, OutroKind as r, ADDITIONAL_FEATURE_LABELS as t };
|
|
89
95
|
|
|
90
|
-
//# sourceMappingURL=wizard-session-
|
|
96
|
+
//# sourceMappingURL=wizard-session-CqihOtk3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard-session-CqihOtk3.js","names":[],"sources":["../src/lib/wizard-session.ts"],"sourcesContent":["/**\n * WizardSession — single source of truth for every decision the wizard needs.\n *\n * Populated in layers:\n * CLI args / env vars → populate fields directly\n * Auto-detection → framework, typescript, package manager\n * TUI screens → region, framework disambiguation, etc.\n * OAuth → credentials\n *\n * Business logic reads from the session. Never calls a prompt.\n */\n\nimport type { Integration } from './constants';\nimport type { FrameworkConfig } from './framework-config';\nimport type { WizardReadinessResult } from './health-checks/readiness';\nimport type { SettingsConflict } from './agent/claude-settings';\nimport type { ApiUser, ApiProject } from './api';\n\nexport interface Credentials {\n accessToken: string;\n projectApiKey: string;\n host: string;\n projectId: number;\n}\n\nfunction parseProjectIdArg(value: string | undefined): number | undefined {\n if (value === undefined || value === '') return undefined;\n const n = Number(value);\n return Number.isInteger(n) && n > 0 ? n : undefined;\n}\n\nexport type CloudRegion = 'us' | 'eu';\n\n/** Lifecycle phase of the main work (agent run, MCP install, etc.) */\nexport enum RunPhase {\n /** Still gathering input (intro, setup screens) */\n Idle = 'idle',\n /** Main work is in progress */\n Running = 'running',\n /** Main work finished successfully */\n Completed = 'completed',\n /** Main work finished with an error */\n Error = 'error',\n}\n\n/** Features discovered by the feature-discovery subagent */\nexport enum DiscoveredFeature {\n Stripe = 'stripe',\n LLM = 'llm',\n}\n\n/** Additional features the agent can integrate after the main setup */\nexport enum AdditionalFeature {\n LLM = 'llm',\n}\n\n/** Human-readable labels for additional features (used in TUI progress) */\nexport const ADDITIONAL_FEATURE_LABELS: Record<AdditionalFeature, string> = {\n [AdditionalFeature.LLM]: 'LLM analytics',\n};\n\n/** Agent prompts for each additional feature, injected via the stop hook */\nexport const ADDITIONAL_FEATURE_PROMPTS: Record<AdditionalFeature, string> = {\n [AdditionalFeature.LLM]: `Now integrate LLM analytics with PostHog. Use the PostHog MCP server to find the appropriate LLM analytics skill, install it, and follow its workflow. PostHog basics are already installed. Update the setup report markdown file when complete with additions from this task. `,\n};\n\n/** Outcome of the MCP server installation step */\nexport enum McpOutcome {\n NoClients = 'no_clients',\n Skipped = 'skipped',\n Installed = 'installed',\n Failed = 'failed',\n}\n\n/** Outcome kind for the outro screen */\nexport enum OutroKind {\n Success = 'success',\n Error = 'error',\n Cancel = 'cancel',\n}\n\nexport interface OutroData {\n kind: OutroKind;\n /** Main headline (green check for Success, red X for Error, etc.) */\n message?: string;\n /** Free-form body text shown under the headline. Use \\n for paragraph breaks. */\n body?: string;\n /** Success-only: bulleted list of \"what the agent did\" */\n changes?: string[];\n /**\n * Success-only: a prominent, labeled link to where the user should go\n * next (e.g. an inbox the program just configured). Rendered right under\n * the headline and shown verbatim — no UTM tagging — so the URL stays\n * clean and copy-pasteable. Set per-program in buildOutroData.\n */\n primaryLink?: { label: string; url: string };\n /**\n * Success-only: a short \"what to do next\" checklist with its own heading,\n * rendered as a bulleted list. Distinct from `changes`, which recaps what\n * the agent already did.\n */\n nextSteps?: { heading: string; items: string[] };\n docsUrl?: string;\n continueUrl?: string;\n /** Report file the agent wrote (e.g. \"posthog-setup-report.md\") */\n reportFile?: string;\n /** PostHog dashboard URL the program created on the user's behalf. */\n dashboardUrl?: string;\n /** PostHog notebook URL the program uploaded the report to. */\n notebookUrl?: string;\n /**\n * Copy-paste prompt the operator hands to their coding agent to finish the\n * job (work the report's checklist). Printed to the terminal's main buffer on\n * exit (see getExitLine in start-tui.ts) — the TUI's alternate screen is wiped\n * on exit, so the scrollback line is where it survives and can be\n * triple-click-selected. Set per-program in buildOutroData.\n */\n handoffPrompt?: string;\n}\n\n/** A single question rendered by the WizardAsk overlay. */\nexport interface AskQuestion {\n /** Key for the response map */\n id: string;\n prompt: string;\n /** text = single-line free input; single/multi = picker */\n kind: 'single' | 'multi' | 'text';\n /** Required for `single` and `multi`. Ignored for `text`. */\n options?: { label: string; value: string; description?: string }[];\n /** Defaults to true */\n required?: boolean;\n /**\n * Only meaningful for kind='text'. When true, the wizard-tools `wizard_ask`\n * tool stores the user's answer in the session secret vault and returns\n * `{ secretRef }` to the agent instead of the plain string — so the value\n * never enters the LLM conversation. The TUI may also mask input\n * accordingly. See `secret-vault.ts`.\n */\n sensitive?: boolean;\n}\n\n/** Map of question id → answer (string for single/text, string[] for multi). */\nexport type AskAnswers = Record<string, string | string[]>;\n\n/** A pending wizard_ask request held by the store. */\nexport interface PendingQuestion {\n id: string;\n questions: AskQuestion[];\n /** Skill id of the caller. Set by the wizard from session.skillId. */\n source: string;\n /**\n * When true, the ask overlay renders standalone URLs in prompt text as\n * OSC 8 hyperlinks and copies a lone URL to the clipboard. Opt-in per\n * program (set from `ProgramRun.richLinks` via the ask bridge); defaults\n * to false so existing flows render prompts exactly as before. See\n * `LinkText` / `link-helpers`.\n */\n richLinks?: boolean;\n}\n\n/**\n * PostHog dashboard URL emitted by the agent during a program run.\n * Populated via the `[DASHBOARD_URL]` text marker in agent assistant messages\n * — see `handleSDKMessage` in `agent/agent-interface.ts`. Read by programs\n * (e.g. events-audit) inside `buildOutroData` to surface a dashboard link\n * the agent actually created.\n */\n\nexport interface WizardSession {\n // From CLI args\n debug: boolean;\n installDir: string;\n ci: boolean;\n signup: boolean;\n localMcp: boolean;\n mcpFeatures?: string[];\n apiKey?: string;\n email?: string;\n region?: CloudRegion;\n /**\n * Explicit PostHog base URL (`--base-url`). When set, it pins every PostHog\n * origin — API host, cloud/app URL, OAuth server — and `region` is ignored.\n * The runtime equivalent of the dev-build localhost routing; lets the shipped\n * wizard target a local/self-hosted stack. Threaded into the URL helpers in\n * `@utils/urls`. Empty/unset → region-based resolution.\n */\n baseUrl?: string;\n benchmark: boolean;\n yaraReport: boolean;\n projectId?: number;\n noTelemetry: boolean;\n\n // From detection + screens\n setupConfirmed: boolean;\n integration: Integration | null;\n frameworkContext: Record<string, unknown>;\n typescript: boolean;\n\n /** Human-readable label for the detected framework variant (e.g., \"Django with Wagtail CMS\") */\n detectedFrameworkLabel: string | null;\n\n /** True once framework detection has run (whether it found something or not) */\n detectionComplete: boolean;\n\n /** Set when the detected framework version is too old for the wizard */\n unsupportedVersion: {\n current: string;\n minimum: string;\n docsUrl: string;\n } | null;\n\n // From OAuth\n credentials: Credentials | null;\n\n /**\n * `role_at_organization` from `/api/users/@me/`. Null when the upstream\n * value is missing (older accounts, fresh signups before onboarding).\n * Drives role-tailored MCP prompt suggestions on the McpSuggestedPromptsScreen.\n *\n * Mirrors `apiUser?.role_at_organization` — kept as a top-level convenience\n * because it has dedicated UI semantics (role-tailored kits) and pre-dates\n * the broader `apiUser` plumbing.\n */\n roleAtOrganization: string | null;\n\n /**\n * Full user payload from `/api/users/@me/` — identifiers, profile,\n * current team + organization, preferences, etc. Null until OAuth /\n * CI-key auth populates it. Schema lives in `src/lib/api.ts` and\n * passes through unknown upstream fields so downstream features can\n * read account context (plan, org name, email, etc.) without\n * re-fetching.\n */\n apiUser: ApiUser | null;\n\n /**\n * Cloud region and project payload resolved at authentication, kept so a\n * second agent run in the same invocation (e.g. self-driving's integration\n * phase) reuses the first login wholesale instead of re-authenticating.\n */\n cloudRegion: CloudRegion | null;\n apiProject: ApiProject | null;\n\n // Lifecycle\n runPhase: RunPhase;\n loginUrl: string | null;\n // Direct PostHog authorize URL, shown in the manual-paste modal for\n // headless/remote shells (the localhost loginUrl is unreachable there).\n authorizeUrl: string | null;\n\n // Feature discovery\n discoveredFeatures: DiscoveredFeature[];\n llmOptIn: boolean;\n\n // ScreenId completion\n mcpComplete: boolean;\n mcpOutcome: McpOutcome | null;\n mcpInstalledClients: string[];\n mcpSuggestedPromptsDismissed: boolean;\n /** True once the user has acted on (opened or skipped) the Connect-Slack step. */\n slackStepDismissed: boolean;\n /**\n * Whether the project already has a Slack integration connected.\n * `null` until detected. Prefetched by the tutorial screen as soon as\n * credentials exist so the Connect-Slack step renders the right\n * variant immediately instead of flashing the nudge first.\n */\n slackConnected: boolean | null;\n skillsComplete: boolean;\n outroDismissed: boolean;\n\n /**\n * Self-driving only: whether to integrate PostHog as part of this run.\n * `null` until decided — the integration-check screen asks \"do you already\n * have PostHog?\" and sets it (No → true, Yes → false). The `--integrate`\n * flag pre-sets it to `true`, skipping the question. When `true`, the\n * self-driving prompt has the agent set up the SDK before the Self-driving\n * steps. Unused by other programs.\n */\n integrate: boolean | null;\n\n /**\n * Ids of composed run steps that have completed — e.g. self-driving's\n * `integrate-run`. Lets a run step's `isComplete` hold after it ran,\n * independent of the shared `runPhase`.\n */\n completedRuns: string[];\n\n /**\n * Self-driving only: whether the user confirmed the handoff screen shown\n * after the integration run (\"PostHog is installed — now set up Self-driving\").\n * Gates the Self-driving run so it doesn't start until acknowledged. Only\n * reached in the integrate path; the already-has-PostHog path skips it.\n */\n selfDrivingHandoffConfirmed: boolean;\n\n // Runtime\n readinessResult: WizardReadinessResult | null;\n outageDismissed: boolean;\n settingsOverrideKeys: string[] | null;\n settingsConflicts: SettingsConflict[] | null;\n authErrorDetail: {\n hasSettingsConflict: boolean;\n conflicts?: SettingsConflict[];\n logFilePath: string;\n } | null;\n portConflictProcess: {\n command: string;\n pid: string;\n port: number;\n user: string;\n } | null;\n outroData: OutroData | null;\n dashboardUrl: string | null;\n notebookUrl: string | null;\n\n // Additional features queue (drained via stop hook after main integration)\n additionalFeatureQueue: AdditionalFeature[];\n\n // Program metadata (set by runWizard in bin.ts)\n programLabel: string | null;\n skillId: string | null;\n\n // Resolved framework config (set after integration is known)\n frameworkConfig: FrameworkConfig | null;\n\n /** Active wizard_ask request, set by the bridge when the agent calls the tool. */\n pendingQuestion: PendingQuestion | null;\n}\n\n/**\n * Build a WizardSession from CLI args, pre-populating whatever is known.\n */\nexport function buildSession(args: {\n debug?: boolean;\n installDir?: string;\n ci?: boolean;\n signup?: boolean;\n localMcp?: boolean;\n mcpFeatures?: string[];\n apiKey?: string;\n email?: string;\n region?: CloudRegion;\n baseUrl?: string;\n integration?: Integration;\n benchmark?: boolean;\n yaraReport?: boolean;\n projectId?: string;\n noTelemetry?: boolean;\n integrate?: boolean;\n}): WizardSession {\n return {\n debug: args.debug ?? false,\n installDir: args.installDir ?? process.cwd(),\n ci: args.ci ?? false,\n signup: args.signup ?? false,\n localMcp: args.localMcp ?? false,\n mcpFeatures: args.mcpFeatures,\n apiKey: args.apiKey,\n email: args.email,\n region: args.region,\n baseUrl: args.baseUrl,\n benchmark: args.benchmark ?? false,\n yaraReport: args.yaraReport ?? false,\n projectId: parseProjectIdArg(args.projectId),\n noTelemetry: args.noTelemetry ?? false,\n\n setupConfirmed: false,\n integration: args.integration ?? null,\n frameworkContext: {},\n typescript: false,\n detectedFrameworkLabel: null,\n detectionComplete: false,\n unsupportedVersion: null,\n\n runPhase: RunPhase.Idle,\n discoveredFeatures: [],\n llmOptIn: false,\n mcpComplete: false,\n mcpOutcome: null,\n mcpInstalledClients: [],\n mcpSuggestedPromptsDismissed: false,\n slackStepDismissed: false,\n slackConnected: null,\n skillsComplete: false,\n outroDismissed: false,\n // `--integrate` forces integration (skip the question); otherwise the\n // integration-check screen resolves it from null.\n integrate: args.integrate === true ? true : null,\n completedRuns: [],\n selfDrivingHandoffConfirmed: false,\n loginUrl: null,\n authorizeUrl: null,\n credentials: null,\n roleAtOrganization: null,\n apiUser: null,\n cloudRegion: null,\n apiProject: null,\n readinessResult: null,\n outageDismissed: false,\n settingsOverrideKeys: null,\n settingsConflicts: null,\n authErrorDetail: null,\n portConflictProcess: null,\n outroData: null,\n dashboardUrl: null,\n notebookUrl: null,\n additionalFeatureQueue: [],\n programLabel: null,\n skillId: null,\n frameworkConfig: null,\n pendingQuestion: null,\n };\n}\n"],"mappings":";AAyBA,SAAS,kBAAkB,OAA+C;AACxE,KAAI,UAAU,KAAA,KAAa,UAAU,GAAI,QAAO,KAAA;CAChD,MAAM,IAAI,OAAO,MAAM;AACvB,QAAO,OAAO,UAAU,EAAE,IAAI,IAAI,IAAI,IAAI,KAAA;;;AAM5C,IAAY,WAAL,yBAAA,UAAA;;AAEL,UAAA,UAAA;;AAEA,UAAA,aAAA;;AAEA,UAAA,eAAA;;AAEA,UAAA,WAAA;;KACD;;AAcD,MAAa,4BAA+D,GAAA,QACjD,iBAC1B;;AAGD,MAAa,6BAAgE,GAAA,QAClD,oRAC1B;;AAWD,IAAY,YAAL,yBAAA,WAAA;AACL,WAAA,aAAA;AACA,WAAA,WAAA;AACA,WAAA,YAAA;;KACD;;;;AA8PD,SAAgB,aAAa,MAiBX;AAChB,QAAO;EACL,OAAO,KAAK,SAAS;EACrB,YAAY,KAAK,cAAc,QAAQ,KAAK;EAC5C,IAAI,KAAK,MAAM;EACf,QAAQ,KAAK,UAAU;EACvB,UAAU,KAAK,YAAY;EAC3B,aAAa,KAAK;EAClB,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,SAAS,KAAK;EACd,WAAW,KAAK,aAAa;EAC7B,YAAY,KAAK,cAAc;EAC/B,WAAW,kBAAkB,KAAK,UAAU;EAC5C,aAAa,KAAK,eAAe;EAEjC,gBAAgB;EAChB,aAAa,KAAK,eAAe;EACjC,kBAAkB,EAAE;EACpB,YAAY;EACZ,wBAAwB;EACxB,mBAAmB;EACnB,oBAAoB;EAEpB,UAAA;EACA,oBAAoB,EAAE;EACtB,UAAU;EACV,aAAa;EACb,YAAY;EACZ,qBAAqB,EAAE;EACvB,8BAA8B;EAC9B,oBAAoB;EACpB,gBAAgB;EAChB,gBAAgB;EAChB,gBAAgB;EAGhB,WAAW,KAAK,cAAc,OAAO,OAAO;EAC5C,eAAe,EAAE;EACjB,6BAA6B;EAC7B,UAAU;EACV,cAAc;EACd,aAAa;EACb,oBAAoB;EACpB,SAAS;EACT,aAAa;EACb,YAAY;EACZ,iBAAiB;EACjB,iBAAiB;EACjB,sBAAsB;EACtB,mBAAmB;EACnB,iBAAiB;EACjB,qBAAqB;EACrB,WAAW;EACX,cAAc;EACd,aAAa;EACb,wBAAwB,EAAE;EAC1B,cAAc;EACd,SAAS;EACT,iBAAiB;EACjB,iBAAiB;EAClB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildSession, i as RunPhase, r as OutroKind } from "./wizard-session-
|
|
1
|
+
import { a as buildSession, i as RunPhase, r as OutroKind } from "./wizard-session-CqihOtk3.js";
|
|
2
2
|
export { OutroKind, RunPhase, buildSession };
|
package/package.json
CHANGED