deep-review 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. deep_review-1.0.0/.beads/README.md +81 -0
  2. deep_review-1.0.0/.beads/hooks/post-checkout +24 -0
  3. deep_review-1.0.0/.beads/hooks/post-merge +24 -0
  4. deep_review-1.0.0/.beads/hooks/pre-commit +24 -0
  5. deep_review-1.0.0/.beads/hooks/pre-push +24 -0
  6. deep_review-1.0.0/.beads/hooks/prepare-commit-msg +24 -0
  7. deep_review-1.0.0/.gitignore +98 -0
  8. deep_review-1.0.0/LICENSE +21 -0
  9. deep_review-1.0.0/PKG-INFO +358 -0
  10. deep_review-1.0.0/README.md +313 -0
  11. deep_review-1.0.0/deep_review/__init__.py +20 -0
  12. deep_review-1.0.0/deep_review/__main__.py +4 -0
  13. deep_review-1.0.0/deep_review/analysis.py +410 -0
  14. deep_review-1.0.0/deep_review/assets/d3.v7.min.js +2 -0
  15. deep_review-1.0.0/deep_review/changes.py +532 -0
  16. deep_review-1.0.0/deep_review/cli.py +1732 -0
  17. deep_review-1.0.0/deep_review/communities.py +1088 -0
  18. deep_review-1.0.0/deep_review/config_keys.py +33 -0
  19. deep_review-1.0.0/deep_review/constants.py +124 -0
  20. deep_review-1.0.0/deep_review/context_savings.py +336 -0
  21. deep_review-1.0.0/deep_review/custom_languages.py +353 -0
  22. deep_review-1.0.0/deep_review/daemon.py +1125 -0
  23. deep_review-1.0.0/deep_review/daemon_cli.py +329 -0
  24. deep_review-1.0.0/deep_review/docs/LLM-OPTIMIZED-REFERENCE.md +76 -0
  25. deep_review-1.0.0/deep_review/embeddings.py +998 -0
  26. deep_review-1.0.0/deep_review/enrich.py +306 -0
  27. deep_review-1.0.0/deep_review/envconfig.py +99 -0
  28. deep_review-1.0.0/deep_review/event_resolver.py +122 -0
  29. deep_review-1.0.0/deep_review/exports.py +447 -0
  30. deep_review-1.0.0/deep_review/flows.py +718 -0
  31. deep_review-1.0.0/deep_review/forget.py +174 -0
  32. deep_review-1.0.0/deep_review/graph.py +2327 -0
  33. deep_review-1.0.0/deep_review/graph_diff.py +122 -0
  34. deep_review-1.0.0/deep_review/hcl_resolver.py +110 -0
  35. deep_review-1.0.0/deep_review/hints.py +384 -0
  36. deep_review-1.0.0/deep_review/http_origin_guard.py +212 -0
  37. deep_review-1.0.0/deep_review/incremental.py +1609 -0
  38. deep_review-1.0.0/deep_review/jedi_resolver.py +303 -0
  39. deep_review-1.0.0/deep_review/main.py +1261 -0
  40. deep_review-1.0.0/deep_review/memory.py +142 -0
  41. deep_review-1.0.0/deep_review/parser.py +16080 -0
  42. deep_review-1.0.0/deep_review/postprocessing.py +203 -0
  43. deep_review-1.0.0/deep_review/prompts.py +159 -0
  44. deep_review-1.0.0/deep_review/python_resolver.py +123 -0
  45. deep_review-1.0.0/deep_review/refactor.py +889 -0
  46. deep_review-1.0.0/deep_review/registry.py +326 -0
  47. deep_review-1.0.0/deep_review/rescript_resolver.py +206 -0
  48. deep_review-1.0.0/deep_review/rules_A/cnc-batch-constitution.md +207 -0
  49. deep_review-1.0.0/deep_review/rules_A/cnc-bdp-constitution.md +312 -0
  50. deep_review-1.0.0/deep_review/rules_A/cnc-sdk-constitution.md +17 -0
  51. deep_review-1.0.0/deep_review/rules_A/cnc-service-constitution.md +180 -0
  52. deep_review-1.0.0/deep_review/rules_B/cnc-batch-constitution.md +165 -0
  53. deep_review-1.0.0/deep_review/rules_B/cnc-bdp-constitution.md +169 -0
  54. deep_review-1.0.0/deep_review/rules_B/cnc-front-constitution.md +131 -0
  55. deep_review-1.0.0/deep_review/rules_B/cnc-sdk-constitution.md +24 -0
  56. deep_review-1.0.0/deep_review/rules_B/cnc-service-constitution.md +166 -0
  57. deep_review-1.0.0/deep_review/rules_B/cnc-tdsql-constitution.md +90 -0
  58. deep_review-1.0.0/deep_review/rules_B/cnc-tidb-constitution.md +83 -0
  59. deep_review-1.0.0/deep_review/scoped_resolver.py +514 -0
  60. deep_review-1.0.0/deep_review/search.py +470 -0
  61. deep_review-1.0.0/deep_review/skills.py +1717 -0
  62. deep_review-1.0.0/deep_review/skills_data/dr/SKILL.md +87 -0
  63. deep_review-1.0.0/deep_review/skills_data/dr-build-graph/SKILL.md +38 -0
  64. deep_review-1.0.0/deep_review/skills_data/dr-debug-issue/SKILL.md +27 -0
  65. deep_review-1.0.0/deep_review/skills_data/dr-explore-codebase/SKILL.md +28 -0
  66. deep_review-1.0.0/deep_review/skills_data/dr-refactor-safely/SKILL.md +28 -0
  67. deep_review-1.0.0/deep_review/skills_data/dr-review-changes/SKILL.md +29 -0
  68. deep_review-1.0.0/deep_review/skills_data/dr-review-delta/SKILL.md +46 -0
  69. deep_review-1.0.0/deep_review/skills_data/dr-review-pr/SKILL.md +66 -0
  70. deep_review-1.0.0/deep_review/spring_resolver.py +200 -0
  71. deep_review-1.0.0/deep_review/temporal_resolver.py +204 -0
  72. deep_review-1.0.0/deep_review/token_benchmark.py +125 -0
  73. deep_review-1.0.0/deep_review/tools/__init__.py +169 -0
  74. deep_review-1.0.0/deep_review/tools/_common.py +292 -0
  75. deep_review-1.0.0/deep_review/tools/analysis_tools.py +184 -0
  76. deep_review-1.0.0/deep_review/tools/build.py +707 -0
  77. deep_review-1.0.0/deep_review/tools/community_tools.py +246 -0
  78. deep_review-1.0.0/deep_review/tools/context.py +189 -0
  79. deep_review-1.0.0/deep_review/tools/docs.py +603 -0
  80. deep_review-1.0.0/deep_review/tools/flows_tools.py +176 -0
  81. deep_review-1.0.0/deep_review/tools/query.py +1016 -0
  82. deep_review-1.0.0/deep_review/tools/refactor_tools.py +168 -0
  83. deep_review-1.0.0/deep_review/tools/registry_tools.py +125 -0
  84. deep_review-1.0.0/deep_review/tools/review.py +480 -0
  85. deep_review-1.0.0/deep_review/tsconfig_resolver.py +266 -0
  86. deep_review-1.0.0/deep_review/uninstall.py +1287 -0
  87. deep_review-1.0.0/deep_review/visualization.py +2355 -0
  88. deep_review-1.0.0/deep_review/wiki.py +308 -0
  89. deep_review-1.0.0/hooks/hooks.json +35 -0
  90. deep_review-1.0.0/hooks/session-start.sh +25 -0
  91. deep_review-1.0.0/pyproject.toml +110 -0
@@ -0,0 +1,81 @@
1
+ # Beads - AI-Native Issue Tracking
2
+
3
+ Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
4
+
5
+ ## What is Beads?
6
+
7
+ Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
8
+
9
+ **Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
10
+
11
+ ## Quick Start
12
+
13
+ ### Essential Commands
14
+
15
+ ```bash
16
+ # Create new issues
17
+ bd create "Add user authentication"
18
+
19
+ # View all issues
20
+ bd list
21
+
22
+ # View issue details
23
+ bd show <issue-id>
24
+
25
+ # Update issue status
26
+ bd update <issue-id> --claim
27
+ bd update <issue-id> --status done
28
+
29
+ # Sync with Dolt remote
30
+ bd dolt push
31
+ ```
32
+
33
+ ### Working with Issues
34
+
35
+ Issues in Beads are:
36
+ - **Git-native**: Stored in Dolt database with version control and branching
37
+ - **AI-friendly**: CLI-first design works perfectly with AI coding agents
38
+ - **Branch-aware**: Issues can follow your branch workflow
39
+ - **Always in sync**: Auto-syncs with your commits
40
+
41
+ ## Why Beads?
42
+
43
+ ✨ **AI-Native Design**
44
+ - Built specifically for AI-assisted development workflows
45
+ - CLI-first interface works seamlessly with AI coding agents
46
+ - No context switching to web UIs
47
+
48
+ 🚀 **Developer Focused**
49
+ - Issues live in your repo, right next to your code
50
+ - Works offline, syncs when you push
51
+ - Fast, lightweight, and stays out of your way
52
+
53
+ 🔧 **Git Integration**
54
+ - Automatic sync with git commits
55
+ - Branch-aware issue tracking
56
+ - Dolt-native three-way merge resolution
57
+
58
+ ## Get Started with Beads
59
+
60
+ Try Beads in your own projects:
61
+
62
+ ```bash
63
+ # Install Beads
64
+ curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
65
+
66
+ # Initialize in your repo
67
+ bd init
68
+
69
+ # Create your first issue
70
+ bd create "Try out Beads"
71
+ ```
72
+
73
+ ## Learn More
74
+
75
+ - **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
76
+ - **Quick Start Guide**: Run `bd quickstart`
77
+ - **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
78
+
79
+ ---
80
+
81
+ *Beads: Issue tracking that moves at the speed of thought* ⚡
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # --- BEGIN BEADS INTEGRATION v1.0.0 ---
3
+ # This section is managed by beads. Do not remove these markers.
4
+ if command -v bd >/dev/null 2>&1; then
5
+ export BD_GIT_HOOK=1
6
+ _bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
7
+ if command -v timeout >/dev/null 2>&1; then
8
+ timeout "$_bd_timeout" bd hooks run post-checkout "$@"
9
+ _bd_exit=$?
10
+ if [ $_bd_exit -eq 124 ]; then
11
+ echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
12
+ _bd_exit=0
13
+ fi
14
+ else
15
+ bd hooks run post-checkout "$@"
16
+ _bd_exit=$?
17
+ fi
18
+ if [ $_bd_exit -eq 3 ]; then
19
+ echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
20
+ _bd_exit=0
21
+ fi
22
+ if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
23
+ fi
24
+ # --- END BEADS INTEGRATION v1.0.0 ---
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # --- BEGIN BEADS INTEGRATION v1.0.0 ---
3
+ # This section is managed by beads. Do not remove these markers.
4
+ if command -v bd >/dev/null 2>&1; then
5
+ export BD_GIT_HOOK=1
6
+ _bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
7
+ if command -v timeout >/dev/null 2>&1; then
8
+ timeout "$_bd_timeout" bd hooks run post-merge "$@"
9
+ _bd_exit=$?
10
+ if [ $_bd_exit -eq 124 ]; then
11
+ echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
12
+ _bd_exit=0
13
+ fi
14
+ else
15
+ bd hooks run post-merge "$@"
16
+ _bd_exit=$?
17
+ fi
18
+ if [ $_bd_exit -eq 3 ]; then
19
+ echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
20
+ _bd_exit=0
21
+ fi
22
+ if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
23
+ fi
24
+ # --- END BEADS INTEGRATION v1.0.0 ---
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # --- BEGIN BEADS INTEGRATION v1.0.0 ---
3
+ # This section is managed by beads. Do not remove these markers.
4
+ if command -v bd >/dev/null 2>&1; then
5
+ export BD_GIT_HOOK=1
6
+ _bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
7
+ if command -v timeout >/dev/null 2>&1; then
8
+ timeout "$_bd_timeout" bd hooks run pre-commit "$@"
9
+ _bd_exit=$?
10
+ if [ $_bd_exit -eq 124 ]; then
11
+ echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
12
+ _bd_exit=0
13
+ fi
14
+ else
15
+ bd hooks run pre-commit "$@"
16
+ _bd_exit=$?
17
+ fi
18
+ if [ $_bd_exit -eq 3 ]; then
19
+ echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
20
+ _bd_exit=0
21
+ fi
22
+ if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
23
+ fi
24
+ # --- END BEADS INTEGRATION v1.0.0 ---
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # --- BEGIN BEADS INTEGRATION v1.0.0 ---
3
+ # This section is managed by beads. Do not remove these markers.
4
+ if command -v bd >/dev/null 2>&1; then
5
+ export BD_GIT_HOOK=1
6
+ _bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
7
+ if command -v timeout >/dev/null 2>&1; then
8
+ timeout "$_bd_timeout" bd hooks run pre-push "$@"
9
+ _bd_exit=$?
10
+ if [ $_bd_exit -eq 124 ]; then
11
+ echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
12
+ _bd_exit=0
13
+ fi
14
+ else
15
+ bd hooks run pre-push "$@"
16
+ _bd_exit=$?
17
+ fi
18
+ if [ $_bd_exit -eq 3 ]; then
19
+ echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
20
+ _bd_exit=0
21
+ fi
22
+ if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
23
+ fi
24
+ # --- END BEADS INTEGRATION v1.0.0 ---
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # --- BEGIN BEADS INTEGRATION v1.0.0 ---
3
+ # This section is managed by beads. Do not remove these markers.
4
+ if command -v bd >/dev/null 2>&1; then
5
+ export BD_GIT_HOOK=1
6
+ _bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
7
+ if command -v timeout >/dev/null 2>&1; then
8
+ timeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
9
+ _bd_exit=$?
10
+ if [ $_bd_exit -eq 124 ]; then
11
+ echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
12
+ _bd_exit=0
13
+ fi
14
+ else
15
+ bd hooks run prepare-commit-msg "$@"
16
+ _bd_exit=$?
17
+ fi
18
+ if [ $_bd_exit -eq 3 ]; then
19
+ echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
20
+ _bd_exit=0
21
+ fi
22
+ if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
23
+ fi
24
+ # --- END BEADS INTEGRATION v1.0.0 ---
@@ -0,0 +1,98 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ *.egg
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Graph database
18
+ *.db
19
+ *.db-journal
20
+ *.db-wal
21
+ *.db-shm
22
+ .deep-review/
23
+
24
+ # IDE
25
+ .idea/
26
+ .vscode/
27
+ *.swp
28
+ *.swo
29
+ *~
30
+
31
+ # OS
32
+ .DS_Store
33
+ Thumbs.db
34
+
35
+ # Node
36
+ node_modules/
37
+
38
+ # VS Code extension build artifacts
39
+ deep-review-vscode/dist/
40
+ *.vsix
41
+
42
+ # Claude Code
43
+ .claude/
44
+ .claude-plugin/
45
+
46
+ # OMC (oh-my-claudecode) local state
47
+ .omc/
48
+
49
+ # Coverage
50
+ htmlcov/
51
+ .coverage
52
+ .coverage.*
53
+
54
+ # pytest
55
+ .pytest_cache/
56
+
57
+ # mypy
58
+ .mypy_cache/
59
+
60
+ # Excalidraw source files (PNGs are tracked, sources are not)
61
+ *.excalidraw
62
+ diagrams/export_pngs.mjs
63
+
64
+ # Superpowers brainstorm docs
65
+ .superpowers/
66
+ docs/superpowers/
67
+
68
+ # Draft/duplicate assets
69
+ docs/assets/marketing-diagram*
70
+
71
+ # One-off docs (audits, analyses, plans, articles)
72
+ medium/
73
+ Quality-Audit-Report.docx
74
+ accessibility-audit.md
75
+ cross-audit-synthesis.md
76
+ design-critique.md
77
+ design-handoff.md
78
+ design-system-audit.md
79
+ research-synthesis.md
80
+ deep-review-analysis.md
81
+ SCALING_AND_TOKEN_EFFICIENCY_PLAN.md
82
+
83
+ # Beads / Dolt files (added by bd init)
84
+ .dolt/
85
+ .beads-credential-key
86
+
87
+ # 发布脚本含明文 PyPI token,勿提交(用 publish.sh.example 作模板)
88
+ scripts/publish.sh
89
+
90
+ # Local-only pending files (temporary — revisit before tracking)
91
+ .codex/
92
+ 2026-06-10-194632-local-command-caveatcaveat-the-messages-below.txt
93
+ OC3_TECHNICAL_CONTRIBUTION.md
94
+ OC3_TECHNICAL_CONTRIBUTION.pdf
95
+ PRESENTATION_BRIEF.md
96
+
97
+ cnc-constitution
98
+ gen-finetune-data
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 shaoqisun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,358 @@
1
+ Metadata-Version: 2.5
2
+ Name: deep-review
3
+ Version: 1.0.0
4
+ Summary: Local-first knowledge graph for token-efficient code review through MCP and CLI
5
+ Project-URL: Homepage, https://github.com/shao-ssq/code-review-graph
6
+ Project-URL: Repository, https://github.com/shao-ssq/code-review-graph
7
+ Project-URL: Documentation, https://github.com/shao-ssq/code-review-graph/blob/main/docs/INDEX.md
8
+ Project-URL: Changelog, https://github.com/shao-ssq/code-review-graph/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/shao-ssq/code-review-graph/issues
10
+ Author-email: shaoqisun <1966799809@qq.com>
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: ai-coding-tools,code-review,knowledge-graph,mcp,tree-sitter
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: fastmcp<4,>=3.2.4
25
+ Requires-Dist: igraph>=0.11.0
26
+ Requires-Dist: jedi>=0.19.2
27
+ Requires-Dist: mcp<3,>=1.0.0
28
+ Requires-Dist: networkx<4,>=3.2
29
+ Requires-Dist: numpy<3,>=1.26
30
+ Requires-Dist: python-dotenv<2,>=1.0
31
+ Requires-Dist: pyyaml<7,>=6.0
32
+ Requires-Dist: sentence-transformers<6,>=3.0.0
33
+ Requires-Dist: tomli<3,>=2.0.0; python_version < '3.11'
34
+ Requires-Dist: tree-sitter-language-pack<1,>=0.3.0
35
+ Requires-Dist: tree-sitter<1,>=0.23.0
36
+ Requires-Dist: watchdog<7,>=4.0.0
37
+ Provides-Extra: dev
38
+ Requires-Dist: mypy<3,>=1.10; extra == 'dev'
39
+ Requires-Dist: pytest-asyncio<2,>=0.23; extra == 'dev'
40
+ Requires-Dist: pytest-cov<8,>=4.0; extra == 'dev'
41
+ Requires-Dist: pytest<9,>=8.0; extra == 'dev'
42
+ Requires-Dist: ruff<1,>=0.3.0; extra == 'dev'
43
+ Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'dev'
44
+ Description-Content-Type: text/markdown
45
+
46
+
47
+ ## DeepReview
48
+ ### 【使用手册-命令行】
49
+ #### install:安装
50
+ ```bash
51
+ # 首次安装
52
+ pip install deep-review
53
+
54
+ # 安装:支持平台 codex, claude, claude-code, codebuddy, cursor, windsurf, zed, continue, opencode, antigravity, gemini-cli, qwen, kiro, copilot, copilot-cli
55
+ dr install --platform claude-code
56
+ ```
57
+
58
+ #### uninstall:卸载
59
+ ```bash
60
+ # 解绑平台 MCP 注册
61
+ dr uninstall --platform claude-code
62
+ # 全删(skills+hooks+用户目录+图数据)
63
+ dr uninstall
64
+
65
+ # 安全相关参数
66
+ dr uninstall --dry-run # 只看计划,什么都不动
67
+ dr uninstall --all-repos # dr uninstall + 所有注册的仓库
68
+ ```
69
+
70
+ #### build:构建
71
+ + ① 解析:用 Tree-sitter 把源码读进来,把代码里的"实体"和"关系"抽出来写进数据库。
72
+ + ② 签名 + FTS:给 ① 里的节点补上"可被搜索"的元数据。
73
+ - 签名(signature):给每个函数/类算一个规范化签名串(参数、返回类型等),存进 nodes.signature 列。这样查函数时能看到它的形参签名。
74
+ - FTS 全文索引:建一张 nodes_fts 虚拟表(SQLite FTS5),把节点的名字、限定名、文件路径、签名都塞进去做倒排索引。
75
+ + ③ 社区:在 ① 的关系网基础上跑图算法,挖出更高层的结构。
76
+ - 执行流(flow):从某个入口点(HTTP handler、CLI 命令、测试函数等)出发,顺着 CALLS 边一路追踪,还原出"一次调用会经过哪些函数"的完整路径,并算关键度评分。
77
+ - 社区(community):用 Leiden 算法把关系紧密的节点聚成一个个"社区"——通常对应代码里的模块/子系统边界。每个社区算内聚度、主导语言、大小等。
78
+
79
+ ```bash
80
+ # 全量构建:一次性执行解析、签名+FTS、社区/执行流,构建速度很快,后续用 update 增量维护即可。
81
+ dr build
82
+
83
+ # 构建同时刷新嵌入索引(启用语义搜索)
84
+ dr build --embedding-provider local --embedding-model all-MiniLM-L6-v2
85
+ ```
86
+
87
+ #### update:更新
88
+ ```bash
89
+ HEAD~1 ──► HEAD (最新) ◄─────── 暂存区 ◄─────── 工作区
90
+ (历史) (仓库) commit (Staged) add (Unstaged)
91
+ │ │ │
92
+ └─── git diff ────┴──────────────────┘ (默认 diff 工作区与 HEAD/暂存区)
93
+ ```
94
+
95
+ ```bash
96
+ # 解析从上次构建到现在的所有变更文件,一次性追平。不用关心中间过了几个 commit。
97
+ dr update
98
+ # 一个命令同时 刷新图谱 + 看这次变更影响了什么、省了多少 token。
99
+ dr update --brief
100
+
101
+ # 想确认"省 token"的估算准不准,用真实分词器校准,需在 .env 指定分词器。
102
+ dr update --brief --verify
103
+
104
+ # base = 比较或合并时的参照点,可以是分支、tag、commit hash、HEAD~1
105
+ # 解析"本地相对 origin/main 有差异的文件"——也就是你本地正在改、还没推的那些。
106
+ dr update --base origin/main
107
+
108
+ # update 默认不更新向量。 它只更新图谱结构(节点/边/FTS/社区/执行流),完全不动 embeddings 表。
109
+ # 是否开启语义(首次):关键词匹配,同义词、接受自然语言查询、跨语言匹配。
110
+ dr embed --provider local
111
+ # 启用了嵌入(embed),日常维护必须带这俩 flag,否则图谱结构和语义索引会不同步。
112
+ dr update --embedding-provider local --embedding-model all-MiniLM-L6-v2
113
+ ```
114
+
115
+ 支持两种 provider:
116
+ - `local`(默认):sentence-transformers,离线,模型经 `DR_EMBEDDING_MODEL` 或 `--model` 指定。
117
+ - `openai`:任何遵循 OpenAI `/v1/embeddings` 的端点。配置好后:
118
+ ```bash
119
+ dr embed --provider openai
120
+ dr update --embedding-provider openai --embedding-model text-embedding-3-small
121
+ ```
122
+ CLI/MCP 的 `--provider/--model` 可覆盖 `.env`;未传则回落 `.env`。
123
+
124
+ #### detect-changes:变更分析
125
+ | 命令 | 输出形式 | 基准 | 风险评分 | Token 估算 |
126
+ | :---: | :---: | :---: | :---: | :---: |
127
+ | dr detect-changes | 完整 JSON | HEAD(默认) | 基础 | 附带估算 |
128
+ | --churn | 同上 | 同上 | + 变更频率项 | 同上 |
129
+ | --base 分支 | 同上 | origin/main | 基础 | 同上 |
130
+ | --brief | 紧凑面板 | HEAD | 摘要 | 估算面板 |
131
+ | --brief --verify | 紧凑面板 | HEAD | 摘要 | + tiktoken 真实验证 |
132
+
133
+
134
+ ```bash
135
+ dr detect-changes
136
+ # 给风险评分加一个“这文件最近改得勤不勤”的加权项(最多 +0.15)。
137
+ dr detect-changes --churn
138
+ dr detect-changes --base origin/main
139
+ dr detect-changes --brief
140
+ dr detect-changes --brief --verify
141
+ # 也支持 --repo PATH
142
+ ```
143
+
144
+ detect-changes vs update—— 选哪个?
145
+
146
+ + detect-changes --brief:只读。询问"我当前变更对现有图谱的影响是什么?快速(约 1 秒)。当图谱已是最新时使用(如果安装了 hooks,默认如此)。
147
+ + update:先将变更文件重新解析到图谱,然后在末尾运行相同分析。在 rebase 后、大型变更集后,或任何怀疑图谱过时时使用。
148
+
149
+ #### watch:半自动更新
150
+ ```bash
151
+ # 后台监听文件变更,一有改动自动增量更新,Ctrl+C 停止。适合开发过程中挂着。
152
+ dr watch
153
+ # 监听同时增量刷新嵌入索引
154
+ dr watch --embedding-provider local --embedding-model all-MiniLM-L6-v2
155
+ ```
156
+
157
+ #### status、visualize、wiki
158
+ ```bash
159
+ # 查看图谱信息
160
+ dr status
161
+ dr status --json # 输出单个机器可读的 JSON 对象(便于脚本消费)
162
+
163
+ # HTML 可视化代码知识图谱
164
+ dr visualize
165
+ --serve:生成 HTML 后,起一个本地静态 HTTP(localhost:8765),方便加载本地资源
166
+ --format:html、json、cypher、svg、graphml、obsidian
167
+
168
+ # 从代码知识图谱的社区结构生成一套可导航的 Markdown 文档 wiki
169
+ dr wiki
170
+ ```
171
+
172
+ #### register:多仓库
173
+ ```bash
174
+ # 注册仓库
175
+ dr register <path> [--alias name]
176
+ # 从注册表移除
177
+ dr unregister <path_or_alias>
178
+ # 列出已注册仓库
179
+ dr repos
180
+ ```
181
+
182
+ #### daemon:多仓库监听
183
+ ```bash
184
+ # 带--foreground:fork 到后台运行,脱离终端,关闭 shell 还在
185
+ dr daemon start [--foreground]
186
+ # 停止守护进程
187
+ dr daemon stop
188
+ # 重启
189
+ dr daemon restart [--foreground]
190
+ # 显示状态和仓库列表
191
+ dr daemon status
192
+ # 仓库加进守护进程
193
+ dr daemon add <path> [--alias NAME]
194
+ # 从配置移除仓库
195
+ dr daemon remove <path_or_alias>
196
+ ```
197
+
198
+ ```bash
199
+ # --repo ALIAS:看指定仓库的日志(<log_dir>/<alias>.log);不带则看主守护进程日志(daemon.log)。
200
+ # --lines N / -n:显示最后 N 行(默认 50)。
201
+ # --follow:持续追踪日志输出(tail -f)。
202
+ dr daemon logs [--repo ALIAS] [--lines N] [--follow]
203
+ ```
204
+
205
+ #### query、impact、search、flow:查询
206
+
207
+ ```bash
208
+ # 查关系:callers_of / callees_of / imports_of / importers_of / children_of / tests_for / inheritors_of / file_summary
209
+ dr query callers_of my_func
210
+ dr query tests_for MyService
211
+ dr query file_summary src/api.py
212
+
213
+ # 从指定变更文件出发,沿边做 BFS 找受影响的下游节点,输出"爆炸半径"。
214
+ dr impact --files src/api.py --depth 2 --max-results 500 --base HEAD
215
+
216
+ # 按自然语言或关键字定位"大概是哪个函数/类",省去 Grep 整库扫。
217
+ dr search "登录鉴权" --kind Function --limit 20
218
+
219
+ # 列出"最重要的调用路径",定位系统热点入口。
220
+ dr flows --sort criticality --limit 50 --kind http
221
+ # 看某条具体调用链的逐步展开(含源码),等价于"这条请求会经过哪些函数"
222
+ dr flow --id 3 --source # --source 带上源码片段
223
+
224
+ # 列出代码库里"自然分成的子系统",看模块边界是否合理。
225
+ dr communities --sort size --min-size 3
226
+ # 看某个子系统具体包含哪些函数/类。
227
+ dr community --name "auth-module" --members
228
+
229
+ # 架构概览
230
+ dr architecture --detail-level minimal # 或 standard(更细)
231
+
232
+ # 定位"该拆分的长函数/大类",做重构排期。
233
+ dr large-functions --min-lines 50 --kind Function --path src/ --limit 50
234
+ ```
235
+
236
+ #### refactor:重构预览
237
+ ```bash
238
+ # 重命名前的"影响点清单"预演。
239
+ dr refactor rename --old-name oldFn --new-name newFn --kind Function
240
+ # 圈定可安全删除的代码。
241
+ dr refactor dead_code --kind Function
242
+ # 让图谱主动给"哪里该重构"的提示。
243
+ dr refactor suggest
244
+ ```
245
+
246
+ #### dead-code:死代码检测
247
+ ```bash
248
+ # 找没有任何调用方、也没有测试引用的函数 / 类
249
+ dr dead-code
250
+ dr dead-code --kind Class/Function --file-pattern src/legacy --limit 100
251
+ dr dead-code --json # 输出机器可读 JSON 数组
252
+ ```
253
+ > 静态分析对动态调用有盲区,删前必须人工复核(框架自动分派、注册式入口等间接调用)。
254
+
255
+ ### 【使用手册-SKILL】
256
+
257
+ #### 总览
258
+
259
+ | Skill | 一句话定位 | 典型场景数 |
260
+ | :--- | :--- | :---: |
261
+ | `/dr-build-graph` | 构建或更新知识图谱,等价于 `dr build` | 2 |
262
+ | `/dr-explore-codebase` | 从整体指标→架构→社区→语义搜索,理解陌生仓库 | 2 |
263
+ | `/dr-review-changes` | 审查当前工作区变更(基线 HEAD),结构化风险报告 | 2 |
264
+ | `/dr-review-delta` | 仅审查工作区未提交变更(变更+2跳邻居),极省 token | 2 |
265
+ | `/dr-review-pr` | 审查整个 PR/分支 vs main,全面但聚焦高风险文件 | 2 |
266
+ | `/dr-debug-issue` | 搜索→追踪调用链→执行流→近期变更→影响半径,系统性调试 | 2 |
267
+ | `/dr-refactor-safely` | 重构前看依赖关系,避免改一个名字炸一片 | 2 |
268
+
269
+ #### 三个审查 skill 的区别
270
+
271
+ | | dr-review-changes | dr-review-delta | dr-review-pr |
272
+ | :---: | :---: | :---: | :---: |
273
+ | **范围** | 当前工作区变更 | 工作区未提交增量 | 整个 PR/分支 vs main |
274
+ | **基线** | HEAD | HEAD | main |
275
+ | **token 策略** | 标准结构化审查 | 极省(变更+2跳邻居) | 全面但聚焦高风险文件 |
276
+ | **适用** | "我改的这些代码 OK 吗" | "快速过一眼工作区改动" | "这个 PR 能不能合并" |
277
+
278
+ ---
279
+
280
+ #### 各 Skill 典型场景
281
+
282
+ ##### /dr-build-graph
283
+ 构建或更新本仓库的知识图谱。图谱会在编辑/提交时通过钩子自动更新,因此手动构建很少需要。
284
+
285
+ 1. **首次接手仓库**:刚 clone 一个项目,还没有图谱。跑一次全量构建,把源码里的函数、类、调用关系、依赖关系全部解析进本地数据库,后续所有审查、调试、探索都建立在这个基础之上。
286
+ 2. **大重构或图谱脱节后追平**:删除了一整个目录、合并了一长串提交,或文件监听没跑起来导致图谱落后于代码。用增量更新只重新解析变更过的文件,把图谱追平到当前状态,避免全量重建的开销。
287
+
288
+ ##### /dr-explore-codebase
289
+ 理解陌生代码库的导航工具,从宏观到微观逐层下钻。
290
+
291
+ 1. **接手陌生仓库**:第一次进入项目,完全不知道它是干什么的。先看整体规模和架构分层,再定位到核心入口和模块边界,快速建立全局心智模型,避免在细节里迷路。
292
+ 2. **发现隐藏的耦合与复杂度风险**:找出跨模块的意外依赖、一旦改动就影响大片代码的桥接节点,以及最复杂的巨型代码——这些都是改动时必须格外小心的高风险区。
293
+
294
+ ##### /dr-review-changes
295
+ 审查当前工作区的未提交变更,给出带风险评分的结构化报告。
296
+
297
+ 1. **提交前的自查**:本地改了一批代码,准备提交。先看这次变更整体风险多高、影响了哪些执行路径、关键改动有没有测试覆盖,再决定能不能放心提交,避免把问题带进主干。
298
+ 2. **甄别机械变更与小改大影响**:大规模重命名后几十个文件都变了,需区分真正的逻辑变更与无实质影响的副产品;反之,只改了几行看似无害的代码却波及十几条路径,要提前预警。两种极端都靠影响半径来判定。
299
+
300
+ ##### /dr-review-delta
301
+ 只审查最近一次提交以来的增量变更,是最省 token 的审查方式。
302
+
303
+ 1. **快速过一眼最近一次提交**:刚提交完一个小改动,想低成本确认没遗漏问题。只把变更代码和它直接相关的邻居代码送给模型审查,而不是读整个仓库,几秒内拿到「风险+问题+影响范围」的紧凑报告。
304
+ 2. **聚焦审查单个改动点及其波及面**:只改了某处代码,自动圈定它以及调用它、被它调用的相关代码,只审查这一小片切片——包括继承关系是否破坏、调用方是否需同步调整,不被无关代码干扰。
305
+
306
+ ##### /dr-review-pr
307
+ 审查整个 PR 或分支相对 main 的全部变更,全面但聚焦高风险区域。
308
+
309
+ 1. **合并前的完整审查**:PR 涉及多个文件、多次提交,需要判断能不能合并。拿到整个 PR 的变更全貌、算出影响半径、对高风险改动逐一检查测试覆盖,输出「风险评级/逐文件问题/缺失测试/合并建议」的完整报告。
310
+ 2. **破坏性变更核对与测试缺口门禁**:重命名核心接口后确认所有调用方都已同步更新,主动搜索可能遗漏的相关代码;同时对所有变更逐一检查测试覆盖,把未覆盖项作为合并的硬门禁,避免合并后下游大面积报错。
311
+
312
+ ##### /dr-debug-issue
313
+ 系统性调试工具,从搜索定位到调用链追踪到近期变更核查,一条龙排查问题。
314
+
315
+ 1. **报错堆栈定位根因**:用户反馈某个操作报错。从报错点出发顺着调用链一路往下追,看完整执行路径上哪一步出了问题,定位真正的根因而非表面症状;若是回归 bug,沿依赖关系找出「改了 A、却炸了依赖 A 的 B」这类间接回归。
316
+ 2. **新问题与性能问题的排查入口**:完全不知道问题出在哪时,先拿全局视图看哪些执行流可能相关,再双向追踪缩小范围;性能变慢时,展开完整调用链找出不必要的中间调用、重复解析或绕远的链路。
317
+
318
+ ##### /dr-refactor-safely
319
+ 重构前的依赖分析工具,避免「改一个名字炸一片」。
320
+
321
+ 1. **安全重命名与拆分巨型代码**:重命名被多处调用的符号时,基于真实调用关系精确找到所有调用点,预览确认后一次性替换,既不漏调用方也不误改注释同名词;拆分超大代码前先看它被多少处依赖、拆分会不会破坏关键路径,把高风险重构变成有把握的动作。
322
+ 2. **清理死代码与结构整理**:找出没有被任何地方引用的代码,但静态分析对动态调用有盲区,必须人工复核排除框架自动分派、注册式入口等间接调用,避免误删;对「某段代码应搬到另一模块」的建议需人工判断收益,机械执行不一定划算。
323
+
324
+ > 通用规则:每个 skill 都遵循「先拿最小全局上下文 → 全程用最精简的输出 → 少量工具调用、极少 token」的省 token 原则。
325
+
326
+ ### 【注意事项】
327
+ #### 影响分析
328
+ 从种子节点(变更文件的内容)出发进行 BFS:
329
+
330
+ 1. 种子 = 变更文件中的所有限定名称
331
+ 2. 对边界中的每个节点:
332
+ - 追踪前向边(该节点影响的内容),下游影响(调用变更代码的内容)
333
+ - 追踪反向边(依赖该节点的内容),上游上下文(变更代码所依赖的内容)
334
+ 3. 展开至最多 `max_depth` 跳(默认:2)
335
+ 4. 收集所有到达的节点作为"受影响节点"
336
+
337
+ #### 忽略模式
338
+ 默认情况下,以下路径被排除在索引之外:
339
+
340
+ ```plain
341
+
342
+ __pycache__/** *.pyc .venv/**
343
+ venv/** dist/** build/**
344
+ .next/** target/** *.min.js
345
+ *.min.css *.map *.lock
346
+ package-lock.json yarn.lock *.db
347
+ *.sqlite *.db-journal
348
+ ```
349
+
350
+ 要添加自定义模式,在仓库根目录创建 `.deep-reviewignore` 文件(语法与 `.gitignore` 相同):
351
+
352
+ ```plain
353
+ generated/**
354
+ vendor/**
355
+ *.generated.ts
356
+ ```
357
+
358
+ 在 git 仓库中,索引基于已追踪文件(`git ls-files`),因此被 gitignore 的文件会自动跳过。当 git 不可用或需要排除已追踪文件时,使用 `.deep-reviewignore`。