git-contribution-analyzer 0.8.0__py3-none-any.whl
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.
- git_contribution_analyzer/__init__.py +3 -0
- git_contribution_analyzer/adapters/__init__.py +1 -0
- git_contribution_analyzer/adapters/git/__init__.py +1 -0
- git_contribution_analyzer/adapters/git/local_identity.py +51 -0
- git_contribution_analyzer/adapters/git/native_git.py +353 -0
- git_contribution_analyzer/adapters/git/pydriller_history.py +57 -0
- git_contribution_analyzer/adapters/git/repository_discovery.py +75 -0
- git_contribution_analyzer/adapters/gui/__init__.py +1 -0
- git_contribution_analyzer/adapters/gui/app.py +63 -0
- git_contribution_analyzer/adapters/gui/controller.py +1084 -0
- git_contribution_analyzer/adapters/gui/models/__init__.py +3 -0
- git_contribution_analyzer/adapters/gui/models/base_table.py +108 -0
- git_contribution_analyzer/adapters/gui/settings.py +53 -0
- git_contribution_analyzer/adapters/gui/task_runner.py +196 -0
- git_contribution_analyzer/adapters/llm/__init__.py +1 -0
- git_contribution_analyzer/adapters/llm/anthropic.py +52 -0
- git_contribution_analyzer/adapters/llm/base.py +142 -0
- git_contribution_analyzer/adapters/llm/cache.py +148 -0
- git_contribution_analyzer/adapters/llm/claude_cli.py +52 -0
- git_contribution_analyzer/adapters/llm/codex_cli.py +52 -0
- git_contribution_analyzer/adapters/llm/command_base.py +153 -0
- git_contribution_analyzer/adapters/llm/mock.py +82 -0
- git_contribution_analyzer/adapters/llm/ollama.py +53 -0
- git_contribution_analyzer/adapters/llm/openai_compatible.py +61 -0
- git_contribution_analyzer/adapters/llm/registry.py +117 -0
- git_contribution_analyzer/adapters/mcp/__init__.py +13 -0
- git_contribution_analyzer/adapters/mcp/installer.py +175 -0
- git_contribution_analyzer/adapters/mcp/prompts_resources.py +218 -0
- git_contribution_analyzer/adapters/mcp/protocol.py +361 -0
- git_contribution_analyzer/adapters/mcp/server.py +52 -0
- git_contribution_analyzer/adapters/mcp/tools.py +621 -0
- git_contribution_analyzer/adapters/outcomes/__init__.py +1 -0
- git_contribution_analyzer/adapters/outcomes/yaml_loader.py +55 -0
- git_contribution_analyzer/adapters/outcomes/yaml_store.py +104 -0
- git_contribution_analyzer/adapters/reporting/__init__.py +1 -0
- git_contribution_analyzer/adapters/reporting/brag_markdown.py +115 -0
- git_contribution_analyzer/adapters/reporting/html_report.py +1413 -0
- git_contribution_analyzer/adapters/reporting/markdown.py +217 -0
- git_contribution_analyzer/adapters/reporting/portfolio_markdown.py +167 -0
- git_contribution_analyzer/adapters/reporting/recap_markdown.py +212 -0
- git_contribution_analyzer/adapters/reporting/resume_markdown.py +37 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_csv.py +117 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_markdown.py +90 -0
- git_contribution_analyzer/adapters/reporting/work_assessment_series_markdown.py +31 -0
- git_contribution_analyzer/adapters/storage/__init__.py +1 -0
- git_contribution_analyzer/adapters/storage/sqlite/__init__.py +1 -0
- git_contribution_analyzer/adapters/storage/sqlite/analysis.py +708 -0
- git_contribution_analyzer/adapters/storage/sqlite/database.py +98 -0
- git_contribution_analyzer/adapters/storage/sqlite/git_index.py +482 -0
- git_contribution_analyzer/adapters/storage/sqlite/identity_merge.py +373 -0
- git_contribution_analyzer/adapters/storage/sqlite/llm_audit.py +109 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/env.py +34 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/script.py.mako +22 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0001_initial.py +51 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0002_git_index.py +146 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0003_analysis.py +79 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0004_llm_audit.py +69 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0005_run_types.py +42 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0006_identity_merges.py +83 -0
- git_contribution_analyzer/adapters/storage/sqlite/migrations/versions/0007_structural_baselines.py +173 -0
- git_contribution_analyzer/adapters/storage/sqlite/models.py +354 -0
- git_contribution_analyzer/adapters/storage/sqlite/structural_baseline.py +841 -0
- git_contribution_analyzer/adapters/workspace/__init__.py +1 -0
- git_contribution_analyzer/adapters/workspace/config.py +135 -0
- git_contribution_analyzer/adapters/workspace/git_exclude.py +32 -0
- git_contribution_analyzer/adapters/workspace/layout.py +40 -0
- git_contribution_analyzer/adapters/workspace/locks.py +27 -0
- git_contribution_analyzer/adapters/workspace/portfolio_workspace.py +380 -0
- git_contribution_analyzer/adapters/workspace/ranking_config.py +17 -0
- git_contribution_analyzer/application/__init__.py +1 -0
- git_contribution_analyzer/application/dto/__init__.py +19 -0
- git_contribution_analyzer/application/dto/gui.py +86 -0
- git_contribution_analyzer/application/dto/results.py +21 -0
- git_contribution_analyzer/application/facades/__init__.py +3 -0
- git_contribution_analyzer/application/facades/gui.py +568 -0
- git_contribution_analyzer/application/ports/__init__.py +22 -0
- git_contribution_analyzer/application/ports/cancellation.py +50 -0
- git_contribution_analyzer/application/ports/git_history.py +22 -0
- git_contribution_analyzer/application/ports/llm.py +44 -0
- git_contribution_analyzer/application/ports/portfolio_store.py +34 -0
- git_contribution_analyzer/application/ports/progress.py +43 -0
- git_contribution_analyzer/application/ports/structural_baseline.py +93 -0
- git_contribution_analyzer/application/services/__init__.py +1 -0
- git_contribution_analyzer/application/services/assessment_explanation.py +127 -0
- git_contribution_analyzer/application/services/default_person.py +61 -0
- git_contribution_analyzer/application/services/evidence_snapshot.py +64 -0
- git_contribution_analyzer/application/services/person_selection.py +88 -0
- git_contribution_analyzer/application/services/resume_generation.py +318 -0
- git_contribution_analyzer/application/services/semantic_enhancement.py +157 -0
- git_contribution_analyzer/application/services/time_boundaries.py +49 -0
- git_contribution_analyzer/application/use_cases/__init__.py +1 -0
- git_contribution_analyzer/application/use_cases/analyze_contributions.py +276 -0
- git_contribution_analyzer/application/use_cases/analyze_project.py +295 -0
- git_contribution_analyzer/application/use_cases/assess_portfolio.py +327 -0
- git_contribution_analyzer/application/use_cases/assess_work.py +602 -0
- git_contribution_analyzer/application/use_cases/assess_work_series.py +212 -0
- git_contribution_analyzer/application/use_cases/compare_assessment_runs.py +121 -0
- git_contribution_analyzer/application/use_cases/export_report.py +49 -0
- git_contribution_analyzer/application/use_cases/generate_brag.py +308 -0
- git_contribution_analyzer/application/use_cases/generate_portfolio_recap.py +244 -0
- git_contribution_analyzer/application/use_cases/generate_portfolio_resume.py +152 -0
- git_contribution_analyzer/application/use_cases/generate_recap.py +316 -0
- git_contribution_analyzer/application/use_cases/generate_report.py +32 -0
- git_contribution_analyzer/application/use_cases/generate_resume.py +209 -0
- git_contribution_analyzer/application/use_cases/get_portfolio_status.py +83 -0
- git_contribution_analyzer/application/use_cases/get_run.py +16 -0
- git_contribution_analyzer/application/use_cases/get_status.py +69 -0
- git_contribution_analyzer/application/use_cases/index_repository.py +267 -0
- git_contribution_analyzer/application/use_cases/init_portfolio.py +89 -0
- git_contribution_analyzer/application/use_cases/init_project.py +71 -0
- git_contribution_analyzer/application/use_cases/list_identities.py +16 -0
- git_contribution_analyzer/application/use_cases/list_providers.py +29 -0
- git_contribution_analyzer/application/use_cases/list_runs.py +17 -0
- git_contribution_analyzer/application/use_cases/manage_identity_merges.py +48 -0
- git_contribution_analyzer/application/use_cases/manage_outcomes.py +189 -0
- git_contribution_analyzer/application/use_cases/manage_structural_baselines.py +262 -0
- git_contribution_analyzer/application/use_cases/map_identity.py +28 -0
- git_contribution_analyzer/application/use_cases/recover_runs.py +22 -0
- git_contribution_analyzer/application/use_cases/run_doctor.py +81 -0
- git_contribution_analyzer/application/use_cases/sync_portfolio.py +232 -0
- git_contribution_analyzer/application/use_cases/test_provider.py +22 -0
- git_contribution_analyzer/application/use_cases/uninit_project.py +23 -0
- git_contribution_analyzer/application/use_cases/verify_portfolio.py +165 -0
- git_contribution_analyzer/cli/__init__.py +1 -0
- git_contribution_analyzer/cli/app.py +1430 -0
- git_contribution_analyzer/cli/exit_codes.py +13 -0
- git_contribution_analyzer/cli/output.py +26 -0
- git_contribution_analyzer/cli/portfolio_commands.py +629 -0
- git_contribution_analyzer/domain/__init__.py +1 -0
- git_contribution_analyzer/domain/errors.py +55 -0
- git_contribution_analyzer/domain/models/__init__.py +3 -0
- git_contribution_analyzer/domain/models/analysis.py +29 -0
- git_contribution_analyzer/domain/models/assessment.py +12 -0
- git_contribution_analyzer/domain/models/brag.py +148 -0
- git_contribution_analyzer/domain/models/contribution.py +55 -0
- git_contribution_analyzer/domain/models/git_history.py +69 -0
- git_contribution_analyzer/domain/models/person_selection.py +46 -0
- git_contribution_analyzer/domain/models/portfolio.py +498 -0
- git_contribution_analyzer/domain/models/ranking.py +48 -0
- git_contribution_analyzer/domain/models/recap.py +235 -0
- git_contribution_analyzer/domain/models/repository.py +10 -0
- git_contribution_analyzer/domain/models/resume.py +59 -0
- git_contribution_analyzer/domain/models/run.py +10 -0
- git_contribution_analyzer/domain/models/semantic.py +34 -0
- git_contribution_analyzer/domain/models/snapshot.py +208 -0
- git_contribution_analyzer/domain/models/structural_baseline.py +120 -0
- git_contribution_analyzer/domain/models/work_assessment.py +81 -0
- git_contribution_analyzer/domain/services/assessment_periods.py +182 -0
- git_contribution_analyzer/domain/services/brag_rules.py +250 -0
- git_contribution_analyzer/domain/services/capability_rules.py +91 -0
- git_contribution_analyzer/domain/services/contribution_clustering.py +98 -0
- git_contribution_analyzer/domain/services/contribution_rules.py +79 -0
- git_contribution_analyzer/domain/services/difficulty_rules.py +191 -0
- git_contribution_analyzer/domain/services/dimensional_summary.py +117 -0
- git_contribution_analyzer/domain/services/portfolio_aggregation.py +250 -0
- git_contribution_analyzer/domain/services/portfolio_resume_rules.py +265 -0
- git_contribution_analyzer/domain/services/portfolio_verifier.py +238 -0
- git_contribution_analyzer/domain/services/ranking_rules.py +226 -0
- git_contribution_analyzer/domain/services/recap_rules.py +268 -0
- git_contribution_analyzer/domain/services/resume_claim_rules.py +70 -0
- git_contribution_analyzer/domain/services/structural_baseline.py +317 -0
- git_contribution_analyzer/domain/services/structural_signals.py +151 -0
- git_contribution_analyzer/domain/services/workload_rules.py +185 -0
- git_contribution_analyzer/gui/__init__.py +1 -0
- git_contribution_analyzer/gui/qml/Main.qml +1141 -0
- git_contribution_analyzer/gui/qml/__init__.py +1 -0
- git_contribution_analyzer/prompts/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/assessment/v1/explanation.txt +4 -0
- git_contribution_analyzer/prompts/resume/__init__.py +1 -0
- git_contribution_analyzer/prompts/resume/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-concise.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-star.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/style-xyz.txt +1 -0
- git_contribution_analyzer/prompts/resume/v1/system.txt +3 -0
- git_contribution_analyzer/prompts/v1/__init__.py +1 -0
- git_contribution_analyzer/prompts/v1/capability_explanation.txt +2 -0
- git_contribution_analyzer/prompts/v1/contribution_summary.txt +2 -0
- git_contribution_analyzer/prompts/v1/overall_summary.txt +2 -0
- git_contribution_analyzer/prompts/v1/resume_bullet.txt +2 -0
- git_contribution_analyzer-0.8.0.dist-info/METADATA +667 -0
- git_contribution_analyzer-0.8.0.dist-info/RECORD +187 -0
- git_contribution_analyzer-0.8.0.dist-info/WHEEL +4 -0
- git_contribution_analyzer-0.8.0.dist-info/entry_points.txt +3 -0
- git_contribution_analyzer-0.8.0.dist-info/licenses/LICENSE +201 -0
- git_contribution_analyzer-0.8.0.dist-info/licenses/NOTICE +6 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from git_contribution_analyzer.adapters.reporting.resume_markdown import render_resume_markdown
|
|
6
|
+
from git_contribution_analyzer.adapters.reporting.work_assessment_markdown import (
|
|
7
|
+
render_work_assessment_markdown,
|
|
8
|
+
)
|
|
9
|
+
from git_contribution_analyzer.adapters.reporting.work_assessment_series_markdown import (
|
|
10
|
+
render_work_assessment_series_markdown,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def render_markdown(report: dict[str, Any]) -> str:
|
|
15
|
+
if report.get("reportType") == "WORK_ASSESSMENT":
|
|
16
|
+
return render_work_assessment_markdown(report)
|
|
17
|
+
if report.get("reportType") == "WORK_ASSESSMENT_SERIES":
|
|
18
|
+
return render_work_assessment_series_markdown(report)
|
|
19
|
+
if report.get("reportType") == "RESUME":
|
|
20
|
+
return render_resume_markdown(report)
|
|
21
|
+
if report.get("reportType") == "PROJECT":
|
|
22
|
+
return _render_project_markdown(report)
|
|
23
|
+
return _render_person_markdown(report)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _render_person_markdown(report: dict[str, Any]) -> str:
|
|
27
|
+
person = report["person"]
|
|
28
|
+
summary = report["summary"]
|
|
29
|
+
lines = [
|
|
30
|
+
f"# Contribution Report: {person['name']}",
|
|
31
|
+
"",
|
|
32
|
+
f"- Email: `{person['email']}`",
|
|
33
|
+
f"- Commits: {summary['commits']}",
|
|
34
|
+
f"- Files changed: {summary['filesChanged']}",
|
|
35
|
+
f"- Insertions / deletions: {summary['insertions']} / {summary['deletions']}",
|
|
36
|
+
"",
|
|
37
|
+
"## Technical Summary",
|
|
38
|
+
"",
|
|
39
|
+
report["technicalSummary"]["headline"],
|
|
40
|
+
"",
|
|
41
|
+
]
|
|
42
|
+
for highlight in report["technicalSummary"]["highlights"]:
|
|
43
|
+
lines.append(
|
|
44
|
+
f"- {highlight['text']} [Evidence: {', '.join(highlight['evidenceIds'])}]"
|
|
45
|
+
)
|
|
46
|
+
_append_structural_signals(lines, report.get("structuralSignals"))
|
|
47
|
+
lines.extend(
|
|
48
|
+
[
|
|
49
|
+
"",
|
|
50
|
+
"## Business Summary",
|
|
51
|
+
"",
|
|
52
|
+
report["businessSummary"]["headline"],
|
|
53
|
+
"",
|
|
54
|
+
]
|
|
55
|
+
)
|
|
56
|
+
for highlight in report["businessSummary"]["highlights"]:
|
|
57
|
+
lines.append(
|
|
58
|
+
f"- {highlight['text']} [Evidence: {', '.join(highlight['evidenceIds'])}]"
|
|
59
|
+
)
|
|
60
|
+
lines.extend(
|
|
61
|
+
[
|
|
62
|
+
"",
|
|
63
|
+
"## Contribution Items",
|
|
64
|
+
"",
|
|
65
|
+
]
|
|
66
|
+
)
|
|
67
|
+
for item in report["contributionItems"]:
|
|
68
|
+
lines.extend(
|
|
69
|
+
[
|
|
70
|
+
f"### {item['id']} - {item['title']}",
|
|
71
|
+
"",
|
|
72
|
+
f"Confidence: **{item['confidence']}**",
|
|
73
|
+
"",
|
|
74
|
+
f"Commits: {', '.join(f'`{value[:12]}`' for value in item['commitHashes'])}",
|
|
75
|
+
"",
|
|
76
|
+
f"Evidence: {', '.join(item['evidenceIds'])}",
|
|
77
|
+
"",
|
|
78
|
+
]
|
|
79
|
+
)
|
|
80
|
+
lines.extend(["## Capabilities", ""])
|
|
81
|
+
for capability in report["capabilities"]:
|
|
82
|
+
lines.extend(
|
|
83
|
+
[
|
|
84
|
+
f"- **{capability['capability']}** ({capability['confidence']}): "
|
|
85
|
+
f"{capability['rationale']} [Evidence: {', '.join(capability['evidenceIds'])}]",
|
|
86
|
+
]
|
|
87
|
+
)
|
|
88
|
+
semantic = report.get("semantic")
|
|
89
|
+
if semantic:
|
|
90
|
+
lines.extend(["", "## Semantic Summary", ""])
|
|
91
|
+
for claim in semantic["overallSummary"]:
|
|
92
|
+
lines.append(
|
|
93
|
+
f"- {claim['text']} [Evidence: {', '.join(claim['evidenceIds'])}]"
|
|
94
|
+
)
|
|
95
|
+
if semantic["resumeBullets"]:
|
|
96
|
+
lines.extend(["", "## Resume Candidates", ""])
|
|
97
|
+
for claim in semantic["resumeBullets"]:
|
|
98
|
+
lines.append(
|
|
99
|
+
f"- {claim['text']} [Evidence: {', '.join(claim['evidenceIds'])}]"
|
|
100
|
+
)
|
|
101
|
+
lines.extend(["", "## Evidence Index", ""])
|
|
102
|
+
for entry in report["evidence"]:
|
|
103
|
+
lines.append(f"- **{entry['id']}**: {entry['summary']}")
|
|
104
|
+
lines.extend(["", "## Limitations", ""])
|
|
105
|
+
for limitation in report["limitations"]:
|
|
106
|
+
lines.append(f"- {limitation}")
|
|
107
|
+
return "\n".join(lines) + "\n"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _render_project_markdown(report: dict[str, Any]) -> str:
|
|
111
|
+
summary = report["summary"]
|
|
112
|
+
technical = report["technicalSummary"]
|
|
113
|
+
business = report["businessSummary"]
|
|
114
|
+
lines = [
|
|
115
|
+
"# Project Contribution Report",
|
|
116
|
+
"",
|
|
117
|
+
f"- Repository: `{report['repository']}`",
|
|
118
|
+
f"- Git people: {summary['people']}",
|
|
119
|
+
f"- Confirmed / unconfirmed: "
|
|
120
|
+
f"{summary['confirmedPeople']} / {summary['unconfirmedPeople']}",
|
|
121
|
+
f"- Commits: {summary['commits']}",
|
|
122
|
+
f"- Files changed: {summary['filesChanged']}",
|
|
123
|
+
f"- Insertions / deletions: "
|
|
124
|
+
f"{summary['insertions']} / {summary['deletions']}",
|
|
125
|
+
"",
|
|
126
|
+
"## Technical Summary",
|
|
127
|
+
"",
|
|
128
|
+
technical["headline"],
|
|
129
|
+
"",
|
|
130
|
+
]
|
|
131
|
+
for module in technical["dominantModules"]:
|
|
132
|
+
lines.append(f"- Module `{module['name']}`: {module['commits']} commits")
|
|
133
|
+
if technical["capabilities"]:
|
|
134
|
+
lines.extend(["", "### Capability Signals", ""])
|
|
135
|
+
for capability in technical["capabilities"]:
|
|
136
|
+
lines.append(
|
|
137
|
+
f"- {capability['capability']}: {capability['people']} people "
|
|
138
|
+
f"[Evidence: {_format_refs(capability['evidenceRefs'])}]"
|
|
139
|
+
)
|
|
140
|
+
_append_structural_signals(lines, report.get("structuralSignals"))
|
|
141
|
+
lines.extend(["", "## Business Summary", "", business["headline"], ""])
|
|
142
|
+
for domain in business["domains"][:30]:
|
|
143
|
+
lines.append(
|
|
144
|
+
f"- `{domain['name']}`: {domain['commits']} commits, "
|
|
145
|
+
f"{domain['people']} people "
|
|
146
|
+
f"[Evidence: {_format_refs(domain['evidenceRefs'])}]"
|
|
147
|
+
)
|
|
148
|
+
if len(business["domains"]) > 30:
|
|
149
|
+
lines.append(
|
|
150
|
+
f"- Showing 30 of {len(business['domains'])} domains; "
|
|
151
|
+
"the JSON report contains the complete list."
|
|
152
|
+
)
|
|
153
|
+
lines.extend(["", "## Contributors", ""])
|
|
154
|
+
for person_report in report["people"]:
|
|
155
|
+
person = person_report["person"]
|
|
156
|
+
marker = "confirmed" if person["confirmed"] else "unconfirmed"
|
|
157
|
+
domains = ", ".join(
|
|
158
|
+
f"`{entry['name']}`"
|
|
159
|
+
for entry in person_report["businessSummary"]["domains"][:5]
|
|
160
|
+
)
|
|
161
|
+
lines.extend(
|
|
162
|
+
[
|
|
163
|
+
f"### {person['name']} <{person['email']}>",
|
|
164
|
+
"",
|
|
165
|
+
f"- Identity: {marker}",
|
|
166
|
+
f"- Commits: {person_report['summary']['commits']}",
|
|
167
|
+
f"- Technical: {person_report['technicalSummary']['headline']}",
|
|
168
|
+
f"- Business: {person_report['businessSummary']['headline']}",
|
|
169
|
+
f"- Domains: {domains or 'none identified'}",
|
|
170
|
+
"",
|
|
171
|
+
]
|
|
172
|
+
)
|
|
173
|
+
if report["identityWarnings"]:
|
|
174
|
+
lines.extend(["## Identity Warnings", ""])
|
|
175
|
+
lines.extend(f"- {warning}" for warning in report["identityWarnings"])
|
|
176
|
+
lines.append("")
|
|
177
|
+
lines.extend(["## Limitations", ""])
|
|
178
|
+
lines.extend(f"- {limitation}" for limitation in report["limitations"])
|
|
179
|
+
lines.extend(f"- {limitation}" for limitation in business["limitations"])
|
|
180
|
+
return "\n".join(lines) + "\n"
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _format_refs(values: list[str], limit: int = 5) -> str:
|
|
184
|
+
visible = values[:limit]
|
|
185
|
+
remaining = len(values) - len(visible)
|
|
186
|
+
suffix = f", ... (+{remaining} more)" if remaining else ""
|
|
187
|
+
return f"{', '.join(visible)}{suffix}"
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _append_structural_signals(
|
|
191
|
+
lines: list[str], structural: dict[str, Any] | None
|
|
192
|
+
) -> None:
|
|
193
|
+
if structural is None:
|
|
194
|
+
return
|
|
195
|
+
summary = structural["summary"]
|
|
196
|
+
lines.extend(
|
|
197
|
+
[
|
|
198
|
+
"",
|
|
199
|
+
"## Structural Signals",
|
|
200
|
+
"",
|
|
201
|
+
f"- Analyzed commits / files: "
|
|
202
|
+
f"{summary['analyzedCommits']} / {summary['analyzedFiles']}",
|
|
203
|
+
f"- Repeated coupled pairs: {summary['coupledPairs']}",
|
|
204
|
+
f"- Structural hotspots: {summary['hotspots']}",
|
|
205
|
+
]
|
|
206
|
+
)
|
|
207
|
+
for coupling in structural["couplings"][:10]:
|
|
208
|
+
lines.append(
|
|
209
|
+
f"- Coupling `{coupling['leftPath']}` <-> `{coupling['rightPath']}`: "
|
|
210
|
+
f"{coupling['coChangeCommits']} commits ({coupling['confidence']})"
|
|
211
|
+
)
|
|
212
|
+
for hotspot in structural["hotspots"][:10]:
|
|
213
|
+
lines.append(
|
|
214
|
+
f"- Hotspot `{hotspot['path']}`: score {hotspot['score']}, "
|
|
215
|
+
f"{hotspot['changeCommits']} change commits, "
|
|
216
|
+
f"{hotspot['coupledFiles']} coupled files"
|
|
217
|
+
)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def render_portfolio_summary_markdown(report: dict[str, Any]) -> str:
|
|
7
|
+
"""将 `portfolio-summary/v1` 渲染为可读 Markdown 汇总报告."""
|
|
8
|
+
identity = report["identity"]
|
|
9
|
+
scope = report["scope"]
|
|
10
|
+
totals = report["totals"]
|
|
11
|
+
difficulty = totals["difficulty"]
|
|
12
|
+
structural = report["structuralObservation"]
|
|
13
|
+
|
|
14
|
+
lines = [
|
|
15
|
+
f"# Portfolio Contribution Summary: {report['portfolioName']}",
|
|
16
|
+
"",
|
|
17
|
+
"## Overview",
|
|
18
|
+
"",
|
|
19
|
+
f"- Canonical person: `{identity['canonicalName']}`",
|
|
20
|
+
f"- GCA version / mode: `{report['gcaVersion']}` / `{report['mode']}`",
|
|
21
|
+
f"- Snapshot ID: `{report['portfolioSnapshotId']}`",
|
|
22
|
+
f"- Repositories: {scope['discoveredRepositories']} discovered, "
|
|
23
|
+
f"{scope['matchedRepositories']} matched, {scope['failedRepositories']} failed",
|
|
24
|
+
f"- Evidence span: {scope['firstAuthoredAt'] or 'N/A'} .. "
|
|
25
|
+
f"{scope['lastAuthoredAt'] or 'N/A'}",
|
|
26
|
+
"",
|
|
27
|
+
"## Totals",
|
|
28
|
+
"",
|
|
29
|
+
f"- Commits: {totals['commits']} (delivered: {totals['deliveredCommits']}, "
|
|
30
|
+
f"landed: {totals['landedCommits']}, released: {totals['releasedCommits']}, "
|
|
31
|
+
f"authored-only: {totals['authoredOnlyCommits']}, merge: {totals['mergeCommits']})",
|
|
32
|
+
f"- File changes: {totals['fileChangeRecords']} records "
|
|
33
|
+
f"(+{totals['insertions']} / -{totals['deletions']})",
|
|
34
|
+
f"- Work items: {totals['completedItems']} completed, {totals['pendingItems']} pending, "
|
|
35
|
+
f"{totals['reworkItems']} rework, {totals['integrationItems']} integration",
|
|
36
|
+
f"- Difficulty distribution: HIGH_RISK={difficulty['HIGH_RISK']}, "
|
|
37
|
+
f"STANDARD={difficulty['STANDARD']}, ROUTINE={difficulty['ROUTINE']}, "
|
|
38
|
+
f"COMPLEX={difficulty['COMPLEX']}",
|
|
39
|
+
f"- Structural observation (non-scoring): "
|
|
40
|
+
f"{structural['hotspotSignalRepositories']} hotspot repos, "
|
|
41
|
+
f"{structural['couplingSignalRepositories']} coupling repos, "
|
|
42
|
+
f"{structural['historicalBaselineBuilds']} historical baselines",
|
|
43
|
+
"",
|
|
44
|
+
"## Groups",
|
|
45
|
+
"",
|
|
46
|
+
"| Group | Repos | Commits | Delivered | Authored-Only | Completed | Pending | High Risk |",
|
|
47
|
+
"|---|---:|---:|---:|---:|---:|---:|---:|",
|
|
48
|
+
]
|
|
49
|
+
for group in report["groups"]:
|
|
50
|
+
lines.append(
|
|
51
|
+
f"| {group['name']} | {group['repositories']} | {group['commits']} | "
|
|
52
|
+
f"{group['deliveredCommits']} | {group['authoredOnlyCommits']} | "
|
|
53
|
+
f"{group['completedItems']} | {group['pendingItems']} | {group['highRiskItems']} |"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
lines.extend(
|
|
57
|
+
[
|
|
58
|
+
"",
|
|
59
|
+
"## Repositories",
|
|
60
|
+
"",
|
|
61
|
+
"| Repo Key | Group | Branch | Commits | Delivered | Authored-Only | "
|
|
62
|
+
"Completed | Pending |",
|
|
63
|
+
"|---|---|---|---:|---:|---:|---:|---:|",
|
|
64
|
+
]
|
|
65
|
+
)
|
|
66
|
+
for repo in report["repositories"]:
|
|
67
|
+
lines.append(
|
|
68
|
+
f"| {repo['repoKey']} | {repo['group']} | {repo['branch']} | {repo['commits']} | "
|
|
69
|
+
f"{repo['delivered']} | {repo['authoredOnly']} | {repo['completedItems']} | "
|
|
70
|
+
f"{repo['pendingItems']} |"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
capabilities = report.get("highConfidenceCapabilities", [])
|
|
74
|
+
if capabilities:
|
|
75
|
+
lines.extend(["", "## High-Confidence Capabilities", ""])
|
|
76
|
+
for item in capabilities:
|
|
77
|
+
lines.append(f"- `{item['capability']}`: {item['repositories']} repositories")
|
|
78
|
+
|
|
79
|
+
if report.get("warnings"):
|
|
80
|
+
lines.extend(["", "## Warnings", ""])
|
|
81
|
+
lines.extend(f"- {warning}" for warning in report["warnings"])
|
|
82
|
+
|
|
83
|
+
lines.extend(["", "## Limitations", ""])
|
|
84
|
+
lines.extend(f"- {limitation}" for limitation in report["limitations"])
|
|
85
|
+
return "\n".join(lines) + "\n"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def render_portfolio_resume_markdown(report: dict[str, Any]) -> str:
|
|
89
|
+
"""将 `portfolio-resume/v1` 渲染为带 `<repoKey>:EV-xxx` 引用的人类可读简历."""
|
|
90
|
+
is_zh = report.get("language") == "zh-CN"
|
|
91
|
+
title = (
|
|
92
|
+
f"# {report['person']['name']} 跨项目简历草稿"
|
|
93
|
+
if is_zh
|
|
94
|
+
else f"# Cross-Project Resume Draft: {report['person']['name']}"
|
|
95
|
+
)
|
|
96
|
+
role_heading = "## 求职方向" if is_zh else "## Target Role"
|
|
97
|
+
summary_heading = "## 专业概述" if is_zh else "## Professional Summary"
|
|
98
|
+
projects_heading = "## 项目经历" if is_zh else "## Project Experience"
|
|
99
|
+
skills_heading = "## 代表性能力" if is_zh else "## Representative Capabilities"
|
|
100
|
+
pending_heading = "## 待本人补充" if is_zh else "## Pending Self-Inputs"
|
|
101
|
+
omitted_heading = "## 已省略声明" if is_zh else "## Omitted Claims"
|
|
102
|
+
limits_heading = "## 证据限制" if is_zh else "## Limitations"
|
|
103
|
+
|
|
104
|
+
lines = [
|
|
105
|
+
title,
|
|
106
|
+
"",
|
|
107
|
+
role_heading,
|
|
108
|
+
"",
|
|
109
|
+
report["targetRole"] or ("未指定" if is_zh else "Not specified"),
|
|
110
|
+
"",
|
|
111
|
+
summary_heading,
|
|
112
|
+
"",
|
|
113
|
+
report["professionalSummary"],
|
|
114
|
+
"",
|
|
115
|
+
projects_heading,
|
|
116
|
+
"",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
for group in report["projectGroups"]:
|
|
120
|
+
lines.append(f"### {group['group']}")
|
|
121
|
+
lines.append("")
|
|
122
|
+
if is_zh:
|
|
123
|
+
lines.append(
|
|
124
|
+
f"覆盖 {group['repositories']} 个仓库, 共 {group['commits']} 条提交, "
|
|
125
|
+
f"其中 {group['deliveredCommits']} 条已交付。"
|
|
126
|
+
)
|
|
127
|
+
else:
|
|
128
|
+
lines.append(
|
|
129
|
+
f"Covers {group['repositories']} repositories, {group['commits']} commits "
|
|
130
|
+
f"({group['deliveredCommits']} delivered)."
|
|
131
|
+
)
|
|
132
|
+
lines.append("")
|
|
133
|
+
for bullet in group["bullets"]:
|
|
134
|
+
ev_text = "/".join(bullet["evidenceIds"]) if len(
|
|
135
|
+
{ev.split(":", 1)[0] for ev in bullet["evidenceIds"]}
|
|
136
|
+
) == 1 else ", ".join(bullet["evidenceIds"])
|
|
137
|
+
if "/" in ev_text:
|
|
138
|
+
repo_prefix = bullet["evidenceIds"][0].split(":", 1)[0]
|
|
139
|
+
ev_suffixes = "/".join(ev.split(":", 1)[1] for ev in bullet["evidenceIds"])
|
|
140
|
+
ev_display = f"{repo_prefix}:{ev_suffixes}"
|
|
141
|
+
else:
|
|
142
|
+
ev_display = ", ".join(bullet["evidenceIds"])
|
|
143
|
+
lines.append(
|
|
144
|
+
f"- {bullet['text']} ({bullet['claimStrength']}) [Evidence: {ev_display}]"
|
|
145
|
+
)
|
|
146
|
+
lines.append("")
|
|
147
|
+
|
|
148
|
+
if report.get("representativeSkills"):
|
|
149
|
+
lines.extend([skills_heading, ""])
|
|
150
|
+
for skill in report["representativeSkills"]:
|
|
151
|
+
ev_list = ", ".join(skill["evidenceIds"][:6])
|
|
152
|
+
lines.append(
|
|
153
|
+
f"- `{skill['capability']}` ({skill['repositories']} repos) [Evidence: {ev_list}]"
|
|
154
|
+
)
|
|
155
|
+
lines.append("")
|
|
156
|
+
|
|
157
|
+
if report.get("omittedClaims"):
|
|
158
|
+
lines.extend([omitted_heading, ""])
|
|
159
|
+
for omitted in report["omittedClaims"]:
|
|
160
|
+
lines.append(f"- `{omitted['candidate']}`: {omitted['reasonCode']}")
|
|
161
|
+
lines.append("")
|
|
162
|
+
|
|
163
|
+
lines.extend([pending_heading, ""])
|
|
164
|
+
lines.extend(f"- {item}" for item in report["pendingSelfInputs"])
|
|
165
|
+
lines.extend(["", limits_heading, ""])
|
|
166
|
+
lines.extend(f"- {item}" for item in report["limitations"])
|
|
167
|
+
return "\n".join(lines) + "\n"
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
_ZH_TITLES = {
|
|
6
|
+
"daily": "日报",
|
|
7
|
+
"weekly": "周度复盘",
|
|
8
|
+
"monthly": "月度复盘",
|
|
9
|
+
"quarterly": "季度复盘",
|
|
10
|
+
"custom": "周期复盘",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_EN_TITLES = {
|
|
14
|
+
"daily": "Daily Recap",
|
|
15
|
+
"weekly": "Weekly Recap",
|
|
16
|
+
"monthly": "Monthly Recap",
|
|
17
|
+
"quarterly": "Quarterly Recap",
|
|
18
|
+
"custom": "Period Recap",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _fmt_delta(value: int) -> str:
|
|
23
|
+
if value > 0:
|
|
24
|
+
return f"+{value}"
|
|
25
|
+
return str(value)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _date_label(iso_ts: str) -> str:
|
|
29
|
+
return iso_ts[:10] if len(iso_ts) >= 10 else iso_ts
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def render_recap_markdown(report: dict[str, Any], *, language: str = "zh-CN") -> str:
|
|
33
|
+
"""将 `recap/v1` 报告渲染为中英双语日报/周报/月报/季报 Markdown."""
|
|
34
|
+
is_zh = language.lower().startswith("zh")
|
|
35
|
+
window = report["window"]
|
|
36
|
+
scope = report["scope"]
|
|
37
|
+
person = report["person"]
|
|
38
|
+
totals = report["totals"]
|
|
39
|
+
prev = report["previousTotals"]
|
|
40
|
+
delta = report["delta"]
|
|
41
|
+
structural = report["structuralObservation"]
|
|
42
|
+
granularity = str(window.get("granularity", "custom"))
|
|
43
|
+
|
|
44
|
+
heading_kind = (
|
|
45
|
+
_ZH_TITLES.get(granularity, "周期复盘")
|
|
46
|
+
if is_zh
|
|
47
|
+
else _EN_TITLES.get(granularity, "Period Recap")
|
|
48
|
+
)
|
|
49
|
+
period_str = (
|
|
50
|
+
_date_label(window["since"])
|
|
51
|
+
if granularity == "daily"
|
|
52
|
+
else f"{_date_label(window['since'])} .. {_date_label(window['until'])}"
|
|
53
|
+
)
|
|
54
|
+
prev_str = (
|
|
55
|
+
_date_label(window["previousSince"])
|
|
56
|
+
if granularity == "daily"
|
|
57
|
+
else f"{_date_label(window['previousSince'])} .. {_date_label(window['previousUntil'])}"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
lines: list[str] = [
|
|
61
|
+
f"# {heading_kind} - {person['name']} ({scope['name']})",
|
|
62
|
+
"",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
if is_zh:
|
|
66
|
+
lines.extend(
|
|
67
|
+
[
|
|
68
|
+
"## 复盘范围",
|
|
69
|
+
"",
|
|
70
|
+
f"- 统计窗口: `{window['label']}` ({period_str})",
|
|
71
|
+
f"- 对照上期: {prev_str}",
|
|
72
|
+
f"- 统计范围: `{scope['mode']}` / `{scope['name']}` "
|
|
73
|
+
f"(命中仓库 {scope['matchedRepositories']}/{scope['repositories']})",
|
|
74
|
+
"",
|
|
75
|
+
"## 本期概览与上期对照",
|
|
76
|
+
"",
|
|
77
|
+
"| 指标 | 本期 | 上期 | 变化 |",
|
|
78
|
+
"|---|---:|---:|---:|",
|
|
79
|
+
f"| 总提交数 | {totals['commits']} | {prev['commits']} | "
|
|
80
|
+
f"{_fmt_delta(delta['commits'])} |",
|
|
81
|
+
f"| 已交付提交 (LANDED+RELEASED) | {totals['deliveredCommits']} | "
|
|
82
|
+
f"{prev['deliveredCommits']} | {_fmt_delta(delta['deliveredCommits'])} |",
|
|
83
|
+
f"| 未合并提交 (AUTHORED_ONLY) | {totals['authoredOnlyCommits']} | "
|
|
84
|
+
f"{prev['authoredOnlyCommits']} | "
|
|
85
|
+
f"{_fmt_delta(totals['authoredOnlyCommits'] - prev['authoredOnlyCommits'])} |",
|
|
86
|
+
f"| 已完成工作项 | {totals['completedItems']} | {prev['completedItems']} | "
|
|
87
|
+
f"{_fmt_delta(delta['completedItems'])} |",
|
|
88
|
+
f"| 待跟进工作项 | {totals['pendingItems']} | {prev['pendingItems']} | "
|
|
89
|
+
f"{_fmt_delta(delta['pendingItems'])} |",
|
|
90
|
+
"",
|
|
91
|
+
f"- 其他统计: 返工项 {totals['reworkItems']}, "
|
|
92
|
+
f"集成合并项 {totals['integrationItems']}",
|
|
93
|
+
f"- 结构信号观察 (仅观察, 不计入评分/排序): "
|
|
94
|
+
f"热点仓库 {structural['hotspotSignalRepositories']}, "
|
|
95
|
+
f"耦合仓库 {structural['couplingSignalRepositories']}",
|
|
96
|
+
]
|
|
97
|
+
)
|
|
98
|
+
else:
|
|
99
|
+
lines.extend(
|
|
100
|
+
[
|
|
101
|
+
"## Window & Scope",
|
|
102
|
+
"",
|
|
103
|
+
f"- Window: `{window['label']}` ({period_str})",
|
|
104
|
+
f"- Previous period: {prev_str}",
|
|
105
|
+
f"- Scope: `{scope['mode']}` / `{scope['name']}` "
|
|
106
|
+
f"(matched repositories {scope['matchedRepositories']}/{scope['repositories']})",
|
|
107
|
+
"",
|
|
108
|
+
"## Overview & Period Delta",
|
|
109
|
+
"",
|
|
110
|
+
"| Metric | Current | Previous | Delta |",
|
|
111
|
+
"|---|---:|---:|---:|",
|
|
112
|
+
f"| Total Commits | {totals['commits']} | {prev['commits']} | "
|
|
113
|
+
f"{_fmt_delta(delta['commits'])} |",
|
|
114
|
+
f"| Delivered Commits (LANDED+RELEASED) | {totals['deliveredCommits']} | "
|
|
115
|
+
f"{prev['deliveredCommits']} | {_fmt_delta(delta['deliveredCommits'])} |",
|
|
116
|
+
f"| Authored-Only Commits | {totals['authoredOnlyCommits']} | "
|
|
117
|
+
f"{prev['authoredOnlyCommits']} | "
|
|
118
|
+
f"{_fmt_delta(totals['authoredOnlyCommits'] - prev['authoredOnlyCommits'])} |",
|
|
119
|
+
f"| Completed Items | {totals['completedItems']} | {prev['completedItems']} | "
|
|
120
|
+
f"{_fmt_delta(delta['completedItems'])} |",
|
|
121
|
+
f"| Pending Items | {totals['pendingItems']} | {prev['pendingItems']} | "
|
|
122
|
+
f"{_fmt_delta(delta['pendingItems'])} |",
|
|
123
|
+
"",
|
|
124
|
+
f"- Additional counts: rework items {totals['reworkItems']}, "
|
|
125
|
+
f"integration items {totals['integrationItems']}",
|
|
126
|
+
f"- Structural observation (non-scoring): "
|
|
127
|
+
f"{structural['hotspotSignalRepositories']} hotspot repos, "
|
|
128
|
+
f"{structural['couplingSignalRepositories']} coupling repos",
|
|
129
|
+
]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
highlights = report.get("deliveredHighlights", [])
|
|
133
|
+
lines.extend(["", "## 已交付亮点" if is_zh else "## Delivered Highlights", ""])
|
|
134
|
+
if highlights:
|
|
135
|
+
for item in highlights:
|
|
136
|
+
ev_text = ", ".join(f"`{ev}`" for ev in item["evidenceIds"])
|
|
137
|
+
tags: list[str] = [item["repoKey"]]
|
|
138
|
+
if item.get("difficulty"):
|
|
139
|
+
tags.append(str(item["difficulty"]))
|
|
140
|
+
if item.get("size"):
|
|
141
|
+
tags.append(str(item["size"]))
|
|
142
|
+
tag_str = " / ".join(tags)
|
|
143
|
+
if is_zh:
|
|
144
|
+
lines.append(
|
|
145
|
+
f"- [{tag_str}] {item['title']} "
|
|
146
|
+
f"({item['commits']} commits; 证据: {ev_text})"
|
|
147
|
+
)
|
|
148
|
+
else:
|
|
149
|
+
lines.append(
|
|
150
|
+
f"- [{tag_str}] {item['title']} "
|
|
151
|
+
f"({item['commits']} commits; evidence: {ev_text})"
|
|
152
|
+
)
|
|
153
|
+
else:
|
|
154
|
+
lines.append(
|
|
155
|
+
"- 本期暂无已合入默认分支的工作项。"
|
|
156
|
+
if is_zh
|
|
157
|
+
else "- No delivered work items in this window."
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
pending_items = report.get("pendingFollowUps", [])
|
|
161
|
+
lines.extend(["", "## 待跟进未合并项" if is_zh else "## Pending Follow-Ups", ""])
|
|
162
|
+
if pending_items:
|
|
163
|
+
for item in pending_items:
|
|
164
|
+
ev_text = ", ".join(f"`{ev}`" for ev in item["evidenceIds"])
|
|
165
|
+
if is_zh:
|
|
166
|
+
lines.append(
|
|
167
|
+
f"- [{item['repoKey']}] {item['title']} "
|
|
168
|
+
f"({item['commits']} commits; 证据: {ev_text})"
|
|
169
|
+
)
|
|
170
|
+
else:
|
|
171
|
+
lines.append(
|
|
172
|
+
f"- [{item['repoKey']}] {item['title']} "
|
|
173
|
+
f"({item['commits']} commits; evidence: {ev_text})"
|
|
174
|
+
)
|
|
175
|
+
else:
|
|
176
|
+
lines.append(
|
|
177
|
+
"- 本期无待跟进的未合并工作项。"
|
|
178
|
+
if is_zh
|
|
179
|
+
else "- No pending unmerged follow-up items in this window."
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
templates = report.get("outcomeTemplates", [])
|
|
183
|
+
if templates:
|
|
184
|
+
verified_date = _date_label(window["until"])
|
|
185
|
+
lines.extend(
|
|
186
|
+
[
|
|
187
|
+
"",
|
|
188
|
+
"## 可沉淀业务成果模板 (outcomes.yml)"
|
|
189
|
+
if is_zh
|
|
190
|
+
else "## Suggested Verified Outcome Templates (outcomes.yml)",
|
|
191
|
+
"",
|
|
192
|
+
"```yaml",
|
|
193
|
+
"outcomes:",
|
|
194
|
+
]
|
|
195
|
+
)
|
|
196
|
+
for tpl in templates:
|
|
197
|
+
ev_ref = ", ".join(tpl["suggestedEvidenceIds"])
|
|
198
|
+
lines.append(f" # item: {tpl['suggestedItemId']} | evidence: {ev_ref}")
|
|
199
|
+
lines.append(f" - id: {tpl['id']}")
|
|
200
|
+
lines.append(f' text: "{tpl["placeholderText"]}"')
|
|
201
|
+
lines.append(" source: <monitoring-or-review-doc>")
|
|
202
|
+
lines.append(" verifiedBy: <owner-or-tech-lead>")
|
|
203
|
+
lines.append(f" verifiedAt: {verified_date}")
|
|
204
|
+
lines.append("```")
|
|
205
|
+
|
|
206
|
+
if report.get("warnings"):
|
|
207
|
+
lines.extend(["", "## 警告" if is_zh else "## Warnings", ""])
|
|
208
|
+
lines.extend(f"- {warning}" for warning in report["warnings"])
|
|
209
|
+
|
|
210
|
+
lines.extend(["", "## 证据限制" if is_zh else "## Limitations", ""])
|
|
211
|
+
lines.extend(f"- {limitation}" for limitation in report["limitations"])
|
|
212
|
+
return "\n".join(lines) + "\n"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def render_resume_markdown(report: dict[str, Any]) -> str:
|
|
7
|
+
lines = [
|
|
8
|
+
f"# Resume Draft: {report['person']['name']}",
|
|
9
|
+
"",
|
|
10
|
+
f"- Target role: {report['targetRole'] or 'not specified'}",
|
|
11
|
+
f"- Language / style: {report['language']} / {report['style']}",
|
|
12
|
+
"",
|
|
13
|
+
"## Technical Summary",
|
|
14
|
+
"",
|
|
15
|
+
report["technicalSummary"]["headline"],
|
|
16
|
+
"",
|
|
17
|
+
"## Business Summary",
|
|
18
|
+
"",
|
|
19
|
+
report["businessSummary"]["headline"],
|
|
20
|
+
"",
|
|
21
|
+
"## Experience Bullets",
|
|
22
|
+
"",
|
|
23
|
+
]
|
|
24
|
+
for claim in report["experienceBullets"]:
|
|
25
|
+
lines.append(
|
|
26
|
+
f"- {claim['text']} ({claim['claimStrength']}) "
|
|
27
|
+
f"[Evidence: {', '.join(claim['evidenceIds'])}]"
|
|
28
|
+
)
|
|
29
|
+
lines.extend(["", "## Omitted Claims", ""])
|
|
30
|
+
for claim in report["omittedClaims"]:
|
|
31
|
+
lines.append(f"- {claim['candidate']}: {claim['reasonCode']}")
|
|
32
|
+
lines.extend(["", "## Evidence Index", ""])
|
|
33
|
+
for entry in report["evidence"]:
|
|
34
|
+
lines.append(f"- **{entry['id']}**: {entry['summary']}")
|
|
35
|
+
lines.extend(["", "## Limitations", ""])
|
|
36
|
+
lines.extend(f"- {value}" for value in report["limitations"])
|
|
37
|
+
return "\n".join(lines) + "\n"
|