fix(coding-agent): support PI_CODING_AGENT_DIR env var in example extensions (#2009)

This commit is contained in:
Ben Smith
2026-03-12 16:48:38 -07:00
committed by GitHub
parent b6b7fafddb
commit f5b1084176
5 changed files with 13 additions and 15 deletions

View File

@@ -39,10 +39,9 @@
*/
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
import { DynamicBorder } from "@mariozechner/pi-coding-agent";
import { DynamicBorder, getAgentDir } from "@mariozechner/pi-coding-agent";
import { Container, Key, type SelectItem, SelectList, Text } from "@mariozechner/pi-tui";
// Preset configuration
@@ -68,7 +67,7 @@ interface PresetsConfig {
* Project-local presets override global presets with the same name.
*/
function loadPresets(cwd: string): PresetsConfig {
const globalPath = join(homedir(), ".pi", "agent", "presets.json");
const globalPath = join(getAgentDir(), "presets.json");
const projectPath = join(cwd, ".pi", "presets.json");
let globalPresets: PresetsConfig = {};