Detect existing PostHog setup and serve a menu of skills instead of re-running instrumentation
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 58/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
从 src/lib/programs/posthog-integration/steps.ts 和 PostHogIntegrationIntroScreen.tsx 开始,然后阅读 package-scanning.ts、posthog-integration/index.ts 和 program-registry.ts。跟踪现有的依赖检测和可用的子命令程序。完成的标准是:现有设置获得一个带有路由的 skills 菜单,以及一种明确的方式来重新运行集成,同时不改变新设置当前的默认流程。
由索引模型根据 Issue 内容生成。
描述
Problem
When you run npx @posthog/wizard (the default integration flow) on a project that already has PostHog set up, the wizard doesn't notice. It walks you straight into the full instrumentation program — detect → intro ("Continue") → health check → setup → auth → run (plan event tracking, install posthog, instrument events) → outro.
From a user who tried this on an already-instrumented project:
It seemed like it didn't know I'd already set up PostHog. I feel like it should notice that and say something like "Looks like you already have PostHog set up, what can we help you with?" (with a list of skills) — instead I clicked Continue and it started the whole instrumentation process. I would've been worried it was about to start changing whatever I had set up previously.
Once I finished the wizard, it wasn't clear to me how to interact with it again. If I wanted to audit my events or run the product tours skill, where would I go?
The skills are runnable (npx @posthog/wizard audit, npx @posthog/wizard events-audit, etc.), but nothing surfaces them — so re-running the wizard on an existing project is both confusing and a little scary (looks like it might overwrite existing setup).
Proposed behavior
When the default flow detects PostHog is already installed in the target project, intervene instead of starting instrumentation: show a menu of available wizard skills/programs and ask what the user wants to do, e.g.
Looks like you already have PostHog set up. What can we help you with?
› Audit my events
Events audit
Revenue analytics setup
Error tracking source maps
SDK doctor
...
Re-run integration anyway
Selecting an option routes into that program. "Re-run integration anyway" preserves the current behavior for anyone who genuinely wants it.
Relevant code
- Default program steps:
src/lib/programs/posthog-integration/steps.ts(detect→intro→ ...). - PostHog-installed detection already exists in pieces and could be reused/centralized:
src/lib/programs/shared/package-scanning.ts—findPackageJsons()scans forPOSTHOG_SDKS(posthog-js,posthog-node, etc.).hasDeclaredDependency(...)insrc/lib/programs/posthog-integration/index.ts(currently only logs a warning and continues).hasPostHogSdk(...)used by the source-maps / revenue prerequisite gates.
- Intro screen that currently just offers "Continue":
src/ui/tui/screens/PostHogIntegrationIntroScreen.tsx. - Program registry (the source of truth for a skills menu):
src/lib/programs/program-registry.ts(getSubcommandPrograms()).
Notes / open questions
- "Already installed" should probably be more than just a dependency in
package.json— ideally an actual init/API key — to avoid false positives on half-finished setups. - This also addresses discoverability: the menu doubles as the answer to "how do I run a skill again later?" Worth coordinating with the docs update in PostHog/posthog.com#17438.
- Keep an escape hatch to force the integration flow (menu option and/or a flag) for users who explicitly want to re-instrument.
Filed from team triage of a wizard run-through on an existing PostHog project.
- 主要语言
- TypeScript
- 星标
- 208
- 派生
- 58
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 76
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PostHog/wizard 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 2 天内回复
-
wizard --version prints unknown when run through npx可能已有人在做 @bryanlundberg 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 2 天内回复
-
Self-driving setup: checkbox labels and Confirm button overlap wrapped description text可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
相似的 Issue
-
bug Needs Triage
难度 2/5 1-3 小时 新手友好度 79/100
scottbenton/Iron-Link#541 ·
维护者通常 1 天内回复
-
hosts settings: the SSH address field and the separate User field are two ways to name one SSH user未关闭
难度 2/5 1-3 小时 新手友好度 72/100
prime-radiant-inc/evener#8161 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nicobailon/pi-subagents#3420 ·
维护者通常 1 天内回复
-
Edit content TabList: selected tab's icon/label are hidden by its own selection indicator - a11y未关闭01 type: bug 99 tag: UX Accessibility
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 2 天内回复