feat: 导出 SproutClaw .sproutclaw 配置
包含 extensions、skills、prompts、settings、auth、models、mcp 等配置。 排除 node_modules、npm 缓存、sessions 等运行时数据。
This commit is contained in:
22
agent/extensions/pi-mcp-adapter/agent-dir.ts
Normal file
22
agent/extensions/pi-mcp-adapter/agent-dir.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CONFIG_DIR_NAME } from "@earendil-works/pi-coding-agent";
|
||||
import { homedir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
export function getAgentDir(): string {
|
||||
const configured =
|
||||
process.env.SPROUTCLAW_CODING_AGENT_DIR?.trim() || process.env.PI_CODING_AGENT_DIR?.trim();
|
||||
if (!configured) {
|
||||
return join(homedir(), CONFIG_DIR_NAME, "agent");
|
||||
}
|
||||
if (configured === "~") {
|
||||
return homedir();
|
||||
}
|
||||
if (configured.startsWith("~/")) {
|
||||
return resolve(homedir(), configured.slice(2));
|
||||
}
|
||||
return resolve(configured);
|
||||
}
|
||||
|
||||
export function getAgentPath(...segments: string[]): string {
|
||||
return join(getAgentDir(), ...segments);
|
||||
}
|
||||
Reference in New Issue
Block a user