Files
oh-my-pi/packages/utils
can1357 9fb082bf14 refactor(utils): consolidated file locking into pi-utils file-lock
- Moved the coding-agent lock-directory primitive to @oh-my-pi/pi-utils/file-lock
  and migrated settings, MCP config-writer, and security store imports.
- Replaced the stats aggregator's parallel ~200-line token/breaker lock protocol
  with the shared primitive: dead owners reclaimed immediately, live-but-wedged
  owners after STATS_SYNC_LOCK_STALE_MS, unstamped acquisitions after the new
  acquireStaleMs grace (10s).
- Shared primitive now treats EPERM kill probes as live owners.
- Rewrote the stats lock-reclamation regressions against the shared protocol
  and moved the file-lock contract test into pi-utils.
2026-08-03 15:25:03 +02:00
..
2026-08-03 05:53:12 +02:00
2026-08-03 05:53:12 +02:00

@oh-my-pi/pi-utils

Shared utilities for oh-my-pi packages. Zero ceremony, Bun-first.

Notable modules

Module Purpose
logger Centralized logger writing to ~/.omp/logs/ with rotation (TUI-safe — never stdout)
prompt Handlebars-based prompt templating and formatting helpers
dirs Path helpers for omp config directories (~/.omp, XDG-aware on Linux)
stream readStream / readLines helpers over ReadableStream
ptree / procmgr Process trees, ChildProcess wrapper, process lifecycle management
postmortem Cleanup callbacks on exit, signals, and fatal exceptions
which $which() binary lookup with caching
fetch-retry fetch with retry/backoff policies
fs-error Errno guards (isEnoent and friends)
env / worker-host Environment plumbing and side-effect-free worker-host entry contract (workerHostEntry)
abortable / async AbortSignal-aware stream/promise helpers
peek-file Read the first N bytes of a file with pooled buffers
frontmatter, glob, mime, temp, format, color, snowflake, tab-spacing, path-tree, sanitize-text Smaller single-purpose helpers

Import from the root barrel or per-module subpaths (@oh-my-pi/pi-utils/<module>).

Install

bun add @oh-my-pi/pi-utils

Ships TypeScript source directly (no build step); requires Bun ≥ 1.3.14.

References