@posthog/wizard 1.31.2 → 1.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/bin.js +14 -1
- package/dist/bin.js.map +1 -1
- package/dist/src/__tests__/run.test.js +5 -5
- package/dist/src/__tests__/run.test.js.map +1 -1
- package/dist/src/android/android-wizard-agent.d.ts +6 -0
- package/dist/src/android/android-wizard-agent.js +140 -0
- package/dist/src/android/android-wizard-agent.js.map +1 -0
- package/dist/src/android/utils.d.ts +11 -0
- package/dist/src/android/utils.js +97 -0
- package/dist/src/android/utils.js.map +1 -0
- package/dist/src/angular/angular-wizard-agent.d.ts +4 -0
- package/dist/src/angular/angular-wizard-agent.js +67 -0
- package/dist/src/angular/angular-wizard-agent.js.map +1 -0
- package/dist/src/angular/utils.d.ts +4 -0
- package/dist/src/angular/utils.js +9 -0
- package/dist/src/angular/utils.js.map +1 -0
- package/dist/src/astro/astro-wizard-agent.d.ts +7 -0
- package/dist/src/astro/astro-wizard-agent.js +102 -0
- package/dist/src/astro/astro-wizard-agent.js.map +1 -0
- package/dist/src/astro/utils.d.ts +17 -0
- package/dist/src/astro/utils.js +163 -0
- package/dist/src/astro/utils.js.map +1 -0
- package/dist/src/django/django-wizard-agent.d.ts +8 -5
- package/dist/src/django/django-wizard-agent.js +62 -51
- package/dist/src/django/django-wizard-agent.js.map +1 -1
- package/dist/src/django/utils.d.ts +1 -1
- package/dist/src/django/utils.js +3 -22
- package/dist/src/django/utils.js.map +1 -1
- package/dist/src/fastapi/fastapi-wizard-agent.d.ts +7 -0
- package/dist/src/fastapi/fastapi-wizard-agent.js +217 -0
- package/dist/src/fastapi/fastapi-wizard-agent.js.map +1 -0
- package/dist/src/fastapi/utils.d.ts +26 -0
- package/dist/src/fastapi/utils.js +258 -0
- package/dist/src/fastapi/utils.js.map +1 -0
- package/dist/src/flask/flask-wizard-agent.d.ts +8 -5
- package/dist/src/flask/flask-wizard-agent.js +67 -51
- package/dist/src/flask/flask-wizard-agent.js.map +1 -1
- package/dist/src/flask/utils.d.ts +1 -1
- package/dist/src/flask/utils.js +3 -22
- package/dist/src/flask/utils.js.map +1 -1
- package/dist/src/laravel/laravel-wizard-agent.d.ts +10 -5
- package/dist/src/laravel/laravel-wizard-agent.js +50 -53
- package/dist/src/laravel/laravel-wizard-agent.js.map +1 -1
- package/dist/src/laravel/utils.d.ts +1 -1
- package/dist/src/laravel/utils.js +3 -22
- package/dist/src/laravel/utils.js.map +1 -1
- package/dist/src/lib/__tests__/agent-interface.test.js +1 -0
- package/dist/src/lib/__tests__/agent-interface.test.js.map +1 -1
- package/dist/src/lib/agent-interface.d.ts +4 -1
- package/dist/src/lib/agent-interface.js +42 -4
- package/dist/src/lib/agent-interface.js.map +1 -1
- package/dist/src/lib/agent-runner.js +65 -3
- package/dist/src/lib/agent-runner.js.map +1 -1
- package/dist/src/lib/api.d.ts +4 -4
- package/dist/src/lib/constants.d.ts +15 -14
- package/dist/src/lib/constants.js +17 -40
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/env-file-tools.d.ts +11 -0
- package/dist/src/lib/env-file-tools.js +154 -0
- package/dist/src/lib/env-file-tools.js.map +1 -0
- package/dist/src/lib/framework-config.d.ts +34 -16
- package/dist/src/lib/framework-config.js.map +1 -1
- package/dist/src/lib/registry.d.ts +3 -0
- package/dist/src/lib/registry.js +41 -0
- package/dist/src/lib/registry.js.map +1 -0
- package/dist/src/nextjs/nextjs-wizard-agent.d.ts +7 -5
- package/dist/src/nextjs/nextjs-wizard-agent.js +16 -79
- package/dist/src/nextjs/nextjs-wizard-agent.js.map +1 -1
- package/dist/src/nextjs/utils.d.ts +1 -1
- package/dist/src/nextjs/utils.js +3 -22
- package/dist/src/nextjs/utils.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard-agent.d.ts +6 -0
- package/dist/src/nuxt/nuxt-wizard-agent.js +77 -0
- package/dist/src/nuxt/nuxt-wizard-agent.js.map +1 -0
- package/dist/src/python/python-wizard-agent.d.ts +7 -0
- package/dist/src/python/python-wizard-agent.js +269 -0
- package/dist/src/python/python-wizard-agent.js.map +1 -0
- package/dist/src/python/utils.d.ts +28 -0
- package/dist/src/python/utils.js +147 -0
- package/dist/src/python/utils.js.map +1 -0
- package/dist/src/react-native/react-native-wizard-agent.d.ts +7 -0
- package/dist/src/react-native/react-native-wizard-agent.js +91 -0
- package/dist/src/react-native/react-native-wizard-agent.js.map +1 -0
- package/dist/src/react-native/utils.d.ts +8 -0
- package/dist/src/react-native/utils.js +31 -0
- package/dist/src/react-native/utils.js.map +1 -0
- package/dist/src/react-router/react-router-wizard-agent.d.ts +7 -5
- package/dist/src/react-router/react-router-wizard-agent.js +18 -80
- package/dist/src/react-router/react-router-wizard-agent.js.map +1 -1
- package/dist/src/react-router/utils.d.ts +1 -1
- package/dist/src/react-router/utils.js +3 -21
- package/dist/src/react-router/utils.js.map +1 -1
- package/dist/src/run.d.ts +1 -0
- package/dist/src/run.js +28 -76
- package/dist/src/run.js.map +1 -1
- package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.d.ts +6 -6
- 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 +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.d.ts +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.d.ts +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/clients/zed.d.ts +6 -6
- package/dist/src/steps/add-mcp-server-to-clients/defaults.d.ts +6 -6
- package/dist/src/svelte/svelte-wizard-agent.d.ts +4 -0
- package/dist/src/svelte/svelte-wizard-agent.js +60 -0
- package/dist/src/svelte/svelte-wizard-agent.js.map +1 -0
- package/dist/src/swift/swift-wizard-agent.d.ts +7 -0
- package/dist/src/swift/swift-wizard-agent.js +141 -0
- package/dist/src/swift/swift-wizard-agent.js.map +1 -0
- package/dist/src/swift/utils.d.ts +8 -0
- package/dist/src/swift/utils.js +105 -0
- package/dist/src/swift/utils.js.map +1 -0
- package/dist/src/tanstack-router/tanstack-router-wizard-agent.d.ts +7 -0
- package/dist/src/tanstack-router/tanstack-router-wizard-agent.js +93 -0
- package/dist/src/tanstack-router/tanstack-router-wizard-agent.js.map +1 -0
- package/dist/src/tanstack-router/utils.d.ts +17 -0
- package/dist/src/tanstack-router/utils.js +192 -0
- package/dist/src/tanstack-router/utils.js.map +1 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.d.ts +4 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.js +66 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.js.map +1 -0
- package/dist/src/tanstack-start/utils.d.ts +4 -0
- package/dist/src/tanstack-start/utils.js +9 -0
- package/dist/src/tanstack-start/utils.js.map +1 -0
- package/dist/src/utils/__tests__/semver.test.d.ts +1 -0
- package/dist/src/utils/__tests__/semver.test.js +117 -0
- package/dist/src/utils/__tests__/semver.test.js.map +1 -0
- package/dist/src/utils/clack-utils.js +2 -5
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/debug.d.ts +2 -0
- package/dist/src/utils/debug.js +17 -5
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/file-utils.d.ts +1 -31
- package/dist/src/utils/file-utils.js +0 -163
- package/dist/src/utils/file-utils.js.map +1 -1
- package/dist/src/utils/semver.d.ts +16 -0
- package/dist/src/utils/semver.js +37 -0
- package/dist/src/utils/semver.js.map +1 -1
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.js.map +1 -1
- package/dist/src/vue/vue-wizard-agent.d.ts +4 -0
- package/dist/src/vue/vue-wizard-agent.js +64 -0
- package/dist/src/vue/vue-wizard-agent.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/astro/astro-wizard.d.ts +0 -2
- package/dist/src/astro/astro-wizard.js +0 -89
- package/dist/src/astro/astro-wizard.js.map +0 -1
- package/dist/src/astro/docs.d.ts +0 -4
- package/dist/src/astro/docs.js +0 -101
- package/dist/src/astro/docs.js.map +0 -1
- package/dist/src/lib/config.d.ts +0 -104
- package/dist/src/lib/config.js +0 -368
- package/dist/src/lib/config.js.map +0 -1
- package/dist/src/lib/messages.d.ts +0 -16
- package/dist/src/lib/messages.js +0 -66
- package/dist/src/lib/messages.js.map +0 -1
- package/dist/src/lib/prompts.d.ts +0 -16
- package/dist/src/lib/prompts.js +0 -83
- package/dist/src/lib/prompts.js.map +0 -1
- package/dist/src/react/docs.d.ts +0 -4
- package/dist/src/react/docs.js +0 -49
- package/dist/src/react/docs.js.map +0 -1
- package/dist/src/react/react-wizard.d.ts +0 -2
- package/dist/src/react/react-wizard.js +0 -121
- package/dist/src/react/react-wizard.js.map +0 -1
- package/dist/src/react-native/docs.d.ts +0 -5
- package/dist/src/react-native/docs.js +0 -31
- package/dist/src/react-native/docs.js.map +0 -1
- package/dist/src/react-native/react-native-wizard.d.ts +0 -2
- package/dist/src/react-native/react-native-wizard.js +0 -128
- package/dist/src/react-native/react-native-wizard.js.map +0 -1
- package/dist/src/svelte/docs.d.ts +0 -3
- package/dist/src/svelte/docs.js +0 -111
- package/dist/src/svelte/docs.js.map +0 -1
- package/dist/src/svelte/svelte-wizard.d.ts +0 -2
- package/dist/src/svelte/svelte-wizard.js +0 -121
- package/dist/src/svelte/svelte-wizard.js.map +0 -1
- package/dist/src/utils/errors.d.ts +0 -3
- package/dist/src/utils/errors.js +0 -11
- package/dist/src/utils/errors.js.map +0 -1
- package/dist/src/utils/query.d.ts +0 -11
- package/dist/src/utils/query.js +0 -115
- package/dist/src/utils/query.js.map +0 -1
package/dist/src/lib/config.js
DELETED
|
@@ -1,368 +0,0 @@
|
|
|
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
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.INTEGRATION_ORDER = exports.INTEGRATION_CONFIG = void 0;
|
|
40
|
-
const clack_utils_1 = require("../utils/clack-utils");
|
|
41
|
-
const package_json_1 = require("../utils/package-json");
|
|
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"));
|
|
46
|
-
exports.INTEGRATION_CONFIG = {
|
|
47
|
-
[constants_1.Integration.nextjs]: {
|
|
48
|
-
name: 'Next.js',
|
|
49
|
-
filterPatterns: ['**/*.{tsx,ts,jsx,js,mjs,cjs}'],
|
|
50
|
-
ignorePatterns: [
|
|
51
|
-
'node_modules',
|
|
52
|
-
'dist',
|
|
53
|
-
'build',
|
|
54
|
-
'public',
|
|
55
|
-
'static',
|
|
56
|
-
'next-env.d.*',
|
|
57
|
-
],
|
|
58
|
-
detect: async (options) => {
|
|
59
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
60
|
-
return packageJson ? (0, package_json_1.hasPackageInstalled)('next', packageJson) : false;
|
|
61
|
-
},
|
|
62
|
-
generateFilesRules: '',
|
|
63
|
-
filterFilesRules: '',
|
|
64
|
-
docsUrl: 'https://posthog.com/docs/libraries/next-js',
|
|
65
|
-
defaultChanges: '• 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',
|
|
66
|
-
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
|
|
67
|
-
},
|
|
68
|
-
[constants_1.Integration.react]: {
|
|
69
|
-
name: 'React',
|
|
70
|
-
filterPatterns: ['**/*.{tsx,ts,jsx,js}'],
|
|
71
|
-
ignorePatterns: [
|
|
72
|
-
'node_modules',
|
|
73
|
-
'dist',
|
|
74
|
-
'build',
|
|
75
|
-
'public',
|
|
76
|
-
'static',
|
|
77
|
-
'assets',
|
|
78
|
-
],
|
|
79
|
-
detect: async (options) => {
|
|
80
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
81
|
-
return packageJson ? (0, package_json_1.hasPackageInstalled)('react', packageJson) : false;
|
|
82
|
-
},
|
|
83
|
-
generateFilesRules: '',
|
|
84
|
-
filterFilesRules: '',
|
|
85
|
-
docsUrl: 'https://posthog.com/docs/libraries/react',
|
|
86
|
-
defaultChanges: '• Installed posthog-js package\n• Added PostHogProvider to the root of the app, to initialize PostHog and enable autocapture',
|
|
87
|
-
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
|
|
88
|
-
},
|
|
89
|
-
[constants_1.Integration.svelte]: {
|
|
90
|
-
name: 'Svelte',
|
|
91
|
-
filterPatterns: ['**/*.{svelte,ts,js,jsx,tsx}'],
|
|
92
|
-
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
93
|
-
detect: async (options) => {
|
|
94
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
95
|
-
return packageJson
|
|
96
|
-
? (0, package_json_1.hasPackageInstalled)('@sveltejs/kit', packageJson)
|
|
97
|
-
: false;
|
|
98
|
-
},
|
|
99
|
-
generateFilesRules: '',
|
|
100
|
-
filterFilesRules: '',
|
|
101
|
-
docsUrl: 'https://posthog.com/docs/libraries/svelte',
|
|
102
|
-
defaultChanges: '• 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',
|
|
103
|
-
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Use getPostHogClient() to start capturing events server - side',
|
|
104
|
-
},
|
|
105
|
-
[constants_1.Integration.reactNative]: {
|
|
106
|
-
name: 'React Native',
|
|
107
|
-
filterPatterns: ['**/*.{ts,js,jsx,tsx}'],
|
|
108
|
-
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
109
|
-
detect: async (options) => {
|
|
110
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
111
|
-
return packageJson
|
|
112
|
-
? (0, package_json_1.hasPackageInstalled)('react-native', packageJson)
|
|
113
|
-
: false;
|
|
114
|
-
},
|
|
115
|
-
generateFilesRules: '',
|
|
116
|
-
filterFilesRules: '',
|
|
117
|
-
docsUrl: 'https://posthog.com/docs/libraries/react-native',
|
|
118
|
-
defaultChanges: '• Installed required packages\n• Added PostHogProvider to the root of the app\n• Enabled autocapture and session replay',
|
|
119
|
-
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
|
|
120
|
-
},
|
|
121
|
-
[constants_1.Integration.astro]: {
|
|
122
|
-
name: 'Astro',
|
|
123
|
-
filterPatterns: ['**/*.{astro,ts,js,jsx,tsx}'],
|
|
124
|
-
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
|
|
125
|
-
detect: async (options) => {
|
|
126
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
127
|
-
return packageJson ? (0, package_json_1.hasPackageInstalled)('astro', packageJson) : false;
|
|
128
|
-
},
|
|
129
|
-
generateFilesRules: '',
|
|
130
|
-
filterFilesRules: '',
|
|
131
|
-
docsUrl: 'https://posthog.com/docs/libraries/js',
|
|
132
|
-
defaultChanges: '• Added PostHog component with initialization script\n• Created PostHogLayout for consistent analytics tracking',
|
|
133
|
-
nextSteps: '• 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',
|
|
134
|
-
},
|
|
135
|
-
[constants_1.Integration.reactRouter]: {
|
|
136
|
-
name: 'React Router',
|
|
137
|
-
filterPatterns: ['**/*.{tsx,ts,jsx,js}'],
|
|
138
|
-
ignorePatterns: [
|
|
139
|
-
'node_modules',
|
|
140
|
-
'dist',
|
|
141
|
-
'build',
|
|
142
|
-
'public',
|
|
143
|
-
'static',
|
|
144
|
-
'assets',
|
|
145
|
-
],
|
|
146
|
-
detect: async (options) => {
|
|
147
|
-
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
148
|
-
return packageJson
|
|
149
|
-
? (0, package_json_1.hasPackageInstalled)('react-router', packageJson)
|
|
150
|
-
: false;
|
|
151
|
-
},
|
|
152
|
-
generateFilesRules: '',
|
|
153
|
-
filterFilesRules: '',
|
|
154
|
-
docsUrl: 'https://posthog-git-react-post-hog.vercel.app/docs/libraries/react-router',
|
|
155
|
-
defaultChanges: '• Installed posthog-js package\n• Added PostHogProvider to the root of the app\n• Integrated PostHog with React Router for pageview tracking',
|
|
156
|
-
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
|
|
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
|
-
},
|
|
226
|
-
[constants_1.Integration.flask]: {
|
|
227
|
-
name: 'Flask',
|
|
228
|
-
filterPatterns: ['**/*.py'],
|
|
229
|
-
ignorePatterns: [
|
|
230
|
-
'node_modules',
|
|
231
|
-
'dist',
|
|
232
|
-
'build',
|
|
233
|
-
'public',
|
|
234
|
-
'static',
|
|
235
|
-
'venv',
|
|
236
|
-
'.venv',
|
|
237
|
-
'env',
|
|
238
|
-
'.env',
|
|
239
|
-
'__pycache__',
|
|
240
|
-
'*.pyc',
|
|
241
|
-
'migrations',
|
|
242
|
-
'instance',
|
|
243
|
-
],
|
|
244
|
-
detect: async (options) => {
|
|
245
|
-
const { installDir } = options;
|
|
246
|
-
// Note: Django is checked before Flask in INTEGRATION_ORDER,
|
|
247
|
-
// so if we get here, the project is not a Django project.
|
|
248
|
-
// Check for Flask in requirements files
|
|
249
|
-
const requirementsFiles = await (0, fast_glob_1.default)([
|
|
250
|
-
'**/requirements*.txt',
|
|
251
|
-
'**/pyproject.toml',
|
|
252
|
-
'**/setup.py',
|
|
253
|
-
'**/Pipfile',
|
|
254
|
-
], {
|
|
255
|
-
cwd: installDir,
|
|
256
|
-
ignore: ['**/venv/**', '**/.venv/**', '**/env/**', '**/.env/**'],
|
|
257
|
-
});
|
|
258
|
-
for (const reqFile of requirementsFiles) {
|
|
259
|
-
try {
|
|
260
|
-
const content = fs.readFileSync(path.join(installDir, reqFile), 'utf-8');
|
|
261
|
-
// Check for flask package (case-insensitive)
|
|
262
|
-
// Match "flask" as a standalone package, not just as part of plugin names
|
|
263
|
-
if (/^flask([<>=~!]|$|\s)/im.test(content) ||
|
|
264
|
-
/["']flask["']/i.test(content)) {
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
catch {
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
// Check for Flask app patterns in Python files
|
|
273
|
-
const pyFiles = await (0, fast_glob_1.default)(['**/app.py', '**/wsgi.py', '**/application.py', '**/__init__.py'], {
|
|
274
|
-
cwd: installDir,
|
|
275
|
-
ignore: [
|
|
276
|
-
'**/venv/**',
|
|
277
|
-
'**/.venv/**',
|
|
278
|
-
'**/env/**',
|
|
279
|
-
'**/.env/**',
|
|
280
|
-
'**/__pycache__/**',
|
|
281
|
-
],
|
|
282
|
-
});
|
|
283
|
-
for (const pyFile of pyFiles) {
|
|
284
|
-
try {
|
|
285
|
-
const content = fs.readFileSync(path.join(installDir, pyFile), 'utf-8');
|
|
286
|
-
if (content.includes('from flask import') ||
|
|
287
|
-
content.includes('import flask') ||
|
|
288
|
-
/Flask\s*\(/.test(content)) {
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return false;
|
|
297
|
-
},
|
|
298
|
-
generateFilesRules: '',
|
|
299
|
-
filterFilesRules: '',
|
|
300
|
-
docsUrl: 'https://posthog.com/docs/libraries/flask',
|
|
301
|
-
defaultChanges: '• Installed posthog Python package\n• Added PostHog initialization to your Flask app\n• Configured automatic event tracking',
|
|
302
|
-
nextSteps: '• Use posthog.identify() to associate events with users\n• Call posthog.capture() to capture custom events\n• Use feature flags with posthog.feature_enabled()',
|
|
303
|
-
},
|
|
304
|
-
[constants_1.Integration.laravel]: {
|
|
305
|
-
name: 'Laravel',
|
|
306
|
-
filterPatterns: ['**/*.php'],
|
|
307
|
-
ignorePatterns: [
|
|
308
|
-
'node_modules',
|
|
309
|
-
'vendor',
|
|
310
|
-
'storage',
|
|
311
|
-
'bootstrap/cache',
|
|
312
|
-
'public/build',
|
|
313
|
-
'public/hot',
|
|
314
|
-
'.phpunit.cache',
|
|
315
|
-
],
|
|
316
|
-
detect: async (options) => {
|
|
317
|
-
const { installDir } = options;
|
|
318
|
-
// Primary check: artisan file (definitive Laravel indicator)
|
|
319
|
-
const artisanPath = path.join(installDir, 'artisan');
|
|
320
|
-
if (fs.existsSync(artisanPath)) {
|
|
321
|
-
try {
|
|
322
|
-
const content = fs.readFileSync(artisanPath, 'utf-8');
|
|
323
|
-
if (content.includes('Laravel') || content.includes('Artisan')) {
|
|
324
|
-
return true;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
catch {
|
|
328
|
-
// Continue to other checks
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
// Secondary check: composer.json with laravel/framework
|
|
332
|
-
const composerPath = path.join(installDir, 'composer.json');
|
|
333
|
-
if (fs.existsSync(composerPath)) {
|
|
334
|
-
try {
|
|
335
|
-
const content = fs.readFileSync(composerPath, 'utf-8');
|
|
336
|
-
const composer = JSON.parse(content);
|
|
337
|
-
if (composer.require?.['laravel/framework'] ||
|
|
338
|
-
composer['require-dev']?.['laravel/framework']) {
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
// Continue to other checks
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
// Tertiary check: Laravel-specific directory structure
|
|
347
|
-
const hasLaravelStructure = await (0, fast_glob_1.default)(['**/bootstrap/app.php', '**/app/Http/Kernel.php'], { cwd: installDir, ignore: ['**/vendor/**'] });
|
|
348
|
-
return hasLaravelStructure.length > 0;
|
|
349
|
-
},
|
|
350
|
-
generateFilesRules: '',
|
|
351
|
-
filterFilesRules: '',
|
|
352
|
-
docsUrl: 'https://posthog.com/docs/libraries/php',
|
|
353
|
-
defaultChanges: '• Installed posthog/posthog-php via Composer\n• Added PostHog service provider\n• Configured automatic event tracking',
|
|
354
|
-
nextSteps: '• Use PostHog::capture() to track custom events\n• Use PostHog::identify() to associate events with users',
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
exports.INTEGRATION_ORDER = [
|
|
358
|
-
constants_1.Integration.nextjs,
|
|
359
|
-
constants_1.Integration.astro,
|
|
360
|
-
constants_1.Integration.svelte,
|
|
361
|
-
constants_1.Integration.reactNative,
|
|
362
|
-
constants_1.Integration.reactRouter,
|
|
363
|
-
constants_1.Integration.django,
|
|
364
|
-
constants_1.Integration.flask,
|
|
365
|
-
constants_1.Integration.laravel,
|
|
366
|
-
constants_1.Integration.react,
|
|
367
|
-
];
|
|
368
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAC9C,CAAC;wBACD,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,2BAA2B;gBAC7B,CAAC;YACH,CAAC;YAED,uDAAuD;YACvD,MAAM,mBAAmB,GAAG,MAAM,IAAA,mBAAE,EAClC,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,EAClD,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,CAC9C,CAAC;YAEF,OAAO,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;QACxC,CAAC;QACD,kBAAkB,EAAE,EAAE;QACtB,gBAAgB,EAAE,EAAE;QACpB,OAAO,EAAE,wCAAwC;QACjD,cAAc,EACZ,uHAAuH;QACzH,SAAS,EACP,2GAA2G;KAC9G;CACwD,CAAC;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;IACjB,uBAAW,CAAC,OAAO;IACnB,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 [Integration.flask]: {\n name: 'Flask',\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 'instance',\n ],\n detect: async (options) => {\n const { installDir } = options;\n\n // Note: Django is checked before Flask in INTEGRATION_ORDER,\n // so if we get here, the project is not a Django project.\n\n // Check for Flask in requirements files\n const requirementsFiles = await fg(\n [\n '**/requirements*.txt',\n '**/pyproject.toml',\n '**/setup.py',\n '**/Pipfile',\n ],\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 flask package (case-insensitive)\n // Match \"flask\" as a standalone package, not just as part of plugin names\n if (\n /^flask([<>=~!]|$|\\s)/im.test(content) ||\n /[\"']flask[\"']/i.test(content)\n ) {\n return true;\n }\n } catch {\n continue;\n }\n }\n\n // Check for Flask app patterns in Python files\n const pyFiles = await fg(\n ['**/app.py', '**/wsgi.py', '**/application.py', '**/__init__.py'],\n {\n cwd: installDir,\n ignore: [\n '**/venv/**',\n '**/.venv/**',\n '**/env/**',\n '**/.env/**',\n '**/__pycache__/**',\n ],\n },\n );\n\n for (const pyFile of pyFiles) {\n try {\n const content = fs.readFileSync(\n path.join(installDir, pyFile),\n 'utf-8',\n );\n if (\n content.includes('from flask import') ||\n content.includes('import flask') ||\n /Flask\\s*\\(/.test(content)\n ) {\n return true;\n }\n } catch {\n continue;\n }\n }\n\n return false;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/flask',\n defaultChanges:\n '• Installed posthog Python package\\n• Added PostHog initialization to your Flask app\\n• Configured automatic event tracking',\n nextSteps:\n '• Use posthog.identify() to associate events with users\\n• Call posthog.capture() to capture custom events\\n• Use feature flags with posthog.feature_enabled()',\n },\n [Integration.laravel]: {\n name: 'Laravel',\n filterPatterns: ['**/*.php'],\n ignorePatterns: [\n 'node_modules',\n 'vendor',\n 'storage',\n 'bootstrap/cache',\n 'public/build',\n 'public/hot',\n '.phpunit.cache',\n ],\n detect: async (options) => {\n const { installDir } = options;\n\n // Primary check: artisan file (definitive Laravel indicator)\n const artisanPath = path.join(installDir, 'artisan');\n if (fs.existsSync(artisanPath)) {\n try {\n const content = fs.readFileSync(artisanPath, 'utf-8');\n if (content.includes('Laravel') || content.includes('Artisan')) {\n return true;\n }\n } catch {\n // Continue to other checks\n }\n }\n\n // Secondary check: composer.json with laravel/framework\n const composerPath = path.join(installDir, 'composer.json');\n if (fs.existsSync(composerPath)) {\n try {\n const content = fs.readFileSync(composerPath, 'utf-8');\n const composer = JSON.parse(content);\n if (\n composer.require?.['laravel/framework'] ||\n composer['require-dev']?.['laravel/framework']\n ) {\n return true;\n }\n } catch {\n // Continue to other checks\n }\n }\n\n // Tertiary check: Laravel-specific directory structure\n const hasLaravelStructure = await fg(\n ['**/bootstrap/app.php', '**/app/Http/Kernel.php'],\n { cwd: installDir, ignore: ['**/vendor/**'] },\n );\n\n return hasLaravelStructure.length > 0;\n },\n generateFilesRules: '',\n filterFilesRules: '',\n docsUrl: 'https://posthog.com/docs/libraries/php',\n defaultChanges:\n '• Installed posthog/posthog-php via Composer\\n• Added PostHog service provider\\n• Configured automatic event tracking',\n nextSteps:\n '• Use PostHog::capture() to track custom events\\n• Use PostHog::identify() to associate events with users',\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.flask,\n Integration.laravel,\n Integration.react,\n] as const;\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CloudRegion, WizardOptions } from '../utils/types';
|
|
2
|
-
import type { PackageManager } from '../utils/package-manager';
|
|
3
|
-
import { Integration } from './constants';
|
|
4
|
-
export declare const getPRDescription: ({ integration, addedEditorRules, }: {
|
|
5
|
-
integration: Integration;
|
|
6
|
-
addedEditorRules: boolean;
|
|
7
|
-
}) => string;
|
|
8
|
-
export declare const getOutroMessage: ({ options, integration, cloudRegion, addedEditorRules, packageManager, envFileChanged, uploadedEnvVars, }: {
|
|
9
|
-
options: WizardOptions;
|
|
10
|
-
integration: Integration;
|
|
11
|
-
cloudRegion: CloudRegion;
|
|
12
|
-
addedEditorRules: boolean;
|
|
13
|
-
packageManager?: PackageManager;
|
|
14
|
-
envFileChanged?: string;
|
|
15
|
-
uploadedEnvVars: string[];
|
|
16
|
-
}) => string;
|
package/dist/src/lib/messages.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
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.getOutroMessage = exports.getPRDescription = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const urls_1 = require("../utils/urls");
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
const config_1 = require("./config");
|
|
11
|
-
const getPRDescription = ({ integration, addedEditorRules, }) => {
|
|
12
|
-
const integrationConfig = config_1.INTEGRATION_CONFIG[integration];
|
|
13
|
-
return `This PR adds an integration for PostHog.
|
|
14
|
-
|
|
15
|
-
The following changes were made:
|
|
16
|
-
${integrationConfig.defaultChanges}
|
|
17
|
-
${addedEditorRules ? `• Added Cursor rules for PostHog\n` : ''}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Note: This used the ${integrationConfig.name} wizard to setup PostHog, this is still in alpha and like all AI, might have got it wrong. Please check the installation carefully!
|
|
21
|
-
|
|
22
|
-
Learn more about PostHog + ${integrationConfig.name}: ${integrationConfig.docsUrl}`;
|
|
23
|
-
};
|
|
24
|
-
exports.getPRDescription = getPRDescription;
|
|
25
|
-
const getOutroMessage = ({ options, integration, cloudRegion, addedEditorRules, packageManager, envFileChanged, uploadedEnvVars, }) => {
|
|
26
|
-
const continueUrl = options.signup
|
|
27
|
-
? `${(0, urls_1.getCloudUrlFromRegion)(cloudRegion)}/products?source=wizard`
|
|
28
|
-
: undefined;
|
|
29
|
-
const integrationConfig = config_1.INTEGRATION_CONFIG[integration];
|
|
30
|
-
const changes = [
|
|
31
|
-
addedEditorRules ? `Added Cursor rules for PostHog` : '',
|
|
32
|
-
envFileChanged
|
|
33
|
-
? `Added your Project API key to your ${envFileChanged} file`
|
|
34
|
-
: '',
|
|
35
|
-
uploadedEnvVars.length > 0
|
|
36
|
-
? `Uploaded your Project API key to your hosting provider`
|
|
37
|
-
: '',
|
|
38
|
-
].filter(Boolean);
|
|
39
|
-
const nextSteps = [
|
|
40
|
-
uploadedEnvVars.length === 0
|
|
41
|
-
? `Upload your Project API key to your hosting provider`
|
|
42
|
-
: '',
|
|
43
|
-
].filter(Boolean);
|
|
44
|
-
return `
|
|
45
|
-
${chalk_1.default.green('Successfully installed PostHog!')}
|
|
46
|
-
|
|
47
|
-
${chalk_1.default.cyan('Changes made:')}
|
|
48
|
-
${integrationConfig.defaultChanges}
|
|
49
|
-
${changes.map((change) => `• ${change}`).join('\n')}
|
|
50
|
-
|
|
51
|
-
${chalk_1.default.yellow('Next steps:')}
|
|
52
|
-
${integrationConfig.nextSteps}
|
|
53
|
-
${nextSteps.map((step) => `• ${step}`).join('\n')}
|
|
54
|
-
|
|
55
|
-
Learn more about PostHog + ${integrationConfig.name}: ${chalk_1.default.cyan(integrationConfig.docsUrl)}
|
|
56
|
-
${continueUrl ? `\nContinue onboarding: ${chalk_1.default.cyan(continueUrl)}\n` : ``}
|
|
57
|
-
Note: This uses experimental AI to setup your project. It might have got it wrong, please check!
|
|
58
|
-
|
|
59
|
-
You should validate your setup by (re)starting your dev environment${packageManager
|
|
60
|
-
? ` (e.g. ${chalk_1.default.cyan(`${packageManager.runScriptCommand} dev`)}).`
|
|
61
|
-
: `.`}
|
|
62
|
-
|
|
63
|
-
${chalk_1.default.dim(`If you encounter any issues, let us know here: ${constants_1.ISSUES_URL}`)}`;
|
|
64
|
-
};
|
|
65
|
-
exports.getOutroMessage = getOutroMessage;
|
|
66
|
-
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/lib/messages.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,wCAAsD;AAEtD,2CAAsD;AACtD,qCAA8C;AAEvC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,WAAW,EACX,gBAAgB,GAIjB,EAAE,EAAE;IACH,MAAM,iBAAiB,GAAG,2BAAkB,CAAC,WAAW,CAAC,CAAC;IAE1D,OAAO;;;IAGL,iBAAiB,CAAC,cAAc;IAChC,gBAAgB,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,EAAE;;;wBAI5D,iBAAiB,CAAC,IACpB;;+BAE6B,iBAAiB,CAAC,IAAI,KACjD,iBAAiB,CAAC,OACpB,EAAE,CAAC;AACL,CAAC,CAAC;AAvBW,QAAA,gBAAgB,oBAuB3B;AAEK,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,GAShB,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM;QAChC,CAAC,CAAC,GAAG,IAAA,4BAAqB,EAAC,WAAW,CAAC,yBAAyB;QAChE,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,iBAAiB,GAAG,2BAAkB,CAAC,WAAW,CAAC,CAAC;IAE1D,MAAM,OAAO,GAAG;QACd,gBAAgB,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,EAAE;QACxD,cAAc;YAC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chalk';\nimport type { CloudRegion, WizardOptions } from '../utils/types';\nimport { getCloudUrlFromRegion } from '../utils/urls';\nimport type { PackageManager } from '../utils/package-manager';\nimport { ISSUES_URL, Integration } from './constants';\nimport { INTEGRATION_CONFIG } from './config';\n\nexport const getPRDescription = ({\n integration,\n addedEditorRules,\n}: {\n integration: Integration;\n addedEditorRules: boolean;\n}) => {\n const integrationConfig = INTEGRATION_CONFIG[integration];\n\n return `This PR adds an integration for PostHog.\n\n The following changes were made:\n ${integrationConfig.defaultChanges}\n ${addedEditorRules ? `• Added Cursor rules for PostHog\\n` : ''}\n \n \n Note: This used the ${\n integrationConfig.name\n } wizard to setup PostHog, this is still in alpha and like all AI, might have got it wrong. Please check the installation carefully!\n \n Learn more about PostHog + ${integrationConfig.name}: ${\n integrationConfig.docsUrl\n }`;\n};\n\nexport const getOutroMessage = ({\n options,\n integration,\n cloudRegion,\n addedEditorRules,\n packageManager,\n envFileChanged,\n uploadedEnvVars,\n}: {\n options: WizardOptions;\n integration: Integration;\n cloudRegion: CloudRegion;\n addedEditorRules: boolean;\n packageManager?: PackageManager;\n envFileChanged?: string;\n uploadedEnvVars: string[];\n}) => {\n const continueUrl = options.signup\n ? `${getCloudUrlFromRegion(cloudRegion)}/products?source=wizard`\n : undefined;\n\n const integrationConfig = INTEGRATION_CONFIG[integration];\n\n const changes = [\n addedEditorRules ? `Added Cursor rules for PostHog` : '',\n envFileChanged\n ? `Added your Project API key to your ${envFileChanged} file`\n : '',\n uploadedEnvVars.length > 0\n ? `Uploaded your Project API key to your hosting provider`\n : '',\n ].filter(Boolean);\n\n const nextSteps = [\n uploadedEnvVars.length === 0\n ? `Upload your Project API key to your hosting provider`\n : '',\n ].filter(Boolean);\n\n return `\n${chalk.green('Successfully installed PostHog!')} \n \n${chalk.cyan('Changes made:')}\n${integrationConfig.defaultChanges}\n${changes.map((change) => `• ${change}`).join('\\n')}\n\n${chalk.yellow('Next steps:')}\n${integrationConfig.nextSteps}\n${nextSteps.map((step) => `• ${step}`).join('\\n')}\n\nLearn more about PostHog + ${integrationConfig.name}: ${chalk.cyan(\n integrationConfig.docsUrl,\n )}\n${continueUrl ? `\\nContinue onboarding: ${chalk.cyan(continueUrl)}\\n` : ``}\nNote: This uses experimental AI to setup your project. It might have got it wrong, please check!\n\nYou should validate your setup by (re)starting your dev environment${\n packageManager\n ? ` (e.g. ${chalk.cyan(`${packageManager.runScriptCommand} dev`)}).`\n : `.`\n }\n\n${chalk.dim(`If you encounter any issues, let us know here: ${ISSUES_URL}`)}`;\n};\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PromptTemplate } from '@langchain/core/prompts';
|
|
2
|
-
export declare const baseFilterFilesPromptTemplate: PromptTemplate<{
|
|
3
|
-
documentation: any;
|
|
4
|
-
file_list: any;
|
|
5
|
-
integration_name: any;
|
|
6
|
-
integration_rules: any;
|
|
7
|
-
}, any>;
|
|
8
|
-
export declare const baseGenerateFileChangesPromptTemplate: PromptTemplate<{
|
|
9
|
-
documentation: any;
|
|
10
|
-
integration_name: any;
|
|
11
|
-
integration_rules: any;
|
|
12
|
-
file_content: any;
|
|
13
|
-
file_path: any;
|
|
14
|
-
changed_files: any;
|
|
15
|
-
unchanged_files: any;
|
|
16
|
-
}, any>;
|
package/dist/src/lib/prompts.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseGenerateFileChangesPromptTemplate = exports.baseFilterFilesPromptTemplate = void 0;
|
|
4
|
-
const prompts_1 = require("@langchain/core/prompts");
|
|
5
|
-
exports.baseFilterFilesPromptTemplate = new prompts_1.PromptTemplate({
|
|
6
|
-
inputVariables: [
|
|
7
|
-
'documentation',
|
|
8
|
-
'file_list',
|
|
9
|
-
'integration_name',
|
|
10
|
-
'integration_rules',
|
|
11
|
-
],
|
|
12
|
-
template: `You are a PostHog installation wizard, a master AI programming assistant that implements PostHog for {integration_name} projects.
|
|
13
|
-
Given the following list of file paths from a project, determine which files are likely to require modifications
|
|
14
|
-
to integrate PostHog. Use the installation documentation as a reference for what files might need modifications, do not include files that are unlikely to require modification based on the documentation.
|
|
15
|
-
|
|
16
|
-
- If you would like to create a new file, you can include the file path in your response.
|
|
17
|
-
- If you would like to modify an existing file, you can include the file path in your response.
|
|
18
|
-
|
|
19
|
-
You should return all files that you think will be required to look at or modify to integrate PostHog. You should return them in the order you would like to see them processed, with new files first, followed by the files that you want to update to integrate PostHog.
|
|
20
|
-
|
|
21
|
-
Rules:
|
|
22
|
-
- Only return files that you think will be required to look at or modify to integrate PostHog.
|
|
23
|
-
- Do not return files that are unlikely to require modification based on the documentation.
|
|
24
|
-
- If you are unsure, return the file, since it's better to have more files than less.
|
|
25
|
-
- If two files might include the content you need to edit, return both.
|
|
26
|
-
- If you create a new file, it should not conflict with any existing files.
|
|
27
|
-
- If the user is using TypeScript, you should return .ts and .tsx files.
|
|
28
|
-
- The file structure of the project may be different than the documentation, you should follow the file structure of the project. e.g. if there is an existing file containing providers, you should edit that file instead of creating a new one.
|
|
29
|
-
{integration_rules}
|
|
30
|
-
- Look for existing files that contain providers, components, hooks, etc. and edit those files instead of creating new ones if appropriate.
|
|
31
|
-
|
|
32
|
-
Installation documentation:
|
|
33
|
-
{documentation}
|
|
34
|
-
|
|
35
|
-
All current files in the repository:
|
|
36
|
-
|
|
37
|
-
{file_list}`,
|
|
38
|
-
});
|
|
39
|
-
exports.baseGenerateFileChangesPromptTemplate = new prompts_1.PromptTemplate({
|
|
40
|
-
inputVariables: [
|
|
41
|
-
'file_content',
|
|
42
|
-
'documentation',
|
|
43
|
-
'file_path',
|
|
44
|
-
'changed_files',
|
|
45
|
-
'unchanged_files',
|
|
46
|
-
'integration_name',
|
|
47
|
-
'integration_rules',
|
|
48
|
-
],
|
|
49
|
-
template: `You are a PostHog installation wizard, a master AI programming assistant that implements PostHog for {integration_name} projects.
|
|
50
|
-
|
|
51
|
-
Your task is to update the file to integrate PostHog according to the documentation.
|
|
52
|
-
Do not return a diff — you should return the complete updated file content.
|
|
53
|
-
|
|
54
|
-
Rules:
|
|
55
|
-
- Preserve the existing code formatting and style.
|
|
56
|
-
- Only make the changes required by the documentation.
|
|
57
|
-
- If no changes are needed, return the file as-is.
|
|
58
|
-
- If the current file is empty, and you think it should be created, you can add the contents of the new file.
|
|
59
|
-
- The file structure of the project may be different than the documentation, you should follow the file structure of the project.
|
|
60
|
-
- Use relative imports if you are unsure what the project import paths are.
|
|
61
|
-
- It's okay not to edit a file if it's not needed (e.g. if you have already edited another one or this one is not needed).
|
|
62
|
-
{integration_rules}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
CONTEXT
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
Documentation for integrating PostHog with {integration_name}:
|
|
69
|
-
{documentation}
|
|
70
|
-
|
|
71
|
-
The file you are updating is:
|
|
72
|
-
{file_path}
|
|
73
|
-
|
|
74
|
-
Here are the changes you have already made to the project:
|
|
75
|
-
{changed_files}
|
|
76
|
-
|
|
77
|
-
Here are the files that have not been changed yet:
|
|
78
|
-
{unchanged_files}
|
|
79
|
-
|
|
80
|
-
Below is the current file contents:
|
|
81
|
-
{file_content}`,
|
|
82
|
-
});
|
|
83
|
-
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/lib/prompts.ts"],"names":[],"mappings":";;;AAAA,qDAAyD;AAE5C,QAAA,6BAA6B,GAAG,IAAI,wBAAc,CAAC;IAC9D,cAAc,EAAE;QACd,eAAe;QACf,WAAW;QACX,kBAAkB;QAClB,mBAAmB;KACpB;IACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;YAyBA;CACX,CAAC,CAAC;AAEU,QAAA,qCAAqC,GAAG,IAAI,wBAAc,CAAC;IACtE,cAAc,EAAE;QACd,cAAc;QACd,eAAe;QACf,WAAW;QACX,eAAe;QACf,iBAAiB;QACjB,kBAAkB;QAClB,mBAAmB;KACpB;IACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgCG;CACd,CAAC,CAAC","sourcesContent":["import { PromptTemplate } from '@langchain/core/prompts';\n\nexport const baseFilterFilesPromptTemplate = new PromptTemplate({\n inputVariables: [\n 'documentation',\n 'file_list',\n 'integration_name',\n 'integration_rules',\n ],\n template: `You are a PostHog installation wizard, a master AI programming assistant that implements PostHog for {integration_name} projects.\nGiven the following list of file paths from a project, determine which files are likely to require modifications \nto integrate PostHog. Use the installation documentation as a reference for what files might need modifications, do not include files that are unlikely to require modification based on the documentation.\n\n- If you would like to create a new file, you can include the file path in your response.\n- If you would like to modify an existing file, you can include the file path in your response.\n\nYou should return all files that you think will be required to look at or modify to integrate PostHog. You should return them in the order you would like to see them processed, with new files first, followed by the files that you want to update to integrate PostHog.\n\nRules:\n- Only return files that you think will be required to look at or modify to integrate PostHog.\n- Do not return files that are unlikely to require modification based on the documentation.\n- If you are unsure, return the file, since it's better to have more files than less.\n- If two files might include the content you need to edit, return both.\n- If you create a new file, it should not conflict with any existing files.\n- If the user is using TypeScript, you should return .ts and .tsx files.\n- The file structure of the project may be different than the documentation, you should follow the file structure of the project. e.g. if there is an existing file containing providers, you should edit that file instead of creating a new one.\n{integration_rules}\n- Look for existing files that contain providers, components, hooks, etc. and edit those files instead of creating new ones if appropriate.\n\nInstallation documentation:\n{documentation}\n\nAll current files in the repository:\n\n{file_list}`,\n});\n\nexport const baseGenerateFileChangesPromptTemplate = new PromptTemplate({\n inputVariables: [\n 'file_content',\n 'documentation',\n 'file_path',\n 'changed_files',\n 'unchanged_files',\n 'integration_name',\n 'integration_rules',\n ],\n template: `You are a PostHog installation wizard, a master AI programming assistant that implements PostHog for {integration_name} projects.\n\nYour task is to update the file to integrate PostHog according to the documentation.\nDo not return a diff — you should return the complete updated file content.\n\nRules:\n- Preserve the existing code formatting and style.\n- Only make the changes required by the documentation.\n- If no changes are needed, return the file as-is.\n- If the current file is empty, and you think it should be created, you can add the contents of the new file.\n- The file structure of the project may be different than the documentation, you should follow the file structure of the project.\n- Use relative imports if you are unsure what the project import paths are.\n- It's okay not to edit a file if it's not needed (e.g. if you have already edited another one or this one is not needed).\n{integration_rules}\n\n\nCONTEXT\n---\n\nDocumentation for integrating PostHog with {integration_name}:\n{documentation}\n\nThe file you are updating is:\n{file_path}\n\nHere are the changes you have already made to the project:\n{changed_files}\n\nHere are the files that have not been changed yet:\n{unchanged_files}\n\nBelow is the current file contents:\n{file_content}`,\n});\n"]}
|
package/dist/src/react/docs.d.ts
DELETED