diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 381f9f49..38b8e6b6 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -4,7 +4,6 @@ "description": "Coding agent CLI with read, bash, edit, write tools and session management", "type": "module", "piConfig": { - "name": "pi", "configDir": ".pi" }, "bin": { diff --git a/packages/coding-agent/src/bun/cli.ts b/packages/coding-agent/src/bun/cli.ts index d0b11663..641a7d78 100644 --- a/packages/coding-agent/src/bun/cli.ts +++ b/packages/coding-agent/src/bun/cli.ts @@ -1,5 +1,7 @@ #!/usr/bin/env node -process.title = "pi"; +import { APP_NAME } from "../config.js"; + +process.title = APP_NAME; process.emitWarning = (() => {}) as typeof process.emitWarning; await import("./register-bedrock.js"); diff --git a/packages/coding-agent/src/cli.ts b/packages/coding-agent/src/cli.ts index b48f8587..7d042702 100644 --- a/packages/coding-agent/src/cli.ts +++ b/packages/coding-agent/src/cli.ts @@ -5,13 +5,14 @@ * * Test with: npx tsx src/cli-new.ts [args...] */ -process.title = "pi"; +import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici"; +import { APP_NAME } from "./config.js"; +import { main } from "./main.js"; + +process.title = APP_NAME; process.env.PI_CODING_AGENT = "true"; process.emitWarning = (() => {}) as typeof process.emitWarning; -import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici"; -import { main } from "./main.js"; - setGlobalDispatcher(new EnvHttpProxyAgent()); main(process.argv.slice(2)); diff --git a/packages/coding-agent/src/config.ts b/packages/coding-agent/src/config.ts index eeb510b0..6f13b499 100644 --- a/packages/coding-agent/src/config.ts +++ b/packages/coding-agent/src/config.ts @@ -184,7 +184,9 @@ export function getBundledInteractiveAssetPath(name: string): string { const pkg = JSON.parse(readFileSync(getPackageJsonPath(), "utf-8")); -export const APP_NAME: string = pkg.piConfig?.name || "pi"; +const piConfigName: string | undefined = pkg.piConfig?.name; +export const APP_NAME: string = piConfigName || "pi"; +export const APP_TITLE: string = piConfigName ? APP_NAME : "π"; export const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || ".pi"; export const VERSION: string = pkg.version; diff --git a/packages/coding-agent/src/core/extensions/loader.ts b/packages/coding-agent/src/core/extensions/loader.ts index 893bd728..a62f8ed1 100644 --- a/packages/coding-agent/src/core/extensions/loader.ts +++ b/packages/coding-agent/src/core/extensions/loader.ts @@ -21,7 +21,7 @@ import * as _bundledPiTui from "@mariozechner/pi-tui"; import * as _bundledTypebox from "typebox"; import * as _bundledTypeboxCompile from "typebox/compile"; import * as _bundledTypeboxValue from "typebox/value"; -import { getAgentDir, isBunBinary } from "../../config.js"; +import { CONFIG_DIR_NAME, getAgentDir, isBunBinary } from "../../config.js"; // NOTE: This import works because loader.ts exports are NOT re-exported from index.ts, // avoiding a circular dependency. Extensions can import from @mariozechner/pi-coding-agent. import * as _bundledPiCodingAgent from "../../index.js"; @@ -576,8 +576,8 @@ export async function discoverAndLoadExtensions( } }; - // 1. Project-local extensions: cwd/.pi/extensions/ - const localExtDir = path.join(cwd, ".pi", "extensions"); + // 1. Project-local extensions: cwd/${CONFIG_DIR_NAME}/extensions/ + const localExtDir = path.join(cwd, CONFIG_DIR_NAME, "extensions"); addPaths(discoverExtensionsInDir(localExtDir)); // 2. Global extensions: agentDir/extensions/ diff --git a/packages/coding-agent/src/core/slash-commands.ts b/packages/coding-agent/src/core/slash-commands.ts index 8fa588ca..9280f76c 100644 --- a/packages/coding-agent/src/core/slash-commands.ts +++ b/packages/coding-agent/src/core/slash-commands.ts @@ -1,3 +1,4 @@ +import { APP_NAME } from "../config.js"; import type { SourceInfo } from "./source-info.js"; export type SlashCommandSource = "extension" | "prompt" | "skill"; @@ -35,5 +36,5 @@ export const BUILTIN_SLASH_COMMANDS: ReadonlyArray = [ { name: "compact", description: "Manually compact the session context" }, { name: "resume", description: "Resume a different session" }, { name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" }, - { name: "quit", description: "Quit pi" }, + { name: "quit", description: `Quit ${APP_NAME}` }, ]; diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index 3bf17c9d..e67a2508 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -41,6 +41,7 @@ import { import { spawn, spawnSync } from "child_process"; import { APP_NAME, + APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, @@ -637,9 +638,9 @@ export class InteractiveMode { const cwdBasename = path.basename(this.sessionManager.getCwd()); const sessionName = this.sessionManager.getSessionName(); if (sessionName) { - this.ui.terminal.setTitle(`π - ${sessionName} - ${cwdBasename}`); + this.ui.terminal.setTitle(`${APP_TITLE} - ${sessionName} - ${cwdBasename}`); } else { - this.ui.terminal.setTitle(`π - ${cwdBasename}`); + this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`); } }