chore: checkpoint pi lab rust integration work
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { parseFrontmatter } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export type AgentScope = "user" | "project" | "both";
|
||||
@@ -97,9 +98,20 @@ function findNearestProjectAgentsDir(cwd: string): string | null {
|
||||
|
||||
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
|
||||
const userDir = path.join(os.homedir(), ".pi", "agent", "agents");
|
||||
const bundledDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "agents");
|
||||
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
|
||||
const bundledAgents = loadAgentsFromDir(bundledDir, "user").map((agent) => ({
|
||||
...agent,
|
||||
model: undefined,
|
||||
}));
|
||||
|
||||
const userAgents = scope === "project" ? [] : loadAgentsFromDir(userDir, "user");
|
||||
const userAgents =
|
||||
scope === "project"
|
||||
? []
|
||||
: [
|
||||
...bundledAgents,
|
||||
...loadAgentsFromDir(userDir, "user"),
|
||||
];
|
||||
const projectAgents = scope === "user" || !projectAgentsDir ? [] : loadAgentsFromDir(projectAgentsDir, "project");
|
||||
|
||||
const agentMap = new Map<string, AgentConfig>();
|
||||
|
||||
Reference in New Issue
Block a user