Skip to content

v0.1.5 — Bundle-root detection + validate fix-command clarity + list type filter

Choose a tag to compare

@likai-hust likai-hust released this 04 Aug 08:22
· 7 commits to main since this release

opencode-okf-context v0.1.5

Three robustness fixes found through real-world usage. No API changes.

1. Bundle-root false positive (discovery)

The bundle-root heuristic used recursive scan totals to decide if a directory is a bundle. A plain project root with a typed README.md + a sub-directory that happened to have an index.md was mis-detected as a bundle, swallowing unrelated files into a spurious bundle.

Fix: ScanHit now tracks root-level-only markers (rootHasIndex, rootHasLog, rootTypedCount — depth=0 files only). isBundleRoot reads only these, so sub-directory index.md files or deeply nested typed concepts can no longer trick the heuristic.

2. Validate fix commands were misleading (caused okf_version pollution)

The okf_validate report footer told the model to "Run the suggested okf_write calls to fix" for all issues — including bundle-level ones (okf_version) that okf_write cannot fix (index.md is a reserved file). This misled the model into adding okf_version to every individual concept file.

Fix: The footer now splits concept-level fixes (use okf_write) vs bundle-level fixes (direct edit of reserved files). bundleIssueFix emits real absolute paths and explicit "okf_write cannot touch reserved files" warnings.

3. okf_list showed plain .md docs without type

okf_list listed every .md file in a bundle, including plain docs (README, drafts, notes) without a type field. This cluttered the index and confused the model about which entries were real OKF concepts.

Fix: okf_list now filters to typed concepts only — consistent with the scheme-B guard already used in reference annotations and okf_refs. Plain docs are still discovered (so okf_validate can report type-missing) and still participate in the backlink index; only the list view hides them.

Tests

6 new regression tests (105 total, all pass):

  • M7 (×3): validate fix-command wording + footer clarity + single-concept mode never mentions okf_version
  • M8 (×1): list filter hides untyped docs but validate still sees them
  • H3 (×2): project root not mis-detected + sibling bundles discovered independently

中文摘要

三个鲁棒性修复,无 API 变更。

  1. Bundle-root 误判修复:扫描启发式之前用递归累积的 index/type 计数判断 bundle root,导致普通项目根(有带 type 的 README + 子目录恰好有 index.md)被误判为 bundle。现在只看根目录直接子文件的标志。
  2. Validate 修复命令误导修复:报告统一提示"用 okf_write 修复",但 bundle 级的 okf_version 问题不能用 okf_write 修(index.md 是保留文件)。这导致 AI 给每个 concept 文件加了 okf_version。现在 footer 区分两类修复路径,fix 命令用真实路径 + 明确声明保留文件限制。
  3. okf_list type 过滤:列表现在只显示有 type 的 concept,无 type 的普通 MD 文档不再列出(与 references 注释、okf_refs 的守卫一致)。无 type 文件仍被发现(validate 能报),只是列表隐藏。