Skip to content

feat(wizard): Add User-Agent header to wizard HTTP requests#291

Merged
robbie-c merged 3 commits intomainfrom
claude/wizard-api-identification-CxZWY
Feb 26, 2026
Merged

feat(wizard): Add User-Agent header to wizard HTTP requests#291
robbie-c merged 3 commits intomainfrom
claude/wizard-api-identification-CxZWY

Conversation

@robbie-c
Copy link
Member

Summary

This PR adds a consistent User-Agent header to all HTTP requests made by the wizard, enabling better request identification and tracking across the PostHog API and MCP server.

Key Changes

  • Added WIZARD_USER_AGENT constant ('posthog/wizard') to src/lib/constants.ts with documentation
  • Updated src/lib/api.ts to include the User-Agent header in:
    • fetchUserData() - PostHog API call to fetch user information
    • fetchProjectData() - PostHog API call to fetch project information
  • Updated src/utils/oauth.ts to include the User-Agent header in:
    • exchangeCodeForToken() - OAuth token exchange request
  • Updated src/lib/agent-interface.ts to include the User-Agent header in:
    • MCP server configuration for PostHog API requests

Implementation Details

The User-Agent header is now consistently applied across all wizard HTTP requests, allowing the PostHog API and MCP server to identify and track requests originating from the wizard. This improves observability and enables better request routing/handling on the server side.

https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K

Add User-Agent identification so PostHog can distinguish wizard-originated
requests. Direct API calls send 'posthog/wizard' and the MCP server
receives the same header so it can construct 'posthog/mcp posthog/wizard'.

https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
Copilot AI review requested due to automatic review settings February 26, 2026 09:38
@github-actions
Copy link

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci android
  • /wizard-ci angular
  • /wizard-ci astro
  • /wizard-ci django
  • /wizard-ci fastapi
  • /wizard-ci flask
  • /wizard-ci javascript-node
  • /wizard-ci javascript-web
  • /wizard-ci laravel
  • /wizard-ci next-js
  • /wizard-ci nuxt
  • /wizard-ci python
  • /wizard-ci rails
  • /wizard-ci react-native
  • /wizard-ci react-router
  • /wizard-ci sveltekit
  • /wizard-ci swift
  • /wizard-ci tanstack-router
  • /wizard-ci tanstack-start
  • /wizard-ci vue

Test an individual app:

  • /wizard-ci android/Jetchat
  • /wizard-ci angular/angular-saas
  • /wizard-ci astro/astro-hybrid-marketing
Show more apps
  • /wizard-ci astro/astro-ssr-docs
  • /wizard-ci astro/astro-static-marketing
  • /wizard-ci astro/astro-view-transitions-marketing
  • /wizard-ci django/django3-saas
  • /wizard-ci fastapi/fastapi3-ai-saas
  • /wizard-ci flask/flask3-social-media
  • /wizard-ci javascript-node/express-todo
  • /wizard-ci javascript-node/fastify-blog
  • /wizard-ci javascript-node/hono-links
  • /wizard-ci javascript-node/koa-notes
  • /wizard-ci javascript-node/native-http-contacts
  • /wizard-ci javascript-web/saas-dashboard
  • /wizard-ci laravel/laravel12-saas
  • /wizard-ci next-js/15-app-router-saas
  • /wizard-ci next-js/15-app-router-todo
  • /wizard-ci next-js/15-pages-router-saas
  • /wizard-ci next-js/15-pages-router-todo
  • /wizard-ci nuxt/movies-nuxt-3-6
  • /wizard-ci nuxt/movies-nuxt-4
  • /wizard-ci python/meeting-summarizer
  • /wizard-ci rails/fizzy
  • /wizard-ci react-native/expo-react-native-hacker-news
  • /wizard-ci react-native/react-native-saas
  • /wizard-ci react-router/react-router-v7-project
  • /wizard-ci react-router/rrv7-starter
  • /wizard-ci react-router/saas-template
  • /wizard-ci react-router/shopper
  • /wizard-ci sveltekit/CMSaasStarter
  • /wizard-ci swift/hackers-ios
  • /wizard-ci tanstack-router/tanstack-router-code-based-saas
  • /wizard-ci tanstack-router/tanstack-router-file-based-saas
  • /wizard-ci tanstack-start/tanstack-start-saas
  • /wizard-ci vue/movies

Results will be posted here when complete.

@robbie-c robbie-c changed the title Add User-Agent header to wizard HTTP requests feat(wizard): Add User-Agent header to wizard HTTP requests Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a consistent User-Agent header ('posthog/wizard') to all HTTP requests made by the wizard, enabling better request identification and tracking across the PostHog API and MCP server.

Changes:

  • Introduced WIZARD_USER_AGENT constant in src/lib/constants.ts
  • Added User-Agent header to PostHog API calls in src/lib/api.ts
  • Added User-Agent header to OAuth token exchange in src/utils/oauth.ts
  • Configured User-Agent header for MCP server requests in src/lib/agent-interface.ts

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/lib/constants.ts Defines the new WIZARD_USER_AGENT constant with documentation
src/lib/api.ts Applies User-Agent header to fetchUserData() and fetchProjectData() API calls
src/utils/oauth.ts Applies User-Agent header to OAuth token exchange request
src/lib/agent-interface.ts Configures User-Agent header for MCP server initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@robbie-c robbie-c requested a review from a team February 26, 2026 09:42
Changes format from 'posthog/wizard' to
'posthog/wizard; version: 1.34.0' to match the convention used
by other PostHog tools like the MCP server.

https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
Replace the try/catch require approach with a clean import from
package.json, enabled by adding resolveJsonModule to tsconfig.
TypeScript handles emitting the JSON into dist/ automatically.

https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
@robbie-c robbie-c merged commit edae68f into main Feb 26, 2026
14 checks passed
@robbie-c robbie-c deleted the claude/wizard-api-identification-CxZWY branch February 26, 2026 12:19
@daniloc
Copy link
Collaborator

daniloc commented Feb 26, 2026

/wizard-ci next-js

@daniloc daniloc restored the claude/wizard-api-identification-CxZWY branch February 26, 2026 16:39
@daniloc
Copy link
Collaborator

daniloc commented Feb 26, 2026

/wizard-ci next-js

@daniloc daniloc deleted the claude/wizard-api-identification-CxZWY branch February 26, 2026 16:41
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.

5 participants