@getcodesentinel/codesentinel 1.16.0 → 1.17.0
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.
- package/README.md +23 -31
- package/dist/index.js +745 -1020
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ CI example:
|
|
|
76
76
|
BASE_REF="${GITHUB_BASE_REF:-main}"
|
|
77
77
|
git fetch origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
78
78
|
- name: Run CodeSentinel
|
|
79
|
-
run: npx codesentinel ci --baseline-ref auto --max-risk-score 55 --max-risk-delta 0.03 --min-
|
|
79
|
+
run: npx codesentinel ci --baseline-ref auto --max-risk-score 55 --max-risk-delta 0.03 --min-health-score 65 --max-health-delta 0.03 --no-new-cycles --no-new-high-risk-deps --max-new-hotspots 2 --fail-on error
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
`--baseline-ref auto` requires enough git history to resolve a baseline deterministically. In GitHub Actions, use `fetch-depth: 0` and ensure the CI base branch ref is fetched.
|
|
@@ -100,7 +100,7 @@ The CLI output now includes a deterministic `risk` block composed from those dim
|
|
|
100
100
|
- `dependencyAmplificationZones`
|
|
101
101
|
- file/module/dependency score tables
|
|
102
102
|
|
|
103
|
-
It also includes a deterministic `
|
|
103
|
+
It also includes a deterministic `health` block (`healthScore`, dimension scores, and actionable top issues) computed independently from risk.
|
|
104
104
|
|
|
105
105
|
The goal is a practical, engineering-grade model that supports both strategic architecture decisions and daily code review workflows.
|
|
106
106
|
|
|
@@ -111,8 +111,7 @@ The goal is a practical, engineering-grade model that supports both strategic ar
|
|
|
111
111
|
- `packages/git-analyzer`: Git history and evolutionary signals.
|
|
112
112
|
- `packages/dependency-firewall`: external dependency and supply chain signals.
|
|
113
113
|
- `packages/risk-engine`: risk aggregation and scoring model.
|
|
114
|
-
- `packages/
|
|
115
|
-
- `packages/quality-engine`: quality posture aggregation and scoring model.
|
|
114
|
+
- `packages/health-engine`: health posture aggregation and scoring model.
|
|
116
115
|
- `packages/reporter`: structured report output (console, JSON, CI).
|
|
117
116
|
- `packages/governance`: CI gate evaluation and enforcement policy checks.
|
|
118
117
|
- `packages/cli`: user-facing CLI entrypoint.
|
|
@@ -186,7 +185,7 @@ codesentinel analyze . --author-identity likely_merge
|
|
|
186
185
|
codesentinel analyze . --author-identity strict_email
|
|
187
186
|
|
|
188
187
|
# Personal-project profile (down-weights single-maintainer ownership penalties)
|
|
189
|
-
codesentinel analyze . --
|
|
188
|
+
codesentinel analyze . --scoring-profile personal
|
|
190
189
|
|
|
191
190
|
# Tune recency window (days) used for evolution volatility
|
|
192
191
|
codesentinel analyze . --recent-window-days 60
|
|
@@ -238,9 +237,9 @@ Notes:
|
|
|
238
237
|
- `--output summary` (default) prints a compact result for terminal use.
|
|
239
238
|
- `--output json` (or `--json`) prints the full analysis object.
|
|
240
239
|
- `--recent-window-days <days>` customizes the git recency window used to compute `recentVolatility` (default: `30`).
|
|
241
|
-
- `--
|
|
240
|
+
- `--scoring-profile default|personal` selects scoring profile.
|
|
242
241
|
- `default`: balanced team-oriented defaults.
|
|
243
|
-
- `personal`: lowers ownership
|
|
242
|
+
- `personal`: lowers single-maintainer ownership penalties for both risk and health ownership scoring.
|
|
244
243
|
- `personal` does not remove structural, churn, volatility, external, or interaction risk; scores can still be elevated when those signals are high.
|
|
245
244
|
|
|
246
245
|
When running through pnpm, pass CLI arguments after `--`:
|
|
@@ -295,12 +294,12 @@ Diff mode compares snapshots and reports:
|
|
|
295
294
|
Supported gates:
|
|
296
295
|
|
|
297
296
|
- `--max-risk-delta <value>`
|
|
298
|
-
- `--max-
|
|
297
|
+
- `--max-health-delta <value>`
|
|
299
298
|
- `--no-new-cycles`
|
|
300
299
|
- `--no-new-high-risk-deps`
|
|
301
300
|
- `--max-new-hotspots <count>`
|
|
302
301
|
- `--max-risk-score <score>`
|
|
303
|
-
- `--min-
|
|
302
|
+
- `--min-health-score <score>`
|
|
304
303
|
- `--new-hotspot-score-threshold <score>`
|
|
305
304
|
- `--fail-on error|warn`
|
|
306
305
|
|
|
@@ -372,7 +371,7 @@ Filters:
|
|
|
372
371
|
- `evolution`: git-derived change behavior per file and coupling pairs.
|
|
373
372
|
- `external`: dependency exposure for direct packages plus propagated transitive signals.
|
|
374
373
|
- `risk`: deterministic composition of `structural + evolution + external`.
|
|
375
|
-
- `
|
|
374
|
+
- `health`: deterministic code health posture from local structural/evolution/test signals.
|
|
376
375
|
|
|
377
376
|
Minimal shape:
|
|
378
377
|
|
|
@@ -388,16 +387,14 @@ Minimal shape:
|
|
|
388
387
|
"fragileClusters": [],
|
|
389
388
|
"dependencyAmplificationZones": []
|
|
390
389
|
},
|
|
391
|
-
"
|
|
392
|
-
"
|
|
390
|
+
"health": {
|
|
391
|
+
"healthScore": 0,
|
|
393
392
|
"normalizedScore": 0,
|
|
394
393
|
"dimensions": {
|
|
395
394
|
"modularity": 0,
|
|
396
395
|
"changeHygiene": 0,
|
|
397
|
-
"
|
|
398
|
-
"
|
|
399
|
-
"duplication": 0,
|
|
400
|
-
"testHealth": 0
|
|
396
|
+
"testHealth": 0,
|
|
397
|
+
"ownershipDistribution": 0
|
|
401
398
|
},
|
|
402
399
|
"topIssues": [],
|
|
403
400
|
"trace": {
|
|
@@ -418,26 +415,21 @@ How to read `risk` first:
|
|
|
418
415
|
Score direction:
|
|
419
416
|
|
|
420
417
|
- `risk.riskScore`: higher means higher risk (worse).
|
|
421
|
-
- `
|
|
422
|
-
- `
|
|
418
|
+
- `health.healthScore`: higher means better health posture.
|
|
419
|
+
- `health.trace`: per-dimension factor traces with normalized metrics and evidence.
|
|
423
420
|
|
|
424
|
-
|
|
421
|
+
Health v2 dimensions and weights:
|
|
425
422
|
|
|
426
|
-
- `modularity` (`0.
|
|
427
|
-
- `changeHygiene` (`0.
|
|
428
|
-
- `
|
|
429
|
-
- `
|
|
430
|
-
- `duplication` (`0.10`): duplicated block/line ratio.
|
|
431
|
-
- `testHealth` (`0.15`): test file presence + optional coverage summary input.
|
|
423
|
+
- `modularity` (`0.35`): cycle density + fan/centrality concentration + structural-hotspot overlap.
|
|
424
|
+
- `changeHygiene` (`0.30`): churn/volatility concentration + dense co-change clusters.
|
|
425
|
+
- `testHealth` (`0.20`): test presence + test-to-source ratio + testing directory presence.
|
|
426
|
+
- `ownershipDistribution` (`0.15`): top-author share + author entropy + single-author dominance signals.
|
|
432
427
|
|
|
433
428
|
Signal ingestion (deterministic, local):
|
|
434
429
|
|
|
435
|
-
-
|
|
436
|
-
-
|
|
437
|
-
-
|
|
438
|
-
- Coverage input is optional:
|
|
439
|
-
- default path: `<target>/coverage/coverage-summary.json`
|
|
440
|
-
- override path: `CODESENTINEL_QUALITY_COVERAGE_SUMMARY`
|
|
430
|
+
- Structural and evolution metrics come from local graph + git analysis.
|
|
431
|
+
- Test posture uses file/path heuristics only (no mandatory coverage integration).
|
|
432
|
+
- Ownership posture is derived from local git author distribution metrics.
|
|
441
433
|
|
|
442
434
|
Interpretation notes:
|
|
443
435
|
|