merge(gitea): 同步漏檔/push 衝突回報/clone 新功能/錯誤訊息

衝突:scripts/selftest.mjs 檔尾兩份都各自 append 一個測試區塊
(guard 的「注入區塊不可被人格檔案逸出(S6)」與 gitea 的「㉒ 從 Gitea
匯入本機還沒有的人格」)。兩塊都保留,各自收好自己的 `}`。
This commit is contained in:
2026-07-31 14:29:10 +00:00
8 changed files with 657 additions and 50 deletions
+13
View File
@@ -45,11 +45,24 @@ if (!gt.giteaProblem() && gt.personaCode(host) && gt.pushDue(host, "files")) {
}
const out = { suppressOutput: true };
// 背景 push 撞到別台機器時是「本機覆蓋遠端」。那條路徑會把帳記在 sync.json,
// 但它是 detached 跑的、輸出丟掉,所以由這裡認領並回報一次——劇場模式也照報(那是資料被蓋掉)。
const overwrites = gt.pendingOverwrites(host);
if (overwrites.length) {
gt.markOverwritesReported(host);
const files = [...new Set(overwrites.flatMap((o) => o.files || []))];
const last = overwrites.at(-1);
out.systemMessage =
`[jsc-persona] ⚠ \`${host}\` 同步到 Gitea 時**以本機為準覆蓋了遠端** ${files.length} 個檔案` +
`${files.slice(0, 5).join(", ")}${files.length > 5 ? "…" : ""}),上一版是 ${String(last.previous).slice(0, 8)}` +
"別台機器可能正在用同一個人格;細節見 `sync status`。";
}
if (!theater) {
const { total, candidates } = pl.promotionCandidates(host);
if (candidates.length) {
const rules = [...new Set(candidates.flatMap((c) => c.rules))].sort().join("/");
out.systemMessage =
`${out.systemMessage ? `${out.systemMessage}\n` : ""}` +
`[jsc-persona] \`${host}\` 短期記憶 ${total} 筆,${candidates.length} 組已達固化條件(${rules}` +
"→ 建議執行 /jsc-persona:persona-memory。";
}