@fanchao8609/agent_brain_sync 1.7.3 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/store.js +24 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanchao8609/agent_brain_sync",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "agent-brain-sync: 跨会话 AI 编码记忆 — hook 纯触发 + CLI/MCP 读写 .brain markdown 图谱, 防并发写保护。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/store.js CHANGED
@@ -4,7 +4,7 @@ import { promises as fs } from 'node:fs';
4
4
  import { join, resolve, dirname } from 'node:path';
5
5
  import { requireBrain, brainPath, absLogDir, BRAIN_DIR } from './index.js';
6
6
  import { requireUser, atTag, getUser } from './userconfig.js';
7
- import { addTask, upsertTask, boardText, readTodo, ensureTodo, todoTemplate, today, localStamp, setBreakpoint, moveBlocked, insertDoneGrouped, idOfTaskLine, archiveDoneInText, renderArchivePage, renderArchiveBody, DONE_KINDS, withDoneKind, doneKindOf, collapseDone } from './todo.js';
7
+ import { addTask, upsertTask, boardText, readTodo, ensureTodo, todoTemplate, today, localStamp, setBreakpoint, moveBlocked, insertDoneGrouped, idOfTaskLine, archiveDoneInText, renderArchivePage, renderArchiveBody, DONE_KINDS, withDoneKind, doneKindOf, doneDateOf, collapseDone } from './todo.js';
8
8
  import { editFile, SKIP } from './lock.js';
9
9
  import { appendWrapup, strandedFor } from './wrapup.js';
10
10
 
@@ -765,8 +765,16 @@ export async function cmdLint({ dir }) {
765
765
  for (const pg of pages) {
766
766
  if (!pg.hasFrontmatter) issues.push(`NO-FRONTMATTER: ${pg.rel}`);
767
767
  for (const ln of pg.links) {
768
- if (/slug|Name|name|Date|页面名$/.test(ln)) issues.push(`TEMPLATE-LINK: ${pg.rel} -> [[${ln}]]`);
769
- if (!names.has(ln)) issues.push(`DEAD-LINK: ${pg.rel} -> [[${ln}]]`);
768
+ // 两类都不是真链接,只报 TEMPLATE-LINK(且不短路就会再报一次 DEAD-LINK,同一条报两遍):
769
+ // ① 模板占位: `[[页面名]]` / `[[slug]]` / `[[Name]]` —— 模板没填
770
+ // ② 描述语法时引用的字面量: `[[<slug>]]` —— 尖括号不是合法 wikilink 字符,
771
+ // 而是任务描述在解释格式(如 “在 ### 归档 段留下 [[<slug>]] 完成任务 N 条”)。
772
+ // 单靠关键字(slug/name)分辨不了两者,故额外认尖括号形态。
773
+ if (/^<.+>$/.test(ln) || /slug|Name|name|Date|页面名$/.test(ln)) {
774
+ issues.push(`TEMPLATE-LINK: ${pg.rel} -> [[${ln}]]`);
775
+ } else if (!names.has(ln)) {
776
+ issues.push(`DEAD-LINK: ${pg.rel} -> [[${ln}]]`);
777
+ }
770
778
  }
771
779
  // ORPHAN: sources/ 暂存页与 todo 归档页豁免。前者是暂存线索(提炼成 concept 前天然孤立),
772
780
  // 后者是历史数据倾倒(已登记在 index.md,就是图谱入口,无需再制造双链)。
@@ -825,6 +833,19 @@ export async function cmdLint({ dir }) {
825
833
  `逐条补 \`--as 落地|否决|仅方案\`(新条目:abs todo done <id> --as …)`,
826
834
  );
827
835
  }
836
+ // 完成日期同理必须由工具盖:手写 [x] 时人会抄语义部分(结语)而漏掉机械部分(日期)。
837
+ // 后果不只是排版不齐 —— 无日期行归入 `### (未标日期)` 尾组,而归档靠日期判天数,
838
+ // 故这些行**永远无法被 abs todo archive 迁出**(todo.js:300 保守跳过)。
839
+ // 即:漏一个日期 = 一条永久钉住 Done 区、拖大 load 输出的行。
840
+ // 两处在同一处校验(同一份契约的两半),别只查一半给假信心。
841
+ const noDate = doneBody.filter((l) => /^\s*- \[x\]/.test(l) && !doneDateOf(l));
842
+ if (noDate.length) {
843
+ const sample = (noDate[0].match(/- \[x\] (\S+)/) || [, '?'])[1];
844
+ issues.push(
845
+ `DONE-NO-DATE: Done 区 ${noDate.length} 条缺 \`(完成 YYYY-MM-DD)\`(如 ${sample})。` +
846
+ `手写的 [x] 不会自动盖日期 —— 补上后重跑;新条目一律走 \`abs todo done <id>\`。`,
847
+ );
848
+ }
828
849
  }
829
850
 
830
851
  const n = issues.length;