@getcodesentinel/codesentinel 1.33.1 → 1.34.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 +82 -0
- package/dist/html-report-app/assets/index-DNX4F3q4.js +9 -0
- package/dist/html-report-app/assets/index-DzfavZJn.css +2 -0
- package/dist/html-report-app/index.html +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1829 -41
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/dist/html-report-app/assets/index-Byv8gMRD.js +0 -9
- package/dist/html-report-app/assets/index-Dkq-kKM9.css +0 -2
package/README.md
CHANGED
|
@@ -114,6 +114,7 @@ The goal is a practical, engineering-grade model that supports both strategic ar
|
|
|
114
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
|
+
- `packages/ownership`: declared ownership signals (CODEOWNERS parsing and matching).
|
|
117
118
|
- `packages/cli`: user-facing CLI entrypoint.
|
|
118
119
|
|
|
119
120
|
Each package is standalone, ESM-only, TypeScript-first, and built with `tsup`. The CLI depends on `core`; domain packages are kept decoupled to avoid circular dependencies.
|
|
@@ -148,6 +149,7 @@ codesentinel explain [path]
|
|
|
148
149
|
codesentinel report [path]
|
|
149
150
|
codesentinel check [path]
|
|
150
151
|
codesentinel ci [path]
|
|
152
|
+
codesentinel owners [path]
|
|
151
153
|
codesentinel dependency-risk <dependency[@version]>
|
|
152
154
|
codesentinel update
|
|
153
155
|
```
|
|
@@ -172,6 +174,9 @@ codesentinel check --compare baseline.json --max-risk-delta 0.03 --no-new-cycles
|
|
|
172
174
|
codesentinel ci --baseline baseline.json --snapshot current.json --report report.md --fail-on error
|
|
173
175
|
codesentinel ci --baseline-ref origin/main --max-risk-delta 0.03 --no-new-cycles
|
|
174
176
|
codesentinel ci --baseline-ref auto --fail-on error
|
|
177
|
+
codesentinel owners
|
|
178
|
+
codesentinel owners . --format md --output ownership.md
|
|
179
|
+
codesentinel owners . --fail-on error --max-unowned-critical 0 --max-ghost-owners 2 --max-drift 0.25
|
|
175
180
|
codesentinel dependency-risk react
|
|
176
181
|
codesentinel dependency-risk react@19.0.0
|
|
177
182
|
codesentinel update
|
|
@@ -179,6 +184,8 @@ codesentinel update
|
|
|
179
184
|
|
|
180
185
|
Use `codesentinel update` to manually check for a newer CLI release and install it without waiting for the startup notifier.
|
|
181
186
|
|
|
187
|
+
`codesentinel owners` cross-checks the owners declared in `CODEOWNERS` with the authors that history proves. It is offline, reads the `CODEOWNERS` file and the tracked tree from `--ref` so CI and a local run measure the same revision, and exits with `0` when the audit ran, `1` when a configured threshold is exceeded under `--fail-on error`, and `2` on a configuration or parse error (an untracked `CODEOWNERS`, an invalid flag value, or a file above GitHub's 3 MB limit). A repository without a `CODEOWNERS` file reports `available: false` and still exits `0`.
|
|
188
|
+
|
|
182
189
|
Author identity mode:
|
|
183
190
|
|
|
184
191
|
```bash
|
|
@@ -306,8 +313,15 @@ Supported gates:
|
|
|
306
313
|
- `--max-risk-score <score>`
|
|
307
314
|
- `--min-health-score <score>`
|
|
308
315
|
- `--new-hotspot-score-threshold <score>`
|
|
316
|
+
- `--max-unowned-critical <count>` (ci only; requires a `CODEOWNERS` file)
|
|
317
|
+
- `--max-ghost-owners <count>` (ci only; requires a `CODEOWNERS` file)
|
|
318
|
+
- `--max-drift <ratio>` (ci only; requires a `CODEOWNERS` file)
|
|
309
319
|
- `--fail-on error|warn`
|
|
310
320
|
|
|
321
|
+
The ownership gates are a no-op with an explicit warning when no `CODEOWNERS` file is found. They never pass silently.
|
|
322
|
+
|
|
323
|
+
Ownership violations are error-level, so `--fail-on` never softens them; `--fail-on warn` only adds warn-level gates such as `--max-new-hotspots`.
|
|
324
|
+
|
|
311
325
|
`codesentinel ci` orchestrates snapshot + diff + gate evaluation + markdown summary generation.
|
|
312
326
|
|
|
313
327
|
Baseline input modes:
|
|
@@ -347,6 +361,74 @@ Exit codes:
|
|
|
347
361
|
- `3`: invalid configuration
|
|
348
362
|
- `4`: internal execution error
|
|
349
363
|
|
|
364
|
+
## Ownership Audit
|
|
365
|
+
|
|
366
|
+
`codesentinel owners` cross-checks the owners declared in `CODEOWNERS` against the authors that git history proves, and reports coverage, drift, ghost owners and unowned critical files. The audit is offline by contract: it reads the `CODEOWNERS` file and the tracked tree from `--ref` (default `HEAD`), so CI and a local run measure the same revision.
|
|
367
|
+
|
|
368
|
+
### Quickstart
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
codesentinel owners
|
|
372
|
+
codesentinel owners . --format md --output ownership.md
|
|
373
|
+
codesentinel ci --max-unowned-critical 0 --max-ghost-owners 2 --max-drift 0.25 --fail-on error
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Sample output
|
|
377
|
+
|
|
378
|
+
The following is illustrative output from a small four-file repository (plus its `CODEOWNERS` file), run with `--min-commits 2`:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
Ownership audit — 5 tracked files, window 90d, ref HEAD
|
|
382
|
+
CODEOWNERS CODEOWNERS · 3 entries · 0 invalid lines
|
|
383
|
+
|
|
384
|
+
Declared coverage: 60% (3/5)
|
|
385
|
+
Critical coverage: 0% (0/1)
|
|
386
|
+
Drift: 33.33% (1/3 declared files)
|
|
387
|
+
Owners without activity: 1 owner
|
|
388
|
+
Unowned critical: 1
|
|
389
|
+
Single-owner modules: 3
|
|
390
|
+
|
|
391
|
+
Unowned critical
|
|
392
|
+
scripts/deploy.txt fan-in n/a commits 6 authors 1
|
|
393
|
+
|
|
394
|
+
Drift — declared owner is not the top recent author
|
|
395
|
+
api/webhooks.txt declared @alice observed dave@example.com (75%)
|
|
396
|
+
|
|
397
|
+
Ghost owners — declared, no commits in the window
|
|
398
|
+
@carol docs/guide.txt
|
|
399
|
+
|
|
400
|
+
Warnings
|
|
401
|
+
- No structural analysis available: criticality falls back to hotspots and churn (p90).
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### What the statuses mean
|
|
405
|
+
|
|
406
|
+
- `aligned`: a declared owner is the top author for the file's activity horizon.
|
|
407
|
+
- `drifted`: the file has a declaration, but the top author is not one of the declared owners. A dormant file is compared against its lifetime top author.
|
|
408
|
+
- `ghosted`: no declared owner has **verified** activity inside the window, and every declared owner is verifiable. A file that is merely dormant (the owner touched it historically, nothing in the window) is not ghosted.
|
|
409
|
+
- `unowned`: no `CODEOWNERS` pattern matches the file, or the winning entry has no owners.
|
|
410
|
+
- `unowned-critical`: an unowned file is also critical (structural fan-in, hotspot, risk or churn fallback).
|
|
411
|
+
- `insufficient-evidence`: fewer lifetime commits than `--min-commits`; no verdict is emitted.
|
|
412
|
+
- `unknown`: the audit degraded (an unexpanded team, an unresolved alias). It is not a verdict on the file. An unexpanded team (`@org/team` while offline) is `unknown`, never `ghosted`: absence of evidence is not evidence of absence.
|
|
413
|
+
|
|
414
|
+
### The metric that matters
|
|
415
|
+
|
|
416
|
+
Coverage over critical files (`declaredCoverageCriticalPercent`) is the metric to watch. A single `* @someone` line takes flat coverage to 100% while the critical files that carry the risk stay orphaned.
|
|
417
|
+
|
|
418
|
+
### Ethics
|
|
419
|
+
|
|
420
|
+
This measures system risk, not individual performance. No owner or author ranking is emitted, drift is a coordination signal rather than a fault, and the audit must not be used to evaluate people.
|
|
421
|
+
|
|
422
|
+
### Known limitations
|
|
423
|
+
|
|
424
|
+
- No `!` negation and no `[ ]` character classes: they are literal characters, same as GitHub.
|
|
425
|
+
- Matching is case-sensitive on every platform, including macOS.
|
|
426
|
+
- A `CODEOWNERS` file above 3 MB is rejected (`codeowners_too_large`).
|
|
427
|
+
- `CODEOWNERS` is read per ref/branch, so a run measures the ref you pass, and a PR that edits `CODEOWNERS` is measured against the base ref in CI.
|
|
428
|
+
- Teams are opaque offline and stay `unknown` unless resolved; `--resolve-github` is accepted but not implemented in this iteration.
|
|
429
|
+
- The universe is tracked files only: untracked, ignored and binary-only files are out of scope.
|
|
430
|
+
- Identity matching is heuristic (noreply address, email local part, display name, alias map in `.codesentinel/owners.json`).
|
|
431
|
+
|
|
350
432
|
## Explain Output
|
|
351
433
|
|
|
352
434
|
`codesentinel explain` uses the same risk-engine scoring model as `analyze` and adds structured explanation traces.
|