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,498 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from git_contribution_analyzer.domain.models.resume import (
|
|
9
|
+
ClaimStrength,
|
|
10
|
+
OmittedClaim,
|
|
11
|
+
ResumeClaim,
|
|
12
|
+
ResumeLanguage,
|
|
13
|
+
ResumeStyle,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
REPO_KEY_PATTERN = re.compile(r"^[A-Za-z0-9_.-]+$")
|
|
17
|
+
QUALIFIED_EVIDENCE_ID_PATTERN = re.compile(r"^[A-Za-z0-9_.-]+:EV-\d+$")
|
|
18
|
+
QUALIFIED_ITEM_ID_PATTERN = re.compile(r"^[A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+$")
|
|
19
|
+
BARE_EVIDENCE_ID_PATTERN = re.compile(r"^EV-\d+$")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True, slots=True)
|
|
23
|
+
class PortfolioRepoSpec:
|
|
24
|
+
repo_key: str
|
|
25
|
+
group: str
|
|
26
|
+
path: str
|
|
27
|
+
target_branch: str | None = None
|
|
28
|
+
|
|
29
|
+
def __post_init__(self) -> None:
|
|
30
|
+
if not REPO_KEY_PATTERN.match(self.repo_key):
|
|
31
|
+
raise ValueError(f"Invalid repo_key: {self.repo_key!r}")
|
|
32
|
+
if not self.group.strip():
|
|
33
|
+
raise ValueError("group must be non-empty")
|
|
34
|
+
if not self.path.strip():
|
|
35
|
+
raise ValueError("path must be non-empty")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True, slots=True)
|
|
39
|
+
class PortfolioIdentityAlias:
|
|
40
|
+
email: str
|
|
41
|
+
name: str | None = None
|
|
42
|
+
|
|
43
|
+
def __post_init__(self) -> None:
|
|
44
|
+
if not self.email.strip() or "@" not in self.email:
|
|
45
|
+
raise ValueError(f"Alias requires an explicit email address: {self.email!r}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True, slots=True)
|
|
49
|
+
class PortfolioIdentityRule:
|
|
50
|
+
canonical_name: str
|
|
51
|
+
canonical_email: str
|
|
52
|
+
aliases: tuple[PortfolioIdentityAlias, ...] = ()
|
|
53
|
+
|
|
54
|
+
def __post_init__(self) -> None:
|
|
55
|
+
if not self.canonical_name.strip():
|
|
56
|
+
raise ValueError("canonical_name must be non-empty")
|
|
57
|
+
if not self.canonical_email.strip() or "@" not in self.canonical_email:
|
|
58
|
+
raise ValueError(f"Invalid canonical_email: {self.canonical_email!r}")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass(frozen=True, slots=True)
|
|
62
|
+
class PortfolioManifest:
|
|
63
|
+
name: str
|
|
64
|
+
repositories: tuple[PortfolioRepoSpec, ...]
|
|
65
|
+
identities: tuple[PortfolioIdentityRule, ...] = ()
|
|
66
|
+
discovery_roots: tuple[str, ...] = ()
|
|
67
|
+
exclude_patterns: tuple[str, ...] = ()
|
|
68
|
+
schema_version: str = "1.0"
|
|
69
|
+
|
|
70
|
+
def __post_init__(self) -> None:
|
|
71
|
+
if not self.name.strip():
|
|
72
|
+
raise ValueError("Portfolio name must be non-empty")
|
|
73
|
+
seen: set[str] = set()
|
|
74
|
+
for repo in self.repositories:
|
|
75
|
+
if repo.repo_key in seen:
|
|
76
|
+
raise ValueError(f"Duplicate repo_key in portfolio manifest: {repo.repo_key!r}")
|
|
77
|
+
seen.add(repo.repo_key)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass(frozen=True, slots=True)
|
|
81
|
+
class RepoDifficultyCounts:
|
|
82
|
+
high_risk: int = 0
|
|
83
|
+
standard: int = 0
|
|
84
|
+
routine: int = 0
|
|
85
|
+
complex: int = 0
|
|
86
|
+
|
|
87
|
+
def __post_init__(self) -> None:
|
|
88
|
+
for field_name, value in (
|
|
89
|
+
("high_risk", self.high_risk),
|
|
90
|
+
("standard", self.standard),
|
|
91
|
+
("routine", self.routine),
|
|
92
|
+
("complex", self.complex),
|
|
93
|
+
):
|
|
94
|
+
if value < 0:
|
|
95
|
+
raise ValueError(f"{field_name} must be non-negative")
|
|
96
|
+
|
|
97
|
+
def to_schema_dict(self) -> dict[str, int]:
|
|
98
|
+
return {
|
|
99
|
+
"HIGH_RISK": self.high_risk,
|
|
100
|
+
"STANDARD": self.standard,
|
|
101
|
+
"ROUTINE": self.routine,
|
|
102
|
+
"COMPLEX": self.complex,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@dataclass(frozen=True, slots=True)
|
|
107
|
+
class RepoPortfolioObservation:
|
|
108
|
+
repo_key: str
|
|
109
|
+
group: str
|
|
110
|
+
branch: str
|
|
111
|
+
indexed_head_commit: str | None
|
|
112
|
+
commits: int
|
|
113
|
+
landed_commits: int
|
|
114
|
+
released_commits: int
|
|
115
|
+
authored_only_commits: int
|
|
116
|
+
reverted_commits: int
|
|
117
|
+
merge_commits: int
|
|
118
|
+
file_change_records: int
|
|
119
|
+
insertions: int
|
|
120
|
+
deletions: int
|
|
121
|
+
completed_items: int
|
|
122
|
+
pending_items: int
|
|
123
|
+
rework_items: int
|
|
124
|
+
integration_items: int
|
|
125
|
+
difficulty: RepoDifficultyCounts
|
|
126
|
+
commits_by_email: Mapping[str, int]
|
|
127
|
+
high_confidence_capabilities: tuple[str, ...] = ()
|
|
128
|
+
has_hotspot_signal: bool = False
|
|
129
|
+
has_coupling_signal: bool = False
|
|
130
|
+
historical_baseline_builds: int = 0
|
|
131
|
+
first_authored_at: str | None = None
|
|
132
|
+
last_authored_at: str | None = None
|
|
133
|
+
evidence_ids: tuple[str, ...] = ()
|
|
134
|
+
|
|
135
|
+
def __post_init__(self) -> None:
|
|
136
|
+
if not REPO_KEY_PATTERN.match(self.repo_key):
|
|
137
|
+
raise ValueError(f"Invalid repo_key: {self.repo_key!r}")
|
|
138
|
+
if not self.group.strip():
|
|
139
|
+
raise ValueError("group must be non-empty")
|
|
140
|
+
if not self.branch.strip():
|
|
141
|
+
raise ValueError("branch must be non-empty")
|
|
142
|
+
for field_name, value in (
|
|
143
|
+
("commits", self.commits),
|
|
144
|
+
("landed_commits", self.landed_commits),
|
|
145
|
+
("released_commits", self.released_commits),
|
|
146
|
+
("authored_only_commits", self.authored_only_commits),
|
|
147
|
+
("reverted_commits", self.reverted_commits),
|
|
148
|
+
("merge_commits", self.merge_commits),
|
|
149
|
+
("file_change_records", self.file_change_records),
|
|
150
|
+
("insertions", self.insertions),
|
|
151
|
+
("deletions", self.deletions),
|
|
152
|
+
("completed_items", self.completed_items),
|
|
153
|
+
("pending_items", self.pending_items),
|
|
154
|
+
("rework_items", self.rework_items),
|
|
155
|
+
("integration_items", self.integration_items),
|
|
156
|
+
("historical_baseline_builds", self.historical_baseline_builds),
|
|
157
|
+
):
|
|
158
|
+
if value < 0:
|
|
159
|
+
raise ValueError(f"{field_name} must be non-negative")
|
|
160
|
+
if self.delivered_commits > self.commits:
|
|
161
|
+
raise ValueError("delivered_commits cannot exceed total commits")
|
|
162
|
+
|
|
163
|
+
@property
|
|
164
|
+
def delivered_commits(self) -> int:
|
|
165
|
+
return self.landed_commits + self.released_commits
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@dataclass(frozen=True, slots=True)
|
|
169
|
+
class PortfolioIdentitySummary:
|
|
170
|
+
canonical_name: str
|
|
171
|
+
canonical_email: str
|
|
172
|
+
merged_selectors: tuple[str, ...]
|
|
173
|
+
commits_by_email: Mapping[str, int]
|
|
174
|
+
notes: tuple[str, ...]
|
|
175
|
+
|
|
176
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
177
|
+
return {
|
|
178
|
+
"canonicalName": self.canonical_name,
|
|
179
|
+
"canonicalEmail": self.canonical_email,
|
|
180
|
+
"mergedSelectors": list(self.merged_selectors),
|
|
181
|
+
"commitsByEmail": dict(sorted(self.commits_by_email.items())),
|
|
182
|
+
"notes": list(self.notes),
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
@dataclass(frozen=True, slots=True)
|
|
187
|
+
class PortfolioScopeSummary:
|
|
188
|
+
discovered_repositories: int
|
|
189
|
+
matched_repositories: int
|
|
190
|
+
failed_repositories: int
|
|
191
|
+
first_authored_at: str | None
|
|
192
|
+
last_authored_at: str | None
|
|
193
|
+
|
|
194
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
195
|
+
return {
|
|
196
|
+
"discoveredRepositories": self.discovered_repositories,
|
|
197
|
+
"matchedRepositories": self.matched_repositories,
|
|
198
|
+
"failedRepositories": self.failed_repositories,
|
|
199
|
+
"firstAuthoredAt": self.first_authored_at,
|
|
200
|
+
"lastAuthoredAt": self.last_authored_at,
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@dataclass(frozen=True, slots=True)
|
|
205
|
+
class PortfolioTotals:
|
|
206
|
+
commits: int
|
|
207
|
+
delivered_commits: int
|
|
208
|
+
landed_commits: int
|
|
209
|
+
released_commits: int
|
|
210
|
+
authored_only_commits: int
|
|
211
|
+
reverted_commits: int
|
|
212
|
+
merge_commits: int
|
|
213
|
+
file_change_records: int
|
|
214
|
+
insertions: int
|
|
215
|
+
deletions: int
|
|
216
|
+
completed_items: int
|
|
217
|
+
pending_items: int
|
|
218
|
+
rework_items: int
|
|
219
|
+
integration_items: int
|
|
220
|
+
difficulty: RepoDifficultyCounts
|
|
221
|
+
|
|
222
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
223
|
+
return {
|
|
224
|
+
"commits": self.commits,
|
|
225
|
+
"deliveredCommits": self.delivered_commits,
|
|
226
|
+
"landedCommits": self.landed_commits,
|
|
227
|
+
"releasedCommits": self.released_commits,
|
|
228
|
+
"authoredOnlyCommits": self.authored_only_commits,
|
|
229
|
+
"revertedCommits": self.reverted_commits,
|
|
230
|
+
"mergeCommits": self.merge_commits,
|
|
231
|
+
"fileChangeRecords": self.file_change_records,
|
|
232
|
+
"insertions": self.insertions,
|
|
233
|
+
"deletions": self.deletions,
|
|
234
|
+
"completedItems": self.completed_items,
|
|
235
|
+
"pendingItems": self.pending_items,
|
|
236
|
+
"reworkItems": self.rework_items,
|
|
237
|
+
"integrationItems": self.integration_items,
|
|
238
|
+
"difficulty": self.difficulty.to_schema_dict(),
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@dataclass(frozen=True, slots=True)
|
|
243
|
+
class PortfolioGroupSummary:
|
|
244
|
+
name: str
|
|
245
|
+
repositories: int
|
|
246
|
+
commits: int
|
|
247
|
+
delivered_commits: int
|
|
248
|
+
authored_only_commits: int
|
|
249
|
+
merge_commits: int
|
|
250
|
+
file_change_records: int
|
|
251
|
+
insertions: int
|
|
252
|
+
deletions: int
|
|
253
|
+
completed_items: int
|
|
254
|
+
pending_items: int
|
|
255
|
+
high_risk_items: int
|
|
256
|
+
|
|
257
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
258
|
+
return {
|
|
259
|
+
"name": self.name,
|
|
260
|
+
"repositories": self.repositories,
|
|
261
|
+
"commits": self.commits,
|
|
262
|
+
"deliveredCommits": self.delivered_commits,
|
|
263
|
+
"authoredOnlyCommits": self.authored_only_commits,
|
|
264
|
+
"mergeCommits": self.merge_commits,
|
|
265
|
+
"fileChangeRecords": self.file_change_records,
|
|
266
|
+
"insertions": self.insertions,
|
|
267
|
+
"deletions": self.deletions,
|
|
268
|
+
"completedItems": self.completed_items,
|
|
269
|
+
"pendingItems": self.pending_items,
|
|
270
|
+
"highRiskItems": self.high_risk_items,
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
@dataclass(frozen=True, slots=True)
|
|
275
|
+
class PortfolioCapabilityCoverage:
|
|
276
|
+
capability: str
|
|
277
|
+
repositories: int
|
|
278
|
+
|
|
279
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
280
|
+
return {
|
|
281
|
+
"capability": self.capability,
|
|
282
|
+
"repositories": self.repositories,
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
@dataclass(frozen=True, slots=True)
|
|
287
|
+
class PortfolioStructuralObservation:
|
|
288
|
+
hotspot_signal_repositories: int
|
|
289
|
+
coupling_signal_repositories: int
|
|
290
|
+
historical_baseline_builds: int
|
|
291
|
+
affects_difficulty_ranking_or_resume: bool = False
|
|
292
|
+
note: str = "Structural signals are observation-only and do not alter difficulty or ranking."
|
|
293
|
+
|
|
294
|
+
def __post_init__(self) -> None:
|
|
295
|
+
if self.affects_difficulty_ranking_or_resume:
|
|
296
|
+
raise ValueError("Portfolio structural observations must remain observation-only")
|
|
297
|
+
|
|
298
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
299
|
+
return {
|
|
300
|
+
"hotspotSignalRepositories": self.hotspot_signal_repositories,
|
|
301
|
+
"couplingSignalRepositories": self.coupling_signal_repositories,
|
|
302
|
+
"historicalBaselineBuilds": self.historical_baseline_builds,
|
|
303
|
+
"affectsDifficultyRankingOrResume": False,
|
|
304
|
+
"note": self.note,
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@dataclass(frozen=True, slots=True)
|
|
309
|
+
class PortfolioRepoSummary:
|
|
310
|
+
repo_key: str
|
|
311
|
+
group: str
|
|
312
|
+
branch: str
|
|
313
|
+
indexed_head_commit: str | None
|
|
314
|
+
commits: int
|
|
315
|
+
delivered: int
|
|
316
|
+
authored_only: int
|
|
317
|
+
completed_items: int
|
|
318
|
+
pending_items: int
|
|
319
|
+
|
|
320
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
321
|
+
return {
|
|
322
|
+
"repoKey": self.repo_key,
|
|
323
|
+
"group": self.group,
|
|
324
|
+
"branch": self.branch,
|
|
325
|
+
"indexedHeadCommit": self.indexed_head_commit,
|
|
326
|
+
"commits": self.commits,
|
|
327
|
+
"delivered": self.delivered,
|
|
328
|
+
"authoredOnly": self.authored_only,
|
|
329
|
+
"completedItems": self.completed_items,
|
|
330
|
+
"pendingItems": self.pending_items,
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
@dataclass(frozen=True, slots=True)
|
|
335
|
+
class PortfolioSummary:
|
|
336
|
+
portfolio_snapshot_id: str
|
|
337
|
+
portfolio_name: str
|
|
338
|
+
gca_version: str
|
|
339
|
+
mode: str
|
|
340
|
+
identity: PortfolioIdentitySummary
|
|
341
|
+
scope: PortfolioScopeSummary
|
|
342
|
+
totals: PortfolioTotals
|
|
343
|
+
groups: tuple[PortfolioGroupSummary, ...]
|
|
344
|
+
high_confidence_capabilities: tuple[PortfolioCapabilityCoverage, ...]
|
|
345
|
+
structural_observation: PortfolioStructuralObservation
|
|
346
|
+
repositories: tuple[PortfolioRepoSummary, ...]
|
|
347
|
+
warnings: tuple[str, ...]
|
|
348
|
+
limitations: tuple[str, ...]
|
|
349
|
+
schema_version: str = "1.0"
|
|
350
|
+
report_type: str = "PORTFOLIO_SUMMARY"
|
|
351
|
+
|
|
352
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
353
|
+
return {
|
|
354
|
+
"schemaVersion": self.schema_version,
|
|
355
|
+
"reportType": self.report_type,
|
|
356
|
+
"portfolioSnapshotId": self.portfolio_snapshot_id,
|
|
357
|
+
"portfolioName": self.portfolio_name,
|
|
358
|
+
"gcaVersion": self.gca_version,
|
|
359
|
+
"mode": self.mode,
|
|
360
|
+
"identity": self.identity.to_schema_dict(),
|
|
361
|
+
"scope": self.scope.to_schema_dict(),
|
|
362
|
+
"totals": self.totals.to_schema_dict(),
|
|
363
|
+
"groups": [group.to_schema_dict() for group in self.groups],
|
|
364
|
+
"highConfidenceCapabilities": [
|
|
365
|
+
item.to_schema_dict() for item in self.high_confidence_capabilities
|
|
366
|
+
],
|
|
367
|
+
"structuralObservation": self.structural_observation.to_schema_dict(),
|
|
368
|
+
"repositories": [repo.to_schema_dict() for repo in self.repositories],
|
|
369
|
+
"warnings": list(self.warnings),
|
|
370
|
+
"limitations": list(self.limitations),
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@dataclass(frozen=True, slots=True)
|
|
375
|
+
class RepoResumeCandidateItem:
|
|
376
|
+
repo_key: str
|
|
377
|
+
group: str
|
|
378
|
+
item_id: str
|
|
379
|
+
evidence_ids: tuple[str, ...]
|
|
380
|
+
summary_text: str
|
|
381
|
+
claim_strength: ClaimStrength
|
|
382
|
+
confidence: str
|
|
383
|
+
pending: bool
|
|
384
|
+
capabilities: tuple[str, ...] = ()
|
|
385
|
+
verified_outcome_ids: tuple[str, ...] = ()
|
|
386
|
+
|
|
387
|
+
def __post_init__(self) -> None:
|
|
388
|
+
if not REPO_KEY_PATTERN.match(self.repo_key):
|
|
389
|
+
raise ValueError(f"Invalid repo_key: {self.repo_key!r}")
|
|
390
|
+
if not self.item_id.strip():
|
|
391
|
+
raise ValueError("item_id must be non-empty")
|
|
392
|
+
if not self.evidence_ids:
|
|
393
|
+
raise ValueError("evidence_ids must be non-empty")
|
|
394
|
+
if not self.summary_text.strip():
|
|
395
|
+
raise ValueError("summary_text must be non-empty")
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
@dataclass(frozen=True, slots=True)
|
|
399
|
+
class PortfolioResumeGroup:
|
|
400
|
+
group: str
|
|
401
|
+
repositories: int
|
|
402
|
+
commits: int
|
|
403
|
+
delivered_commits: int
|
|
404
|
+
bullets: tuple[ResumeClaim, ...]
|
|
405
|
+
|
|
406
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
407
|
+
return {
|
|
408
|
+
"group": self.group,
|
|
409
|
+
"repositories": self.repositories,
|
|
410
|
+
"commits": self.commits,
|
|
411
|
+
"deliveredCommits": self.delivered_commits,
|
|
412
|
+
"bullets": [
|
|
413
|
+
{
|
|
414
|
+
"text": bullet.text,
|
|
415
|
+
"claimStrength": bullet.claim_strength.value,
|
|
416
|
+
"contributionItemIds": list(bullet.contribution_item_ids),
|
|
417
|
+
"evidenceIds": list(bullet.evidence_ids),
|
|
418
|
+
"verifiedOutcomeIds": list(bullet.verified_outcome_ids),
|
|
419
|
+
"confidence": bullet.confidence,
|
|
420
|
+
"pending": bullet.pending,
|
|
421
|
+
}
|
|
422
|
+
for bullet in self.bullets
|
|
423
|
+
],
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
@dataclass(frozen=True, slots=True)
|
|
428
|
+
class PortfolioSkillCoverage:
|
|
429
|
+
capability: str
|
|
430
|
+
repositories: int
|
|
431
|
+
evidence_ids: tuple[str, ...]
|
|
432
|
+
|
|
433
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
434
|
+
return {
|
|
435
|
+
"capability": self.capability,
|
|
436
|
+
"repositories": self.repositories,
|
|
437
|
+
"evidenceIds": list(self.evidence_ids),
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
@dataclass(frozen=True, slots=True)
|
|
442
|
+
class PortfolioResume:
|
|
443
|
+
portfolio_snapshot_id: str
|
|
444
|
+
person_name: str
|
|
445
|
+
target_role: str
|
|
446
|
+
language: ResumeLanguage
|
|
447
|
+
style: ResumeStyle
|
|
448
|
+
professional_summary: str
|
|
449
|
+
project_groups: tuple[PortfolioResumeGroup, ...]
|
|
450
|
+
representative_skills: tuple[PortfolioSkillCoverage, ...]
|
|
451
|
+
pending_self_inputs: tuple[str, ...]
|
|
452
|
+
omitted_claims: tuple[OmittedClaim, ...]
|
|
453
|
+
warnings: tuple[str, ...]
|
|
454
|
+
limitations: tuple[str, ...]
|
|
455
|
+
schema_version: str = "1.0"
|
|
456
|
+
report_type: str = "PORTFOLIO_RESUME"
|
|
457
|
+
|
|
458
|
+
def to_schema_dict(self) -> dict[str, Any]:
|
|
459
|
+
return {
|
|
460
|
+
"schemaVersion": self.schema_version,
|
|
461
|
+
"reportType": self.report_type,
|
|
462
|
+
"portfolioSnapshotId": self.portfolio_snapshot_id,
|
|
463
|
+
"person": {"name": self.person_name},
|
|
464
|
+
"targetRole": self.target_role,
|
|
465
|
+
"language": self.language.value,
|
|
466
|
+
"style": self.style.value,
|
|
467
|
+
"professionalSummary": self.professional_summary,
|
|
468
|
+
"projectGroups": [group.to_schema_dict() for group in self.project_groups],
|
|
469
|
+
"representativeSkills": [
|
|
470
|
+
skill.to_schema_dict() for skill in self.representative_skills
|
|
471
|
+
],
|
|
472
|
+
"pendingSelfInputs": list(self.pending_self_inputs),
|
|
473
|
+
"omittedClaims": [
|
|
474
|
+
{
|
|
475
|
+
"candidate": omitted.candidate,
|
|
476
|
+
"reasonCode": omitted.reason_code,
|
|
477
|
+
"missingEvidence": list(omitted.missing_evidence),
|
|
478
|
+
}
|
|
479
|
+
for omitted in self.omitted_claims
|
|
480
|
+
],
|
|
481
|
+
"warnings": list(self.warnings),
|
|
482
|
+
"limitations": list(self.limitations),
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
@dataclass(frozen=True, slots=True)
|
|
487
|
+
class PortfolioVerificationIssue:
|
|
488
|
+
code: str
|
|
489
|
+
message: str
|
|
490
|
+
location: str | None = None
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
@dataclass(frozen=True, slots=True)
|
|
494
|
+
class PortfolioVerificationReport:
|
|
495
|
+
ok: bool
|
|
496
|
+
issues: tuple[PortfolioVerificationIssue, ...]
|
|
497
|
+
checked_repositories: int
|
|
498
|
+
checked_evidence_references: int
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from decimal import Decimal
|
|
4
|
+
from typing import Any, Self
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RankingWeights(BaseModel):
|
|
10
|
+
model_config = ConfigDict(extra="forbid")
|
|
11
|
+
|
|
12
|
+
workload: Decimal = Field(ge=0, le=1)
|
|
13
|
+
difficulty: Decimal = Field(ge=0, le=1)
|
|
14
|
+
delivery: Decimal = Field(ge=0, le=1)
|
|
15
|
+
|
|
16
|
+
@model_validator(mode="after")
|
|
17
|
+
def validate_values(self) -> Self:
|
|
18
|
+
values = (self.workload, self.difficulty, self.delivery)
|
|
19
|
+
if any(not value.is_finite() for value in values):
|
|
20
|
+
raise ValueError("ranking weights must be finite")
|
|
21
|
+
if sum(values, start=Decimal(0)) != Decimal(1):
|
|
22
|
+
raise ValueError("ranking weights must sum exactly to 1.0")
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class RankingConfig(BaseModel):
|
|
27
|
+
model_config = ConfigDict(extra="forbid", populate_by_name=True)
|
|
28
|
+
|
|
29
|
+
schema_version: str = Field(alias="schemaVersion", pattern=r"^1\.0$")
|
|
30
|
+
ranking_rule_version: str = Field(
|
|
31
|
+
alias="rankingRuleVersion", pattern=r"^performance-ranking-v1$"
|
|
32
|
+
)
|
|
33
|
+
weights: RankingWeights
|
|
34
|
+
normalization: str = Field(pattern=r"^cohort-max$")
|
|
35
|
+
ties: str = Field(pattern=r"^dense$")
|
|
36
|
+
|
|
37
|
+
def as_dict(self) -> dict[str, Any]:
|
|
38
|
+
return {
|
|
39
|
+
"schemaVersion": self.schema_version,
|
|
40
|
+
"rankingRuleVersion": self.ranking_rule_version,
|
|
41
|
+
"weights": {
|
|
42
|
+
"workload": str(self.weights.workload),
|
|
43
|
+
"difficulty": str(self.weights.difficulty),
|
|
44
|
+
"delivery": str(self.weights.delivery),
|
|
45
|
+
},
|
|
46
|
+
"normalization": self.normalization,
|
|
47
|
+
"ties": self.ties,
|
|
48
|
+
}
|