How jandedobbeleer/oh-my-posh works
Oh My Posh is a cross-platform, configurable shell prompt engine. In the principal workflow, a shell integration invokes the CLI, which uses configuration and runtime state to build prompt output; the prompt engine formats it for terminal display. The repository also supports rendering configurations to SVG in the CLI and browser, plus website tooling and MCP endpoints. The excerpts show shared render setup and selected integrations, but not the full CLI dispatch or segment execution path, so those links are omitted or marked unverified.
Main entry points: segment.go Prompt config · render.go Render setup · main.go WASM renderer · engine.go Prompt engine
Components 18
Shell and CLI
- Shell integration
src/shell/init.go - CLI entry
src/main.go - CLI commands
src/cli
Prompt rendering
- Prompt config
src/config/segment.go - Prompt segments
src/segments - Prompt engine
src/prompt/engine.go - Terminal writer
src/terminal/writer.go - Prompt cache
src/cache - Render setup
src/render/render.go - SVG encoder
src/svg/svg.go
Browser rendering
- WASM renderer
src/wasm/main.go - Config editor
website/src/components/ConfigEditor/useWasmRenderer.js - WASM loader
website/src/components/ConfigEditor/wasmLoader.js - Studio
website/src/components/Studio/index.js
Website services
- MCP endpoint
website/api/mcp/index.js - Request validator
website/api/shared/validator.js - Segment catalog data
website/plugins/segments/data.js
Other components
- Shell user
Connections 18
- Shell user → Shell integration: uses
README.md - Shell integration → CLI entry: invokes CLI
- CLI entry → CLI commands: calls
src/main.go - CLI commands → Prompt engine: renders prompt
- Prompt config → Prompt cache: uses
src/config/segment.go - Prompt config → Prompt segments: executes
src/config/segment.go - Prompt engine → Prompt config: loads
src/prompt/engine.go - Prompt engine → Terminal writer: writes output
src/prompt/engine.go - Render setup → Prompt config: initializes
src/render/render.go - Render setup → Prompt engine: builds
src/render/render.go - Render setup → SVG encoder: configures SVG
src/render/render.go - WASM renderer → Prompt config: parses config
src/wasm/main.go - WASM renderer → Render setup: uses setup
src/wasm/main.go - WASM renderer → SVG encoder: returns SVG
- Config editor → WASM loader: loads module
website/src/components/ConfigEditor/useWasmRenderer.js - Config editor → WASM renderer: calls renderer
website/src/components/ConfigEditor/useWasmRenderer.js - Studio → Config editor: uses renderer
website/src/components/ConfigEditor/useWasmRenderer.js - MCP endpoint → Request validator: validates with
website/api/mcp/index.js