@getcodesentinel/codesentinel 1.35.0 → 1.37.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 +19 -1
- package/dist/index.js +633 -149
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,6 +150,7 @@ codesentinel report [path]
|
|
|
150
150
|
codesentinel check [path]
|
|
151
151
|
codesentinel ci [path]
|
|
152
152
|
codesentinel owners [path]
|
|
153
|
+
codesentinel trend --from <dir-or-glob>
|
|
153
154
|
codesentinel init [path]
|
|
154
155
|
codesentinel dependency-risk <dependency[@version]>
|
|
155
156
|
codesentinel update
|
|
@@ -178,6 +179,8 @@ codesentinel ci --baseline-ref auto --fail-on error
|
|
|
178
179
|
codesentinel owners
|
|
179
180
|
codesentinel owners . --format md --output ownership.md
|
|
180
181
|
codesentinel owners . --fail-on error --max-unowned-critical 0 --max-ghost-owners 2 --max-drift 0.25
|
|
182
|
+
codesentinel trend --from ./snapshots
|
|
183
|
+
codesentinel trend --from './snapshots/*.json' --since 90d --format md --output trend.md
|
|
181
184
|
codesentinel init
|
|
182
185
|
codesentinel init . --force
|
|
183
186
|
codesentinel init . --ci none --dry-run
|
|
@@ -190,7 +193,7 @@ Use `codesentinel update` to manually check for a newer CLI release and install
|
|
|
190
193
|
|
|
191
194
|
`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`.
|
|
192
195
|
|
|
193
|
-
`codesentinel init [path]` scaffolds a working CI setup in the target repository. It writes `.github/workflows/codesentinel.yml` and, when a `CODEOWNERS` file exists, `.codesentinel/owners.json`. The workflow runs `codesentinel ci --baseline-ref auto --fail-on error --snapshot codesentinel-snapshot.json`, builds an ownership report when a `CODEOWNERS` file is present, and uploads both artifacts with 90-day retention. Use `--force` to overwrite existing generated files, `--ci none` to skip the workflow (for example when CI lives elsewhere), or `--dry-run` to print what would be written without changing anything. Existing files are never overwritten without `--force`, and the command never edits `package.json`.
|
|
196
|
+
`codesentinel init [path]` scaffolds a working CI setup in the target repository. It writes `.github/workflows/codesentinel.yml` and, when a `CODEOWNERS` file exists, `.codesentinel/owners.json`. The workflow runs `codesentinel ci --baseline-ref auto --fail-on error --snapshot codesentinel-snapshot.json`, builds an ownership report when a `CODEOWNERS` file is present, and uploads both artifacts with 90-day retention. The uploaded snapshot includes ownership data when a `CODEOWNERS` file exists, so `codesentinel trend` can chart ownership history from those artifacts. Use `--force` to overwrite existing generated files, `--ci none` to skip the workflow (for example when CI lives elsewhere), or `--dry-run` to print what would be written without changing anything. Existing files are never overwritten without `--force`, and the command never edits `package.json`.
|
|
194
197
|
|
|
195
198
|
Author identity mode:
|
|
196
199
|
|
|
@@ -330,6 +333,8 @@ Ownership violations are error-level, so `--fail-on` never softens them; `--fail
|
|
|
330
333
|
|
|
331
334
|
`codesentinel ci` orchestrates snapshot + diff + gate evaluation + markdown summary generation.
|
|
332
335
|
|
|
336
|
+
`--snapshot <path>` writes a `codesentinel.snapshot.v2` artifact. Whenever a `CODEOWNERS` file exists, the snapshot embeds the ownership audit block (`ownership`) independently of the ownership thresholds, which only control enforcement. It also records `source.commit` (the full SHA) and `source.ref`, so `trend` can show the revision each run measured.
|
|
337
|
+
|
|
333
338
|
Baseline input modes:
|
|
334
339
|
|
|
335
340
|
- `--baseline <path>`: use an existing snapshot JSON artifact.
|
|
@@ -435,6 +440,19 @@ This measures system risk, not individual performance. No owner or author rankin
|
|
|
435
440
|
- The universe is tracked files only: untracked, ignored and binary-only files are out of scope.
|
|
436
441
|
- Identity matching is heuristic (noreply address, email local part, display name, alias map in `.codesentinel/owners.json`).
|
|
437
442
|
|
|
443
|
+
## Trend
|
|
444
|
+
|
|
445
|
+
`codesentinel trend` reads snapshot JSON artifacts written by `codesentinel ci --snapshot` and prints the series over time. Snapshots are CI artifacts, not repository files: `trend` never writes history into the repository and never changes the snapshot schema.
|
|
446
|
+
|
|
447
|
+
The workflow generated by `codesentinel init` runs `codesentinel ci --snapshot` and uploads the result as the `codesentinel` artifact, retrievable with `gh run download <run-id> -n codesentinel`. The ownership columns (Unowned, Ghosts, Drift) are populated from the snapshot's embedded ownership block, and the Commit column shows the short SHA. Both `codesentinel.snapshot.v2` and legacy `codesentinel.snapshot.v1` artifacts are read; v1 snapshots have no commit, so Commit shows `—`.
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
codesentinel trend --from ./snapshots
|
|
451
|
+
codesentinel trend --from './snapshots/*.json' --since 90d --last 12 --format md --output trend.md
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
`--from` accepts a directory (non-recursive `*.json` files) or a glob pattern. Each snapshot is parsed independently: a corrupt file, an unsupported schema version or a missing score is skipped with a warning so the remaining history still renders. Series are ordered by `generatedAt`, duplicate timestamp and commit pairs are collapsed, and `--since <N>d`/`--last <N>` narrow the window. Output is available as `console` (default), `json` (stable payload) and `md`. Deltas are last minus first; ownership deltas stay `null` when either endpoint has no ownership block. Fewer than two snapshots still exits `0` and prints `not enough history for a trend`. Configuration errors exit `2`.
|
|
455
|
+
|
|
438
456
|
## Explain Output
|
|
439
457
|
|
|
440
458
|
`codesentinel explain` uses the same risk-engine scoring model as `analyze` and adds structured explanation traces.
|