Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
chore(cli): rename COMPOSIO_POSTHOG_KEY to COMPOSIO_POSTHOG_PROJECT_API_KEY
Kshitij Jhunjhunwala15007c26ad59
diff --git a/.github/workflows/build-cli-binaries.yml b/.github/workflows/build-cli-binaries.ymlindex eb090217f..9a2a86e18 100644--- a/.github/workflows/build-cli-binaries.yml+++ b/.github/workflows/build-cli-binaries.yml@@ -133,7 +133,7 @@ jobs:- name: Cross-compile CLI binaryworking-directory: ts/packages/clienv:- COMPOSIO_POSTHOG_KEY: ${{ vars.COMPOSIO_POSTHOG_KEY }}+ COMPOSIO_POSTHOG_PROJECT_API_KEY: ${{ vars.COMPOSIO_POSTHOG_PROJECT_API_KEY }}run: pnpm build:binary:cross --target ${{ matrix.target }}- name: Verify binarydiff --git a/ts/packages/cli/scripts/_shared.ts b/ts/packages/cli/scripts/_shared.tsindex 712d17c1c..5f0c2dfe2 100644--- a/ts/packages/cli/scripts/_shared.ts+++ b/ts/packages/cli/scripts/_shared.ts@@ -53,8 +53,8 @@ export const LOCAL_TOOLS_BINARY_ASSET_DIRNAME = 'local-tools-binaries';// Kept out of --env: Bun honors only the last --env, which would clobber DEBUG_OVERRIDE_*.export const posthogBakeArgs = (): ReadonlyArray<string> => {- const key = process.env.COMPOSIO_POSTHOG_KEY?.trim();- return key ? ['--define', `COMPOSIO_POSTHOG_KEY_BAKED=${JSON.stringify(key)}`] : [];+ const key = process.env.COMPOSIO_POSTHOG_PROJECT_API_KEY?.trim();+ return key ? ['--define', `COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED=${JSON.stringify(key)}`] : [];};const localToolsBinaryAssetsSourceDir = (): string =>diff --git a/ts/packages/cli/src/analytics/dispatch.ts b/ts/packages/cli/src/analytics/dispatch.tsindex b04f6c54e..812cacf33 100644--- a/ts/packages/cli/src/analytics/dispatch.ts+++ b/ts/packages/cli/src/analytics/dispatch.ts@@ -104,13 +104,13 @@ const getPostHogConfig = environmentProvider.load(Config.all({ingestUrl: optionalString('COMPOSIO_POSTHOG_INGEST_URL'),- projectKey: optionalString('COMPOSIO_POSTHOG_KEY'),+ projectKey: optionalString('COMPOSIO_POSTHOG_PROJECT_API_KEY'),})).pipe(Effect.map(({ ingestUrl, projectKey }) => ({ingestUrl: configuredString(ingestUrl) ?? constants.COMPOSIO_POSTHOG_INGEST_URL,- projectKey: configuredString(projectKey) ?? constants.COMPOSIO_POSTHOG_PROJECT_KEY,+ projectKey: configuredString(projectKey) ?? constants.COMPOSIO_POSTHOG_PROJECT_API_KEY,})));diff --git a/ts/packages/cli/src/constants.ts b/ts/packages/cli/src/constants.tsindex 8a9a02ed5..dff3b7233 100644--- a/ts/packages/cli/src/constants.ts+++ b/ts/packages/cli/src/constants.ts@@ -82,13 +82,16 @@ export const PROJECT_COMPOSIO_DIR = '.composio';*/export const COMPOSIO_POSTHOG_INGEST_URL = 'https://us.i.posthog.com/i/v0/e/';-declare const COMPOSIO_POSTHOG_KEY_BAKED: string | undefined;+declare const COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED: string | undefined;/**- * Public write-only PostHog project key, baked at build from `COMPOSIO_POSTHOG_KEY`.+ * Public write-only PostHog *project API key* (`phc_...`), baked at build from+ * `COMPOSIO_POSTHOG_PROJECT_API_KEY`. Never a private/personal PostHog key.*/-export const COMPOSIO_POSTHOG_PROJECT_KEY =- typeof COMPOSIO_POSTHOG_KEY_BAKED === 'string' ? COMPOSIO_POSTHOG_KEY_BAKED : '';+export const COMPOSIO_POSTHOG_PROJECT_API_KEY =+ typeof COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED === 'string'+ ? COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED+ : '';/*** GitHub repository information for release fetchingdiff --git a/ts/packages/cli/test/src/analytics.dispatch.test.ts b/ts/packages/cli/test/src/analytics.dispatch.test.tsindex de8d8b869..1b346f73e 100644--- a/ts/packages/cli/test/src/analytics.dispatch.test.ts+++ b/ts/packages/cli/test/src/analytics.dispatch.test.ts@@ -60,7 +60,7 @@ const enableTelemetry = (apiKey = 'uak_test') => {vi.stubEnv('COMPOSIO_DISABLE_TELEMETRY', 'false');// A configured project key is what gates delivery/worker spawning; enabled// telemetry implies a target. The no-key path is covered explicitly below.- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');};const decodeWorkerPayload = <A>(encodedPayload: string): A => {@@ -176,7 +176,7 @@ describe('CLI analytics dispatch', () => {// the ingest URL + a fake public key keeps the test off the real project.vi.stubEnv('COMPOSIO_BASE_URL', '');vi.stubEnv('COMPOSIO_POSTHOG_INGEST_URL', 'https://posthog.example.test/i/v0/e/');- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response(null, { status: 200 }));@@ -232,7 +232,7 @@ describe('CLI analytics dispatch', () => {enableTelemetry();// No project key -> the empty embedded placeholder, so the worker's delivery// is a safe no-op until the real key is baked in.- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response(null, { status: 200 }));@@ -255,7 +255,7 @@ describe('CLI analytics dispatch', () => {enableTelemetry();// Empty key: forks / local builds without a baked key must not spawn a// detached worker on every command just to have it no-op.- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');process.argv[1] = scriptPath;return Effect.gen(function* () {@@ -505,7 +505,7 @@ describe('CLI analytics dispatch', () => {const home = tempy.temporaryDirectory();const scriptPath = `${home}/composio.ts`;enableTelemetry();- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');process.argv[1] = scriptPath;return Effect.gen(function* () {@@ -523,7 +523,7 @@ describe('CLI analytics dispatch', () => {expect(afterSkip.aliased_apollo_user_id).toBeUndefined();// Once a key is configured the alias is attempted again.- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');yield* linkApolloIdentityForAnalytics('om_apollo_retry');expect(childProcessMocks.spawn).toHaveBeenCalledTimes(1);const afterRetry = JSON.parse(