fix(subagent): use getAgentDir for user agents path (#1559)

This commit is contained in:
Tianshu Wang 2026-02-26 07:22:42 +08:00 committed by GitHub
parent 96cf7425ca
commit 7390f830de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,9 +3,8 @@
*/
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { parseFrontmatter } from "@mariozechner/pi-coding-agent";
import { getAgentDir, parseFrontmatter } from "@mariozechner/pi-coding-agent";
export type AgentScope = "user" | "project" | "both";
@ -96,7 +95,7 @@ function findNearestProjectAgentsDir(cwd: string): string | null {
}
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
const userDir = path.join(os.homedir(), ".pi", "agent", "agents");
const userDir = path.join(getAgentDir(), "agents");
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
const userAgents = scope === "project" ? [] : loadAgentsFromDir(userDir, "user");