Skip to content

feat(deep-link): posthog-code://new?prompt=… opens prefilled task input#2020

Draft
posthog[bot] wants to merge 1 commit intomainfrom
posthog-code/deep-link-new-task-prompt
Draft

feat(deep-link): posthog-code://new?prompt=… opens prefilled task input#2020
posthog[bot] wants to merge 1 commit intomainfrom
posthog-code/deep-link-new-task-prompt

Conversation

@posthog
Copy link
Copy Markdown
Contributor

@posthog posthog Bot commented May 5, 2026

Summary

Adds a new deep link key so external integrations can launch PostHog Code straight into the new-task view with an optional prompt prefilled.

URL: posthog-code://new?prompt=fix%20the%20bug (prod) or posthog-code-dev://new?prompt=… (dev).

  • New "new" handler registered in TaskLinkService. The handler reads prompt from the URL's query params, treats whitespace-only values as undefined, and emits a CreateTask event (or queues it as a pending deep link if the renderer isn't ready yet).
  • deepLinkRouter gets onCreateTask (subscription) + getPendingNewTaskLink (query), mirroring the existing task / inbox shape.
  • useTaskDeepLink now drains pending new-task links on mount (cold start) and subscribes to onCreateTask (warm start), then calls navigateToTaskInput({ initialPrompt }) — which is the same path the codebase already uses for prefilled inputs from inbox reports.
  • Window focus / restore reuses the same logic as the existing task and inbox handlers.
  • 12 new unit tests in task-link/service.test.ts covering both the existing task handler (which had no tests) and the new-task handler.

Test plan

  • pnpm --filter code typecheck passes
  • pnpm --filter code exec vitest run src/main/services/task-link passes (12/12)
  • Manually open posthog-code-dev://new?prompt=hello%20world in dev — task input opens with "hello world" prefilled
  • Manually open posthog-code-dev://new — task input opens with empty prompt
  • Cold start: quit the app, then open posthog-code-dev://new?prompt=test from a terminal — app launches into prefilled input

Created with PostHog Code

…nput

Adds a new deep link key handled by TaskLinkService that opens the task
input view with an optional prompt prefilled. Reuses the existing pending
deep link queue + tRPC subscription pattern so cold-start launches are
covered. Whitespace-only prompts collapse to undefined.

Generated-By: PostHog Code
Task-Id: 2521ff3b-a2ea-48ec-adf6-db44a6661ef4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants