Repository navigation
feat(cli): add wizard cli add to install agent steering instructions - #646
Merged
Merged
Conversation
Adds a headless `wizard cli add` command that writes the PostHog CLI steering snippet into a coding agent's global instructions file (Claude Code ~/.claude/CLAUDE.md, Codex ~/.codex/AGENTS.md, Gemini CLI ~/.gemini/GEMINI.md, or any file via --path). Detected agents are offered as a numbered selection; non-interactive shells install for all detected agents, mirroring the MCP install behavior. The write is delegated to `npx -y @posthog/cli@latest api agents-md install`, so the snippet's single source of truth stays in the CLI and reruns always refresh the installed <posthog> block to the latest published content.
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
cvolzer3
marked this pull request as ready for review
June 11, 2026 20:37
Contributor
Author
|
Depends on PostHog/posthog#61178 |
bin.ts: keep the cli command (#646) plus main orphaned-settings-backup heal; drop the removed integrate command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gewenyu99
approved these changes
Jun 18, 2026
Collaborator
sarahxsanders
added a commit
that referenced
this pull request
Jun 24, 2026
Resolved 4 conflicts and completed the jest->vitest migration for tests main added after #656: - CLAUDE.md: take main's @AGENTS.md pointer; migrate the warlock kill-switch runbook line into AGENTS.md so it isn't lost - agent-interface.ts: keep both sides (isWarlockDisabled + isOrchestratorEnabled, both imports); honor main's removal of the init log lines while keeping the warlock pre-warm - agent-runner.ts: take main's runner/ re-export shim; re-home the scan-report flush into runner/index.ts as an idempotent flushScanReport() finalizer wired at the runProgram seam (registerCleanup + finally), so every harness reports without knowing warlock exists - provision-cli.test.ts: vitest port of main's #617 rewrite Migrated 9 jest test files (from #642/#606/#617/#646/#687/#689/#488) to vitest: vi.hoisted mock vars, importOriginal partial mocks, resetModules+import for isolateModules, vitest Mock/MockedFunction types. Full suite green: 980 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Coding agents don't know that
posthog-cli apiexists unless something tells them. The CLI can install its steering snippet into a repo'sAGENTS.md(posthog-cli api agents-md install), but there's no easy way to set it up globally — in the per-user instructions file of whichever agent someone uses (Claude Code's~/.claude/CLAUDE.md, Codex's~/.codex/AGENTS.md, …).Per product direction, this should not be a new wizard screen, nor an option on the MCP install screen — it's a standalone command.
Changes
wizard cli addcommand (src/commands/cli/):--allinstalls for every detected agent without prompting (rejected when combined with--agent/--path);--agent <id>and--path <file>for explicit/headless use.src/steps/install-cli-steering/step that delegates the actual write tonpx -y @posthog/cli@latest api agents-md install --path <file>. The steering snippet's single source of truth stays in the CLI, and pinning to@latestmeans a rerun always refreshes the installed<posthog>block to current content instead of baking a copy into the wizard that would go stale.cli addcommand — it is not wired into any onboarding program. It lives insteps/(mirroringadd-mcp-server-to-clients) so a program could adopt it later as an explicit product decision.Dependency: the
apicommand group ships in the next@posthog/clirelease (PostHog/posthog branchcodex/agentic-cli-api-tools). Until then the command fails with a clear error from the published CLI ("unrecognized subcommand 'api'"). Keeping this as a draft until that lands.Test plan
pnpm jest src/steps/install-cli-steering— 6 new unit tests (target mapping, detection, npx delegation incl. failure modes).pnpm build && pnpm test && pnpm fix— green exceptsrc/__tests__/provision-cli.test.ts, which fails identically on a clean checkout of main.node dist/bin.js cli add --help,node dist/bin.js cli add --path /tmp/x/AGENTS.md(surfaces the published CLI's missing-subcommand error cleanly, exit 1),node dist/bin.js cli add --all --agent claude-code(rejected by the cross-flag check).LLM context
Implemented with Claude Code; design follows the existing
mcp addcommand andadd-mcp-server-to-clientsstep patterns.