refactor: finish companion rename migration

Complete the remaining pi-to-companion rename across companion-os, web, vm-orchestrator, docker, and archived fixtures.

Verification:
- semantic rg sweeps for Pi/piConfig/getPi/.pi runtime references
- npm run check in apps/companion-os (fails in this worktree: biome not found)

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Harivansh Rathi 2026-03-10 07:39:32 -05:00
parent e8fe3d54af
commit 536241053c
303 changed files with 3603 additions and 3602 deletions

View file

@ -2,7 +2,7 @@
* Armin says hi! A fun easter egg with animated XBM art.
*/
import type { Component, TUI } from "@mariozechner/pi-tui";
import type { Component, TUI } from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
// XBM image: 31x36 pixels, LSB first, 1=background, 0=foreground

View file

@ -1,11 +1,11 @@
import type { AssistantMessage } from "@mariozechner/pi-ai";
import type { AssistantMessage } from "@mariozechner/companion-ai";
import {
Container,
Markdown,
type MarkdownTheme,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { getMarkdownTheme, theme } from "../theme/theme.js";
/**

View file

@ -8,7 +8,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import stripAnsi from "strip-ansi";
import {
DEFAULT_MAX_BYTES,

View file

@ -5,7 +5,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { Theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
import { keyHint } from "./keybinding-hints.js";

View file

@ -4,7 +4,7 @@ import {
type MarkdownTheme,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { BranchSummaryMessage } from "../../../core/messages.js";
import { getMarkdownTheme, theme } from "../theme/theme.js";
import { editorKey } from "./keybinding-hints.js";

View file

@ -4,7 +4,7 @@ import {
type MarkdownTheme,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { CompactionSummaryMessage } from "../../../core/messages.js";
import { getMarkdownTheme, theme } from "../theme/theme.js";
import { editorKey } from "./keybinding-hints.js";

View file

@ -13,7 +13,7 @@ import {
Spacer,
truncateToWidth,
visibleWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { CONFIG_DIR_NAME } from "../../../config.js";
import type {
PathMetadata,
@ -68,7 +68,7 @@ function getGroupLabel(metadata: PathMetadata): string {
}
// Top-level resources
if (metadata.source === "auto") {
return metadata.scope === "user" ? "User (~/.pi/agent/)" : "Project (.pi/)";
return metadata.scope === "user" ? "User (~/.companion/agent/)" : "Project (.companion/)";
}
return metadata.scope === "user" ? "User settings" : "Project settings";
}

View file

@ -2,7 +2,7 @@
* Reusable countdown timer for dialog components.
*/
import type { TUI } from "@mariozechner/pi-tui";
import type { TUI } from "@mariozechner/companion-tui";
export class CountdownTimer {
private intervalId: ReturnType<typeof setInterval> | undefined;

View file

@ -3,7 +3,7 @@ import {
type EditorOptions,
type EditorTheme,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type {
AppAction,
KeybindingsManager,

View file

@ -1,5 +1,5 @@
import type { TextContent } from "@mariozechner/pi-ai";
import type { Component } from "@mariozechner/pi-tui";
import type { TextContent } from "@mariozechner/companion-ai";
import type { Component } from "@mariozechner/companion-tui";
import {
Box,
Container,
@ -7,7 +7,7 @@ import {
type MarkdownTheme,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { MessageRenderer } from "../../../core/extensions/types.js";
import type { CustomMessage } from "../../../core/messages.js";
import { getMarkdownTheme, theme } from "../theme/theme.js";

View file

@ -4,7 +4,7 @@
* A heartfelt tribute to dax (@thdxr) for providing free Kimi K2.5 access via OpenCode.
*/
import type { Component, TUI } from "@mariozechner/pi-tui";
import type { Component, TUI } from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
// 32x32 RGB image of dax, hex encoded (3 bytes per pixel)

View file

@ -1,4 +1,4 @@
import type { Component } from "@mariozechner/pi-tui";
import type { Component } from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
/**

View file

@ -16,7 +16,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { KeybindingsManager } from "../../../core/keybindings.js";
import { getEditorTheme, theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@ -121,7 +121,7 @@ export class ExtensionEditorComponent extends Container implements Focusable {
const currentText = this.editor.getText();
const tmpFile = path.join(
os.tmpdir(),
`pi-extension-editor-${Date.now()}.md`,
`companion-extension-editor-${Date.now()}.md`,
);
try {

View file

@ -10,7 +10,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
import { CountdownTimer } from "./countdown-timer.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -9,7 +9,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
import { CountdownTimer } from "./countdown-timer.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -2,7 +2,7 @@ import {
type Component,
truncateToWidth,
visibleWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { AgentSession } from "../../../core/agent-session.js";
import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.js";
import { theme } from "../theme/theme.js";

View file

@ -6,7 +6,7 @@ import {
type EditorAction,
getEditorKeybindings,
type KeyId,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type {
AppAction,
KeybindingsManager,

View file

@ -1,4 +1,4 @@
import { getOAuthProviders } from "@mariozechner/pi-ai/oauth";
import { getOAuthProviders } from "@mariozechner/companion-ai/oauth";
import {
Container,
type Focusable,
@ -7,7 +7,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { exec } from "child_process";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -1,4 +1,4 @@
import { type Model, modelsAreEqual } from "@mariozechner/pi-ai";
import { type Model, modelsAreEqual } from "@mariozechner/companion-ai";
import {
Container,
type Focusable,
@ -8,7 +8,7 @@ import {
Spacer,
Text,
type TUI,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { ModelRegistry } from "../../../core/model-registry.js";
import type { SettingsManager } from "../../../core/settings-manager.js";
import { theme } from "../theme/theme.js";

View file

@ -1,11 +1,11 @@
import type { OAuthProviderInterface } from "@mariozechner/pi-ai";
import { getOAuthProviders } from "@mariozechner/pi-ai/oauth";
import type { OAuthProviderInterface } from "@mariozechner/companion-ai";
import { getOAuthProviders } from "@mariozechner/companion-ai/oauth";
import {
Container,
getEditorKeybindings,
Spacer,
TruncatedText,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { AuthStorage } from "../../../core/auth-storage.js";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -1,4 +1,4 @@
import type { Model } from "@mariozechner/pi-ai";
import type { Model } from "@mariozechner/companion-ai";
import {
Container,
type Focusable,
@ -9,7 +9,7 @@ import {
matchesKey,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -1,4 +1,4 @@
import { fuzzyMatch } from "@mariozechner/pi-tui";
import { fuzzyMatch } from "@mariozechner/companion-tui";
import type { SessionInfo } from "../../../core/session-manager.js";
export type SortMode = "threaded" | "recent" | "relevance";

View file

@ -13,7 +13,7 @@ import {
Text,
truncateToWidth,
visibleWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { KeybindingsManager } from "../../../core/keybindings.js";
import type {
SessionInfo,
@ -607,7 +607,7 @@ class SessionList implements Component, Focusable {
void this.onDeleteSession?.(pathToDelete);
return;
}
// Allow both Escape and Ctrl+C to cancel (consistent with pi UX)
// Allow both Escape and Ctrl+C to cancel (consistent with companion UX)
if (
kb.matches(keyData, "selectCancel") ||
matchesKey(keyData, "ctrl+c")

View file

@ -1,5 +1,5 @@
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import type { Transport } from "@mariozechner/pi-ai";
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
import type { Transport } from "@mariozechner/companion-ai";
import {
Container,
getCapabilities,
@ -9,7 +9,7 @@ import {
SettingsList,
Spacer,
Text,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import {
getSelectListTheme,
getSettingsListTheme,

View file

@ -1,4 +1,4 @@
import { Container, type SelectItem, SelectList } from "@mariozechner/pi-tui";
import { Container, type SelectItem, SelectList } from "@mariozechner/companion-tui";
import { getSelectListTheme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -1,4 +1,4 @@
import { Box, Markdown, type MarkdownTheme, Text } from "@mariozechner/pi-tui";
import { Box, Markdown, type MarkdownTheme, Text } from "@mariozechner/companion-tui";
import type { ParsedSkillBlock } from "../../../core/agent-session.js";
import { getMarkdownTheme, theme } from "../theme/theme.js";
import { editorKey } from "./keybinding-hints.js";

View file

@ -1,4 +1,4 @@
import { Container, type SelectItem, SelectList } from "@mariozechner/pi-tui";
import { Container, type SelectItem, SelectList } from "@mariozechner/companion-tui";
import { getAvailableThemes, getSelectListTheme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -1,5 +1,5 @@
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import { Container, type SelectItem, SelectList } from "@mariozechner/pi-tui";
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
import { Container, type SelectItem, SelectList } from "@mariozechner/companion-tui";
import { getSelectListTheme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -10,7 +10,7 @@ import {
Text,
type TUI,
truncateToWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import stripAnsi from "strip-ansi";
import type { ToolDefinition } from "../../../core/extensions/types.js";
import {

View file

@ -9,7 +9,7 @@ import {
Text,
TruncatedText,
truncateToWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import type { SessionTreeNode } from "../../../core/session-manager.js";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -5,7 +5,7 @@ import {
Spacer,
Text,
truncateToWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";

View file

@ -3,7 +3,7 @@ import {
Markdown,
type MarkdownTheme,
Spacer,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { getMarkdownTheme, theme } from "../theme/theme.js";
const OSC133_ZONE_START = "\x1b]133;A\x07";

View file

@ -3,7 +3,7 @@
* Used by both tool-execution.ts and bash-execution.ts for consistent behavior.
*/
import { Text } from "@mariozechner/pi-tui";
import { Text } from "@mariozechner/companion-tui";
export interface VisualTruncateResult {
/** The visual lines to display */

View file

@ -7,14 +7,14 @@ import * as crypto from "node:crypto";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import type { AgentMessage } from "@mariozechner/pi-agent-core";
import type { AgentMessage } from "@mariozechner/companion-agent-core";
import type {
AssistantMessage,
ImageContent,
Message,
Model,
OAuthProviderId,
} from "@mariozechner/pi-ai";
} from "@mariozechner/companion-ai";
import type {
AutocompleteItem,
EditorAction,
@ -25,7 +25,7 @@ import type {
OverlayHandle,
OverlayOptions,
SlashCommand,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import {
CombinedAutocompleteProvider,
type Component,
@ -40,7 +40,7 @@ import {
TruncatedText,
TUI,
visibleWidth,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { spawn, spawnSync } from "child_process";
import {
APP_NAME,
@ -666,12 +666,12 @@ export class InteractiveMode {
* Check npm registry for a newer version.
*/
private async checkForNewVersion(): Promise<string | undefined> {
if (process.env.PI_SKIP_VERSION_CHECK || process.env.PI_OFFLINE)
if (process.env.COMPANION_SKIP_VERSION_CHECK || process.env.COMPANION_OFFLINE)
return undefined;
try {
const response = await fetch(
"https://registry.npmjs.org/@mariozechner/pi-coding-agent/latest",
"https://registry.npmjs.org/@mariozechner/companion-coding-agent/latest",
{
signal: AbortSignal.timeout(10000),
},
@ -2141,7 +2141,7 @@ export class InteractiveMode {
// Write to temp file
const tmpDir = os.tmpdir();
const ext = extensionForImageMimeType(image.mimeType) ?? "png";
const fileName = `pi-clipboard-${crypto.randomUUID()}.${ext}`;
const fileName = `companion-clipboard-${crypto.randomUUID()}.${ext}`;
const filePath = path.join(tmpDir, fileName);
fs.writeFileSync(filePath, Buffer.from(image.bytes));
@ -3110,7 +3110,7 @@ export class InteractiveMode {
const currentText =
this.editor.getExpandedText?.() ?? this.editor.getText();
const tmpFile = path.join(os.tmpdir(), `pi-editor-${Date.now()}.pi.md`);
const tmpFile = path.join(os.tmpdir(), `companion-editor-${Date.now()}.companion.md`);
try {
// Write current content to temp file
@ -3176,13 +3176,13 @@ export class InteractiveMode {
showNewVersionNotification(newVersion: string): void {
const action = theme.fg(
"accent",
getUpdateInstruction("@mariozechner/pi-coding-agent"),
getUpdateInstruction("@mariozechner/companion-coding-agent"),
);
const updateInstruction =
theme.fg("muted", `New version ${newVersion} is available. `) + action;
const changelogUrl = theme.fg(
"accent",
"https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/CHANGELOG.md",
"https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/CHANGELOG.md",
);
const changelogLine = theme.fg("muted", "Changelog: ") + changelogUrl;

View file

@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
"$schema": "https://raw.githubusercontent.com/badlogic/companion-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
"name": "dark",
"vars": {
"cyan": "#00d7ff",

View file

@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
"$schema": "https://raw.githubusercontent.com/badlogic/companion-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
"name": "light",
"vars": {
"teal": "#5a8080",

View file

@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Pi Coding Agent Theme",
"description": "Theme schema for Pi coding agent",
"title": "Companion Coding Agent Theme",
"description": "Theme schema for companion coding agent",
"type": "object",
"required": ["name", "colors"],
"properties": {

View file

@ -4,7 +4,7 @@ import type {
EditorTheme,
MarkdownTheme,
SelectListTheme,
} from "@mariozechner/pi-tui";
} from "@mariozechner/companion-tui";
import { type Static, Type } from "@sinclair/typebox";
import { TypeCompiler } from "@sinclair/typebox/compiler";
import chalk from "chalk";
@ -682,7 +682,7 @@ function getDefaultTheme(): string {
// ============================================================================
// Use globalThis to share theme across module loaders (tsx + jiti in dev mode)
const THEME_KEY = Symbol.for("@mariozechner/pi-coding-agent:theme");
const THEME_KEY = Symbol.for("@mariozechner/companion-coding-agent:theme");
// Export theme as a getter that reads from globalThis
// This ensures all module instances (tsx, jiti) see the same theme
@ -1144,7 +1144,7 @@ export function getEditorTheme(): EditorTheme {
};
}
export function getSettingsListTheme(): import("@mariozechner/pi-tui").SettingsListTheme {
export function getSettingsListTheme(): import("@mariozechner/companion-tui").SettingsListTheme {
return {
label: (text: string, selected: boolean) =>
selected ? theme.fg("accent", text) : text,