:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(code): include repository in task deep links (#73113)
Alessandro Pogliaghif43eef7f6c2b
diff --git a/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.test.ts b/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.test.tsnew file mode 100644index 000000000000..f542aaf9e481--- /dev/null+++ b/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.test.ts@@ -0,0 +1,10 @@+import { buildPostHogCodeDeepLink } from './AgentPromptButton'++describe('AgentPromptButton', () => {+ it.each([+ ['with a repository', 'posthog/posthog', 'posthog-code://new?prompt=fix%20this&repo=posthog%2Fposthog'],+ ['without a repository', undefined, 'posthog-code://new?prompt=fix%20this'],+ ])('builds a PostHog Code deep link %s', (_, repository, expected) => {+ expect(buildPostHogCodeDeepLink('fix this', repository)).toBe(expected)+ })+})diff --git a/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx b/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsxindex 8b7ef565ce9b..51944ae5ac02 100644--- a/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx+++ b/frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx@@ -100,6 +100,11 @@ function openDeepLink(buildDeepLink: (prompt: string) => string): (prompt: strinreturn (prompt: string) => window.open(buildDeepLink(prompt), '_blank')}+export function buildPostHogCodeDeepLink(prompt: string, repository?: string): string {+ const repoParam = repository ? `&repo=${encodeURIComponent(repository)}` : ''+ return `posthog-code://new?prompt=${encodeURIComponent(prompt)}${repoParam}`+}+const AGENTS: AgentDef[] = [{key: 'posthog-ai',@@ -113,7 +118,7 @@ const AGENTS: AgentDef[] = [name: 'PostHog Code',logo: <IconLogomark className="size-4 shrink-0" />,verb: 'Open',- open: openDeepLink((p) => `posthog-code://new?prompt=${encodeURIComponent(p)}`),+ open: (prompt, { repository }) => window.open(buildPostHogCodeDeepLink(prompt, repository), '_blank'),},{key: 'claude-code',