Skip to content

v1.0.0 — 首个 production-ready stable 🚀

Choose a tag to compare

@Tianbuyu-wwx Tianbuyu-wwx released this 03 Sep 05:13
· 4 commits to main since this release
8e34a32

v1.0.0 — 首个 production-ready stable 🚀

发布日期:2026-08-31 · npm @tianbuyu-wwx/dsh-formatforge@1.0.0 (latest) · 测试 567 passed / 0 fail
主题:v1.0 production-ready 里程碑——v0.14.0 stable 代码 + 协议冻结 + 5 项 audit 修复。

⚠️ 关于 v0.14.0

npm 上的 v0.14.0 缺 audit 修复(4 bug + 1 性能),已在 npm 上 deprecate 提示升级 v1.0.0。

升级指南

npm install @tianbuyu-wwx/dsh-formatforge@latest
#
npm update @tianbuyu-wwx/dsh-formatforge

API 完全向后兼容(v1.x 内不变更),无破坏性改动。

v1.0.0 增量(5 项 audit 修复)

1. Bug:translate.mjs 多文件分页用 inline 旧逻辑(v0.13.0 遗留)

文件:packages/dsh-formatforge/tools/translate.mjs line 152-160

  • 之前 lastIndexOf('\n\n', windowEnd) 没保护 --- 边界
  • 改法:用 _truncate.mjs::smartTruncate 替代 inline 截断

2. Bug:多文件分隔符 --- 与 markdown 水平线冲突

  • translate 多文件拼接改用 <!-- ff-file-sep -->(HTML 注释)
  • 之前 --- 第 1 页 --- 水平线被 smartTruncate 误识别为多文件分隔符
  • 实测:cap=40/70 时单文件内容被切断到 --- 第 1 页 --- 之前
  • HTML 注释:markdown 不解析、对模型可读

3. Bug:smartTruncate JS / Python 算法不一致(6 case 不一致)

  • 修法:sep_len 跟踪避免 nxt 算法漂移
  • Python 与 JS 现在完全对齐 13/13

4. Bug:--against-dir 触发 self-diff

文件:formatforge/diff.py::cmd_diff_against_dir

  • 之前 glob(stem) 会匹配 new.txt 自身 → path_a=path_b → 假 negative
  • 修法:candidatesif p != path_b and p.exists() 排除自身

5. 性能优化:inbox-watcher retention sha256 全量读

文件:packages/dsh-formatforge/services/inbox-watcher.mjs

  • 之前 readFileSync(full).slice(0, 65536) 全量读 + slice
  • 改法:openSync + readSync(64KB) + closeSync

包含 v0.14.0 stable 全部

v0.14.0 Release Notes(窗 B 7 项 P0+P1 + 窗 C 协议快照 + 死代码清理)。

测试

  • 567 passed / 0 fail(基线 538 → 567,+29)
  • 跨语言 truncate 一致性:13/13
  • ruff ✓ / format ✓ / mypy ✓

文件变更(+128 / -61)

  • core/utils.py(+27 / -13)
  • formatforge/diff.py(+7 / -3)
  • packages/dsh-formatforge/services/inbox-watcher.mjs(+14 / -4)
  • packages/dsh-formatforge/test/test-truncate-consistency.mjs(+21 / -6)
  • packages/dsh-formatforge/tools/_truncate.mjs(+30 / -27)
  • packages/dsh-formatforge/tools/translate.mjs(+10 / -8)
  • test/unit/test_cli_protocol.py(+18 / -0)

生产可用性

  • ✅ 协议冻结(v1.x 内向后兼容)
  • ✅ npm latest = 1.0.0
  • ✅ CI 7/7 全绿(Python 3.10/3.11/3.12 × pytest、Node 22 × syntax、security scan、CLI e2e)
  • ✅ 跨语言一致性测试(Python ↔ JS byte-equal)

下一步

  • v0.14.1 / v1.0.1 hotfix:修复 description 字符串 + 7 项 UX 已知问题(argparse JSON 输出、retention Plan B、扩展名 fallback 等)
  • v1.1:性能优化(parallel batch、streaming upload)
  • v2.0:协议 v2(breaking changes)

完整变更见 CHANGELOG.md