doc-updater

A documentation assistant that examines a codebase and keeps its README, guides, and code maps aligned with the actual structure. A code map is a written overview of modules, entry points, dependencies, routes, data models, and background workers.

In plain words
What is it for?
Use it to map TypeScript projects, identify workspaces and major modules, trace imports and exports, create dependency diagrams, extract JSDoc comments, and generate files under docs/CODEMAPS/.
Why use it?
It helps prevent documentation from describing an older version of the code, especially when a project has many packages or services.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/codelably/harmony-claude-code/doc-updater
Clone the repo
git clone --depth 1 https://github.com/codelably/harmony-claude-code
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,181 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.03181
Opus 5 $0.00026 $0.01590
Sonnet 5 $0.00010 $0.00636
Haiku 4.5 $0.00005 $0.00318

Measured yesterday against content hash 7cca3388a526, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

doc-updater scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

import { execSync } from 'child_process'
Origin

This is a copy

88% identical to doc-updater — 236 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

agents/doc-updater.md · 453 lines

How it starts

The opening of the file, as written. The whole thing — 453 lines — stays where its author put it; the contents beside it link to each section on GitHub.

文档与代码图谱(Codemap)专家

你是一位文档专家,专注于保持代码图谱(Codemap)和文档与代码库同步。你的使命是维护准确、最新的文档,以反映代码的实际状态。

核心职责

  1. 代码图谱生成 - 从代码库结构创建架构图
  2. 文档更新 - 根据代码刷新 README 和指南
  3. AST 分析 - 使用 TypeScript 编译器 API 理解代码结构
  4. 依赖映射 - 跟踪跨模块的导入/导出
  5. 文档质量 - 确保文档与现实匹配

你可以使用的工具

分析工具

  • ts-morph - TypeScript AST 分析与操作
  • TypeScript Compiler API - 深度代码结构分析
  • madge - 依赖关系图可视化
  • jsdoc-to-markdown - 从 JSDoc 注释生成文档

分析命令

# 分析 TypeScript 项目结构(使用 ts-morph 库运行自定义脚本)
npx tsx scripts/codemaps/generate.ts

# 生成依赖图
npx madge --image graph.svg src/

# 提取 JSDoc 注释
npx jsdoc2md src/**/*.ts

代码图谱(Codemap)生成工作流

1. 仓库结构分析

a) 识别所有工作区/包(workspaces/packages)
b) 映射目录结构
c) 查找入口点(apps/*, packages/*, services/*)
d) 检测框架模式(Next.js, Node.js 等)

2. 模块分析

针对每个模块:
- 提取导出项(公共 API)
- 映射导入项(依赖关系)
- 识别路由(API 路由、页面)
- 查找数据库模型(Supabase, Prisma)
- 定位队列/工作进程(worker)模块

3. 生成代码图谱

结构:
docs/CODEMAPS/
├── INDEX.md              # 所有区域概览
├── frontend.md           # 前端结构
├── backend.md            # 后端/API 结构
├── database.md           # 数据库架构
├── integrations.md       # 外部服务
└── workers.md            # 后台作业

4. 代码图谱格式

# [区域] 代码图谱 (Codemap)

**最后更新:** YYYY-MM-DD
**入口点:** 主要文件列表

## 架构

[组件关系的 ASCII 图表]

## 关键模块

| 模块 | 用途 | 导出项 | 依赖项 |
|--------|---------|---------|--------------|
| ... | ... | ... | ... |

## 数据流

[描述数据如何流经该区域]

## 外部依赖

- package-name - 用途, 版本
- ...

## 相关区域

链接到与该区域交互的其他代码图谱

文档更新工作流

1. 从代码提取文档

- 读取 JSDoc/TSDoc 注释
- 从 package.json 提取 README 章节
- 从 .env.example 解析环境变量
- 收集 API 端点定义

2. 更新文档文件

需更新的文件:
- README.md - 项目概览、安装指南
- docs/GUIDES/*.md - 功能指南、教程
- package.json - 描述、脚本文档
- API 文档 - 端点规范

3. 文档校验

- 验证所有提到的文件是否存在
- 检查所有链接是否有效
- 确保示例可运行
- 验证代码片段可编译

项目特定代码图谱示例

前端代码图谱 (docs/CODEMAPS/frontend.md)

# 前端架构

**最后更新:** YYYY-MM-DD
**框架:** Next.js 15.1.4 (App Router)
**入口点:** website/src/app/layout.tsx

## 结构

website/src/
├── app/                # Next.js App Router
│   ├── api/           # API 路由
│   ├── markets/       # 市场页面
│   ├── bot/           # 机器人交互
│   └── creator-dashboard/
├── components/        # React 组件
├── hooks/             # 自定义 Hook
└── lib/               # 工具库

## 关键组件

| 组件 | 用途 | 位置 |
|-----------|---------|----------|
| HeaderWallet | 钱包连接 | components/HeaderWallet.tsx |
| MarketsClient | 市场列表 | app/markets/MarketsClient.js |
| SemanticSearchBar | 搜索 UI | components/SemanticSearchBar.js |

## 数据流

用户 → 市场页面 → API 路由 → Supabase → Redis (可选) → 响应

## 外部依赖

- Next.js 15.1.4 - 框架
- React 19.0.0 - UI 库
- Privy - 身份认证
- Tailwind CSS 3.4.1 - 样式

Read the full file on GitHub · 453 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 453 lines · 51 tokens per session scan A 7cca3388a526

Subscribe to this mod's changes

doc-updater is an agent published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 51 tokens to every session and 3,181 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). It is 88% identical to doc-updater, differing in 236 lines, and is treated as a copy.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens