Skip to content

feat: 增加项目记忆检查 CLI - #7

Open
borankux wants to merge 1 commit into
JamesShi96:mainfrom
borankux:codex/cli-tools
Open

borankux wants to merge 1 commit into
JamesShi96:mainfrom
borankux:codex/cli-tools

Conversation

@borankux

@borankux borankux commented Jun 10, 2026

Copy link
Copy Markdown

摘要

  • 新增一个轻量的 Node.js / TypeScript CLI,用于处理 Project Butler 中更确定性的检查和记账操作。
  • 实现 doctorsnapshotdocs syncprofile validatechangelog bump
  • 增加基于 Node 内置 node:test 的测试,覆盖参数解析、版本计算、Markdown 链接解析和 profile 校验。
  • 新增 docs/cli.md,并在 README 与 SKILL.md 中补充 CLI 用法。

为什么需要这个改动

Project Butler 的 Skill 文档已经覆盖了完整的项目记忆流程,但其中有一部分工作属于确定性的状态检查和文件记账,例如:

  • 检查管理文件是否齐全。
  • 校验 JSON 是否合法。
  • 更新文件快照。
  • 重建 DOCS.md 索引。
  • 计算 UPDATE_LOG.md 的下一个版本。
  • 校验 profile pending 状态是否合法。

这些事情如果完全依赖 LLM 按 Markdown 协议手动执行,容易出现漏字段、漏链接、版本计算不一致、profile JSON 漂移等问题。

这个 PR 的设计是:Skill 仍然负责交互、判断和用户确认;CLI 只负责可验证的检查和记账。这样可以降低维护成本,也能让 Project Butler 的长期记忆文件更稳定。

设计原则

  • 可能写文件的命令默认 dry-run,只有传入 --write 才会落盘。
  • 不引入运行时依赖。
  • 测试使用 Node 内置 node:test,避免额外测试框架依赖。
  • npm audit --audit-level=moderate 当前为 0 vulnerabilities。

命令示例

npm install
npm run build
node dist/src/cli.js doctor
node dist/src/cli.js snapshot --write
node dist/src/cli.js docs sync --write
node dist/src/cli.js profile validate
node dist/src/cli.js changelog bump --level minor --title "Title" --bullet "Change" --write

验证

  • npm run check
  • npm audit --audit-level=moderate
  • node dist/src/cli.js doctor --json
  • node dist/src/cli.js snapshot
  • node dist/src/cli.js changelog bump --level minor --title "Add CLI utilities" --bullet "Added deterministic project memory checks"

@borankux borankux changed the title feat: add CLI utilities for project memory checks feat: 增加项目记忆检查 CLI Jun 10, 2026
@borankux
borankux marked this pull request as ready for review June 10, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants