@yolk_vat-y/dsh-project-memory 0.6.6 → 0.6.7

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.
@@ -62,6 +62,8 @@ export function indexDocTool(ctx, config) {
62
62
  // 与 index_repo/watch/lazy 同一条判据:哈希未变但旧条目缺 terms 时仍要重抽一次(一次性回填)。
63
63
  // 少了这一步,terms 回填就是"路径相关"的——只有走 index_repo 才生效。
64
64
  if (existing && existing.sha256 === hash && !docEntriesNeedBackfill(store.entries[rel])) {
65
+ // 旧记录没有 explicit 时在这里补上:否则重新 index_doc 一次也救不回被扫描清理掉的文件。
66
+ if (!existing.explicit) store.commit((s) => s.markFile(rel, { ...existing, explicit: true }))
65
67
  return `Skipped (unchanged): ${rel}\nAlready indexed with ${(store.entries[rel] || []).length} entry/entries.`
66
68
  }
67
69
 
@@ -80,7 +82,9 @@ export function indexDocTool(ctx, config) {
80
82
 
81
83
  return store.commit((s) => {
82
84
  s.setEntries(rel, entries)
83
- s.markFile(rel, { sha256: hash, size, type: 'doc', indexedAt: new Date().toISOString() })
85
+ // explicit:这个文件可能是被 .gitignore 排除的(显式索引不受 gitignore 限制),
86
+ // 扫描清单里永远不会有它 —— 清理时靠这个标记区分"没扫到"与"被删了"。
87
+ s.markFile(rel, { sha256: hash, size, type: 'doc', indexedAt: new Date().toISOString(), explicit: true })
84
88
  const preview = entries
85
89
  .map((e) => ` - ${e.title} @ ${rel}:${e.sourceLine}`)
86
90
  .join('\n')
@@ -58,7 +58,7 @@ export async function indexRepository(ctx, config, root, { reindex = false, allo
58
58
  continue
59
59
  }
60
60
  if (plan.key === OVERSIZE) {
61
- // 体积超限的代码文件:旧记录一律清掉,避免检索命中一个已经不索引的文件。
61
+ // 体积超限的文件:旧记录一律清掉,避免检索命中一个已经不索引的文件。
62
62
  batch.push({ rel, drop: true })
63
63
  skipped++
64
64
  if (batch.length >= COMMIT_BATCH) flushBatch()
@@ -84,6 +84,7 @@ export async function indexRepository(ctx, config, root, { reindex = false, allo
84
84
  const { removed } = commitFileUpdates(store, {
85
85
  updates: batch,
86
86
  unseen: truncated ? null : seen,
87
+ root,
87
88
  })
88
89
  const stats = store.stats()
89
90
  let report =
@@ -16,7 +16,7 @@ export function lessonTool(config) {
16
16
  return defineTool({
17
17
  name: 'save_lesson',
18
18
  description:
19
- '写入一条教训 / 决策 / 流程(单条 insight)。写入前与既有记忆比对:高相似度自动覆盖(旧值留在 prev),'
19
+ '写入一条教训 / 决策 / 流程(单条 insight)。只写下次仍成立的判据与命令;某次运行的值(版本号、计数、分支名)不进正文。写入前与既有记忆比对:高相似度自动覆盖(旧值留在 prev),'
20
20
  + '较近的提示近邻 id。发现记错/过时:带 id 再写一次即就地覆盖;确定要删用 forget。',
21
21
  parameters: {
22
22
  id: { type: 'string', description: '既有条目 id(就地更新,忽略 scope)' },
@@ -40,7 +40,7 @@ export function lessonTool(config) {
40
40
  writes: { type: 'array', items: { type: 'string' }, description: '项目相对路径,禁 glob' },
41
41
  intents: { type: 'array', items: { type: 'string' }, description: '意图词(CJK≥2,拉丁≥5)' },
42
42
  },
43
- description: '唯一触发面:三者取或。',
43
+ description: '唯一触发面:三者取或;不写则只能靠检索命中,不会主动注入。',
44
44
  },
45
45
  guard: {
46
46
  type: 'object',