refactor(personality): CONVENTIONS 改从 cfg 读取,不再依赖本地文件
- loadConventions() 从 cfg get FAMILY_CONVENTIONS 读取(shared scope) - 改一处即所有 agent 即时可用,无需 git pull + sync - 移除 CONVENTIONS_PATH 文件依赖 [小糯]
This commit is contained in:
parent
c5559b134d
commit
559913466a
@ -6,7 +6,6 @@ import { parse, stringify } from "yaml";
|
||||
const HERMES_HOME = process.env.HERMES_HOME || join(homedir(), ".hermes");
|
||||
const CONFIG_PATH = join(HERMES_HOME, "config.yaml");
|
||||
const SOUL_PATH = join(HERMES_HOME, "SOUL.md");
|
||||
const CONVENTIONS_PATH = join(HERMES_HOME, "CONVENTIONS.md");
|
||||
|
||||
interface Config {
|
||||
agent?: {
|
||||
@ -57,8 +56,17 @@ function getPreview(value: string | PersonalityDict): string {
|
||||
// --- SOUL.md management ---
|
||||
|
||||
function loadConventions(): string {
|
||||
if (!existsSync(CONVENTIONS_PATH)) return "";
|
||||
return readFileSync(CONVENTIONS_PATH, "utf-8").trim();
|
||||
try {
|
||||
const { execSync } = require("child_process");
|
||||
const result = execSync("cfg get FAMILY_CONVENTIONS", {
|
||||
encoding: "utf-8",
|
||||
timeout: 5000,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
}).trim();
|
||||
return result || "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function writeSoulMd(personalityPrompt: string) {
|
||||
@ -146,7 +154,6 @@ function switchLocal(name: string) {
|
||||
saveConfig(config);
|
||||
writeSoulMd("");
|
||||
console.log("Personality cleared.");
|
||||
if (existsSync(CONVENTIONS_PATH)) console.log("SOUL.md updated (conventions only).");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user