@getcodesentinel/codesentinel 1.40.0 → 1.40.1
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 +16 -1
- package/dist/index.js +175 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -182,6 +182,7 @@ codesentinel owners
|
|
|
182
182
|
codesentinel owners . --format md --output ownership.md
|
|
183
183
|
codesentinel owners . --format sarif --output codesentinel-ownership.sarif
|
|
184
184
|
codesentinel owners . --fail-on error --max-unowned-critical 0 --max-ghost-owners 2 --max-drift 0.25
|
|
185
|
+
codesentinel owners . --ignore-author '*@acme-bot.example'
|
|
185
186
|
codesentinel comment --input codesentinel-ci.json
|
|
186
187
|
codesentinel comment --input codesentinel-ci.json --pr 42 --comment-on change
|
|
187
188
|
codesentinel trend --from ./snapshots
|
|
@@ -196,7 +197,7 @@ codesentinel update
|
|
|
196
197
|
|
|
197
198
|
Use `codesentinel update` to manually check for a newer CLI release and install it without waiting for the startup notifier.
|
|
198
199
|
|
|
199
|
-
`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`.
|
|
200
|
+
`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`. Machine accounts are excluded from the evidence by default; use `--ignore-author <glob>` to add repository-specific patterns.
|
|
200
201
|
|
|
201
202
|
Use `--format sarif` to emit SARIF 2.1.0 for GitHub code scanning. Each ownership finding maps to one of the four rules (`ownership/unowned-critical`, `ownership/ghost-owner`, `ownership/drift`, `ownership/unknown`), points at line 1 of the file, and links back to the matching `CODEOWNERS` line when one exists. Results carry stable `codesentinel/v1` partial fingerprints derived only from the rule id and the relative path, so repeated uploads deduplicate instead of opening duplicate alerts. Upload it with `github/codeql-action/upload-sarif` and the `codesentinel-ownership` category. When no `CODEOWNERS` file exists the log still declares all four rules and contains zero results.
|
|
202
203
|
|
|
@@ -401,11 +402,24 @@ Exit codes:
|
|
|
401
402
|
codesentinel owners
|
|
402
403
|
codesentinel owners . --format md --output ownership.md
|
|
403
404
|
codesentinel owners . --format sarif --output codesentinel-ownership.sarif
|
|
405
|
+
codesentinel owners . --ignore-author '*@acme-bot.example'
|
|
404
406
|
codesentinel ci --max-unowned-critical 0 --max-ghost-owners 2 --max-drift 0.25 --fail-on error
|
|
405
407
|
```
|
|
406
408
|
|
|
407
409
|
The SARIF format is intended for GitHub code scanning: upload `codesentinel-ownership.sarif` with `github/codeql-action/upload-sarif` and `category: codesentinel-ownership`. Findings keep stable fingerprints, so code scanning updates the same alerts across runs.
|
|
408
410
|
|
|
411
|
+
### Ignoring bot authors
|
|
412
|
+
|
|
413
|
+
The audit excludes machine accounts from ownership evidence by default. The eight default globs are `*[bot]*`, `*-bot@*`, `*bot@users.noreply.github.com`, `semantic-release-bot@*`, `renovate@*`, `dependabot@*`, `github-actions@*` and `noreply@github.com`.
|
|
414
|
+
|
|
415
|
+
Matching is case-insensitive and anchored to the full author id or display name: `*` matches any sequence, `?` matches one character, and every other character is literal. Additional patterns extend the defaults in `.codesentinel/owners.json`:
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{ "ignoreAuthors": ["*@acme-bot.example"] }
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Use `--ignore-author <glob>` for a per-run override; it is repeatable and additive. The defaults are always on and cannot be removed. Ignored authors are excluded from the top author, author counts, shares, ghost and drift evidence. When the activity window contains only automated commits, the audit falls back to lifetime human evidence, so a file maintained by humans is not reported as drifted or unknown just because a bot touched it. `codesentinel ci` reads the same `ignoreAuthors` configuration from `.codesentinel/owners.json`, while `--ignore-author` is the `owners` per-run override.
|
|
422
|
+
|
|
409
423
|
### Sample output
|
|
410
424
|
|
|
411
425
|
The following is illustrative output from a small four-file repository (plus its `CODEOWNERS` file), run with `--min-commits 2`:
|
|
@@ -461,6 +475,7 @@ This measures system risk, not individual performance. No owner or author rankin
|
|
|
461
475
|
- Teams are opaque offline and stay `unknown` unless resolved; `--resolve-github` is accepted but not implemented in this iteration.
|
|
462
476
|
- The universe is tracked files only: untracked, ignored and binary-only files are out of scope.
|
|
463
477
|
- Identity matching is heuristic (noreply address, email local part, display name, alias map in `.codesentinel/owners.json`).
|
|
478
|
+
- Machine accounts are excluded by the built-in author patterns; add repository-specific patterns with `ignoreAuthors` in `.codesentinel/owners.json` or `--ignore-author <glob>`.
|
|
464
479
|
|
|
465
480
|
## Trend
|
|
466
481
|
|
package/dist/index.js
CHANGED
|
@@ -9395,12 +9395,51 @@ function discoverCodeowners(existingPaths) {
|
|
|
9395
9395
|
if (source === void 0) return null;
|
|
9396
9396
|
return { source, ignoredSources };
|
|
9397
9397
|
}
|
|
9398
|
-
var
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9398
|
+
var DEFAULT_IGNORED_AUTHOR_PATTERNS = [
|
|
9399
|
+
"*[bot]*",
|
|
9400
|
+
"*-bot@*",
|
|
9401
|
+
"*bot@users.noreply.github.com",
|
|
9402
|
+
"semantic-release-bot@*",
|
|
9403
|
+
"renovate@*",
|
|
9404
|
+
"dependabot@*",
|
|
9405
|
+
"github-actions@*",
|
|
9406
|
+
"noreply@github.com"
|
|
9407
|
+
];
|
|
9408
|
+
var escapePattern = (pattern) => pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9409
|
+
var compilePattern = (pattern) => {
|
|
9410
|
+
const escaped = escapePattern(pattern);
|
|
9411
|
+
const source = escaped.replace(/\\\*/g, ".*").replace(/\\\?/g, ".");
|
|
9412
|
+
return new RegExp(`^${source}$`, "i");
|
|
9403
9413
|
};
|
|
9414
|
+
var normalizePatterns = (patterns) => {
|
|
9415
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9416
|
+
const normalized = [];
|
|
9417
|
+
for (const raw of patterns) {
|
|
9418
|
+
const trimmed = raw.trim();
|
|
9419
|
+
if (trimmed.length === 0) continue;
|
|
9420
|
+
const key = trimmed.toLowerCase();
|
|
9421
|
+
if (seen.has(key)) continue;
|
|
9422
|
+
seen.add(key);
|
|
9423
|
+
normalized.push(trimmed);
|
|
9424
|
+
}
|
|
9425
|
+
return normalized;
|
|
9426
|
+
};
|
|
9427
|
+
var compileAuthorIgnorePatterns = (patterns) => {
|
|
9428
|
+
const compiled = patterns.map((pattern) => pattern.trim()).filter((pattern) => pattern.length > 0).map(compilePattern);
|
|
9429
|
+
return (author) => {
|
|
9430
|
+
const name = typeof author.authorName === "string" ? author.authorName : "";
|
|
9431
|
+
const hasName = name.trim().length > 0;
|
|
9432
|
+
return compiled.some(
|
|
9433
|
+
(pattern) => pattern.test(author.authorId) || hasName && pattern.test(name)
|
|
9434
|
+
);
|
|
9435
|
+
};
|
|
9436
|
+
};
|
|
9437
|
+
var createAuthorIgnoreMatcher = (extraPatterns = []) => compileAuthorIgnorePatterns(
|
|
9438
|
+
normalizePatterns([...DEFAULT_IGNORED_AUTHOR_PATTERNS, ...extraPatterns])
|
|
9439
|
+
);
|
|
9440
|
+
var defaultAuthorIgnoreMatcher = createAuthorIgnoreMatcher();
|
|
9441
|
+
var isBotAuthor = (author) => defaultAuthorIgnoreMatcher(author);
|
|
9442
|
+
var WHITESPACE_PATTERN2 = /\s+/g;
|
|
9404
9443
|
var normalizeHandle = (value) => value.trim().replace(/^@+/, "").toLowerCase().replace(WHITESPACE_PATTERN2, "");
|
|
9405
9444
|
var normalizeAuthorName = (value) => value.toLowerCase().replace(WHITESPACE_PATTERN2, "");
|
|
9406
9445
|
var localPartOf = (authorId) => {
|
|
@@ -9409,35 +9448,13 @@ var localPartOf = (authorId) => {
|
|
|
9409
9448
|
};
|
|
9410
9449
|
var uniquify = (values) => [...new Set(values)];
|
|
9411
9450
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9412
|
-
var
|
|
9413
|
-
const warnings = [];
|
|
9414
|
-
if (raw === null || raw === void 0 || raw.trim().length === 0) {
|
|
9415
|
-
return { aliases: {}, warnings };
|
|
9416
|
-
}
|
|
9417
|
-
let parsed;
|
|
9418
|
-
try {
|
|
9419
|
-
parsed = JSON.parse(raw);
|
|
9420
|
-
} catch {
|
|
9421
|
-
return {
|
|
9422
|
-
aliases: {},
|
|
9423
|
-
warnings: ["owners.json is not valid JSON: identity aliases were ignored."]
|
|
9424
|
-
};
|
|
9425
|
-
}
|
|
9426
|
-
if (!isRecord(parsed)) {
|
|
9427
|
-
return {
|
|
9428
|
-
aliases: {},
|
|
9429
|
-
warnings: ["owners.json must contain a JSON object: identity aliases were ignored."]
|
|
9430
|
-
};
|
|
9431
|
-
}
|
|
9432
|
-
const rawAliases = parsed["aliases"];
|
|
9451
|
+
var parseAliases = (rawAliases, warnings) => {
|
|
9433
9452
|
if (rawAliases === void 0 || rawAliases === null) {
|
|
9434
|
-
return {
|
|
9453
|
+
return {};
|
|
9435
9454
|
}
|
|
9436
9455
|
if (!isRecord(rawAliases)) {
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
warnings: ['owners.json "aliases" must be an object: identity aliases were ignored.']
|
|
9440
|
-
};
|
|
9456
|
+
warnings.push('owners.json "aliases" must be an object: identity aliases were ignored.');
|
|
9457
|
+
return {};
|
|
9441
9458
|
}
|
|
9442
9459
|
const aliases = {};
|
|
9443
9460
|
for (const [handle, value] of Object.entries(rawAliases)) {
|
|
@@ -9460,7 +9477,60 @@ var parseOwnerAliases = (raw) => {
|
|
|
9460
9477
|
for (const key of Object.keys(aliases)) {
|
|
9461
9478
|
aliases[key] = uniquify(aliases[key] ?? []);
|
|
9462
9479
|
}
|
|
9463
|
-
return
|
|
9480
|
+
return aliases;
|
|
9481
|
+
};
|
|
9482
|
+
var parseIgnoreAuthors = (rawIgnoreAuthors, warnings) => {
|
|
9483
|
+
if (rawIgnoreAuthors === void 0 || rawIgnoreAuthors === null) {
|
|
9484
|
+
return [];
|
|
9485
|
+
}
|
|
9486
|
+
if (!Array.isArray(rawIgnoreAuthors)) {
|
|
9487
|
+
warnings.push(
|
|
9488
|
+
'owners.json "ignoreAuthors" must be an array of glob pattern strings: it was ignored.'
|
|
9489
|
+
);
|
|
9490
|
+
return [];
|
|
9491
|
+
}
|
|
9492
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9493
|
+
const patterns = [];
|
|
9494
|
+
rawIgnoreAuthors.forEach((entry, index) => {
|
|
9495
|
+
if (typeof entry !== "string" || entry.trim().length === 0) {
|
|
9496
|
+
warnings.push(
|
|
9497
|
+
`owners.json "ignoreAuthors[${index + 1}]" was ignored: expected a non-empty glob pattern string.`
|
|
9498
|
+
);
|
|
9499
|
+
return;
|
|
9500
|
+
}
|
|
9501
|
+
const pattern = entry.trim();
|
|
9502
|
+
const key = pattern.toLowerCase();
|
|
9503
|
+
if (seen.has(key)) return;
|
|
9504
|
+
seen.add(key);
|
|
9505
|
+
patterns.push(pattern);
|
|
9506
|
+
});
|
|
9507
|
+
return patterns;
|
|
9508
|
+
};
|
|
9509
|
+
var parseOwnersConfig = (raw) => {
|
|
9510
|
+
const warnings = [];
|
|
9511
|
+
if (raw === null || raw === void 0 || raw.trim().length === 0) {
|
|
9512
|
+
return { aliases: {}, ignoreAuthors: [], warnings };
|
|
9513
|
+
}
|
|
9514
|
+
let parsed;
|
|
9515
|
+
try {
|
|
9516
|
+
parsed = JSON.parse(raw);
|
|
9517
|
+
} catch {
|
|
9518
|
+
return {
|
|
9519
|
+
aliases: {},
|
|
9520
|
+
ignoreAuthors: [],
|
|
9521
|
+
warnings: ["owners.json is not valid JSON: identity aliases were ignored."]
|
|
9522
|
+
};
|
|
9523
|
+
}
|
|
9524
|
+
if (!isRecord(parsed)) {
|
|
9525
|
+
return {
|
|
9526
|
+
aliases: {},
|
|
9527
|
+
ignoreAuthors: [],
|
|
9528
|
+
warnings: ["owners.json must contain a JSON object: identity aliases were ignored."]
|
|
9529
|
+
};
|
|
9530
|
+
}
|
|
9531
|
+
const aliases = parseAliases(parsed["aliases"], warnings);
|
|
9532
|
+
const ignoreAuthors = parseIgnoreAuthors(parsed["ignoreAuthors"], warnings);
|
|
9533
|
+
return { aliases, ignoreAuthors, warnings };
|
|
9464
9534
|
};
|
|
9465
9535
|
var resolveOwner = (owner, authors, aliases) => {
|
|
9466
9536
|
if (owner.kind === "team") {
|
|
@@ -9563,6 +9633,12 @@ var pickTopAuthor = (commitsByAuthor) => {
|
|
|
9563
9633
|
};
|
|
9564
9634
|
var countDistinct = (values) => new Set(values).size;
|
|
9565
9635
|
var plural = (count, singular, pluralForm) => `${count} ${count === 1 ? singular : pluralForm}`;
|
|
9636
|
+
var MAX_REPORTED_IGNORED_AUTHORS = 5;
|
|
9637
|
+
var ignoredAuthorsWarning = (commits, authorIds) => {
|
|
9638
|
+
const shown = authorIds.slice(0, MAX_REPORTED_IGNORED_AUTHORS);
|
|
9639
|
+
const more = authorIds.length > shown.length ? ` \u2026 and ${authorIds.length - shown.length} more` : "";
|
|
9640
|
+
return `Ignored ${plural(commits, "commit", "commits")} attributed to ${plural(authorIds.length, "ignored author", "ignored authors")} matched by "ignoreAuthors": ${shown.join(", ")}${more}.`;
|
|
9641
|
+
};
|
|
9566
9642
|
var auditOwnership = (input) => {
|
|
9567
9643
|
const callerWarnings = input.warnings ?? [];
|
|
9568
9644
|
if (input.codeowners === null) {
|
|
@@ -9599,22 +9675,36 @@ var auditOwnership = (input) => {
|
|
|
9599
9675
|
);
|
|
9600
9676
|
const matcher = createCodeownersMatcher(codeowners.entries);
|
|
9601
9677
|
const resolveOwner2 = createIdentityResolver(input.aliases ?? {});
|
|
9678
|
+
const ignoreAuthor = createAuthorIgnoreMatcher(input.ignoreAuthors ?? []);
|
|
9602
9679
|
const files = [];
|
|
9603
9680
|
const ghostCandidates = [];
|
|
9681
|
+
const ignoredAuthorIds = /* @__PURE__ */ new Set();
|
|
9604
9682
|
const teamKeys = /* @__PURE__ */ new Set();
|
|
9605
9683
|
const unresolvedAliasKeys = /* @__PURE__ */ new Set();
|
|
9684
|
+
let ignoredCommits = 0;
|
|
9606
9685
|
let filesWithoutAuthorEvidence = 0;
|
|
9607
9686
|
for (const filePath of trackedFiles) {
|
|
9608
9687
|
const item = evidenceByPath.get(filePath);
|
|
9609
9688
|
const entry = matcher(filePath);
|
|
9610
9689
|
const declared = entry?.owners ?? [];
|
|
9611
|
-
const
|
|
9612
|
-
const
|
|
9690
|
+
const rawAuthors = item?.authors ?? [];
|
|
9691
|
+
const rawRecentAuthors = item?.recentAuthors ?? [];
|
|
9692
|
+
const authors = rawAuthors.filter((author) => !ignoreAuthor(author));
|
|
9693
|
+
const recentAuthors = rawRecentAuthors.filter((author) => !ignoreAuthor(author));
|
|
9613
9694
|
const commits = item?.commits ?? 0;
|
|
9614
9695
|
const recentCommits = item?.recentCommits ?? 0;
|
|
9696
|
+
const recentHumanCommits = recentAuthors.reduce((total, author) => total + author.commits, 0);
|
|
9697
|
+
for (const author of rawAuthors) {
|
|
9698
|
+
if (!ignoreAuthor(author)) continue;
|
|
9699
|
+
ignoredAuthorIds.add(author.authorId);
|
|
9700
|
+
ignoredCommits += author.commits;
|
|
9701
|
+
}
|
|
9702
|
+
for (const author of rawRecentAuthors) {
|
|
9703
|
+
if (ignoreAuthor(author)) ignoredAuthorIds.add(author.authorId);
|
|
9704
|
+
}
|
|
9615
9705
|
const lifetimeResolutions = declared.map((owner) => resolveOwner2(owner, authors));
|
|
9616
9706
|
const recentResolutions = declared.map((owner) => resolveOwner2(owner, recentAuthors));
|
|
9617
|
-
const usesLifetimeHorizon =
|
|
9707
|
+
const usesLifetimeHorizon = recentHumanCommits === 0;
|
|
9618
9708
|
const resolutions = usesLifetimeHorizon ? lifetimeResolutions : recentResolutions;
|
|
9619
9709
|
const horizonAuthors = usesLifetimeHorizon ? authors : recentAuthors;
|
|
9620
9710
|
const dormant = usesLifetimeHorizon && commits > 0;
|
|
@@ -9632,7 +9722,7 @@ var auditOwnership = (input) => {
|
|
|
9632
9722
|
declaredCount: declared.length,
|
|
9633
9723
|
isCritical,
|
|
9634
9724
|
commits,
|
|
9635
|
-
recentCommits,
|
|
9725
|
+
recentCommits: recentHumanCommits,
|
|
9636
9726
|
minCommits,
|
|
9637
9727
|
topAuthorId: top?.topAuthorId ?? null,
|
|
9638
9728
|
hasAuthorEvidence,
|
|
@@ -9641,7 +9731,7 @@ var auditOwnership = (input) => {
|
|
|
9641
9731
|
if (declared.length > 0 && commits >= minCommits && !hasAuthorEvidence) {
|
|
9642
9732
|
filesWithoutAuthorEvidence += 1;
|
|
9643
9733
|
}
|
|
9644
|
-
if (declared.length > 0 && commits >= minCommits &&
|
|
9734
|
+
if (declared.length > 0 && commits >= minCommits && recentHumanCommits > 0) {
|
|
9645
9735
|
for (const resolution of recentResolutions) {
|
|
9646
9736
|
if (!isActiveOwnerResolution(resolution) && isVerifiableOwnerResolution(resolution)) {
|
|
9647
9737
|
ghostCandidates.push({ owner: resolution.owner, filePath });
|
|
@@ -9673,6 +9763,10 @@ var auditOwnership = (input) => {
|
|
|
9673
9763
|
}
|
|
9674
9764
|
const sortedFiles = sortFileOwnershipAudits(files);
|
|
9675
9765
|
const ghostOwners = summarizeGhostOwners(ghostCandidates);
|
|
9766
|
+
const sortedIgnoredAuthors = [...ignoredAuthorIds].sort(compareText2);
|
|
9767
|
+
if (ignoredCommits > 0) {
|
|
9768
|
+
warnings.push(ignoredAuthorsWarning(ignoredCommits, sortedIgnoredAuthors));
|
|
9769
|
+
}
|
|
9676
9770
|
if (!policy.structuralDataAvailable) {
|
|
9677
9771
|
warnings.push(
|
|
9678
9772
|
"No structural analysis available: criticality falls back to hotspots and churn (p90)."
|
|
@@ -9714,6 +9808,7 @@ var auditOwnership = (input) => {
|
|
|
9714
9808
|
metrics,
|
|
9715
9809
|
ghostOwners,
|
|
9716
9810
|
files: sortedFiles,
|
|
9811
|
+
ignoredAuthors: sortedIgnoredAuthors,
|
|
9717
9812
|
warnings
|
|
9718
9813
|
};
|
|
9719
9814
|
};
|
|
@@ -9963,27 +10058,32 @@ var readCodeowners = (input) => {
|
|
|
9963
10058
|
ignoredSources: selection.ignoredSources
|
|
9964
10059
|
});
|
|
9965
10060
|
};
|
|
9966
|
-
var
|
|
10061
|
+
var readOwnersConfig = async (snapshot, aliasesPath) => {
|
|
9967
10062
|
const normalized = normalizeRepositoryPath(aliasesPath);
|
|
9968
10063
|
const tracked = snapshot.trackedFiles.includes(normalized);
|
|
9969
10064
|
if (tracked) {
|
|
9970
10065
|
const text = readTextAtRef(snapshot.repositoryPath, snapshot.ref, normalized);
|
|
9971
|
-
const parsed =
|
|
9972
|
-
return {
|
|
10066
|
+
const parsed = parseOwnersConfig(text);
|
|
10067
|
+
return {
|
|
10068
|
+
aliases: parsed.aliases,
|
|
10069
|
+
ignoreAuthors: parsed.ignoreAuthors,
|
|
10070
|
+
warnings: parsed.warnings
|
|
10071
|
+
};
|
|
9973
10072
|
}
|
|
9974
10073
|
const workingTreePath = resolve5(snapshot.repositoryPath, normalized);
|
|
9975
10074
|
if (existsSync4(workingTreePath)) {
|
|
9976
10075
|
const text = await readFile4(workingTreePath, "utf8");
|
|
9977
|
-
const parsed =
|
|
10076
|
+
const parsed = parseOwnersConfig(text);
|
|
9978
10077
|
return {
|
|
9979
10078
|
aliases: parsed.aliases,
|
|
10079
|
+
ignoreAuthors: parsed.ignoreAuthors,
|
|
9980
10080
|
warnings: [
|
|
9981
10081
|
...parsed.warnings,
|
|
9982
10082
|
`Identity aliases were read from the working tree because "${normalized}" is not tracked at "${snapshot.ref}".`
|
|
9983
10083
|
]
|
|
9984
10084
|
};
|
|
9985
10085
|
}
|
|
9986
|
-
return { aliases: {}, warnings: [] };
|
|
10086
|
+
return { aliases: {}, ignoreAuthors: [], warnings: [] };
|
|
9987
10087
|
};
|
|
9988
10088
|
var collectFanInByPath = (projectPath, logger) => {
|
|
9989
10089
|
try {
|
|
@@ -10029,7 +10129,7 @@ var buildOwnershipAudit = async (targetPath, options, logger) => {
|
|
|
10029
10129
|
}
|
|
10030
10130
|
throw error;
|
|
10031
10131
|
}
|
|
10032
|
-
const
|
|
10132
|
+
const configSource = await readOwnersConfig(
|
|
10033
10133
|
snapshot,
|
|
10034
10134
|
options.aliasesPath ?? DEFAULT_OWNERS_ALIASES_PATH
|
|
10035
10135
|
);
|
|
@@ -10043,9 +10143,10 @@ var buildOwnershipAudit = async (targetPath, options, logger) => {
|
|
|
10043
10143
|
codeowners: parsedCodeowners,
|
|
10044
10144
|
trackedFiles: snapshot.trackedFiles,
|
|
10045
10145
|
evidence,
|
|
10046
|
-
aliases:
|
|
10146
|
+
aliases: configSource.aliases,
|
|
10147
|
+
ignoreAuthors: [...configSource.ignoreAuthors, ...options.ignoreAuthors ?? []],
|
|
10047
10148
|
minCommits,
|
|
10048
|
-
warnings: [...options.warnings ?? [], ...
|
|
10149
|
+
warnings: [...options.warnings ?? [], ...configSource.warnings]
|
|
10049
10150
|
});
|
|
10050
10151
|
return {
|
|
10051
10152
|
audit,
|
|
@@ -10122,6 +10223,7 @@ var toOwnershipAuditReport = (audit) => {
|
|
|
10122
10223
|
metrics: audit.metrics,
|
|
10123
10224
|
ghostOwners: audit.ghostOwners,
|
|
10124
10225
|
files: audit.files,
|
|
10226
|
+
ignoredAuthors: audit.ignoredAuthors,
|
|
10125
10227
|
warnings: audit.warnings
|
|
10126
10228
|
};
|
|
10127
10229
|
};
|
|
@@ -10825,6 +10927,7 @@ var buildOwnersReport = (input) => {
|
|
|
10825
10927
|
metrics: audit.available ? audit.metrics : null,
|
|
10826
10928
|
ghostOwners: audit.available ? audit.ghostOwners : [],
|
|
10827
10929
|
files,
|
|
10930
|
+
ignoredAuthors: audit.available ? audit.ignoredAuthors : [],
|
|
10828
10931
|
warnings: [...audit.warnings],
|
|
10829
10932
|
thresholds: {
|
|
10830
10933
|
...input.thresholds,
|
|
@@ -11129,6 +11232,7 @@ var runOwnersCommand = async (inputPath, options = {}, logger = createSilentLogg
|
|
|
11129
11232
|
minCommits,
|
|
11130
11233
|
...options.codeownersPath === void 0 ? {} : { codeownersPath: options.codeownersPath },
|
|
11131
11234
|
...options.aliasesPath === void 0 ? {} : { aliasesPath: options.aliasesPath },
|
|
11235
|
+
...options.ignoreAuthors === void 0 ? {} : { ignoreAuthors: options.ignoreAuthors },
|
|
11132
11236
|
warnings: callerWarnings
|
|
11133
11237
|
},
|
|
11134
11238
|
logger
|
|
@@ -12969,6 +13073,24 @@ var parseOwnersRatio = (value, optionName) => {
|
|
|
12969
13073
|
}
|
|
12970
13074
|
return parsed;
|
|
12971
13075
|
};
|
|
13076
|
+
var parseOwnersIgnoreAuthors = (values) => {
|
|
13077
|
+
if (values === void 0) {
|
|
13078
|
+
return void 0;
|
|
13079
|
+
}
|
|
13080
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13081
|
+
const patterns = [];
|
|
13082
|
+
for (const value of values) {
|
|
13083
|
+
const pattern = value.trim();
|
|
13084
|
+
if (pattern.length === 0) {
|
|
13085
|
+
throw new OwnersConfigurationError("--ignore-author must be a non-empty glob pattern");
|
|
13086
|
+
}
|
|
13087
|
+
const key = pattern.toLowerCase();
|
|
13088
|
+
if (seen.has(key)) continue;
|
|
13089
|
+
seen.add(key);
|
|
13090
|
+
patterns.push(pattern);
|
|
13091
|
+
}
|
|
13092
|
+
return patterns.length > 0 ? patterns : void 0;
|
|
13093
|
+
};
|
|
12972
13094
|
var parseCommentPullRequest = (value) => {
|
|
12973
13095
|
if (value === void 0) {
|
|
12974
13096
|
return void 0;
|
|
@@ -12988,7 +13110,12 @@ program.command("owners").alias("ownership").exitOverride().argument("[path]", "
|
|
|
12988
13110
|
"--format <mode>",
|
|
12989
13111
|
"output format: console (default), json (stable, sorted payload), md (pastes into a PR) or sarif (code scanning)"
|
|
12990
13112
|
).choices(["console", "json", "md", "sarif"]).default("console")
|
|
12991
|
-
).option("--output <file>", "write the rendered output to a file instead of stdout").option("--aliases <file>", "identity alias map", ".codesentinel/owners.json").
|
|
13113
|
+
).option("--output <file>", "write the rendered output to a file instead of stdout").option("--aliases <file>", "identity alias map", ".codesentinel/owners.json").addOption(
|
|
13114
|
+
new Option(
|
|
13115
|
+
"--ignore-author <glob>",
|
|
13116
|
+
"additional author glob to exclude from ownership evidence (repeatable; the defaults stay active)"
|
|
13117
|
+
).argParser(collectOptionValues)
|
|
13118
|
+
).option(
|
|
12992
13119
|
"--resolve-github",
|
|
12993
13120
|
"accepted for compatibility; not implemented in this iteration, the audit stays offline"
|
|
12994
13121
|
).addOption(
|
|
@@ -13005,6 +13132,7 @@ program.command("owners").alias("ownership").exitOverride().argument("[path]", "
|
|
|
13005
13132
|
const windowDays = parseOwnersInteger(options.windowDays, "--window-days", 1) ?? 90;
|
|
13006
13133
|
const minCommits = parseOwnersInteger(options.minCommits, "--min-commits", 0) ?? 2;
|
|
13007
13134
|
const top = parseOwnersInteger(options.top, "--top", 1) ?? 10;
|
|
13135
|
+
const ignoreAuthors = parseOwnersIgnoreAuthors(options.ignoreAuthor);
|
|
13008
13136
|
const commandOptions = {
|
|
13009
13137
|
...options.codeowners === void 0 ? {} : { codeownersPath: options.codeowners },
|
|
13010
13138
|
ref: options.ref,
|
|
@@ -13014,6 +13142,7 @@ program.command("owners").alias("ownership").exitOverride().argument("[path]", "
|
|
|
13014
13142
|
format: options.format,
|
|
13015
13143
|
...options.output === void 0 ? {} : { outputPath: options.output },
|
|
13016
13144
|
aliasesPath: options.aliases,
|
|
13145
|
+
...ignoreAuthors === void 0 ? {} : { ignoreAuthors },
|
|
13017
13146
|
toolVersion: version,
|
|
13018
13147
|
...options.resolveGithub === true ? { resolveGithub: true } : {},
|
|
13019
13148
|
thresholds: {
|