Skip to content

feat: pass org and project names to provisioning API#384

Open
MattBro wants to merge 4 commits intomainfrom
matt/provisioning-project-names
Open

feat: pass org and project names to provisioning API#384
MattBro wants to merge 4 commits intomainfrom
matt/provisioning-project-names

Conversation

@MattBro
Copy link
Copy Markdown
Contributor

@MattBro MattBro commented Apr 12, 2026

Problem

When the wizard provisions a new account via the PKCE flow, the organization gets named "Wizard (email)" and the project gets named "Default project" - not helpful.

Changes

Detects org and project names from git remote get-url origin:

  • github.com/AcmeCorp/my-app -> org=AcmeCorp, project=my-app

Fallbacks when no git remote:

  • Org: email domain (skips freemail like gmail/hotmail) -> e.g. matt@stripe.com -> stripe
  • Project: basename(cwd) -> e.g. /Users/matt/projects/my-app -> my-app
  • No signal at all: server defaults (Wizard (email) / Default project)

Adds --org-name and --project-name CLI arguments (+ POSTHOG_WIZARD_ORG_NAME / POSTHOG_WIZARD_PROJECT_NAME env vars) to explicitly override auto-detection:

npx @posthog/wizard --org-name "AcmeCorp" --project-name "my-app"

When provided, these take precedence over the git remote / email domain detection.

Depends on PostHog/posthog#53493 (server-side support for configuration.organization_name and configuration.project_name).

How did you test this code?

  • 8/8 provisioning unit tests pass
  • 457/460 full suite pass (same 3 skipped as before)
  • E2E against local dev server with feat: make agentic provisioning multi-tenant with ProvisioningPartner model posthog#53493:
    • Git remote github.com/AcmeCorp/analytics-dashboard -> org="AcmeCorp", project="analytics-dashboard" in DB
    • Work email fallback: dev@stripe.com -> org="stripe"
    • Freemail fallback: dev@gmail.com -> org=undefined (server default)
    • No git remote: project falls back to dirname

Publish to changelog?

No

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

🧙 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.

@MattBro MattBro requested a review from edwinyjlim April 13, 2026 12:46
Base automatically changed from matt/provisioning-signup-flow to main April 13, 2026 14:57
@MattBro MattBro force-pushed the matt/provisioning-project-names branch from b18412d to 6256741 Compare April 13, 2026 15:01
@MattBro MattBro requested a review from a team April 13, 2026 15:18
Copy link
Copy Markdown
Member

@edwinyjlim edwinyjlim left a comment

Choose a reason for hiding this comment

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

LGTM

@MattBro MattBro force-pushed the matt/provisioning-project-names branch from f55f7ca to f6c8a72 Compare April 13, 2026 21:27
MattBro and others added 3 commits April 13, 2026 17:29
- Organization name: "{name}'s Organization" when the user provides
  their name, sent via configuration.organization_name
- Project name: basename of cwd (e.g. "my-nextjs-app"), sent via
  configuration.project_name on the resources request
- Falls back to server defaults when not provided (Wizard (email)
  for org, Default project for project)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Pass email local part (e.g. "matt" from "matt@example.com") as
  the user name so organization_name gets set to "matt's Organization"
  instead of falling back to "Wizard (email)"
- Add tests for project_name passthrough and omission
- 8/8 provisioning tests pass, 457/460 full suite pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of using email prefix for org name and basename(cwd) for
project, now parses `git remote get-url origin` to extract both:
- github.com/AcmeCorp/my-app -> org="AcmeCorp", project="my-app"

Fallbacks:
- No git remote: org from email domain (skip freemail), project from
  directory name
- CLI overrides via --org-name and --project-name (future)

provisionNewAccount now takes an opts object with orgName/projectName
instead of positional args.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MattBro MattBro force-pushed the matt/provisioning-project-names branch from f6c8a72 to e0fd993 Compare April 13, 2026 21:30
Use POSTHOG_US_CLIENT_ID for production and POSTHOG_DEV_CLIENT_ID for
dev, matching the OAuthApplication client_ids in each environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants