pi-plus
v0.2.52
Published
pi coding agent with the pi-plus override layer (pipi CLI)
Readme
plus-cli
The pi-plus CLI surface, on top of the shared override core in ../plus.
Direct updates to any other folder under packages/ are forbidden — upstream packages
stay pristine so they can be synced/updated without merge conflicts.
The published npm artifact is pi-plus (https://www.npmjs.com/package/pi-plus);
it installs a single global command, pipi — deliberately not pi (pi-plus must
not own pi's command). Library hosts embedding pi in-process use the separate
pi-plus-sdk package built from ../plus-api.
What this layer adds on top of the shared core
The context-detection/compaction/reasoning overrides and the twelve non-TUI extensions
(subagent, tasks, memory, plan, ask-user, hooks, context-guard, recap, diagram, /cd, /init, web-search) live in
../plus and are shared with the SDK. This package adds the CLI-only pieces:
- Hub profiles (
src/coding-agent/main.tswrapper, backed by@earendil-works/pi-hub=../hub) — named pi profiles (provider/models/thinking/token/base URL) stored in~/.pi/profiles.json, materialized into isolated agent dirs under~/.pi/pi-hub/profiles/<name>/. Addspipi profile …,pipi use/pipi unuse, and thepipi --as <name>flag. The wrapper resolves the profile, setsPI_CODING_AGENT_DIRin-process (read lazily bygetAgentDir()), and delegates to the originalmain.pipi profile add <name> -p <provider>with no credential — orpipi profile add/update <name> --sign-infor an explicit sign-in that overwrites the profile token — invokes the provider's interactive login (OAuth page / API-key setup) against the profile dir via hub's injectedloginhook, usingloginProviderfrom../plus/src/auth/login.ts(the same entrypi-plus-sdkre-exports for embedded hosts); the TUI/loginis disabled by core redirect wrappers in favour of this flow. - Shell completion (
src/completion/) —pipi completion <bash|zsh>prints a completion script covering the whole CLI: hub subcommands (with dynamic profile/model names from~/.pi/profiles.json) plus pi's native commands and flags. - Usage print (
src/coding-agent/cli/args.tswrapper) —pipi --helpgains a "Profile commands (pi-plus)" section. - Welcome banner (
src/coding-agent/ui/banner.ts) — pipi's TUI startup header is a CC-style banner with a block-character π+ mark: condensed logo by default, boxed variant with Extensions/Skills feeds, compact/plain degradation on narrow terminals,resumed <id> · <title>on resume/fork. - Vim modal editing (
src/coding-agent/ui/vim/, core subset ported from pi-vimmode, MIT, (c) 2026 pekochan069) — insert/normal/visual/visual-line modes, motions with counts,d c yoperators, undo/redo, prompt search. Enable with"vim": truein settings or toggle with/vim. - Settings selector rows (
src/coding-agent/ui/settings-selector.tswrapper) —/settingsgains "Auto-compact threshold", "Context floor", and "Context window cap" rows (persisted in thepiPlusblock of the base agent settings.json via the shared core'scontext/plus-settings.ts). - Tab title + busy spinner (
src/extensions/tab-title/) — the terminal window/tab title brands aspi+ - [sessionName -] cwdBasenamewith a braille spinner while the agent or compaction is working. TUI mode only. - Plain tool blocks (
src/extensions/plain-tools/) — strips background fills from tool result blocks so tool status reads as text (words, never colored blocks). - Fancy content-change diffs (
src/extensions/fancy-diff/) — takes over the TUI rendering ofeditandwrite: syntax-highlighted diff bodies, colored +/- markers, a dim line-number gutter,+N −Mchange stats with a language badge, bold word-level emphasis on modified lines, and a ⋮ separator for elided context. Awritethat overwrites an existing file renders as an old-vs-new diff (the pre-image is captured in atool_callhandler before execution; new files keep the streaming content preview). No background fills, consistent with plain tool blocks. - Session change report (
src/extensions/changes/) —/changesprints the cumulative content diff of every file the agent changed this session, including files git cannot show: brand-new (untracked) files render as all-added diffs and deletions as all-removed. Atool_callhandler snapshots each file's original content at the agent's first touch; the command diffs those baselines against the current files on disk and appends the report as a custom transcript entry (never in LLM context, re-rendered with the fancy-diff styling, persists across session restore). Optional argument filters paths by substring (/changes src/foo). Changes made through thebashtool are not tracked. TUI only. - Auto-fold history (
src/coding-agent/ui/auto-fold-history.ts) — rolling fold of the transcript: as the agent starts each new assistant message mid-run, the previous step's thinking and finished tool rows collapse (thinking to the "Thinking... (ctrl+o to expand)" hint label, tools back to their standard preview), and a new user message folds all previous turns. The live step (streaming assistant message + in-flight tools) is always excluded, so output stays open while it's still relevant; resume and compaction replays fold everything before the last user turn. thinking folds and unfolds exactly like tool output: the fold syncs both flags (toolOutputExpandedfalse,hideThinkingBlocktrue — so neither ctrl+o nor ctrl+t ever dead-presses), new components inherit them (after a fold a fresh tool row starts collapsed and a fresh assistant message starts with hidden thinking, mid-run included — reveal via ctrl+o, ctrl+t or a click), and ctrl+o sweeps the whole transcript for both kinds, streaming component included, like upstream's tool sweep; clicking re-opens a single folded block. WithPI_AUTO_FOLD_HISTORY=0the whole feature is off and ctrl+o behaves exactly like upstream (tool output only); verbose startup never folds. CLI-only —pi-plus-sdkhosts (e.g. the desktop app) do their own folding. - Resume list hides headless sessions (
src/coding-agent/ui/session-selector.tswrapper) — the session picker reached bypipi --resume,pipi -rand the TUI/resumedrops transcripts the host markedinteractive: false(the marker itself lives in../plus/src/coding-agent/core/session-manager.ts), so SDK and automation runs stop crowding out the chats you actually had. Unmarked sessions stay listed, and--session <id>/-r <id>still resolve a headless transcript: only the display list is filtered, applied to the resolved list and to the partial lists rendered while a scan is still running. Side effect: a headless session cannot be renamed or deleted from the picker.
The CLI identifies as pipi (pi-plus) in CLI text via the shared config wrapper's
APP_NAME shadow; the terminal tab title brands as pi+ via APP_TITLE.
Running from sources
./pipi --no-env # pi (pi-plus) from TypeScript sources with the override layer activeloader/hooks.mjs is a Node module-customization hook that maps @earendil-works/*
to packages/*/src and redirects the overridden upstream modules to the wrappers
(shared core redirects in ../plus/loader/redirects.mjs, CLI redirects in
loader/redirects.mjs). Importers inside any packages/plus* dir are never
redirected, so wrappers can import the true original via relative path without a loop.
Compiled artifact (npm)
build.mjs bundles pipi into dist/npm/ — a self-contained staging tree that
npm link / npm publish operate on (this package itself stays private). The bundle
applies the redirect tables at bundle time via the shared plugin in
../plus/build/redirect-plugin.mjs and funnels every packages/*/src import with a
compiled dist/ counterpart to that dist file (singleton preservation). --no-env
is preserved via a banner scrub.
npm run build:offline # at the repo root, first
npm run build # in packages/plus-cli
npm publish --access public --ignore-scripts # in packages/plus-cli/dist/npmThe staged package is CLI-only: a pipi bin and no . export, so
import "pi-plus" fails by design — library hosts use pi-plus-sdk.
Known limitations of the compiled artifact:
pipi server/pipi clientexperimental subcommands (PI_EXPERIMENTAL=1) spawn sibling JS files that are not emitted next to the bundle; use source-mode./pipifor those.docs/andexamples/are not shipped, so/docs-style paths into them are absent.
Tests
npx vitest run # from packages/plus-cli; unit tests under test/ (faux streamFn, no real APIs)