Skip to content

Commit e0280b7

Browse files
committed
feat(vscode,report): rename overloaded modules canonically and harden the VS Code surface
1 parent 7c92fbd commit e0280b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6161
-1389
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ docs
1818
codeclone.egg-info
1919
.pre-commit-config.yaml
2020
uv.lock
21+
extensions

.github/actions/codeclone/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Explicit prerelease:
149149

150150
```yaml
151151
with:
152-
package-version: "2.0.0b3"
152+
package-version: "2.0.0b4"
153153
```
154154

155155
Local/self-repo validation:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ site/
3838
/docs/SPEC-2.0.0.md
3939
/.uv-cache/
4040
/package-lock.json
41+
extensions/vscode-codeclone/node_modules

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ Use modern syntax when it stays compatible with 3.10+:
574574
Prefer these rules:
575575

576576
- **Domain / contracts / enums** live near the domain owner (baseline statuses in baseline domain).
577-
- If a module becomes a “god module”, split by:
577+
- If a module becomes an “overloaded module”, split by:
578578
- model (types)
579579
- io/serialization
580580
- rules/validation

CHANGELOG.md

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,35 @@
22

33
## [2.0.0b4]
44

5-
2.0.0b4 deepens the platform model introduced in b3: MCP becomes more self-guiding, report-only analysis expands with
6-
module-level hotspot ranking, findings and suggestions are separated more cleanly by role, Health Score documentation
7-
now formalizes phased score-model evolution, and CodeClone gains its first native IDE surface in preview.
8-
95
### MCP server
106

11-
- Add bounded MCP `help(topic=...)` as a compact uncertainty-recovery and semantic-routing tool for workflow, baseline,
12-
suppressions, latest-run semantics, review state, and changed-scope routing.
7+
- Add `help(topic=...)` tool for workflow guidance, baseline semantics, and review-state routing.
8+
- Optimize MCP payloads: short finding IDs (sha256-based for block clones), compact `derived` section projection,
9+
bounded `metrics_detail` with pagination.
1310

1411
### Report contract
1512

16-
- Bump canonical report schema to `2.3` and add `metrics.families.god_modules` as a project-relative, report-only
17-
module-hotspot layer.
18-
- Surface `God Modules` consistently across canonical JSON, text/markdown, HTML Overview + Quality projections, and
19-
bounded MCP `metrics_detail` access without changing findings, health, gates, baseline semantics, or SARIF.
20-
- Tighten the findings/suggestions role split: low-signal local structural `info` hints remain canonical findings,
21-
while separate suggestion cards are reserved for action-surplus cases and structural findings can render compact
22-
inline suggested action in HTML.
13+
- Bump canonical report schema to `2.3`.
14+
- Add `metrics.overloaded_modules` — report-only module-hotspot ranking by size, complexity, and coupling pressure.
15+
- Surface Overloaded Modules across JSON, text/markdown, HTML, and MCP without affecting findings, health, or gates.
16+
- Normalize the canonical family name and MCP/report output to `overloaded_modules`; `god_modules` remains accepted as a read-only MCP input alias during transition.
2317

2418
### CLI and HTML
2519

26-
- Align CLI and HTML scope summaries with canonical report-wide inventory totals.
27-
- Polish `God Modules` presentation so report-only module-hotspot summaries read consistently across surfaces.
20+
- Align CLI and HTML scope summaries with canonical inventory totals.
21+
- Redesign Overview tab: Executive Summary becomes 2-column (Issue Breakdown + Source Breakdown) with scan scope in
22+
the section subtitle; Overloaded Modules section replaces the earlier stretched module-hotspot layout.
2823

2924
### Documentation
3025

31-
- Add a dedicated Health Score chapter documenting current scoring inputs, report-only / non-scoring layers, and the
32-
phased policy for future health-model expansion.
33-
- Explicitly document that future releases may lower a repository score because the scoring model becomes broader or
34-
stricter, not only because the code became worse.
26+
- Add Health Score chapter: scoring inputs, report-only layers, phased expansion policy.
27+
- Document that future releases may lower scores due to broader scoring model, not only worse code.
3528

36-
### IDE integration
29+
### IDE integration (preview)
3730

38-
- Add a preview VS Code extension as the first native IDE surface for `codeclone-mcp`, bringing baseline-aware,
39-
triage-first structural review and guided source-first drill-down into the editor.
40-
- Establish the initial extension interaction model, including explicit setup/session semantics, review-loop navigation,
41-
hotspot focus persistence, lightweight Explorer decorations, safe HTML-report bridging, and accessibility/status
42-
polish.
43-
- Add extension-side regression coverage with Node unit tests, local extension-host smoke, and validated preview `.vsix`
44-
packaging.
31+
- Add VS Code extension (`codeclone-mcp` client) with baseline-aware triage, source drill-down, Explorer decorations,
32+
and HTML-report bridging.
33+
- Add Node unit tests, extension-host smoke tests, and `.vsix` packaging.
4534

4635
## [2.0.0b3] - 20260401
4736

README.md

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ Live sample report:
3939
- **Clone detection** — function (CFG fingerprint), block (statement windows), and segment (report-only) clones
4040
- **Structural findings** — duplicated branch families, clone guard/exit divergence and clone-cohort drift (report-only)
4141
- **Quality metrics** — cyclomatic complexity, coupling (`CBO`), cohesion (`LCOM4`), dependency cycles, dead code,
42-
health
43-
score, and report-only `God Modules` profiling
42+
health score, and report-only `Overloaded Modules` profiling
4443
- **Baseline governance** — separates accepted **legacy** debt from **new regressions** and lets CI fail **only** on
4544
what changed
4645
- **Reports** — interactive HTML, deterministic JSON/TXT plus Markdown and SARIF projections from one canonical report
47-
- **MCP server** — optional read-only MCP surface for AI agents and IDEs, designed as a budget-aware guided control
46+
- **MCP server** — optional read-only surface for AI agents and IDEs, designed as a budget-aware guided control
4847
surface for agentic development
49-
- **VS Code extension** — preview native client for CodeClone MCP with baseline-aware, triage-first structural
50-
review inside the editor
48+
- **VS Code extension** — preview native client for CodeClone MCP with triage-first structural review
5149
- **CI-first** — deterministic output, stable ordering, exit code contract, pre-commit support
5250
- **Fast** — incremental caching, parallel processing, warm-run optimization, and reproducible benchmark coverage
5351

@@ -170,18 +168,8 @@ codeclone-mcp --transport stdio
170168
codeclone-mcp --transport streamable-http --port 8000
171169
```
172170

173-
21 tools + 10 resources — deterministic, baseline-aware, and read-only.
174-
Never mutates source files, baselines, or repo state.
175-
176-
Payloads are optimized for LLM context: compact summaries by default, full detail on demand.
177-
The cheapest useful path is also the most obvious path: first-pass triage stays compact, and deeper detail is explicit.
178-
179-
Recommended agent flow:
180-
`analyze_repository` or `analyze_changed_paths``get_run_summary` or `get_production_triage`
181-
`list_hotspots` or `check_*``get_finding``get_remediation`
182-
183-
If workflow or contract meaning is unclear, `help(topic=...)` returns a compact
184-
semantic guide with the safest next step and canonical doc links.
171+
21 tools + 10 resources. Read-only — never mutates source, baselines, or repo state.
172+
Payloads are optimized for LLM context: compact summaries by default, full detail on drill-down.
185173

186174
Docs:
187175
[MCP usage guide](https://orenlab.github.io/codeclone/mcp/)
@@ -190,21 +178,10 @@ Docs:
190178

191179
### VS Code Extension
192180

193-
The repository also ships a preview VS Code extension in
181+
A preview VS Code extension ships in
194182
[`extensions/vscode-codeclone/`](https://github.com/orenlab/codeclone/tree/main/extensions/vscode-codeclone).
195-
196-
It is:
197-
198-
- native VS Code first
199-
- baseline-aware
200-
- triage-first
201-
- read-only with respect to repository state
202-
- powered by the same `codeclone-mcp` contract surface
203-
- limited in Restricted Mode until workspace trust is granted
204-
205-
It focuses on source-first structural review inside the editor: overview,
206-
hotspots, review loop, changed-files pass, and explicit drill-down into finding,
207-
remediation, or local HTML report when needed.
183+
It connects to `codeclone-mcp` and provides triage-first structural review inside the editor:
184+
overview, hotspots, review loop, and drill-down into findings or the HTML report.
208185

209186
Docs:
210187
[VS Code extension guide](https://orenlab.github.io/codeclone/vscode-extension/)
@@ -300,11 +277,11 @@ class Middleware: # codeclone: ignore[dead-code]
300277
Dynamic/runtime false positives are resolved via explicit inline suppressions, not via broad heuristics.
301278

302279
<details>
303-
<summary>Canonical JSON report shape (v2.2)</summary>
280+
<summary>Canonical JSON report shape (v2.3)</summary>
304281

305282
```json
306283
{
307-
"report_schema_version": "2.2",
284+
"report_schema_version": "2.3",
308285
"meta": {
309286
"codeclone_version": "2.0.0b4",
310287
"project_name": "...",

codeclone/_cli_summary.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class MetricsSnapshot:
2626
health_total: int
2727
health_grade: str
2828
suppressed_dead_code_count: int = 0
29-
god_modules_candidates: int = 0
30-
god_modules_total: int = 0
31-
god_modules_population_status: str = ""
32-
god_modules_top_score: float = 0.0
29+
overloaded_modules_candidates: int = 0
30+
overloaded_modules_total: int = 0
31+
overloaded_modules_population_status: str = ""
32+
overloaded_modules_top_score: float = 0.0
3333

3434

3535
@dataclass(frozen=True, slots=True)
@@ -136,7 +136,7 @@ def _print_metrics(
136136
dead=metrics.dead_code_count,
137137
health=metrics.health_total,
138138
grade=metrics.health_grade,
139-
god_modules=metrics.god_modules_candidates,
139+
overloaded_modules=metrics.overloaded_modules_candidates,
140140
)
141141
)
142142
else:
@@ -166,11 +166,11 @@ def _print_metrics(
166166
)
167167
)
168168
console.print(
169-
ui.fmt_metrics_god_modules(
170-
candidates=metrics.god_modules_candidates,
171-
total=metrics.god_modules_total,
172-
population_status=metrics.god_modules_population_status,
173-
top_score=metrics.god_modules_top_score,
169+
ui.fmt_metrics_overloaded_modules(
170+
candidates=metrics.overloaded_modules_candidates,
171+
total=metrics.overloaded_modules_total,
172+
population_status=metrics.overloaded_modules_population_status,
173+
top_score=metrics.overloaded_modules_top_score,
174174
)
175175
)
176176

codeclone/_html_css.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -683,23 +683,23 @@
683683
.dir-hotspot-meta{display:flex;flex-wrap:wrap;gap:6px;font-size:.68rem;color:var(--text-muted)}
684684
.dir-hotspot-meta span{font-variant-numeric:tabular-nums}
685685
.dir-hotspot-meta-sep{opacity:.3}
686-
.god-module-list{display:flex;flex-direction:column;gap:0}
687-
.god-module-entry{padding:var(--sp-2) 0;border-bottom:1px solid color-mix(in srgb,var(--border) 50%,transparent)}
688-
.god-module-entry:last-child{border-bottom:none;padding-bottom:0}
689-
.god-module-entry:first-child{padding-top:0}
690-
.god-module-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--sp-2);margin-bottom:4px}
691-
.god-module-title{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);min-width:0}
692-
.god-module-title code{font-size:.78rem;font-weight:600;color:var(--text-primary);line-height:1.35}
693-
.god-module-score{flex-shrink:0;font-size:.72rem;font-weight:700;font-variant-numeric:tabular-nums;
686+
.overloaded-module-list{display:flex;flex-direction:column;gap:0}
687+
.overloaded-module-entry{padding:var(--sp-2) 0;border-bottom:1px solid color-mix(in srgb,var(--border) 50%,transparent)}
688+
.overloaded-module-entry:last-child{border-bottom:none;padding-bottom:0}
689+
.overloaded-module-entry:first-child{padding-top:0}
690+
.overloaded-module-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--sp-2);margin-bottom:4px}
691+
.overloaded-module-title{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);min-width:0}
692+
.overloaded-module-title code{font-size:.78rem;font-weight:600;color:var(--text-primary);line-height:1.35}
693+
.overloaded-module-score{flex-shrink:0;font-size:.72rem;font-weight:700;font-variant-numeric:tabular-nums;
694694
color:var(--accent-primary);background:var(--accent-muted);border-radius:999px;padding:2px 8px}
695-
.god-module-metrics{display:flex;flex-wrap:wrap;gap:6px;font-size:.68rem;color:var(--text-muted)}
696-
.god-module-metrics span{font-variant-numeric:tabular-nums}
697-
.god-module-reasons,.god-module-signal-list{display:flex;flex-wrap:wrap;gap:var(--sp-1);margin-top:var(--sp-2)}
698-
.god-module-reason-chip,.god-module-signal-pill{display:inline-flex;align-items:center;gap:5px;
695+
.overloaded-module-metrics{display:flex;flex-wrap:wrap;gap:6px;font-size:.68rem;color:var(--text-muted)}
696+
.overloaded-module-metrics span{font-variant-numeric:tabular-nums}
697+
.overloaded-module-reasons,.overloaded-module-signal-list{display:flex;flex-wrap:wrap;gap:var(--sp-1);margin-top:var(--sp-2)}
698+
.overloaded-module-reason-chip,.overloaded-module-signal-pill{display:inline-flex;align-items:center;gap:5px;
699699
font-size:.68rem;font-weight:500;color:var(--text-secondary);background:var(--bg-raised);
700700
border:1px solid color-mix(in srgb,var(--border) 60%,transparent);border-radius:999px;
701701
padding:2px 8px}
702-
.god-module-signal-count{font-variant-numeric:tabular-nums;color:var(--text-muted)}
702+
.overloaded-module-signal-count{font-variant-numeric:tabular-nums;color:var(--text-muted)}
703703
/* Health radar chart */
704704
.health-radar{display:flex;justify-content:center;padding:var(--sp-3) 0}
705705
.health-radar svg{width:100%;max-width:520px;height:auto;overflow:visible}

codeclone/_html_report/_assemble.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def build_html_report(
111111
_as_int(_as_mapping(ctx.complexity_map.get("summary")).get("high_risk"))
112112
+ _as_int(_as_mapping(ctx.coupling_map.get("summary")).get("high_risk"))
113113
+ _as_int(_as_mapping(ctx.cohesion_map.get("summary")).get("low_cohesion"))
114-
+ _as_int(_as_mapping(ctx.god_modules_map.get("summary")).get("candidates"))
114+
+ _as_int(
115+
_as_mapping(ctx.overloaded_modules_map.get("summary")).get("candidates")
116+
)
115117
)
116118

117119
def _tab_badge(count: int) -> str:

codeclone/_html_report/_components.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ def overview_cluster_header(title: str, subtitle: str | None = None) -> str:
5151

5252

5353
_SUMMARY_ICON_KEYS: dict[str, tuple[str, str]] = {
54-
"scan scope": ("overview", "summary-icon summary-icon--info"),
5554
"top risks": ("top-risks", "summary-icon summary-icon--risk"),
5655
"issue breakdown": ("issue-breakdown", "summary-icon summary-icon--info"),
5756
"source breakdown": ("source-breakdown", "summary-icon summary-icon--info"),
5857
"all findings": ("all-findings", "summary-icon summary-icon--info"),
5958
"clone groups": ("clone-groups", "summary-icon summary-icon--info"),
6059
"low cohesion": ("low-cohesion", "summary-icon summary-icon--info"),
6160
"top candidates": ("quality", "summary-icon summary-icon--info"),
62-
"candidate profile": ("quality", "summary-icon summary-icon--info"),
61+
"more candidates": ("quality", "summary-icon summary-icon--info"),
6362
"health profile": ("health-profile", "summary-icon summary-icon--info"),
6463
}
6564

0 commit comments

Comments
 (0)