@posthog/wizard 1.31.1 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +36 -3
- package/dist/src/lib/agent-interface.js.map +1 -1
- package/dist/src/lib/agent-runner.js +69 -6
- 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 +3 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/utils/semver.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/utils/semver.ts"],"names":[],"mappings":";;AASA,oDA8BC;AAiBD,kDAoBC;AA5ED,mCAOgB;AAEhB,SAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,kBAAkB,EAClB,WAAW,GAKZ;IACC,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,kBAAkB,EAAE,OAAO,CAAC;IAEhC,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,EAAE,CAAC;QACnB,kBAAkB,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC;QACpC,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;SAAM,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,kBAAkB,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACzC,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IAED,OAAO;IACL,yGAAyG;IACzG,CAAC,CAAC,kBAAkB;QACpB,CAAC,OAAO;YACN,CAAC,CAAC,IAAA,eAAM,EAAC,kBAAkB,EAAE,kBAAkB,CAAC;YAChD,CAAC,CAAC,IAAA,kBAAS,EAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CACvD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,mBAAmB,CAAC,eAAwB;IAC1D,OAAO,CAAC,OAA2B,EAAU,EAAE;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC;YACnC,IAAI,eAAe,KAAK,SAAS,IAAI,YAAY,GAAG,eAAe,EAAE,CAAC;gBACpE,OAAO,IAAI,eAAe,MAAM,CAAC;YACnC,CAAC;YACD,OAAO,GAAG,YAAY,IAAI,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n major,\n minVersion,\n satisfies,\n subset,\n valid,\n validRange,\n} from 'semver';\n\nexport function fulfillsVersionRange({\n version,\n acceptableVersions,\n canBeLatest,\n}: {\n version: string;\n acceptableVersions: string;\n canBeLatest: boolean;\n}): boolean {\n if (version === 'latest') {\n return canBeLatest;\n }\n\n let cleanedUserVersion, isRange;\n\n if (valid(version)) {\n cleanedUserVersion = valid(version);\n isRange = false;\n } else if (validRange(version)) {\n cleanedUserVersion = validRange(version);\n isRange = true;\n }\n\n return (\n // If the given version is a bogus format, this will still be undefined and we'll automatically reject it\n !!cleanedUserVersion &&\n (isRange\n ? subset(cleanedUserVersion, acceptableVersions)\n : satisfies(cleanedUserVersion, acceptableVersions))\n );\n}\n\n/**\n * Creates a version bucket function for analytics.\n * Converts versions like \"1.2.3\" to \"1.x\" for grouping in analytics.\n *\n * @param minMajorVersion - Optional minimum major version threshold.\n * Versions below this will be bucketed as \"<{min}.0.0\"\n *\n * @example\n * const getVersionBucket = createVersionBucket(); // no minimum\n * getVersionBucket(\"1.2.3\") // \"1.x\"\n *\n * const getVersionBucket = createVersionBucket(11);\n * getVersionBucket(\"15.3.0\") // \"15.x\"\n * getVersionBucket(\"10.0.0\") // \"<11.0.0\"\n */\nexport function createVersionBucket(minMajorVersion?: number) {\n return (version: string | undefined): string => {\n if (!version) {\n return 'none';\n }\n\n try {\n const minVer = minVersion(version);\n if (!minVer) {\n return 'invalid';\n }\n const majorVersion = major(minVer);\n if (minMajorVersion !== undefined && majorVersion < minMajorVersion) {\n return `<${minMajorVersion}.0.0`;\n }\n return `${majorVersion}.x`;\n } catch {\n return 'unknown';\n }\n };\n}\n"]}
|
|
@@ -45,6 +45,10 @@ export type WizardOptions = {
|
|
|
45
45
|
* Personal API key (phx_xxx) - used for LLM gateway auth, skips OAuth
|
|
46
46
|
*/
|
|
47
47
|
apiKey?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to show the menu for manual integration selection instead of auto-detecting.
|
|
50
|
+
*/
|
|
51
|
+
menu: boolean;
|
|
48
52
|
};
|
|
49
53
|
export interface Feature {
|
|
50
54
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PostHogProjectData = Record<string, unknown>;\n\nexport type PreselectedProject = {\n project: PostHogProjectData;\n authToken: string;\n};\n\nexport type WizardOptions = {\n /**\n * Whether to enable debug mode.\n */\n debug: boolean;\n\n /**\n * Whether to force install the SDK package to continue with the installation in case\n * any package manager checks are failing (e.g. peer dependency versions).\n *\n * Use with caution and only if you know what you're doing.\n *\n * Does not apply to all wizard flows (currently NPM only)\n */\n forceInstall: boolean;\n\n /**\n * The directory to run the wizard in.\n */\n installDir: string;\n\n /**\n * The cloud region to use.\n */\n cloudRegion?: CloudRegion;\n\n /**\n * Whether to select the default option for all questions automatically.\n */\n default: boolean;\n\n /**\n * Whether to create a new PostHog account during setup.\n */\n signup: boolean;\n\n /**\n * Whether to use the local MCP server at http://localhost:8787/mcp\n */\n localMcp: boolean;\n\n /**\n * CI mode - non-interactive execution\n */\n ci: boolean;\n\n /**\n * Personal API key (phx_xxx) - used for LLM gateway auth, skips OAuth\n */\n apiKey?: string;\n};\n\nexport interface Feature {\n id: string;\n prompt: string;\n enabledHint?: string;\n disabledHint?: string;\n}\n\nexport type FileChange = {\n filePath: string;\n oldContent?: string;\n newContent: string;\n};\n\nexport type CloudRegion = 'us' | 'eu';\n\nexport type AIModel =\n | 'gpt-5-mini'\n | 'o4-mini'\n | 'gemini-2.5-flash'\n | 'gemini-2.5-pro';\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PostHogProjectData = Record<string, unknown>;\n\nexport type PreselectedProject = {\n project: PostHogProjectData;\n authToken: string;\n};\n\nexport type WizardOptions = {\n /**\n * Whether to enable debug mode.\n */\n debug: boolean;\n\n /**\n * Whether to force install the SDK package to continue with the installation in case\n * any package manager checks are failing (e.g. peer dependency versions).\n *\n * Use with caution and only if you know what you're doing.\n *\n * Does not apply to all wizard flows (currently NPM only)\n */\n forceInstall: boolean;\n\n /**\n * The directory to run the wizard in.\n */\n installDir: string;\n\n /**\n * The cloud region to use.\n */\n cloudRegion?: CloudRegion;\n\n /**\n * Whether to select the default option for all questions automatically.\n */\n default: boolean;\n\n /**\n * Whether to create a new PostHog account during setup.\n */\n signup: boolean;\n\n /**\n * Whether to use the local MCP server at http://localhost:8787/mcp\n */\n localMcp: boolean;\n\n /**\n * CI mode - non-interactive execution\n */\n ci: boolean;\n\n /**\n * Personal API key (phx_xxx) - used for LLM gateway auth, skips OAuth\n */\n apiKey?: string;\n\n /**\n * Whether to show the menu for manual integration selection instead of auto-detecting.\n */\n menu: boolean;\n};\n\nexport interface Feature {\n id: string;\n prompt: string;\n enabledHint?: string;\n disabledHint?: string;\n}\n\nexport type FileChange = {\n filePath: string;\n oldContent?: string;\n newContent: string;\n};\n\nexport type CloudRegion = 'us' | 'eu';\n\nexport type AIModel =\n | 'gpt-5-mini'\n | 'o4-mini'\n | 'gemini-2.5-flash'\n | 'gemini-2.5-pro';\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VUE_AGENT_CONFIG = void 0;
|
|
4
|
+
const constants_1 = require("../lib/constants");
|
|
5
|
+
const package_json_1 = require("../utils/package-json");
|
|
6
|
+
const clack_utils_1 = require("../utils/clack-utils");
|
|
7
|
+
const semver_1 = require("../utils/semver");
|
|
8
|
+
const getVueVersionBucket = (0, semver_1.createVersionBucket)();
|
|
9
|
+
exports.VUE_AGENT_CONFIG = {
|
|
10
|
+
metadata: {
|
|
11
|
+
name: 'Vue',
|
|
12
|
+
integration: constants_1.Integration.vue,
|
|
13
|
+
docsUrl: 'https://posthog.com/docs/libraries/vue',
|
|
14
|
+
beta: true,
|
|
15
|
+
},
|
|
16
|
+
detection: {
|
|
17
|
+
packageName: 'vue',
|
|
18
|
+
packageDisplayName: 'Vue',
|
|
19
|
+
getVersion: (packageJson) => (0, package_json_1.getPackageVersion)('vue', packageJson),
|
|
20
|
+
getVersionBucket: getVueVersionBucket,
|
|
21
|
+
getInstalledVersion: async (options) => {
|
|
22
|
+
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
|
|
23
|
+
return (0, package_json_1.getPackageVersion)('vue', packageJson);
|
|
24
|
+
},
|
|
25
|
+
detect: async (options) => {
|
|
26
|
+
const packageJson = await (0, clack_utils_1.tryGetPackageJson)(options);
|
|
27
|
+
return packageJson ? (0, package_json_1.hasPackageInstalled)('vue', packageJson) : false;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
environment: {
|
|
31
|
+
uploadToHosting: true,
|
|
32
|
+
getEnvVars: (apiKey, host) => ({
|
|
33
|
+
VITE_POSTHOG_KEY: apiKey,
|
|
34
|
+
VITE_POSTHOG_HOST: host,
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
analytics: {
|
|
38
|
+
getTags: () => ({}),
|
|
39
|
+
},
|
|
40
|
+
prompts: {
|
|
41
|
+
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.',
|
|
42
|
+
packageInstallation: 'Look for lockfiles to determine the package manager (npm, yarn, pnpm, bun). Do not manually edit package.json.',
|
|
43
|
+
getAdditionalContextLines: () => {
|
|
44
|
+
const frameworkId = 'vue';
|
|
45
|
+
return [
|
|
46
|
+
`Framework docs ID: ${frameworkId} (use posthog://docs/frameworks/${frameworkId} for documentation)`,
|
|
47
|
+
];
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
ui: {
|
|
51
|
+
successMessage: 'PostHog integration complete',
|
|
52
|
+
estimatedDurationMinutes: 5,
|
|
53
|
+
getOutroChanges: () => [
|
|
54
|
+
'Analyzed your Vue project structure',
|
|
55
|
+
'Created and configured PostHog initializers',
|
|
56
|
+
'Integrated PostHog into your application',
|
|
57
|
+
],
|
|
58
|
+
getOutroNextSteps: () => [
|
|
59
|
+
'Start your development server to see PostHog in action',
|
|
60
|
+
'Visit your PostHog dashboard to see incoming events',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=vue-wizard-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-wizard-agent.js","sourceRoot":"","sources":["../../../src/vue/vue-wizard-agent.ts"],"names":[],"mappings":";;;AAEA,gDAA+C;AAC/C,wDAI+B;AAC/B,sDAA4E;AAC5E,4CAAsD;AAEtD,MAAM,mBAAmB,GAAG,IAAA,4BAAmB,GAAE,CAAC;AAIrC,QAAA,gBAAgB,GAAgC;IAC3D,QAAQ,EAAE;QACR,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,uBAAW,CAAC,GAAG;QAC5B,OAAO,EAAE,wCAAwC;QACjD,IAAI,EAAE,IAAI;KACX;IAED,SAAS,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,CAAC,WAAoB,EAAE,EAAE,CACnC,IAAA,gCAAiB,EAAC,KAAK,EAAE,WAA6B,CAAC;QACzD,gBAAgB,EAAE,mBAAmB;QACrC,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAiB,EAAC,OAAO,CAAC,CAAC;YACrD,OAAO,IAAA,gCAAiB,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAC/C,CAAC;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,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,CAAC;KACF;IAED,WAAW,EAAE;QACX,eAAe,EAAE,IAAI;QACrB,UAAU,EAAE,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC;YAC7C,gBAAgB,EAAE,MAAM;YACxB,iBAAiB,EAAE,IAAI;SACxB,CAAC;KACH;IAED,SAAS,EAAE;QACT,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpB;IAED,OAAO,EAAE;QACP,oBAAoB,EAClB,oJAAoJ;QACtJ,mBAAmB,EACjB,gHAAgH;QAClH,yBAAyB,EAAE,GAAG,EAAE;YAC9B,MAAM,WAAW,GAAG,KAAK,CAAC;YAC1B,OAAO;gBACL,sBAAsB,WAAW,mCAAmC,WAAW,qBAAqB;aACrG,CAAC;QACJ,CAAC;KACF;IAED,EAAE,EAAE;QACF,cAAc,EAAE,8BAA8B;QAC9C,wBAAwB,EAAE,CAAC;QAC3B,eAAe,EAAE,GAAG,EAAE,CAAC;YACrB,qCAAqC;YACrC,6CAA6C;YAC7C,0CAA0C;SAC3C;QACD,iBAAiB,EAAE,GAAG,EAAE,CAAC;YACvB,wDAAwD;YACxD,qDAAqD;SACtD;KACF;CACF,CAAC","sourcesContent":["/* Vue wizard using posthog-agent with PostHog MCP */\nimport type { FrameworkConfig } from '../lib/framework-config';\nimport { Integration } from '../lib/constants';\nimport {\n getPackageVersion,\n hasPackageInstalled,\n type PackageDotJson,\n} from '../utils/package-json';\nimport { getPackageDotJson, tryGetPackageJson } from '../utils/clack-utils';\nimport { createVersionBucket } from '../utils/semver';\n\nconst getVueVersionBucket = createVersionBucket();\n\ntype VueContext = Record<string, unknown>;\n\nexport const VUE_AGENT_CONFIG: FrameworkConfig<VueContext> = {\n metadata: {\n name: 'Vue',\n integration: Integration.vue,\n docsUrl: 'https://posthog.com/docs/libraries/vue',\n beta: true,\n },\n\n detection: {\n packageName: 'vue',\n packageDisplayName: 'Vue',\n getVersion: (packageJson: unknown) =>\n getPackageVersion('vue', packageJson as PackageDotJson),\n getVersionBucket: getVueVersionBucket,\n getInstalledVersion: async (options) => {\n const packageJson = await getPackageDotJson(options);\n return getPackageVersion('vue', packageJson);\n },\n detect: async (options) => {\n const packageJson = await tryGetPackageJson(options);\n return packageJson ? hasPackageInstalled('vue', packageJson) : false;\n },\n },\n\n environment: {\n uploadToHosting: true,\n getEnvVars: (apiKey: string, host: string) => ({\n VITE_POSTHOG_KEY: apiKey,\n VITE_POSTHOG_HOST: host,\n }),\n },\n\n analytics: {\n getTags: () => ({}),\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: () => {\n const frameworkId = 'vue';\n return [\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: 5,\n getOutroChanges: () => [\n 'Analyzed your Vue project structure',\n 'Created and configured PostHog initializers',\n 'Integrated PostHog into your application',\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"]}
|
package/package.json
CHANGED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable max-lines */
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.runAstroWizard = runAstroWizard;
|
|
8
|
-
const clack_utils_1 = require("../utils/clack-utils");
|
|
9
|
-
const package_json_1 = require("../utils/package-json");
|
|
10
|
-
const clack_1 = __importDefault(require("../utils/clack"));
|
|
11
|
-
const constants_1 = require("../lib/constants");
|
|
12
|
-
const docs_1 = require("./docs");
|
|
13
|
-
const analytics_1 = require("../utils/analytics");
|
|
14
|
-
const file_utils_1 = require("../utils/file-utils");
|
|
15
|
-
const clack_utils_2 = require("../utils/clack-utils");
|
|
16
|
-
const messages_1 = require("../lib/messages");
|
|
17
|
-
const steps_1 = require("../steps");
|
|
18
|
-
async function runAstroWizard(options) {
|
|
19
|
-
(0, clack_utils_1.printWelcome)({
|
|
20
|
-
wizardName: 'PostHog Astro wizard',
|
|
21
|
-
});
|
|
22
|
-
const aiConsent = await (0, clack_utils_1.askForAIConsent)(options);
|
|
23
|
-
if (!aiConsent) {
|
|
24
|
-
await (0, clack_utils_1.abort)('The Astro wizard requires AI to get setup right now. Please view the docs to setup Astro manually instead: https://posthog.com/docs/libraries/js', 0);
|
|
25
|
-
}
|
|
26
|
-
const cloudRegion = options.cloudRegion ?? (await (0, clack_utils_2.askForCloudRegion)());
|
|
27
|
-
await (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)(options);
|
|
28
|
-
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
|
|
29
|
-
await (0, clack_utils_1.ensurePackageIsInstalled)(packageJson, 'astro', 'Astro');
|
|
30
|
-
const astroVersion = (0, package_json_1.getPackageVersion)('astro', packageJson);
|
|
31
|
-
if (astroVersion) {
|
|
32
|
-
analytics_1.analytics.setTag('astro-version', astroVersion);
|
|
33
|
-
}
|
|
34
|
-
const { projectApiKey, accessToken, host, projectId } = await (0, clack_utils_1.getOrAskForProjectData)({
|
|
35
|
-
...options,
|
|
36
|
-
cloudRegion,
|
|
37
|
-
});
|
|
38
|
-
clack_1.default.log.info('Heading to include the PostHogSnippet in your Astro project');
|
|
39
|
-
const relevantFiles = await (0, file_utils_1.getRelevantFilesForIntegration)({
|
|
40
|
-
installDir: options.installDir,
|
|
41
|
-
integration: constants_1.Integration.astro,
|
|
42
|
-
});
|
|
43
|
-
const installationDocumentation = (0, docs_1.getAstroDocumentation)({
|
|
44
|
-
projectApiKey,
|
|
45
|
-
host,
|
|
46
|
-
});
|
|
47
|
-
clack_1.default.log.info('Reviewing PostHog documentation for Astro');
|
|
48
|
-
const filesToChange = await (0, file_utils_1.getFilesToChange)({
|
|
49
|
-
integration: constants_1.Integration.astro,
|
|
50
|
-
relevantFiles,
|
|
51
|
-
documentation: installationDocumentation,
|
|
52
|
-
accessToken,
|
|
53
|
-
cloudRegion,
|
|
54
|
-
projectId,
|
|
55
|
-
});
|
|
56
|
-
await (0, file_utils_1.generateFileChangesForIntegration)({
|
|
57
|
-
integration: constants_1.Integration.astro,
|
|
58
|
-
filesToChange,
|
|
59
|
-
accessToken,
|
|
60
|
-
installDir: options.installDir,
|
|
61
|
-
documentation: installationDocumentation,
|
|
62
|
-
cloudRegion,
|
|
63
|
-
projectId,
|
|
64
|
-
});
|
|
65
|
-
await (0, steps_1.runPrettierStep)({
|
|
66
|
-
installDir: options.installDir,
|
|
67
|
-
integration: constants_1.Integration.astro,
|
|
68
|
-
});
|
|
69
|
-
const addedEditorRules = await (0, steps_1.addEditorRulesStep)({
|
|
70
|
-
installDir: options.installDir,
|
|
71
|
-
rulesName: 'astro-rules.md',
|
|
72
|
-
integration: constants_1.Integration.astro,
|
|
73
|
-
});
|
|
74
|
-
await (0, steps_1.addMCPServerToClientsStep)({
|
|
75
|
-
cloudRegion,
|
|
76
|
-
integration: constants_1.Integration.astro,
|
|
77
|
-
ci: options.ci,
|
|
78
|
-
});
|
|
79
|
-
const outroMessage = (0, messages_1.getOutroMessage)({
|
|
80
|
-
options,
|
|
81
|
-
integration: constants_1.Integration.astro,
|
|
82
|
-
cloudRegion,
|
|
83
|
-
addedEditorRules,
|
|
84
|
-
uploadedEnvVars: [],
|
|
85
|
-
});
|
|
86
|
-
clack_1.default.outro(outroMessage);
|
|
87
|
-
await analytics_1.analytics.shutdown('success');
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=astro-wizard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astro-wizard.js","sourceRoot":"","sources":["../../../src/astro/astro-wizard.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable max-lines */\n\nimport {\n abort,\n askForAIConsent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n printWelcome,\n} from '../utils/clack-utils';\nimport { getPackageVersion } from '../utils/package-json';\nimport clack from '../utils/clack';\nimport { Integration } from '../lib/constants';\nimport { getAstroDocumentation } from './docs';\nimport { analytics } from '../utils/analytics';\nimport {\n generateFileChangesForIntegration,\n getFilesToChange,\n getRelevantFilesForIntegration,\n} from '../utils/file-utils';\nimport type { WizardOptions } from '../utils/types';\nimport { askForCloudRegion } from '../utils/clack-utils';\nimport { getOutroMessage } from '../lib/messages';\nimport {\n addEditorRulesStep,\n addMCPServerToClientsStep,\n runPrettierStep,\n} from '../steps';\n\nexport async function runAstroWizard(options: WizardOptions): Promise<void> {\n printWelcome({\n wizardName: 'PostHog Astro wizard',\n });\n\n const aiConsent = await askForAIConsent(options);\n\n if (!aiConsent) {\n await abort(\n 'The Astro wizard requires AI to get setup right now. Please view the docs to setup Astro manually instead: https://posthog.com/docs/libraries/js',\n 0,\n );\n }\n\n const cloudRegion = options.cloudRegion ?? (await askForCloudRegion());\n\n await confirmContinueIfNoOrDirtyGitRepo(options);\n\n const packageJson = await getPackageDotJson(options);\n\n await ensurePackageIsInstalled(packageJson, 'astro', 'Astro');\n\n const astroVersion = getPackageVersion('astro', packageJson);\n\n if (astroVersion) {\n analytics.setTag('astro-version', astroVersion);\n }\n\n const { projectApiKey, accessToken, host, projectId } =\n await getOrAskForProjectData({\n ...options,\n cloudRegion,\n });\n\n clack.log.info('Heading to include the PostHogSnippet in your Astro project');\n\n const relevantFiles = await getRelevantFilesForIntegration({\n installDir: options.installDir,\n integration: Integration.astro,\n });\n\n const installationDocumentation = getAstroDocumentation({\n projectApiKey,\n host,\n });\n\n clack.log.info('Reviewing PostHog documentation for Astro');\n\n const filesToChange = await getFilesToChange({\n integration: Integration.astro,\n relevantFiles,\n documentation: installationDocumentation,\n accessToken,\n cloudRegion,\n projectId,\n });\n\n await generateFileChangesForIntegration({\n integration: Integration.astro,\n filesToChange,\n accessToken,\n installDir: options.installDir,\n documentation: installationDocumentation,\n cloudRegion,\n projectId,\n });\n\n await runPrettierStep({\n installDir: options.installDir,\n integration: Integration.astro,\n });\n\n const addedEditorRules = await addEditorRulesStep({\n installDir: options.installDir,\n rulesName: 'astro-rules.md',\n integration: Integration.astro,\n });\n\n await addMCPServerToClientsStep({\n cloudRegion,\n integration: Integration.astro,\n ci: options.ci,\n });\n\n const outroMessage = getOutroMessage({\n options,\n integration: Integration.astro,\n cloudRegion,\n addedEditorRules,\n uploadedEnvVars: [],\n });\n\n clack.outro(outroMessage);\n\n await analytics.shutdown('success');\n}\n"]}
|
package/dist/src/astro/docs.d.ts
DELETED
package/dist/src/astro/docs.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAstroDocumentation = getAstroDocumentation;
|
|
4
|
-
function getAstroDocumentation({ projectApiKey = 'your_project_api_key', host = 'https://us.i.posthog.com', }) {
|
|
5
|
-
return `
|
|
6
|
-
==============================
|
|
7
|
-
FILE: src/components/posthog.astro
|
|
8
|
-
LOCATION: Components folder (create if missing)
|
|
9
|
-
==============================
|
|
10
|
-
Changes:
|
|
11
|
-
- Add a PostHog loader script with \`is:inline\`.
|
|
12
|
-
|
|
13
|
-
Example:
|
|
14
|
-
--------------------------------------------------
|
|
15
|
-
---
|
|
16
|
-
// src/components/posthog.astro
|
|
17
|
-
---
|
|
18
|
-
<script is:inline type="text/javascript" id="posthog-js">
|
|
19
|
-
!(function(t, e) {
|
|
20
|
-
var o, n, p, r;
|
|
21
|
-
e.__SV ||
|
|
22
|
-
((window.posthog = e),
|
|
23
|
-
(e._i = []),
|
|
24
|
-
(e.init = function(i, s, a) {
|
|
25
|
-
function g(t, e) {
|
|
26
|
-
var o = e.split('.');
|
|
27
|
-
2 == o.length && ((t = t[o[0]]), (e = o[1])),
|
|
28
|
-
(t[e] = function() {
|
|
29
|
-
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
((p = t.createElement('script')).type = 'text/javascript'),
|
|
33
|
-
(p.crossOrigin = 'anonymous'),
|
|
34
|
-
(p.async = true),
|
|
35
|
-
(p.src = s.api_host + '/static/array.js'),
|
|
36
|
-
(r = t.getElementsByTagName('script')[0]).parentNode.insertBefore(p, r);
|
|
37
|
-
var u = e;
|
|
38
|
-
void 0 !== a ? (u = e[a] = []) : (a = 'posthog');
|
|
39
|
-
u.people = u.people || [];
|
|
40
|
-
u.toString = function(t) {
|
|
41
|
-
var e = 'posthog';
|
|
42
|
-
return 'posthog' !== a && (e += '.' + a), t || (e += ' (stub)'), e;
|
|
43
|
-
};
|
|
44
|
-
u.people.toString = function() {
|
|
45
|
-
return u.toString(1) + '.people (stub)';
|
|
46
|
-
};
|
|
47
|
-
o =
|
|
48
|
-
'capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys getNextSurveyStep onSessionId'.split(
|
|
49
|
-
' '
|
|
50
|
-
);
|
|
51
|
-
for (n = 0; n < o.length; n++) g(u, o[n]);
|
|
52
|
-
e._i.push([i, s, a]);
|
|
53
|
-
}),
|
|
54
|
-
(e.__SV = 1));
|
|
55
|
-
})(document, window.posthog || []);
|
|
56
|
-
posthog.init('${projectApiKey}', { api_host: '${host}', defaults: '2025-05-24' });
|
|
57
|
-
</script>
|
|
58
|
-
--------------------------------------------------
|
|
59
|
-
|
|
60
|
-
==============================
|
|
61
|
-
FILE: src/layouts/PostHogLayout.astro
|
|
62
|
-
LOCATION: Layouts folder (create if missing)
|
|
63
|
-
==============================
|
|
64
|
-
Changes:
|
|
65
|
-
- Insert the new \`<PostHog />\` component in the \`<head>\`.
|
|
66
|
-
|
|
67
|
-
Example:
|
|
68
|
-
--------------------------------------------------
|
|
69
|
-
---
|
|
70
|
-
import PostHog from '../components/posthog.astro';
|
|
71
|
-
---
|
|
72
|
-
<html>
|
|
73
|
-
<head>
|
|
74
|
-
<PostHog />
|
|
75
|
-
</head>
|
|
76
|
-
<body>
|
|
77
|
-
<slot />
|
|
78
|
-
</body>
|
|
79
|
-
</html>
|
|
80
|
-
--------------------------------------------------
|
|
81
|
-
|
|
82
|
-
==============================
|
|
83
|
-
FILE: any page you want analytics on, e.g. src/pages/index.astro
|
|
84
|
-
LOCATION: Your page file
|
|
85
|
-
==============================
|
|
86
|
-
Changes:
|
|
87
|
-
- Wrap content with the new layout.
|
|
88
|
-
|
|
89
|
-
Example:
|
|
90
|
-
--------------------------------------------------
|
|
91
|
-
---
|
|
92
|
-
import PostHogLayout from '../layouts/PostHogLayout.astro';
|
|
93
|
-
---
|
|
94
|
-
<PostHogLayout>
|
|
95
|
-
<!-- existing page content -->
|
|
96
|
-
<h1>Welcome to Astro</h1>
|
|
97
|
-
</PostHogLayout>
|
|
98
|
-
--------------------------------------------------
|
|
99
|
-
`;
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=docs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/astro/docs.ts"],"names":[],"mappings":";;AAAA,sDAsGC;AAtGD,SAAgB,qBAAqB,CAAC,EACpC,aAAa,GAAG,sBAAsB,EACtC,IAAI,GAAG,0BAA0B,GAIlC;IACC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmDS,aAAa,mBAAmB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CrD,CAAC;AACF,CAAC","sourcesContent":["export function getAstroDocumentation({\n projectApiKey = 'your_project_api_key',\n host = 'https://us.i.posthog.com',\n}: {\n projectApiKey?: string;\n host?: string;\n}) {\n return `\n==============================\nFILE: src/components/posthog.astro\nLOCATION: Components folder (create if missing)\n==============================\nChanges:\n- Add a PostHog loader script with \\`is:inline\\`.\n\nExample:\n--------------------------------------------------\n---\n// src/components/posthog.astro\n---\n<script is:inline type=\"text/javascript\" id=\"posthog-js\">\n !(function(t, e) {\n var o, n, p, r;\n e.__SV ||\n ((window.posthog = e),\n (e._i = []),\n (e.init = function(i, s, a) {\n function g(t, e) {\n var o = e.split('.');\n 2 == o.length && ((t = t[o[0]]), (e = o[1])),\n (t[e] = function() {\n t.push([e].concat(Array.prototype.slice.call(arguments, 0)));\n });\n }\n ((p = t.createElement('script')).type = 'text/javascript'),\n (p.crossOrigin = 'anonymous'),\n (p.async = true),\n (p.src = s.api_host + '/static/array.js'),\n (r = t.getElementsByTagName('script')[0]).parentNode.insertBefore(p, r);\n var u = e;\n void 0 !== a ? (u = e[a] = []) : (a = 'posthog');\n u.people = u.people || [];\n u.toString = function(t) {\n var e = 'posthog';\n return 'posthog' !== a && (e += '.' + a), t || (e += ' (stub)'), e;\n };\n u.people.toString = function() {\n return u.toString(1) + '.people (stub)';\n };\n o =\n 'capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys getNextSurveyStep onSessionId'.split(\n ' '\n );\n for (n = 0; n < o.length; n++) g(u, o[n]);\n e._i.push([i, s, a]);\n }),\n (e.__SV = 1));\n })(document, window.posthog || []);\n posthog.init('${projectApiKey}', { api_host: '${host}', defaults: '2025-05-24' });\n</script>\n--------------------------------------------------\n\n==============================\nFILE: src/layouts/PostHogLayout.astro\nLOCATION: Layouts folder (create if missing)\n==============================\nChanges:\n- Insert the new \\`<PostHog />\\` component in the \\`<head>\\`.\n\nExample:\n--------------------------------------------------\n---\nimport PostHog from '../components/posthog.astro';\n---\n<html>\n <head>\n <PostHog />\n </head>\n <body>\n <slot />\n </body>\n</html>\n--------------------------------------------------\n\n==============================\nFILE: any page you want analytics on, e.g. src/pages/index.astro\nLOCATION: Your page file\n==============================\nChanges:\n- Wrap content with the new layout.\n\nExample:\n--------------------------------------------------\n---\nimport PostHogLayout from '../layouts/PostHogLayout.astro';\n---\n<PostHogLayout>\n <!-- existing page content -->\n <h1>Welcome to Astro</h1>\n</PostHogLayout>\n--------------------------------------------------\n`;\n}\n"]}
|
package/dist/src/lib/config.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { WizardOptions } from '../utils/types';
|
|
2
|
-
import { Integration } from './constants';
|
|
3
|
-
export declare const INTEGRATION_CONFIG: {
|
|
4
|
-
readonly nextjs: {
|
|
5
|
-
readonly name: "Next.js";
|
|
6
|
-
readonly filterPatterns: ["**/*.{tsx,ts,jsx,js,mjs,cjs}"];
|
|
7
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static", "next-env.d.*"];
|
|
8
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
9
|
-
readonly generateFilesRules: "";
|
|
10
|
-
readonly filterFilesRules: "";
|
|
11
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/next-js";
|
|
12
|
-
readonly 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";
|
|
13
|
-
readonly nextSteps: "• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app";
|
|
14
|
-
};
|
|
15
|
-
readonly react: {
|
|
16
|
-
readonly name: "React";
|
|
17
|
-
readonly filterPatterns: ["**/*.{tsx,ts,jsx,js}"];
|
|
18
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static", "assets"];
|
|
19
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
20
|
-
readonly generateFilesRules: "";
|
|
21
|
-
readonly filterFilesRules: "";
|
|
22
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/react";
|
|
23
|
-
readonly defaultChanges: "• Installed posthog-js package\n• Added PostHogProvider to the root of the app, to initialize PostHog and enable autocapture";
|
|
24
|
-
readonly nextSteps: "• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app";
|
|
25
|
-
};
|
|
26
|
-
readonly svelte: {
|
|
27
|
-
readonly name: "Svelte";
|
|
28
|
-
readonly filterPatterns: ["**/*.{svelte,ts,js,jsx,tsx}"];
|
|
29
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static"];
|
|
30
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
31
|
-
readonly generateFilesRules: "";
|
|
32
|
-
readonly filterFilesRules: "";
|
|
33
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/svelte";
|
|
34
|
-
readonly 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";
|
|
35
|
-
readonly nextSteps: "• Call posthog.identify() when a user signs into your app\n• Use getPostHogClient() to start capturing events server - side";
|
|
36
|
-
};
|
|
37
|
-
readonly "react-native": {
|
|
38
|
-
readonly name: "React Native";
|
|
39
|
-
readonly filterPatterns: ["**/*.{ts,js,jsx,tsx}"];
|
|
40
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static"];
|
|
41
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
42
|
-
readonly generateFilesRules: "";
|
|
43
|
-
readonly filterFilesRules: "";
|
|
44
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/react-native";
|
|
45
|
-
readonly defaultChanges: "• Installed required packages\n• Added PostHogProvider to the root of the app\n• Enabled autocapture and session replay";
|
|
46
|
-
readonly nextSteps: "• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app";
|
|
47
|
-
};
|
|
48
|
-
readonly astro: {
|
|
49
|
-
readonly name: "Astro";
|
|
50
|
-
readonly filterPatterns: ["**/*.{astro,ts,js,jsx,tsx}"];
|
|
51
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static"];
|
|
52
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
53
|
-
readonly generateFilesRules: "";
|
|
54
|
-
readonly filterFilesRules: "";
|
|
55
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/js";
|
|
56
|
-
readonly defaultChanges: "• Added PostHog component with initialization script\n• Created PostHogLayout for consistent analytics tracking";
|
|
57
|
-
readonly 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";
|
|
58
|
-
};
|
|
59
|
-
readonly "react-router": {
|
|
60
|
-
readonly name: "React Router";
|
|
61
|
-
readonly filterPatterns: ["**/*.{tsx,ts,jsx,js}"];
|
|
62
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static", "assets"];
|
|
63
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
64
|
-
readonly generateFilesRules: "";
|
|
65
|
-
readonly filterFilesRules: "";
|
|
66
|
-
readonly docsUrl: "https://posthog-git-react-post-hog.vercel.app/docs/libraries/react-router";
|
|
67
|
-
readonly defaultChanges: "• Installed posthog-js package\n• Added PostHogProvider to the root of the app\n• Integrated PostHog with React Router for pageview tracking";
|
|
68
|
-
readonly nextSteps: "• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app";
|
|
69
|
-
};
|
|
70
|
-
readonly django: {
|
|
71
|
-
readonly name: "Django";
|
|
72
|
-
readonly filterPatterns: ["**/*.py"];
|
|
73
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static", "venv", ".venv", "env", ".env", "__pycache__", "*.pyc", "migrations"];
|
|
74
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
75
|
-
readonly generateFilesRules: "";
|
|
76
|
-
readonly filterFilesRules: "";
|
|
77
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/django";
|
|
78
|
-
readonly defaultChanges: "• Installed posthog Python package\n• Added PostHog middleware for automatic event tracking\n• Configured PostHog settings in Django settings file";
|
|
79
|
-
readonly 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()";
|
|
80
|
-
};
|
|
81
|
-
readonly flask: {
|
|
82
|
-
readonly name: "Flask";
|
|
83
|
-
readonly filterPatterns: ["**/*.py"];
|
|
84
|
-
readonly ignorePatterns: ["node_modules", "dist", "build", "public", "static", "venv", ".venv", "env", ".env", "__pycache__", "*.pyc", "migrations", "instance"];
|
|
85
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
86
|
-
readonly generateFilesRules: "";
|
|
87
|
-
readonly filterFilesRules: "";
|
|
88
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/flask";
|
|
89
|
-
readonly defaultChanges: "• Installed posthog Python package\n• Added PostHog initialization to your Flask app\n• Configured automatic event tracking";
|
|
90
|
-
readonly 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()";
|
|
91
|
-
};
|
|
92
|
-
readonly laravel: {
|
|
93
|
-
readonly name: "Laravel";
|
|
94
|
-
readonly filterPatterns: ["**/*.php"];
|
|
95
|
-
readonly ignorePatterns: ["node_modules", "vendor", "storage", "bootstrap/cache", "public/build", "public/hot", ".phpunit.cache"];
|
|
96
|
-
readonly detect: (options: Pick<WizardOptions, "installDir">) => Promise<boolean>;
|
|
97
|
-
readonly generateFilesRules: "";
|
|
98
|
-
readonly filterFilesRules: "";
|
|
99
|
-
readonly docsUrl: "https://posthog.com/docs/libraries/php";
|
|
100
|
-
readonly defaultChanges: "• Installed posthog/posthog-php via Composer\n• Added PostHog service provider\n• Configured automatic event tracking";
|
|
101
|
-
readonly nextSteps: "• Use PostHog::capture() to track custom events\n• Use PostHog::identify() to associate events with users";
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
export declare const INTEGRATION_ORDER: readonly [Integration.nextjs, Integration.astro, Integration.svelte, Integration.reactNative, Integration.reactRouter, Integration.django, Integration.flask, Integration.laravel, Integration.react];
|