Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 18:30 UTC
chore(cli): rename COMPOSIO_POSTHOG_KEY to COMPOSIO_POSTHOG_PROJECT_API_KEY
PostHog's own term for the public write-only phc_* credential is the project API key; the old name read like a secret. Covers the env var, the build-time bake define, the baked constant, and the workflow env. The GitHub repo variable itself must be renamed manually. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Kshitij Jhunjhunwala committed
Jul 27, 2026 at 15:08 UTC
15007c26ad59a07f347fb62be31675be39115f7f
5 files changed
+18
-15
.github/workflows/build-cli-binaries.yml
+1
-1
@@ -133,7 +133,7 @@ jobs:
133
- name: Cross-compile CLI binary
134
working-directory: ts/packages/cli
135
env:
136
- COMPOSIO_POSTHOG_KEY: ${{ vars.COMPOSIO_POSTHOG_KEY }}
136
+ COMPOSIO_POSTHOG_PROJECT_API_KEY: ${{ vars.COMPOSIO_POSTHOG_PROJECT_API_KEY }}
137
run: pnpm build:binary:cross --target ${{ matrix.target }}
138
139
- name: Verify binary
ts/packages/cli/scripts/_shared.ts
+2
-2
@@ -53,8 +53,8 @@ export const LOCAL_TOOLS_BINARY_ASSET_DIRNAME = 'local-tools-binaries';
53
54
// Kept out of --env: Bun honors only the last --env, which would clobber DEBUG_OVERRIDE_*.
55
export const posthogBakeArgs = (): ReadonlyArray<string> => {
56
- const key = process.env.COMPOSIO_POSTHOG_KEY?.trim();
57
- return key ? ['--define', `COMPOSIO_POSTHOG_KEY_BAKED=${JSON.stringify(key)}`] : [];
56
+ const key = process.env.COMPOSIO_POSTHOG_PROJECT_API_KEY?.trim();
57
+ return key ? ['--define', `COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED=${JSON.stringify(key)}`] : [];
58
};
59
60
const localToolsBinaryAssetsSourceDir = (): string =>
ts/packages/cli/src/analytics/dispatch.ts
+2
-2
@@ -104,13 +104,13 @@ const getPostHogConfig = environmentProvider
104
.load(
105
Config.all({
106
ingestUrl: optionalString('COMPOSIO_POSTHOG_INGEST_URL'),
107
- projectKey: optionalString('COMPOSIO_POSTHOG_KEY'),
107
+ projectKey: optionalString('COMPOSIO_POSTHOG_PROJECT_API_KEY'),
108
})
109
)
110
.pipe(
111
Effect.map(({ ingestUrl, projectKey }) => ({
112
ingestUrl: configuredString(ingestUrl) ?? constants.COMPOSIO_POSTHOG_INGEST_URL,
113
- projectKey: configuredString(projectKey) ?? constants.COMPOSIO_POSTHOG_PROJECT_KEY,
113
+ projectKey: configuredString(projectKey) ?? constants.COMPOSIO_POSTHOG_PROJECT_API_KEY,
114
}))
115
);
116
ts/packages/cli/src/constants.ts
+7
-4
@@ -82,13 +82,16 @@ export const PROJECT_COMPOSIO_DIR = '.composio';
82
*/
83
export const COMPOSIO_POSTHOG_INGEST_URL = 'https://us.i.posthog.com/i/v0/e/';
84
85
-declare const COMPOSIO_POSTHOG_KEY_BAKED: string | undefined;
85
+declare const COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED: string | undefined;
86
87
/**
88
- * Public write-only PostHog project key, baked at build from `COMPOSIO_POSTHOG_KEY`.
88
+ * Public write-only PostHog *project API key* (`phc_...`), baked at build from
89
+ * `COMPOSIO_POSTHOG_PROJECT_API_KEY`. Never a private/personal PostHog key.
90
*/
90
-export const COMPOSIO_POSTHOG_PROJECT_KEY =
91
- typeof COMPOSIO_POSTHOG_KEY_BAKED === 'string' ? COMPOSIO_POSTHOG_KEY_BAKED : '';
91
+export const COMPOSIO_POSTHOG_PROJECT_API_KEY =
92
+ typeof COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED === 'string'
93
+ ? COMPOSIO_POSTHOG_PROJECT_API_KEY_BAKED
94
+ : '';
95
96
/**
97
* GitHub repository information for release fetching
ts/packages/cli/test/src/analytics.dispatch.test.ts
+6
-6
@@ -60,7 +60,7 @@ const enableTelemetry = (apiKey = 'uak_test') => {
60
vi.stubEnv('COMPOSIO_DISABLE_TELEMETRY', 'false');
61
// A configured project key is what gates delivery/worker spawning; enabled
62
// telemetry implies a target. The no-key path is covered explicitly below.
63
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');
63
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');
64
};
65
66
const decodeWorkerPayload = <A>(encodedPayload: string): A => {
@@ -176,7 +176,7 @@ describe('CLI analytics dispatch', () => {
176
// the ingest URL + a fake public key keeps the test off the real project.
177
vi.stubEnv('COMPOSIO_BASE_URL', '');
178
vi.stubEnv('COMPOSIO_POSTHOG_INGEST_URL', 'https://posthog.example.test/i/v0/e/');
179
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');
179
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');
180
const fetchSpy = vi
181
.spyOn(globalThis, 'fetch')
182
.mockResolvedValue(new Response(null, { status: 200 }));
@@ -232,7 +232,7 @@ describe('CLI analytics dispatch', () => {
232
enableTelemetry();
233
// No project key -> the empty embedded placeholder, so the worker's delivery
234
// is a safe no-op until the real key is baked in.
235
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');
235
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');
236
const fetchSpy = vi
237
.spyOn(globalThis, 'fetch')
238
.mockResolvedValue(new Response(null, { status: 200 }));
@@ -255,7 +255,7 @@ describe('CLI analytics dispatch', () => {
255
enableTelemetry();
256
// Empty key: forks / local builds without a baked key must not spawn a
257
// detached worker on every command just to have it no-op.
258
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');
258
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');
259
process.argv[1] = scriptPath;
260
261
return Effect.gen(function* () {
@@ -505,7 +505,7 @@ describe('CLI analytics dispatch', () => {
505
const home = tempy.temporaryDirectory();
506
const scriptPath = `${home}/composio.ts`;
507
enableTelemetry();
508
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', '');
508
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', '');
509
process.argv[1] = scriptPath;
510
511
return Effect.gen(function* () {
@@ -523,7 +523,7 @@ describe('CLI analytics dispatch', () => {
523
expect(afterSkip.aliased_apollo_user_id).toBeUndefined();
524
525
// Once a key is configured the alias is attempted again.
526
- vi.stubEnv('COMPOSIO_POSTHOG_KEY', 'phc_test_key');
526
+ vi.stubEnv('COMPOSIO_POSTHOG_PROJECT_API_KEY', 'phc_test_key');
527
yield* linkApolloIdentityForAnalytics('om_apollo_retry');
528
expect(childProcessMocks.spawn).toHaveBeenCalledTimes(1);
529
const afterRetry = JSON.parse(