20 pure-Python stdlib tools for AI-assisted development: symbol impact analysis, file dependency graphs, AST rename, hash-anchored editing, lint orchestration, health summary, workspace snapshots, secret scanning, dead code detection, git churn, pre-commit gates, format runners, and more. Zero pip install beyond OpenCode itself — os, ast, re, json, subprocess only.
After pip install -e ., every tool becomes a global CLI command — graph, impact, lint, refactor, rename, search, verify, calltrace, changelog, hashline, health, snapshot, todo, tags, check, audit, fmt, churn, report, ghost. All via pyproject.toml entry points, zero shell config needed.
🧩 Zero dependencies, zero config — 20 tools, pure Python stdlib, cross-platform since day one. Install in one line, use as CLI commands immediately. Python AST for precise analysis, regex fallback for C++/TS/JS. Hash-anchored edits survive whitespace mismatches. Cross-drive safe on Windows (C:↔D:).
git clone https://github.com/xxxn3m3s1sxxx/opencode-tools.git
cd opencode-tools
pip install -e .That's it. All 20 tools are now available as global CLI commands via pyproject.toml entry points. No aliases, no PATH hacking.
| Benchmark | Typical |
|---|---|
Cold start (any tool, --help) |
~150ms |
graph on monorepo (120 source files) |
~430ms |
search on 50k lines |
~200ms |
impact symbol lookup on monorepo |
~150ms |
| Full CI (9 matrix variants) | ~5-8 min |
Key design decisions: os.walk-based file discovery (no glob/Path overhead), regex import parsing (no full AST for non-Python files), hash-anchored edits survive whitespace/indent mismatches where direct text replace fails.
| Category | Command | What it does |
|---|---|---|
| Editing | hashline_edit file.py --old "foo" --new "bar" |
Hash-anchored content replace — handles whitespace/indent mismatches |
hashline_patch file.py --diff "@@ path / + ANCHOR~text" |
Apply raw hashline diff format | |
hashline_stats |
Show edit() fallback rate — how often direct match fails | |
| Analysis | impact def <symbol> |
Find definition of any symbol (Python/C++/TS) |
impact refs <symbol> |
Find all references to a symbol | |
impact tests <symbol> |
Find test files using a symbol | |
impact <symbol> |
Show everything: def + refs + tests | |
verify file.py |
Confirm file has expected content | |
verify file.py:42 --context 5 |
Show context at line 42 | |
trace forward --down -d 3 |
Recursive call chain, 3 levels deep | |
trace AtlasModel --up |
Who calls AtlasModel? | |
graph src/main.py |
Show imports + dependents of a file | |
graph --circular |
Find circular dependencies | |
graph --stats |
Project-wide dependency stats | |
search "def main" --include *.py |
Regex search with file filter | |
| `search "TODO | FIXME" --context 2` | |
lint ruff |
Run ruff on current project | |
lint tsc src/main.ts |
Run tsc on specific file | |
churn -n 10 |
Top 10 high-churn files (most commits) | |
churn --since 2026-01-01 |
Churn since date | |
tags --stats |
Project-wide symbol index stats | |
tags ClassName |
Look up symbol in index | |
ghost --lang py |
Find unused Python functions/classes | |
| Refactoring | rename foo bar |
Word-boundary rename across all source files |
rename old_name new_name --lang py |
Only Python files | |
refactor foo bar |
AST-based rename — no false positives on partial matches | |
refactor foo bar --dry-run |
Preview before renaming | |
| Safety | audit |
Scan for secrets — API keys, passwords, tokens |
audit --json |
JSON output for CI | |
check --quick |
Pre-commit gate — lint + mypy | |
check |
Full gate — lint + mypy + tests | |
| Formatting | fmt |
Run ruff format on project |
fmt --check |
Check mode (read-only) | |
| Health | health |
Full project health — tests, mypy, ruff, code metrics |
health --quick |
Skip running tests (faster) | |
health --check |
Exit 0 only if all checks pass | |
report |
Combined health + audit + churn + fmt report | |
| History | changelog |
Recent commits with category grouping |
changelog -n 50 |
Last 50 commits | |
changelog --since 2024-01-01 |
Commits since date | |
| Workspace | snapshot |
Save workspace snapshot to .opencode/snapshots/ |
snapshot --show |
Print snapshot to stdout | |
snapshot --mine |
Save + file into MemPalace | |
todo |
Find TODO/FIXME/HACK markers in project | |
todo --count |
Summary counts by type |
Windows (PowerShell):
.\install.ps1Windows (cmd):
install.batLinux/macOS:
chmod +x install.sh && ./install.shOr download from GitHub:
curl -fsSL https://raw.githubusercontent.com/xxxn3m3s1sxxx/opencode-tools/main/install.sh | bashcp *.ts *.py ~/.config/opencode/plugins/
cp *.py /path/to/project/| Tool | File | Description |
|---|---|---|
edit |
hashline.py | Replace text by exact match; auto-retries with hash-anchored fallback |
hashline_edit |
hashline.py | Explicit hash-anchored edit — handles whitespace, indent, blank lines |
hashline_patch |
hashline.py | Apply raw hashline diff format (@@ path / + ANCHOR~payload) |
hashline_stats |
hashline.py | Show edit() fallback rate |
| Tool | File | Description |
|---|---|---|
impact |
impact.py | Symbol analysis — definitions, references, tests, callers. Python AST + C++ heuristics |
verify |
verify.py | Post-edit verification — confirm content, check lines, old/new |
calltrace |
calltrace.py | Recursive call chain — follow execution paths up/down |
graph |
graph.py | File-level dependency graph — imports, dependents, cycles. Python/TS/C++ |
search |
search.py | Rich grep — regex, file filters, context lines, JSON output |
lint |
lint.py | Structured lint — ruff/eslint/tsc/mypy/pylint output parsing |
tags |
tags.py | ctags-style symbol indexer — scan project for definitions |
churn |
churn.py | Git churn analysis — files with most changes, hot spots |
ghost |
ghost.py | Dead code finder — unused functions, classes, imports |
| Tool | File | Description |
|---|---|---|
rename |
rename.py | Word-boundary \b symbol rename across all source files |
refactor |
refactor.py | AST-based rename (Python) — no substring false matches on partial names |
| Tool | File | Description |
|---|---|---|
audit |
audit.py | Secret scanner — API keys, passwords, tokens, private keys |
check |
check.py | Pre-commit gate — lint + mypy + tests, exit 0 only if all pass |
fmt |
fmt.py | Format runner — ruff format + optional prettier |
| Tool | File | Description |
|---|---|---|
health |
health.py | Project health summary — pytest, mypy, ruff, code metrics |
snapshot |
snapshot.py | Capture workspace context for MemPalace auto-save |
todo |
todo.py | TODO/FIXME/HACK marker scanner with counts |
report |
report.py | Combined report — health + audit + churn + fmt |
| Tool | File | Description |
|---|---|---|
changelog |
changelog.py | Formatted git log with conventional-commit grouping (feat/fix/docs/refactor) |
pip install -e . # Install all tools
python -m pytest -q # Run all tests
python smoke_test.py # Smoke test all tools| Suite | Tests | Status |
|---|---|---|
| hashline | 42 core + 22 regression + 39 stress + 27 deep = 130 | ✅ All pass |
| impact | 63 | ✅ All pass |
| verify | 48 | ✅ All pass |
| calltrace | 28 | ✅ All pass |
| graph | 20 | ✅ All pass |
| changelog | 25 | ✅ All pass |
| search | 14 | ✅ All pass |
| lint | 17 | ✅ All pass |
| refactor | 21 | ✅ All pass |
| installers | 6 | ✅ All pass |
| regression | 19 | ✅ All pass |
| new tools | 32 | ✅ All pass |
| stress | 37 | ✅ All pass |
| deeper | 27 | ✅ All pass |
| health | — (runs live checks) | ✅ All pass |
| snapshot | — (integration) | ✅ All pass |
| smoke | 74 (self-test all 20 tools) | ✅ 72 pass |
opencode-tools/
├── src/ # 21 .py engines
│ ├── common.py # Shared utilities (20 tools)
│ ├── hashline.py # Hash-anchored editing
│ ├── impact.py # Impact analysis
│ ├── verify.py # Post-edit verification
│ ├── calltrace.py # Recursive call chain
│ ├── rename.py # Word-boundary rename
│ ├── graph.py # Dependency graph
│ ├── changelog.py # Formatted git log
│ ├── search.py # Rich grep
│ ├── lint.py # Lint runner
│ ├── refactor.py # AST-based rename
│ ├── health.py # Health summary
│ ├── snapshot.py # Workspace snapshot
│ ├── todo.py # TODO marker scanner
│ ├── tags.py # Symbol indexer
│ ├── check.py # Pre-commit gate
│ ├── audit.py # Secret scanner
│ ├── fmt.py # Format runner
│ ├── churn.py # Git churn analysis
│ ├── report.py # Combined report
│ └── ghost.py # Dead code finder
├── plugins/ # 21 .ts OpenCode plugin wrappers
│ ├── utils.ts
│ ├── hashline.ts
│ ├── impact.ts
│ └── ...
├── tests/ # 17 test suites
│ ├── test_hashline.py
│ ├── test_impact.py
│ ├── ...
│ ├── smoke_test.py
│ ├── stress_tools.py
│ └── deeper_tests.py
├── install.sh # Linux/macOS installer
├── install.ps1 # Windows PowerShell installer
├── install.bat # Windows cmd installer
├── .github/workflows/ci.yml
├── pyproject.toml # Python packaging — 20 console_scripts
├── package.json # TS plugin metadata — 20 entries
├── CHANGELOG.md
├── QUALITY.md
├── LICENSE # MIT
└── README.md
- Plugins: TypeScript, @opencode-ai/plugin v1.14.20
- Engines: Python 3.10+ (stdlib only — zero external deps)
- Tests: Python unittest + pytest
MIT