Show HN: Treedocs:自动检查文档是否过时的工具
Show HN: Treedocs: Documentation that automatically checks for staleness

原始链接: https://dandylyons.github.io/treedocs/

**treedocs** 是一款旨在保持仓库文档与实际文件结构同步的开发者工具。通过生成版本控制下的 `treedocs.yaml` 文件,它可以映射项目的层级结构,并允许你为每个文件和文件夹添加易于阅读的描述。 该工具提供直观的命令行界面(CLI)来管理这些文档: * **可视化:** 查看你的仓库树状结构,通过颜色编码的状态指示器(绿色表示有效,红色表示过期)快速识别同步问题。 * **同步:** 自动更新 `treedocs.yaml` 以反映文件系统的当前状态,添加新路径并清理已删除的路径。 * **验证:** 使用 `treedocs check` 确保一致性。 * **自动化:** 由于采用规范的 JSON Schema,`treedocs.yaml` 可被 IDE、CI/CD 流水线和 AI 代理轻松读取。你甚至可以利用 AI 自动生成并维护文件描述。 简而言之,treedocs 简化了维护文档这一持续性任务,确保你的仓库概览保持准确、可搜索且机器可读。

**Treedocs** 是一款旨在解决软件仓库中“文档腐烂”问题的命令行工具。它通过生成一个 `treedocs.yaml` 文件来映射项目的目录结构,允许开发者为特定的文件和文件夹添加说明与链接。 主要功能包括: * **漂移检测**:自动识别文件移动或删除的情况,提醒用户文档已过期。 * **入门引导与 AI 上下文**:帮助开发者熟悉陌生的代码库,并为编程智能体提供简洁、结构化的项目地图,从而避免 Token 浪费。 * **渐进式披露**:支持嵌套的文档边界,实现更好的组织管理。 开发者目前正在征求关于该 CLI 易用性及方法实用性的反馈。尽管一些用户质疑手动维护带来的开销,并建议利用大语言模型(LLM)实现索引维护的自动化,但 Treedocs 旨在通过基于 Schema 的 YAML 格式,实现仓库级映射的规范化。
相关文章

原文

Readable Tree Output

Just run treedocs to see the repository at a glance. Current files render green, while stale or invalid entries render red so problems stand out immediately.

✅ The treedocs below is up to date with the filesystem.
.
├── README.md  User-facing overview, installation, and command usage documentation.
├── Sources/  Swift package source code for the treedocs executable.
│   └── treedocs/  Main treedocs executable target.
│       ├── Commands/  ArgumentParser command implementations for treedocs subcommands.
│       └── Core/  Core services for loading, scanning, rendering, and updating treedocs data.
├── site/  Static files deployed to the project GitHub Pages site.
│   ├── index.html  Landing page for the treedocs GitHub Pages site.
│   └── styles.css  Stylesheet for the treedocs GitHub Pages landing page.
└── old-file.swift  Stale entry: no matching path exists on disk.

The treedocs.yaml Schema

treedocs.yaml is a version-controlled map of your repository. It mirrors your file tree and stores a human-readable YAML description for every file and folder. This same description can be parsed and displayed with treedocs' rich tooling. The file format is defined by a canonical JSON Schema, which means editors, CI tools, and AI agents can all parse, validate, and understand the same structure.

Keeping docs up to date is an ongoing task, but treedocs makes it easy! Running treedocs sync updates your treedocs.yaml file, adding new paths and removing ghost paths. All that's left to do is add short descriptions. It's easy to update descriptions with treedocs update.

Or simply ask an agent to fill in your treedocs.yaml file for you. Agents are extremely good at filling in descriptions and everything can be validated with treedocs check.

联系我们 contact @ memedata.com