Back to Posthog

phrocs

tools/phrocs/README.md

1.43.13.7 KB
Original Source

phrocs

PostHog-branded dev process runner built with Bubble Tea. Drop-in replacement for mprocs — reads the same YAML config that hogli dev:generate produces.

Layout

text
┌───────────────────────────────────────────┐
│  phrocs                      ● 3 running  │  ← header
├────────────────┬──────────────────────────┤
│ ● backend      │ (process output)         │
│ ● frontend     │                          │  ← sidebar + viewport
│ ✗ capture      │                          │
├────────────────┴──────────────────────────┤
│ k next  j prev  r restart  q quit  ? help │  ← footer
└───────────────────────────────────────────┘

Usage

sh
phrocs --config <config.yaml>
phrocs --config <config.yaml> --debug   # write debug log to /tmp/phrocs-debug.log

The config is generated by hogli dev:generate and lives at .cache/hogli/dev.yaml in the repo root. You typically run phrocs via hogli dev rather than directly.

Keybindings

KeyAction
tabSwap focus sidebar/output
↓/kNext process (sidebar) / scroll down (output)
↑/jPrevious process (sidebar) / scroll up (output)
pgdnScroll output down
pgupScroll output up
homeJump to top of output
endJump to bottom of output
rRestart selected process
sStop selected process
cEnter copy mode
/Enter search mode
escExit copy and search modes
?Toggle full help
qQuit

Mouse clicks switch focus; mouse wheel scrolls the output pane.

Copy mode

Press c to enter copy mode in the output pane. Navigate with /, press c again to mark the selection start, then extend with / and press c to copy to clipboard. Press esc to exit without copying.

Search mode

Press / to enter search mode, type a query, then press enter to keep highlights active. Use and ⇧↵ to jump to the next/previous match. Press esc to clear the active search.

Debug logging

Pass --debug to write a timestamped log of TUI events to /tmp/phrocs-debug.log:

log
2026/03/06 10:00:00.123456 debug logging started
2026/03/06 10:00:00.145678 resize: 220x54
2026/03/06 10:00:00.200000 status: proc=backend status=running
2026/03/06 10:00:01.300000 key: "j" (type=runes)
2026/03/06 10:00:01.300100 proc selected: 0→1 (frontend)

Tail it in a separate terminal while phrocs is running:

sh
tail -f /tmp/phrocs-debug.log

Package structure

fs
phrocs/
├── main.go                   entry point, arg parsing, program wiring
└── internal/
    ├── config/               YAML config loader
    ├── ipc/                  Unix domain socket server (/tmp/phrocs.sock)
    ├── process/              process lifecycle (start, stop, restart, pty I/O)
    └── tui/                  Bubble Tea model, key map, styles