@getcodesentinel/codesentinel 1.34.0 → 1.36.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 CHANGED
@@ -81,7 +81,7 @@ CI example:
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.
83
83
 
84
- A full workflow template is available at `examples/github-actions/codesentinel-ci.yml`.
84
+ A full workflow template is available at `examples/github-actions/codesentinel-ci.yml`. For a faster setup, run `codesentinel init` in the repository root instead of copying the example: it writes the workflow and, when a `CODEOWNERS` file exists, the ownership configuration.
85
85
 
86
86
  ## Vision
87
87
 
@@ -150,6 +150,8 @@ 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>
154
+ codesentinel init [path]
153
155
  codesentinel dependency-risk <dependency[@version]>
154
156
  codesentinel update
155
157
  ```
@@ -177,6 +179,11 @@ codesentinel ci --baseline-ref auto --fail-on error
177
179
  codesentinel owners
178
180
  codesentinel owners . --format md --output ownership.md
179
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
184
+ codesentinel init
185
+ codesentinel init . --force
186
+ codesentinel init . --ci none --dry-run
180
187
  codesentinel dependency-risk react
181
188
  codesentinel dependency-risk react@19.0.0
182
189
  codesentinel update
@@ -186,6 +193,8 @@ Use `codesentinel update` to manually check for a newer CLI release and install
186
193
 
187
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`.
188
195
 
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. 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`.
197
+
189
198
  Author identity mode:
190
199
 
191
200
  ```bash
@@ -429,6 +438,17 @@ This measures system risk, not individual performance. No owner or author rankin
429
438
  - The universe is tracked files only: untracked, ignored and binary-only files are out of scope.
430
439
  - Identity matching is heuristic (noreply address, email local part, display name, alias map in `.codesentinel/owners.json`).
431
440
 
441
+ ## Trend
442
+
443
+ `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.
444
+
445
+ ```bash
446
+ codesentinel trend --from ./snapshots
447
+ codesentinel trend --from './snapshots/*.json' --since 90d --last 12 --format md --output trend.md
448
+ ```
449
+
450
+ `--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`.
451
+
432
452
  ## Explain Output
433
453
 
434
454
  `codesentinel explain` uses the same risk-engine scoring model as `analyze` and adds structured explanation traces.