Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/skills/storybook-stories/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: storybook-stories
description: Write Storybook stories for PostHog Code UI components. Covers the provider stack stories run inside, the key gotcha that tRPC/useHostTRPC queries never resolve in Storybook (so data-fetching components render empty), and the pure-presentational split that makes a component storyable. Use when adding or fixing a *.stories.tsx file under packages/ui.
description: Write Storybook stories for PostHog UI components. Covers the provider stack stories run inside, the key gotcha that tRPC/useHostTRPC queries never resolve in Storybook (so data-fetching components render empty), and the pure-presentational split that makes a component storyable. Use when adding or fixing a *.stories.tsx file under packages/ui.
---

# Storybook stories in PostHog Code
# Storybook stories in PostHog

Stories live next to components as `*.stories.tsx` and are collected by
`apps/code/.storybook/main.ts` (its glob includes
Expand Down
10 changes: 5 additions & 5 deletions .claude/skills/test-electron-app/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: test-electron-app
description: Drive the real running PostHog Code Electron app (live tRPC, workspace-server, real data) over CDP with agent-browser. Connect to the running app on port 9222, snapshot the accessibility tree to verify changes, click/type/navigate, and screenshot the actual desktop app only when explicitly asked. Use when asked to test, verify, dogfood, screenshot or interact with the running app. For regression specs use the Playwright E2E suite.
description: Drive the real running PostHog Electron app (live tRPC, workspace-server, real data) over CDP with agent-browser. Connect to the running app on port 9222, snapshot the accessibility tree to verify changes, click/type/navigate, and screenshot the actual desktop app only when explicitly asked. Use when asked to test, verify, dogfood, screenshot or interact with the running app. For regression specs use the Playwright E2E suite.
allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*), Bash(pnpm app:cdp*)
---

# Test the real PostHog Code Electron app
# Test the real PostHog Electron app

Drive the actual running app over the Chrome DevTools Protocol with
[agent-browser](https://github.com/vercel-labs/agent-browser). The dev app
Expand Down Expand Up @@ -186,7 +186,7 @@ When the user asked for a screenshot, they want to look at it, so close the loop
default debugging port; if `connect` attaches to the wrong target, list and
pick the PostHog window: `agent-browser tab` then `agent-browser tab --url "*"`.
- **Multiple targets:** the app has a main renderer window (page title contains
"PostHog Code") plus possible webviews/devtools. `agent-browser tab` lists them;
"PostHog") plus possible webviews/devtools. `agent-browser tab` lists them;
switch with `agent-browser tab <index>`.
- **Never pass `--color-scheme dark`:** that global flag makes agent-browser apply
device emulation that forces a 1280x720 viewport and renders this Electron window
Expand All @@ -201,7 +201,7 @@ When the user asked for a screenshot, they want to look at it, so close the loop

## Running alongside prod

PostHog Code orchestrates the agent, so the usual loop is: **prod** (the installed app) runs the agent, and the **dev** build (`pnpm dev`) is the system under test. They coexist by design (`apps/code/src/main/bootstrap.ts`): dev runs as `posthog-code-dev` with its own app name, userData and single-instance lock, so it never collides with prod.
PostHog orchestrates the agent, so the usual loop is: **prod** (the installed app) runs the agent, and the **dev** build (`pnpm dev`) is the system under test. They coexist by design (`apps/code/src/main/bootstrap.ts`): dev runs as `posthog-code-dev` with its own app name, userData and single-instance lock, so it never collides with prod.

- **agent-browser always targets dev.** Only the dev build exposes CDP on `:9222`; prod has no debug port, so `connect 9222` can't accidentally drive prod.
- **Separate auth/state.** The dev instance has its own `posthog-code-dev` profile; it is not signed in just because prod is. Sign into the dev window once; its state persists.
Expand All @@ -220,6 +220,6 @@ PostHog Code orchestrates the agent, so the usual loop is: **prod** (the install
check the `pnpm dev:code` output. Note `pnpm dev` cannot run headlessly at all — its
`phrocs` TUI needs a TTY; use `pnpm dev:code`.
- **Snapshot is empty / wrong window:** you're on the wrong target. Run
`agent-browser tab` and switch to the "PostHog Code" page.
`agent-browser tab` and switch to the "PostHog" page.
- **Can't type into an input:** try `agent-browser keyboard type "text"` (types at
current focus) or `agent-browser keyboard inserttext "text"` to bypass key events.
4 changes: 2 additions & 2 deletions .github/workflows/code-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ jobs:
MATRIX_ARCH: ${{ matrix.arch }}
run: |
if [[ "$MATRIX_ARCH" == "arm64" ]]; then
APP_BUNDLE="apps/code/out/mac-arm64/PostHog Code.app"
APP_BUNDLE="apps/code/out/mac-arm64/PostHog.app"
else
APP_BUNDLE="apps/code/out/mac/PostHog Code.app"
APP_BUNDLE="apps/code/out/mac/PostHog.app"
fi
RESOURCES="$APP_BUNDLE/Contents/Resources"
UNPACKED="$RESOURCES/app.asar.unpacked/node_modules"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-discord-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release PostHog Code to Discord
name: Release PostHog to Discord

on:
release:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release PostHog Code
name: Release PostHog

on:
push:
Expand Down Expand Up @@ -170,9 +170,9 @@ jobs:
MATRIX_ARCH: ${{ matrix.arch }}
run: |
if [[ "$MATRIX_ARCH" == "arm64" ]]; then
APP_BUNDLE="apps/code/out/mac-arm64/PostHog Code.app"
APP_BUNDLE="apps/code/out/mac-arm64/PostHog.app"
else
APP_BUNDLE="apps/code/out/mac/PostHog Code.app"
APP_BUNDLE="apps/code/out/mac/PostHog.app"
fi
RESOURCES="$APP_BUNDLE/Contents/Resources"
UNPACKED="$RESOURCES/app.asar.unpacked/node_modules"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-tag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tag PostHog Code Release
name: Tag PostHog Release

on:
schedule:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
echo "$1 Skipping auto-release; the next scheduled release will pick this up."
echo "authorized=false" >> "$GITHUB_OUTPUT"
GH_TOKEN="$COMMENT_TOKEN" gh pr comment "$PR_NUMBER" --repo "$REPOSITORY" \
--body "$1 Auto-release is limited to Team PostHog Code members, so this will ship with the next scheduled release instead." || true
--body "$1 Auto-release is limited to members of the team-posthog-code GitHub team, so this will ship with the next scheduled release instead." || true
}

LABELER=$(gh api "repos/${REPOSITORY}/issues/${PR_NUMBER}/events" --paginate \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-build-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ jobs:
echo ""
echo "**[⬇️ Open this run and download the \`code-macos-arm64\` artifact](${RUN_URL}#artifacts)** (Apple Silicon / M-series)."
echo ""
echo "Unzip it to get the \`.dmg\`, open it, and drag **PostHog Code** into **Applications**."
echo "Unzip it to get the \`.dmg\`, open it, and drag **PostHog** into **Applications**."
echo ""
echo "This build is **signed but not notarized**, so macOS quarantines it on download and Gatekeeper reports *\"PostHog Code is damaged and can't be opened\"*. That is the missing notarization, not a corrupt file — clear the quarantine flag once and it launches:"
echo "This build is **signed but not notarized**, so macOS quarantines it on download and Gatekeeper reports *\"PostHog is damaged and can't be opened\"*. That is the missing notarization, not a corrupt file — clear the quarantine flag once and it launches:"
echo ""
echo "\`\`\`sh"
echo "xattr -dr com.apple.quarantine \"/Applications/PostHog Code.app\""
echo "xattr -dr com.apple.quarantine \"/Applications/PostHog.app\""
echo "\`\`\`"
echo ""
echo "Then open **PostHog Code** normally. (Fully notarized, double-click-to-run builds ship only from the tagged release pipeline.)"
echo "Then open **PostHog** normally. (Fully notarized, double-click-to-run builds ship only from the tagged release pipeline.)"
echo ""
echo "<sub>Built from ${GITHUB_SHA} · rebuilds on each push while the \`build-installer\` label is present. Downloading requires being signed in to GitHub with repo access.</sub>"
} > comment-body.md
Expand Down
10 changes: 5 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug PostHog Code (Main Process)",
"name": "Debug PostHog (Main Process)",
"type": "node",
"request": "attach",
"port": 5858,
Expand All @@ -15,7 +15,7 @@
"remoteRoot": "${workspaceFolder}"
},
{
"name": "Debug PostHog Code (Renderer Process)",
"name": "Debug PostHog (Renderer Process)",
"type": "chrome",
"request": "attach",
"port": 9222,
Expand All @@ -32,10 +32,10 @@
],
"compounds": [
{
"name": "Debug PostHog Code (Main + Renderer)",
"name": "Debug PostHog (Main + Renderer)",
"configurations": [
"Debug PostHog Code (Main Process)",
"Debug PostHog Code (Renderer Process)"
"Debug PostHog (Main Process)",
"Debug PostHog (Renderer Process)"
],
"preLaunchTask": "start-dev-with-debug",
"stopAll": true
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# PostHog Code Development Guide
# PostHog Development Guide

`AGENTS.md` is the source of truth for architecture and development rules. `CLAUDE.md` is a symlink to this file. Edit this file only.

## Architecture

PostHog Code uses a layered architecture. Business logic and UI live in shared `packages/*`. Each `apps/*` host boots those packages and binds host-specific implementations. `@posthog/core` and `@posthog/ui` must run unchanged on desktop, web, and mobile.
PostHog uses a layered architecture. Business logic and UI live in shared `packages/*`. Each `apps/*` host boots those packages and binds host-specific implementations. `@posthog/core` and `@posthog/ui` must run unchanged on desktop, web, and mobile.

Principle: logic is portable; hosts are thin.

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to PostHog Code
# Contributing to PostHog

We love contributions big and small. PostHog Code is the IDE for understanding how users interact with your product -- and we want the community involved in shaping it.
We love contributions big and small. The PostHog desktop app is the IDE for understanding how users interact with your product -- and we want the community involved in shaping it.

## Getting started

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
> [!IMPORTANT]
> Interested in PostHog Code? [Join the waitlist](https://posthog.com/code) or hop into our [Discord](https://discord.gg/aSrHKVNVdR).
> Interested in the PostHog desktop app? [Join the waitlist](https://posthog.com/code) or hop into our [Discord](https://discord.gg/aSrHKVNVdR).

**[Download the latest version](https://github.com/PostHog/code/releases/latest)**

Found a bug or have feedback? [Open an issue](https://github.com/PostHog/code/issues/new) on GitHub.

# PostHog Code
# PostHog

This is the monorepo for PostHog Code apps and the agent framework that powers them.
This is the monorepo for the PostHog desktop and mobile apps and the agent framework that powers them.

## Development

Expand Down Expand Up @@ -57,7 +57,7 @@ Scripts in `scripts/` for development and debugging:

| Script | Description |
|--------|-------------|
| `scripts/clean-posthog-code-macos.sh` | Remove all PostHog Code app data from macOS (caches, preferences, logs, saved state). Use `--app` flag to also delete PostHog Code.app from /Applications. |
| `scripts/clean-posthog-code-macos.sh` | Remove all PostHog app data from macOS (caches, preferences, logs, saved state). Use `--app` flag to also delete PostHog.app from /Applications. |
| `scripts/test-access-token.js` | Validate a PostHog OAuth access token by testing API endpoints. Usage: `node scripts/test-access-token.js <token> <project_id> [region]` |

## Project Structure
Expand All @@ -83,8 +83,8 @@ posthog-code/
| [apps/mobile/README.md](./apps/mobile/README.md) | Mobile app: Expo setup, EAS builds, and TestFlight deployment |
| [apps/cli/README.md](./apps/cli/README.md) | CLI: stacked PR management with Jujutsu |
| [AGENTS.md](./AGENTS.md) | Architecture rules, code style, patterns, and testing guidelines (read by Claude Code, Codex, Cursor, Aider, etc.) |
| [CONTRIBUTING.md](./CONTRIBUTING.md) | How to contribute to PostHog Code |
| [docs/LOCAL-DEVELOPMENT.md](./docs/LOCAL-DEVELOPMENT.md) | Connecting PostHog Code to a local PostHog instance |
| [CONTRIBUTING.md](./CONTRIBUTING.md) | How to contribute to PostHog |
| [docs/LOCAL-DEVELOPMENT.md](./docs/LOCAL-DEVELOPMENT.md) | Connecting the desktop app to a local PostHog instance |
| [docs/UPDATES.md](./docs/UPDATES.md) | Release versioning and git tagging |
| [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) | Common issues and fixes |
| [docs/DEEP-LINKS.md](./docs/DEEP-LINKS.md) | `posthog-code://` deep link schemes and parameters |
Expand Down
18 changes: 9 additions & 9 deletions apps/code/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostHog Code
# PostHog

The PostHog desktop task manager
The agentic workspace for product builders

## The Goal

Expand Down Expand Up @@ -56,8 +56,8 @@ pnpm make

Output will be in:

- `out/PostHog Code-darwin-arm64/PostHog Code.app` - Packaged app
- `out/make/PostHog Code-*.dmg` - macOS installer
- `out/mac-arm64/PostHog.app` - Packaged app
- `out/PostHog-Code-*.dmg` - macOS installer
- `out/make/zip/` - ZIP archives

**Note:** Native modules for the DMG maker are automatically compiled via the `prePackage` hook. If you need to manually rebuild them, run:
Expand All @@ -68,13 +68,13 @@ pnpm build-native

### Auto Updates & Releases

PostHog Code auto-updates on macOS and Windows. Current builds use `electron-updater`, which reads the `latest-mac.yml` and `latest.yml` manifests published with each non-draft GitHub release and downloads the matching archive. Builds made by the old Electron Forge toolchain (`v0.55.x` and earlier) take a single bridge update through the public `update.electronjs.org` service, which serves the same GitHub releases to their built-in Squirrel client, and become `electron-updater` clients from the next launch. See [docs/UPDATES.md](../../docs/UPDATES.md) and [docs/AUTO-UPDATE-TESTING.md](../../docs/AUTO-UPDATE-TESTING.md).
PostHog auto-updates on macOS and Windows. Current builds use `electron-updater`, which reads the `latest-mac.yml` and `latest.yml` manifests published with each non-draft GitHub release and downloads the matching archive. Builds made by the old Electron Forge toolchain (`v0.55.x` and earlier) take a single bridge update through the public `update.electronjs.org` service, which serves the same GitHub releases to their built-in Squirrel client, and become `electron-updater` clients from the next launch. See [docs/UPDATES.md](../../docs/UPDATES.md) and [docs/AUTO-UPDATE-TESTING.md](../../docs/AUTO-UPDATE-TESTING.md).

There are three ways a release can fire:

1. **Scheduled (default)** — automatic at 17:00 and 01:00 UTC.
2. **Hotfix** — add the `Create release` label to a PR before it merges. On merge, the tag workflow runs immediately and ships whatever is on `main`.
3. **Manual** — run `Tag PostHog Code Release` via `workflow_dispatch` from the Actions tab.
3. **Manual** — run `Tag PostHog Release` via `workflow_dispatch` from the Actions tab.

Local prep (only needed for one-off manual builds):

Expand Down Expand Up @@ -123,11 +123,11 @@ SKIP_NOTARIZE=1 pnpm run make

## Workspace Configuration (posthog-code.json)

PostHog Code supports per-repository configuration through a `posthog-code.json` file. This lets you define scripts that run automatically when workspaces are created or destroyed.
PostHog supports per-repository configuration through a `posthog-code.json` file. This lets you define scripts that run automatically when workspaces are created or destroyed.

### File Locations

PostHog Code searches for configuration in this order (first match wins):
PostHog searches for configuration in this order (first match wins):

1. `.posthog-code/{workspace-name}/posthog-code.json` - Workspace-specific config
2. `posthog-code.json` - Repository root config
Expand Down Expand Up @@ -184,7 +184,7 @@ Clean up Docker containers:

## Workspace Environment Variables

PostHog Code automatically sets environment variables in all workspace terminals and scripts. These are available in `init`, `start`, and `destroy` scripts, as well as any terminal sessions opened within a workspace.
PostHog automatically sets environment variables in all workspace terminals and scripts. These are available in `init`, `start`, and `destroy` scripts, as well as any terminal sessions opened within a workspace.

| Variable | Description | Example |
|----------|-------------|---------|
Expand Down
8 changes: 4 additions & 4 deletions apps/code/electron-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const skipNotarize =
const config: Configuration = {
// Original release bundle id; changing it breaks existing installs' data dir and Keychain entries.
appId: "com.posthog.array",
productName: "PostHog Code",
executableName: "PostHog Code",
productName: "PostHog",
executableName: "PostHog",

directories: {
output: "out",
Expand Down Expand Up @@ -61,7 +61,7 @@ const config: Configuration = {

protocols: [
{
name: "PostHog Code",
name: "PostHog",
schemes: ["posthog-code"],
},
],
Expand All @@ -81,7 +81,7 @@ const config: Configuration = {
// Shown in the macOS microphone-permission prompt when a user records a
// custom notification sound.
NSMicrophoneUsageDescription:
"PostHog Code uses the microphone to record custom notification sounds.",
"PostHog uses the microphone to record custom notification sounds.",
},
notarize: !skipNotarize,
},
Expand Down
2 changes: 1 addition & 1 deletion apps/code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/src/renderer/assets/images/bw-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PostHog Code</title>
<title>PostHog</title>
</head>

<body class="bg-(--color-background) text-(--gray-12)">
Expand Down
4 changes: 2 additions & 2 deletions apps/code/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@posthog/code",
"version": "0.0.0-dev",
"description": "PostHog Code - desktop task manager",
"homepage": "https://posthog.com",
"description": "PostHog - the agentic workspace for product builders",
"homepage": "https://posthog.com/desktop",
"main": ".vite/build/bootstrap.js",
"versionHash": "dynamic",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion apps/code/scripts/dev-update/build-pair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ pnpm exec electron-builder build --mac zip --arm64 --publish never \
-c.extraMetadata.version="$OLD_VERSION" --config electron-builder.ts

echo "==> feed=$FEED_DIR"
echo "==> app=out/mac-arm64/PostHog Code.app ($OLD_VERSION)"
echo "==> app=out/mac-arm64/PostHog.app ($OLD_VERSION)"
4 changes: 2 additions & 2 deletions apps/code/scripts/dev-update/run-from-ci-forge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ command -v gh >/dev/null || {
exit 1
}

if pgrep -x "PostHog Code" >/dev/null; then
echo "PostHog Code is already running. Quit it first; the test build shares its single-instance lock and data dir." >&2
if pgrep -x "PostHog Code|PostHog" >/dev/null; then
echo "PostHog is already running. Quit it first; the test build shares its single-instance lock and data dir." >&2
exit 1
fi

Expand Down
Loading
Loading