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,235 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from enum import StrEnum
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RecapGranularity(StrEnum):
|
|
10
|
+
DAILY = "daily"
|
|
11
|
+
WEEKLY = "weekly"
|
|
12
|
+
MONTHLY = "monthly"
|
|
13
|
+
QUARTERLY = "quarterly"
|
|
14
|
+
CUSTOM = "custom"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True, slots=True)
|
|
18
|
+
class RecapWindow:
|
|
19
|
+
label: str
|
|
20
|
+
granularity: RecapGranularity
|
|
21
|
+
since: datetime
|
|
22
|
+
until: datetime
|
|
23
|
+
previous_since: datetime
|
|
24
|
+
previous_until: datetime
|
|
25
|
+
|
|
26
|
+
def __post_init__(self) -> None:
|
|
27
|
+
if self.since > self.until:
|
|
28
|
+
raise ValueError("Recap window since cannot be after until")
|
|
29
|
+
if self.previous_since > self.previous_until:
|
|
30
|
+
raise ValueError("Recap previous window since cannot be after until")
|
|
31
|
+
|
|
32
|
+
def to_schema_dict(self) -> dict[str, str]:
|
|
33
|
+
return {
|
|
34
|
+
"label": self.label,
|
|
35
|
+
"granularity": self.granularity.value,
|
|
36
|
+
"since": self.since.isoformat(),
|
|
37
|
+
"until": self.until.isoformat(),
|
|
38
|
+
"previousSince": self.previous_since.isoformat(),
|
|
39
|
+
"previousUntil": self.previous_until.isoformat(),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True, slots=True)
|
|
44
|
+
class RecapScope:
|
|
45
|
+
mode: str
|
|
46
|
+
name: str
|
|
47
|
+
repositories: int
|
|
48
|
+
matched_repositories: int
|
|
49
|
+
|
|
50
|
+
def __post_init__(self) -> None:
|
|
51
|
+
if self.mode not in {"REPOSITORY", "PORTFOLIO"}:
|
|
52
|
+
raise ValueError(f"Unsupported recap scope mode: {self.mode!r}")
|
|
53
|
+
if self.repositories < 1:
|
|
54
|
+
raise ValueError("repositories must be at least 1")
|
|
55
|
+
if self.matched_repositories < 0:
|
|
56
|
+
raise ValueError("matched_repositories must be non-negative")
|
|
57
|
+
|
|
58
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
59
|
+
return {
|
|
60
|
+
"mode": self.mode,
|
|
61
|
+
"name": self.name,
|
|
62
|
+
"repositories": self.repositories,
|
|
63
|
+
"matchedRepositories": self.matched_repositories,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass(frozen=True, slots=True)
|
|
68
|
+
class RecapTotals:
|
|
69
|
+
commits: int = 0
|
|
70
|
+
delivered_commits: int = 0
|
|
71
|
+
authored_only_commits: int = 0
|
|
72
|
+
completed_items: int = 0
|
|
73
|
+
pending_items: int = 0
|
|
74
|
+
rework_items: int = 0
|
|
75
|
+
integration_items: int = 0
|
|
76
|
+
|
|
77
|
+
def to_schema_dict(self) -> dict[str, int]:
|
|
78
|
+
return {
|
|
79
|
+
"commits": self.commits,
|
|
80
|
+
"deliveredCommits": self.delivered_commits,
|
|
81
|
+
"authoredOnlyCommits": self.authored_only_commits,
|
|
82
|
+
"completedItems": self.completed_items,
|
|
83
|
+
"pendingItems": self.pending_items,
|
|
84
|
+
"reworkItems": self.rework_items,
|
|
85
|
+
"integrationItems": self.integration_items,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass(frozen=True, slots=True)
|
|
90
|
+
class RecapPreviousTotals:
|
|
91
|
+
commits: int = 0
|
|
92
|
+
delivered_commits: int = 0
|
|
93
|
+
authored_only_commits: int = 0
|
|
94
|
+
completed_items: int = 0
|
|
95
|
+
pending_items: int = 0
|
|
96
|
+
|
|
97
|
+
def to_schema_dict(self) -> dict[str, int]:
|
|
98
|
+
return {
|
|
99
|
+
"commits": self.commits,
|
|
100
|
+
"deliveredCommits": self.delivered_commits,
|
|
101
|
+
"authoredOnlyCommits": self.authored_only_commits,
|
|
102
|
+
"completedItems": self.completed_items,
|
|
103
|
+
"pendingItems": self.pending_items,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@dataclass(frozen=True, slots=True)
|
|
108
|
+
class RecapDelta:
|
|
109
|
+
commits: int
|
|
110
|
+
delivered_commits: int
|
|
111
|
+
completed_items: int
|
|
112
|
+
pending_items: int
|
|
113
|
+
|
|
114
|
+
def to_schema_dict(self) -> dict[str, int]:
|
|
115
|
+
return {
|
|
116
|
+
"commits": self.commits,
|
|
117
|
+
"deliveredCommits": self.delivered_commits,
|
|
118
|
+
"completedItems": self.completed_items,
|
|
119
|
+
"pendingItems": self.pending_items,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass(frozen=True, slots=True)
|
|
124
|
+
class RecapItemEntry:
|
|
125
|
+
repo_key: str
|
|
126
|
+
group: str
|
|
127
|
+
item_id: str
|
|
128
|
+
title: str
|
|
129
|
+
evidence_ids: tuple[str, ...]
|
|
130
|
+
commits: int
|
|
131
|
+
pending: bool
|
|
132
|
+
difficulty: str | None = None
|
|
133
|
+
size: str | None = None
|
|
134
|
+
|
|
135
|
+
def __post_init__(self) -> None:
|
|
136
|
+
if not self.evidence_ids:
|
|
137
|
+
raise ValueError("Recap item requires at least one evidence ID")
|
|
138
|
+
if self.commits < 1:
|
|
139
|
+
raise ValueError("Recap item commits must be positive")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@dataclass(frozen=True, slots=True)
|
|
143
|
+
class RecapOutcomeTemplate:
|
|
144
|
+
id: str
|
|
145
|
+
suggested_item_id: str
|
|
146
|
+
suggested_evidence_ids: tuple[str, ...]
|
|
147
|
+
placeholder_text: str
|
|
148
|
+
|
|
149
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
150
|
+
return {
|
|
151
|
+
"id": self.id,
|
|
152
|
+
"suggestedItemId": self.suggested_item_id,
|
|
153
|
+
"suggestedEvidenceIds": list(self.suggested_evidence_ids),
|
|
154
|
+
"placeholderText": self.placeholder_text,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@dataclass(frozen=True, slots=True)
|
|
159
|
+
class RecapStructuralObservation:
|
|
160
|
+
hotspot_signal_repositories: int = 0
|
|
161
|
+
coupling_signal_repositories: int = 0
|
|
162
|
+
affects_difficulty_ranking_or_resume: bool = False
|
|
163
|
+
|
|
164
|
+
def __post_init__(self) -> None:
|
|
165
|
+
if self.affects_difficulty_ranking_or_resume:
|
|
166
|
+
raise ValueError("Recap structural observations must remain observation-only")
|
|
167
|
+
|
|
168
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
169
|
+
return {
|
|
170
|
+
"hotspotSignalRepositories": self.hotspot_signal_repositories,
|
|
171
|
+
"couplingSignalRepositories": self.coupling_signal_repositories,
|
|
172
|
+
"affectsDifficultyRankingOrResume": False,
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@dataclass(frozen=True, slots=True)
|
|
177
|
+
class RecapReport:
|
|
178
|
+
report_type: str
|
|
179
|
+
window: RecapWindow
|
|
180
|
+
scope: RecapScope
|
|
181
|
+
person_name: str
|
|
182
|
+
totals: RecapTotals
|
|
183
|
+
previous_totals: RecapPreviousTotals
|
|
184
|
+
delta: RecapDelta
|
|
185
|
+
delivered_highlights: tuple[RecapItemEntry, ...]
|
|
186
|
+
pending_follow_ups: tuple[RecapItemEntry, ...]
|
|
187
|
+
structural_observation: RecapStructuralObservation
|
|
188
|
+
outcome_templates: tuple[RecapOutcomeTemplate, ...]
|
|
189
|
+
warnings: tuple[str, ...]
|
|
190
|
+
limitations: tuple[str, ...]
|
|
191
|
+
schema_version: str = "1.0"
|
|
192
|
+
|
|
193
|
+
def __post_init__(self) -> None:
|
|
194
|
+
if self.report_type not in {"RECAP", "PORTFOLIO_RECAP"}:
|
|
195
|
+
raise ValueError(f"Unsupported recap report_type: {self.report_type!r}")
|
|
196
|
+
|
|
197
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
198
|
+
return {
|
|
199
|
+
"schemaVersion": self.schema_version,
|
|
200
|
+
"reportType": self.report_type,
|
|
201
|
+
"window": self.window.to_schema_dict(),
|
|
202
|
+
"scope": self.scope.to_schema_dict(),
|
|
203
|
+
"person": {"name": self.person_name},
|
|
204
|
+
"totals": self.totals.to_schema_dict(),
|
|
205
|
+
"previousTotals": self.previous_totals.to_schema_dict(),
|
|
206
|
+
"delta": self.delta.to_schema_dict(),
|
|
207
|
+
"deliveredHighlights": [
|
|
208
|
+
{
|
|
209
|
+
"repoKey": item.repo_key,
|
|
210
|
+
"group": item.group,
|
|
211
|
+
"itemId": item.item_id,
|
|
212
|
+
"title": item.title,
|
|
213
|
+
"evidenceIds": list(item.evidence_ids),
|
|
214
|
+
"difficulty": item.difficulty,
|
|
215
|
+
"size": item.size,
|
|
216
|
+
"commits": item.commits,
|
|
217
|
+
}
|
|
218
|
+
for item in self.delivered_highlights
|
|
219
|
+
],
|
|
220
|
+
"pendingFollowUps": [
|
|
221
|
+
{
|
|
222
|
+
"repoKey": item.repo_key,
|
|
223
|
+
"group": item.group,
|
|
224
|
+
"itemId": item.item_id,
|
|
225
|
+
"title": item.title,
|
|
226
|
+
"evidenceIds": list(item.evidence_ids),
|
|
227
|
+
"commits": item.commits,
|
|
228
|
+
}
|
|
229
|
+
for item in self.pending_follow_ups
|
|
230
|
+
],
|
|
231
|
+
"structuralObservation": self.structural_observation.to_schema_dict(),
|
|
232
|
+
"outcomeTemplates": [tpl.to_schema_dict() for tpl in self.outcome_templates],
|
|
233
|
+
"warnings": list(self.warnings),
|
|
234
|
+
"limitations": list(self.limitations),
|
|
235
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import date
|
|
5
|
+
from enum import StrEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ClaimStrength(StrEnum):
|
|
9
|
+
CONTRIBUTED = "CONTRIBUTED"
|
|
10
|
+
IMPLEMENTED = "IMPLEMENTED"
|
|
11
|
+
LED = "LED"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ResumeStyle(StrEnum):
|
|
15
|
+
CONCISE = "concise"
|
|
16
|
+
STAR = "star"
|
|
17
|
+
XYZ = "xyz"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ResumeLanguage(StrEnum):
|
|
21
|
+
ZH_CN = "zh-CN"
|
|
22
|
+
EN_US = "en-US"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True, slots=True)
|
|
26
|
+
class VerifiedOutcome:
|
|
27
|
+
id: str
|
|
28
|
+
text: str
|
|
29
|
+
source: str
|
|
30
|
+
verified_by: str
|
|
31
|
+
verified_at: date
|
|
32
|
+
kind: str = "OUTCOME"
|
|
33
|
+
evidence_ids: tuple[str, ...] = ()
|
|
34
|
+
tags: tuple[str, ...] = ()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True, slots=True)
|
|
38
|
+
class ResumeClaim:
|
|
39
|
+
text: str
|
|
40
|
+
claim_strength: ClaimStrength
|
|
41
|
+
contribution_item_ids: tuple[str, ...]
|
|
42
|
+
evidence_ids: tuple[str, ...]
|
|
43
|
+
verified_outcome_ids: tuple[str, ...]
|
|
44
|
+
confidence: str
|
|
45
|
+
pending: bool
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True, slots=True)
|
|
49
|
+
class SkillEvidence:
|
|
50
|
+
skill: str
|
|
51
|
+
evidence_ids: tuple[str, ...]
|
|
52
|
+
contribution_item_ids: tuple[str, ...]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True, slots=True)
|
|
56
|
+
class OmittedClaim:
|
|
57
|
+
candidate: str
|
|
58
|
+
reason_code: str
|
|
59
|
+
missing_evidence: tuple[str, ...]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
|
|
7
|
+
Confidence = Literal["HIGH", "MEDIUM", "LOW"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SemanticClaim(BaseModel):
|
|
11
|
+
model_config = ConfigDict(extra="forbid", populate_by_name=True)
|
|
12
|
+
|
|
13
|
+
text: str = Field(min_length=1)
|
|
14
|
+
evidence_ids: list[str] = Field(alias="evidenceIds", min_length=1)
|
|
15
|
+
confidence: Confidence
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ContributionSummary(SemanticClaim):
|
|
19
|
+
contribution_item_id: str = Field(alias="contributionItemId")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CapabilityExplanation(SemanticClaim):
|
|
23
|
+
capability: str = Field(min_length=1)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SemanticEnhancement(BaseModel):
|
|
27
|
+
model_config = ConfigDict(extra="forbid", populate_by_name=True)
|
|
28
|
+
|
|
29
|
+
overall_summary: list[SemanticClaim] = Field(alias="overallSummary", min_length=1)
|
|
30
|
+
contribution_summaries: list[ContributionSummary] = Field(alias="contributionSummaries")
|
|
31
|
+
capability_explanations: list[CapabilityExplanation] = Field(
|
|
32
|
+
alias="capabilityExplanations"
|
|
33
|
+
)
|
|
34
|
+
resume_bullets: list[SemanticClaim] = Field(alias="resumeBullets")
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
from dataclasses import dataclass, replace
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing import Any, Self
|
|
8
|
+
|
|
9
|
+
from git_contribution_analyzer.domain.models.analysis import AnalysisFilters
|
|
10
|
+
from git_contribution_analyzer.domain.models.assessment import CapabilityAssessment
|
|
11
|
+
from git_contribution_analyzer.domain.models.contribution import (
|
|
12
|
+
ContributionCommit,
|
|
13
|
+
ContributionItem,
|
|
14
|
+
Evidence,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
SNAPSHOT_SCHEMA_VERSION = "snapshot-v1"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(frozen=True, slots=True)
|
|
21
|
+
class SnapshotPerson:
|
|
22
|
+
id: str
|
|
23
|
+
name: str
|
|
24
|
+
email: str
|
|
25
|
+
kind: str
|
|
26
|
+
confirmed: bool
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True, slots=True)
|
|
30
|
+
class SnapshotSubject:
|
|
31
|
+
person: SnapshotPerson
|
|
32
|
+
commits: tuple[ContributionCommit, ...]
|
|
33
|
+
contribution_items: tuple[ContributionItem, ...]
|
|
34
|
+
evidence: tuple[Evidence, ...]
|
|
35
|
+
capabilities: tuple[CapabilityAssessment, ...]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True, slots=True)
|
|
39
|
+
class EvidenceSnapshot:
|
|
40
|
+
id: str
|
|
41
|
+
schema_version: str
|
|
42
|
+
repository_id: str
|
|
43
|
+
repository_root: str
|
|
44
|
+
baseline_commit: str | None
|
|
45
|
+
filters: AnalysisFilters
|
|
46
|
+
scope_type: str
|
|
47
|
+
subjects: tuple[SnapshotSubject, ...]
|
|
48
|
+
identity_warnings: tuple[str, ...]
|
|
49
|
+
rule_versions: tuple[tuple[str, str], ...]
|
|
50
|
+
created_at: datetime
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def create(
|
|
54
|
+
cls,
|
|
55
|
+
*,
|
|
56
|
+
repository_id: str,
|
|
57
|
+
repository_root: str,
|
|
58
|
+
baseline_commit: str | None,
|
|
59
|
+
filters: AnalysisFilters,
|
|
60
|
+
scope_type: str,
|
|
61
|
+
subjects: tuple[SnapshotSubject, ...],
|
|
62
|
+
identity_warnings: tuple[str, ...],
|
|
63
|
+
rule_versions: tuple[tuple[str, str], ...],
|
|
64
|
+
created_at: datetime,
|
|
65
|
+
) -> Self:
|
|
66
|
+
candidate = cls(
|
|
67
|
+
id="",
|
|
68
|
+
schema_version=SNAPSHOT_SCHEMA_VERSION,
|
|
69
|
+
repository_id=repository_id,
|
|
70
|
+
repository_root=repository_root,
|
|
71
|
+
baseline_commit=baseline_commit,
|
|
72
|
+
filters=filters,
|
|
73
|
+
scope_type=scope_type,
|
|
74
|
+
subjects=tuple(sorted(subjects, key=lambda value: value.person.id)),
|
|
75
|
+
identity_warnings=tuple(sorted(identity_warnings)),
|
|
76
|
+
rule_versions=tuple(sorted(rule_versions)),
|
|
77
|
+
created_at=created_at,
|
|
78
|
+
)
|
|
79
|
+
encoded = json.dumps(
|
|
80
|
+
candidate._canonical_payload(),
|
|
81
|
+
ensure_ascii=False,
|
|
82
|
+
sort_keys=True,
|
|
83
|
+
separators=(",", ":"),
|
|
84
|
+
).encode("utf-8")
|
|
85
|
+
return replace(candidate, id=hashlib.sha256(encoded).hexdigest())
|
|
86
|
+
|
|
87
|
+
def as_reference(self) -> dict[str, Any]:
|
|
88
|
+
return {
|
|
89
|
+
"id": self.id,
|
|
90
|
+
"schemaVersion": self.schema_version,
|
|
91
|
+
"baselineCommit": self.baseline_commit,
|
|
92
|
+
"filters": self.filters.as_dict(),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
def as_llm_context(self) -> dict[str, Any]:
|
|
96
|
+
return {
|
|
97
|
+
"snapshotId": self.id,
|
|
98
|
+
"schemaVersion": self.schema_version,
|
|
99
|
+
"baselineCommit": self.baseline_commit,
|
|
100
|
+
"filters": self.filters.as_dict(),
|
|
101
|
+
"subjects": [
|
|
102
|
+
{
|
|
103
|
+
"person": {"id": subject.person.id, "name": subject.person.name},
|
|
104
|
+
"contributionItems": [
|
|
105
|
+
{
|
|
106
|
+
"id": item.id,
|
|
107
|
+
"title": item.title,
|
|
108
|
+
"confidence": item.confidence,
|
|
109
|
+
"evidenceIds": list(item.evidence_ids),
|
|
110
|
+
}
|
|
111
|
+
for item in sorted(
|
|
112
|
+
subject.contribution_items, key=lambda value: value.id
|
|
113
|
+
)
|
|
114
|
+
],
|
|
115
|
+
"evidence": [
|
|
116
|
+
{
|
|
117
|
+
"id": entry.id,
|
|
118
|
+
"type": entry.evidence_type,
|
|
119
|
+
"summary": entry.summary,
|
|
120
|
+
"metrics": dict(entry.metrics),
|
|
121
|
+
}
|
|
122
|
+
for entry in sorted(subject.evidence, key=lambda value: value.id)
|
|
123
|
+
],
|
|
124
|
+
}
|
|
125
|
+
for subject in self.subjects
|
|
126
|
+
],
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
def _canonical_payload(self) -> dict[str, Any]:
|
|
130
|
+
return {
|
|
131
|
+
"schemaVersion": self.schema_version,
|
|
132
|
+
"repositoryId": self.repository_id,
|
|
133
|
+
"repositoryRoot": self.repository_root,
|
|
134
|
+
"baselineCommit": self.baseline_commit,
|
|
135
|
+
"filters": self.filters.as_dict(),
|
|
136
|
+
"scopeType": self.scope_type,
|
|
137
|
+
"subjects": [_serialize_subject(subject) for subject in self.subjects],
|
|
138
|
+
"identityWarnings": list(self.identity_warnings),
|
|
139
|
+
"ruleVersions": dict(self.rule_versions),
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _serialize_subject(subject: SnapshotSubject) -> dict[str, Any]:
|
|
144
|
+
return {
|
|
145
|
+
"person": {
|
|
146
|
+
"id": subject.person.id,
|
|
147
|
+
"name": subject.person.name,
|
|
148
|
+
"email": subject.person.email,
|
|
149
|
+
"kind": subject.person.kind,
|
|
150
|
+
"confirmed": subject.person.confirmed,
|
|
151
|
+
},
|
|
152
|
+
"commits": [
|
|
153
|
+
{
|
|
154
|
+
"hash": commit.hash,
|
|
155
|
+
"subject": commit.subject,
|
|
156
|
+
"authoredAt": commit.authored_at.isoformat(),
|
|
157
|
+
"periodAt": commit.period_at.isoformat() if commit.period_at else None,
|
|
158
|
+
"commitType": commit.commit_type,
|
|
159
|
+
"deliveryStatus": commit.delivery_status,
|
|
160
|
+
"paths": sorted(commit.paths),
|
|
161
|
+
"modules": sorted(commit.modules),
|
|
162
|
+
"insertions": commit.insertions,
|
|
163
|
+
"deletions": commit.deletions,
|
|
164
|
+
"filesChanged": commit.files_changed,
|
|
165
|
+
"merge": commit.merge,
|
|
166
|
+
"binaryFiles": commit.binary_files,
|
|
167
|
+
"generatedFiles": commit.generated_files,
|
|
168
|
+
"patchId": commit.patch_id,
|
|
169
|
+
"revertsHash": commit.reverts_hash,
|
|
170
|
+
"effectiveInsertions": commit.effective_insertions,
|
|
171
|
+
"effectiveDeletions": commit.effective_deletions,
|
|
172
|
+
"effectiveFilesChanged": commit.effective_files_changed,
|
|
173
|
+
}
|
|
174
|
+
for commit in sorted(subject.commits, key=lambda value: (value.authored_at, value.hash))
|
|
175
|
+
],
|
|
176
|
+
"contributionItems": [
|
|
177
|
+
{
|
|
178
|
+
"id": item.id,
|
|
179
|
+
"groupKey": item.group_key,
|
|
180
|
+
"title": item.title,
|
|
181
|
+
"confidence": item.confidence,
|
|
182
|
+
"commitHashes": sorted(commit.hash for commit in item.commits),
|
|
183
|
+
"evidenceIds": sorted(item.evidence_ids),
|
|
184
|
+
}
|
|
185
|
+
for item in sorted(subject.contribution_items, key=lambda value: value.id)
|
|
186
|
+
],
|
|
187
|
+
"evidence": [
|
|
188
|
+
{
|
|
189
|
+
"id": entry.id,
|
|
190
|
+
"type": entry.evidence_type,
|
|
191
|
+
"summary": entry.summary,
|
|
192
|
+
"commitHashes": sorted(entry.commit_hashes),
|
|
193
|
+
"paths": sorted(entry.paths),
|
|
194
|
+
"metrics": dict(sorted(entry.metrics)),
|
|
195
|
+
}
|
|
196
|
+
for entry in sorted(subject.evidence, key=lambda value: value.id)
|
|
197
|
+
],
|
|
198
|
+
"capabilities": [
|
|
199
|
+
{
|
|
200
|
+
"capability": capability.capability,
|
|
201
|
+
"confidence": capability.confidence,
|
|
202
|
+
"rationale": capability.rationale,
|
|
203
|
+
"evidenceIds": sorted(capability.evidence_ids),
|
|
204
|
+
"gaps": sorted(capability.gaps),
|
|
205
|
+
}
|
|
206
|
+
for capability in sorted(subject.capabilities, key=lambda value: value.capability)
|
|
207
|
+
],
|
|
208
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from enum import StrEnum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class StructuralTimeStrategy(StrEnum):
|
|
10
|
+
LIFETIME = "LIFETIME"
|
|
11
|
+
ROLLING_WINDOW = "ROLLING_WINDOW"
|
|
12
|
+
DUAL_WINDOW = "DUAL_WINDOW"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True, slots=True)
|
|
16
|
+
class StructuralRuleConfig:
|
|
17
|
+
time_strategy: StructuralTimeStrategy = StructuralTimeStrategy.LIFETIME
|
|
18
|
+
minimum_baseline_commits: int = 2
|
|
19
|
+
hotspot_percentile: float = 0.90
|
|
20
|
+
minimum_co_change_count: int = 2
|
|
21
|
+
minimum_subset_ratio: float = 0.75
|
|
22
|
+
minimum_jaccard: float = 0.20
|
|
23
|
+
minimum_hub_penalty: float = 0.0
|
|
24
|
+
maximum_context_paths: int = 200
|
|
25
|
+
rolling_window_days: int = 365
|
|
26
|
+
|
|
27
|
+
def __post_init__(self) -> None:
|
|
28
|
+
if self.minimum_baseline_commits < 1:
|
|
29
|
+
raise ValueError("minimum_baseline_commits must be positive")
|
|
30
|
+
if self.minimum_co_change_count < 1:
|
|
31
|
+
raise ValueError("minimum_co_change_count must be positive")
|
|
32
|
+
if self.maximum_context_paths < 1:
|
|
33
|
+
raise ValueError("maximum_context_paths must be positive")
|
|
34
|
+
if self.rolling_window_days < 1:
|
|
35
|
+
raise ValueError("rolling_window_days must be positive")
|
|
36
|
+
for name, value in (
|
|
37
|
+
("hotspot_percentile", self.hotspot_percentile),
|
|
38
|
+
("minimum_subset_ratio", self.minimum_subset_ratio),
|
|
39
|
+
("minimum_jaccard", self.minimum_jaccard),
|
|
40
|
+
("minimum_hub_penalty", self.minimum_hub_penalty),
|
|
41
|
+
):
|
|
42
|
+
if not 0 <= value <= 1:
|
|
43
|
+
raise ValueError(f"{name} must be between 0 and 1")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True, slots=True)
|
|
47
|
+
class StructuralFileCount:
|
|
48
|
+
path: str
|
|
49
|
+
change_count: int
|
|
50
|
+
recent_change_count: int
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True, slots=True)
|
|
54
|
+
class StructuralEdgeCount:
|
|
55
|
+
left_path: str
|
|
56
|
+
right_path: str
|
|
57
|
+
co_change_count: int
|
|
58
|
+
recent_co_change_count: int
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass(frozen=True, slots=True)
|
|
62
|
+
class StructuralFileMetric:
|
|
63
|
+
path: str
|
|
64
|
+
change_count: int
|
|
65
|
+
percentile: float
|
|
66
|
+
recent_percentile: float
|
|
67
|
+
confidence: str
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True, slots=True)
|
|
71
|
+
class StructuralEdgeMetric:
|
|
72
|
+
left_path: str
|
|
73
|
+
right_path: str
|
|
74
|
+
co_change_count: int
|
|
75
|
+
subset_ratio: float
|
|
76
|
+
left_conditional: float
|
|
77
|
+
right_conditional: float
|
|
78
|
+
jaccard: float
|
|
79
|
+
hub_penalty: float
|
|
80
|
+
cross_module: bool
|
|
81
|
+
confidence: str
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(frozen=True, slots=True)
|
|
85
|
+
class StructuralBaselineSummary:
|
|
86
|
+
eligible_commits: int
|
|
87
|
+
eligible_files: int
|
|
88
|
+
raw_edges: int
|
|
89
|
+
capped_commits: int
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@dataclass(frozen=True, slots=True)
|
|
93
|
+
class StructuralMaterialization:
|
|
94
|
+
baseline_id: str
|
|
95
|
+
file_metrics: tuple[StructuralFileMetric, ...]
|
|
96
|
+
edge_metrics: tuple[StructuralEdgeMetric, ...]
|
|
97
|
+
confidence: str
|
|
98
|
+
gaps: tuple[str, ...]
|
|
99
|
+
limitations: tuple[str, ...]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@dataclass(frozen=True, slots=True)
|
|
103
|
+
class StructuralBaseline:
|
|
104
|
+
id: str
|
|
105
|
+
cutoff: datetime
|
|
106
|
+
config: StructuralRuleConfig
|
|
107
|
+
summary: StructuralBaselineSummary
|
|
108
|
+
file_counts: tuple[StructuralFileCount, ...]
|
|
109
|
+
edge_counts: tuple[StructuralEdgeCount, ...]
|
|
110
|
+
materialization: StructuralMaterialization
|
|
111
|
+
supporting_commits: Mapping[str, tuple[str, ...]]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@dataclass(frozen=True, slots=True)
|
|
115
|
+
class WorkItemStructuralContext:
|
|
116
|
+
baseline_id: str
|
|
117
|
+
hotspot_exposures: tuple[StructuralFileMetric, ...]
|
|
118
|
+
coupling_exposures: tuple[StructuralEdgeMetric, ...]
|
|
119
|
+
confidence: str
|
|
120
|
+
gaps: tuple[str, ...]
|