@posthog/wizard 2.64.1 → 2.66.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 +7 -2
- package/dist/{add-mcp-server-to-clients-BUqb93_I.js → add-mcp-server-to-clients-DWDEuDUR.js} +210 -46
- package/dist/add-mcp-server-to-clients-DWDEuDUR.js.map +1 -0
- package/dist/{agent-interface-NurnwA01.js → agent-interface-D3MNaDp3.js} +405 -47
- package/dist/agent-interface-D3MNaDp3.js.map +1 -0
- package/dist/{agent-prompt-loader-CbowPuWI.js → agent-prompt-loader-D8Bajo-L.js} +10 -5
- package/dist/agent-prompt-loader-D8Bajo-L.js.map +1 -0
- package/dist/{agent-runner-DisJWxJa.js → agent-runner-DEeMqJxy.js} +111 -53
- package/dist/agent-runner-DEeMqJxy.js.map +1 -0
- package/dist/{analytics-D3vKvr3l.js → analytics-D8JNuPAT.js} +2 -2
- package/dist/{analytics-D3vKvr3l.js.map → analytics-D8JNuPAT.js.map} +1 -1
- package/dist/analytics-DN3Kzf7H.js +2 -0
- package/dist/{api-Bhe8jpUR.js → api-CemGgyBv.js} +3 -3
- package/dist/{api-Bhe8jpUR.js.map → api-CemGgyBv.js.map} +1 -1
- package/dist/bin.js +245 -93
- package/dist/bin.js.map +1 -1
- package/dist/{bounded-fs-BeWc675I.js → bounded-fs-C6OjqZst.js} +3 -3
- package/dist/{bounded-fs-BeWc675I.js.map → bounded-fs-C6OjqZst.js.map} +1 -1
- package/dist/{ci-install-BpNzfghY.js → ci-install-DIB2n4Ju.js} +4 -4
- package/dist/{ci-install-BpNzfghY.js.map → ci-install-DIB2n4Ju.js.map} +1 -1
- package/dist/{debug-hy6aWAyk.js → debug-BKqv-yfT.js} +14 -9
- package/dist/debug-BKqv-yfT.js.map +1 -0
- package/dist/{debug-DGfRPr2A.js → debug-H-GTKvvU.js} +1 -1
- package/dist/{defaults-mrAre0xM.js → defaults-BHhXrX9F.js} +1 -1
- package/dist/{defaults-mrAre0xM.js.map → defaults-BHhXrX9F.js.map} +1 -1
- package/dist/{env-api-key-CMPe-WJp.js → env-api-key-CzHDwfV2.js} +2 -2
- package/dist/{env-api-key-CMPe-WJp.js.map → env-api-key-CzHDwfV2.js.map} +1 -1
- package/dist/{environment-Ktu0Ktjl.js → environment-Cl-fIQku.js} +4 -4
- package/dist/{environment-Ktu0Ktjl.js.map → environment-Cl-fIQku.js.map} +1 -1
- package/dist/{file-watcher-CqJ1dgjq.js → file-watcher-Cr-4tA-e.js} +2 -2
- package/dist/{file-watcher-CqJ1dgjq.js.map → file-watcher-Cr-4tA-e.js.map} +1 -1
- package/dist/{headless-ui-zZLgs4QL.js → headless-ui-DT3Db1bk.js} +2 -2
- package/dist/{headless-ui-zZLgs4QL.js.map → headless-ui-DT3Db1bk.js.map} +1 -1
- package/dist/{interactive-BUw1SEOz.js → interactive-D3LdFxZG.js} +2 -2
- package/dist/{interactive-BUw1SEOz.js.map → interactive-D3LdFxZG.js.map} +1 -1
- package/dist/local-dev-BN6NKQ0B.js +135 -0
- package/dist/local-dev-BN6NKQ0B.js.map +1 -0
- package/dist/{mcp-C7NMhhWa.js → mcp-BjckYQmP.js} +2 -2
- package/dist/{mcp-C7NMhhWa.js.map → mcp-BjckYQmP.js.map} +1 -1
- package/dist/mcp-install-smoke-test.ts +477 -0
- package/dist/{mcp-prompt-streaming-CKyqqB10.js → mcp-prompt-streaming--sRErHKv.js} +20 -4
- package/dist/mcp-prompt-streaming--sRErHKv.js.map +1 -0
- package/dist/{non-interactive-73xGtug6.js → non-interactive-CNoYoEZp.js} +2 -2
- package/dist/{non-interactive-73xGtug6.js.map → non-interactive-CNoYoEZp.js.map} +1 -1
- package/dist/{orchestrator-tools-DcMJzfDH.js → orchestrator-tools-8bGyDDhn.js} +3 -3
- package/dist/{orchestrator-tools-DcMJzfDH.js.map → orchestrator-tools-8bGyDDhn.js.map} +1 -1
- package/dist/{package-json-CDs1ZVKu.js → package-json-D0DCWpe5.js} +1 -1
- package/dist/{package-json-CDs1ZVKu.js.map → package-json-D0DCWpe5.js.map} +1 -1
- package/dist/{package-manager-KweKX3u_.js → package-manager-BQDHm7ER.js} +58 -3
- package/dist/package-manager-BQDHm7ER.js.map +1 -0
- package/dist/{pi-B4p4gpr0.js → pi-W-4RUPFY.js} +11 -11
- package/dist/{pi-B4p4gpr0.js.map → pi-W-4RUPFY.js.map} +1 -1
- package/dist/{playground-AEkWcB1E.js → playground-uHHgZChe.js} +7 -7
- package/dist/{playground-AEkWcB1E.js.map → playground-uHHgZChe.js.map} +1 -1
- package/dist/{posthog-4PljLcIz.js → posthog-ChzdlmCs.js} +2 -2
- package/dist/{posthog-4PljLcIz.js.map → posthog-ChzdlmCs.js.map} +1 -1
- package/dist/{posthog-integration-DKlEg8-Q.js → posthog-integration-LxEBGkoe.js} +680 -49
- package/dist/posthog-integration-LxEBGkoe.js.map +1 -0
- package/dist/{provisioning-QsG7HDCm.js → provisioning-BHTl91OZ.js} +3 -3
- package/dist/{provisioning-QsG7HDCm.js.map → provisioning-BHTl91OZ.js.map} +1 -1
- package/dist/{queue-tools-Jlz9dV_B.js → queue-tools-DABh1Ssc.js} +33 -7
- package/dist/queue-tools-DABh1Ssc.js.map +1 -0
- package/dist/{registry-PG_nV5Bf.js → registry-CxNpCNAj.js} +309 -6
- package/dist/registry-CxNpCNAj.js.map +1 -0
- package/dist/{security-BKUJk-Gg.js → security-B4jU_-7q.js} +5 -5
- package/dist/{security-BKUJk-Gg.js.map → security-B4jU_-7q.js.map} +1 -1
- package/dist/{setup-utils-DNpldqge.js → setup-utils-aWZEdfwh.js} +18 -13
- package/dist/setup-utils-aWZEdfwh.js.map +1 -0
- package/dist/smoke-test-ci.sh +12 -1
- package/dist/{start-tui-D4B0-2nr.js → start-tui-BQH4mQIZ.js} +138 -27
- package/dist/start-tui-BQH4mQIZ.js.map +1 -0
- package/dist/{steps-Dy0AXdGo.js → steps-5HAqjUvn.js} +7 -7
- package/dist/{steps-Dy0AXdGo.js.map → steps-5HAqjUvn.js.map} +1 -1
- package/dist/{store-DouLLelV.js → store-P_7zUfbj.js} +22 -7
- package/dist/store-P_7zUfbj.js.map +1 -0
- package/dist/{subagent-B4yVs5A2.js → subagent-uGPDXPfS.js} +2 -2
- package/dist/{subagent-B4yVs5A2.js.map → subagent-uGPDXPfS.js.map} +1 -1
- package/dist/{task-DRKYEbKM.js → task-oh8OAnvR.js} +29 -18
- package/dist/task-oh8OAnvR.js.map +1 -0
- package/dist/{task-stream-BGUP7yA-.js → task-stream-jUARpyB5.js} +5 -5
- package/dist/{task-stream-BGUP7yA-.js.map → task-stream-jUARpyB5.js.map} +1 -1
- package/dist/{tasks-B2GzXsZ0.js → tasks-2mu3lAvm.js} +2 -2
- package/dist/{tasks-B2GzXsZ0.js.map → tasks-2mu3lAvm.js.map} +1 -1
- package/dist/{telemetry-6zaFfCcy.js → telemetry-BllPiBKw.js} +3 -3
- package/dist/{telemetry-6zaFfCcy.js.map → telemetry-BllPiBKw.js.map} +1 -1
- package/dist/{terminal-Bu3eHFn0.js → terminal-aWQrDy8s.js} +99 -98
- package/dist/terminal-aWQrDy8s.js.map +1 -0
- package/dist/{tools-DQO5tKJg.js → tools-u8TaJFqa.js} +54 -47
- package/dist/tools-u8TaJFqa.js.map +1 -0
- package/dist/{wizard-abort-D6jJh8u5.js → wizard-abort-D9jiMkZA.js} +4 -4
- package/dist/{wizard-abort-D6jJh8u5.js.map → wizard-abort-D9jiMkZA.js.map} +1 -1
- package/dist/{wizard-abort-PgTdRS1l.js → wizard-abort-pFFH7dcx.js} +1 -1
- package/dist/{wizard-session-DZUDtS5d.js → wizard-session-Cw7-_OcZ.js} +1 -1
- package/dist/{wizard-session-BUhlJ1b8.js → wizard-session-DTyLMPsX.js} +17 -3
- package/dist/wizard-session-DTyLMPsX.js.map +1 -0
- package/dist/{yara-hooks-DjReXmTQ.js → yara-hooks-BXDBIOBq.js} +4 -4
- package/dist/{yara-hooks-DjReXmTQ.js.map → yara-hooks-BXDBIOBq.js.map} +1 -1
- package/dist/yara-hooks-i2jOabhI.js +2 -0
- package/package.json +2 -1
- package/dist/add-mcp-server-to-clients-BUqb93_I.js.map +0 -1
- package/dist/agent-interface-NurnwA01.js.map +0 -1
- package/dist/agent-prompt-loader-CbowPuWI.js.map +0 -1
- package/dist/agent-runner-DisJWxJa.js.map +0 -1
- package/dist/analytics-hNca7GLq.js +0 -2
- package/dist/debug-hy6aWAyk.js.map +0 -1
- package/dist/mcp-prompt-streaming-CKyqqB10.js.map +0 -1
- package/dist/package-manager-KweKX3u_.js.map +0 -1
- package/dist/posthog-integration-DKlEg8-Q.js.map +0 -1
- package/dist/queue-tools-Jlz9dV_B.js.map +0 -1
- package/dist/registry-PG_nV5Bf.js.map +0 -1
- package/dist/setup-utils-DNpldqge.js.map +0 -1
- package/dist/start-tui-D4B0-2nr.js.map +0 -1
- package/dist/store-DouLLelV.js.map +0 -1
- package/dist/task-DRKYEbKM.js.map +0 -1
- package/dist/terminal-Bu3eHFn0.js.map +0 -1
- package/dist/tools-DQO5tKJg.js.map +0 -1
- package/dist/wizard-session-BUhlJ1b8.js.map +0 -1
- package/dist/yara-hooks-CN_uFGCu.js +0 -2
package/dist/bin.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Ct as isHeadless, L as Integration, St as headlessOption, U as POSTHOG_DOCS_URL, a as getLogFilePath, f as getUI, gt as VERSION, m as LoggingUI, mt as getSkillsBaseUrl, p as setUI, pt as WIZARD_USER_AGENT, r as debug, s as logToFile, wt as regionOption } from "./debug-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { n as
|
|
2
|
+
import { Ct as isHeadless, L as Integration, St as headlessOption, U as POSTHOG_DOCS_URL, a as getLogFilePath, f as getUI, gt as VERSION, m as LoggingUI, mt as getSkillsBaseUrl, p as setUI, pt as WIZARD_USER_AGENT, r as debug, s as logToFile, wt as regionOption } from "./debug-BKqv-yfT.js";
|
|
3
|
+
import { a as getLocalDev, i as checkLocalServices, o as initLocalDev, r as POSTHOG_LOCAL_URL, s as localMcpSkillsNotice } from "./local-dev-BN6NKQ0B.js";
|
|
4
|
+
import { n as analytics } from "./analytics-D8JNuPAT.js";
|
|
5
|
+
import { r as setEntryCommand } from "./telemetry-BllPiBKw.js";
|
|
6
|
+
import { a as safeReadFile, o as walkProjectFiles } from "./bounded-fs-C6OjqZst.js";
|
|
7
|
+
import { n as isUsingTypeScript } from "./setup-utils-aWZEdfwh.js";
|
|
8
|
+
import { o as handleApiError } from "./api-CemGgyBv.js";
|
|
9
|
+
import "./wizard-session-DTyLMPsX.js";
|
|
10
|
+
import { i as wizardAbort, r as runCleanups } from "./wizard-abort-D9jiMkZA.js";
|
|
11
|
+
import { n as isNonInteractiveEnvironment } from "./environment-Cl-fIQku.js";
|
|
12
|
+
import { n as runAgent, s as authenticate } from "./agent-runner-DEeMqJxy.js";
|
|
13
|
+
import { m as writeJsonAtomic } from "./queue-tools-DABh1Ssc.js";
|
|
14
|
+
import { D as WIZARD_TOOL_NAMES, j as fetchSkillMenu, l as recoverOrphanedSettingsBackups, p as AgentSignals } from "./agent-interface-D3MNaDp3.js";
|
|
15
|
+
import { S as SETUP_REPORT_FILE, _ as AUDIT_CHECKS_KEY, g as AUDIT_CHECKS_FILE, v as AUDIT_REPORT_FILE } from "./yara-hooks-BXDBIOBq.js";
|
|
16
|
+
import { i as SPINNER_MESSAGE, t as FRAMEWORK_REGISTRY } from "./registry-CxNpCNAj.js";
|
|
17
|
+
import { C as scopeInstallDirToProject, D as detectFramework, E as gatherFrameworkContext, S as detectIntegrationProjects, T as resolveProjectDir, _ as HEALTH_CHECK_STEP, a as LINE_CHART_BLOCK, b as getDetectedWarehouseSources, d as isClearBlock, g as detectPostHogIntegration, h as Icons, i as FUNNEL_BLOCK, m as Colors, n as integrationRunStep, o as PRODUCT_SUITE_BLOCK, r as posthogIntegrationConfig, s as StatusPeekTrigger, u as wordWrap, v as WAREHOUSE_ABORT_CASES, x as detectWarehouseSources, y as detectWarehousePrerequisites } from "./posthog-integration-LxEBGkoe.js";
|
|
18
|
+
import { n as readApiKeyFromEnv } from "./env-api-key-CzHDwfV2.js";
|
|
18
19
|
import { satisfies } from "semver";
|
|
19
20
|
import yargs from "yargs";
|
|
20
21
|
import { hideBin } from "yargs/helpers";
|
|
@@ -66,8 +67,9 @@ function toCommandModule(cmd, parentPath) {
|
|
|
66
67
|
* `POSTHOG_WIZARD` env prefix as well as flags.
|
|
67
68
|
*
|
|
68
69
|
* Options with `hidden: true` are "internal modes" — they don't show up in
|
|
69
|
-
* `--help` but are still accepted on every command. The
|
|
70
|
-
*
|
|
70
|
+
* `--help` but are still accepted on every command. The `--local-*` flags live
|
|
71
|
+
* in the constructor's `!IS_PRODUCTION_BUILD` block instead, so published
|
|
72
|
+
* builds reject them; see `docs/local-dev.md`.
|
|
71
73
|
*/
|
|
72
74
|
const GLOBAL_OPTIONS = {
|
|
73
75
|
debug: {
|
|
@@ -97,12 +99,6 @@ const GLOBAL_OPTIONS = {
|
|
|
97
99
|
describe: "Email address for signup (used with --signup)\nenv: POSTHOG_WIZARD_EMAIL",
|
|
98
100
|
type: "string"
|
|
99
101
|
},
|
|
100
|
-
"local-mcp": {
|
|
101
|
-
default: false,
|
|
102
|
-
describe: "Use local MCP server at http://localhost:8787/mcp\nenv: POSTHOG_WIZARD_LOCAL_MCP",
|
|
103
|
-
type: "boolean",
|
|
104
|
-
hidden: true
|
|
105
|
-
},
|
|
106
102
|
"base-url": {
|
|
107
103
|
describe: "Override the PostHog base URL (e.g. http://localhost:8010), bypassing region resolution. Pins the API host, cloud URL, and OAuth server.\nenv: POSTHOG_WIZARD_BASE_URL",
|
|
108
104
|
type: "string",
|
|
@@ -125,7 +121,15 @@ var Wizard = class Wizard {
|
|
|
125
121
|
cli;
|
|
126
122
|
constructor() {
|
|
127
123
|
let cli = yargs(hideBin(process.argv)).env("POSTHOG_WIZARD").options(GLOBAL_OPTIONS);
|
|
128
|
-
this.cli = cli.
|
|
124
|
+
this.cli = cli.middleware((argv) => {
|
|
125
|
+
initLocalDev(argv);
|
|
126
|
+
const notice = localMcpSkillsNotice({
|
|
127
|
+
localDev: argv.localDev,
|
|
128
|
+
localMcp: argv.localMcp,
|
|
129
|
+
localContextMill: argv.localContextMill
|
|
130
|
+
});
|
|
131
|
+
if (notice) process.stderr.write(`\n\x1b[33m! ${notice}\x1b[0m\n\n`);
|
|
132
|
+
}).strictOptions().strictCommands().fail((msg, err) => {
|
|
129
133
|
const text = msg || err && err.message || "Invalid arguments";
|
|
130
134
|
process.stderr.write(`\n\x1b[1;91m✖ ${text}\x1b[0m\n Run \`wizard --help\` to see available commands and options.\n\n`);
|
|
131
135
|
process.exit(1);
|
|
@@ -156,10 +160,29 @@ var Wizard = class Wizard {
|
|
|
156
160
|
process.stderr.write(`\n\x1b[1;91m✖ The --harness, --sequence, --model, and --capture-aio overrides are not available in published builds.\x1b[0m\n\n`);
|
|
157
161
|
process.exit(1);
|
|
158
162
|
}
|
|
163
|
+
const argvHasLocalTarget = args.some((a) => LOCAL_TARGET_FLAGS.some((f) => a === `--${f}` || a === `--no-${f}` || a.startsWith(`--${f}=`)));
|
|
164
|
+
const envHasLocalTarget = LOCAL_TARGET_ENV_VARS.some((k) => process.env[k] != null && process.env[k] !== "");
|
|
165
|
+
if (argvHasLocalTarget || envHasLocalTarget) {
|
|
166
|
+
process.stderr.write("\n\x1B[1;91m✖ The --local-dev, --local-context-mill, --local-mcp, and --local-posthog targets are not available in published builds.\x1B[0m\n They point the wizard at development servers on localhost.\n\n");
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
159
169
|
}
|
|
160
170
|
this.cli.wrap(process.stdout.isTTY ? this.cli.terminalWidth() : 80).argv;
|
|
161
171
|
}
|
|
162
172
|
};
|
|
173
|
+
/** Excludes bare `local`: `wizard mcp add --local` stays available in prod. */
|
|
174
|
+
const LOCAL_TARGET_FLAGS = [
|
|
175
|
+
"local-dev",
|
|
176
|
+
"local-context-mill",
|
|
177
|
+
"local-mcp",
|
|
178
|
+
"local-posthog"
|
|
179
|
+
];
|
|
180
|
+
const LOCAL_TARGET_ENV_VARS = [
|
|
181
|
+
"POSTHOG_WIZARD_LOCAL_DEV",
|
|
182
|
+
"POSTHOG_WIZARD_LOCAL_CONTEXT_MILL",
|
|
183
|
+
"POSTHOG_WIZARD_LOCAL_MCP",
|
|
184
|
+
"POSTHOG_WIZARD_LOCAL_POSTHOG"
|
|
185
|
+
];
|
|
163
186
|
//#endregion
|
|
164
187
|
//#region src/commands/provision.ts
|
|
165
188
|
const provisionCommand = {
|
|
@@ -202,7 +225,7 @@ function runProvision(argv) {
|
|
|
202
225
|
}
|
|
203
226
|
async function provision({ email, region, name, baseUrl, jsonMode }) {
|
|
204
227
|
try {
|
|
205
|
-
const { provisionNewAccount } = await import("./provisioning-
|
|
228
|
+
const { provisionNewAccount } = await import("./provisioning-BHTl91OZ.js").then((n) => n.r);
|
|
206
229
|
if (!jsonMode) getUI().log.info(`Provisioning account for ${email} in ${region}...`);
|
|
207
230
|
emitResult(await provisionNewAccount(email, name, region, { baseUrl }), jsonMode);
|
|
208
231
|
process.exit(0);
|
|
@@ -269,22 +292,22 @@ const basicIntegrationCommand = {
|
|
|
269
292
|
setEntryCommand("integrate");
|
|
270
293
|
(async () => {
|
|
271
294
|
if (isHeadless(argv)) {
|
|
272
|
-
const { runHeadlessInstall } = await import("./ci-install-
|
|
295
|
+
const { runHeadlessInstall } = await import("./ci-install-DIB2n4Ju.js");
|
|
273
296
|
return runHeadlessInstall(argv);
|
|
274
297
|
}
|
|
275
298
|
if (argv.ci) {
|
|
276
|
-
const { runCIInstall } = await import("./ci-install-
|
|
299
|
+
const { runCIInstall } = await import("./ci-install-DIB2n4Ju.js");
|
|
277
300
|
return runCIInstall(argv);
|
|
278
301
|
}
|
|
279
302
|
if (isNonInteractiveEnvironment()) {
|
|
280
|
-
const { failNonInteractive } = await import("./non-interactive-
|
|
303
|
+
const { failNonInteractive } = await import("./non-interactive-CNoYoEZp.js");
|
|
281
304
|
return failNonInteractive();
|
|
282
305
|
}
|
|
283
306
|
if (argv.playground) {
|
|
284
|
-
const { runPlayground } = await import("./playground-
|
|
307
|
+
const { runPlayground } = await import("./playground-uHHgZChe.js");
|
|
285
308
|
return runPlayground();
|
|
286
309
|
}
|
|
287
|
-
const { runInteractive } = await import("./interactive-
|
|
310
|
+
const { runInteractive } = await import("./interactive-D3LdFxZG.js");
|
|
288
311
|
runInteractive(argv);
|
|
289
312
|
})();
|
|
290
313
|
}
|
|
@@ -569,7 +592,10 @@ function buildPrompt(session) {
|
|
|
569
592
|
"The wizard detected the following data warehouse sources in this project:",
|
|
570
593
|
...sources.map((s) => `- ${s.label} (kind: ${s.kind}, mode: ${s.mode}) — ${s.matchedSignal}`),
|
|
571
594
|
"",
|
|
572
|
-
"
|
|
595
|
+
"Each signal names the file it came from. Trust that path — the wizard read it. To confirm a key is set, call `check_env_keys` with the key names and no `filePath`; it scans every `.env` file in the project.",
|
|
596
|
+
"",
|
|
597
|
+
"Set these up in PostHog following the skill instructions: create `in-cli` sources directly via the PostHog MCP after collecting credentials; for `deep-link` sources, provide the user the pre-filled new-source URL.",
|
|
598
|
+
"Use the `kind` string exactly as printed above for `source_type` — PostHog rejects the display label."
|
|
573
599
|
].join("\n");
|
|
574
600
|
}
|
|
575
601
|
const warehouseSourceConfig = {
|
|
@@ -1953,8 +1979,12 @@ STEP 5 — Write the credentials to the env file. (skill: "Write credentials to
|
|
|
1953
1979
|
Use the wizard-tools MCP server. Reuse the env file the skill tells you to
|
|
1954
1980
|
pick — the prerequisite PostHog integration usually already wrote
|
|
1955
1981
|
POSTHOG_* vars to one, so seed your keys alongside them.
|
|
1956
|
-
- First call check_env_keys
|
|
1957
|
-
|
|
1982
|
+
- First call check_env_keys with the key names and that file as filePath.
|
|
1983
|
+
It answers { status: "present" | "missing", foundIn: [paths] } per key —
|
|
1984
|
+
names and paths only, never values, so don't read the file directly.
|
|
1985
|
+
"present" means a real env file sets the key; a key found only in a
|
|
1986
|
+
committed template (.env.example and friends) reads as "missing",
|
|
1987
|
+
because a template documents a key rather than setting it.
|
|
1958
1988
|
- Env tool path rule: ${inSubproject ? `Tool filePaths are relative to the wizard's working directory, not the selected project directory. Treat the skill's env path as relative to the selected project and prefix it with \`${projectPath}/\` when calling the tools: for example, pass \`${projectPath}/.env\`, not \`.env\` (which would target the wizard's working directory).${variant === "rust" ? ` Cargo workspace exception: when the skill places the env file at the workspace root instead, pass the path of the ROOT manifest's directory relative to the wizard's working directory (e.g. \`rust/.env\` for a workspace root at \`rust/\`, or plain \`.env\` when the workspace root IS the working directory) — not the member path.` : ""}` : `Tool filePaths are relative to the wizard's working directory. For an env file at this project root, pass \`.env\`; never prefix it with this directory's path inside an ancestor repository.`}
|
|
1959
1989
|
- Then call set_env_values, passing the STEP 1 secretRef as a value
|
|
1960
1990
|
object, not a literal string:
|
|
@@ -2936,7 +2966,10 @@ function toIntegrationReport(report) {
|
|
|
2936
2966
|
}
|
|
2937
2967
|
/** Run the Haiku detector over the repo and classify projects for integration. */
|
|
2938
2968
|
async function detectSelfDrivingIntegrationProjects(session, onEvent) {
|
|
2939
|
-
return toIntegrationReport(await detectIntegrationProjects(session, {
|
|
2969
|
+
return toIntegrationReport(await detectIntegrationProjects(session, {
|
|
2970
|
+
programId: "self-driving",
|
|
2971
|
+
onEvent
|
|
2972
|
+
}));
|
|
2940
2973
|
}
|
|
2941
2974
|
/**
|
|
2942
2975
|
* Prepare the integration phase after the user picked a project on the
|
|
@@ -2952,9 +2985,7 @@ async function prepSelfDrivingIntegration(session) {
|
|
|
2952
2985
|
const context = await gatherFrameworkContext(frameworkConfig, {
|
|
2953
2986
|
installDir: session.installDir,
|
|
2954
2987
|
debug: session.debug,
|
|
2955
|
-
default: false,
|
|
2956
2988
|
signup: session.signup,
|
|
2957
|
-
localMcp: session.localMcp,
|
|
2958
2989
|
ci: session.ci,
|
|
2959
2990
|
benchmark: session.benchmark,
|
|
2960
2991
|
yaraReport: session.yaraReport
|
|
@@ -3773,7 +3804,8 @@ const mcpAddConfig = {
|
|
|
3773
3804
|
label: "Suggested prompts",
|
|
3774
3805
|
screenId: "mcp-suggested-prompts",
|
|
3775
3806
|
show: (s) => s.mcpOutcome === "installed",
|
|
3776
|
-
isComplete: (s) => s.mcpSuggestedPromptsDismissed
|
|
3807
|
+
isComplete: (s) => s.mcpSuggestedPromptsDismissed,
|
|
3808
|
+
reportsAsProgramId: "mcp-tutorial"
|
|
3777
3809
|
}
|
|
3778
3810
|
]
|
|
3779
3811
|
};
|
|
@@ -4006,9 +4038,7 @@ const replayVisionConfig = {
|
|
|
4006
4038
|
const context = await gatherFrameworkContext(frameworkConfig, {
|
|
4007
4039
|
installDir: session.installDir,
|
|
4008
4040
|
debug: session.debug,
|
|
4009
|
-
default: false,
|
|
4010
4041
|
signup: session.signup,
|
|
4011
|
-
localMcp: session.localMcp,
|
|
4012
4042
|
ci: true,
|
|
4013
4043
|
benchmark: session.benchmark,
|
|
4014
4044
|
yaraReport: session.yaraReport
|
|
@@ -4072,6 +4102,70 @@ final report is written to ./${AI_OBSERVABILITY_REPORT_FILE}.`,
|
|
|
4072
4102
|
}
|
|
4073
4103
|
};
|
|
4074
4104
|
//#endregion
|
|
4105
|
+
//#region src/lib/programs/metrics/index.ts
|
|
4106
|
+
const METRICS_STEPS = AGENT_SKILL_STEPS.map((step) => step.id === "intro" ? {
|
|
4107
|
+
...step,
|
|
4108
|
+
screenId: "metrics-intro"
|
|
4109
|
+
} : step);
|
|
4110
|
+
const METRICS_REPORT_FILE = "posthog-metrics-report.md";
|
|
4111
|
+
/**
|
|
4112
|
+
* `wizard metrics` — instrument the project with PostHog application metrics
|
|
4113
|
+
* (`posthog.metrics` counters, gauges, and histograms).
|
|
4114
|
+
*
|
|
4115
|
+
* No `run.skillId`: the context-mill `metrics` group ships one variant per
|
|
4116
|
+
* platform (python, nodejs, javascript, kubernetes, other/OTLP) and the agent
|
|
4117
|
+
* pulls the matching one itself — the flow's tasks and the linear
|
|
4118
|
+
* `customPrompt` both pick from the menu and install it. Stays flat while a
|
|
4119
|
+
* single "add metrics to a project" flow is the only action.
|
|
4120
|
+
*/
|
|
4121
|
+
const metricsConfig = {
|
|
4122
|
+
command: "metrics",
|
|
4123
|
+
description: "Add PostHog application metrics to your project",
|
|
4124
|
+
id: "metrics",
|
|
4125
|
+
agentFlow: "metrics",
|
|
4126
|
+
steps: METRICS_STEPS,
|
|
4127
|
+
reportFile: METRICS_REPORT_FILE,
|
|
4128
|
+
getContentBlocks: getContentBlocks$3,
|
|
4129
|
+
run: {
|
|
4130
|
+
integrationLabel: "metrics",
|
|
4131
|
+
customPrompt: () => `Instrument this project with PostHog application metrics.
|
|
4132
|
+
|
|
4133
|
+
This flow has no pre-installed skill — you install the right one yourself:
|
|
4134
|
+
|
|
4135
|
+
1. Call \`load_skill_menu\` with \`category: "metrics"\`. The menu is the
|
|
4136
|
+
source of truth: one variant per platform.
|
|
4137
|
+
|
|
4138
|
+
2. Pick the variant that matches the project:
|
|
4139
|
+
- Python tooling (\`pyproject.toml\`, \`requirements.txt\`, \`Pipfile\`) →
|
|
4140
|
+
\`metrics-python\` (needs \`posthog\` >= 7.23.0)
|
|
4141
|
+
- \`package.json\` with server-side Node code → \`metrics-nodejs\`
|
|
4142
|
+
(needs \`posthog-node\` >= 5.43.0)
|
|
4143
|
+
- \`package.json\` that is browser-only → \`metrics-javascript\`
|
|
4144
|
+
(needs \`posthog-js\` >= 1.399.0)
|
|
4145
|
+
- Kubernetes manifests / Helm charts and the user wants cluster-level
|
|
4146
|
+
scraping → \`metrics-kubernetes\`
|
|
4147
|
+
- Any other language → \`metrics-other\` (plain OTLP exporter)
|
|
4148
|
+
A full-stack app (e.g. Next.js) usually wants the server variant — metrics
|
|
4149
|
+
measure service work, not user actions. Genuinely ambiguous →
|
|
4150
|
+
\`wizard_ask\` with a multi-choice picker.
|
|
4151
|
+
|
|
4152
|
+
3. Call \`install_skill\` with the picked variant id. Then follow that skill's
|
|
4153
|
+
\`SKILL.md\` and references end-to-end — it covers where to place metrics
|
|
4154
|
+
(middleware, background jobs, external calls, business commit sites) and
|
|
4155
|
+
the low-cardinality attribute rules.
|
|
4156
|
+
|
|
4157
|
+
Make only additive changes — reuse an existing PostHog client by adding the
|
|
4158
|
+
\`metrics\` config to it rather than constructing a second client, and do not
|
|
4159
|
+
touch existing identify calls, event capture, or dashboards. The final report
|
|
4160
|
+
is written to ./${METRICS_REPORT_FILE}.`,
|
|
4161
|
+
successMessage: `Application metrics configured! View the report at ./${METRICS_REPORT_FILE}`,
|
|
4162
|
+
reportFile: METRICS_REPORT_FILE,
|
|
4163
|
+
docsUrl: "https://posthog.com/docs/metrics",
|
|
4164
|
+
spinnerMessage: "Setting up application metrics...",
|
|
4165
|
+
estimatedDurationMinutes: 5
|
|
4166
|
+
}
|
|
4167
|
+
};
|
|
4168
|
+
//#endregion
|
|
4075
4169
|
//#region src/lib/programs/slack/index.ts
|
|
4076
4170
|
const slackConnectConfig = {
|
|
4077
4171
|
id: "slack",
|
|
@@ -4122,6 +4216,7 @@ const PROGRAM_REGISTRY = [
|
|
|
4122
4216
|
mcpAnalyticsConfig,
|
|
4123
4217
|
replayVisionConfig,
|
|
4124
4218
|
aiObservabilityConfig,
|
|
4219
|
+
metricsConfig,
|
|
4125
4220
|
slackConnectConfig
|
|
4126
4221
|
];
|
|
4127
4222
|
/**
|
|
@@ -4147,6 +4242,7 @@ const Program = {
|
|
|
4147
4242
|
McpAnalytics: mcpAnalyticsConfig.id,
|
|
4148
4243
|
ReplayVision: replayVisionConfig.id,
|
|
4149
4244
|
AiObservability: aiObservabilityConfig.id,
|
|
4245
|
+
Metrics: metricsConfig.id,
|
|
4150
4246
|
SlackConnect: slackConnectConfig.id
|
|
4151
4247
|
};
|
|
4152
4248
|
/**
|
|
@@ -4186,20 +4282,30 @@ const mcpAddCommand = {
|
|
|
4186
4282
|
"api-key": {
|
|
4187
4283
|
describe: "PostHog personal API key (phx_xxx) for MCP authentication",
|
|
4188
4284
|
type: "string"
|
|
4189
|
-
}
|
|
4285
|
+
},
|
|
4286
|
+
...headlessOption
|
|
4190
4287
|
},
|
|
4191
4288
|
handler: runMcpAdd
|
|
4192
4289
|
};
|
|
4193
4290
|
function runMcpAdd(argv) {
|
|
4194
4291
|
const features = parseFeatures(argv.features);
|
|
4195
4292
|
(async () => {
|
|
4196
|
-
const { readApiKeyFromEnv } = await import("./env-api-key-
|
|
4293
|
+
const { readApiKeyFromEnv } = await import("./env-api-key-CzHDwfV2.js").then((n) => n.t);
|
|
4197
4294
|
const apiKey = argv.apiKey || readApiKeyFromEnv();
|
|
4198
4295
|
const debug = argv.debug;
|
|
4199
4296
|
const localMcp = argv.local;
|
|
4297
|
+
const args = {
|
|
4298
|
+
local: localMcp,
|
|
4299
|
+
features,
|
|
4300
|
+
apiKey
|
|
4301
|
+
};
|
|
4302
|
+
if (isHeadless(argv)) {
|
|
4303
|
+
await runHeadlessAdd(args);
|
|
4304
|
+
return;
|
|
4305
|
+
}
|
|
4200
4306
|
try {
|
|
4201
|
-
const { startTUI } = await import("./start-tui-
|
|
4202
|
-
const { buildSession } = await import("./wizard-session-
|
|
4307
|
+
const { startTUI } = await import("./start-tui-BQH4mQIZ.js");
|
|
4308
|
+
const { buildSession } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
4203
4309
|
const tui = startTUI(VERSION, Program.McpAdd);
|
|
4204
4310
|
tui.store.session = buildSession({
|
|
4205
4311
|
debug,
|
|
@@ -4210,16 +4316,16 @@ function runMcpAdd(argv) {
|
|
|
4210
4316
|
});
|
|
4211
4317
|
} catch (error) {
|
|
4212
4318
|
if (!isTUIUnavailable(error)) throw error;
|
|
4213
|
-
|
|
4214
|
-
const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-BUqb93_I.js").then((n) => n.r);
|
|
4215
|
-
await addMCPServerToClientsStep({
|
|
4216
|
-
local: localMcp,
|
|
4217
|
-
features,
|
|
4218
|
-
apiKey
|
|
4219
|
-
});
|
|
4319
|
+
await runHeadlessAdd(args);
|
|
4220
4320
|
}
|
|
4221
4321
|
})();
|
|
4222
4322
|
}
|
|
4323
|
+
async function runHeadlessAdd(args) {
|
|
4324
|
+
setUI(new LoggingUI());
|
|
4325
|
+
const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-DWDEuDUR.js").then((n) => n.r);
|
|
4326
|
+
const { installed, failed } = await addMCPServerToClientsStep(args);
|
|
4327
|
+
if (failed.length > 0 || installed.length === 0) process.exitCode = 1;
|
|
4328
|
+
}
|
|
4223
4329
|
function parseFeatures(raw) {
|
|
4224
4330
|
if (typeof raw !== "string") return void 0;
|
|
4225
4331
|
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -4229,20 +4335,27 @@ function parseFeatures(raw) {
|
|
|
4229
4335
|
const mcpRemoveCommand = {
|
|
4230
4336
|
name: "remove",
|
|
4231
4337
|
description: "Remove PostHog MCP server from supported clients",
|
|
4232
|
-
options: {
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4338
|
+
options: {
|
|
4339
|
+
local: {
|
|
4340
|
+
default: false,
|
|
4341
|
+
describe: "Remove local development MCP server (http://localhost:8787)",
|
|
4342
|
+
type: "boolean"
|
|
4343
|
+
},
|
|
4344
|
+
...headlessOption
|
|
4345
|
+
},
|
|
4237
4346
|
handler: runMcpRemove
|
|
4238
4347
|
};
|
|
4239
4348
|
function runMcpRemove(argv) {
|
|
4240
4349
|
(async () => {
|
|
4241
4350
|
const debug = argv.debug;
|
|
4242
4351
|
const localMcp = argv.local;
|
|
4352
|
+
if (isHeadless(argv)) {
|
|
4353
|
+
await runHeadlessRemove(localMcp);
|
|
4354
|
+
return;
|
|
4355
|
+
}
|
|
4243
4356
|
try {
|
|
4244
|
-
const { startTUI } = await import("./start-tui-
|
|
4245
|
-
const { buildSession } = await import("./wizard-session-
|
|
4357
|
+
const { startTUI } = await import("./start-tui-BQH4mQIZ.js");
|
|
4358
|
+
const { buildSession } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
4246
4359
|
const tui = startTUI(VERSION, Program.McpRemove);
|
|
4247
4360
|
tui.store.session = buildSession({
|
|
4248
4361
|
debug,
|
|
@@ -4251,12 +4364,16 @@ function runMcpRemove(argv) {
|
|
|
4251
4364
|
});
|
|
4252
4365
|
} catch (error) {
|
|
4253
4366
|
if (!isTUIUnavailable(error)) throw error;
|
|
4254
|
-
|
|
4255
|
-
const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-BUqb93_I.js").then((n) => n.r);
|
|
4256
|
-
await removeMCPServerFromClientsStep({ local: localMcp });
|
|
4367
|
+
await runHeadlessRemove(localMcp);
|
|
4257
4368
|
}
|
|
4258
4369
|
})();
|
|
4259
4370
|
}
|
|
4371
|
+
/** No exit code on an empty result: nothing to remove is the requested end state. */
|
|
4372
|
+
async function runHeadlessRemove(local) {
|
|
4373
|
+
setUI(new LoggingUI());
|
|
4374
|
+
const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-DWDEuDUR.js").then((n) => n.r);
|
|
4375
|
+
await removeMCPServerFromClientsStep({ local });
|
|
4376
|
+
}
|
|
4260
4377
|
//#endregion
|
|
4261
4378
|
//#region src/commands/mcp/tutorial.ts
|
|
4262
4379
|
const mcpTutorialCommand = {
|
|
@@ -4274,8 +4391,8 @@ function runMcpTutorial(argv) {
|
|
|
4274
4391
|
const debug = argv.debug;
|
|
4275
4392
|
const localMcp = argv.local;
|
|
4276
4393
|
try {
|
|
4277
|
-
const { startTUI } = await import("./start-tui-
|
|
4278
|
-
const { buildSession } = await import("./wizard-session-
|
|
4394
|
+
const { startTUI } = await import("./start-tui-BQH4mQIZ.js");
|
|
4395
|
+
const { buildSession } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
4279
4396
|
const tui = startTUI(VERSION, Program.McpTutorial);
|
|
4280
4397
|
tui.store.session = buildSession({
|
|
4281
4398
|
debug,
|
|
@@ -4356,15 +4473,27 @@ function runWizard(config, options) {
|
|
|
4356
4473
|
(async () => {
|
|
4357
4474
|
try {
|
|
4358
4475
|
const installDir = options.installDir || process.cwd();
|
|
4359
|
-
const { startTUI } = await import("./start-tui-
|
|
4360
|
-
const { buildSession, RunPhase } = await import("./wizard-session-
|
|
4361
|
-
const { TaskStreamPush } = await import("./task-stream-
|
|
4362
|
-
const { PostHogDestination } = await import("./posthog-
|
|
4476
|
+
const { startTUI } = await import("./start-tui-BQH4mQIZ.js");
|
|
4477
|
+
const { buildSession, RunPhase } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
4478
|
+
const { TaskStreamPush } = await import("./task-stream-jUARpyB5.js");
|
|
4479
|
+
const { PostHogDestination } = await import("./posthog-ChzdlmCs.js");
|
|
4480
|
+
const local = getLocalDev();
|
|
4481
|
+
const localServicesError = await checkLocalServices({
|
|
4482
|
+
...local,
|
|
4483
|
+
localPosthog: local.localPosthog && !options.baseUrl
|
|
4484
|
+
});
|
|
4485
|
+
if (localServicesError) {
|
|
4486
|
+
const { wizardAbort } = await import("./wizard-abort-pFFH7dcx.js");
|
|
4487
|
+
await wizardAbort({ message: localServicesError });
|
|
4488
|
+
return;
|
|
4489
|
+
}
|
|
4363
4490
|
tui = startTUI(WIZARD_VERSION, config.id);
|
|
4364
4491
|
const activeTui = tui;
|
|
4365
4492
|
const session = buildSession({
|
|
4366
4493
|
debug: options.debug,
|
|
4494
|
+
localDev: options.localDev,
|
|
4367
4495
|
localMcp: options.localMcp,
|
|
4496
|
+
localPosthog: options.localPosthog,
|
|
4368
4497
|
installDir,
|
|
4369
4498
|
ci: false,
|
|
4370
4499
|
signup: options.signup,
|
|
@@ -4425,7 +4554,7 @@ function runWizard(config, options) {
|
|
|
4425
4554
|
if (shown(step)) await advanceStep(step, activeTui.store, config);
|
|
4426
4555
|
}
|
|
4427
4556
|
else if (skipAgent) {
|
|
4428
|
-
const { getOrAskForProjectData } = await import("./setup-utils-
|
|
4557
|
+
const { getOrAskForProjectData } = await import("./setup-utils-aWZEdfwh.js").then((n) => n.r);
|
|
4429
4558
|
const { projectApiKey, host, accessToken, projectId } = await getOrAskForProjectData({
|
|
4430
4559
|
signup: session.signup,
|
|
4431
4560
|
ci: session.ci,
|
|
@@ -4526,11 +4655,11 @@ function runNonInteractive(config, options, mode) {
|
|
|
4526
4655
|
analytics.setTag("build", mode);
|
|
4527
4656
|
(async () => {
|
|
4528
4657
|
const path = await import("path");
|
|
4529
|
-
const { buildSession, RunPhase, OutroKind } = await import("./wizard-session-
|
|
4530
|
-
const { readEnvironment } = await import("./environment-
|
|
4531
|
-
const { readApiKeyFromEnv } = await import("./env-api-key-
|
|
4532
|
-
const { configureLogFileFromEnvironment, logToFile } = await import("./debug-
|
|
4533
|
-
const { wizardAbort, WizardError } = await import("./wizard-abort-
|
|
4658
|
+
const { buildSession, RunPhase, OutroKind } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
4659
|
+
const { readEnvironment } = await import("./environment-Cl-fIQku.js").then((n) => n.t);
|
|
4660
|
+
const { readApiKeyFromEnv } = await import("./env-api-key-CzHDwfV2.js").then((n) => n.t);
|
|
4661
|
+
const { configureLogFileFromEnvironment, logToFile } = await import("./debug-H-GTKvvU.js");
|
|
4662
|
+
const { wizardAbort, WizardError } = await import("./wizard-abort-pFFH7dcx.js");
|
|
4534
4663
|
configureLogFileFromEnvironment();
|
|
4535
4664
|
const env = readEnvironment();
|
|
4536
4665
|
const apiKey = options.apiKey ?? readApiKeyFromEnv() ?? void 0;
|
|
@@ -4540,7 +4669,9 @@ function runNonInteractive(config, options, mode) {
|
|
|
4540
4669
|
installDir,
|
|
4541
4670
|
ci: true,
|
|
4542
4671
|
signup: options.signup,
|
|
4672
|
+
localDev: options.localDev,
|
|
4543
4673
|
localMcp: options.localMcp,
|
|
4674
|
+
localPosthog: options.localPosthog,
|
|
4544
4675
|
apiKey,
|
|
4545
4676
|
email: options.email,
|
|
4546
4677
|
projectId: options.projectId,
|
|
@@ -4560,12 +4691,21 @@ function runNonInteractive(config, options, mode) {
|
|
|
4560
4691
|
const runDef = typeof config.run === "object" ? config.run : null;
|
|
4561
4692
|
getUI().intro("Welcome to the PostHog setup wizard");
|
|
4562
4693
|
getUI().log.info(`Running ${config.id} in ${modeLabel(mode)} mode`);
|
|
4694
|
+
const localServicesError = await checkLocalServices({
|
|
4695
|
+
...getLocalDev(),
|
|
4696
|
+
localMcp: session.localMcp,
|
|
4697
|
+
localPosthog: session.baseUrl === POSTHOG_LOCAL_URL
|
|
4698
|
+
});
|
|
4699
|
+
if (localServicesError) {
|
|
4700
|
+
await wizardAbort({ message: localServicesError });
|
|
4701
|
+
return;
|
|
4702
|
+
}
|
|
4563
4703
|
let store = null;
|
|
4564
4704
|
let taskStream = null;
|
|
4565
4705
|
if (mode === "headless") {
|
|
4566
|
-
const { WizardStore } = await import("./store-
|
|
4567
|
-
const { HeadlessUI } = await import("./headless-ui-
|
|
4568
|
-
const { TaskStreamPush, PostHogDestination } = await import("./task-stream-
|
|
4706
|
+
const { WizardStore } = await import("./store-P_7zUfbj.js").then((n) => n.n);
|
|
4707
|
+
const { HeadlessUI } = await import("./headless-ui-DT3Db1bk.js");
|
|
4708
|
+
const { TaskStreamPush, PostHogDestination } = await import("./task-stream-jUARpyB5.js");
|
|
4569
4709
|
store = new WizardStore(config.id);
|
|
4570
4710
|
store.session = session;
|
|
4571
4711
|
setUI(new HeadlessUI(store));
|
|
@@ -4621,7 +4761,7 @@ function runNonInteractive(config, options, mode) {
|
|
|
4621
4761
|
});
|
|
4622
4762
|
}
|
|
4623
4763
|
}
|
|
4624
|
-
const { runAgent } = await import("./agent-runner-
|
|
4764
|
+
const { runAgent } = await import("./agent-runner-DEeMqJxy.js").then((n) => n.t);
|
|
4625
4765
|
await runAgent(config, session);
|
|
4626
4766
|
await settleStream(RunPhase.Completed);
|
|
4627
4767
|
} catch (error) {
|
|
@@ -4675,10 +4815,9 @@ function runWizardHeadless(config, options) {
|
|
|
4675
4815
|
* Per-command options shared by every skill-based program command
|
|
4676
4816
|
* (`audit events`, `migrate statsig`, `revenue`, `source-maps`, …).
|
|
4677
4817
|
*
|
|
4678
|
-
* Only flags
|
|
4679
|
-
*
|
|
4680
|
-
*
|
|
4681
|
-
* across every command — no need to repeat them per subcommand.
|
|
4818
|
+
* Only flags unique to skill commands live here. Global flags are declared
|
|
4819
|
+
* once in `wizard.ts` — both in `GLOBAL_OPTIONS` and, for the dev-only ones,
|
|
4820
|
+
* the `Wizard` constructor — and apply to every command automatically.
|
|
4682
4821
|
*/
|
|
4683
4822
|
const skillProgramOptions = { "install-dir": {
|
|
4684
4823
|
describe: "Directory to install in",
|
|
@@ -4790,6 +4929,19 @@ const replayVisionCommand = nativeCommandFactory(replayVisionConfig);
|
|
|
4790
4929
|
*/
|
|
4791
4930
|
const aiObservabilityCommand = nativeCommandFactory(aiObservabilityConfig);
|
|
4792
4931
|
//#endregion
|
|
4932
|
+
//#region src/commands/metrics.ts
|
|
4933
|
+
/**
|
|
4934
|
+
* `wizard metrics` — flat skill command, wire PostHog application metrics
|
|
4935
|
+
* (counters, gauges, histograms via \`posthog.metrics\`) into a project.
|
|
4936
|
+
*
|
|
4937
|
+
* The `metrics` context-mill skill has one variant per platform (python,
|
|
4938
|
+
* nodejs, javascript, kubernetes, other/OTLP); the agent picks the right one
|
|
4939
|
+
* at run time by scanning the project's manifest and (when ambiguous) asking
|
|
4940
|
+
* the user via `wizard_ask`. Stays flat while a single "add metrics to a
|
|
4941
|
+
* project" flow is the only action.
|
|
4942
|
+
*/
|
|
4943
|
+
const metricsCommand = nativeCommandFactory(metricsConfig);
|
|
4944
|
+
//#endregion
|
|
4793
4945
|
//#region src/lib/programs/dispatch-family.ts
|
|
4794
4946
|
/**
|
|
4795
4947
|
* Capture a CLI dispatch error, flush analytics, and exit. The wizard never
|
|
@@ -4852,7 +5004,7 @@ async function dispatchFamily(family, argv) {
|
|
|
4852
5004
|
dispatchProgram(native, argv);
|
|
4853
5005
|
return;
|
|
4854
5006
|
}
|
|
4855
|
-
const skillsBaseUrl = getSkillsBaseUrl(
|
|
5007
|
+
const skillsBaseUrl = getSkillsBaseUrl();
|
|
4856
5008
|
const menu = await fetchSkillMenu(skillsBaseUrl);
|
|
4857
5009
|
if (!menu) return exitDispatchError("registry unreachable", {
|
|
4858
5010
|
family,
|
|
@@ -5762,7 +5914,7 @@ function createFamilyPickerDefault(parentLabel, children, chooser = chooseFamily
|
|
|
5762
5914
|
*/
|
|
5763
5915
|
function familyCommandFactory({ family, description, optionsFrom }) {
|
|
5764
5916
|
const openFamilyEntry = async (argv) => {
|
|
5765
|
-
const toShow = pickerChildrenToShow(buildFamilyPickerChildren(family, (await fetchSkillMenu(getSkillsBaseUrl(
|
|
5917
|
+
const toShow = pickerChildrenToShow(buildFamilyPickerChildren(family, (await fetchSkillMenu(getSkillsBaseUrl()))?.cliEntries ?? []));
|
|
5766
5918
|
if (toShow.length === 1 && toShow[0]?.handler) {
|
|
5767
5919
|
await Promise.resolve(toShow[0].handler(argv));
|
|
5768
5920
|
return;
|
|
@@ -5838,7 +5990,7 @@ async function runDoctorCI(options) {
|
|
|
5838
5990
|
getUI().intro("Welcome to the PostHog setup wizard");
|
|
5839
5991
|
getUI().log.info("Running posthog-doctor in CI mode");
|
|
5840
5992
|
try {
|
|
5841
|
-
const { getOrAskForProjectData } = await import("./setup-utils-
|
|
5993
|
+
const { getOrAskForProjectData } = await import("./setup-utils-aWZEdfwh.js").then((n) => n.r);
|
|
5842
5994
|
const { host, accessToken, projectId } = await getOrAskForProjectData({
|
|
5843
5995
|
signup: false,
|
|
5844
5996
|
ci: true,
|
|
@@ -5856,7 +6008,7 @@ async function runDoctorCI(options) {
|
|
|
5856
6008
|
for (const issue of sorted) getUI().log.info(` • [${issue.severity}] ${getKindMeta(issue.kind).title}`);
|
|
5857
6009
|
process.exit(1);
|
|
5858
6010
|
} catch (error) {
|
|
5859
|
-
const { ApiError } = await import("./api-
|
|
6011
|
+
const { ApiError } = await import("./api-CemGgyBv.js").then((n) => n.n);
|
|
5860
6012
|
const message = error instanceof ApiError && error.statusCode === 401 ? "Your PostHog API key is invalid or expired." : error instanceof Error ? error.message : String(error);
|
|
5861
6013
|
getUI().log.error(`Doctor failed: ${message}`);
|
|
5862
6014
|
process.exit(1);
|
|
@@ -5938,8 +6090,8 @@ function runSlackConnect(argv) {
|
|
|
5938
6090
|
(async () => {
|
|
5939
6091
|
const debug = argv.debug;
|
|
5940
6092
|
try {
|
|
5941
|
-
const { startTUI } = await import("./start-tui-
|
|
5942
|
-
const { buildSession } = await import("./wizard-session-
|
|
6093
|
+
const { startTUI } = await import("./start-tui-BQH4mQIZ.js");
|
|
6094
|
+
const { buildSession } = await import("./wizard-session-Cw7-_OcZ.js");
|
|
5943
6095
|
const tui = startTUI(VERSION, Program.SlackConnect);
|
|
5944
6096
|
tui.store.session = buildSession({
|
|
5945
6097
|
debug,
|
|
@@ -6016,8 +6168,8 @@ const BROWSABLE_ROLES = new Set(["command", "skill"]);
|
|
|
6016
6168
|
* step's own `menu-fetch-failed` handling, rather than adding a second network
|
|
6017
6169
|
* dependency that could block an otherwise-valid run.
|
|
6018
6170
|
*/
|
|
6019
|
-
async function assertSkillExists(skillName
|
|
6020
|
-
const skillsBaseUrl = getSkillsBaseUrl(
|
|
6171
|
+
async function assertSkillExists(skillName) {
|
|
6172
|
+
const skillsBaseUrl = getSkillsBaseUrl();
|
|
6021
6173
|
const menu = await fetchSkillMenu(skillsBaseUrl);
|
|
6022
6174
|
if (!menu) return;
|
|
6023
6175
|
if (Object.values(menu.categories).flat().some((s) => s.id === skillName)) return;
|
|
@@ -6050,9 +6202,9 @@ const skillCommand = {
|
|
|
6050
6202
|
children: [{
|
|
6051
6203
|
name: "list",
|
|
6052
6204
|
description: "List every browsable skill in the catalog",
|
|
6053
|
-
handler: (
|
|
6205
|
+
handler: () => {
|
|
6054
6206
|
runCommandHandler(async () => {
|
|
6055
|
-
const skillsBaseUrl = getSkillsBaseUrl(
|
|
6207
|
+
const skillsBaseUrl = getSkillsBaseUrl();
|
|
6056
6208
|
const menu = await fetchSkillMenu(skillsBaseUrl);
|
|
6057
6209
|
if (!menu) {
|
|
6058
6210
|
analytics.wizardCapture("cli dispatch error", {
|
|
@@ -6091,7 +6243,7 @@ const skillCommand = {
|
|
|
6091
6243
|
handler: (argv) => {
|
|
6092
6244
|
runCommandHandler(async () => {
|
|
6093
6245
|
const skillName = readSkillName(argv);
|
|
6094
|
-
await assertSkillExists(skillName
|
|
6246
|
+
await assertSkillExists(skillName);
|
|
6095
6247
|
runSkillMode({
|
|
6096
6248
|
...argv,
|
|
6097
6249
|
skill: skillName
|
|
@@ -6269,7 +6421,7 @@ function resolveInstallDir() {
|
|
|
6269
6421
|
if (inline) return inline.slice(14);
|
|
6270
6422
|
return process.env.POSTHOG_WIZARD_INSTALL_DIR ?? process.cwd();
|
|
6271
6423
|
}
|
|
6272
|
-
Wizard.use(basicIntegrationCommand).use(mcpCommand).use(mcpAnalyticsCommand).use(replayVisionCommand).use(aiObservabilityCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
|
|
6424
|
+
Wizard.use(basicIntegrationCommand).use(mcpCommand).use(mcpAnalyticsCommand).use(replayVisionCommand).use(aiObservabilityCommand).use(metricsCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
|
|
6273
6425
|
//#endregion
|
|
6274
6426
|
export { STRIPE_SDKS as A, MANUAL_SDK_VARIANTS as C, fetchHealthIssues as D, getKindMeta as E, getContentBlocks$3 as O, MANUAL_SDK_INSTALL as S, SOURCE_MAPS_CONTEXT_KEYS as T, detectSelfDrivingIntegrationProjects as _, useStdoutDimensions as a, DISPLAY_NAME as b, runWizardHeadless as c, PROGRAM_REGISTRY as d, Program as f, PRICING_SHORT as g, PRICING_LONG as h, useKeyboardHintsContext as i, POSTHOG_SDKS as k, runWizardCI as l, NO_DEFAULT_LIMIT as m, useKeyBindings as n, ConfirmButton as o, getProgramConfig as p, KeyboardHintsProvider as r, PromptLabel as s, PickerMenu as t, runWizard as u, SELF_DRIVING_INTEGRATE_PATH_KEY as v, RUST_SDK_CRATE as w, GO_SDK_MODULE as x, AUTOMATABLE_VARIANTS as y };
|
|
6275
6427
|
|