@getcodesentinel/codesentinel 1.9.1 → 1.9.3
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 +29 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,11 +67,21 @@ CI example:
|
|
|
67
67
|
- uses: actions/checkout@v4
|
|
68
68
|
with:
|
|
69
69
|
fetch-depth: 0
|
|
70
|
+
filter: blob:none
|
|
71
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
72
|
+
- name: Ensure git history for CodeSentinel
|
|
73
|
+
run: |
|
|
74
|
+
set -euo pipefail
|
|
75
|
+
git fetch --prune --unshallow || true
|
|
76
|
+
BASE_REF="${GITHUB_BASE_REF:-main}"
|
|
77
|
+
git fetch origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
70
78
|
- name: Run CodeSentinel
|
|
71
79
|
run: npx codesentinel ci --baseline-ref auto --max-repo-score 55 --max-repo-delta 0.03 --no-new-cycles --no-new-high-risk-deps --max-new-hotspots 2 --fail-on error
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
`--baseline-ref auto` requires enough git history to resolve a baseline deterministically. In GitHub Actions, use `fetch-depth: 0
|
|
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
|
+
|
|
84
|
+
A full workflow template is available at `examples/github-actions/codesentinel-ci.yml`.
|
|
75
85
|
|
|
76
86
|
## Vision
|
|
77
87
|
|
|
@@ -235,6 +245,7 @@ pnpm dev -- ci . --baseline baseline.json --snapshot current.json --report repor
|
|
|
235
245
|
|
|
236
246
|
`codesentinel report` produces deterministic engineering artifacts from existing analysis outputs.
|
|
237
247
|
|
|
248
|
+
- default format: `md`
|
|
238
249
|
- formats: `text`, `md`, `json`
|
|
239
250
|
- optional file output: `--output <path>`
|
|
240
251
|
- optional snapshot export: `--snapshot <path>`
|
|
@@ -276,6 +287,23 @@ Baseline input modes:
|
|
|
276
287
|
- otherwise: `merge-base(HEAD, origin/main)` then `origin/master`, `main`, `master`
|
|
277
288
|
- `--main-branch <name>` (repeatable) or `--main-branches "main,master,trunk"` customize default branch candidates used by `--baseline-ref auto`.
|
|
278
289
|
|
|
290
|
+
GitHub Actions recommendation for deterministic CI with `--baseline-ref auto`:
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
- uses: actions/checkout@v4
|
|
294
|
+
with:
|
|
295
|
+
fetch-depth: 0
|
|
296
|
+
filter: blob:none
|
|
297
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
298
|
+
|
|
299
|
+
- name: Ensure git history for CodeSentinel
|
|
300
|
+
run: |
|
|
301
|
+
set -euo pipefail
|
|
302
|
+
git fetch --prune --unshallow || true
|
|
303
|
+
BASE_REF="${GITHUB_BASE_REF:-main}"
|
|
304
|
+
git fetch origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
305
|
+
```
|
|
306
|
+
|
|
279
307
|
Exit codes:
|
|
280
308
|
|
|
281
309
|
- `0`: no failing violations
|
package/dist/index.js
CHANGED
|
@@ -5367,7 +5367,7 @@ program.command("explain").argument("[path]", "path to the project to analyze").
|
|
|
5367
5367
|
"log verbosity: silent, error, warn, info, debug (logs are written to stderr)"
|
|
5368
5368
|
).choices(["silent", "error", "warn", "info", "debug"]).default(parseLogLevel(process.env["CODESENTINEL_LOG_LEVEL"]))
|
|
5369
5369
|
).option("--file <path>", "explain a specific file target").option("--module <name>", "explain a specific module target").option("--top <count>", "number of top hotspots to explain when no target is selected", "5").addOption(
|
|
5370
|
-
new Option("--format <mode>", "output format: text, json, md").choices(["text", "json", "md"]).default("
|
|
5370
|
+
new Option("--format <mode>", "output format: text, json, md").choices(["text", "json", "md"]).default("md")
|
|
5371
5371
|
).action(
|
|
5372
5372
|
async (path, options) => {
|
|
5373
5373
|
const logger = createStderrLogger(options.logLevel);
|