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,316 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from git_contribution_analyzer.adapters.git.repository_discovery import discover_repository
|
|
9
|
+
from git_contribution_analyzer.adapters.storage.sqlite.analysis import SqliteAnalysisStore
|
|
10
|
+
from git_contribution_analyzer.adapters.workspace.layout import WorkspaceLayout
|
|
11
|
+
from git_contribution_analyzer.application.ports.cancellation import (
|
|
12
|
+
CancellationToken,
|
|
13
|
+
NeverCancelledToken,
|
|
14
|
+
)
|
|
15
|
+
from git_contribution_analyzer.application.ports.progress import (
|
|
16
|
+
NullProgressReporter,
|
|
17
|
+
ProgressReporter,
|
|
18
|
+
)
|
|
19
|
+
from git_contribution_analyzer.application.services.default_person import (
|
|
20
|
+
resolve_repo_default_person,
|
|
21
|
+
)
|
|
22
|
+
from git_contribution_analyzer.application.use_cases.analyze_contributions import (
|
|
23
|
+
analyze_contributions,
|
|
24
|
+
)
|
|
25
|
+
from git_contribution_analyzer.application.use_cases.assess_work import assess_work
|
|
26
|
+
from git_contribution_analyzer.application.use_cases.index_repository import index_repository
|
|
27
|
+
from git_contribution_analyzer.application.use_cases.init_project import init_project
|
|
28
|
+
from git_contribution_analyzer.application.use_cases.map_identity import map_identity
|
|
29
|
+
from git_contribution_analyzer.domain.models.analysis import AnalysisFilters
|
|
30
|
+
from git_contribution_analyzer.domain.models.recap import (
|
|
31
|
+
RecapItemEntry,
|
|
32
|
+
RecapPreviousTotals,
|
|
33
|
+
RecapScope,
|
|
34
|
+
RecapStructuralObservation,
|
|
35
|
+
RecapTotals,
|
|
36
|
+
)
|
|
37
|
+
from git_contribution_analyzer.domain.services.recap_rules import (
|
|
38
|
+
build_recap_report,
|
|
39
|
+
resolve_recap_window,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True, slots=True)
|
|
44
|
+
class RepoRecapSlice:
|
|
45
|
+
person_name: str
|
|
46
|
+
commits: int
|
|
47
|
+
delivered_commits: int
|
|
48
|
+
authored_only_commits: int
|
|
49
|
+
completed_items: int
|
|
50
|
+
pending_items: int
|
|
51
|
+
rework_items: int
|
|
52
|
+
integration_items: int
|
|
53
|
+
items: tuple[RecapItemEntry, ...]
|
|
54
|
+
has_hotspot_signal: bool
|
|
55
|
+
has_coupling_signal: bool
|
|
56
|
+
warnings: tuple[str, ...] = ()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def extract_repo_recap_slice(
|
|
60
|
+
*,
|
|
61
|
+
repo_key: str,
|
|
62
|
+
group: str,
|
|
63
|
+
analysis: dict[str, Any],
|
|
64
|
+
assessment: dict[str, Any],
|
|
65
|
+
) -> RepoRecapSlice:
|
|
66
|
+
"""从单仓 analyze + assess 确定性输出中提取复盘切片."""
|
|
67
|
+
person_info = analysis.get("person") or {}
|
|
68
|
+
person_name = str(person_info.get("name") or "Unknown")
|
|
69
|
+
|
|
70
|
+
summary = analysis.get("summary") or {}
|
|
71
|
+
deliveries = analysis.get("deliveryStatuses") or {}
|
|
72
|
+
workload = assessment.get("workloadSummary") or {}
|
|
73
|
+
|
|
74
|
+
commits = int(summary.get("commits", 0))
|
|
75
|
+
delivered_commits = int(deliveries.get("LANDED", 0)) + int(deliveries.get("RELEASED", 0))
|
|
76
|
+
authored_only_commits = int(deliveries.get("AUTHORED_ONLY", 0))
|
|
77
|
+
|
|
78
|
+
items_by_id: dict[str, dict[str, Any]] = {
|
|
79
|
+
str(entry["id"]): entry
|
|
80
|
+
for entry in analysis.get("contributionItems", [])
|
|
81
|
+
if entry.get("id")
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
recap_items: list[RecapItemEntry] = []
|
|
85
|
+
subjects = assessment.get("subjects") or []
|
|
86
|
+
item_assessments = subjects[0].get("itemAssessments", []) if subjects else []
|
|
87
|
+
for item_assess in item_assessments:
|
|
88
|
+
bucket = str(item_assess.get("completionBucket") or "")
|
|
89
|
+
if bucket not in {"COMPLETED", "PENDING"}:
|
|
90
|
+
continue
|
|
91
|
+
item_id = str(item_assess.get("contributionItemId") or "")
|
|
92
|
+
if not item_id:
|
|
93
|
+
continue
|
|
94
|
+
source_item = items_by_id.get(item_id, {})
|
|
95
|
+
raw_ev = source_item.get("evidenceIds") or item_assess.get("evidenceIds") or []
|
|
96
|
+
ev_ids = tuple(str(ev) for ev in raw_ev if str(ev))
|
|
97
|
+
if not ev_ids:
|
|
98
|
+
continue
|
|
99
|
+
title = str(source_item.get("title") or item_id)
|
|
100
|
+
commit_hashes = source_item.get("commitHashes") or []
|
|
101
|
+
item_commits = max(1, len(commit_hashes))
|
|
102
|
+
difficulty_obj = item_assess.get("difficulty") or {}
|
|
103
|
+
size_obj = item_assess.get("size") or {}
|
|
104
|
+
is_pending = bucket == "PENDING"
|
|
105
|
+
recap_items.append(
|
|
106
|
+
RecapItemEntry(
|
|
107
|
+
repo_key=repo_key,
|
|
108
|
+
group=group,
|
|
109
|
+
item_id=item_id,
|
|
110
|
+
title=title,
|
|
111
|
+
evidence_ids=ev_ids,
|
|
112
|
+
commits=item_commits,
|
|
113
|
+
pending=is_pending,
|
|
114
|
+
difficulty=None if is_pending else (
|
|
115
|
+
str(difficulty_obj["level"]) if difficulty_obj.get("level") else None
|
|
116
|
+
),
|
|
117
|
+
size=None if is_pending else (
|
|
118
|
+
str(size_obj["band"]) if size_obj.get("band") else None
|
|
119
|
+
),
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
signals = analysis.get("structuralSignals") or {}
|
|
124
|
+
has_hotspot = bool(signals.get("hotspots"))
|
|
125
|
+
has_coupling = bool(signals.get("coChangePairs") or signals.get("couplings"))
|
|
126
|
+
|
|
127
|
+
warnings_list = [
|
|
128
|
+
str(w) for w in (*analysis.get("warnings", []), *assessment.get("warnings", []))
|
|
129
|
+
]
|
|
130
|
+
dedup_warnings = tuple(dict.fromkeys(warnings_list))
|
|
131
|
+
|
|
132
|
+
return RepoRecapSlice(
|
|
133
|
+
person_name=person_name,
|
|
134
|
+
commits=commits,
|
|
135
|
+
delivered_commits=delivered_commits,
|
|
136
|
+
authored_only_commits=authored_only_commits,
|
|
137
|
+
completed_items=int(workload.get("completedItems", 0)),
|
|
138
|
+
pending_items=int(workload.get("pendingItems", 0)),
|
|
139
|
+
rework_items=int(workload.get("reworkItems", 0)),
|
|
140
|
+
integration_items=int(workload.get("integrationItems", 0)),
|
|
141
|
+
items=tuple(recap_items),
|
|
142
|
+
has_hotspot_signal=has_hotspot,
|
|
143
|
+
has_coupling_signal=has_coupling,
|
|
144
|
+
warnings=dedup_warnings,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _confirm_exact_email_identity_if_needed(repo_root: Path, selector: str) -> None:
|
|
149
|
+
"""仅对精确邮箱匹配的单一未确认 HUMAN 身份做 1 对 1 自确认, 绝不自动合并模糊身份."""
|
|
150
|
+
if "@" not in selector:
|
|
151
|
+
return
|
|
152
|
+
layout = WorkspaceLayout.for_repository(repo_root)
|
|
153
|
+
if not layout.database.is_file():
|
|
154
|
+
return
|
|
155
|
+
store = SqliteAnalysisStore(layout.database, str(repo_root))
|
|
156
|
+
target = selector.strip().lower()
|
|
157
|
+
matches = [
|
|
158
|
+
person
|
|
159
|
+
for person in store.list_people_for_analysis()
|
|
160
|
+
if bool(person.get("active", True))
|
|
161
|
+
and str(person.get("kind", "")) == "HUMAN"
|
|
162
|
+
and str(person.get("email") or "").strip().lower() == target
|
|
163
|
+
]
|
|
164
|
+
if len(matches) != 1 or bool(matches[0].get("confirmed")):
|
|
165
|
+
return
|
|
166
|
+
person = matches[0]
|
|
167
|
+
email = str(person["email"])
|
|
168
|
+
name = str(person["name"])
|
|
169
|
+
map_identity(
|
|
170
|
+
repo_root,
|
|
171
|
+
name=name,
|
|
172
|
+
email=email,
|
|
173
|
+
person_name=name,
|
|
174
|
+
person_email=email,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def generate_recap(
|
|
179
|
+
path: Path,
|
|
180
|
+
*,
|
|
181
|
+
person_selector: str | None = None,
|
|
182
|
+
window: str | None = None,
|
|
183
|
+
since: datetime | None = None,
|
|
184
|
+
until: datetime | None = None,
|
|
185
|
+
branch: str | None = None,
|
|
186
|
+
auto_sync: bool = False,
|
|
187
|
+
reference_now: datetime | None = None,
|
|
188
|
+
progress: ProgressReporter | None = None,
|
|
189
|
+
cancellation: CancellationToken | None = None,
|
|
190
|
+
) -> dict[str, Any]:
|
|
191
|
+
"""生成单仓库高频周期复盘报告(支持日报 today/yesterday/1d/day 及周/月/季)."""
|
|
192
|
+
active_cancellation = cancellation or NeverCancelledToken()
|
|
193
|
+
active_progress = progress or NullProgressReporter()
|
|
194
|
+
active_cancellation.raise_if_cancelled()
|
|
195
|
+
|
|
196
|
+
recap_window = resolve_recap_window(
|
|
197
|
+
window,
|
|
198
|
+
since=since,
|
|
199
|
+
until=until,
|
|
200
|
+
reference_now=reference_now,
|
|
201
|
+
)
|
|
202
|
+
repository = discover_repository(path)
|
|
203
|
+
repo_key = repository.root.name
|
|
204
|
+
|
|
205
|
+
if auto_sync:
|
|
206
|
+
layout = WorkspaceLayout.for_repository(repository.root)
|
|
207
|
+
if not layout.database.is_file():
|
|
208
|
+
init_project(
|
|
209
|
+
repository.root,
|
|
210
|
+
progress=active_progress,
|
|
211
|
+
cancellation=active_cancellation,
|
|
212
|
+
)
|
|
213
|
+
else:
|
|
214
|
+
index_repository(
|
|
215
|
+
repository.root,
|
|
216
|
+
full_rebuild=False,
|
|
217
|
+
progress=active_progress,
|
|
218
|
+
cancellation=active_cancellation,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
resolved_selector = (
|
|
222
|
+
person_selector.strip()
|
|
223
|
+
if person_selector and person_selector.strip()
|
|
224
|
+
else resolve_repo_default_person(repository.root)
|
|
225
|
+
)
|
|
226
|
+
if auto_sync:
|
|
227
|
+
_confirm_exact_email_identity_if_needed(repository.root, resolved_selector)
|
|
228
|
+
|
|
229
|
+
current_filters = AnalysisFilters(
|
|
230
|
+
since=recap_window.since,
|
|
231
|
+
until=recap_window.until,
|
|
232
|
+
branch=branch,
|
|
233
|
+
)
|
|
234
|
+
previous_filters = AnalysisFilters(
|
|
235
|
+
since=recap_window.previous_since,
|
|
236
|
+
until=recap_window.previous_until,
|
|
237
|
+
branch=branch,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
current_analysis = analyze_contributions(
|
|
241
|
+
repository.root,
|
|
242
|
+
person_selector=resolved_selector,
|
|
243
|
+
filters=current_filters,
|
|
244
|
+
llm_provider=None,
|
|
245
|
+
)
|
|
246
|
+
current_assessment = assess_work(
|
|
247
|
+
repository.root,
|
|
248
|
+
person_selectors=(resolved_selector,),
|
|
249
|
+
filters=current_filters,
|
|
250
|
+
llm_provider=None,
|
|
251
|
+
progress=active_progress,
|
|
252
|
+
cancellation=active_cancellation,
|
|
253
|
+
)
|
|
254
|
+
current_slice = extract_repo_recap_slice(
|
|
255
|
+
repo_key=repo_key,
|
|
256
|
+
group="repository",
|
|
257
|
+
analysis=current_analysis,
|
|
258
|
+
assessment=current_assessment,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
active_cancellation.raise_if_cancelled()
|
|
262
|
+
prev_analysis = analyze_contributions(
|
|
263
|
+
repository.root,
|
|
264
|
+
person_selector=resolved_selector,
|
|
265
|
+
filters=previous_filters,
|
|
266
|
+
llm_provider=None,
|
|
267
|
+
)
|
|
268
|
+
prev_assessment = assess_work(
|
|
269
|
+
repository.root,
|
|
270
|
+
person_selectors=(resolved_selector,),
|
|
271
|
+
filters=previous_filters,
|
|
272
|
+
llm_provider=None,
|
|
273
|
+
progress=active_progress,
|
|
274
|
+
cancellation=active_cancellation,
|
|
275
|
+
)
|
|
276
|
+
prev_slice = extract_repo_recap_slice(
|
|
277
|
+
repo_key=repo_key,
|
|
278
|
+
group="repository",
|
|
279
|
+
analysis=prev_analysis,
|
|
280
|
+
assessment=prev_assessment,
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
report = build_recap_report(
|
|
284
|
+
report_type="RECAP",
|
|
285
|
+
window=recap_window,
|
|
286
|
+
scope=RecapScope(
|
|
287
|
+
mode="REPOSITORY",
|
|
288
|
+
name=repo_key,
|
|
289
|
+
repositories=1,
|
|
290
|
+
matched_repositories=1 if current_slice.commits > 0 else 0,
|
|
291
|
+
),
|
|
292
|
+
person_name=current_slice.person_name,
|
|
293
|
+
totals=RecapTotals(
|
|
294
|
+
commits=current_slice.commits,
|
|
295
|
+
delivered_commits=current_slice.delivered_commits,
|
|
296
|
+
authored_only_commits=current_slice.authored_only_commits,
|
|
297
|
+
completed_items=current_slice.completed_items,
|
|
298
|
+
pending_items=current_slice.pending_items,
|
|
299
|
+
rework_items=current_slice.rework_items,
|
|
300
|
+
integration_items=current_slice.integration_items,
|
|
301
|
+
),
|
|
302
|
+
previous_totals=RecapPreviousTotals(
|
|
303
|
+
commits=prev_slice.commits,
|
|
304
|
+
delivered_commits=prev_slice.delivered_commits,
|
|
305
|
+
authored_only_commits=prev_slice.authored_only_commits,
|
|
306
|
+
completed_items=prev_slice.completed_items,
|
|
307
|
+
pending_items=prev_slice.pending_items,
|
|
308
|
+
),
|
|
309
|
+
items=current_slice.items,
|
|
310
|
+
structural_observation=RecapStructuralObservation(
|
|
311
|
+
hotspot_signal_repositories=1 if current_slice.has_hotspot_signal else 0,
|
|
312
|
+
coupling_signal_repositories=1 if current_slice.has_coupling_signal else 0,
|
|
313
|
+
),
|
|
314
|
+
warnings=current_slice.warnings,
|
|
315
|
+
)
|
|
316
|
+
return {"report": report.to_schema_dict()}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from git_contribution_analyzer.adapters.reporting.html_report import render_html_report
|
|
7
|
+
from git_contribution_analyzer.adapters.reporting.markdown import render_markdown
|
|
8
|
+
from git_contribution_analyzer.adapters.reporting.work_assessment_csv import (
|
|
9
|
+
render_work_assessment_csv,
|
|
10
|
+
)
|
|
11
|
+
from git_contribution_analyzer.application.use_cases.get_run import get_run
|
|
12
|
+
from git_contribution_analyzer.domain.errors import ReportError
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def generate_report(
|
|
16
|
+
path: Path,
|
|
17
|
+
run_id: str,
|
|
18
|
+
report_format: str,
|
|
19
|
+
*,
|
|
20
|
+
include_email: bool = False,
|
|
21
|
+
) -> str:
|
|
22
|
+
report = get_run(path, run_id)
|
|
23
|
+
normalized_format = report_format.casefold()
|
|
24
|
+
if normalized_format == "json":
|
|
25
|
+
return json.dumps(report, ensure_ascii=False, sort_keys=True, indent=2) + "\n"
|
|
26
|
+
if normalized_format == "markdown":
|
|
27
|
+
return render_markdown(report)
|
|
28
|
+
if normalized_format == "html":
|
|
29
|
+
return render_html_report(report, include_email=include_email)
|
|
30
|
+
if normalized_format == "csv":
|
|
31
|
+
return render_work_assessment_csv(report, include_email=include_email)
|
|
32
|
+
raise ReportError(f"Unsupported report format: {report_format}")
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from datetime import UTC, datetime
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
from uuid import uuid4
|
|
8
|
+
|
|
9
|
+
from git_contribution_analyzer.adapters.git.repository_discovery import discover_repository
|
|
10
|
+
from git_contribution_analyzer.adapters.llm.cache import CachedAuditedProvider
|
|
11
|
+
from git_contribution_analyzer.adapters.storage.sqlite.analysis import SqliteAnalysisStore
|
|
12
|
+
from git_contribution_analyzer.adapters.storage.sqlite.database import initialize_database
|
|
13
|
+
from git_contribution_analyzer.adapters.storage.sqlite.llm_audit import SqliteLlmAuditStore
|
|
14
|
+
from git_contribution_analyzer.adapters.workspace.layout import WorkspaceLayout
|
|
15
|
+
from git_contribution_analyzer.adapters.workspace.locks import workspace_lock
|
|
16
|
+
from git_contribution_analyzer.application.ports.llm import LlmProvider
|
|
17
|
+
from git_contribution_analyzer.application.services.evidence_snapshot import (
|
|
18
|
+
build_evidence_snapshot,
|
|
19
|
+
build_snapshot_subject,
|
|
20
|
+
)
|
|
21
|
+
from git_contribution_analyzer.application.services.resume_generation import (
|
|
22
|
+
build_deterministic_resume,
|
|
23
|
+
enhance_resume,
|
|
24
|
+
)
|
|
25
|
+
from git_contribution_analyzer.application.use_cases.analyze_contributions import _branch_hashes
|
|
26
|
+
from git_contribution_analyzer.domain.errors import ConfigurationError, LlmProviderError
|
|
27
|
+
from git_contribution_analyzer.domain.models.analysis import AnalysisFilters
|
|
28
|
+
from git_contribution_analyzer.domain.models.resume import (
|
|
29
|
+
ResumeLanguage,
|
|
30
|
+
ResumeStyle,
|
|
31
|
+
VerifiedOutcome,
|
|
32
|
+
)
|
|
33
|
+
from git_contribution_analyzer.domain.models.run import RunType
|
|
34
|
+
|
|
35
|
+
Clock = Callable[[], datetime]
|
|
36
|
+
IdGenerator = Callable[[], str]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def generate_resume(
|
|
40
|
+
path: Path,
|
|
41
|
+
*,
|
|
42
|
+
person_selector: str,
|
|
43
|
+
filters: AnalysisFilters | None = None,
|
|
44
|
+
target_role: str = "",
|
|
45
|
+
language: str = "zh-CN",
|
|
46
|
+
style: str = "concise",
|
|
47
|
+
max_bullets: int = 6,
|
|
48
|
+
include_pending: bool = False,
|
|
49
|
+
outcomes: tuple[VerifiedOutcome, ...] = (),
|
|
50
|
+
clock: Clock | None = None,
|
|
51
|
+
id_generator: IdGenerator | None = None,
|
|
52
|
+
llm_provider: LlmProvider | None = None,
|
|
53
|
+
allow_llm_fallback: bool = True,
|
|
54
|
+
) -> dict[str, Any]:
|
|
55
|
+
if not 1 <= max_bullets <= 20:
|
|
56
|
+
raise ConfigurationError("max bullets must be between 1 and 20")
|
|
57
|
+
try:
|
|
58
|
+
selected_language = ResumeLanguage(language)
|
|
59
|
+
selected_style = ResumeStyle(style)
|
|
60
|
+
except ValueError as exc:
|
|
61
|
+
raise ConfigurationError("Unsupported resume language or style") from exc
|
|
62
|
+
repository = discover_repository(path)
|
|
63
|
+
layout = WorkspaceLayout.for_repository(repository.root)
|
|
64
|
+
initialize_database(layout.database)
|
|
65
|
+
store = SqliteAnalysisStore(layout.database, str(repository.root))
|
|
66
|
+
active_filters = filters or AnalysisFilters()
|
|
67
|
+
now = clock or (lambda: datetime.now(UTC))
|
|
68
|
+
next_id = id_generator or (lambda: str(uuid4()))
|
|
69
|
+
run_id = next_id()
|
|
70
|
+
started_at = now()
|
|
71
|
+
baseline = store.baseline_commit()
|
|
72
|
+
person = store.resolve_confirmed_person(person_selector)
|
|
73
|
+
commits = store.load_commits(
|
|
74
|
+
str(person["id"]),
|
|
75
|
+
active_filters,
|
|
76
|
+
allowed_hashes=_branch_hashes(repository.root, active_filters.branch),
|
|
77
|
+
)
|
|
78
|
+
subject = build_snapshot_subject(person, commits)
|
|
79
|
+
snapshot = build_evidence_snapshot(
|
|
80
|
+
repository_root=repository.root,
|
|
81
|
+
baseline_commit=baseline,
|
|
82
|
+
filters=active_filters,
|
|
83
|
+
scope_type="PERSON",
|
|
84
|
+
subjects=(subject,),
|
|
85
|
+
identity_warnings=(),
|
|
86
|
+
created_at=started_at,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
with workspace_lock(layout.locks / "workspace.lock"):
|
|
90
|
+
store.start_run(
|
|
91
|
+
run_id=run_id,
|
|
92
|
+
person_id=str(person["id"]),
|
|
93
|
+
parameters={
|
|
94
|
+
"person": person_selector,
|
|
95
|
+
"filters": active_filters.as_dict(),
|
|
96
|
+
"targetRole": target_role,
|
|
97
|
+
"language": language,
|
|
98
|
+
"style": style,
|
|
99
|
+
"maxBullets": max_bullets,
|
|
100
|
+
"includePending": include_pending,
|
|
101
|
+
"llm": llm_provider is not None,
|
|
102
|
+
},
|
|
103
|
+
baseline_commit=baseline,
|
|
104
|
+
started_at=started_at,
|
|
105
|
+
run_type=RunType.RESUME,
|
|
106
|
+
)
|
|
107
|
+
try:
|
|
108
|
+
content = build_deterministic_resume(
|
|
109
|
+
subject,
|
|
110
|
+
language=selected_language,
|
|
111
|
+
style=selected_style,
|
|
112
|
+
max_bullets=max_bullets,
|
|
113
|
+
include_pending=include_pending,
|
|
114
|
+
outcomes=outcomes,
|
|
115
|
+
)
|
|
116
|
+
report = {
|
|
117
|
+
"schemaVersion": "1.0",
|
|
118
|
+
"reportType": "RESUME",
|
|
119
|
+
"run": {
|
|
120
|
+
"id": run_id,
|
|
121
|
+
"runType": RunType.RESUME.value,
|
|
122
|
+
"parentRunId": None,
|
|
123
|
+
"status": "COMPLETED",
|
|
124
|
+
"startedAt": started_at.isoformat(),
|
|
125
|
+
"completedAt": started_at.isoformat(),
|
|
126
|
+
"ruleVersion": "resume-claim-rules-v1",
|
|
127
|
+
"providerId": "none",
|
|
128
|
+
"model": None,
|
|
129
|
+
"promptVersion": None,
|
|
130
|
+
"semanticSchemaVersion": None,
|
|
131
|
+
},
|
|
132
|
+
"snapshot": snapshot.as_reference(),
|
|
133
|
+
"person": {"id": subject.person.id, "name": subject.person.name},
|
|
134
|
+
"targetRole": target_role,
|
|
135
|
+
"language": selected_language.value,
|
|
136
|
+
"style": selected_style.value,
|
|
137
|
+
**content,
|
|
138
|
+
"evidence": [
|
|
139
|
+
{
|
|
140
|
+
"id": entry.id,
|
|
141
|
+
"type": entry.evidence_type,
|
|
142
|
+
"summary": entry.summary,
|
|
143
|
+
"commitHashes": list(entry.commit_hashes),
|
|
144
|
+
"paths": list(entry.paths),
|
|
145
|
+
"metrics": dict(entry.metrics),
|
|
146
|
+
}
|
|
147
|
+
for entry in subject.evidence
|
|
148
|
+
],
|
|
149
|
+
"warnings": [],
|
|
150
|
+
"limitations": [
|
|
151
|
+
"Resume candidates are evidence-backed drafts and require human review.",
|
|
152
|
+
"Git evidence does not prove business outcomes or sole ownership.",
|
|
153
|
+
],
|
|
154
|
+
}
|
|
155
|
+
status = "COMPLETED"
|
|
156
|
+
provider_id = "none"
|
|
157
|
+
if llm_provider is not None:
|
|
158
|
+
provider_id = llm_provider.provider_id
|
|
159
|
+
if not report["experienceBullets"]:
|
|
160
|
+
report["warnings"].append(
|
|
161
|
+
"LLM resume generation skipped: no eligible Evidence available."
|
|
162
|
+
)
|
|
163
|
+
else:
|
|
164
|
+
audited_provider = CachedAuditedProvider(
|
|
165
|
+
llm_provider,
|
|
166
|
+
SqliteLlmAuditStore(layout.database),
|
|
167
|
+
run_id=run_id,
|
|
168
|
+
)
|
|
169
|
+
try:
|
|
170
|
+
enhancement = enhance_resume(
|
|
171
|
+
report=report,
|
|
172
|
+
snapshot=snapshot,
|
|
173
|
+
provider=audited_provider,
|
|
174
|
+
outcomes=outcomes,
|
|
175
|
+
max_bullets=max_bullets,
|
|
176
|
+
)
|
|
177
|
+
report.update(enhancement.content)
|
|
178
|
+
report["run"].update(
|
|
179
|
+
{
|
|
180
|
+
"providerId": enhancement.completion.provider_id,
|
|
181
|
+
"model": enhancement.completion.model,
|
|
182
|
+
"promptVersion": enhancement.task.prompt_version,
|
|
183
|
+
"semanticSchemaVersion": enhancement.task.schema_version,
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
except LlmProviderError as exc:
|
|
187
|
+
if not allow_llm_fallback:
|
|
188
|
+
raise
|
|
189
|
+
status = "PARTIAL"
|
|
190
|
+
report["warnings"].append(
|
|
191
|
+
f"LLM resume generation unavailable ({exc.code}); "
|
|
192
|
+
"conservative templates retained."
|
|
193
|
+
)
|
|
194
|
+
report["run"]["providerId"] = provider_id
|
|
195
|
+
report["run"]["status"] = status
|
|
196
|
+
completed_at = now()
|
|
197
|
+
report["run"]["completedAt"] = completed_at.isoformat()
|
|
198
|
+
store.complete_run(
|
|
199
|
+
run_id=run_id,
|
|
200
|
+
completed_at=completed_at,
|
|
201
|
+
report=report,
|
|
202
|
+
status=status,
|
|
203
|
+
provider_id=provider_id,
|
|
204
|
+
persist_details=False,
|
|
205
|
+
)
|
|
206
|
+
return report
|
|
207
|
+
except Exception as exc:
|
|
208
|
+
store.fail_run(run_id, now(), str(exc))
|
|
209
|
+
raise
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from git_contribution_analyzer.adapters.workspace.portfolio_workspace import FilePortfolioStore
|
|
7
|
+
from git_contribution_analyzer.application.use_cases.get_status import get_status
|
|
8
|
+
from git_contribution_analyzer.domain.errors import GcaError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_portfolio_status(portfolio_dir: Path) -> dict[str, Any]:
|
|
12
|
+
"""读取 Portfolio 清单与全部成员仓状态, 不因单个缺失仓库中断."""
|
|
13
|
+
store = FilePortfolioStore(portfolio_dir)
|
|
14
|
+
manifest = store.load_manifest()
|
|
15
|
+
|
|
16
|
+
repo_statuses: list[dict[str, Any]] = []
|
|
17
|
+
initialized_count = 0
|
|
18
|
+
missing_count = 0
|
|
19
|
+
unresolved_identities = 0
|
|
20
|
+
|
|
21
|
+
for repo in manifest.repositories:
|
|
22
|
+
resolved = store.resolve_repo_path(repo)
|
|
23
|
+
if not resolved.is_dir():
|
|
24
|
+
missing_count += 1
|
|
25
|
+
repo_statuses.append(
|
|
26
|
+
{
|
|
27
|
+
"repoKey": repo.repo_key,
|
|
28
|
+
"group": repo.group,
|
|
29
|
+
"status": "MISSING",
|
|
30
|
+
"workspaceInitialized": False,
|
|
31
|
+
"indexedCommits": 0,
|
|
32
|
+
"unresolvedIdentities": 0,
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
continue
|
|
36
|
+
try:
|
|
37
|
+
st = get_status(resolved)
|
|
38
|
+
except GcaError as exc:
|
|
39
|
+
missing_count += 1
|
|
40
|
+
repo_statuses.append(
|
|
41
|
+
{
|
|
42
|
+
"repoKey": repo.repo_key,
|
|
43
|
+
"group": repo.group,
|
|
44
|
+
"status": "ERROR",
|
|
45
|
+
"error": str(exc),
|
|
46
|
+
"workspaceInitialized": False,
|
|
47
|
+
"indexedCommits": 0,
|
|
48
|
+
"unresolvedIdentities": 0,
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
continue
|
|
52
|
+
|
|
53
|
+
initialized = bool(st.get("workspaceInitialized"))
|
|
54
|
+
if initialized:
|
|
55
|
+
initialized_count += 1
|
|
56
|
+
unresolved = int(st.get("unresolvedIdentities", 0))
|
|
57
|
+
unresolved_identities += unresolved
|
|
58
|
+
repo_statuses.append(
|
|
59
|
+
{
|
|
60
|
+
"repoKey": repo.repo_key,
|
|
61
|
+
"group": repo.group,
|
|
62
|
+
"status": "READY" if initialized else "NOT_INITIALIZED",
|
|
63
|
+
"workspaceInitialized": initialized,
|
|
64
|
+
"defaultBranch": repo.target_branch or st.get("defaultBranch"),
|
|
65
|
+
"indexedCommit": st.get("indexedCommit"),
|
|
66
|
+
"indexedCommits": int(st.get("indexedCommits", 0)),
|
|
67
|
+
"unresolvedIdentities": unresolved,
|
|
68
|
+
"lastSync": st.get("lastSync"),
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
runs = store.list_runs()
|
|
73
|
+
return {
|
|
74
|
+
"portfolioName": manifest.name,
|
|
75
|
+
"schemaVersion": manifest.schema_version,
|
|
76
|
+
"totalRepositories": len(manifest.repositories),
|
|
77
|
+
"initializedRepositories": initialized_count,
|
|
78
|
+
"missingRepositories": missing_count,
|
|
79
|
+
"unresolvedIdentities": unresolved_identities,
|
|
80
|
+
"runs": len(runs),
|
|
81
|
+
"latestRun": runs[-1] if runs else None,
|
|
82
|
+
"repositories": repo_statuses,
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from git_contribution_analyzer.adapters.git.repository_discovery import discover_repository
|
|
7
|
+
from git_contribution_analyzer.adapters.storage.sqlite.analysis import SqliteAnalysisStore
|
|
8
|
+
from git_contribution_analyzer.adapters.storage.sqlite.database import initialize_database
|
|
9
|
+
from git_contribution_analyzer.adapters.workspace.layout import WorkspaceLayout
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_run(path: Path, run_id: str) -> dict[str, Any]:
|
|
13
|
+
repository = discover_repository(path)
|
|
14
|
+
layout = WorkspaceLayout.for_repository(repository.root)
|
|
15
|
+
initialize_database(layout.database)
|
|
16
|
+
return SqliteAnalysisStore(layout.database, str(repository.root)).get_report(run_id)
|