DocSync
by @suhteevah
Generate and auto-sync documentation from code with git hooks; detect and fix doc drift using tree-sitter parsing and semantic diffs locally.
clawhub install docsyncπ About This Skill
name: docsync description: Auto-generate docs from code and detect documentation drift via git hooks. Free README gen + paid living docs. homepage: https://docsync.pages.dev metadata: { "openclaw": { "emoji": "π", "primaryEnv": "DOCSYNC_LICENSE_KEY", "requires": { "bins": ["git", "bash"] }, "install": [ { "id": "lefthook", "kind": "brew", "formula": "lefthook", "bins": ["lefthook"], "label": "Install lefthook (git hooks manager)" }, { "id": "tree-sitter", "kind": "brew", "formula": "tree-sitter", "bins": ["tree-sitter"], "label": "Install tree-sitter (code parser)" }, { "id": "difftastic", "kind": "brew", "formula": "difftastic", "bins": ["difft"], "label": "Install difftastic (semantic diff)" } ], "os": ["darwin", "linux", "win32"] } } user-invocable: true disable-model-invocation: false
DocSync β Living Documentation for Your Codebase
DocSync generates documentation from your code and keeps it in sync automatically. It uses tree-sitter for multi-language AST parsing, lefthook for git hook integration, and difftastic for semantic change detection.
Commands
Free Tier (No license required)
#### docsync generate
Generate a one-shot README or API doc for a single file or directory.
How to execute:
bash "/scripts/docsync.sh" generate
What it does:
1. Parses the target file(s) with tree-sitter to extract symbols (functions, classes, exports, types, interfaces)
2. Applies the appropriate template from
3. Generates a markdown documentation file alongside the source
Example usage scenarios:
docsync generate src/utils/auth.tsdocsync generate src/api/docsync generate .Pro Tier ($29/user/month β requires DOCSYNC_LICENSE_KEY)
#### docsync drift [directory]
Scan for documentation drift β find where code has changed but docs haven't been updated.
How to execute:
bash "/scripts/docsync.sh" drift [directory]
What it does: 1. Validates license key from config 2. Parses all source files with tree-sitter 3. Compares extracted symbols against existing documentation 4. Reports: new undocumented symbols, changed signatures with stale docs, deleted symbols still in docs 5. Outputs a drift report with severity levels (critical/warning/info)
#### docsync hooks install
Install git hooks that automatically check for doc drift on every commit.
How to execute:
bash "/scripts/docsync.sh" hooks install
What it does: 1. Validates Pro+ license 2. Copies lefthook config to project root 3. Installs lefthook pre-commit hook 4. On every commit: analyzes staged files, blocks commit if critical drift detected, offers auto-regen
#### docsync hooks uninstall
Remove DocSync git hooks.
bash "/scripts/docsync.sh" hooks uninstall
#### docsync auto-fix [directory]
Auto-regenerate stale documentation for files with detected drift.
bash "/scripts/docsync.sh" auto-fix [directory]
Team Tier ($49/user/month β requires DOCSYNC_LICENSE_KEY with team tier)
#### docsync onboarding [directory]
Generate a comprehensive onboarding guide for new developers.
bash "/scripts/docsync.sh" onboarding [directory]
#### docsync architecture [directory]
Generate architecture documentation showing module relationships and data flow.
bash "/scripts/docsync.sh" architecture [directory]
Supported Languages
DocSync uses tree-sitter grammars and supports:
Configuration
Users can configure DocSync in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"docsync": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"outputDir": "docs",
"templateOverrides": {},
"excludePatterns": ["/node_modules/", "/dist/", "/.git/"],
"languages": ["typescript", "python", "go"],
"driftThreshold": "warning",
"autoFix": false
}
}
}
}
}
Important Notes
Error Handling
hooks install, prompt to install itWhen to Use DocSync
The user might say things like:
βοΈ Configuration
Users can configure DocSync in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"docsync": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"outputDir": "docs",
"templateOverrides": {},
"excludePatterns": ["/node_modules/", "/dist/", "/.git/"],
"languages": ["typescript", "python", "go"],
"driftThreshold": "warning",
"autoFix": false
}
}
}
}
}