@posthog/wizard 1.25.0 → 1.27.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/django/django-wizard-agent.d.ts +5 -0
- package/dist/src/django/django-wizard-agent.js +159 -0
- package/dist/src/django/django-wizard-agent.js.map +1 -0
- package/dist/src/django/utils.d.ts +31 -0
- package/dist/src/django/utils.js +325 -0
- package/dist/src/django/utils.js.map +1 -0
- package/dist/src/lib/agent-interface.d.ts +7 -1
- package/dist/src/lib/agent-interface.js +114 -20
- package/dist/src/lib/agent-interface.js.map +1 -1
- package/dist/src/lib/agent-runner.js +50 -13
- package/dist/src/lib/agent-runner.js.map +1 -1
- package/dist/src/lib/config.d.ts +12 -1
- package/dist/src/lib/config.js +126 -12
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/constants.d.ts +2 -1
- package/dist/src/lib/constants.js +3 -0
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/framework-config.d.ts +16 -0
- package/dist/src/lib/framework-config.js.map +1 -1
- package/dist/src/mcp.d.ts +0 -3
- package/dist/src/mcp.js +2 -32
- package/dist/src/mcp.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard-agent.js +2 -0
- package/dist/src/nextjs/nextjs-wizard-agent.js.map +1 -1
- package/dist/src/react-router/react-router-wizard-agent.js +2 -0
- package/dist/src/react-router/react-router-wizard-agent.js.map +1 -1
- package/dist/src/run.js +8 -1
- package/dist/src/run.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/MCPClient.d.ts +5 -4
- package/dist/src/steps/add-mcp-server-to-clients/MCPClient.js +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/MCPClient.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/__tests__/defaults.test.d.ts +1 -0
- package/dist/src/steps/add-mcp-server-to-clients/__tests__/defaults.test.js +92 -0
- package/dist/src/steps/add-mcp-server-to-clients/__tests__/defaults.test.js.map +1 -0
- package/dist/src/steps/add-mcp-server-to-clients/clients/__tests__/claude.test.js +11 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/__tests__/claude.test.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.d.ts +8 -7
- package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.js +5 -3
- package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/claude.d.ts +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/clients/codex.d.ts +8 -7
- package/dist/src/steps/add-mcp-server-to-clients/clients/codex.js +2 -2
- package/dist/src/steps/add-mcp-server-to-clients/clients/codex.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.d.ts +9 -8
- package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js +4 -4
- package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.d.ts +9 -8
- package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.js +4 -4
- package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/zed.d.ts +9 -8
- package/dist/src/steps/add-mcp-server-to-clients/clients/zed.js +4 -4
- package/dist/src/steps/add-mcp-server-to-clients/clients/zed.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/defaults.d.ts +14 -14
- package/dist/src/steps/add-mcp-server-to-clients/defaults.js +34 -13
- package/dist/src/steps/add-mcp-server-to-clients/defaults.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/index.d.ts +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/index.js +4 -5
- package/dist/src/steps/add-mcp-server-to-clients/index.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +5 -0
- package/dist/src/utils/clack-utils.js +14 -0
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/package.json +1 -1
package/dist/src/lib/config.js
CHANGED
|
@@ -1,9 +1,48 @@
|
|
|
1
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.INTEGRATION_ORDER = exports.INTEGRATION_CONFIG = void 0;
|
|
4
40
|
const clack_utils_1 = require("../utils/clack-utils");
|
|
5
41
|
const package_json_1 = require("../utils/package-json");
|
|
6
42
|
const constants_1 = require("./constants");
|
|
43
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
7
46
|
exports.INTEGRATION_CONFIG = {
|
|
8
47
|
[constants_1.Integration.nextjs]: {
|
|
9
48
|
name: 'Next.js',
|
|
@@ -17,8 +56,8 @@ exports.INTEGRATION_CONFIG = {
|
|
|
17
56
|
'next-env.d.*',
|
|
18
57
|
],
|
|
19
58
|
detect: async (options) => {
|
|
20
|
-
const packageJson = await (0, clack_utils_1.
|
|
21
|
-
return (0, package_json_1.hasPackageInstalled)('next', packageJson);
|
|
59
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
60
|
+
return packageJson ? (0, package_json_1.hasPackageInstalled)('next', packageJson) : false;
|
|
22
61
|
},
|
|
23
62
|
generateFilesRules: '',
|
|
24
63
|
filterFilesRules: '',
|
|
@@ -38,8 +77,8 @@ exports.INTEGRATION_CONFIG = {
|
|
|
38
77
|
'assets',
|
|
39
78
|
],
|
|
40
79
|
detect: async (options) => {
|
|
41
|
-
const packageJson = await (0, clack_utils_1.
|
|
42
|
-
return (0, package_json_1.hasPackageInstalled)('react', packageJson);
|
|
80
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
81
|
+
return packageJson ? (0, package_json_1.hasPackageInstalled)('react', packageJson) : false;
|
|
43
82
|
},
|
|
44
83
|
generateFilesRules: '',
|
|
45
84
|
filterFilesRules: '',
|
|
@@ -52,8 +91,10 @@ exports.INTEGRATION_CONFIG = {
|
|
|
52
91
|
filterPatterns: ['**/*.{svelte,ts,js,jsx,tsx}'],
|
|
53
92
|
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
54
93
|
detect: async (options) => {
|
|
55
|
-
const packageJson = await (0, clack_utils_1.
|
|
56
|
-
return
|
|
94
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
95
|
+
return packageJson
|
|
96
|
+
? (0, package_json_1.hasPackageInstalled)('@sveltejs/kit', packageJson)
|
|
97
|
+
: false;
|
|
57
98
|
},
|
|
58
99
|
generateFilesRules: '',
|
|
59
100
|
filterFilesRules: '',
|
|
@@ -66,8 +107,10 @@ exports.INTEGRATION_CONFIG = {
|
|
|
66
107
|
filterPatterns: ['**/*.{ts,js,jsx,tsx}'],
|
|
67
108
|
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
68
109
|
detect: async (options) => {
|
|
69
|
-
const packageJson = await (0, clack_utils_1.
|
|
70
|
-
return
|
|
110
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
111
|
+
return packageJson
|
|
112
|
+
? (0, package_json_1.hasPackageInstalled)('react-native', packageJson)
|
|
113
|
+
: false;
|
|
71
114
|
},
|
|
72
115
|
generateFilesRules: '',
|
|
73
116
|
filterFilesRules: '',
|
|
@@ -80,8 +123,8 @@ exports.INTEGRATION_CONFIG = {
|
|
|
80
123
|
filterPatterns: ['**/*.{astro,ts,js,jsx,tsx}'],
|
|
81
124
|
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
82
125
|
detect: async (options) => {
|
|
83
|
-
const packageJson = await (0, clack_utils_1.
|
|
84
|
-
return (0, package_json_1.hasPackageInstalled)('astro', packageJson);
|
|
126
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
127
|
+
return packageJson ? (0, package_json_1.hasPackageInstalled)('astro', packageJson) : false;
|
|
85
128
|
},
|
|
86
129
|
generateFilesRules: '',
|
|
87
130
|
filterFilesRules: '',
|
|
@@ -101,8 +144,10 @@ exports.INTEGRATION_CONFIG = {
|
|
|
101
144
|
'assets',
|
|
102
145
|
],
|
|
103
146
|
detect: async (options) => {
|
|
104
|
-
const packageJson = await (0, clack_utils_1.
|
|
105
|
-
return
|
|
147
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
148
|
+
return packageJson
|
|
149
|
+
? (0, package_json_1.hasPackageInstalled)('react-router', packageJson)
|
|
150
|
+
: false;
|
|
106
151
|
},
|
|
107
152
|
generateFilesRules: '',
|
|
108
153
|
filterFilesRules: '',
|
|
@@ -110,6 +155,74 @@ exports.INTEGRATION_CONFIG = {
|
|
|
110
155
|
defaultChanges: '• Installed posthog-js package\n• Added PostHogProvider to the root of the app\n• Integrated PostHog with React Router for pageview tracking',
|
|
111
156
|
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
|
|
112
157
|
},
|
|
158
|
+
[constants_1.Integration.django]: {
|
|
159
|
+
name: 'Django',
|
|
160
|
+
filterPatterns: ['**/*.py'],
|
|
161
|
+
ignorePatterns: [
|
|
162
|
+
'node_modules',
|
|
163
|
+
'dist',
|
|
164
|
+
'build',
|
|
165
|
+
'public',
|
|
166
|
+
'static',
|
|
167
|
+
'venv',
|
|
168
|
+
'.venv',
|
|
169
|
+
'env',
|
|
170
|
+
'.env',
|
|
171
|
+
'__pycache__',
|
|
172
|
+
'*.pyc',
|
|
173
|
+
'migrations',
|
|
174
|
+
],
|
|
175
|
+
detect: async (options) => {
|
|
176
|
+
const { installDir } = options;
|
|
177
|
+
// Check for manage.py (Django project indicator)
|
|
178
|
+
const managePyMatches = await (0, fast_glob_1.default)('**/manage.py', {
|
|
179
|
+
cwd: installDir,
|
|
180
|
+
ignore: ['**/venv/**', '**/.venv/**', '**/env/**', '**/.env/**'],
|
|
181
|
+
});
|
|
182
|
+
if (managePyMatches.length > 0) {
|
|
183
|
+
// Verify it's a Django manage.py by checking content
|
|
184
|
+
for (const match of managePyMatches) {
|
|
185
|
+
try {
|
|
186
|
+
const content = fs.readFileSync(path.join(installDir, match), 'utf-8');
|
|
187
|
+
if (content.includes('django') ||
|
|
188
|
+
content.includes('DJANGO_SETTINGS_MODULE')) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
// Skip files that can't be read
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Check for Django in requirements files
|
|
199
|
+
const requirementsFiles = await (0, fast_glob_1.default)(['**/requirements*.txt', '**/pyproject.toml', '**/setup.py'], {
|
|
200
|
+
cwd: installDir,
|
|
201
|
+
ignore: ['**/venv/**', '**/.venv/**', '**/env/**', '**/.env/**'],
|
|
202
|
+
});
|
|
203
|
+
for (const reqFile of requirementsFiles) {
|
|
204
|
+
try {
|
|
205
|
+
const content = fs.readFileSync(path.join(installDir, reqFile), 'utf-8');
|
|
206
|
+
// Check for Django package reference
|
|
207
|
+
if (content.toLowerCase().includes('django') &&
|
|
208
|
+
!content.toLowerCase().includes('django-') // Avoid false positives from Django plugins only
|
|
209
|
+
) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
// Skip files that can't be read
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
},
|
|
220
|
+
generateFilesRules: '',
|
|
221
|
+
filterFilesRules: '',
|
|
222
|
+
docsUrl: 'https://posthog.com/docs/libraries/django',
|
|
223
|
+
defaultChanges: '• Installed posthog Python package\n• Added PostHog middleware for automatic event tracking\n• Configured PostHog settings in Django settings file',
|
|
224
|
+
nextSteps: '• Use identify_context() within new_context() to associate events with users\n• Call posthog.capture() to capture custom events\n• Use feature flags with posthog.feature_enabled()',
|
|
225
|
+
},
|
|
113
226
|
};
|
|
114
227
|
exports.INTEGRATION_ORDER = [
|
|
115
228
|
constants_1.Integration.nextjs,
|
|
@@ -117,6 +230,7 @@ exports.INTEGRATION_ORDER = [
|
|
|
117
230
|
constants_1.Integration.svelte,
|
|
118
231
|
constants_1.Integration.reactNative,
|
|
119
232
|
constants_1.Integration.reactRouter,
|
|
233
|
+
constants_1.Integration.django,
|
|
120
234
|
constants_1.Integration.react,
|
|
121
235
|
];
|
|
122
236
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":";;;AAAA,sDAAyD;AACzD,wDAA4D;AAE5D,2CAA0C;AAc7B,QAAA,kBAAkB,GAAG;IAChC,CAAC,uBAAW,CAAC,MAAM,CAAC,EAAE;QACpB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE,CAAC,8BAA8B,CAAC;QAChD,cAAc,EAAE;YACd,cAAc;YACd,MAAM;YACN,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,cAAc;SACf;QACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACxB,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAiB,EAAC,OAAO,CAAC,CAAC;YACrD,OAAO,IAAA,kCAAmB,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAClD,CAAC;QACD,kBAAkB,EAAE,EAAE;QACtB,gBAAgB,EAAE,EAAE;QACpB,OAAO,EAAE,4CAA4C;QACrD,cAAc,EACZ,mOAAmO;QACrO,SAAS,EACP,0HAA0H;KAC7H;IACD,CAAC,uBAAW,CAAC,KAAK,CAAC,EAAE;QACnB,IAAI,EAAE,OAAO;QACb,cAAc,EAAE,CAAC,sBAAsB,CAAC;QACxC,cAAc,EAAE;YACd,cAAc;YACd,MAAM;YACN,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,QAAQ;SACT;QACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACxB,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAiB,EAAC,OAAO,CAAC,C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AC,WAAW;IACvB,uBAAW,CAAC,KAAK;CACT,CAAC","sourcesContent":["import { getPackageDotJson } from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { Integration } from './constants';\n\ntype IntegrationConfig = {\n name: string;\n filterPatterns: string[];\n ignorePatterns: string[];\n detect: (options: Pick<WizardOptions, 'installDir'>) => Promise<boolean>;\n generateFilesRules: string;\n filterFilesRules: string;\n docsUrl: string;\n nextSteps: string;\n defaultChanges: string;\n};\n\nexport const INTEGRATION_CONFIG = {\n [Integration.nextjs]: {\n name: 'Next.js',\n filterPatterns: ['**/*.{tsx,ts,jsx,js,mjs,cjs}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'next-env.d.*',\n ],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('next', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/next-js',\n defaultChanges:\n '• Installed posthog-js & posthog-node packages\\n• Initialized PostHog and added pageview tracking\\n• Created a PostHogClient to use PostHog server-side\\n• Setup a reverse proxy to avoid ad blockers blocking analytics requests',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.react]: {\n name: 'React',\n filterPatterns: ['**/*.{tsx,ts,jsx,js}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'assets',\n ],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('react', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/react',\n defaultChanges:\n '• Installed posthog-js package\\n• Added PostHogProvider to the root of the app, to initialize PostHog and enable autocapture',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.svelte]: {\n name: 'Svelte',\n filterPatterns: ['**/*.{svelte,ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('@sveltejs/kit', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/svelte',\n defaultChanges:\n '• Installed posthog-js & posthog-node packages\\n• Added PostHog initialization to your Svelte app\\n• Setup pageview & pageleave tracking\\n• Setup event auto - capture to capture events as users interact with your app\\n• Added a getPostHogClient() function to use PostHog server-side',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Use getPostHogClient() to start capturing events server - side',\n },\n [Integration.reactNative]: {\n name: 'React Native',\n filterPatterns: ['**/*.{ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('react-native', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/react-native',\n defaultChanges:\n '• Installed required packages\\n• Added PostHogProvider to the root of the app\\n• Enabled autocapture and session replay',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.astro]: {\n name: 'Astro',\n filterPatterns: ['**/*.{astro,ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('astro', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/js',\n defaultChanges:\n '• Added PostHog component with initialization script\\n• Created PostHogLayout for consistent analytics tracking',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app\\n• Use posthog.isFeatureEnabled() for feature flags',\n },\n [Integration.reactRouter]: {\n name: 'React Router',\n filterPatterns: ['**/*.{tsx,ts,jsx,js}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'assets',\n ],\n detect: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return hasPackageInstalled('react-router', packageJson);\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl:\n 'https://posthog-git-react-post-hog.vercel.app/docs/libraries/react-router',\n defaultChanges:\n '• Installed posthog-js package\\n• Added PostHogProvider to the root of the app\\n• Integrated PostHog with React Router for pageview tracking',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n} as const satisfies Record<Integration, IntegrationConfig>;\n\nexport const INTEGRATION_ORDER = [\n Integration.nextjs,\n Integration.astro,\n Integration.svelte,\n Integration.reactNative,\n Integration.reactRouter,\n Integration.react,\n] as const;\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAyD;AACzD,wDAA4D;AAE5D,2CAA0C;AAC1C,0DAA2B;AAC3B,4CAA8B;AAC9B,gDAAkC;AAcrB,QAAA,kBAAkB,GAAG;IAChC,CAAC,uBAAW,CAAC,MAAM,CAAC,EAAE;QACpB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE,CAAC,8BAA8B,CAAC;QAChD,cAAc,EAAE;YACd,cAAc;YACd,MAAM;YACN,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,cAAc;SACf;QACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACxB,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAiB,EAAC,OAAO,CAAC,CAAC;YACrD,OAAO,WAAW,CAAC,CAAC,CAAC,IAAA,kCAAmB,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACxE,CAAC;QACD,kBAAkB,EA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AAC;AAE/C,QAAA,iBAAiB,GAAG;IAC/B,uBAAW,CAAC,MAAM;IAClB,uBAAW,CAAC,KAAK;IACjB,uBAAW,CAAC,MAAM;IAClB,uBAAW,CAAC,WAAW;IACvB,uBAAW,CAAC,WAAW;IACvB,uBAAW,CAAC,MAAM;IAClB,uBAAW,CAAC,KAAK;CACT,CAAC","sourcesContent":["import { tryGetPackageJson } from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { Integration } from './constants';\nimport fg from 'fast-glob';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\ntype IntegrationConfig = {\n name: string;\n filterPatterns: string[];\n ignorePatterns: string[];\n detect: (options: Pick<WizardOptions, 'installDir'>) => Promise<boolean>;\n generateFilesRules: string;\n filterFilesRules: string;\n docsUrl: string;\n nextSteps: string;\n defaultChanges: string;\n};\n\nexport const INTEGRATION_CONFIG = {\n [Integration.nextjs]: {\n name: 'Next.js',\n filterPatterns: ['**/*.{tsx,ts,jsx,js,mjs,cjs}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'next-env.d.*',\n ],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson ? hasPackageInstalled('next', packageJson) : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/next-js',\n defaultChanges:\n '• Installed posthog-js & posthog-node packages\\n• Initialized PostHog and added pageview tracking\\n• Created a PostHogClient to use PostHog server-side\\n• Setup a reverse proxy to avoid ad blockers blocking analytics requests',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.react]: {\n name: 'React',\n filterPatterns: ['**/*.{tsx,ts,jsx,js}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'assets',\n ],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson ? hasPackageInstalled('react', packageJson) : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/react',\n defaultChanges:\n '• Installed posthog-js package\\n• Added PostHogProvider to the root of the app, to initialize PostHog and enable autocapture',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.svelte]: {\n name: 'Svelte',\n filterPatterns: ['**/*.{svelte,ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson\n ? hasPackageInstalled('@sveltejs/kit', packageJson)\n : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/svelte',\n defaultChanges:\n '• Installed posthog-js & posthog-node packages\\n• Added PostHog initialization to your Svelte app\\n• Setup pageview & pageleave tracking\\n• Setup event auto - capture to capture events as users interact with your app\\n• Added a getPostHogClient() function to use PostHog server-side',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Use getPostHogClient() to start capturing events server - side',\n },\n [Integration.reactNative]: {\n name: 'React Native',\n filterPatterns: ['**/*.{ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson\n ? hasPackageInstalled('react-native', packageJson)\n : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/react-native',\n defaultChanges:\n '• Installed required packages\\n• Added PostHogProvider to the root of the app\\n• Enabled autocapture and session replay',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.astro]: {\n name: 'Astro',\n filterPatterns: ['**/*.{astro,ts,js,jsx,tsx}'],\n ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson ? hasPackageInstalled('astro', packageJson) : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/js',\n defaultChanges:\n '• Added PostHog component with initialization script\\n• Created PostHogLayout for consistent analytics tracking',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app\\n• Use posthog.isFeatureEnabled() for feature flags',\n },\n [Integration.reactRouter]: {\n name: 'React Router',\n filterPatterns: ['**/*.{tsx,ts,jsx,js}'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'assets',\n ],\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson\n ? hasPackageInstalled('react-router', packageJson)\n : false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl:\n 'https://posthog-git-react-post-hog.vercel.app/docs/libraries/react-router',\n defaultChanges:\n '• Installed posthog-js package\\n• Added PostHogProvider to the root of the app\\n• Integrated PostHog with React Router for pageview tracking',\n nextSteps:\n '• Call posthog.identify() when a user signs into your app\\n• Call posthog.capture() to capture custom events in your app',\n },\n [Integration.django]: {\n name: 'Django',\n filterPatterns: ['**/*.py'],\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'public',\n 'static',\n 'venv',\n '.venv',\n 'env',\n '.env',\n '__pycache__',\n '*.pyc',\n 'migrations',\n ],\n detect: async (options) => {\n const { installDir } = options;\n\n // Check for manage.py (Django project indicator)\n const managePyMatches = await fg('**/manage.py', {\n cwd: installDir,\n ignore: ['**/venv/**', '**/.venv/**', '**/env/**', '**/.env/**'],\n });\n\n if (managePyMatches.length > 0) {\n // Verify it's a Django manage.py by checking content\n for (const match of managePyMatches) {\n try {\n const content = fs.readFileSync(\n path.join(installDir, match),\n 'utf-8',\n );\n if (\n content.includes('django') ||\n content.includes('DJANGO_SETTINGS_MODULE')\n ) {\n return true;\n }\n } catch {\n // Skip files that can't be read\n continue;\n }\n }\n }\n\n // Check for Django in requirements files\n const requirementsFiles = await fg(\n ['**/requirements*.txt', '**/pyproject.toml', '**/setup.py'],\n {\n cwd: installDir,\n ignore: ['**/venv/**', '**/.venv/**', '**/env/**', '**/.env/**'],\n },\n );\n\n for (const reqFile of requirementsFiles) {\n try {\n const content = fs.readFileSync(\n path.join(installDir, reqFile),\n 'utf-8',\n );\n // Check for Django package reference\n if (\n content.toLowerCase().includes('django') &&\n !content.toLowerCase().includes('django-') // Avoid false positives from Django plugins only\n ) {\n return true;\n }\n } catch {\n // Skip files that can't be read\n continue;\n }\n }\n\n return false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/django',\n defaultChanges:\n '• Installed posthog Python package\\n• Added PostHog middleware for automatic event tracking\\n• Configured PostHog settings in Django settings file',\n nextSteps:\n '• Use identify_context() within new_context() to associate events with users\\n• Call posthog.capture() to capture custom events\\n• Use feature flags with posthog.feature_enabled()',\n },\n} as const satisfies Record<Integration, IntegrationConfig>;\n\nexport const INTEGRATION_ORDER = [\n Integration.nextjs,\n Integration.astro,\n Integration.svelte,\n Integration.reactNative,\n Integration.reactRouter,\n Integration.django,\n Integration.react,\n] as const;\n"]}
|
|
@@ -4,7 +4,8 @@ export declare enum Integration {
|
|
|
4
4
|
svelte = "svelte",
|
|
5
5
|
reactNative = "react-native",
|
|
6
6
|
astro = "astro",
|
|
7
|
-
reactRouter = "react-router"
|
|
7
|
+
reactRouter = "react-router",
|
|
8
|
+
django = "django"
|
|
8
9
|
}
|
|
9
10
|
export declare enum FeatureFlagDefinition {
|
|
10
11
|
ReactRouter = "wizard-react-router"
|
|
@@ -11,6 +11,7 @@ var Integration;
|
|
|
11
11
|
Integration["reactNative"] = "react-native";
|
|
12
12
|
Integration["astro"] = "astro";
|
|
13
13
|
Integration["reactRouter"] = "react-router";
|
|
14
|
+
Integration["django"] = "django";
|
|
14
15
|
})(Integration || (exports.Integration = Integration = {}));
|
|
15
16
|
var FeatureFlagDefinition;
|
|
16
17
|
(function (FeatureFlagDefinition) {
|
|
@@ -30,6 +31,8 @@ function getIntegrationDescription(type) {
|
|
|
30
31
|
return 'Astro';
|
|
31
32
|
case Integration.reactRouter:
|
|
32
33
|
return 'React Router';
|
|
34
|
+
case Integration.django:
|
|
35
|
+
return 'Django';
|
|
33
36
|
default:
|
|
34
37
|
throw new Error(`Unknown integration ${type}`);
|
|
35
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAcA,8DAmBC;AAOD,sDAKC;AA7CD,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,2CAA4B,CAAA;IAC5B,8BAAe,CAAA;IACf,2CAA4B,CAAA;IAC5B,gCAAiB,CAAA;AACnB,CAAC,EARW,WAAW,2BAAX,WAAW,QAQtB;AAED,IAAY,qBAEX;AAFD,WAAY,qBAAqB;IAC/B,4DAAmC,CAAA;AACrC,CAAC,EAFW,qBAAqB,qCAArB,qBAAqB,QAEhC;AAED,SAAgB,yBAAyB,CAAC,IAAY;IACpD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,OAAO,CAAC;QACjB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,QAAQ,CAAC;QAClB,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,OAAO,CAAC;QACjB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,QAAQ,CAAC;QAClB;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AAOY,QAAA,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,QAAQ,CACpD,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAC3B,CAAC;AAEW,QAAA,KAAK,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,cAAM;IAC/B,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,wBAAwB,CAAC;AAChB,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,gBAAgB,GAAG,cAAM;IACpC,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,0BAA0B,CAAC;AAClB,QAAA,0CAA0C,GAAG,gBAAgB,CAAC;AAC9D,QAAA,kBAAkB,GAAG,gCAAgC,CAAC;AACtD,QAAA,kBAAkB,GAAG,iBAAiB,CAAC;AACvC,QAAA,qBAAqB,GAAG,gCAAgC,CAAC;AAEzD,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,qBAAqB,GAAG,0CAA0C,CAAC;AACnE,QAAA,UAAU,GAAG,IAAI,CAAC;AAElB,QAAA,6BAA6B,GAAG,oBAAoB,CAAC","sourcesContent":["export enum Integration {\n nextjs = 'nextjs',\n react = 'react',\n svelte = 'svelte',\n reactNative = 'react-native',\n astro = 'astro',\n reactRouter = 'react-router',\n django = 'django',\n}\n\nexport enum FeatureFlagDefinition {\n ReactRouter = 'wizard-react-router',\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.nextjs:\n return 'Next.js';\n case Integration.react:\n return 'React';\n case Integration.reactNative:\n return 'React Native';\n case Integration.svelte:\n return 'Svelte';\n case Integration.astro:\n return 'Astro';\n case Integration.reactRouter:\n return 'React Router';\n case Integration.django:\n return 'Django';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n debug: boolean;\n integration: Integration;\n}\n\nexport const IS_DEV = ['test', 'development'].includes(\n process.env.NODE_ENV ?? '',\n);\n\nexport const DEBUG = false;\n\nexport const DEFAULT_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.posthog.com';\nexport const ISSUES_URL = 'https://github.com/posthog/wizard/issues';\nexport const DEFAULT_HOST_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.i.posthog.com';\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';\nexport const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_API_KEY_';\n\nexport const POSTHOG_US_CLIENT_ID = 'c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM';\nexport const POSTHOG_EU_CLIENT_ID = 'bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy';\nexport const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';\nexport const OAUTH_PORT = 8239;\n\nexport const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';\n"]}
|
|
@@ -46,6 +46,12 @@ export interface FrameworkDetection {
|
|
|
46
46
|
getVersion: (packageJson: any) => string | undefined;
|
|
47
47
|
/** Optional: Convert version to analytics bucket (e.g., "15.x") */
|
|
48
48
|
getVersionBucket?: (version: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether this framework uses package.json (Node.js/JavaScript).
|
|
51
|
+
* If false, skips package.json checks (for Python, Go, etc.)
|
|
52
|
+
* Defaults to true if not specified.
|
|
53
|
+
*/
|
|
54
|
+
usesPackageJson?: boolean;
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* Environment variable configuration
|
|
@@ -78,6 +84,16 @@ export interface PromptConfig {
|
|
|
78
84
|
* For React Native: "- Platform: Expo"
|
|
79
85
|
*/
|
|
80
86
|
getAdditionalContextLines?: (context: any) => string[];
|
|
87
|
+
/**
|
|
88
|
+
* How to detect the project type for this framework.
|
|
89
|
+
* e.g., "Look for package.json and lockfiles" or "Look for requirements.txt and manage.py"
|
|
90
|
+
*/
|
|
91
|
+
projectTypeDetection: string;
|
|
92
|
+
/**
|
|
93
|
+
* How to install packages for this framework.
|
|
94
|
+
* e.g., "Use npm/yarn/pnpm based on lockfile" or "Use pip/poetry based on config files"
|
|
95
|
+
*/
|
|
96
|
+
packageInstallation: string;
|
|
81
97
|
}
|
|
82
98
|
/**
|
|
83
99
|
* UI messaging configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-config.js","sourceRoot":"","sources":["../../../src/lib/framework-config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"framework-config.js","sourceRoot":"","sources":["../../../src/lib/framework-config.ts"],"names":[],"mappings":";;;AAwIA,8CAEC;AALD;;GAEG;AACH,SAAgB,iBAAiB,CAAC,aAAqB;IACrD,OAAO,WAAW,aAAa,yBAAyB,CAAC;AAC3D,CAAC;AAED;;GAEG;AACU,QAAA,eAAe,GAC1B,mEAAmE,CAAC","sourcesContent":["import type { Integration } from './constants';\nimport type { WizardOptions } from '../utils/types';\n\n/**\n * Configuration interface for framework-specific agent integrations.\n * Each framework exports a FrameworkConfig that the universal runner uses.\n */\nexport interface FrameworkConfig {\n metadata: FrameworkMetadata;\n detection: FrameworkDetection;\n environment: EnvironmentConfig;\n analytics: AnalyticsConfig;\n prompts: PromptConfig;\n ui: UIConfig;\n}\n\n/**\n * Basic framework information and documentation\n */\nexport interface FrameworkMetadata {\n /** Display name (e.g., \"Next.js\", \"React\") */\n name: string;\n\n /** Integration type from constants */\n integration: Integration;\n\n /** URL to framework-specific PostHog docs */\n docsUrl: string;\n\n /**\n * Optional URL to docs for users with unsupported framework versions.\n * If not provided, defaults to docsUrl.\n */\n unsupportedVersionDocsUrl?: string;\n\n /**\n * Optional function to gather framework-specific context before agent runs.\n * For Next.js: detects router type\n * For React Native: detects Expo vs bare\n */\n gatherContext?: (options: WizardOptions) => Promise<Record<string, any>>;\n}\n\n/**\n * Framework detection and version handling\n */\nexport interface FrameworkDetection {\n /** Package name to check in package.json (e.g., \"next\", \"react\") */\n packageName: string;\n\n /** Human-readable name for error messages (e.g., \"Next.js\") */\n packageDisplayName: string;\n\n /** Extract version from package.json */\n getVersion: (packageJson: any) => string | undefined;\n\n /** Optional: Convert version to analytics bucket (e.g., \"15.x\") */\n getVersionBucket?: (version: string) => string;\n\n /**\n * Whether this framework uses package.json (Node.js/JavaScript).\n * If false, skips package.json checks (for Python, Go, etc.)\n * Defaults to true if not specified.\n */\n usesPackageJson?: boolean;\n}\n\n/**\n * Environment variable configuration\n */\nexport interface EnvironmentConfig {\n /** Whether to upload env vars to hosting providers post-agent */\n uploadToHosting: boolean;\n\n /**\n * Build the environment variables object for this framework.\n * Returns the exact variable names and values to upload to hosting providers.\n */\n getEnvVars: (apiKey: string, host: string) => Record<string, string>;\n}\n\n/**\n * Analytics configuration\n */\nexport interface AnalyticsConfig {\n /** Generate tags from context (e.g., { 'nextjs-version': '15.x', 'router': 'app' }) */\n getTags: (context: any) => Record<string, any>;\n\n /** Optional: Additional event properties */\n getEventProperties?: (context: any) => Record<string, any>;\n}\n\n/**\n * Prompt configuration\n */\nexport interface PromptConfig {\n /**\n * Optional: Additional context lines to append to base prompt\n * For Next.js: \"- Router: app\"\n * For React Native: \"- Platform: Expo\"\n */\n getAdditionalContextLines?: (context: any) => string[];\n\n /**\n * How to detect the project type for this framework.\n * e.g., \"Look for package.json and lockfiles\" or \"Look for requirements.txt and manage.py\"\n */\n projectTypeDetection: string;\n\n /**\n * How to install packages for this framework.\n * e.g., \"Use npm/yarn/pnpm based on lockfile\" or \"Use pip/poetry based on config files\"\n */\n packageInstallation: string;\n}\n\n/**\n * UI messaging configuration\n */\nexport interface UIConfig {\n /** Success message when agent completes */\n successMessage: string;\n\n /** Estimated time for agent to complete (in minutes) */\n estimatedDurationMinutes: number;\n\n /** Generate \"What the agent did\" bullets from context */\n getOutroChanges: (context: any) => string[];\n\n /** Generate \"Next steps\" bullets from context */\n getOutroNextSteps: (context: any) => string[];\n}\n\n/**\n * Generate welcome message from framework name\n */\nexport function getWelcomeMessage(frameworkName: string): string {\n return `PostHog ${frameworkName} wizard (agent-powered)`;\n}\n\n/**\n * Shared spinner message for all frameworks\n */\nexport const SPINNER_MESSAGE =\n 'Writing your PostHog setup with events, error capture and more...';\n"]}
|
package/dist/src/mcp.d.ts
CHANGED
package/dist/src/mcp.js
CHANGED
|
@@ -3,14 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runMCPRemove = exports.runMCPInstall = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const add_mcp_server_to_clients_1 = require("./steps/add-mcp-server-to-clients");
|
|
9
9
|
const clack_1 = __importDefault(require("./utils/clack"));
|
|
10
|
-
const clack_utils_1 = require("./utils/clack-utils");
|
|
11
|
-
const opn_1 = __importDefault(require("opn"));
|
|
12
|
-
const urls_1 = require("./utils/urls");
|
|
13
|
-
const helper_functions_1 = require("./lib/helper-functions");
|
|
14
10
|
const debug_1 = require("./utils/debug");
|
|
15
11
|
const runMCPInstall = async (options) => {
|
|
16
12
|
if (options.debug) {
|
|
@@ -23,6 +19,7 @@ const runMCPInstall = async (options) => {
|
|
|
23
19
|
local: options.local,
|
|
24
20
|
});
|
|
25
21
|
clack_1.default.log.message(`${chalk_1.default.greenBright('You might need to restart your MCP clients to see the changes.')}`);
|
|
22
|
+
clack_1.default.log.message(`You'll be prompted to log in to PostHog when you first use the MCP.`);
|
|
26
23
|
clack_1.default.log.message(`Get started with some prompts like:
|
|
27
24
|
- What feature flags do I have active?
|
|
28
25
|
- Add a new feature flag for our homepage redesign
|
|
@@ -45,31 +42,4 @@ const runMCPRemove = async (options) => {
|
|
|
45
42
|
clack_1.default.outro(`${chalk_1.default.green('You might need to restart your MCP clients to see the changes.\n\n')}`);
|
|
46
43
|
};
|
|
47
44
|
exports.runMCPRemove = runMCPRemove;
|
|
48
|
-
const getPersonalApiKey = async (options) => {
|
|
49
|
-
const cloudUrl = (0, urls_1.getCloudUrlFromRegion)(options.cloudRegion);
|
|
50
|
-
const urlToOpen = `${cloudUrl}/settings/user-api-keys?preset=mcp_server`;
|
|
51
|
-
const spinner = clack_1.default.spinner();
|
|
52
|
-
spinner.start(`Opening your project settings so you can get a Personal API key...`);
|
|
53
|
-
await (0, helper_functions_1.sleep)(1500);
|
|
54
|
-
spinner.stop(`Opened your project settings. If the link didn't open automatically, open the following URL in your browser to get a Personal API key: \n\n${chalk_1.default.cyan(urlToOpen)}`);
|
|
55
|
-
(0, opn_1.default)(urlToOpen, { wait: false }).catch(() => {
|
|
56
|
-
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
57
|
-
});
|
|
58
|
-
const personalApiKey = await clack_1.default.password({
|
|
59
|
-
message: 'Paste in your Personal API key:',
|
|
60
|
-
validate(value) {
|
|
61
|
-
if (value.length === 0)
|
|
62
|
-
return `Value is required!`;
|
|
63
|
-
if (!value.startsWith('phx_')) {
|
|
64
|
-
return `That doesn't look right, are you sure you copied the right key? It should start with 'phx_'`;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
if (!personalApiKey) {
|
|
69
|
-
await (0, clack_utils_1.abort)('Unable to proceed without a personal API key.');
|
|
70
|
-
return '';
|
|
71
|
-
}
|
|
72
|
-
return personalApiKey;
|
|
73
|
-
};
|
|
74
|
-
exports.getPersonalApiKey = getPersonalApiKey;
|
|
75
45
|
//# sourceMappingURL=mcp.js.map
|
package/dist/src/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/mcp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iFAG2C;AAC3C,0DAAkC;
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/mcp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iFAG2C;AAC3C,0DAAkC;AAElC,yCAAgD;AAEzC,MAAM,aAAa,GAAG,KAAK,EAAE,OAKnC,EAAE,EAAE;IACH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAA,uBAAe,GAAE,CAAC;IACpB,CAAC;IACD,eAAK,CAAC,KAAK,CACT,eAAK,CAAC,aAAa,CACjB,qCAAqC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,CAClE,CACF,CAAC;IAEF,MAAM,IAAA,qDAAyB,EAAC;QAC9B,WAAW,EAAE,OAAO,CAAC,MAAM;QAC3B,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;IAEH,eAAK,CAAC,GAAG,CAAC,OAAO,CACf,GAAG,eAAK,CAAC,WAAW,CAClB,gEAAgE,CACjE,EAAE,CACJ,CAAC;IAEF,eAAK,CAAC,GAAG,CAAC,OAAO,CACf,qEAAqE,CACtE,CAAC;IAEF,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC;;;kCAGc,CAAC,CAAC;IAElC,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC;EAClB,eAAK,CAAC,UAAU,CAAC,iDAAiD,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAtCW,QAAA,aAAa,iBAsCxB;AAEK,MAAM,YAAY,GAAG,KAAK,EAAE,OAA6B,EAAE,EAAE;IAClE,eAAK,CAAC,KAAK,CAAC,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,MAAM,IAAA,0DAA8B,EAAC;QACnD,KAAK,EAAE,OAAO,EAAE,KAAK;KACtB,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,eAAK,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;IAED,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,eAAK,CAAC,KAAK,CACT,GAAG,eAAK,CAAC,KAAK,CACZ,oEAAoE,CACrE,EAAE,CACJ,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import chalk from 'chalk';\nimport {\n addMCPServerToClientsStep,\n removeMCPServerFromClientsStep,\n} from './steps/add-mcp-server-to-clients';\nimport clack from './utils/clack';\nimport type { CloudRegion } from './utils/types';\nimport { enableDebugLogs } from './utils/debug';\n\nexport const runMCPInstall = async (options: {\n signup: boolean;\n region?: CloudRegion;\n local?: boolean;\n debug?: boolean;\n}) => {\n if (options.debug) {\n enableDebugLogs();\n }\n clack.intro(\n chalk.bgGreenBright(\n `Installing the PostHog MCP server ${options.local && '(local)'}`,\n ),\n );\n\n await addMCPServerToClientsStep({\n cloudRegion: options.region,\n askPermission: false,\n local: options.local,\n });\n\n clack.log.message(\n `${chalk.greenBright(\n 'You might need to restart your MCP clients to see the changes.',\n )}`,\n );\n\n clack.log.message(\n `You'll be prompted to log in to PostHog when you first use the MCP.`,\n );\n\n clack.log.message(`Get started with some prompts like:\n- What feature flags do I have active?\n- Add a new feature flag for our homepage redesign\n- What are my most common errors?`);\n\n clack.log.message(`Check out our MCP Server documentation:\n${chalk.blueBright(`https://posthog.com/docs/model-context-protocol`)}`);\n};\n\nexport const runMCPRemove = async (options?: { local?: boolean }) => {\n clack.intro(chalk.bgRed('Removing the PostHog MCP server'));\n const results = await removeMCPServerFromClientsStep({\n local: options?.local,\n });\n\n if (results.length === 0) {\n clack.outro(`No PostHog MCP servers found to remove.`);\n return;\n }\n\n clack.log.success(`PostHog MCP server removed from:`);\n results.map((c) => clack.log.message(`- ${c}`));\n clack.outro(\n `${chalk.green(\n 'You might need to restart your MCP clients to see the changes.\\n\\n',\n )}`,\n );\n};\n"]}
|
|
@@ -83,6 +83,8 @@ const NEXTJS_AGENT_CONFIG = {
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
prompts: {
|
|
86
|
+
projectTypeDetection: 'This is a JavaScript/TypeScript project. Look for package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to confirm.',
|
|
87
|
+
packageInstallation: 'Look for lockfiles to determine the package manager (npm, yarn, pnpm, bun). Do not manually edit package.json.',
|
|
86
88
|
getAdditionalContextLines: (context) => {
|
|
87
89
|
const router = context.router;
|
|
88
90
|
const routerType = router === utils_1.NextJsRouter.APP_ROUTER ? 'app' : 'pages';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-wizard-agent.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard-agent.ts"],"names":[],"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AAC;QAChB,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI,cAAc,IAAI,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC;YACxE,MAAM,OAAO,GACX,mBAAmB,CAAC,QAAQ,CAAC,yBAAyB;gBACtD,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC;YAEvC,eAAK,CAAC,GAAG,CAAC,IAAI,CACZ,iDAAiD,WAAW,wBAAwB,sBAAsB,iDAAiD,CAC5J,CAAC;YACF,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,eAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACjE,eAAK,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;IACH,CAAC;IAED,MAAM,IAAA,6BAAc,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/* Simplified Next.js wizard using posthog-agent with PostHog MCP */\nimport type { WizardOptions } from '../utils/types';\nimport { enableDebugLogs } from '../utils/debug';\nimport { runAgentWizard } from '../lib/agent-runner';\nimport { Integration } from '../lib/constants';\nimport { getPackageVersion } from '../utils/package-json';\nimport { getPackageDotJson } from '../utils/clack-utils';\nimport clack from '../utils/clack';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport {\n getNextJsRouter,\n getNextJsVersionBucket,\n getNextJsRouterName,\n NextJsRouter,\n} from './utils';\n\n/**\n * Next.js framework configuration for the universal agent runner.\n */\nconst MINIMUM_NEXTJS_VERSION = '15.3.0';\n\nconst NEXTJS_AGENT_CONFIG = {\n metadata: {\n name: 'Next.js',\n integration: Integration.nextjs,\n docsUrl: 'https://posthog.com/docs/libraries/next-js',\n unsupportedVersionDocsUrl: 'https://posthog.com/docs/libraries/next-js',\n gatherContext: async (options: WizardOptions) => {\n const router = await getNextJsRouter(options);\n return { router };\n },\n },\n\n detection: {\n packageName: 'next',\n packageDisplayName: 'Next.js',\n getVersion: (packageJson: any) => getPackageVersion('next', packageJson),\n getVersionBucket: getNextJsVersionBucket,\n },\n\n environment: {\n uploadToHosting: true,\n getEnvVars: (apiKey: string, host: string) => ({\n NEXT_PUBLIC_POSTHOG_KEY: apiKey,\n NEXT_PUBLIC_POSTHOG_HOST: host,\n }),\n },\n\n analytics: {\n getTags: (context: any) => {\n const router = context.router as NextJsRouter;\n return {\n router: router === NextJsRouter.APP_ROUTER ? 'app' : 'pages',\n };\n },\n },\n\n prompts: {\n projectTypeDetection:\n 'This is a JavaScript/TypeScript project. Look for package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to confirm.',\n packageInstallation:\n 'Look for lockfiles to determine the package manager (npm, yarn, pnpm, bun). Do not manually edit package.json.',\n getAdditionalContextLines: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerType = router === NextJsRouter.APP_ROUTER ? 'app' : 'pages';\n return [`Router: ${routerType}`];\n },\n },\n\n ui: {\n successMessage: 'PostHog integration complete',\n estimatedDurationMinutes: 8,\n getOutroChanges: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerName = getNextJsRouterName(router);\n return [\n `Analyzed your Next.js project structure (${routerName})`,\n `Created and configured PostHog initializers`,\n `Integrated PostHog into your application`,\n ];\n },\n getOutroNextSteps: () => {\n return [\n 'Start your development server to see PostHog in action',\n 'Visit your PostHog dashboard to see incoming events',\n ];\n },\n },\n};\n\n/**\n * Next.js wizard powered by the universal agent runner.\n */\nexport async function runNextjsWizardAgent(\n options: WizardOptions,\n): Promise<void> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n // Check Next.js version - agent wizard requires >= 15.3.0\n const packageJson = await getPackageDotJson(options);\n const nextVersion = getPackageVersion('next', packageJson);\n\n if (nextVersion) {\n const coercedVersion = semver.coerce(nextVersion);\n if (coercedVersion && semver.lt(coercedVersion, MINIMUM_NEXTJS_VERSION)) {\n const docsUrl =\n NEXTJS_AGENT_CONFIG.metadata.unsupportedVersionDocsUrl ??\n NEXTJS_AGENT_CONFIG.metadata.docsUrl;\n\n clack.log.warn(\n `Sorry: the wizard can't help you with Next.js ${nextVersion}. Upgrade to Next.js ${MINIMUM_NEXTJS_VERSION} or later, or check out the manual setup guide.`,\n );\n clack.log.info(`Setup Next.js manually: ${chalk.cyan(docsUrl)}`);\n clack.outro('PostHog wizard will see you next time!');\n return;\n }\n }\n\n await runAgentWizard(NEXTJS_AGENT_CONFIG, options);\n}\n"]}
|
|
@@ -83,6 +83,8 @@ const REACT_ROUTER_AGENT_CONFIG = {
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
prompts: {
|
|
86
|
+
projectTypeDetection: 'This is a JavaScript/TypeScript project. Look for package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to confirm.',
|
|
87
|
+
packageInstallation: 'Look for lockfiles to determine the package manager (npm, yarn, pnpm, bun). Do not manually edit package.json.',
|
|
86
88
|
getAdditionalContextLines: (context) => {
|
|
87
89
|
const routerMode = context.routerMode;
|
|
88
90
|
const modeName = routerMode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-wizard-agent.js","sourceRoot":"","sources":["../../../src/react-router/react-router-wizard-agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"react-router-wizard-agent.js","sourceRoot":"","sources":["../../../src/react-router/react-router-wizard-agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,8DA+BC;AA9ID,0CAAiD;AACjD,sDAAqD;AACrD,gDAA+C;AAC/C,wDAA0D;AAC1D,sDAAyD;AACzD,2DAAmC;AACnC,kDAA0B;AAC1B,+CAAiC;AACjC,mCAKiB;AAEjB;;GAEG;AACH,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAE7C,MAAM,yBAAy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B,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACzD,IACE,cAAc;YACd,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,4BAA4B,CAAC,EACvD,CAAC;YACD,MAAM,OAAO,GACX,yBAAyB,CAAC,QAAQ,CAAC,yBAAyB;gBAC5D,yBAAyB,CAAC,QAAQ,CAAC,OAAO,CAAC;YAE7C,eAAK,CAAC,GAAG,CAAC,IAAI,CACZ,sDAAsD,kBAAkB,6BAA6B,4BAA4B,iDAAiD,CACnL,CAAC;YACF,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gCAAgC,eAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACtE,eAAK,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;IACH,CAAC;IAED,MAAM,IAAA,6BAAc,EAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/* React Router wizard using posthog-agent with PostHog MCP */\nimport type { WizardOptions } from '../utils/types';\nimport type { FrameworkConfig } from '../lib/framework-config';\nimport { enableDebugLogs } from '../utils/debug';\nimport { runAgentWizard } from '../lib/agent-runner';\nimport { Integration } from '../lib/constants';\nimport { getPackageVersion } from '../utils/package-json';\nimport { getPackageDotJson } from '../utils/clack-utils';\nimport clack from '../utils/clack';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport {\n getReactRouterMode,\n getReactRouterModeName,\n getReactRouterVersionBucket,\n ReactRouterMode,\n} from './utils';\n\n/**\n * React Router framework configuration for the universal agent runner.\n */\nconst MINIMUM_REACT_ROUTER_VERSION = '6.0.0';\n\nconst REACT_ROUTER_AGENT_CONFIG: FrameworkConfig = {\n metadata: {\n name: 'React Router',\n integration: Integration.reactRouter,\n docsUrl: 'https://posthog.com/docs/libraries/react',\n unsupportedVersionDocsUrl: 'https://posthog.com/docs/libraries/react',\n gatherContext: async (options: WizardOptions) => {\n const routerMode = await getReactRouterMode(options);\n return { routerMode };\n },\n },\n\n detection: {\n packageName: 'react-router',\n packageDisplayName: 'React Router',\n getVersion: (packageJson: any) =>\n getPackageVersion('react-router', packageJson),\n getVersionBucket: getReactRouterVersionBucket,\n },\n\n environment: {\n uploadToHosting: false,\n getEnvVars: (apiKey: string, host: string) => ({\n REACT_APP_POSTHOG_KEY: apiKey,\n REACT_APP_POSTHOG_HOST: host,\n }),\n },\n\n analytics: {\n getTags: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n return {\n routerMode: routerMode || 'unknown',\n };\n },\n },\n\n prompts: {\n projectTypeDetection:\n 'This is a JavaScript/TypeScript project. Look for package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to confirm.',\n packageInstallation:\n 'Look for lockfiles to determine the package manager (npm, yarn, pnpm, bun). Do not manually edit package.json.',\n getAdditionalContextLines: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode\n ? getReactRouterModeName(routerMode)\n : 'unknown';\n\n // Map router mode to framework ID for MCP docs resource\n const frameworkIdMap: Record<ReactRouterMode, string> = {\n [ReactRouterMode.V6]: 'react-react-router-6',\n [ReactRouterMode.V7_FRAMEWORK]: 'react-react-router-7-framework',\n [ReactRouterMode.V7_DATA]: 'react-react-router-7-data',\n [ReactRouterMode.V7_DECLARATIVE]: 'react-react-router-7-declarative',\n };\n\n const frameworkId = routerMode\n ? frameworkIdMap[routerMode]\n : ReactRouterMode.V7_FRAMEWORK;\n\n return [\n `Router mode: ${modeName}`,\n `Framework docs ID: ${frameworkId} (use posthog://docs/frameworks/${frameworkId} for documentation)`,\n ];\n },\n },\n\n ui: {\n successMessage: 'PostHog integration complete',\n estimatedDurationMinutes: 8,\n getOutroChanges: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode\n ? getReactRouterModeName(routerMode)\n : 'React Router';\n return [\n `Analyzed your React Router project structure (${modeName})`,\n `Created and configured PostHog initializers`,\n `Integrated PostHog into your application`,\n ];\n },\n getOutroNextSteps: () => [\n 'Start your development server to see PostHog in action',\n 'Visit your PostHog dashboard to see incoming events',\n ],\n },\n};\n\n/**\n * React Router wizard powered by the universal agent runner.\n */\nexport async function runReactRouterWizardAgent(\n options: WizardOptions,\n): Promise<void> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n // Check React Router version - agent wizard requires >= 6.0.0\n const packageJson = await getPackageDotJson(options);\n const reactRouterVersion = getPackageVersion('react-router', packageJson);\n\n if (reactRouterVersion) {\n const coercedVersion = semver.coerce(reactRouterVersion);\n if (\n coercedVersion &&\n semver.lt(coercedVersion, MINIMUM_REACT_ROUTER_VERSION)\n ) {\n const docsUrl =\n REACT_ROUTER_AGENT_CONFIG.metadata.unsupportedVersionDocsUrl ??\n REACT_ROUTER_AGENT_CONFIG.metadata.docsUrl;\n\n clack.log.warn(\n `Sorry: the wizard can't help you with React Router ${reactRouterVersion}. Upgrade to React Router ${MINIMUM_REACT_ROUTER_VERSION} or later, or check out the manual setup guide.`,\n );\n clack.log.info(`Setup React Router manually: ${chalk.cyan(docsUrl)}`);\n clack.outro('PostHog wizard will see you next time!');\n return;\n }\n }\n\n await runAgentWizard(REACT_ROUTER_AGENT_CONFIG, options);\n}\n"]}
|
package/dist/src/run.js
CHANGED
|
@@ -17,6 +17,7 @@ const svelte_wizard_1 = require("./svelte/svelte-wizard");
|
|
|
17
17
|
const react_native_wizard_1 = require("./react-native/react-native-wizard");
|
|
18
18
|
const astro_wizard_1 = require("./astro/astro-wizard");
|
|
19
19
|
const react_router_wizard_agent_1 = require("./react-router/react-router-wizard-agent");
|
|
20
|
+
const django_wizard_agent_1 = require("./django/django-wizard-agent");
|
|
20
21
|
const events_1 = require("events");
|
|
21
22
|
const chalk_1 = __importDefault(require("chalk"));
|
|
22
23
|
const errors_1 = require("./utils/errors");
|
|
@@ -74,7 +75,8 @@ async function runWizard(argv) {
|
|
|
74
75
|
break;
|
|
75
76
|
case constants_1.Integration.reactRouter: {
|
|
76
77
|
const flagValue = await analytics_1.analytics.getFeatureFlag(constants_1.FeatureFlagDefinition.ReactRouter);
|
|
77
|
-
|
|
78
|
+
// In CI mode, bypass feature flags and always use the React Router wizard
|
|
79
|
+
if (wizardOptions.ci || flagValue === true) {
|
|
78
80
|
await (0, react_router_wizard_agent_1.runReactRouterWizardAgent)(wizardOptions);
|
|
79
81
|
}
|
|
80
82
|
else {
|
|
@@ -82,6 +84,10 @@ async function runWizard(argv) {
|
|
|
82
84
|
}
|
|
83
85
|
break;
|
|
84
86
|
}
|
|
87
|
+
case constants_1.Integration.django:
|
|
88
|
+
clack_1.default.log.info(`${chalk_1.default.yellow('[BETA]')} The Django wizard is in beta. Questions or feedback? Email ${chalk_1.default.cyan('wizard@posthog.com')}`);
|
|
89
|
+
await (0, django_wizard_agent_1.runDjangoWizardAgent)(wizardOptions);
|
|
90
|
+
break;
|
|
85
91
|
default:
|
|
86
92
|
clack_1.default.log.error('No setup wizard selected!');
|
|
87
93
|
}
|
|
@@ -124,6 +130,7 @@ async function getIntegrationForSetup(options) {
|
|
|
124
130
|
{ value: constants_1.Integration.astro, label: 'Astro' },
|
|
125
131
|
{ value: constants_1.Integration.react, label: 'React' },
|
|
126
132
|
{ value: constants_1.Integration.reactRouter, label: 'React Router' },
|
|
133
|
+
{ value: constants_1.Integration.django, label: 'Django' },
|
|
127
134
|
{ value: constants_1.Integration.svelte, label: 'Svelte' },
|
|
128
135
|
{ value: constants_1.Integration.reactNative, label: 'React Native' },
|
|
129
136
|
],
|