@getcodesentinel/codesentinel 1.15.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 +39 -18
- package/dist/index.js +885 -234
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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-
|
|
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,7 +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/
|
|
114
|
+
- `packages/health-engine`: health posture aggregation and scoring model.
|
|
115
115
|
- `packages/reporter`: structured report output (console, JSON, CI).
|
|
116
116
|
- `packages/governance`: CI gate evaluation and enforcement policy checks.
|
|
117
117
|
- `packages/cli`: user-facing CLI entrypoint.
|
|
@@ -167,9 +167,9 @@ codesentinel report
|
|
|
167
167
|
codesentinel report --format md --output report.md
|
|
168
168
|
codesentinel report --snapshot snapshot.json
|
|
169
169
|
codesentinel report --compare baseline.json --format text
|
|
170
|
-
codesentinel check --compare baseline.json --max-
|
|
170
|
+
codesentinel check --compare baseline.json --max-risk-delta 0.03 --no-new-cycles
|
|
171
171
|
codesentinel ci --baseline baseline.json --snapshot current.json --report report.md --fail-on error
|
|
172
|
-
codesentinel ci --baseline-ref origin/main --max-
|
|
172
|
+
codesentinel ci --baseline-ref origin/main --max-risk-delta 0.03 --no-new-cycles
|
|
173
173
|
codesentinel ci --baseline-ref auto --fail-on error
|
|
174
174
|
codesentinel dependency-risk react
|
|
175
175
|
codesentinel dependency-risk react@19.0.0
|
|
@@ -185,7 +185,7 @@ codesentinel analyze . --author-identity likely_merge
|
|
|
185
185
|
codesentinel analyze . --author-identity strict_email
|
|
186
186
|
|
|
187
187
|
# Personal-project profile (down-weights single-maintainer ownership penalties)
|
|
188
|
-
codesentinel analyze . --
|
|
188
|
+
codesentinel analyze . --scoring-profile personal
|
|
189
189
|
|
|
190
190
|
# Tune recency window (days) used for evolution volatility
|
|
191
191
|
codesentinel analyze . --recent-window-days 60
|
|
@@ -237,9 +237,9 @@ Notes:
|
|
|
237
237
|
- `--output summary` (default) prints a compact result for terminal use.
|
|
238
238
|
- `--output json` (or `--json`) prints the full analysis object.
|
|
239
239
|
- `--recent-window-days <days>` customizes the git recency window used to compute `recentVolatility` (default: `30`).
|
|
240
|
-
- `--
|
|
240
|
+
- `--scoring-profile default|personal` selects scoring profile.
|
|
241
241
|
- `default`: balanced team-oriented defaults.
|
|
242
|
-
- `personal`: lowers ownership
|
|
242
|
+
- `personal`: lowers single-maintainer ownership penalties for both risk and health ownership scoring.
|
|
243
243
|
- `personal` does not remove structural, churn, volatility, external, or interaction risk; scores can still be elevated when those signals are high.
|
|
244
244
|
|
|
245
245
|
When running through pnpm, pass CLI arguments after `--`:
|
|
@@ -256,7 +256,7 @@ pnpm dev -- explain . --file src/app/page.tsx
|
|
|
256
256
|
pnpm dev -- report
|
|
257
257
|
pnpm dev -- report . --format md --output report.md
|
|
258
258
|
pnpm dev -- report . --compare baseline.json --format text
|
|
259
|
-
pnpm dev -- check . --compare baseline.json --max-
|
|
259
|
+
pnpm dev -- check . --compare baseline.json --max-risk-delta 0.03 --no-new-cycles
|
|
260
260
|
pnpm dev -- ci . --baseline baseline.json --snapshot current.json --report report.md --fail-on warn
|
|
261
261
|
```
|
|
262
262
|
|
|
@@ -282,7 +282,7 @@ Diff mode compares snapshots and reports:
|
|
|
282
282
|
|
|
283
283
|
`codesentinel run` is a convenience command that emits `analyze + explain + report` in one execution.
|
|
284
284
|
|
|
285
|
-
- formats: `text`, `md`, `json` (`
|
|
285
|
+
- formats: `text`, `md`, `json` (`md` default)
|
|
286
286
|
- detail levels: `--detail compact|standard|full` (`compact` default, `full` = full verbose sections)
|
|
287
287
|
- explain target selectors: `--file <path>`, `--module <name>`, `--top <n>`
|
|
288
288
|
- report diff/snapshot flags: `--compare <baseline.json>`, `--snapshot <path>`, `--no-trace`
|
|
@@ -293,11 +293,13 @@ Diff mode compares snapshots and reports:
|
|
|
293
293
|
|
|
294
294
|
Supported gates:
|
|
295
295
|
|
|
296
|
-
- `--max-
|
|
296
|
+
- `--max-risk-delta <value>`
|
|
297
|
+
- `--max-health-delta <value>`
|
|
297
298
|
- `--no-new-cycles`
|
|
298
299
|
- `--no-new-high-risk-deps`
|
|
299
300
|
- `--max-new-hotspots <count>`
|
|
300
|
-
- `--max-
|
|
301
|
+
- `--max-risk-score <score>`
|
|
302
|
+
- `--min-health-score <score>`
|
|
301
303
|
- `--new-hotspot-score-threshold <score>`
|
|
302
304
|
- `--fail-on error|warn`
|
|
303
305
|
|
|
@@ -369,7 +371,7 @@ Filters:
|
|
|
369
371
|
- `evolution`: git-derived change behavior per file and coupling pairs.
|
|
370
372
|
- `external`: dependency exposure for direct packages plus propagated transitive signals.
|
|
371
373
|
- `risk`: deterministic composition of `structural + evolution + external`.
|
|
372
|
-
- `
|
|
374
|
+
- `health`: deterministic code health posture from local structural/evolution/test signals.
|
|
373
375
|
|
|
374
376
|
Minimal shape:
|
|
375
377
|
|
|
@@ -385,15 +387,20 @@ Minimal shape:
|
|
|
385
387
|
"fragileClusters": [],
|
|
386
388
|
"dependencyAmplificationZones": []
|
|
387
389
|
},
|
|
388
|
-
"
|
|
389
|
-
"
|
|
390
|
+
"health": {
|
|
391
|
+
"healthScore": 0,
|
|
390
392
|
"normalizedScore": 0,
|
|
391
393
|
"dimensions": {
|
|
392
394
|
"modularity": 0,
|
|
393
395
|
"changeHygiene": 0,
|
|
394
|
-
"testHealth": 0
|
|
396
|
+
"testHealth": 0,
|
|
397
|
+
"ownershipDistribution": 0
|
|
395
398
|
},
|
|
396
|
-
"topIssues": []
|
|
399
|
+
"topIssues": [],
|
|
400
|
+
"trace": {
|
|
401
|
+
"schemaVersion": "1",
|
|
402
|
+
"dimensions": []
|
|
403
|
+
}
|
|
397
404
|
}
|
|
398
405
|
}
|
|
399
406
|
```
|
|
@@ -408,7 +415,21 @@ How to read `risk` first:
|
|
|
408
415
|
Score direction:
|
|
409
416
|
|
|
410
417
|
- `risk.riskScore`: higher means higher risk (worse).
|
|
411
|
-
- `
|
|
418
|
+
- `health.healthScore`: higher means better health posture.
|
|
419
|
+
- `health.trace`: per-dimension factor traces with normalized metrics and evidence.
|
|
420
|
+
|
|
421
|
+
Health v2 dimensions and weights:
|
|
422
|
+
|
|
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.
|
|
427
|
+
|
|
428
|
+
Signal ingestion (deterministic, local):
|
|
429
|
+
|
|
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.
|
|
412
433
|
|
|
413
434
|
Interpretation notes:
|
|
414
435
|
|