vcode-analysis 0.10.0__tar.gz → 0.10.1__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.
- {vcode_analysis-0.10.0/vcode_analysis.egg-info → vcode_analysis-0.10.1}/PKG-INFO +8 -6
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/README.md +7 -5
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/cli.py +66 -5
- vcode_analysis-0.10.1/core/json_utils.py +125 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/pyproject.toml +1 -1
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1/vcode_analysis.egg-info}/PKG-INFO +8 -6
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/server.py +1 -1
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/tool_handler.py +2 -2
- vcode_analysis-0.10.0/core/json_utils.py +0 -65
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/LICENSE +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/MANIFEST.in +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/_tuning_context.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/architecture.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/code_review.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/context_builder.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/directory.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/documentation.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/knowledge_graph.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/security.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/analyzers/security_ast.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/analyzer.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/batch_analyzer.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/batch_planner.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/cache_manager.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/config.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/feedback_hub.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/git_handler.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/ignore.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/llm_client.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/metrics_store.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompt_manager.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/architecture.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/batch_review.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/code_review.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/code_review_v2.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/commit_review.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/documentation/api.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/documentation/module.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/documentation/readme.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/mcp/code_review_checklist.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/mcp/mr_review_template.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/mcp/vuln_tuning_advisor.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/prompts/security_analysis.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/report_generator.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/core/token_estimator.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/2026-stage-highlights.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/PPT/345/244/247/347/272/262-VCode_Analysis_/346/231/272/350/203/275/344/273/243/347/240/201/345/210/206/346/236/220/345/267/245/345/205/267/345/210/206/344/272/253.md" +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/PPT/347/224/237/346/210/220/346/217/220/347/244/272/350/257/215-VCode_Analysis/345/210/206/344/272/253.md" +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/USER_MANUAL.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/batch-cache-optimization.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/c-parser-design.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/code-knowledge-graph.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/critical-severity.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/expert-review-response-2026-07.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/kotlin-parser-design.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/prompt-externalization.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/three-year-roadmap.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/vcode-analysis-tool.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/review-scenarios.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/security-sharing-article.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/severity-standard.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/superpowers/plans/2026-07-22-expert-review-response.md +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs//350/207/252/350/215/220/344/272/256/347/202/271/350/257/264/346/230/216.md" +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c/ast_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c/models.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c/patterns.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c/regex_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/c_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/java_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/javascript_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin/ast_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin/models.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin/patterns.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin/regex_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/kotlin_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/python_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/sql_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/parsers/typescript_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/requirements.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/setup.cfg +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_batch_operations.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_c_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_context_builder_sql.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_kotlin_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_mcp_tools.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_metrics_store.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_prompt_manager.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_report_generator.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_security_rules.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/tests/test_sql_parser.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/SOURCES.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/dependency_links.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/entry_points.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/requires.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/top_level.txt +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/__init__.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/prompt_handler.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/resource_handler.py +0 -0
- {vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_mcp/transports/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vcode-analysis
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.1
|
|
4
4
|
Summary: 基于大模型的智能代码分析工具,支持代码审查、文档生成、架构分析和安全扫描
|
|
5
5
|
Author-email: Wellchang <2483808264@qq.com>
|
|
6
6
|
License: MIT
|
|
@@ -115,14 +115,13 @@ vcode-analysis review ./src
|
|
|
115
115
|
# 审查单个文件
|
|
116
116
|
vcode-analysis review ./src/main.py
|
|
117
117
|
|
|
118
|
-
#
|
|
119
|
-
vcode-analysis review ./src -o report.md
|
|
120
|
-
vcode-analysis review ./src -o report.html -f html
|
|
118
|
+
# 指定输出路径(默认生成 Markdown 报告,并自动生成同目录 .html 交互报告)
|
|
119
|
+
vcode-analysis review ./src -o report.md
|
|
121
120
|
|
|
122
121
|
# 启用上下文增强(提升分析质量)
|
|
123
122
|
vcode-analysis review ./src --context
|
|
124
123
|
|
|
125
|
-
# 审查 Git
|
|
124
|
+
# 审查 Git 提交(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
126
125
|
vcode-analysis review-commit abc1234
|
|
127
126
|
```
|
|
128
127
|
|
|
@@ -209,9 +208,12 @@ MCP Server 提供 8 个 Tool、3 个 Resource、3 个 Prompt:
|
|
|
209
208
|
### 6. Git 操作
|
|
210
209
|
|
|
211
210
|
```bash
|
|
212
|
-
#
|
|
211
|
+
# 克隆并分析(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
213
212
|
vcode-analysis clone https://github.com/user/repo.git
|
|
214
213
|
|
|
214
|
+
# 克隆后自动执行代码审查并保存报告
|
|
215
|
+
vcode-analysis clone https://github.com/user/repo.git --analyze
|
|
216
|
+
|
|
215
217
|
# 批量克隆(从文件读取 URL 列表)
|
|
216
218
|
vcode-analysis batch-clone repos.txt ./workspace
|
|
217
219
|
|
|
@@ -73,14 +73,13 @@ vcode-analysis review ./src
|
|
|
73
73
|
# 审查单个文件
|
|
74
74
|
vcode-analysis review ./src/main.py
|
|
75
75
|
|
|
76
|
-
#
|
|
77
|
-
vcode-analysis review ./src -o report.md
|
|
78
|
-
vcode-analysis review ./src -o report.html -f html
|
|
76
|
+
# 指定输出路径(默认生成 Markdown 报告,并自动生成同目录 .html 交互报告)
|
|
77
|
+
vcode-analysis review ./src -o report.md
|
|
79
78
|
|
|
80
79
|
# 启用上下文增强(提升分析质量)
|
|
81
80
|
vcode-analysis review ./src --context
|
|
82
81
|
|
|
83
|
-
# 审查 Git
|
|
82
|
+
# 审查 Git 提交(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
84
83
|
vcode-analysis review-commit abc1234
|
|
85
84
|
```
|
|
86
85
|
|
|
@@ -167,9 +166,12 @@ MCP Server 提供 8 个 Tool、3 个 Resource、3 个 Prompt:
|
|
|
167
166
|
### 6. Git 操作
|
|
168
167
|
|
|
169
168
|
```bash
|
|
170
|
-
#
|
|
169
|
+
# 克隆并分析(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
171
170
|
vcode-analysis clone https://github.com/user/repo.git
|
|
172
171
|
|
|
172
|
+
# 克隆后自动执行代码审查并保存报告
|
|
173
|
+
vcode-analysis clone https://github.com/user/repo.git --analyze
|
|
174
|
+
|
|
173
175
|
# 批量克隆(从文件读取 URL 列表)
|
|
174
176
|
vcode-analysis batch-clone repos.txt ./workspace
|
|
175
177
|
|
|
@@ -113,7 +113,7 @@ from analyzers import (
|
|
|
113
113
|
)
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
__version__ = "0.10.
|
|
116
|
+
__version__ = "0.10.1"
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
def _timestamp() -> str:
|
|
@@ -530,7 +530,7 @@ def cmd_review(args: dict) -> int:
|
|
|
530
530
|
reviewer.metrics_store = _metrics_store
|
|
531
531
|
reviewer._current_run_id = _metrics_store.record_scan_run(ScanRun(
|
|
532
532
|
repo_path=str(Path(target_path).resolve()),
|
|
533
|
-
analyzer="code_review", tool_version="0.10.
|
|
533
|
+
analyzer="code_review", tool_version="0.10.1",
|
|
534
534
|
))
|
|
535
535
|
_log_section("分析中(逐文件模式)")
|
|
536
536
|
_log(f"开始分析 {total} 个文件...", "START")
|
|
@@ -640,7 +640,7 @@ def cmd_review(args: dict) -> int:
|
|
|
640
640
|
_metrics_store = MetricsStore(_metrics_db)
|
|
641
641
|
_run_id = _metrics_store.record_scan_run(ScanRun(
|
|
642
642
|
repo_path=str(Path(target_path).resolve()),
|
|
643
|
-
analyzer="code_review", tool_version="0.10.
|
|
643
|
+
analyzer="code_review", tool_version="0.10.1",
|
|
644
644
|
))
|
|
645
645
|
for r in results:
|
|
646
646
|
if r.success and r.issues:
|
|
@@ -774,6 +774,9 @@ def cmd_review_commit(args: dict) -> int:
|
|
|
774
774
|
if target_path is True:
|
|
775
775
|
target_path = "."
|
|
776
776
|
|
|
777
|
+
# 默认输出路径(未指定 --output 时自动生成)
|
|
778
|
+
output_file = args.get("--output") or str(get_default_output_path(target_path, "commit_review"))
|
|
779
|
+
|
|
777
780
|
config = Config.create(
|
|
778
781
|
config_file=args.get("--config"),
|
|
779
782
|
prompts_dir=args.get("--prompts-dir"),
|
|
@@ -803,7 +806,7 @@ def cmd_review_commit(args: dict) -> int:
|
|
|
803
806
|
_metrics_store = MetricsStore(_metrics_db)
|
|
804
807
|
_run_id = _metrics_store.record_scan_run(ScanRun(
|
|
805
808
|
repo_path=str(Path(target_path).resolve()),
|
|
806
|
-
analyzer="code_review", tool_version="0.10.
|
|
809
|
+
analyzer="code_review", tool_version="0.10.1",
|
|
807
810
|
))
|
|
808
811
|
|
|
809
812
|
with Analyzer(config) as analyzer:
|
|
@@ -842,6 +845,41 @@ def cmd_review_commit(args: dict) -> int:
|
|
|
842
845
|
if result.summary:
|
|
843
846
|
print(f"## 总结\n {result.summary}")
|
|
844
847
|
|
|
848
|
+
# 构建并保存报告文件
|
|
849
|
+
report_lines = [
|
|
850
|
+
"# 提交审查报告",
|
|
851
|
+
"",
|
|
852
|
+
f"- **提交**: {commit_hash}",
|
|
853
|
+
f"- **仓库路径**: {target_path}",
|
|
854
|
+
f"- **评分**: {result.score}/10",
|
|
855
|
+
f"- **审查时间**: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
|
|
856
|
+
"",
|
|
857
|
+
]
|
|
858
|
+
if result.issues:
|
|
859
|
+
report_lines.append("## 问题列表")
|
|
860
|
+
report_lines.append("")
|
|
861
|
+
for issue in result.issues:
|
|
862
|
+
sev = issue.get("severity", "low")
|
|
863
|
+
file_ = issue.get("file", "")
|
|
864
|
+
line = issue.get("line", 0)
|
|
865
|
+
desc = issue.get("description", "")
|
|
866
|
+
loc = f"{file_}:{line}" if file_ else f"行 {line}"
|
|
867
|
+
report_lines.append(f"- [{sev.upper()}] {issue.get('type', '')}: {desc} ({loc})")
|
|
868
|
+
report_lines.append("")
|
|
869
|
+
if result.suggestions:
|
|
870
|
+
report_lines.append("## 改进建议")
|
|
871
|
+
report_lines.append("")
|
|
872
|
+
for i, s in enumerate(result.suggestions, 1):
|
|
873
|
+
report_lines.append(f"{i}. {s}")
|
|
874
|
+
report_lines.append("")
|
|
875
|
+
if result.summary:
|
|
876
|
+
report_lines.append("## 总结")
|
|
877
|
+
report_lines.append("")
|
|
878
|
+
report_lines.append(result.summary)
|
|
879
|
+
report_lines.append("")
|
|
880
|
+
Path(output_file).write_text("\n".join(report_lines), encoding="utf-8")
|
|
881
|
+
_log(f"结果已保存到: {output_file}")
|
|
882
|
+
|
|
845
883
|
_log_section("审查完成")
|
|
846
884
|
_log(f"总耗时: {_format_duration(elapsed)}")
|
|
847
885
|
if args.get("--metrics") and _metrics_db:
|
|
@@ -1304,7 +1342,7 @@ def cmd_security(args: dict) -> int:
|
|
|
1304
1342
|
security.metrics_store = _metrics_store
|
|
1305
1343
|
security._current_run_id = _metrics_store.record_scan_run(ScanRun(
|
|
1306
1344
|
repo_path=str(Path(target_path).resolve()),
|
|
1307
|
-
analyzer="security", tool_version="0.10.
|
|
1345
|
+
analyzer="security", tool_version="0.10.1",
|
|
1308
1346
|
))
|
|
1309
1347
|
results = security.scan_project(target_path, deep=deep_scan, log_callback=_log)
|
|
1310
1348
|
scan_time = time.time() - scan_start
|
|
@@ -1495,6 +1533,7 @@ def cmd_clone(args: dict) -> int:
|
|
|
1495
1533
|
)
|
|
1496
1534
|
|
|
1497
1535
|
analyze_start = time.time()
|
|
1536
|
+
review_results = []
|
|
1498
1537
|
with Analyzer(config) as analyzer:
|
|
1499
1538
|
# 代码审查
|
|
1500
1539
|
_log_section("代码审查")
|
|
@@ -1506,6 +1545,7 @@ def cmd_clone(args: dict) -> int:
|
|
|
1506
1545
|
for i, file_info in enumerate(file_infos[:5], 1): # 限制数量
|
|
1507
1546
|
_log(f"[{i}] {file_info.relative_path}")
|
|
1508
1547
|
result = reviewer.review_file(file_info)
|
|
1548
|
+
review_results.append((file_info, result))
|
|
1509
1549
|
if result.success:
|
|
1510
1550
|
_log(f" 评分: {result.score}/10")
|
|
1511
1551
|
analyze_time = time.time() - analyze_start
|
|
@@ -1521,6 +1561,27 @@ def cmd_clone(args: dict) -> int:
|
|
|
1521
1561
|
],
|
|
1522
1562
|
)
|
|
1523
1563
|
|
|
1564
|
+
# 保存分析报告
|
|
1565
|
+
report_lines = [
|
|
1566
|
+
"# 克隆分析报告",
|
|
1567
|
+
"",
|
|
1568
|
+
f"- **仓库**: {repo_url}",
|
|
1569
|
+
f"- **分支**: {branch or '默认分支'}",
|
|
1570
|
+
f"- **克隆路径**: {repo_path}",
|
|
1571
|
+
f"- **分析文件数**: {len(review_results)}",
|
|
1572
|
+
f"- **总耗时**: {_format_duration(total_time)}",
|
|
1573
|
+
"",
|
|
1574
|
+
"## 审查结果",
|
|
1575
|
+
"",
|
|
1576
|
+
]
|
|
1577
|
+
for file_info, result in review_results:
|
|
1578
|
+
if result.success:
|
|
1579
|
+
report_lines.append(f"- {file_info.relative_path}: **{result.score}/10**")
|
|
1580
|
+
else:
|
|
1581
|
+
report_lines.append(f"- {file_info.relative_path}: 分析失败")
|
|
1582
|
+
report_lines.append("")
|
|
1583
|
+
_save_output_to_file(args, "\n".join(report_lines), "clone")
|
|
1584
|
+
|
|
1524
1585
|
return 0
|
|
1525
1586
|
|
|
1526
1587
|
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""JSON 解析工具函数
|
|
2
|
+
|
|
3
|
+
处理 LLM 生成的 JSON 中常见的格式问题。
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
# JSON 中合法的单字符转义(\uXXXX 单独处理)
|
|
9
|
+
_VALID_ESCAPES = frozenset('"\\/bfnrt')
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def fix_invalid_escapes(json_str: str) -> str:
|
|
13
|
+
"""修复 JSON 字符串字面量中非法的反斜杠转义序列。
|
|
14
|
+
|
|
15
|
+
LLM 常把 Windows 路径(如 C:\\Users\\...)或正则表达式(如 \\d+)原样写入
|
|
16
|
+
JSON 字符串,导致 json.loads 抛出 "Invalid \\escape"。本函数只处理字符串
|
|
17
|
+
字面量内的非法转义,合法转义(\\" \\\\ \\/ \\b \\f \\n \\r \\t \\uXXXX)
|
|
18
|
+
保持不变。
|
|
19
|
+
|
|
20
|
+
处理规则:
|
|
21
|
+
- \\x(x 非合法转义字符,如 \\d、\\U、\\q)→ \\\\x,即把反斜杠转义为字面反斜杠
|
|
22
|
+
- \\ 后跟裸换行/回车 → 换成合法的 \\n / \\r 转义
|
|
23
|
+
- 字符串内末尾的裸 \\ → \\\\
|
|
24
|
+
- 非法 \\u(后 4 位非十六进制)→ \\\\u
|
|
25
|
+
"""
|
|
26
|
+
out = []
|
|
27
|
+
i, n = 0, len(json_str)
|
|
28
|
+
in_string = False
|
|
29
|
+
while i < n:
|
|
30
|
+
ch = json_str[i]
|
|
31
|
+
if ch == '"':
|
|
32
|
+
in_string = not in_string
|
|
33
|
+
out.append(ch)
|
|
34
|
+
i += 1
|
|
35
|
+
elif ch == '\\' and in_string:
|
|
36
|
+
if i + 1 >= n:
|
|
37
|
+
out.append('\\\\')
|
|
38
|
+
i += 1
|
|
39
|
+
else:
|
|
40
|
+
nxt = json_str[i + 1]
|
|
41
|
+
if nxt == 'u':
|
|
42
|
+
hex_part = json_str[i + 2:i + 6]
|
|
43
|
+
if len(hex_part) == 4 and all(c in '0123456789abcdefABCDEF' for c in hex_part):
|
|
44
|
+
out.append('\\u')
|
|
45
|
+
out.append(hex_part)
|
|
46
|
+
i += 6
|
|
47
|
+
else:
|
|
48
|
+
out.append('\\\\u')
|
|
49
|
+
i += 2
|
|
50
|
+
elif nxt in _VALID_ESCAPES:
|
|
51
|
+
out.append(ch)
|
|
52
|
+
out.append(nxt)
|
|
53
|
+
i += 2
|
|
54
|
+
elif nxt in '\r\n':
|
|
55
|
+
out.append('\\\\')
|
|
56
|
+
out.append('n' if nxt == '\n' else 'r')
|
|
57
|
+
i += 2
|
|
58
|
+
else:
|
|
59
|
+
out.append('\\\\')
|
|
60
|
+
out.append(nxt)
|
|
61
|
+
i += 2
|
|
62
|
+
else:
|
|
63
|
+
out.append(ch)
|
|
64
|
+
i += 1
|
|
65
|
+
return ''.join(out)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def remove_trailing_commas(json_str: str) -> str:
|
|
69
|
+
"""修复 LLM 生成 JSON 中的常见格式问题,使其兼容 Python json.loads()。
|
|
70
|
+
|
|
71
|
+
处理:
|
|
72
|
+
1. 移除字符串外的尾随逗号(如 {"a":1,}),不影响字符串内的逗号
|
|
73
|
+
2. 修复字符串内非法的反斜杠转义(如 Windows 路径 C:\\Users\\...、正则 \\d+)
|
|
74
|
+
"""
|
|
75
|
+
return re.sub(r',\s*([}\]])', r'\1', fix_invalid_escapes(json_str))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def parse_llm_json(content: str) -> dict:
|
|
79
|
+
"""解析 LLM 返回的 JSON 内容,自动处理常见格式问题。
|
|
80
|
+
|
|
81
|
+
处理步骤:
|
|
82
|
+
1. 移除 markdown 代码块包裹
|
|
83
|
+
2. 移除思考过程标签
|
|
84
|
+
3. 移除尾随逗号
|
|
85
|
+
4. 解析 JSON
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
content: LLM 返回的原始文本
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
解析后的字典
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
json.JSONDecodeError: JSON 格式无法修复时抛出
|
|
95
|
+
"""
|
|
96
|
+
import json
|
|
97
|
+
|
|
98
|
+
text = content.strip()
|
|
99
|
+
|
|
100
|
+
# 移除思考过程
|
|
101
|
+
thinking_patterns = [
|
|
102
|
+
r'Thinking Process:[\s\S]*?(?=\{)',
|
|
103
|
+
r'<think>[\s\S]*?</think>',
|
|
104
|
+
r'\[THOUGHT\][\s\S]*?\[/THOUGHT\]',
|
|
105
|
+
]
|
|
106
|
+
for pattern in thinking_patterns:
|
|
107
|
+
match = re.search(pattern, text)
|
|
108
|
+
if match:
|
|
109
|
+
text = text[match.end():].strip()
|
|
110
|
+
break
|
|
111
|
+
|
|
112
|
+
# 提取 JSON
|
|
113
|
+
if "```json" in text:
|
|
114
|
+
text = text.split("```json")[1].split("```")[0].strip()
|
|
115
|
+
elif "```" in text:
|
|
116
|
+
parts = text.split("```")
|
|
117
|
+
if len(parts) >= 2:
|
|
118
|
+
text = parts[1].strip()
|
|
119
|
+
else:
|
|
120
|
+
json_match = re.search(r'\{[\s\S]*\}', text)
|
|
121
|
+
if json_match:
|
|
122
|
+
text = json_match.group(0)
|
|
123
|
+
|
|
124
|
+
# 移除尾随逗号后解析
|
|
125
|
+
return json.loads(remove_trailing_commas(text))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vcode-analysis
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.1
|
|
4
4
|
Summary: 基于大模型的智能代码分析工具,支持代码审查、文档生成、架构分析和安全扫描
|
|
5
5
|
Author-email: Wellchang <2483808264@qq.com>
|
|
6
6
|
License: MIT
|
|
@@ -115,14 +115,13 @@ vcode-analysis review ./src
|
|
|
115
115
|
# 审查单个文件
|
|
116
116
|
vcode-analysis review ./src/main.py
|
|
117
117
|
|
|
118
|
-
#
|
|
119
|
-
vcode-analysis review ./src -o report.md
|
|
120
|
-
vcode-analysis review ./src -o report.html -f html
|
|
118
|
+
# 指定输出路径(默认生成 Markdown 报告,并自动生成同目录 .html 交互报告)
|
|
119
|
+
vcode-analysis review ./src -o report.md
|
|
121
120
|
|
|
122
121
|
# 启用上下文增强(提升分析质量)
|
|
123
122
|
vcode-analysis review ./src --context
|
|
124
123
|
|
|
125
|
-
# 审查 Git
|
|
124
|
+
# 审查 Git 提交(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
126
125
|
vcode-analysis review-commit abc1234
|
|
127
126
|
```
|
|
128
127
|
|
|
@@ -209,9 +208,12 @@ MCP Server 提供 8 个 Tool、3 个 Resource、3 个 Prompt:
|
|
|
209
208
|
### 6. Git 操作
|
|
210
209
|
|
|
211
210
|
```bash
|
|
212
|
-
#
|
|
211
|
+
# 克隆并分析(结果默认保存到 result/ 目录,-o 可指定路径)
|
|
213
212
|
vcode-analysis clone https://github.com/user/repo.git
|
|
214
213
|
|
|
214
|
+
# 克隆后自动执行代码审查并保存报告
|
|
215
|
+
vcode-analysis clone https://github.com/user/repo.git --analyze
|
|
216
|
+
|
|
215
217
|
# 批量克隆(从文件读取 URL 列表)
|
|
216
218
|
vcode-analysis batch-clone repos.txt ./workspace
|
|
217
219
|
|
|
@@ -8,7 +8,7 @@ from vcode_mcp.prompt_handler import PROMPTS
|
|
|
8
8
|
from vcode_mcp.resource_handler import read_metrics_summary, read_report, read_rule
|
|
9
9
|
from vcode_mcp.tool_handler import handle_tool
|
|
10
10
|
|
|
11
|
-
mcp = MCPServer("vcode-analysis", version="0.10.
|
|
11
|
+
mcp = MCPServer("vcode-analysis", version="0.10.1")
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
# ── Tools ────────────────────────────────────────────────────────
|
|
@@ -61,7 +61,7 @@ def _run_review(target: str, config, args: dict) -> list[dict]:
|
|
|
61
61
|
reviewer.metrics_store = ms
|
|
62
62
|
reviewer._current_run_id = ms.record_scan_run(ScanRun(
|
|
63
63
|
repo_path=str(Path(target).resolve()), analyzer="code_review",
|
|
64
|
-
tool_version="0.10.
|
|
64
|
+
tool_version="0.10.1",
|
|
65
65
|
))
|
|
66
66
|
|
|
67
67
|
path = Path(target)
|
|
@@ -99,7 +99,7 @@ def _run_security(target: str, config, args: dict) -> list[dict]:
|
|
|
99
99
|
scanner.metrics_store = ms
|
|
100
100
|
scanner._current_run_id = ms.record_scan_run(ScanRun(
|
|
101
101
|
repo_path=str(Path(target).resolve()), analyzer="security",
|
|
102
|
-
tool_version="0.10.
|
|
102
|
+
tool_version="0.10.1",
|
|
103
103
|
))
|
|
104
104
|
|
|
105
105
|
path = Path(target)
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"""JSON 解析工具函数
|
|
2
|
-
|
|
3
|
-
处理 LLM 生成的 JSON 中常见的格式问题。
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import re
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def remove_trailing_commas(json_str: str) -> str:
|
|
10
|
-
"""移除 JSON 字符串中的尾随逗号,使其兼容 Python json.loads()。
|
|
11
|
-
|
|
12
|
-
LLM 生成的 JSON 常包含尾随逗号(如 {"a":1,}),Python 标准库不支持。
|
|
13
|
-
仅移除 ,} 和 ,] 模式中的多余逗号,不影响字符串内的逗号。
|
|
14
|
-
"""
|
|
15
|
-
return re.sub(r',\s*([}\]])', r'\1', json_str)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def parse_llm_json(content: str) -> dict:
|
|
19
|
-
"""解析 LLM 返回的 JSON 内容,自动处理常见格式问题。
|
|
20
|
-
|
|
21
|
-
处理步骤:
|
|
22
|
-
1. 移除 markdown 代码块包裹
|
|
23
|
-
2. 移除思考过程标签
|
|
24
|
-
3. 移除尾随逗号
|
|
25
|
-
4. 解析 JSON
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
content: LLM 返回的原始文本
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
解析后的字典
|
|
32
|
-
|
|
33
|
-
Raises:
|
|
34
|
-
json.JSONDecodeError: JSON 格式无法修复时抛出
|
|
35
|
-
"""
|
|
36
|
-
import json
|
|
37
|
-
|
|
38
|
-
text = content.strip()
|
|
39
|
-
|
|
40
|
-
# 移除思考过程
|
|
41
|
-
thinking_patterns = [
|
|
42
|
-
r'Thinking Process:[\s\S]*?(?=\{)',
|
|
43
|
-
r'<think>[\s\S]*?</think>',
|
|
44
|
-
r'\[THOUGHT\][\s\S]*?\[/THOUGHT\]',
|
|
45
|
-
]
|
|
46
|
-
for pattern in thinking_patterns:
|
|
47
|
-
match = re.search(pattern, text)
|
|
48
|
-
if match:
|
|
49
|
-
text = text[match.end():].strip()
|
|
50
|
-
break
|
|
51
|
-
|
|
52
|
-
# 提取 JSON
|
|
53
|
-
if "```json" in text:
|
|
54
|
-
text = text.split("```json")[1].split("```")[0].strip()
|
|
55
|
-
elif "```" in text:
|
|
56
|
-
parts = text.split("```")
|
|
57
|
-
if len(parts) >= 2:
|
|
58
|
-
text = parts[1].strip()
|
|
59
|
-
else:
|
|
60
|
-
json_match = re.search(r'\{[\s\S]*\}', text)
|
|
61
|
-
if json_match:
|
|
62
|
-
text = json_match.group(0)
|
|
63
|
-
|
|
64
|
-
# 移除尾随逗号后解析
|
|
65
|
-
return json.loads(remove_trailing_commas(text))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/docs/design/expert-review-response-2026-07.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vcode_analysis-0.10.0 → vcode_analysis-0.10.1}/vcode_analysis.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|