feat(cli): add wizard cli add to install agent steering instructions#646
Open
cvolzer3 wants to merge 2 commits into
Open
feat(cli): add wizard cli add to install agent steering instructions#646cvolzer3 wants to merge 2 commits into
wizard cli add to install agent steering instructions#646cvolzer3 wants to merge 2 commits into
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. |
Author
|
Depends on PostHog/posthog#61178 |
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.