npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trapsea/codewiki

v0.1.0

Published

Generate deep, traceable codebase wiki documentation — citation tracking, knowledge graph, Mermaid diagrams, incremental updates. Cross-client (OpenCode/Claude/Codex/Qoder).

Readme

codewiki

Generate deep, traceable codebase wiki documentation — citation tracking, knowledge graph, Mermaid diagrams, incremental updates. Cross-client (OpenCode / Claude Code / Codex / Qoder).

npm version License: MIT Node

What it does

codewiki scans your codebase and generates a structured wiki documentation system with:

  • Interactive HTML — single-file HTML with sidebar navigation, stats overview, file classification charts, document details. Open in any browser.
  • Citation tracking — every document links back to source files with line numbers
  • Knowledge graph — metadata.json with PARENT_CHILD / CALLS / IMPLEMENTS / EXTENDS / DEPENDS_ON relations
  • Mermaid diagrams — graph, sequenceDiagram, erDiagram, flowchart, classDiagram
  • Incremental updates — file-hash-based change detection, only rewrite affected docs
  • Integrity verification — check citation reachability, section completeness, Mermaid syntax
  • Cross-client — works with OpenCode, Claude Code, Codex, Qoder, Trae, Cursor

Inspired by Qoder's repowiki, with enhancements: incremental updates, verification, multi-language, cross-client support.

Quick start

Install

npm install -g @trapsea/codewiki

Generate

codewiki init                              # scan codebase, generate outline + metadata
codewiki gen                               # generate markdown document bodies (dispatch mapper agents)
codewiki verify-docs                       # verify docs and optionally fix mermaid issues
codewiki html                              # generate interactive HTML (open in browser)
codewiki refresh                           # incremental update on code changes
codewiki verify                            # verify citation, sections, diagrams
codewiki query "用户认证"                   # search generated docs

Or just run the default bootstrap flow:

codewiki                                   # init + prompt next steps

Output structure

.ai/
├── codewiki/                      # markdown docs root
│   ├── INDEX.md
│   ├── 项目概述.md
│   ├── 架构设计/
│   └── ...
├── meta/codewiki/                 # metadata root
│   ├── outline.json
│   ├── codewiki-metadata.json
│   ├── file-hash.json
│   ├── source-manifest.json
│   └── verify-report.json
└── codewiki.html                  # ⭐ interactive HTML (open in browser)

The codewiki.html is a single-file interactive document with:

  • Sidebar — topic-grouped document tree, expandable/collapsible
  • Overview — total docs, source files, code lines, modules, graph relations
  • Charts — file classification bar chart, module file distribution
  • Document details — cited files, source symbols, file detail table
  • Dark theme — GitHub-inspired dark UI

Document template

Each generated document contains 10 standard sections:

  1. 引言 / Introduction
  2. 项目结构 / Project structure (Mermaid graph)
  3. 核心组件 / Core components
  4. 架构总览 / Architecture overview (Mermaid graph/sequence)
  5. 详细组件分析 / Detailed component analysis (Mermaid sequence/flowchart)
  6. 依赖分析 / Dependency analysis (Mermaid graph LR)
  7. 性能考虑 / Performance considerations
  8. 故障排查指南 / Troubleshooting guide
  9. 结论 / Conclusion
  10. 附录 / Appendix

Every section ends with "章节来源" citing source files with line numbers. Document header has <cite> block listing all referenced files.

See docs/template-spec.md for the full specification.

Cross-client support

codewiki works with any AI coding assistant. The install/ directory contains pre-configured command/agent/skill/rule files for each IDE.

Install to your IDE

Ask your AI assistant to read install.md and follow the instructions. The AI will copy the command/agent/skill/rule files to your IDE's global config directory.

前提:用户已执行 npm install -g @trapsea/codewiki,IDE 模板直接调用全局命令 codewiki。

OpenCode — /codewiki command, codewiki-mapper agent, codewiki skill

~/.config/opencode/command/codewiki*.md         ← commands
~/.config/opencode/agents/codewiki-mapper.md    ← agent
~/.config/opencode/skills/codewiki/SKILL.md     ← skill

Claude Code — /codewiki slash command, codewiki-mapper agent

~/.claude/commands/codewiki*.md
~/.claude/agents/codewiki-mapper.md

Cursor — codewiki rule

~/.cursor/rules/codewiki.mdc

Manual install

# OpenCode
npm install -g @trapsea/codewiki
mkdir -p ~/.config/opencode/{command,agents,skills/codewiki}
cp install/opencode/command/codewiki*.md ~/.config/opencode/command/
cp install/opencode/agents/codewiki-mapper.md ~/.config/opencode/agents/
cp install/opencode/skills/codewiki/SKILL.md ~/.config/opencode/skills/codewiki/

# Claude Code
npm install -g @trapsea/codewiki
mkdir -p ~/.claude/{commands,agents}
cp install/claude/commands/codewiki*.md ~/.claude/commands/
cp install/claude/agents/codewiki-mapper.md ~/.claude/agents/

# Cursor
mkdir -p ~/.cursor/rules
npm install -g @trapsea/codewiki
cp install/cursor/rules/codewiki.mdc ~/.cursor/rules/

CLI reference

codewiki [init|gen|html|verify-docs|refresh|verify|query] [options]

Commands:
  init      Scan codebase, generate outline + metadata skeleton
  verify-docs  Verify docs and optionally fix mermaid issues
  html      Generate interactive single-file HTML (open in browser)
  gen       Generate markdown document bodies (dispatch mapper agents)
  refresh   Incremental update based on file hash change detection
  verify    Verify citation, section, diagram integrity
  query     Search generated documents

Options:
  --help               Show help
  --version            Show version
  --module=<name>      Only generate for specified module
  --focus=<area>       Focus area (api|entity|service|config|arch|deploy|dev-guide)
  --fix                Auto-fix issues (verify command)

Programmatic API

import { cmdInit, cmdGen } from '@trapsea/codewiki';

// 直接使用默认配置执行初始化与生成
cmdInit({ project: 'my-project', modules: [] } as any, process.cwd());
cmdGen({ project: 'my-project', modules: [] } as any, process.cwd());

Comparison with Qoder repowiki

| Feature | Qoder repowiki | codewiki | |---|---|---| | Citation precision | file://path#L10-L50 | same + symbol-level FQN + git commit lock | | Knowledge graph | PARENT_CHILD | + CALLS / IMPLEMENTS / EXTENDS / DEPENDS_ON | | Diagrams | 4 Mermaid types | 6 Mermaid types | | Incremental update | none | file-hash-based | | Verification | none | 5 checks + report + optional auto-fix | | Multi-language | zh only | zh + en | | Index | none | INDEX.md navigation | | Cross-client | Qoder only | OpenCode + Claude + Codex + Qoder + Trae + Cursor | | Implementation | — | TypeScript (npm package) |

Requirements

  • Node.js >= 18
  • Git (for commit hash tracking)

License

MIT