developing-the-cli
Skill731 starsChanged 2 days agoMITView on GitHub
Changes PostHog's command line in this repo, which ships as two CLIs that must stay in step: posthog-cli, the Rust CLI in `cli/`, and hog, its TypeScript successor in `hog/`. Use before writing, fixing, or reviewing code under `cli/` or `hog/`, including symbol and sourcemap uploads, dSYM, Hermes and ProGuard handling, releases, login and credentials, query, endpoints, and schema commands, or a security fix in either CLI. Carries the rule that every change lands in both CLIs, how to find the matching code on the other side, the upload parity goldens, and the test and release steps for each. Trigger terms: posthog-cli, hog CLI, cli/, hog/, cargo, bun, symbol_sets.rs, upload.ts, parity golden, sampo changeset, port to hog.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- PostHog/posthogword for word, first seen Nov 15, 2026
Other versions1 project uses a version of this.
Word for word · 1
- PostHog/posthog★ 41k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository127 other files it gives its agents.
- AGENTS.mdAGENTS.md
- common/AGENTS.mdAGENTS.md
- hog/AGENTS.mdAGENTS.md
- proto/AGENTS.mdAGENTS.md
- rust/AGENTS.mdAGENTS.md
- .cursor/rules/django-python.mdcCursor rule
- .cursor/rules/react-typescript.mdcCursor rule
- .cursor/rules/rust.mdcCursor rule
- adding-activity-loggingSkill
- adding-api-scopesSkill
- adding-inbound-webhooksSkill
- adding-inbox-sourcesSkill
- adding-ingestion-warningsSkill
- adding-mcp-store-serversSkill
- adding-personhog-rpcSkill
- adding-product-alertingSkill
- adding-project-secret-api-key-authSkill
- adding-today-highlightsSkill
- adopting-generated-api-typesSkill
- analyzing-experiment-precompute-canarySkill
- analyzing-experiment-query-performanceSkill
- analyzing-insights-across-teamsSkill
- announcing-behavior-changesSkill
- auditing-llm-gateway-paritySkill
- auditing-warehouse-source-coverageSkill
- authenticating-to-clickhouseSkill
- authoring-ci-workflowsSkill
- building-product-empty-statesSkill
- building-the-toolbarSkill
- clickhouse-migrationsSkill
- creating-customer-analytics-account-widgetsSkill
- debugging-ci-failuresSkill
- debugging-local-replaySkill
- debugging-local-task-agent-runsSkill
- debugging-mcp-analyticsSkill
- debugging-signals-pipelineSkill
- debugging-table-access-deniedSkill
- depot-ciSkill
- depot-container-buildsSkill
- depot-github-runnersSkill
- developing-subscriptionsSkill
- django-migrationsSkill
- django-startup-timeSkill
- documenting-warehouse-sourcesSkill
- editing-agents-mdSkill
- establishing-code-ownershipSkill
- extending-hobby-smoke-testsSkill
- extending-personhog-test-harnessSkill
- extending-the-admin-consoleSkill
- finding-llm-gateway-migration-candidatesSkill
- fixing-flaky-testsSkill
- formatting-slack-messagesSkill
- gating-production-deploysSkill
- gating-sensitive-actionsSkill
- generating-clickhouse-query-performance-reportsSkill
- hogliSkill
- implementing-mcp-toolsSkill
- implementing-mcp-ui-appsSkill
- implementing-warehouse-sourcesSkill
- improving-drf-endpointsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
When a change does not apply to the other CLI, say why in the PR description, for example "hog prints only the error message, which never …
- Very specific: line 76
Add the regression test on both sides too.
- Very specific: line 77
Use /writing-tests for both.
- Very specific: line 82
Add a mockup of the terminal for each case that changed: success, each error, and each prompt, as a person at a terminal sees it.
- Very specific: line 83
When agent output (-o json) changed, show that too.
- Very specific: line 86
Put each in a console code block that starts with the command, and give the exit code when it isn't 0.
- Very specific: line 95
Use the cli scope in the PR title, as in fix(cli): ..., for a change to either CLI.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Developing the CLI
PostHog has two command lines in this repo:
| CLI | Folder | Language | Status |
posthog-cli | cli/ | Rust | Published. Customers and the SDK build integrations run it today |
hog | hog/ | TypeScript, Bun | Version 1, the successor. Not published yet; see hog/README.md |
Both stay in use until every caller moves to hog, so both must behave the same.
Change both CLIs
A change to one CLI is REQUIRED to land in the other one, in the same PR.
This covers features, bug fixes, error handling, new flags, and security fixes.
A fix that lands only in cli/ leaves the bug in hog, and the reverse ships a hog that posthog-cli users never get.
The only exceptions are commands that exist on one side:
hog/src/commands/legacy.tslists the commands posthog-cli still owns (logs,tasks,upgrade). A change to those touches onlycli/.- hog-only commands, such as
hog setup,hog api,hog ciandhog auth migrate, have no Rust counterpart. - The "Not planned" list in
hog/README.mdnames posthog-cli commands hog will not port.
When a change does not apply to the other CLI, say why in the PR description, for example "hog prints only the error message, which never contains the URL".
Reviewers: a PR that touches cli/src/ or hog/src/ without the other side, and without that sentence, is incomplete.
Find the matching code
Port the behavior, not the code. The two CLIs are laid out differently.
- Map the command with the table in
hog/MIGRATING.md(sourcemap uploadbecomeserror-tracking upload, and so on). Find the hog side with the layout table in
hog/AGENTS.md. Common pairs:posthog-cli hog cli/src/api/symbol_sets.rs(upload protocol)hog/src/error-tracking/upload.tscli/src/sourcemaps/,cli/src/debug_symbols/hog/src/error-tracking/kinds/,.../native/cli/src/release/hog/src/error-tracking/release.ts,git.tscli/src/login.rshog/src/commands/auth/,hog/src/posthog/cli/src/experimental/hog/src/commands/query/,endpoints/,schema/- Check how the runtimes differ before copying a fix. For example, reqwest puts the request URL in its error text, while Bun's
fetchkeeps it offerror.message, so a redaction needed in Rust may not be needed in hog. Verify such a difference, then name it in the PR.
Follow each side's rules
- hog: read
hog/AGENTS.mdbefore the first edit. It holds the command, output, error and typed-boundary rules. - Uploads: hog must send the same bytes, content hashes and requests as posthog-cli, or re-uploads fail with
content_hash_mismatch. Readhog/test/parity/README.mdbefore changing anything that reaches an upload. When a Rust change alters what posthog-cli uploads, regenerate the goldens from the new binary as that README describes, and review the diff. - posthog-cli: every user-visible change needs a sampo changeset in
cli/.sampo/changesets/, ascli/.sampo/README.mddescribes. hog has no changesets yet.
Test both sides
# posthog-cli
cargo test --locked --manifest-path cli/Cargo.toml
cargo clippy --locked --manifest-path cli/Cargo.toml --all-targets -- -D warnings
cargo fmt --manifest-path cli/Cargo.toml -- --check
# hog
pnpm --filter @posthog/hog unit
pnpm --filter @posthog/hog typecheckAdd the regression test on both sides too. hog tests drive the real CLI with runHog from hog/src/testing.ts, and its respond option fakes PostHog and object storage, so a hog test can cover the same failure as the Rust one without a server.
Use /writing-tests for both.
Show the terminal in the PR
A PR that changes what either CLI prints, asks or exits with shows it in the description.
Add a mockup of the terminal for each case that changed: success, each error, and each prompt, as a person at a terminal sees it.
When agent output (-o json) changed, show that too.
- Copy the mockup from a real run, such as
pnpm --filter @posthog/hog hog <command>orcargo run --manifest-path cli/Cargo.toml -- <command>. Write one by hand only for a state you can't reach locally, and say which. - Put each in a
consolecode block that starts with the command, and give the exit code when it isn't 0. - Reviewers judge wording, order and hints from the mockup, so they don't have to check out the branch to see what users get.
Before you report done
- The PR description shows the terminal for each changed case.
- Both CLIs carry the change, or the PR says why one does not need it.
- Both test suites pass, and
hog/test/parity/is green. cli/has a changeset when its behavior changed.- Use the
cliscope in the PR title, as infix(cli): ..., for a change to either CLI.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

