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

@ -60,7 +60,7 @@ Skill content here.`,
});
it("should ignore extra markdown files in auto-discovered skill dirs", async () => {
const skillDir = join(agentDir, "skills", "pi-skills", "browser-tools");
const skillDir = join(agentDir, "skills", "companion-skills", "browser-tools");
mkdirSync(skillDir, { recursive: true });
writeFileSync(
join(skillDir, "SKILL.md"),
@ -102,7 +102,7 @@ Prompt content.`,
it("should prefer project resources over user on name collisions", async () => {
const userPromptsDir = join(agentDir, "prompts");
const projectPromptsDir = join(cwd, ".pi", "prompts");
const projectPromptsDir = join(cwd, ".companion", "prompts");
mkdirSync(userPromptsDir, { recursive: true });
mkdirSync(projectPromptsDir, { recursive: true });
const userPromptPath = join(userPromptsDir, "commit.md");
@ -111,7 +111,7 @@ Prompt content.`,
writeFileSync(projectPromptPath, "Project prompt");
const userSkillDir = join(agentDir, "skills", "collision-skill");
const projectSkillDir = join(cwd, ".pi", "skills", "collision-skill");
const projectSkillDir = join(cwd, ".companion", "skills", "collision-skill");
mkdirSync(userSkillDir, { recursive: true });
mkdirSync(projectSkillDir, { recursive: true });
const userSkillPath = join(userSkillDir, "SKILL.md");
@ -148,9 +148,9 @@ Project skill`,
) as { name: string; vars?: Record<string, string> };
baseTheme.name = "collision-theme";
const userThemePath = join(agentDir, "themes", "collision.json");
const projectThemePath = join(cwd, ".pi", "themes", "collision.json");
const projectThemePath = join(cwd, ".companion", "themes", "collision.json");
mkdirSync(join(agentDir, "themes"), { recursive: true });
mkdirSync(join(cwd, ".pi", "themes"), { recursive: true });
mkdirSync(join(cwd, ".companion", "themes"), { recursive: true });
writeFileSync(userThemePath, JSON.stringify(baseTheme, null, 2));
if (baseTheme.vars) {
baseTheme.vars.accent = "#ff00ff";
@ -178,18 +178,18 @@ Project skill`,
it("should keep both extensions loaded when command names collide", async () => {
const userExtDir = join(agentDir, "extensions");
const projectExtDir = join(cwd, ".pi", "extensions");
const projectExtDir = join(cwd, ".companion", "extensions");
mkdirSync(userExtDir, { recursive: true });
mkdirSync(projectExtDir, { recursive: true });
writeFileSync(
join(projectExtDir, "project.ts"),
`export default function(pi) {
pi.registerCommand("deploy", {
`export default function(companion) {
companion.registerCommand("deploy", {
description: "project deploy",
handler: async () => {},
});
pi.registerCommand("project-only", {
companion.registerCommand("project-only", {
description: "project only",
handler: async () => {},
});
@ -198,12 +198,12 @@ Project skill`,
writeFileSync(
join(userExtDir, "user.ts"),
`export default function(pi) {
pi.registerCommand("deploy", {
`export default function(companion) {
companion.registerCommand("deploy", {
description: "user deploy",
handler: async () => {},
});
pi.registerCommand("user-only", {
companion.registerCommand("user-only", {
description: "user only",
handler: async () => {},
});
@ -326,7 +326,7 @@ Content`,
mkdirSync(workspaceDir, { recursive: true });
mkdirSync(appDir, { recursive: true });
writeFileSync(join(workspaceDir, "IDENTITY.md"), "# Identity\n\nPi");
writeFileSync(join(workspaceDir, "TOOLS.md"), "# Tools\n\nUse ~/.pi");
writeFileSync(join(workspaceDir, "TOOLS.md"), "# Tools\n\nUse ~/.companion");
const loader = new DefaultResourceLoader({ cwd: appDir, agentDir });
await loader.reload();
@ -338,8 +338,8 @@ Content`,
expect(agentsFiles.some((f) => f.path.endsWith("TOOLS.md"))).toBe(true);
});
it("should discover SYSTEM.md from cwd/.pi", async () => {
const piDir = join(cwd, ".pi");
it("should discover SYSTEM.md from cwd/.companion", async () => {
const piDir = join(cwd, ".companion");
mkdirSync(piDir, { recursive: true });
writeFileSync(join(piDir, "SYSTEM.md"), "You are a helpful assistant.");
@ -350,7 +350,7 @@ Content`,
});
it("should discover APPEND_SYSTEM.md", async () => {
const piDir = join(cwd, ".pi");
const piDir = join(cwd, ".companion");
mkdirSync(piDir, { recursive: true });
writeFileSync(
join(piDir, "APPEND_SYSTEM.md"),
@ -528,10 +528,10 @@ Content`,
writeFileSync(
join(ext1Dir, "index.ts"),
`
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
import type { ExtensionAPI } from "@mariozechner/companion-coding-agent";
import { Type } from "@sinclair/typebox";
export default function(pi: ExtensionAPI) {
pi.registerTool({
export default function(companion: ExtensionAPI) {
companion.registerTool({
name: "duplicate-tool",
description: "First",
parameters: Type.Object({}),
@ -543,10 +543,10 @@ export default function(pi: ExtensionAPI) {
writeFileSync(
join(ext2Dir, "index.ts"),
`
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
import type { ExtensionAPI } from "@mariozechner/companion-coding-agent";
import { Type } from "@sinclair/typebox";
export default function(pi: ExtensionAPI) {
pi.registerTool({
export default function(companion: ExtensionAPI) {
companion.registerTool({
name: "duplicate-tool",
description: "Second",
parameters: Type.Object({}),