添加注释

This commit is contained in:
2026-05-11 17:04:23 +08:00
parent 37bee1e775
commit c5801bbf41
3 changed files with 8 additions and 0 deletions
+2
View File
@@ -18,6 +18,7 @@ const initializePromise = Promise.all([
toolContextStore.initialize(),
]);
const SKILLS_ROOT_DIR = ".opencode/skills";
// learned skill 与正式技能树同路径组织,但历史版本单独落到 data/history/skills 下。
const SKILLS_HISTORY_DIR = join(config.PERSISTENCE_HISTORY_DIR, "skills");
const LEARNED_PATTERNS_MARKER = "## Learned Patterns";
let writeQueue: Promise<void> = Promise.resolve();
@@ -120,6 +121,7 @@ const appendLearnedSkillPattern = async (skillPath: string, pattern: string) =>
: `${current.trimEnd()}\n\n${LEARNED_PATTERNS_MARKER}\n- ${pattern}\n`;
await ensureDirectory(join(SKILLS_ROOT_DIR, skillPath));
// 追加 learned pattern 前先备份旧版 SKILL.md,避免共享技能被异常写坏。
await atomicWriteFileWithHistory(target, next, {
historyDir: SKILLS_HISTORY_DIR,
rootDir: SKILLS_ROOT_DIR,