@posthog/wizard 2.6.2 → 2.7.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/src/lib/__tests__/cloudflare-detection.test.d.ts +1 -0
- package/dist/src/lib/__tests__/cloudflare-detection.test.js +119 -0
- package/dist/src/lib/__tests__/cloudflare-detection.test.js.map +1 -0
- package/dist/src/lib/agent-runner.js +15 -3
- package/dist/src/lib/agent-runner.js.map +1 -1
- package/dist/src/lib/cloudflare-detection.d.ts +14 -0
- package/dist/src/lib/cloudflare-detection.js +74 -0
- package/dist/src/lib/cloudflare-detection.js.map +1 -0
- package/dist/src/lib/constants.d.ts +4 -1
- package/dist/src/lib/constants.js +4 -1
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/middleware/config.js +4 -4
- package/dist/src/lib/middleware/config.js.map +1 -1
- package/dist/src/lib/version.d.ts +1 -1
- package/dist/src/lib/version.js +1 -1
- package/dist/src/lib/version.js.map +1 -1
- package/dist/src/lib/wizard-session.d.ts +2 -0
- package/dist/src/lib/wizard-session.js +2 -0
- package/dist/src/lib/wizard-session.js.map +1 -1
- package/dist/src/run.js +4 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/defaults.js +5 -5
- package/dist/src/steps/add-mcp-server-to-clients/defaults.js.map +1 -1
- package/dist/src/ui/tui/__tests__/store.test.js +26 -2
- package/dist/src/ui/tui/__tests__/store.test.js.map +1 -1
- package/dist/src/ui/tui/flows.d.ts +1 -0
- package/dist/src/ui/tui/flows.js +6 -1
- package/dist/src/ui/tui/flows.js.map +1 -1
- package/dist/src/ui/tui/screen-registry.js +2 -0
- package/dist/src/ui/tui/screen-registry.js.map +1 -1
- package/dist/src/ui/tui/screens/OutroScreen.js +2 -2
- package/dist/src/ui/tui/screens/OutroScreen.js.map +1 -1
- package/dist/src/ui/tui/screens/SkillsScreen.d.ts +14 -0
- package/dist/src/ui/tui/screens/SkillsScreen.js +71 -0
- package/dist/src/ui/tui/screens/SkillsScreen.js.map +1 -0
- package/dist/src/ui/tui/store.d.ts +2 -0
- package/dist/src/ui/tui/store.js +12 -0
- package/dist/src/ui/tui/store.js.map +1 -1
- package/dist/src/utils/debug.d.ts +6 -0
- package/dist/src/utils/debug.js +16 -0
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/oauth.js +1 -1
- package/dist/src/utils/oauth.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +8 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const cloudflare_detection_1 = require("../cloudflare-detection");
|
|
40
|
+
jest.mock('../../utils/debug');
|
|
41
|
+
function makeTmpDir() {
|
|
42
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), 'cloudflare-detect-'));
|
|
43
|
+
}
|
|
44
|
+
function cleanup(dir) {
|
|
45
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
function writePackageJson(dir, pkg) {
|
|
48
|
+
fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(pkg));
|
|
49
|
+
}
|
|
50
|
+
describe('detectCloudflareTarget', () => {
|
|
51
|
+
let tmpDir;
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
tmpDir = makeTmpDir();
|
|
54
|
+
});
|
|
55
|
+
afterEach(() => cleanup(tmpDir));
|
|
56
|
+
it('returns false for an empty directory', async () => {
|
|
57
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
// -------------------------------------------------------------------------
|
|
60
|
+
// Criterion 1: wrangler config files
|
|
61
|
+
// -------------------------------------------------------------------------
|
|
62
|
+
describe('wrangler config detection', () => {
|
|
63
|
+
it('detects wrangler.toml', async () => {
|
|
64
|
+
fs.writeFileSync(path.join(tmpDir, 'wrangler.toml'), 'name = "app"');
|
|
65
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it('detects wrangler.jsonc', async () => {
|
|
68
|
+
fs.writeFileSync(path.join(tmpDir, 'wrangler.jsonc'), '{}');
|
|
69
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
it('detects wrangler.json', async () => {
|
|
72
|
+
fs.writeFileSync(path.join(tmpDir, 'wrangler.json'), '{}');
|
|
73
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
it('detects wrangler config even when package.json is missing', async () => {
|
|
76
|
+
fs.writeFileSync(path.join(tmpDir, 'wrangler.toml'), 'name = "app"');
|
|
77
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
// -------------------------------------------------------------------------
|
|
81
|
+
// Criterion 2: Cloudflare adapter/platform packages
|
|
82
|
+
// -------------------------------------------------------------------------
|
|
83
|
+
describe('package dependency detection', () => {
|
|
84
|
+
it.each([
|
|
85
|
+
'@react-router/cloudflare',
|
|
86
|
+
'@astrojs/cloudflare',
|
|
87
|
+
'@sveltejs/adapter-cloudflare',
|
|
88
|
+
'@sveltejs/adapter-cloudflare-workers',
|
|
89
|
+
'@cloudflare/workers-types',
|
|
90
|
+
'wrangler',
|
|
91
|
+
])('detects %s in dependencies', async (pkgName) => {
|
|
92
|
+
writePackageJson(tmpDir, { dependencies: { [pkgName]: '^1.0.0' } });
|
|
93
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('detects Cloudflare package in devDependencies', async () => {
|
|
96
|
+
writePackageJson(tmpDir, {
|
|
97
|
+
devDependencies: { wrangler: '^3.0.0' },
|
|
98
|
+
});
|
|
99
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
it('returns false when no Cloudflare packages are present', async () => {
|
|
102
|
+
writePackageJson(tmpDir, {
|
|
103
|
+
dependencies: { react: '^19.0.0', next: '^15.0.0' },
|
|
104
|
+
});
|
|
105
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
it('returns false for an invalid package.json', async () => {
|
|
108
|
+
fs.writeFileSync(path.join(tmpDir, 'package.json'), 'not json');
|
|
109
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
it('does not match packages whose names merely contain "cloudflare"', async () => {
|
|
112
|
+
writePackageJson(tmpDir, {
|
|
113
|
+
dependencies: { 'some-cloudflare-lookalike': '^1.0.0' },
|
|
114
|
+
});
|
|
115
|
+
expect(await (0, cloudflare_detection_1.detectCloudflareTarget)(tmpDir)).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=cloudflare-detection.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-detection.test.js","sourceRoot":"","sources":["../../../../src/lib/__tests__/cloudflare-detection.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,kEAAiE;AAEjE,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AAE/B,SAAS,UAAU;IACjB,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,I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EAAE;gBACvB,eAAe,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;aACxC,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,IAAA,6CAAsB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACrE,gBAAgB,CAAC,MAAM,EAAE;gBACvB,YAAY,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;aACpD,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,IAAA,6CAAsB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;YACzD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;YAChE,MAAM,CAAC,MAAM,IAAA,6CAAsB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;YAC/E,gBAAgB,CAAC,MAAM,EAAE;gBACvB,YAAY,EAAE,EAAE,2BAA2B,EAAE,QAAQ,EAAE;aACxD,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,IAAA,6CAAsB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { detectCloudflareTarget } from '../cloudflare-detection';\n\njest.mock('../../utils/debug');\n\nfunction makeTmpDir(): string {\n return fs.mkdtempSync(path.join(os.tmpdir(), 'cloudflare-detect-'));\n}\n\nfunction cleanup(dir: string): void {\n fs.rmSync(dir, { recursive: true, force: true });\n}\n\nfunction writePackageJson(dir: string, pkg: Record<string, unknown>): void {\n fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(pkg));\n}\n\ndescribe('detectCloudflareTarget', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = makeTmpDir();\n });\n afterEach(() => cleanup(tmpDir));\n\n it('returns false for an empty directory', async () => {\n expect(await detectCloudflareTarget(tmpDir)).toBe(false);\n });\n\n // -------------------------------------------------------------------------\n // Criterion 1: wrangler config files\n // -------------------------------------------------------------------------\n\n describe('wrangler config detection', () => {\n it('detects wrangler.toml', async () => {\n fs.writeFileSync(path.join(tmpDir, 'wrangler.toml'), 'name = \"app\"');\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n\n it('detects wrangler.jsonc', async () => {\n fs.writeFileSync(path.join(tmpDir, 'wrangler.jsonc'), '{}');\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n\n it('detects wrangler.json', async () => {\n fs.writeFileSync(path.join(tmpDir, 'wrangler.json'), '{}');\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n\n it('detects wrangler config even when package.json is missing', async () => {\n fs.writeFileSync(path.join(tmpDir, 'wrangler.toml'), 'name = \"app\"');\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n });\n\n // -------------------------------------------------------------------------\n // Criterion 2: Cloudflare adapter/platform packages\n // -------------------------------------------------------------------------\n\n describe('package dependency detection', () => {\n it.each([\n '@react-router/cloudflare',\n '@astrojs/cloudflare',\n '@sveltejs/adapter-cloudflare',\n '@sveltejs/adapter-cloudflare-workers',\n '@cloudflare/workers-types',\n 'wrangler',\n ])('detects %s in dependencies', async (pkgName) => {\n writePackageJson(tmpDir, { dependencies: { [pkgName]: '^1.0.0' } });\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n\n it('detects Cloudflare package in devDependencies', async () => {\n writePackageJson(tmpDir, {\n devDependencies: { wrangler: '^3.0.0' },\n });\n expect(await detectCloudflareTarget(tmpDir)).toBe(true);\n });\n\n it('returns false when no Cloudflare packages are present', async () => {\n writePackageJson(tmpDir, {\n dependencies: { react: '^19.0.0', next: '^15.0.0' },\n });\n expect(await detectCloudflareTarget(tmpDir)).toBe(false);\n });\n\n it('returns false for an invalid package.json', async () => {\n fs.writeFileSync(path.join(tmpDir, 'package.json'), 'not json');\n expect(await detectCloudflareTarget(tmpDir)).toBe(false);\n });\n\n it('does not match packages whose names merely contain \"cloudflare\"', async () => {\n writePackageJson(tmpDir, {\n dependencies: { 'some-cloudflare-lookalike': '^1.0.0' },\n });\n expect(await detectCloudflareTarget(tmpDir)).toBe(false);\n });\n });\n});\n"]}
|
|
@@ -48,6 +48,7 @@ const debug_1 = require("../utils/debug");
|
|
|
48
48
|
const benchmark_1 = require("./middleware/benchmark");
|
|
49
49
|
const wizard_abort_1 = require("../utils/wizard-abort");
|
|
50
50
|
const yara_hooks_1 = require("./yara-hooks");
|
|
51
|
+
const cloudflare_detection_1 = require("./cloudflare-detection");
|
|
51
52
|
/**
|
|
52
53
|
* Build a WizardOptions bag from a WizardSession (for code that still expects WizardOptions).
|
|
53
54
|
*/
|
|
@@ -182,13 +183,21 @@ async function runAgentWizard(config, session) {
|
|
|
182
183
|
Object.entries(contextTags).forEach(([key, value]) => {
|
|
183
184
|
analytics_1.analytics.setTag(key, value);
|
|
184
185
|
});
|
|
186
|
+
// Detect Cloudflare Workers target and fetch runtime reference if needed
|
|
187
|
+
const isCloudflare = await (0, cloudflare_detection_1.detectCloudflareTarget)(session.installDir);
|
|
188
|
+
let cloudflareReference = null;
|
|
189
|
+
if (isCloudflare) {
|
|
190
|
+
(0, debug_1.logToFile)('[agent-runner] Cloudflare Workers target detected');
|
|
191
|
+
analytics_1.analytics.setTag('cloudflare', 'true');
|
|
192
|
+
cloudflareReference = await (0, cloudflare_detection_1.fetchCloudflareReference)(skillsBaseUrl);
|
|
193
|
+
}
|
|
185
194
|
const integrationPrompt = buildIntegrationPrompt(config, {
|
|
186
195
|
frameworkVersion: frameworkVersion || 'latest',
|
|
187
196
|
typescript: typeScriptDetected,
|
|
188
197
|
projectApiKey,
|
|
189
198
|
host,
|
|
190
199
|
projectId,
|
|
191
|
-
}, frameworkContext);
|
|
200
|
+
}, frameworkContext, cloudflareReference);
|
|
192
201
|
// Initialize and run agent
|
|
193
202
|
const spinner = (0, ui_1.getUI)().spinner();
|
|
194
203
|
// Evaluate all feature flags at the start of the run so they can be sent to the LLM gateway
|
|
@@ -325,13 +334,16 @@ async function runAgentWizard(config, session) {
|
|
|
325
334
|
/**
|
|
326
335
|
* Build the integration prompt for the agent.
|
|
327
336
|
*/
|
|
328
|
-
function buildIntegrationPrompt(config, context, frameworkContext) {
|
|
337
|
+
function buildIntegrationPrompt(config, context, frameworkContext, cloudflareReference) {
|
|
329
338
|
const additionalLines = config.prompts.getAdditionalContextLines
|
|
330
339
|
? config.prompts.getAdditionalContextLines(frameworkContext)
|
|
331
340
|
: [];
|
|
332
341
|
const additionalContext = additionalLines.length > 0
|
|
333
342
|
? '\n' + additionalLines.map((line) => `- ${line}`).join('\n')
|
|
334
343
|
: '';
|
|
344
|
+
const runtimeOverrides = cloudflareReference
|
|
345
|
+
? `\n\n---\n\n${cloudflareReference}`
|
|
346
|
+
: '';
|
|
335
347
|
return `You have access to the PostHog MCP server which provides skills to integrate PostHog into this ${config.metadata.name} project.
|
|
336
348
|
|
|
337
349
|
Project context:
|
|
@@ -364,7 +376,7 @@ STEP 5: Set up environment variables for PostHog using the wizard-tools MCP serv
|
|
|
364
376
|
- Reference these environment variables in the code files you create instead of hardcoding the public token and host.
|
|
365
377
|
|
|
366
378
|
Important: Use the detect_package_manager tool (from the wizard-tools MCP server) to determine which package manager the project uses. Do not manually search for lockfiles or config files. Always install packages as a background task. Don't await completion; proceed with other work immediately after starting the installation. You must read a file immediately before attempting to write it, even if you have previously read it; failure to do so will cause a tool failure.
|
|
367
|
-
|
|
379
|
+
${runtimeOverrides}
|
|
368
380
|
|
|
369
381
|
`;
|
|
370
382
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../../src/lib/agent-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,wCAsUC;AA1YD,yDAI4B;AAC5B,qDAAiE;AACjE,sDAI8B;AAG9B,2CAA4D;AAC5D,kDAA+C;AAC/C,8BAA8B;AAC9B,uDAS2B;AAC3B,wCAAsD;AAEtD,+CAAiC;AACjC,yDAGmC;AACnC,0CAAyE;AACzE,sDAAiE;AACjE,wDAI+B;AAC/B,6CAAiE;AAEjE;;GAEG;AACH,SAAS,gBAAgB,CAAC,OAAsB;IAC9C,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,MAAuB,EACvB,OAAsB;IAEtB,IAAA,mBAAW,GAAE,CAAC;IACd,IAAA,iBAAS,EAAC,oCAAoC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAE7E,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAA,uBAAe,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CAAC,mBAAmB,IAAI,+CACxC,GAAG,iBAAiB;;;;;8BAMjB,8BAAY,CAAC,iBACf;;;sDAIE,8BAAY,CAAC,sBACf;;;;;;;;;;;kJAYE,MAAM,CAAC,QAAQ,CAAC,IAClB;;;;;;CAMF,CAAC;AACF,CAAC","sourcesContent":["import {\n DEFAULT_PACKAGE_INSTALLATION,\n SPINNER_MESSAGE,\n type FrameworkConfig,\n} from './framework-config';\nimport { type WizardSession, OutroKind } from './wizard-session';\nimport {\n tryGetPackageJson,\n isUsingTypeScript,\n getOrAskForProjectData,\n} from '../utils/setup-utils';\nimport type { PackageDotJson } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { WIZARD_INTERACTION_EVENT_NAME } from './constants';\nimport { analytics } from '../utils/analytics';\nimport { getUI } from '../ui';\nimport {\n initializeAgent,\n runAgent,\n AgentSignals,\n AgentErrorType,\n buildWizardMetadata,\n checkAllSettingsConflicts,\n backupAndFixClaudeSettings,\n restoreClaudeSettings,\n} from './agent-interface';\nimport { getCloudUrlFromRegion } from '../utils/urls';\n\nimport * as semver from 'semver';\nimport {\n evaluateWizardReadiness,\n WizardReadiness,\n} from './health-checks/readiness';\nimport { enableDebugLogs, initLogFile, logToFile } from '../utils/debug';\nimport { createBenchmarkPipeline } from './middleware/benchmark';\nimport {\n wizardAbort,\n WizardError,\n registerCleanup,\n} from '../utils/wizard-abort';\nimport { formatScanReport, writeScanReport } from './yara-hooks';\n\n/**\n * Build a WizardOptions bag from a WizardSession (for code that still expects WizardOptions).\n */\nfunction sessionToOptions(session: WizardSession): WizardOptions {\n return {\n installDir: session.installDir,\n debug: session.debug,\n forceInstall: session.forceInstall,\n default: false,\n signup: session.signup,\n localMcp: session.localMcp,\n ci: session.ci,\n menu: session.menu,\n benchmark: session.benchmark,\n projectId: session.projectId,\n apiKey: session.apiKey,\n yaraReport: session.yaraReport,\n };\n}\n\n/**\n * Universal agent-powered wizard runner.\n * Handles the complete flow for any framework using PostHog MCP integration.\n *\n * All user decisions come from the session — no UI prompts.\n */\nexport async function runAgentWizard(\n config: FrameworkConfig,\n session: WizardSession,\n): Promise<void> {\n initLogFile();\n logToFile(`[agent-runner] START integration=${config.metadata.integration}`);\n\n if (session.debug) {\n enableDebugLogs();\n }\n\n // Version check\n if (config.detection.minimumVersion && config.detection.getInstalledVersion) {\n logToFile('[agent-runner] checking version');\n const version = await config.detection.getInstalledVersion(\n sessionToOptions(session),\n );\n if (version) {\n logToFile(\n `[agent-runner] version=${version} minimum=${config.detection.minimumVersion}`,\n );\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n const docsUrl =\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n await wizardAbort({\n message:\n `Sorry: the wizard can't help you with ${config.metadata.name} ${version}. ` +\n `Upgrade to ${config.metadata.name} ${config.detection.minimumVersion} or later, ` +\n `or check out the manual setup guide.\\n\\n` +\n `Setup ${config.metadata.name} manually: ${docsUrl}`,\n });\n }\n }\n }\n\n // Compute skills server URL (needed for agent tool calls)\n const skillsBaseUrl = session.localMcp\n ? 'http://localhost:8765'\n : 'https://github.com/PostHog/context-mill/releases/latest/download';\n\n // Check all external service health (skip if TUI already ran it in bin.ts)\n if (!session.readinessResult) {\n logToFile('[agent-runner] evaluating wizard readiness');\n const readiness = await evaluateWizardReadiness();\n logToFile(`[agent-runner] readiness=${readiness.decision}`);\n if (readiness.decision === WizardReadiness.No) {\n await getUI().showBlockingOutage(readiness);\n } else if (readiness.decision === WizardReadiness.YesWithWarnings) {\n getUI().setReadinessWarnings(readiness);\n }\n }\n\n // Check ALL settings sources for blocking overrides before login.\n const settingsConflicts = checkAllSettingsConflicts(session.installDir);\n logToFile(\n `[agent-runner] settings conflicts: ${\n settingsConflicts.length > 0\n ? settingsConflicts\n .map((c) => `${c.source}(${c.keys.join(',')})`)\n .join('; ')\n : 'none'\n }`,\n );\n\n if (settingsConflicts.length > 0) {\n // Capture analytics for each conflict variation\n for (const conflict of settingsConflicts) {\n const level = conflict.source === 'managed' ? 'org' : conflict.source;\n analytics.wizardCapture('settings conflict detected', {\n level,\n keys: conflict.keys,\n });\n }\n\n await getUI().showSettingsOverride(settingsConflicts, () =>\n backupAndFixClaudeSettings(session.installDir),\n );\n logToFile('[agent-runner] settings override resolved');\n }\n\n const typeScriptDetected = isUsingTypeScript({\n installDir: session.installDir,\n });\n session.typescript = typeScriptDetected;\n\n // Framework detection and version\n const usesPackageJson = config.detection.usesPackageJson !== false;\n let packageJson: PackageDotJson | null = null;\n let frameworkVersion: string | undefined;\n\n if (usesPackageJson) {\n packageJson = await tryGetPackageJson({ installDir: session.installDir });\n if (packageJson) {\n const { hasPackageInstalled } = await import('../utils/package-json.js');\n if (!hasPackageInstalled(config.detection.packageName, packageJson)) {\n getUI().log.warn(\n `${config.detection.packageDisplayName} does not seem to be installed. Continuing anyway — the agent will handle it.`,\n );\n }\n frameworkVersion = config.detection.getVersion(packageJson);\n } else {\n getUI().log.warn(\n 'Could not find package.json. Continuing anyway — the agent will handle it.',\n );\n }\n } else {\n frameworkVersion = config.detection.getVersion(null);\n }\n\n // Set analytics tags for framework version\n if (frameworkVersion && config.detection.getVersionBucket) {\n const versionBucket = config.detection.getVersionBucket(frameworkVersion);\n analytics.setTag(`${config.metadata.integration}-version`, versionBucket);\n }\n\n analytics.wizardCapture('agent started', {\n integration: config.metadata.integration,\n });\n\n // Get PostHog credentials (region auto-detected from token)\n logToFile('[agent-runner] starting OAuth');\n const { projectApiKey, host, accessToken, projectId, cloudRegion } =\n await getOrAskForProjectData({\n signup: session.signup,\n ci: session.ci,\n apiKey: session.apiKey,\n projectId: session.projectId,\n });\n\n session.credentials = { accessToken, projectApiKey, host, projectId };\n\n // Notify TUI that credentials are available (resolves past AuthScreen)\n getUI().setCredentials(session.credentials);\n\n // Framework context was already gathered by SetupScreen + detection\n const frameworkContext = session.frameworkContext;\n\n // Set analytics tags from framework context\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n const integrationPrompt = buildIntegrationPrompt(\n config,\n {\n frameworkVersion: frameworkVersion || 'latest',\n typescript: typeScriptDetected,\n projectApiKey,\n host,\n projectId,\n },\n frameworkContext,\n );\n\n // Initialize and run agent\n const spinner = getUI().spinner();\n\n // Evaluate all feature flags at the start of the run so they can be sent to the LLM gateway\n const wizardFlags = await analytics.getAllFlagsForWizard();\n const wizardMetadata = buildWizardMetadata(wizardFlags);\n\n // Determine MCP URL: CLI flag > env var > production default\n const mcpUrl = session.localMcp\n ? 'http://localhost:8787/mcp'\n : process.env.MCP_URL ||\n (cloudRegion === 'eu'\n ? 'https://mcp-eu.posthog.com/mcp'\n : 'https://mcp.posthog.com/mcp');\n\n const restoreSettings = () => restoreClaudeSettings(session.installDir);\n getUI().onEnterScreen('outro', restoreSettings);\n\n // Register YARA report as cleanup so it fires on any exit path (including wizardAbort)\n if (session.yaraReport) {\n registerCleanup(() => {\n const reportPath = writeScanReport();\n if (reportPath) {\n const summary = formatScanReport();\n getUI().log.info(`YARA scan report: ${reportPath}${summary ?? ''}`);\n }\n });\n }\n\n getUI().startRun();\n\n const agent = await initializeAgent(\n {\n workingDirectory: session.installDir,\n posthogMcpUrl: mcpUrl,\n posthogApiKey: accessToken,\n posthogApiHost: host,\n additionalMcpServers: config.metadata.additionalMcpServers,\n detectPackageManager: config.detection.detectPackageManager,\n skillsBaseUrl,\n wizardFlags,\n wizardMetadata,\n },\n sessionToOptions(session),\n );\n\n const middleware = session.benchmark\n ? createBenchmarkPipeline(spinner, sessionToOptions(session))\n : undefined;\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n sessionToOptions(session),\n spinner,\n {\n estimatedDurationMinutes: config.ui.estimatedDurationMinutes,\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n additionalFeatureQueue: session.additionalFeatureQueue,\n },\n middleware,\n );\n\n // Handle error cases detected in agent output\n if (agentResult.error === AgentErrorType.MCP_MISSING) {\n await wizardAbort({\n message: `Could not access the PostHog MCP server\\n\\nThe wizard was unable to connect to the PostHog MCP server.\\nThis could be due to a network issue or a configuration problem.\\n\\nPlease try again, or set up ${config.metadata.name} manually by following our documentation:\\n${config.metadata.docsUrl}`,\n error: new WizardError('Agent could not access PostHog MCP server', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.MCP_MISSING,\n signal: AgentSignals.ERROR_MCP_MISSING,\n }),\n });\n }\n\n if (agentResult.error === AgentErrorType.RESOURCE_MISSING) {\n await wizardAbort({\n message: `Could not access the setup resource\\n\\nThe wizard could not access the setup resource. This may indicate a version mismatch or a temporary service issue.\\n\\nPlease try again, or set up ${config.metadata.name} manually by following our documentation:\\n${config.metadata.docsUrl}`,\n error: new WizardError('Agent could not access setup resource', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.RESOURCE_MISSING,\n signal: AgentSignals.ERROR_RESOURCE_MISSING,\n }),\n });\n }\n\n if (agentResult.error === AgentErrorType.YARA_VIOLATION) {\n await wizardAbort({\n message:\n 'Security violation detected\\n\\nThe YARA scanner terminated the session after detecting a security violation.\\nThis may indicate prompt injection, poisoned skill files, or a policy breach.\\n\\nPlease report this to: wizard@posthog.com',\n error: new WizardError('YARA scanner terminated session', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.YARA_VIOLATION,\n }),\n });\n }\n\n if (\n agentResult.error === AgentErrorType.RATE_LIMIT ||\n agentResult.error === AgentErrorType.API_ERROR\n ) {\n analytics.wizardCapture('agent api error', {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n error_message: agentResult.message,\n });\n\n await wizardAbort({\n message: `API Error\\n\\n${\n agentResult.message || 'Unknown error'\n }\\n\\nPlease report this error to: wizard@posthog.com`,\n error: new WizardError(`API error: ${agentResult.message}`, {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n }),\n });\n }\n\n // Build environment variables from OAuth credentials\n const envVars = config.environment.getEnvVars(projectApiKey, host);\n\n // Upload environment variables to hosting providers (auto-accept)\n let uploadedEnvVars: string[] = [];\n if (config.environment.uploadToHosting) {\n const { uploadEnvironmentVariablesStep } = await import(\n '../steps/index.js'\n );\n uploadedEnvVars = await uploadEnvironmentVariablesStep(envVars, {\n integration: config.metadata.integration,\n session,\n });\n if (uploadedEnvVars.length > 0) {\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'wizard_env_vars_uploaded',\n integration: config.metadata.integration,\n variable_count: uploadedEnvVars.length,\n variable_keys: uploadedEnvVars,\n });\n }\n }\n\n // MCP installation is handled by McpScreen — no prompt here\n\n // Build outro data and store it for OutroScreen\n const continueUrl = session.signup\n ? `${getCloudUrlFromRegion(cloudRegion)}/products?source=wizard`\n : undefined;\n\n const changes = [\n ...config.ui.getOutroChanges(frameworkContext),\n Object.keys(envVars).length > 0\n ? `Added environment variables to .env file`\n : '',\n uploadedEnvVars.length > 0\n ? `Uploaded environment variables to your hosting provider`\n : '',\n ].filter(Boolean);\n\n session.outroData = {\n kind: OutroKind.Success,\n changes,\n docsUrl: config.metadata.docsUrl,\n continueUrl,\n };\n\n getUI().outro(`Successfully installed PostHog!`);\n\n await analytics.shutdown('success');\n}\n\n/**\n * Build the integration prompt for the agent.\n */\nfunction buildIntegrationPrompt(\n config: FrameworkConfig,\n context: {\n frameworkVersion: string;\n typescript: boolean;\n projectApiKey: string;\n host: string;\n projectId: number;\n },\n frameworkContext: Record<string, unknown>,\n): string {\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n\n const additionalContext =\n additionalLines.length > 0\n ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n')\n : '';\n\n return `You have access to the PostHog MCP server which provides skills to integrate PostHog into this ${\n config.metadata.name\n } project.\n\nProject context:\n- PostHog Project ID: ${context.projectId}\n- Framework: ${config.metadata.name} ${context.frameworkVersion}\n- TypeScript: ${context.typescript ? 'Yes' : 'No'}\n- PostHog public token: ${context.projectApiKey}\n- PostHog Host: ${context.host}\n- Project type: ${config.prompts.projectTypeDetection}\n- Package installation: ${\n config.prompts.packageInstallation ?? DEFAULT_PACKAGE_INSTALLATION\n }${additionalContext}\n\nInstructions (follow these steps IN ORDER - do not skip or reorder):\n\nSTEP 1: Call load_skill_menu (from the wizard-tools MCP server) to see available skills.\n If the tool fails, emit: ${\n AgentSignals.ERROR_MCP_MISSING\n } Could not load skill menu and halt.\n\n Choose a skill from the \\`integration\\` category that matches this project's framework. Do NOT pick skills from other categories (llm-analytics, error-tracking, feature-flags, omnibus, etc.) — those are handled separately.\n If no suitable integration skill is found, emit: ${\n AgentSignals.ERROR_RESOURCE_MISSING\n } Could not find a suitable skill for this project.\n\nSTEP 2: Call install_skill (from the wizard-tools MCP server) with the chosen skill ID (e.g., \"integration-nextjs-app-router\").\n Do NOT run any shell commands to install skills.\n\nSTEP 3: Load the installed skill's SKILL.md file to understand what references are available.\n\nSTEP 4: Follow the skill's workflow files in sequence. Look for numbered workflow files in the references (e.g., files with patterns like \"1.0-\", \"1.1-\", \"1.2-\"). Start with the first one and proceed through each step until completion. Each workflow file will tell you what to do and which file comes next. Never directly write PostHog tokens directly to code files; always use environment variables.\n\nSTEP 5: Set up environment variables for PostHog using the wizard-tools MCP server (this runs locally — secret values never leave the machine):\n - Use check_env_keys to see which keys already exist in the project's .env file (e.g. .env.local or .env).\n - Use set_env_values to create or update the PostHog public token and host, using the appropriate environment variable naming convention for ${\n config.metadata.name\n }, which you'll find in example code. The tool will also ensure .gitignore coverage. Don't assume the presence of keys means the value is up to date. Write the correct value each time.\n - Reference these environment variables in the code files you create instead of hardcoding the public token and host.\n\nImportant: Use the detect_package_manager tool (from the wizard-tools MCP server) to determine which package manager the project uses. Do not manually search for lockfiles or config files. Always install packages as a background task. Don't await completion; proceed with other work immediately after starting the installation. You must read a file immediately before attempting to write it, even if you have previously read it; failure to do so will cause a tool failure.\n\n\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agent-runner.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AAC;IAEP,OAAO,kGACL,MAAM,CAAC,QAAQ,CAAC,IAClB;;;wBAGsB,OAAO,CAAC,SAAS;eAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,gBAAgB;gBAC/C,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;0BACvB,OAAO,CAAC,aAAa;kBAC7B,OAAO,CAAC,IAAI;kBACZ,MAAM,CAAC,OAAO,CAAC,oBAAoB;0BAEjD,MAAM,CAAC,OAAO,CAAC,mBAAmB,IAAI,+CACxC,GAAG,iBAAiB;;;;;8BAMjB,8BAAY,CAAC,iBACf;;;sDAIE,8BAAY,CAAC,sBACf;;;;;;;;;;;kJAYE,MAAM,CAAC,QAAQ,CAAC,IAClB;;;;EAID,gBAAgB;;CAEjB,CAAC;AACF,CAAC","sourcesContent":["import {\n DEFAULT_PACKAGE_INSTALLATION,\n SPINNER_MESSAGE,\n type FrameworkConfig,\n} from './framework-config';\nimport { type WizardSession, OutroKind } from './wizard-session';\nimport {\n tryGetPackageJson,\n isUsingTypeScript,\n getOrAskForProjectData,\n} from '../utils/setup-utils';\nimport type { PackageDotJson } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { WIZARD_INTERACTION_EVENT_NAME } from './constants';\nimport { analytics } from '../utils/analytics';\nimport { getUI } from '../ui';\nimport {\n initializeAgent,\n runAgent,\n AgentSignals,\n AgentErrorType,\n buildWizardMetadata,\n checkAllSettingsConflicts,\n backupAndFixClaudeSettings,\n restoreClaudeSettings,\n} from './agent-interface';\nimport { getCloudUrlFromRegion } from '../utils/urls';\n\nimport * as semver from 'semver';\nimport {\n evaluateWizardReadiness,\n WizardReadiness,\n} from './health-checks/readiness';\nimport { enableDebugLogs, initLogFile, logToFile } from '../utils/debug';\nimport { createBenchmarkPipeline } from './middleware/benchmark';\nimport {\n wizardAbort,\n WizardError,\n registerCleanup,\n} from '../utils/wizard-abort';\nimport { formatScanReport, writeScanReport } from './yara-hooks';\nimport {\n detectCloudflareTarget,\n fetchCloudflareReference,\n} from './cloudflare-detection';\n\n/**\n * Build a WizardOptions bag from a WizardSession (for code that still expects WizardOptions).\n */\nfunction sessionToOptions(session: WizardSession): WizardOptions {\n return {\n installDir: session.installDir,\n debug: session.debug,\n forceInstall: session.forceInstall,\n default: false,\n signup: session.signup,\n localMcp: session.localMcp,\n ci: session.ci,\n menu: session.menu,\n benchmark: session.benchmark,\n projectId: session.projectId,\n apiKey: session.apiKey,\n yaraReport: session.yaraReport,\n };\n}\n\n/**\n * Universal agent-powered wizard runner.\n * Handles the complete flow for any framework using PostHog MCP integration.\n *\n * All user decisions come from the session — no UI prompts.\n */\nexport async function runAgentWizard(\n config: FrameworkConfig,\n session: WizardSession,\n): Promise<void> {\n initLogFile();\n logToFile(`[agent-runner] START integration=${config.metadata.integration}`);\n\n if (session.debug) {\n enableDebugLogs();\n }\n\n // Version check\n if (config.detection.minimumVersion && config.detection.getInstalledVersion) {\n logToFile('[agent-runner] checking version');\n const version = await config.detection.getInstalledVersion(\n sessionToOptions(session),\n );\n if (version) {\n logToFile(\n `[agent-runner] version=${version} minimum=${config.detection.minimumVersion}`,\n );\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n const docsUrl =\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n await wizardAbort({\n message:\n `Sorry: the wizard can't help you with ${config.metadata.name} ${version}. ` +\n `Upgrade to ${config.metadata.name} ${config.detection.minimumVersion} or later, ` +\n `or check out the manual setup guide.\\n\\n` +\n `Setup ${config.metadata.name} manually: ${docsUrl}`,\n });\n }\n }\n }\n\n // Compute skills server URL (needed for agent tool calls)\n const skillsBaseUrl = session.localMcp\n ? 'http://localhost:8765'\n : 'https://github.com/PostHog/context-mill/releases/latest/download';\n\n // Check all external service health (skip if TUI already ran it in bin.ts)\n if (!session.readinessResult) {\n logToFile('[agent-runner] evaluating wizard readiness');\n const readiness = await evaluateWizardReadiness();\n logToFile(`[agent-runner] readiness=${readiness.decision}`);\n if (readiness.decision === WizardReadiness.No) {\n await getUI().showBlockingOutage(readiness);\n } else if (readiness.decision === WizardReadiness.YesWithWarnings) {\n getUI().setReadinessWarnings(readiness);\n }\n }\n\n // Check ALL settings sources for blocking overrides before login.\n const settingsConflicts = checkAllSettingsConflicts(session.installDir);\n logToFile(\n `[agent-runner] settings conflicts: ${\n settingsConflicts.length > 0\n ? settingsConflicts\n .map((c) => `${c.source}(${c.keys.join(',')})`)\n .join('; ')\n : 'none'\n }`,\n );\n\n if (settingsConflicts.length > 0) {\n // Capture analytics for each conflict variation\n for (const conflict of settingsConflicts) {\n const level = conflict.source === 'managed' ? 'org' : conflict.source;\n analytics.wizardCapture('settings conflict detected', {\n level,\n keys: conflict.keys,\n });\n }\n\n await getUI().showSettingsOverride(settingsConflicts, () =>\n backupAndFixClaudeSettings(session.installDir),\n );\n logToFile('[agent-runner] settings override resolved');\n }\n\n const typeScriptDetected = isUsingTypeScript({\n installDir: session.installDir,\n });\n session.typescript = typeScriptDetected;\n\n // Framework detection and version\n const usesPackageJson = config.detection.usesPackageJson !== false;\n let packageJson: PackageDotJson | null = null;\n let frameworkVersion: string | undefined;\n\n if (usesPackageJson) {\n packageJson = await tryGetPackageJson({ installDir: session.installDir });\n if (packageJson) {\n const { hasPackageInstalled } = await import('../utils/package-json.js');\n if (!hasPackageInstalled(config.detection.packageName, packageJson)) {\n getUI().log.warn(\n `${config.detection.packageDisplayName} does not seem to be installed. Continuing anyway — the agent will handle it.`,\n );\n }\n frameworkVersion = config.detection.getVersion(packageJson);\n } else {\n getUI().log.warn(\n 'Could not find package.json. Continuing anyway — the agent will handle it.',\n );\n }\n } else {\n frameworkVersion = config.detection.getVersion(null);\n }\n\n // Set analytics tags for framework version\n if (frameworkVersion && config.detection.getVersionBucket) {\n const versionBucket = config.detection.getVersionBucket(frameworkVersion);\n analytics.setTag(`${config.metadata.integration}-version`, versionBucket);\n }\n\n analytics.wizardCapture('agent started', {\n integration: config.metadata.integration,\n });\n\n // Get PostHog credentials (region auto-detected from token)\n logToFile('[agent-runner] starting OAuth');\n const { projectApiKey, host, accessToken, projectId, cloudRegion } =\n await getOrAskForProjectData({\n signup: session.signup,\n ci: session.ci,\n apiKey: session.apiKey,\n projectId: session.projectId,\n });\n\n session.credentials = { accessToken, projectApiKey, host, projectId };\n\n // Notify TUI that credentials are available (resolves past AuthScreen)\n getUI().setCredentials(session.credentials);\n\n // Framework context was already gathered by SetupScreen + detection\n const frameworkContext = session.frameworkContext;\n\n // Set analytics tags from framework context\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n // Detect Cloudflare Workers target and fetch runtime reference if needed\n const isCloudflare = await detectCloudflareTarget(session.installDir);\n let cloudflareReference: string | null = null;\n if (isCloudflare) {\n logToFile('[agent-runner] Cloudflare Workers target detected');\n analytics.setTag('cloudflare', 'true');\n cloudflareReference = await fetchCloudflareReference(skillsBaseUrl);\n }\n\n const integrationPrompt = buildIntegrationPrompt(\n config,\n {\n frameworkVersion: frameworkVersion || 'latest',\n typescript: typeScriptDetected,\n projectApiKey,\n host,\n projectId,\n },\n frameworkContext,\n cloudflareReference,\n );\n\n // Initialize and run agent\n const spinner = getUI().spinner();\n\n // Evaluate all feature flags at the start of the run so they can be sent to the LLM gateway\n const wizardFlags = await analytics.getAllFlagsForWizard();\n const wizardMetadata = buildWizardMetadata(wizardFlags);\n\n // Determine MCP URL: CLI flag > env var > production default\n const mcpUrl = session.localMcp\n ? 'http://localhost:8787/mcp'\n : process.env.MCP_URL ||\n (cloudRegion === 'eu'\n ? 'https://mcp-eu.posthog.com/mcp'\n : 'https://mcp.posthog.com/mcp');\n\n const restoreSettings = () => restoreClaudeSettings(session.installDir);\n getUI().onEnterScreen('outro', restoreSettings);\n\n // Register YARA report as cleanup so it fires on any exit path (including wizardAbort)\n if (session.yaraReport) {\n registerCleanup(() => {\n const reportPath = writeScanReport();\n if (reportPath) {\n const summary = formatScanReport();\n getUI().log.info(`YARA scan report: ${reportPath}${summary ?? ''}`);\n }\n });\n }\n\n getUI().startRun();\n\n const agent = await initializeAgent(\n {\n workingDirectory: session.installDir,\n posthogMcpUrl: mcpUrl,\n posthogApiKey: accessToken,\n posthogApiHost: host,\n additionalMcpServers: config.metadata.additionalMcpServers,\n detectPackageManager: config.detection.detectPackageManager,\n skillsBaseUrl,\n wizardFlags,\n wizardMetadata,\n },\n sessionToOptions(session),\n );\n\n const middleware = session.benchmark\n ? createBenchmarkPipeline(spinner, sessionToOptions(session))\n : undefined;\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n sessionToOptions(session),\n spinner,\n {\n estimatedDurationMinutes: config.ui.estimatedDurationMinutes,\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n additionalFeatureQueue: session.additionalFeatureQueue,\n },\n middleware,\n );\n\n // Handle error cases detected in agent output\n if (agentResult.error === AgentErrorType.MCP_MISSING) {\n await wizardAbort({\n message: `Could not access the PostHog MCP server\\n\\nThe wizard was unable to connect to the PostHog MCP server.\\nThis could be due to a network issue or a configuration problem.\\n\\nPlease try again, or set up ${config.metadata.name} manually by following our documentation:\\n${config.metadata.docsUrl}`,\n error: new WizardError('Agent could not access PostHog MCP server', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.MCP_MISSING,\n signal: AgentSignals.ERROR_MCP_MISSING,\n }),\n });\n }\n\n if (agentResult.error === AgentErrorType.RESOURCE_MISSING) {\n await wizardAbort({\n message: `Could not access the setup resource\\n\\nThe wizard could not access the setup resource. This may indicate a version mismatch or a temporary service issue.\\n\\nPlease try again, or set up ${config.metadata.name} manually by following our documentation:\\n${config.metadata.docsUrl}`,\n error: new WizardError('Agent could not access setup resource', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.RESOURCE_MISSING,\n signal: AgentSignals.ERROR_RESOURCE_MISSING,\n }),\n });\n }\n\n if (agentResult.error === AgentErrorType.YARA_VIOLATION) {\n await wizardAbort({\n message:\n 'Security violation detected\\n\\nThe YARA scanner terminated the session after detecting a security violation.\\nThis may indicate prompt injection, poisoned skill files, or a policy breach.\\n\\nPlease report this to: wizard@posthog.com',\n error: new WizardError('YARA scanner terminated session', {\n integration: config.metadata.integration,\n error_type: AgentErrorType.YARA_VIOLATION,\n }),\n });\n }\n\n if (\n agentResult.error === AgentErrorType.RATE_LIMIT ||\n agentResult.error === AgentErrorType.API_ERROR\n ) {\n analytics.wizardCapture('agent api error', {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n error_message: agentResult.message,\n });\n\n await wizardAbort({\n message: `API Error\\n\\n${\n agentResult.message || 'Unknown error'\n }\\n\\nPlease report this error to: wizard@posthog.com`,\n error: new WizardError(`API error: ${agentResult.message}`, {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n }),\n });\n }\n\n // Build environment variables from OAuth credentials\n const envVars = config.environment.getEnvVars(projectApiKey, host);\n\n // Upload environment variables to hosting providers (auto-accept)\n let uploadedEnvVars: string[] = [];\n if (config.environment.uploadToHosting) {\n const { uploadEnvironmentVariablesStep } = await import(\n '../steps/index.js'\n );\n uploadedEnvVars = await uploadEnvironmentVariablesStep(envVars, {\n integration: config.metadata.integration,\n session,\n });\n if (uploadedEnvVars.length > 0) {\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'wizard_env_vars_uploaded',\n integration: config.metadata.integration,\n variable_count: uploadedEnvVars.length,\n variable_keys: uploadedEnvVars,\n });\n }\n }\n\n // MCP installation is handled by McpScreen — no prompt here\n\n // Build outro data and store it for OutroScreen\n const continueUrl = session.signup\n ? `${getCloudUrlFromRegion(cloudRegion)}/products?source=wizard`\n : undefined;\n\n const changes = [\n ...config.ui.getOutroChanges(frameworkContext),\n Object.keys(envVars).length > 0\n ? `Added environment variables to .env file`\n : '',\n uploadedEnvVars.length > 0\n ? `Uploaded environment variables to your hosting provider`\n : '',\n ].filter(Boolean);\n\n session.outroData = {\n kind: OutroKind.Success,\n changes,\n docsUrl: config.metadata.docsUrl,\n continueUrl,\n };\n\n getUI().outro(`Successfully installed PostHog!`);\n\n await analytics.shutdown('success');\n}\n\n/**\n * Build the integration prompt for the agent.\n */\nfunction buildIntegrationPrompt(\n config: FrameworkConfig,\n context: {\n frameworkVersion: string;\n typescript: boolean;\n projectApiKey: string;\n host: string;\n projectId: number;\n },\n frameworkContext: Record<string, unknown>,\n cloudflareReference?: string | null,\n): string {\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n\n const additionalContext =\n additionalLines.length > 0\n ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n')\n : '';\n\n const runtimeOverrides = cloudflareReference\n ? `\\n\\n---\\n\\n${cloudflareReference}`\n : '';\n\n return `You have access to the PostHog MCP server which provides skills to integrate PostHog into this ${\n config.metadata.name\n } project.\n\nProject context:\n- PostHog Project ID: ${context.projectId}\n- Framework: ${config.metadata.name} ${context.frameworkVersion}\n- TypeScript: ${context.typescript ? 'Yes' : 'No'}\n- PostHog public token: ${context.projectApiKey}\n- PostHog Host: ${context.host}\n- Project type: ${config.prompts.projectTypeDetection}\n- Package installation: ${\n config.prompts.packageInstallation ?? DEFAULT_PACKAGE_INSTALLATION\n }${additionalContext}\n\nInstructions (follow these steps IN ORDER - do not skip or reorder):\n\nSTEP 1: Call load_skill_menu (from the wizard-tools MCP server) to see available skills.\n If the tool fails, emit: ${\n AgentSignals.ERROR_MCP_MISSING\n } Could not load skill menu and halt.\n\n Choose a skill from the \\`integration\\` category that matches this project's framework. Do NOT pick skills from other categories (llm-analytics, error-tracking, feature-flags, omnibus, etc.) — those are handled separately.\n If no suitable integration skill is found, emit: ${\n AgentSignals.ERROR_RESOURCE_MISSING\n } Could not find a suitable skill for this project.\n\nSTEP 2: Call install_skill (from the wizard-tools MCP server) with the chosen skill ID (e.g., \"integration-nextjs-app-router\").\n Do NOT run any shell commands to install skills.\n\nSTEP 3: Load the installed skill's SKILL.md file to understand what references are available.\n\nSTEP 4: Follow the skill's workflow files in sequence. Look for numbered workflow files in the references (e.g., files with patterns like \"1.0-\", \"1.1-\", \"1.2-\"). Start with the first one and proceed through each step until completion. Each workflow file will tell you what to do and which file comes next. Never directly write PostHog tokens directly to code files; always use environment variables.\n\nSTEP 5: Set up environment variables for PostHog using the wizard-tools MCP server (this runs locally — secret values never leave the machine):\n - Use check_env_keys to see which keys already exist in the project's .env file (e.g. .env.local or .env).\n - Use set_env_values to create or update the PostHog public token and host, using the appropriate environment variable naming convention for ${\n config.metadata.name\n }, which you'll find in example code. The tool will also ensure .gitignore coverage. Don't assume the presence of keys means the value is up to date. Write the correct value each time.\n - Reference these environment variables in the code files you create instead of hardcoding the public token and host.\n\nImportant: Use the detect_package_manager tool (from the wizard-tools MCP server) to determine which package manager the project uses. Do not manually search for lockfiles or config files. Always install packages as a background task. Don't await completion; proceed with other work immediately after starting the installation. You must read a file immediately before attempting to write it, even if you have previously read it; failure to do so will cause a tool failure.\n${runtimeOverrides}\n\n`;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect whether the project targets Cloudflare Workers.
|
|
3
|
+
*
|
|
4
|
+
* Checks for:
|
|
5
|
+
* 1. wrangler.toml / wrangler.jsonc / wrangler.json in project root
|
|
6
|
+
* 2. Cloudflare adapter packages in dependencies (@react-router/cloudflare,
|
|
7
|
+
* @astrojs/cloudflare, @sveltejs/adapter-cloudflare, etc.)
|
|
8
|
+
*/
|
|
9
|
+
export declare function detectCloudflareTarget(installDir: string): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch the Cloudflare Workers reference from the skills server.
|
|
12
|
+
* Returns the markdown content, or null on failure.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchCloudflareReference(skillsBaseUrl: string): Promise<string | null>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.detectCloudflareTarget = detectCloudflareTarget;
|
|
7
|
+
exports.fetchCloudflareReference = fetchCloudflareReference;
|
|
8
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
9
|
+
const debug_1 = require("../utils/debug");
|
|
10
|
+
const setup_utils_1 = require("../utils/setup-utils");
|
|
11
|
+
const CLOUDFLARE_PACKAGES = [
|
|
12
|
+
'@react-router/cloudflare',
|
|
13
|
+
'@astrojs/cloudflare',
|
|
14
|
+
'@sveltejs/adapter-cloudflare',
|
|
15
|
+
'@sveltejs/adapter-cloudflare-workers',
|
|
16
|
+
'@cloudflare/workers-types',
|
|
17
|
+
'wrangler',
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Detect whether the project targets Cloudflare Workers.
|
|
21
|
+
*
|
|
22
|
+
* Checks for:
|
|
23
|
+
* 1. wrangler.toml / wrangler.jsonc / wrangler.json in project root
|
|
24
|
+
* 2. Cloudflare adapter packages in dependencies (@react-router/cloudflare,
|
|
25
|
+
* @astrojs/cloudflare, @sveltejs/adapter-cloudflare, etc.)
|
|
26
|
+
*/
|
|
27
|
+
async function detectCloudflareTarget(installDir) {
|
|
28
|
+
// Check for wrangler config files
|
|
29
|
+
const wranglerFiles = await (0, fast_glob_1.default)('wrangler.@(toml|jsonc|json)', {
|
|
30
|
+
cwd: installDir,
|
|
31
|
+
dot: true,
|
|
32
|
+
});
|
|
33
|
+
if (wranglerFiles.length > 0) {
|
|
34
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] detected via wrangler config: ${wranglerFiles[0]}`);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Check for Cloudflare adapter/platform packages in deps
|
|
38
|
+
const packageJson = await (0, setup_utils_1.tryGetPackageJson)({ installDir });
|
|
39
|
+
if (!packageJson)
|
|
40
|
+
return false;
|
|
41
|
+
const allDeps = {
|
|
42
|
+
...packageJson.dependencies,
|
|
43
|
+
...packageJson.devDependencies,
|
|
44
|
+
};
|
|
45
|
+
const cloudflarePackages = Object.keys(allDeps).filter((dep) => CLOUDFLARE_PACKAGES.includes(dep));
|
|
46
|
+
if (cloudflarePackages.length > 0) {
|
|
47
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] detected via packages: ${cloudflarePackages.join(', ')}`);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Fetch the Cloudflare Workers reference from the skills server.
|
|
54
|
+
* Returns the markdown content, or null on failure.
|
|
55
|
+
*/
|
|
56
|
+
async function fetchCloudflareReference(skillsBaseUrl) {
|
|
57
|
+
try {
|
|
58
|
+
const url = `${skillsBaseUrl}/cloudflare-workers.md`;
|
|
59
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] fetching reference from ${url}`);
|
|
60
|
+
const resp = await fetch(url);
|
|
61
|
+
if (resp.ok) {
|
|
62
|
+
const text = await resp.text();
|
|
63
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] loaded reference (${text.length} chars)`);
|
|
64
|
+
return text;
|
|
65
|
+
}
|
|
66
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] reference fetch failed: HTTP ${resp.status}`);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
(0, debug_1.logToFile)(`[cloudflare-detection] reference fetch error: ${err.message}`);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=cloudflare-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-detection.js","sourceRoot":"","sources":["../../../src/lib/cloudflare-detection.ts"],"names":[],"mappings":";;;;;AAqBA,wDAsCC;AAMD,4D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C;QACH,MAAM,GAAG,GAAG,GAAG,aAAa,wBAAwB,CAAC;QACrD,IAAA,iBAAS,EAAC,kDAAkD,GAAG,EAAE,CAAC,CAAC;QACnE,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,IAAA,iBAAS,EACP,4CAA4C,IAAI,CAAC,MAAM,SAAS,CACjE,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAA,iBAAS,EACP,uDAAuD,IAAI,CAAC,MAAM,EAAE,CACrE,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAA,iBAAS,EAAC,iDAAiD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import fg from 'fast-glob';\nimport { logToFile } from '../utils/debug';\nimport { tryGetPackageJson } from '../utils/setup-utils';\n\nconst CLOUDFLARE_PACKAGES = [\n '@react-router/cloudflare',\n '@astrojs/cloudflare',\n '@sveltejs/adapter-cloudflare',\n '@sveltejs/adapter-cloudflare-workers',\n '@cloudflare/workers-types',\n 'wrangler',\n];\n\n/**\n * Detect whether the project targets Cloudflare Workers.\n *\n * Checks for:\n * 1. wrangler.toml / wrangler.jsonc / wrangler.json in project root\n * 2. Cloudflare adapter packages in dependencies (@react-router/cloudflare,\n * @astrojs/cloudflare, @sveltejs/adapter-cloudflare, etc.)\n */\nexport async function detectCloudflareTarget(\n installDir: string,\n): Promise<boolean> {\n // Check for wrangler config files\n const wranglerFiles = await fg('wrangler.@(toml|jsonc|json)', {\n cwd: installDir,\n dot: true,\n });\n if (wranglerFiles.length > 0) {\n logToFile(\n `[cloudflare-detection] detected via wrangler config: ${wranglerFiles[0]}`,\n );\n return true;\n }\n\n // Check for Cloudflare adapter/platform packages in deps\n const packageJson = await tryGetPackageJson({ installDir });\n if (!packageJson) return false;\n\n const allDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n const cloudflarePackages = Object.keys(allDeps).filter((dep) =>\n CLOUDFLARE_PACKAGES.includes(dep),\n );\n\n if (cloudflarePackages.length > 0) {\n logToFile(\n `[cloudflare-detection] detected via packages: ${cloudflarePackages.join(\n ', ',\n )}`,\n );\n return true;\n }\n\n return false;\n}\n\n/**\n * Fetch the Cloudflare Workers reference from the skills server.\n * Returns the markdown content, or null on failure.\n */\nexport async function fetchCloudflareReference(\n skillsBaseUrl: string,\n): Promise<string | null> {\n try {\n const url = `${skillsBaseUrl}/cloudflare-workers.md`;\n logToFile(`[cloudflare-detection] fetching reference from ${url}`);\n const resp = await fetch(url);\n if (resp.ok) {\n const text = await resp.text();\n logToFile(\n `[cloudflare-detection] loaded reference (${text.length} chars)`,\n );\n return text;\n }\n logToFile(\n `[cloudflare-detection] reference fetch failed: HTTP ${resp.status}`,\n );\n return null;\n } catch (err: any) {\n logToFile(`[cloudflare-detection] reference fetch error: ${err.message}`);\n return null;\n }\n}\n"]}
|
|
@@ -36,6 +36,7 @@ export declare const DEBUG = false;
|
|
|
36
36
|
export declare const DEFAULT_URL: string;
|
|
37
37
|
export declare const DEFAULT_HOST_URL: string;
|
|
38
38
|
export declare const ISSUES_URL = "https://github.com/posthog/wizard/issues";
|
|
39
|
+
export declare const CONTEXT_MILL_URL = "https://github.com/PostHog/context-mill";
|
|
39
40
|
export declare const ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = "sTMFPsFhdP1Ssg";
|
|
40
41
|
export declare const ANALYTICS_HOST_URL = "https://internal-j.posthog.com";
|
|
41
42
|
export declare const ANALYTICS_TEAM_TAG = "docs-and-wizard";
|
|
@@ -53,10 +54,12 @@ export declare const WIZARD_VARIANT_FLAG_KEY = "wizard-variant";
|
|
|
53
54
|
/** Variant key -> metadata for wizard run (VARIANT flag selects which entry to use). */
|
|
54
55
|
export declare const WIZARD_VARIANTS: Record<string, Record<string, string>>;
|
|
55
56
|
/** User-Agent for wizard HTTP requests and MCP server identification. */
|
|
56
|
-
export declare const WIZARD_USER_AGENT = "posthog/wizard; version: 2.
|
|
57
|
+
export declare const WIZARD_USER_AGENT = "posthog/wizard; version: 2.7.0";
|
|
57
58
|
/** Header prefix for PostHog properties (e.g. X-POSTHOG-PROPERTY-VARIANT). */
|
|
58
59
|
export declare const POSTHOG_PROPERTY_HEADER_PREFIX = "X-POSTHOG-PROPERTY-";
|
|
59
60
|
/** Header prefix for PostHog feature flags. */
|
|
60
61
|
export declare const POSTHOG_FLAG_HEADER_PREFIX = "X-POSTHOG-FLAG-";
|
|
61
62
|
/** Timeout for framework / project detection probes (ms). */
|
|
62
63
|
export declare const DETECTION_TIMEOUT_MS = 10000;
|
|
64
|
+
/** Timeout for the OAuth authorization flow (ms). */
|
|
65
|
+
export declare const OAUTH_TIMEOUT_MS = 360000;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Shared constants for the PostHog wizard.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DETECTION_TIMEOUT_MS = exports.POSTHOG_FLAG_HEADER_PREFIX = exports.POSTHOG_PROPERTY_HEADER_PREFIX = exports.WIZARD_USER_AGENT = exports.WIZARD_VARIANTS = exports.WIZARD_VARIANT_FLAG_KEY = exports.WIZARD_REMARK_EVENT_NAME = exports.WIZARD_INTERACTION_EVENT_NAME = exports.DUMMY_PROJECT_API_KEY = exports.POSTHOG_PROXY_CLIENT_ID = exports.POSTHOG_DEV_CLIENT_ID = exports.POSTHOG_EU_CLIENT_ID = exports.POSTHOG_US_CLIENT_ID = exports.OAUTH_PORT = exports.POSTHOG_OAUTH_URL = exports.ANALYTICS_TEAM_TAG = exports.ANALYTICS_HOST_URL = exports.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = exports.ISSUES_URL = exports.DEFAULT_HOST_URL = exports.DEFAULT_URL = exports.DEBUG = exports.IS_DEV = exports.Integration = void 0;
|
|
6
|
+
exports.OAUTH_TIMEOUT_MS = exports.DETECTION_TIMEOUT_MS = exports.POSTHOG_FLAG_HEADER_PREFIX = exports.POSTHOG_PROPERTY_HEADER_PREFIX = exports.WIZARD_USER_AGENT = exports.WIZARD_VARIANTS = exports.WIZARD_VARIANT_FLAG_KEY = exports.WIZARD_REMARK_EVENT_NAME = exports.WIZARD_INTERACTION_EVENT_NAME = exports.DUMMY_PROJECT_API_KEY = exports.POSTHOG_PROXY_CLIENT_ID = exports.POSTHOG_DEV_CLIENT_ID = exports.POSTHOG_EU_CLIENT_ID = exports.POSTHOG_US_CLIENT_ID = exports.OAUTH_PORT = exports.POSTHOG_OAUTH_URL = exports.ANALYTICS_TEAM_TAG = exports.ANALYTICS_HOST_URL = exports.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = exports.CONTEXT_MILL_URL = exports.ISSUES_URL = exports.DEFAULT_HOST_URL = exports.DEFAULT_URL = exports.DEBUG = exports.IS_DEV = exports.Integration = void 0;
|
|
7
7
|
const version_1 = require("./version");
|
|
8
8
|
// ── Integration / CLI ───────────────────────────────────────────────
|
|
9
9
|
/**
|
|
@@ -46,6 +46,7 @@ exports.DEFAULT_HOST_URL = exports.IS_DEV
|
|
|
46
46
|
? 'http://localhost:8010'
|
|
47
47
|
: 'https://us.i.posthog.com';
|
|
48
48
|
exports.ISSUES_URL = 'https://github.com/posthog/wizard/issues';
|
|
49
|
+
exports.CONTEXT_MILL_URL = 'https://github.com/PostHog/context-mill';
|
|
49
50
|
// ── Analytics (internal) ──────────────────────────────────────────────
|
|
50
51
|
exports.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = 'sTMFPsFhdP1Ssg';
|
|
51
52
|
exports.ANALYTICS_HOST_URL = 'https://internal-j.posthog.com';
|
|
@@ -80,4 +81,6 @@ exports.POSTHOG_FLAG_HEADER_PREFIX = 'X-POSTHOG-FLAG-';
|
|
|
80
81
|
// ── Timeouts ─────────────────────────────────────────────────────────
|
|
81
82
|
/** Timeout for framework / project detection probes (ms). */
|
|
82
83
|
exports.DETECTION_TIMEOUT_MS = 10_000;
|
|
84
|
+
/** Timeout for the OAuth authorization flow (ms). */
|
|
85
|
+
exports.OAUTH_TIMEOUT_MS = 360_000;
|
|
83
86
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAoC;AAEpC,uEAAuE;AAEvE;;GAEG;AACH,IAAY,WAyBX;AAzBD,WAAY,WAAW;IACrB,aAAa;IACb,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,2CAA4B,CAAA;IAC5B,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAClC,2CAA4B,CAAA;IAC5B,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IAEf,qBAAqB;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,iDAAkC,CAAA;IAClC,gDAAiC,CAAA;AACnC,CAAC,EAzBW,WAAW,2BAAX,WAAW,QAyBtB;AAOD,wEAAwE;AAE3D,QAAA,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,QAAQ,CACpD,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAC3B,CAAC;AACW,QAAA,KAAK,GAAG,KAAK,CAAC;AAE3B,wEAAwE;AAE3D,QAAA,WAAW,GAAG,cAAM;IAC/B,CAAC,CAAC,uBAA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Integration / CLI ───────────────────────────────────────────────\n\n/**\n * Detection order matters: put framework-specific integrations BEFORE basic language fallbacks.\n */\nexport enum Integration {\n // Frameworks\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n vue = 'vue',\n reactRouter = 'react-router',\n tanstackStart = 'tanstack-start',\n tanstackRouter = 'tanstack-router',\n reactNative = 'react-native',\n angular = 'angular',\n astro = 'astro',\n django = 'django',\n flask = 'flask',\n fastapi = 'fastapi',\n laravel = 'laravel',\n sveltekit = 'sveltekit',\n swift = 'swift',\n android = 'android',\n rails = 'rails',\n\n // Language fallbacks\n python = 'python',\n ruby = 'ruby',\n javascriptNode = 'javascript_node',\n javascript_web = 'javascript_web',\n}\n\nexport interface Args {\n debug: boolean;\n integration: Integration;\n}\n\n// ── Environment ──────────────────────────────────────────────────────\n\nexport const IS_DEV = ['test', 'development'].includes(\n process.env.NODE_ENV ?? '',\n);\nexport const DEBUG = false;\n\n// ── URLs ─────────────────────────────────────────────────────────────\n\nexport const DEFAULT_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.posthog.com';\nexport const DEFAULT_HOST_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.i.posthog.com';\nexport const ISSUES_URL = 'https://github.com/posthog/wizard/issues';\nexport const CONTEXT_MILL_URL = 'https://github.com/PostHog/context-mill';\n\n// ── Analytics (internal) ──────────────────────────────────────────────\n\nexport const ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = 'sTMFPsFhdP1Ssg';\nexport const ANALYTICS_HOST_URL = 'https://internal-j.posthog.com';\nexport const ANALYTICS_TEAM_TAG = 'docs-and-wizard';\n\n// ── OAuth / Auth ────────────────────────────────────────────────────\n\nexport const POSTHOG_OAUTH_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://oauth.posthog.com';\nexport const OAUTH_PORT = 8239;\nexport const POSTHOG_US_CLIENT_ID = 'c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM';\nexport const POSTHOG_EU_CLIENT_ID = 'bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy';\nexport const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';\nexport const POSTHOG_PROXY_CLIENT_ID = POSTHOG_US_CLIENT_ID;\nexport const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_TOKEN_';\n\n// ── Wizard run / variants ───────────────────────────────────────────\n\nexport const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';\nexport const WIZARD_REMARK_EVENT_NAME = 'wizard remark';\n/** Feature flag key whose value selects a variant from WIZARD_VARIANTS. */\nexport const WIZARD_VARIANT_FLAG_KEY = 'wizard-variant';\n/** Variant key -> metadata for wizard run (VARIANT flag selects which entry to use). */\nexport const WIZARD_VARIANTS: Record<string, Record<string, string>> = {\n base: { VARIANT: 'base' },\n subagents: { VARIANT: 'subagents' },\n};\n/** User-Agent for wizard HTTP requests and MCP server identification. */\nexport const WIZARD_USER_AGENT = `posthog/wizard; version: ${VERSION}`;\n\n// ── HTTP headers ─────────────────────────────────────────────────────\n\n/** Header prefix for PostHog properties (e.g. X-POSTHOG-PROPERTY-VARIANT). */\nexport const POSTHOG_PROPERTY_HEADER_PREFIX = 'X-POSTHOG-PROPERTY-';\n/** Header prefix for PostHog feature flags. */\nexport const POSTHOG_FLAG_HEADER_PREFIX = 'X-POSTHOG-FLAG-';\n\n// ── Timeouts ─────────────────────────────────────────────────────────\n\n/** Timeout for framework / project detection probes (ms). */\nexport const DETECTION_TIMEOUT_MS = 10_000;\n\n/** Timeout for the OAuth authorization flow (ms). */\nexport const OAUTH_TIMEOUT_MS = 360_000;\n"]}
|
|
@@ -49,8 +49,8 @@ function loadBenchmarkConfig(installDir) {
|
|
|
49
49
|
if (process.env.POSTHOG_WIZARD_BENCHMARK_FILE) {
|
|
50
50
|
config.output.benchmarkPath = process.env.POSTHOG_WIZARD_BENCHMARK_FILE;
|
|
51
51
|
}
|
|
52
|
-
if (process.env.
|
|
53
|
-
config.output.logPath = process.env.
|
|
52
|
+
if (process.env.POSTHOG_WIZARD_LOG_DIR) {
|
|
53
|
+
config.output.logPath = path_1.default.join(process.env.POSTHOG_WIZARD_LOG_DIR, 'posthog-wizard.log');
|
|
54
54
|
}
|
|
55
55
|
// If benchmark output is disabled, disable the jsonWriter plugin
|
|
56
56
|
if (!config.output.benchmarkEnabled) {
|
|
@@ -66,8 +66,8 @@ function loadBenchmarkConfig(installDir) {
|
|
|
66
66
|
if (process.env.POSTHOG_WIZARD_BENCHMARK_FILE) {
|
|
67
67
|
config.output.benchmarkPath = process.env.POSTHOG_WIZARD_BENCHMARK_FILE;
|
|
68
68
|
}
|
|
69
|
-
if (process.env.
|
|
70
|
-
config.output.logPath = process.env.
|
|
69
|
+
if (process.env.POSTHOG_WIZARD_LOG_DIR) {
|
|
70
|
+
config.output.logPath = path_1.default.join(process.env.POSTHOG_WIZARD_LOG_DIR, 'posthog-wizard.log');
|
|
71
71
|
}
|
|
72
72
|
return config;
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/lib/middleware/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AA6CH,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/lib/middleware/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AA6CH,kDA+CC;AAED,4CAEC;AA9FD,4CAAoB;AACpB,gDAAwB;AACxB,6CAA8C;AAC9C,wDAAkD;AAmBlD,MAAM,cAAc,GAAoB;IACtC,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,UAAU,E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AG,8BAAY,CAAC,SAAS,uBAAuB,UAAU,EAAE,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,gDAAgD;QAChD,MAAM,MAAM,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;QAE/C,oBAAoB;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;QAC1E,CAAC;QACD,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;YACvC,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,cAAI,CAAC,IAAI,CAC/B,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAClC,oBAAoB,CACrB,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,eAAe,CAAC,cAAc,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/**\n * Benchmark configuration loader.\n *\n * Loads .benchmark-config.json from the working directory with sensible defaults.\n * All fields are optional — missing fields fall back to defaults.\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { logToFile } from '../../utils/debug';\nimport { AgentSignals } from '../agent-interface';\n\nexport interface BenchmarkConfig {\n /** Enable/disable individual metric plugins */\n plugins: Record<string, boolean>;\n output: {\n /** Path for the benchmark JSON output file */\n benchmarkPath: string;\n /** Whether to write the benchmark JSON file */\n benchmarkEnabled: boolean;\n /** Path for the main wizard debug log file */\n logPath: string;\n /** Whether to write the main wizard debug log */\n logEnabled: boolean;\n /** Suppress benchmark console output (disables the summary plugin) */\n suppressWizardLogs: boolean;\n };\n}\n\nconst DEFAULT_CONFIG: BenchmarkConfig = {\n plugins: {\n tokens: true,\n cache: true,\n turns: true,\n compactions: true,\n contextSize: true,\n cost: true,\n duration: true,\n summary: true,\n jsonWriter: true,\n },\n output: {\n benchmarkPath: '/tmp/posthog-wizard-benchmark.json',\n benchmarkEnabled: true,\n logPath: '/tmp/posthog-wizard.log',\n logEnabled: true,\n suppressWizardLogs: false,\n },\n};\n\nexport function loadBenchmarkConfig(installDir: string): BenchmarkConfig {\n const configPath =\n process.env.POSTHOG_WIZARD_BENCHMARK_CONFIG ??\n path.join(installDir, '.benchmark-config.json');\n try {\n const raw = fs.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(raw);\n const config: BenchmarkConfig = {\n plugins: { ...DEFAULT_CONFIG.plugins, ...parsed.plugins },\n output: { ...DEFAULT_CONFIG.output, ...parsed.output },\n };\n\n // Env var overrides for parallel runs\n if (process.env.POSTHOG_WIZARD_BENCHMARK_FILE) {\n config.output.benchmarkPath = process.env.POSTHOG_WIZARD_BENCHMARK_FILE;\n }\n if (process.env.POSTHOG_WIZARD_LOG_DIR) {\n config.output.logPath = path.join(\n process.env.POSTHOG_WIZARD_LOG_DIR,\n 'posthog-wizard.log',\n );\n }\n\n // If benchmark output is disabled, disable the jsonWriter plugin\n if (!config.output.benchmarkEnabled) {\n config.plugins.jsonWriter = false;\n }\n\n logToFile(`${AgentSignals.BENCHMARK} Loaded config from ${configPath}`);\n return config;\n } catch {\n // No config file or invalid JSON — use defaults\n const config = structuredClone(DEFAULT_CONFIG);\n\n // Env var overrides\n if (process.env.POSTHOG_WIZARD_BENCHMARK_FILE) {\n config.output.benchmarkPath = process.env.POSTHOG_WIZARD_BENCHMARK_FILE;\n }\n if (process.env.POSTHOG_WIZARD_LOG_DIR) {\n config.output.logPath = path.join(\n process.env.POSTHOG_WIZARD_LOG_DIR,\n 'posthog-wizard.log',\n );\n }\n\n return config;\n }\n}\n\nexport function getDefaultConfig(): BenchmarkConfig {\n return structuredClone(DEFAULT_CONFIG);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.7.0";
|
package/dist/src/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AACjD,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// Auto-generated by scripts/generate-version.js — do not edit\nexport const VERSION = '2.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AACjD,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// Auto-generated by scripts/generate-version.js — do not edit\nexport const VERSION = '2.7.0';\n"]}
|
|
@@ -98,6 +98,8 @@ export interface WizardSession {
|
|
|
98
98
|
mcpComplete: boolean;
|
|
99
99
|
mcpOutcome: McpOutcome | null;
|
|
100
100
|
mcpInstalledClients: string[];
|
|
101
|
+
skillsComplete: boolean;
|
|
102
|
+
outroDismissed: boolean;
|
|
101
103
|
readinessResult: WizardReadinessResult | null;
|
|
102
104
|
outageDismissed: boolean;
|
|
103
105
|
settingsOverrideKeys: string[] | null;
|