@attalabs/vinaya 0.31.0 → 0.32.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 +1 -2
- package/aeg-root/roles/developer/reference.md +3 -3
- package/aeg-root/templates/pr-report-template.md +7 -2
- package/dist/checks/bin/check-body-bare-digits.js +229 -86
- package/dist/checks/bin/check-branch-topology.js +101 -89
- package/dist/checks/bin/check-brief-shape.js +222 -79
- package/dist/checks/bin/check-changeset-coverage.js +739 -232
- package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
- package/dist/checks/bin/check-closes-n.js +101 -89
- package/dist/checks/bin/check-coherence.js +233 -129
- package/dist/checks/bin/check-dead-branch-push.js +97 -44
- package/dist/checks/bin/check-dispatch-readiness.js +238 -134
- package/dist/checks/bin/check-doc-coverage-push.js +722 -215
- package/dist/checks/bin/check-doc-coverage.js +726 -219
- package/dist/checks/bin/check-doctrine-no-procedures.js +222 -79
- package/dist/checks/bin/check-doctrine-portability.js +724 -217
- package/dist/checks/bin/check-evidence-fresh.js +720 -206
- package/dist/checks/bin/check-exec-bits.js +720 -213
- package/dist/checks/bin/check-first-push-dispatch.js +231 -129
- package/dist/checks/bin/check-issue-assignment.js +103 -91
- package/dist/checks/bin/check-issue-milestone-attach.js +94 -41
- package/dist/checks/bin/check-issue-objectives-numbering.js +94 -41
- package/dist/checks/bin/check-issue-parts-coverage.js +94 -41
- package/dist/checks/bin/check-issue-surface-globs.js +251 -127
- package/dist/checks/bin/check-issue-title-grammar.js +94 -41
- package/dist/checks/bin/check-issue-tranche-label.js +94 -41
- package/dist/checks/bin/check-main-branch-refusal.js +94 -41
- package/dist/checks/bin/check-no-disk-state.js +94 -41
- package/dist/checks/bin/check-pr-premise-reassert.js +222 -77
- package/dist/checks/bin/check-pr-report-density.js +94 -41
- package/dist/checks/bin/check-principal-test-plan-wait.js +94 -39
- package/dist/checks/bin/check-quoted-command.js +710 -201
- package/dist/checks/bin/check-reader-resolvable-prose.js +722 -213
- package/dist/checks/bin/check-registry-gates.js +104 -41
- package/dist/checks/bin/check-retired-vocabulary.js +708 -199
- package/dist/checks/bin/check-review-gate.js +224 -79
- package/dist/checks/bin/check-single-plan-pr.js +94 -41
- package/dist/checks/bin/check-surface-scope.js +101 -89
- package/dist/checks/bin/check-test-plan.js +94 -39
- package/dist/checks/bin/check-token-collection-wired.js +100 -42
- package/dist/checks/bin/check-token-report.js +96 -43
- package/dist/checks/bin/check-workspace-escape.js +722 -213
- package/dist/index.js +3725 -3148
- package/dist/lib/pre-push-cache-test-run.js +4175 -0
- package/dist/lib/pre-push-select-tests.js +709 -101
- package/package.json +3 -2
|
@@ -3,8 +3,8 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
// src/checks/bin/check-workspace-escape.ts
|
|
6
|
-
import { readdirSync, readFileSync as
|
|
7
|
-
import { join as
|
|
6
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7
|
+
import { join as join9 } from "node:path";
|
|
8
8
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
9
9
|
var GATE_AUDIENCE = {
|
|
10
10
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1038,7 +1038,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
1038
1038
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
1039
1039
|
|
|
1040
1040
|
// ../../node_modules/fast-content-type-parse/index.js
|
|
1041
|
-
var NullObject = function
|
|
1041
|
+
var NullObject = function NullObject() {};
|
|
1042
1042
|
NullObject.prototype = Object.create(null);
|
|
1043
1043
|
var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
1044
1044
|
var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
@@ -1132,8 +1132,8 @@ function isPlainObject2(value) {
|
|
|
1132
1132
|
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
|
1133
1133
|
}
|
|
1134
1134
|
async function fetchWrapper(requestOptions) {
|
|
1135
|
-
const
|
|
1136
|
-
if (!
|
|
1135
|
+
const fetch2 = requestOptions.request?.fetch || globalThis.fetch;
|
|
1136
|
+
if (!fetch2) {
|
|
1137
1137
|
throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");
|
|
1138
1138
|
}
|
|
1139
1139
|
const log = requestOptions.request?.log || console;
|
|
@@ -1145,7 +1145,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
1145
1145
|
]));
|
|
1146
1146
|
let fetchResponse;
|
|
1147
1147
|
try {
|
|
1148
|
-
fetchResponse = await
|
|
1148
|
+
fetchResponse = await fetch2(requestOptions.url, {
|
|
1149
1149
|
method: requestOptions.method,
|
|
1150
1150
|
body,
|
|
1151
1151
|
redirect: requestOptions.request?.redirect,
|
|
@@ -1782,27 +1782,27 @@ function splitTableRow(row) {
|
|
|
1782
1782
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1783
1783
|
}
|
|
1784
1784
|
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1785
|
-
function resolveWorkspaceEntry(
|
|
1786
|
-
if (
|
|
1787
|
-
const baseDir =
|
|
1785
|
+
function resolveWorkspaceEntry(entry, listDirs) {
|
|
1786
|
+
if (entry.endsWith("/*")) {
|
|
1787
|
+
const baseDir = entry.slice(0, -2);
|
|
1788
1788
|
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1789
1789
|
}
|
|
1790
|
-
if (
|
|
1790
|
+
if (entry.includes("*"))
|
|
1791
1791
|
return [];
|
|
1792
|
-
return [
|
|
1792
|
+
return [entry];
|
|
1793
1793
|
}
|
|
1794
1794
|
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1795
1795
|
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1796
|
-
const positive = workspaces.filter((
|
|
1797
|
-
const negative = workspaces.filter((
|
|
1796
|
+
const positive = workspaces.filter((entry) => !entry.startsWith("!"));
|
|
1797
|
+
const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
1798
1798
|
const excluded = new Set;
|
|
1799
|
-
for (const
|
|
1800
|
-
for (const member of resolveWorkspaceEntry(
|
|
1799
|
+
for (const entry of negative) {
|
|
1800
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs))
|
|
1801
1801
|
excluded.add(member);
|
|
1802
1802
|
}
|
|
1803
1803
|
const members = new Set;
|
|
1804
|
-
for (const
|
|
1805
|
-
for (const member of resolveWorkspaceEntry(
|
|
1804
|
+
for (const entry of positive) {
|
|
1805
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs)) {
|
|
1806
1806
|
if (!excluded.has(member))
|
|
1807
1807
|
members.add(member);
|
|
1808
1808
|
}
|
|
@@ -2126,15 +2126,15 @@ function summarizeTranscript(jsonl) {
|
|
|
2126
2126
|
const line = rawLine.trim();
|
|
2127
2127
|
if (!line)
|
|
2128
2128
|
continue;
|
|
2129
|
-
let
|
|
2129
|
+
let entry;
|
|
2130
2130
|
try {
|
|
2131
|
-
|
|
2131
|
+
entry = JSON.parse(line);
|
|
2132
2132
|
} catch {
|
|
2133
2133
|
continue;
|
|
2134
2134
|
}
|
|
2135
|
-
if (!
|
|
2135
|
+
if (!entry || typeof entry !== "object")
|
|
2136
2136
|
continue;
|
|
2137
|
-
const obj =
|
|
2137
|
+
const obj = entry;
|
|
2138
2138
|
if (obj.type !== "assistant")
|
|
2139
2139
|
continue;
|
|
2140
2140
|
const message = obj.message;
|
|
@@ -2982,7 +2982,7 @@ function isStep0Block(content) {
|
|
|
2982
2982
|
}
|
|
2983
2983
|
function checkCommandsCarryOutput(prBody) {
|
|
2984
2984
|
const errors = [];
|
|
2985
|
-
for (const [
|
|
2985
|
+
for (const [label, num] of [
|
|
2986
2986
|
["5", 5],
|
|
2987
2987
|
["6", 6]
|
|
2988
2988
|
]) {
|
|
@@ -2996,7 +2996,7 @@ function checkCommandsCarryOutput(prBody) {
|
|
|
2996
2996
|
continue;
|
|
2997
2997
|
const next = blocks[i + 1];
|
|
2998
2998
|
if (!next || isCommandBlock(next.content)) {
|
|
2999
|
-
errors.push(`brief-validation commands carry output: §${
|
|
2999
|
+
errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
|
|
3000
3000
|
}
|
|
3001
3001
|
}
|
|
3002
3002
|
}
|
|
@@ -3433,8 +3433,8 @@ function stripPartBackticks(text) {
|
|
|
3433
3433
|
function partWordCount(text) {
|
|
3434
3434
|
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3435
3435
|
}
|
|
3436
|
-
function looksLikeFilePath(
|
|
3437
|
-
const stripped =
|
|
3436
|
+
function looksLikeFilePath(entry) {
|
|
3437
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3438
3438
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3439
3439
|
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3440
3440
|
return extMatch !== null && extMatch.index > 0;
|
|
@@ -3920,14 +3920,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3920
3920
|
const referenced = extractClosesReferences(prBody);
|
|
3921
3921
|
if (taskIssueRefs) {
|
|
3922
3922
|
for (const n of referenced) {
|
|
3923
|
-
const
|
|
3924
|
-
if (!
|
|
3923
|
+
const ref = taskIssueRefs.get(n);
|
|
3924
|
+
if (!ref)
|
|
3925
3925
|
continue;
|
|
3926
|
-
const expectedBranch = `task/${
|
|
3926
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
3927
3927
|
if (branch !== expectedBranch) {
|
|
3928
3928
|
return {
|
|
3929
3929
|
ok: false,
|
|
3930
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3930
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
3931
3931
|
};
|
|
3932
3932
|
}
|
|
3933
3933
|
}
|
|
@@ -3936,15 +3936,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3936
3936
|
if (!ref)
|
|
3937
3937
|
return { ok: true };
|
|
3938
3938
|
if (ref.kind === "issue") {
|
|
3939
|
-
const
|
|
3940
|
-
if (!referenced.has(
|
|
3939
|
+
const expectedIssue = ref.issueNumber;
|
|
3940
|
+
if (!referenced.has(expectedIssue)) {
|
|
3941
3941
|
return {
|
|
3942
3942
|
ok: false,
|
|
3943
|
-
expectedIssue
|
|
3944
|
-
message: `closes-n: PR body does not contain \`Closes #${
|
|
3943
|
+
expectedIssue,
|
|
3944
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3945
3945
|
};
|
|
3946
3946
|
}
|
|
3947
|
-
return { ok: true, expectedIssue
|
|
3947
|
+
return { ok: true, expectedIssue };
|
|
3948
3948
|
}
|
|
3949
3949
|
const trancheSlug = ref.tranche;
|
|
3950
3950
|
const taskId = ref.taskId;
|
|
@@ -3990,8 +3990,8 @@ function extractIssue(body) {
|
|
|
3990
3990
|
const anchorNums = closesRefs(anchored);
|
|
3991
3991
|
if (anchorNums.length === 0)
|
|
3992
3992
|
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3993
|
-
const
|
|
3994
|
-
return { issue
|
|
3993
|
+
const issue = anchorNums[0];
|
|
3994
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
3995
3995
|
}
|
|
3996
3996
|
const headerNums = closesRefs(headerRegion(stripped));
|
|
3997
3997
|
if (bodyNums.length === 0)
|
|
@@ -4060,15 +4060,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4060
4060
|
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4061
4061
|
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4062
4062
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4063
|
-
const
|
|
4063
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4064
4064
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4065
4065
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4066
4066
|
return {
|
|
4067
|
-
bound: head && base && briefHashBound &&
|
|
4067
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4068
4068
|
head,
|
|
4069
4069
|
base,
|
|
4070
4070
|
briefHash: briefHashBound,
|
|
4071
|
-
objectivesVersion
|
|
4071
|
+
objectivesVersion,
|
|
4072
4072
|
rulingOrdinal,
|
|
4073
4073
|
policyDigest: policyDigestBound
|
|
4074
4074
|
};
|
|
@@ -5500,6 +5500,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5500
5500
|
}
|
|
5501
5501
|
return findings;
|
|
5502
5502
|
}
|
|
5503
|
+
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5504
|
+
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5505
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5506
|
+
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5503
5507
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5504
5508
|
import { createHash as createHash5 } from "node:crypto";
|
|
5505
5509
|
|
|
@@ -6038,6 +6042,7 @@ function redact(value, home) {
|
|
|
6038
6042
|
return value;
|
|
6039
6043
|
}
|
|
6040
6044
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6045
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6041
6046
|
function metaOf(obj) {
|
|
6042
6047
|
if (obj === null || typeof obj !== "object")
|
|
6043
6048
|
return null;
|
|
@@ -6060,11 +6065,61 @@ function recordIdentity(obj) {
|
|
|
6060
6065
|
}
|
|
6061
6066
|
return null;
|
|
6062
6067
|
}
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
+
function schemaVersionOf(obj) {
|
|
6069
|
+
const meta = metaOf(obj);
|
|
6070
|
+
const schema = meta?.schema;
|
|
6071
|
+
return typeof schema === "number" ? schema : null;
|
|
6072
|
+
}
|
|
6073
|
+
function isKnownSchema(version) {
|
|
6074
|
+
return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
|
|
6075
|
+
}
|
|
6076
|
+
function classifyStoredLine(raw, home) {
|
|
6077
|
+
let obj;
|
|
6078
|
+
try {
|
|
6079
|
+
obj = JSON.parse(raw);
|
|
6080
|
+
} catch {
|
|
6081
|
+
return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
|
|
6082
|
+
}
|
|
6083
|
+
const version = schemaVersionOf(obj);
|
|
6084
|
+
if (version === null) {
|
|
6085
|
+
return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
|
|
6086
|
+
}
|
|
6087
|
+
if (!isKnownSchema(version)) {
|
|
6088
|
+
return {
|
|
6089
|
+
status: "unknown_version",
|
|
6090
|
+
identity: recordIdentity(obj),
|
|
6091
|
+
schema: version,
|
|
6092
|
+
raw,
|
|
6093
|
+
reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
|
|
6094
|
+
};
|
|
6095
|
+
}
|
|
6096
|
+
const result = LogEventSchema.safeParse(obj);
|
|
6097
|
+
if (!result.success) {
|
|
6098
|
+
return {
|
|
6099
|
+
status: "invalid",
|
|
6100
|
+
identity: recordIdentity(obj),
|
|
6101
|
+
raw,
|
|
6102
|
+
reason: result.error.issues[0]?.message ?? "schema violation"
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
const event = result.data;
|
|
6106
|
+
const identity = recordIdentity(event);
|
|
6107
|
+
if (identity === null) {
|
|
6108
|
+
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6109
|
+
}
|
|
6110
|
+
const redacted = redact(event, home);
|
|
6111
|
+
const provenance = version === 2 ? event.meta.provenance ?? null : null;
|
|
6112
|
+
return {
|
|
6113
|
+
status: "ok",
|
|
6114
|
+
identity,
|
|
6115
|
+
runId: event.meta.run_id,
|
|
6116
|
+
seq: event.meta.seq,
|
|
6117
|
+
schema: version,
|
|
6118
|
+
provenance,
|
|
6119
|
+
event,
|
|
6120
|
+
postLine: JSON.stringify(redacted)
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6068
6123
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6069
6124
|
import { z as z3 } from "zod";
|
|
6070
6125
|
var isoTimestamp = z3.string().min(1);
|
|
@@ -6195,11 +6250,12 @@ var ResolutionRecordSchema = z3.object({
|
|
|
6195
6250
|
consumedAt: isoTimestamp
|
|
6196
6251
|
}).strict();
|
|
6197
6252
|
// src/lib/diff-evidence.ts
|
|
6198
|
-
import { execFileSync as
|
|
6199
|
-
import { join as
|
|
6253
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
6254
|
+
import { join as join8, relative, resolve as resolve2 } from "node:path";
|
|
6200
6255
|
|
|
6201
6256
|
// src/lib/config.ts
|
|
6202
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6257
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6258
|
+
import { promisify as promisify4 } from "node:util";
|
|
6203
6259
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6204
6260
|
import { homedir } from "node:os";
|
|
6205
6261
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -6226,10 +6282,10 @@ var CheckEntrySchema = z4.object({
|
|
|
6226
6282
|
ownWorkflow: z4.boolean().optional(),
|
|
6227
6283
|
principalOwed: z4.literal(true).optional(),
|
|
6228
6284
|
validates: z4.enum(["body", "issue"]).optional()
|
|
6229
|
-
}).superRefine((
|
|
6230
|
-
if (!
|
|
6285
|
+
}).superRefine((entry, ctx) => {
|
|
6286
|
+
if (!entry.env)
|
|
6231
6287
|
return;
|
|
6232
|
-
for (const [key, value] of Object.entries(
|
|
6288
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6233
6289
|
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6234
6290
|
continue;
|
|
6235
6291
|
const members = value.anyOf;
|
|
@@ -6386,18 +6442,19 @@ var VinayaConfigSchema = z4.object({
|
|
|
6386
6442
|
});
|
|
6387
6443
|
}
|
|
6388
6444
|
}).optional(),
|
|
6389
|
-
logPublish: z4.
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
}).refine((v) => v.
|
|
6398
|
-
message: "
|
|
6399
|
-
}).
|
|
6400
|
-
|
|
6445
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6446
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6447
|
+
}),
|
|
6448
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6449
|
+
logs: z4.object({
|
|
6450
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6451
|
+
url: z4.string().url().optional(),
|
|
6452
|
+
headers: z4.record(z4.string()).optional()
|
|
6453
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6454
|
+
message: "logs: set at most one of folder/url"
|
|
6455
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6456
|
+
message: "logs: headers requires url"
|
|
6457
|
+
}).optional()
|
|
6401
6458
|
});
|
|
6402
6459
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
6403
6460
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -6442,32 +6499,39 @@ function globalTokensCollectIgnoredWarning(path) {
|
|
|
6442
6499
|
function globalRuntimeDirIgnoredWarning(path) {
|
|
6443
6500
|
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6444
6501
|
}
|
|
6502
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6503
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6504
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6505
|
+
return;
|
|
6506
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6507
|
+
console.error(`⚠ ${message}`);
|
|
6508
|
+
}
|
|
6445
6509
|
function stripGlobalOnlyKeys(config, path) {
|
|
6446
6510
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
6447
6511
|
return config;
|
|
6448
6512
|
let result = config;
|
|
6449
6513
|
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6450
|
-
|
|
6514
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6451
6515
|
result = { ...result, checks: undefined };
|
|
6452
6516
|
}
|
|
6453
6517
|
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6454
|
-
|
|
6518
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6455
6519
|
result = { ...result, roles: undefined };
|
|
6456
6520
|
}
|
|
6457
6521
|
if (result.principals && result.principals.length > 0) {
|
|
6458
|
-
|
|
6522
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6459
6523
|
result = { ...result, principals: undefined };
|
|
6460
6524
|
}
|
|
6461
6525
|
if (result.releaseActor) {
|
|
6462
|
-
|
|
6526
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6463
6527
|
result = { ...result, releaseActor: undefined };
|
|
6464
6528
|
}
|
|
6465
6529
|
if (result.tokens) {
|
|
6466
|
-
|
|
6530
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6467
6531
|
result = { ...result, tokens: undefined };
|
|
6468
6532
|
}
|
|
6469
6533
|
if (result.runtimeDir) {
|
|
6470
|
-
|
|
6534
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6471
6535
|
result = { ...result, runtimeDir: undefined };
|
|
6472
6536
|
}
|
|
6473
6537
|
return result;
|
|
@@ -6500,25 +6564,80 @@ function resolveReviewPolicy(config) {
|
|
|
6500
6564
|
maxRounds
|
|
6501
6565
|
};
|
|
6502
6566
|
}
|
|
6503
|
-
function
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6567
|
+
function resolveRuntimeDirSetting(config) {
|
|
6568
|
+
return config?.runtimeDir ?? null;
|
|
6569
|
+
}
|
|
6570
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6571
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6572
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6573
|
+
}
|
|
6574
|
+
function resolveLogsSetting(config) {
|
|
6575
|
+
const raw = config?.logs;
|
|
6576
|
+
if (!raw)
|
|
6577
|
+
return null;
|
|
6578
|
+
if (raw.url !== undefined)
|
|
6579
|
+
return { url: raw.url, headers: raw.headers };
|
|
6580
|
+
if (raw.folder !== undefined)
|
|
6581
|
+
return { folder: raw.folder };
|
|
6582
|
+
return null;
|
|
6583
|
+
}
|
|
6584
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6585
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6586
|
+
if (!anchored)
|
|
6587
|
+
return null;
|
|
6588
|
+
if ("url" in local)
|
|
6589
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6590
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6591
|
+
}
|
|
6592
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6593
|
+
if (!headers)
|
|
6594
|
+
return;
|
|
6595
|
+
const resolved = {};
|
|
6596
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6597
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6510
6598
|
}
|
|
6599
|
+
return resolved;
|
|
6600
|
+
}
|
|
6601
|
+
function trustAnchorRepo() {
|
|
6602
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6603
|
+
if (fromRunner)
|
|
6604
|
+
return fromRunner;
|
|
6511
6605
|
try {
|
|
6512
6606
|
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6513
6607
|
encoding: "utf-8",
|
|
6514
6608
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6515
|
-
})
|
|
6516
|
-
|
|
6517
|
-
|
|
6609
|
+
});
|
|
6610
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6611
|
+
} catch {
|
|
6612
|
+
return null;
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
async function trustAnchorRepoAsync() {
|
|
6616
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6617
|
+
if (fromRunner)
|
|
6618
|
+
return fromRunner;
|
|
6619
|
+
try {
|
|
6620
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6621
|
+
encoding: "utf-8",
|
|
6622
|
+
timeout: 1e4
|
|
6623
|
+
});
|
|
6624
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6518
6625
|
} catch {
|
|
6519
6626
|
return null;
|
|
6520
6627
|
}
|
|
6521
6628
|
}
|
|
6629
|
+
function wellFormedRepoSlug(slug) {
|
|
6630
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6631
|
+
}
|
|
6632
|
+
function trustAnchorRepoFromRunner() {
|
|
6633
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6634
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6635
|
+
}
|
|
6636
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6637
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6638
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6639
|
+
}
|
|
6640
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6522
6641
|
function ghFetchTrustAnchorConfig() {
|
|
6523
6642
|
const repo = trustAnchorRepo();
|
|
6524
6643
|
if (!repo)
|
|
@@ -6528,6 +6647,13 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6528
6647
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6529
6648
|
});
|
|
6530
6649
|
}
|
|
6650
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6651
|
+
const repo = await trustAnchorRepoAsync();
|
|
6652
|
+
if (!repo)
|
|
6653
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6654
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6655
|
+
return stdout;
|
|
6656
|
+
}
|
|
6531
6657
|
function firstLine(err) {
|
|
6532
6658
|
return err?.message?.split(`
|
|
6533
6659
|
`)[0] ?? "unknown error";
|
|
@@ -6542,16 +6668,35 @@ function isMissingFileError(err) {
|
|
|
6542
6668
|
return /\b404\b|not found/i.test(haystack);
|
|
6543
6669
|
}
|
|
6544
6670
|
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6545
|
-
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6546
|
-
`);
|
|
6547
6671
|
let base64;
|
|
6548
6672
|
try {
|
|
6549
|
-
base64 = fetcher()
|
|
6673
|
+
base64 = fetcher();
|
|
6550
6674
|
} catch (err) {
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6675
|
+
return trustAnchorFetchFailed(err);
|
|
6676
|
+
}
|
|
6677
|
+
return parseTrustAnchorContent(base64);
|
|
6678
|
+
}
|
|
6679
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6680
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6681
|
+
let base64;
|
|
6682
|
+
try {
|
|
6683
|
+
base64 = await fetcher();
|
|
6684
|
+
} catch (err) {
|
|
6685
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6554
6686
|
}
|
|
6687
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6688
|
+
}
|
|
6689
|
+
function warnTrustAnchorFallback(why) {
|
|
6690
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6691
|
+
`);
|
|
6692
|
+
}
|
|
6693
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6694
|
+
if (!isMissingFileError(err))
|
|
6695
|
+
warn(firstLine(err));
|
|
6696
|
+
return null;
|
|
6697
|
+
}
|
|
6698
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6699
|
+
const base64 = content.trim();
|
|
6555
6700
|
if (!base64)
|
|
6556
6701
|
return null;
|
|
6557
6702
|
try {
|
|
@@ -6581,6 +6726,8 @@ var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.j
|
|
|
6581
6726
|
|
|
6582
6727
|
// src/lib/brief-assembly.ts
|
|
6583
6728
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
6729
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
|
|
6730
|
+
import { join as join3 } from "node:path";
|
|
6584
6731
|
|
|
6585
6732
|
// ../../packages/sources/src/commands.ts
|
|
6586
6733
|
var COMMANDS = [
|
|
@@ -6733,10 +6880,10 @@ var COMMANDS = [
|
|
|
6733
6880
|
}
|
|
6734
6881
|
],
|
|
6735
6882
|
details: [
|
|
6736
|
-
"Composes `task brief`'s own preparation (`prepareTask`) with `dev-review-loop`
|
|
6883
|
+
"Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
6737
6884
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
6738
|
-
"Refuses when the frozen brief's developer branch already has an open pull request —
|
|
6739
|
-
"Exit and printed summary distinguish a published
|
|
6885
|
+
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
6886
|
+
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the exact `vinaya task run <tranche> <n>` command to continue by hand), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
6740
6887
|
],
|
|
6741
6888
|
status: "shipped"
|
|
6742
6889
|
},
|
|
@@ -6905,48 +7052,6 @@ var COMMANDS = [
|
|
|
6905
7052
|
],
|
|
6906
7053
|
status: "shipped"
|
|
6907
7054
|
},
|
|
6908
|
-
{
|
|
6909
|
-
name: "log flush",
|
|
6910
|
-
description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
|
|
6911
|
-
flags: [
|
|
6912
|
-
{ flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
|
|
6913
|
-
{
|
|
6914
|
-
flag: "--pr",
|
|
6915
|
-
description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
|
|
6916
|
-
},
|
|
6917
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6918
|
-
],
|
|
6919
|
-
details: [
|
|
6920
|
-
"Exactly one of `--issue`/`--pr` is required. `--pr` resolves the Issue from the PR body's `Closes #N` line — the same anchor every gate reads — and refuses with a check error naming the missing line when the body carries none.",
|
|
6921
|
-
"Splits the outbox first at `run_id` boundaries (a maximal run of consecutive lines sharing one `run_id`, never a global group-by, so an interleaved outbox never produces a range spanning a gap), then at `FORGE_COMMENT_MAX_CHARS` (65536) within each run. Each comment opens with `<!-- aeg:log:<run_id>:<seq_from>-<seq_to> -->` on its own line, then one fenced `ndjson` block, one outbox line per line, verbatim. A single line too large to fit alone is refused by name, never split across two comments.",
|
|
6922
|
-
"Logs its own `forge_write` line — `validated` before posting, `written` (with every returned comment id) after the last post succeeds, or `refused` (with gh's error) on any failure — through the same `log()` every other family uses, into the same outbox, before truncating. The outbox is truncated only to the lines confirmed posted; a failed chunk's lines, and anything appended to the outbox during the flush (including the flush's own `validated`/`written`/`refused` line), always survive to ride the next flush."
|
|
6923
|
-
],
|
|
6924
|
-
status: "shipped"
|
|
6925
|
-
},
|
|
6926
|
-
{
|
|
6927
|
-
name: "log export-artifact",
|
|
6928
|
-
description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
|
|
6929
|
-
flags: [],
|
|
6930
|
-
details: [
|
|
6931
|
-
"Concatenates every `*.ndjson` file under `~/.vinaya/outbox/` into `<dest>`, verbatim — no filtering, no second redaction pass (lines are already redacted at `log()`'s own write boundary). Writes nothing when the outbox is empty, and exits 0 either way: no gate events this run is a legitimate outcome, never a failure.",
|
|
6932
|
-
"Runs inside the generated `vinaya-checks.yml` job, which holds no forge-write credential — this command never calls the forge. Both this step and the `actions/upload-artifact` step after it run `if: always()`, so a cancelled or failed job still exports whatever partial outbox it has."
|
|
6933
|
-
],
|
|
6934
|
-
status: "shipped"
|
|
6935
|
-
},
|
|
6936
|
-
{
|
|
6937
|
-
name: "log collect-artifact",
|
|
6938
|
-
description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
|
|
6939
|
-
flags: [
|
|
6940
|
-
{ flag: "--pr", description: "The pull request this artifact belongs to" },
|
|
6941
|
-
{ flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
|
|
6942
|
-
],
|
|
6943
|
-
details: [
|
|
6944
|
-
"Runs inside the generated `vinaya-task-log-collector.yml` workflow — a `workflow_run`-triggered job on the default branch, holding the write credential the task-path job that produced the artifact never gets. `<path>` is already downloaded by that workflow, scoped to a specific, API-verified run id — a provenance guarantee this command never re-derives from the artifact bytes.",
|
|
6945
|
-
"Never executes, imports, or evaluates the artifact's content: every line is read as text and validated (schema, an 8 MiB whole-artifact size cap, redaction, and a repo cross-check) before anything is trusted. A rejected line becomes a named gap — printed, never a silent drop — and the artifact is never partially trusted past that check into executing anything.",
|
|
6946
|
-
"The valid, re-redacted survivors are appended into the same local outbox `vinaya log flush` would read for that PR's Issue, then published through the existing `flushOutbox` unmodified — reusing its chunking, its `<!-- aeg:log:… -->` marker, and its idempotent-retry read, rather than a second publisher. A retried collector run (a fresh runner, the same forge state) therefore dedupes for free: the marker already on the forge is acknowledged, never re-posted."
|
|
6947
|
-
],
|
|
6948
|
-
status: "shipped"
|
|
6949
|
-
},
|
|
6950
7055
|
{
|
|
6951
7056
|
name: "milestone create",
|
|
6952
7057
|
description: "Create a GitHub Milestone from a validated body",
|
|
@@ -7276,7 +7381,7 @@ var COMMANDS = [
|
|
|
7276
7381
|
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
7277
7382
|
{
|
|
7278
7383
|
flag: "--pr",
|
|
7279
|
-
description: "
|
|
7384
|
+
description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
|
|
7280
7385
|
},
|
|
7281
7386
|
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
7282
7387
|
{
|
|
@@ -7288,7 +7393,7 @@ var COMMANDS = [
|
|
|
7288
7393
|
details: [
|
|
7289
7394
|
"Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
|
|
7290
7395
|
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `refused`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
|
|
7291
|
-
"
|
|
7396
|
+
"Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
|
|
7292
7397
|
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude/gemini: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`; `gemini ... --resume <id> ...`) in place of its first-dispatch args."
|
|
7293
7398
|
],
|
|
7294
7399
|
status: "shipped"
|
|
@@ -7308,7 +7413,8 @@ var COMMANDS = [
|
|
|
7308
7413
|
"Dispatches the developer through `dispatchRole` with the brief read from the Issue, waits for the PR it opens, then runs `assessRound` (`@attalabs/aeg-core`) — the entire policy — against observations this command reads from the forge: the head via `git ls-remote` only (never `gh pr view headRefOid`, which can lag a push), CI conclusion via the check-runs API (never run locally), and ruling comments matching `<!-- aeg:principal:ruling:<pr>-<k> -->`.",
|
|
7309
7414
|
"Nothing is posted to the PR before the policy decides `publish`: each round's reviewer and security verdicts are dispatched fresh (never a resumed session) through `dispatchRole`, rendered through `review post`'s own render functions, and written to a local file under the outbox — never `gh pr comment`/`gh pr review`. Posting the held verdicts is a separate, later task.",
|
|
7310
7415
|
"The developer's session is resumed every round via `dispatchRole`'s `resumeId` — never a fresh session — for every vendor; a round whose resume fails for a vendor that resumed successfully the round before stops the loop rather than silently falling back to a fresh developer session.",
|
|
7311
|
-
"Every dispatch and round transition is a log line through the Vinaya Log,
|
|
7416
|
+
"Every dispatch and round transition is a log line through the Vinaya Log, delivered live to its configured `logs` destination as it is emitted — never a tracker comment.",
|
|
7417
|
+
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
7312
7418
|
],
|
|
7313
7419
|
status: "shipped"
|
|
7314
7420
|
}
|
|
@@ -7445,25 +7551,6 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
7445
7551
|
};
|
|
7446
7552
|
}
|
|
7447
7553
|
|
|
7448
|
-
// src/lib/brief-assembly.ts
|
|
7449
|
-
function git(args) {
|
|
7450
|
-
try {
|
|
7451
|
-
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7452
|
-
} catch {
|
|
7453
|
-
return "";
|
|
7454
|
-
}
|
|
7455
|
-
}
|
|
7456
|
-
function expandGlob(glob) {
|
|
7457
|
-
const out = git(["ls-files", "--", glob]);
|
|
7458
|
-
return out.split(`
|
|
7459
|
-
`).map((s) => s.trim()).filter(Boolean);
|
|
7460
|
-
}
|
|
7461
|
-
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7462
|
-
|
|
7463
|
-
// src/checks/registry.ts
|
|
7464
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
7465
|
-
import { join as join3 } from "node:path";
|
|
7466
|
-
|
|
7467
7554
|
// src/lib/package-root.ts
|
|
7468
7555
|
import { existsSync as existsSync2 } from "node:fs";
|
|
7469
7556
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
@@ -7481,13 +7568,33 @@ function packageRoot(moduleUrl) {
|
|
|
7481
7568
|
return dir;
|
|
7482
7569
|
}
|
|
7483
7570
|
|
|
7571
|
+
// src/lib/brief-assembly.ts
|
|
7572
|
+
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
7573
|
+
var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
|
|
7574
|
+
var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7575
|
+
function git(args) {
|
|
7576
|
+
try {
|
|
7577
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7578
|
+
} catch {
|
|
7579
|
+
return "";
|
|
7580
|
+
}
|
|
7581
|
+
}
|
|
7582
|
+
function expandGlob(glob) {
|
|
7583
|
+
const out = git(["ls-files", "--", glob]);
|
|
7584
|
+
return out.split(`
|
|
7585
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
7586
|
+
}
|
|
7587
|
+
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7588
|
+
|
|
7484
7589
|
// src/checks/registry.ts
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
var
|
|
7590
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
7591
|
+
import { join as join4 } from "node:path";
|
|
7592
|
+
var DIST_BIN_DIR = join4(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7593
|
+
var SRC_BIN_DIR = join4(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7594
|
+
var BIN_DIR = existsSync4(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7488
7595
|
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7489
7596
|
function bin(name) {
|
|
7490
|
-
return
|
|
7597
|
+
return join4(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7491
7598
|
}
|
|
7492
7599
|
var REGISTRY = [
|
|
7493
7600
|
[
|
|
@@ -7899,6 +8006,16 @@ var REGISTRY = [
|
|
|
7899
8006
|
},
|
|
7900
8007
|
0
|
|
7901
8008
|
],
|
|
8009
|
+
[
|
|
8010
|
+
{
|
|
8011
|
+
name: "ci-shard-coverage",
|
|
8012
|
+
run: bin("check-ci-shard-coverage"),
|
|
8013
|
+
scope: "diff",
|
|
8014
|
+
timeoutMs: 15000,
|
|
8015
|
+
env: {}
|
|
8016
|
+
},
|
|
8017
|
+
0
|
|
8018
|
+
],
|
|
7902
8019
|
[
|
|
7903
8020
|
{
|
|
7904
8021
|
name: "workspace-escape",
|
|
@@ -8036,42 +8153,382 @@ function coreCheckRegistry() {
|
|
|
8036
8153
|
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
8037
8154
|
|
|
8038
8155
|
// src/lib/log-sink.ts
|
|
8039
|
-
import {
|
|
8040
|
-
import { randomUUID } from "node:crypto";
|
|
8156
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
8157
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8158
|
+
import {
|
|
8159
|
+
closeSync as closeSync3,
|
|
8160
|
+
constants as fsConstants3,
|
|
8161
|
+
existsSync as existsSync6,
|
|
8162
|
+
fstatSync as fstatSync2,
|
|
8163
|
+
mkdirSync as mkdirSync3,
|
|
8164
|
+
openSync as openSync3,
|
|
8165
|
+
readFileSync as readFileSync5,
|
|
8166
|
+
renameSync as renameSync2,
|
|
8167
|
+
writeSync as writeSync2
|
|
8168
|
+
} from "node:fs";
|
|
8169
|
+
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8170
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
8171
|
+
import { promisify as promisify5 } from "node:util";
|
|
8172
|
+
|
|
8173
|
+
// src/lib/run-paths.ts
|
|
8174
|
+
import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
8175
|
+
import { dirname as dirname3, join as join5, resolve as resolvePath } from "node:path";
|
|
8176
|
+
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8177
|
+
function isSafeRepoSegment(segment) {
|
|
8178
|
+
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
8179
|
+
}
|
|
8180
|
+
function repoSegment(repo) {
|
|
8181
|
+
if (!repo || !isSafeRepoSegment(repo.owner) || !isSafeRepoSegment(repo.repo))
|
|
8182
|
+
return "unresolved";
|
|
8183
|
+
return `${repo.owner}-${repo.repo}`;
|
|
8184
|
+
}
|
|
8185
|
+
function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
|
|
8186
|
+
return join5(home, "runtime", repoSegment(repo));
|
|
8187
|
+
}
|
|
8188
|
+
function resolveRuntimeDir(input) {
|
|
8189
|
+
const local = resolveRuntimeDirSetting(input.localConfig);
|
|
8190
|
+
if (local === null)
|
|
8191
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8192
|
+
if (isInsideRepo(local, input.repoRoot))
|
|
8193
|
+
return defaultRuntimeDir(input.repo, input.home);
|
|
8194
|
+
if (!input.unattended)
|
|
8195
|
+
return local;
|
|
8196
|
+
const anchored = resolveTrustAnchorRuntimeDir(local, input.trustAnchorConfig ?? null);
|
|
8197
|
+
return anchored ?? defaultRuntimeDir(input.repo, input.home);
|
|
8198
|
+
}
|
|
8199
|
+
function isInsideRepo(candidate, repoRoot) {
|
|
8200
|
+
if (!repoRoot)
|
|
8201
|
+
return false;
|
|
8202
|
+
const root = resolvePath(repoRoot);
|
|
8203
|
+
const target = resolvePath(candidate);
|
|
8204
|
+
return target === root || target.startsWith(`${root}/`);
|
|
8205
|
+
}
|
|
8206
|
+
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8207
|
+
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8208
|
+
function isUnattendedProcess(env = process.env) {
|
|
8209
|
+
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8210
|
+
}
|
|
8211
|
+
var memoized = null;
|
|
8212
|
+
async function runtimeDirForRepoAsync(repo) {
|
|
8213
|
+
const key = repoSegment(repo);
|
|
8214
|
+
if (memoized?.key === key)
|
|
8215
|
+
return memoized.value;
|
|
8216
|
+
const inputs = runtimeDirInputs();
|
|
8217
|
+
if (typeof inputs === "string")
|
|
8218
|
+
return inputs;
|
|
8219
|
+
const value = resolveRuntimeDir({
|
|
8220
|
+
repo,
|
|
8221
|
+
...inputs.base,
|
|
8222
|
+
trustAnchorConfig: inputs.needsAnchor ? await loadTrustAnchorConfigAsync() : null
|
|
8223
|
+
});
|
|
8224
|
+
memoized = { key, value };
|
|
8225
|
+
return value;
|
|
8226
|
+
}
|
|
8227
|
+
function runtimeDirInputs() {
|
|
8228
|
+
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8229
|
+
if (handedDown)
|
|
8230
|
+
return handedDown;
|
|
8231
|
+
const localConfig = loadConfig();
|
|
8232
|
+
const unattended = isUnattendedProcess();
|
|
8233
|
+
return {
|
|
8234
|
+
base: { localConfig, unattended, repoRoot: repoRootSync() },
|
|
8235
|
+
needsAnchor: unattended && resolveRuntimeDirSetting(localConfig) !== null
|
|
8236
|
+
};
|
|
8237
|
+
}
|
|
8238
|
+
function repoRootSync(start = process.cwd()) {
|
|
8239
|
+
let dir;
|
|
8240
|
+
try {
|
|
8241
|
+
dir = realpathSync2(start);
|
|
8242
|
+
} catch {
|
|
8243
|
+
return null;
|
|
8244
|
+
}
|
|
8245
|
+
for (;; ) {
|
|
8246
|
+
if (existsSync5(join5(dir, ".git")))
|
|
8247
|
+
return dir;
|
|
8248
|
+
const parent = dirname3(dir);
|
|
8249
|
+
if (parent === dir)
|
|
8250
|
+
return null;
|
|
8251
|
+
dir = parent;
|
|
8252
|
+
}
|
|
8253
|
+
}
|
|
8254
|
+
|
|
8255
|
+
// src/lib/log-webhook-drain.ts
|
|
8041
8256
|
import {
|
|
8042
8257
|
closeSync as closeSync2,
|
|
8043
8258
|
constants as fsConstants2,
|
|
8044
|
-
|
|
8045
|
-
fstatSync as fstatSync2,
|
|
8259
|
+
lstatSync,
|
|
8046
8260
|
mkdirSync as mkdirSync2,
|
|
8047
8261
|
openSync as openSync2,
|
|
8048
|
-
|
|
8262
|
+
linkSync,
|
|
8263
|
+
readFileSync as readFileSync4,
|
|
8049
8264
|
renameSync,
|
|
8265
|
+
statSync,
|
|
8266
|
+
unlinkSync,
|
|
8267
|
+
writeFileSync as writeFileSync2,
|
|
8050
8268
|
writeSync
|
|
8051
8269
|
} from "node:fs";
|
|
8052
|
-
import {
|
|
8053
|
-
import {
|
|
8054
|
-
|
|
8270
|
+
import { randomUUID } from "node:crypto";
|
|
8271
|
+
import { homedir as homedir2 } from "node:os";
|
|
8272
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
8273
|
+
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8274
|
+
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8275
|
+
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8276
|
+
function isSafeRepoSegment2(segment) {
|
|
8277
|
+
return SAFE_PATH_SEGMENT2.test(segment) && !segment.includes("..");
|
|
8278
|
+
}
|
|
8279
|
+
function isErrnoCode(err, code) {
|
|
8280
|
+
return typeof err === "object" && err !== null && err.code === code;
|
|
8281
|
+
}
|
|
8055
8282
|
function isEnoent(err) {
|
|
8283
|
+
return isErrnoCode(err, "ENOENT");
|
|
8284
|
+
}
|
|
8285
|
+
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8286
|
+
function tryCreateLock(lockPath, token) {
|
|
8287
|
+
try {
|
|
8288
|
+
mkdirSync2(dirname4(lockPath), { recursive: true, mode: 448 });
|
|
8289
|
+
const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
|
|
8290
|
+
try {
|
|
8291
|
+
writeSync(fd, `${token}
|
|
8292
|
+
`);
|
|
8293
|
+
} finally {
|
|
8294
|
+
closeSync2(fd);
|
|
8295
|
+
}
|
|
8296
|
+
return true;
|
|
8297
|
+
} catch (err) {
|
|
8298
|
+
if (isErrnoCode(err, "EEXIST"))
|
|
8299
|
+
return false;
|
|
8300
|
+
throw err;
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
function acquireDrainLock(lockPath) {
|
|
8304
|
+
const token = `${process.pid}:${randomUUID()}`;
|
|
8305
|
+
if (tryCreateLock(lockPath, token))
|
|
8306
|
+
return token;
|
|
8307
|
+
let observedMtimeMs;
|
|
8308
|
+
try {
|
|
8309
|
+
observedMtimeMs = statSync(lockPath).mtimeMs;
|
|
8310
|
+
} catch (err) {
|
|
8311
|
+
if (!isEnoent(err))
|
|
8312
|
+
throw err;
|
|
8313
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8314
|
+
}
|
|
8315
|
+
if (Date.now() - observedMtimeMs <= WEBHOOK_DRAIN_LOCK_STALE_MS)
|
|
8316
|
+
return null;
|
|
8317
|
+
const claimed = `${lockPath}.claimed-${randomUUID()}`;
|
|
8318
|
+
try {
|
|
8319
|
+
renameSync(lockPath, claimed);
|
|
8320
|
+
} catch (err) {
|
|
8321
|
+
if (isEnoent(err))
|
|
8322
|
+
return null;
|
|
8323
|
+
throw err;
|
|
8324
|
+
}
|
|
8325
|
+
let claimedMtimeMs = null;
|
|
8326
|
+
try {
|
|
8327
|
+
claimedMtimeMs = statSync(claimed).mtimeMs;
|
|
8328
|
+
} catch (err) {
|
|
8329
|
+
if (!isEnoent(err))
|
|
8330
|
+
throw err;
|
|
8331
|
+
}
|
|
8332
|
+
if (claimedMtimeMs !== observedMtimeMs) {
|
|
8333
|
+
try {
|
|
8334
|
+
linkSync(claimed, lockPath);
|
|
8335
|
+
} catch (err) {
|
|
8336
|
+
if (!isErrnoCode(err, "EEXIST"))
|
|
8337
|
+
throw err;
|
|
8338
|
+
}
|
|
8339
|
+
try {
|
|
8340
|
+
unlinkSync(claimed);
|
|
8341
|
+
} catch (err) {
|
|
8342
|
+
if (!isEnoent(err))
|
|
8343
|
+
throw err;
|
|
8344
|
+
}
|
|
8345
|
+
return null;
|
|
8346
|
+
}
|
|
8347
|
+
unlinkSync(claimed);
|
|
8348
|
+
return tryCreateLock(lockPath, token) ? token : null;
|
|
8349
|
+
}
|
|
8350
|
+
function releaseDrainLock(lockPath, token) {
|
|
8351
|
+
try {
|
|
8352
|
+
const holder = readFileSync4(lockPath, "utf8").trim();
|
|
8353
|
+
if (holder !== token)
|
|
8354
|
+
return;
|
|
8355
|
+
unlinkSync(lockPath);
|
|
8356
|
+
} catch (err) {
|
|
8357
|
+
if (!isEnoent(err))
|
|
8358
|
+
throw err;
|
|
8359
|
+
}
|
|
8360
|
+
}
|
|
8361
|
+
|
|
8362
|
+
class WebhookDrainError extends Error {
|
|
8363
|
+
code;
|
|
8364
|
+
constructor(code, message) {
|
|
8365
|
+
super(message);
|
|
8366
|
+
this.code = code;
|
|
8367
|
+
}
|
|
8368
|
+
}
|
|
8369
|
+
async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
|
|
8370
|
+
const resolved = await resolveRepo();
|
|
8371
|
+
const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
|
|
8372
|
+
const outboxRoot = () => join6(GLOBAL_VINAYA_HOME, "outbox");
|
|
8373
|
+
const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
|
|
8374
|
+
const lockPath = `${path}.flush-lock`;
|
|
8375
|
+
const lockToken = acquireDrainLock(lockPath);
|
|
8376
|
+
if (lockToken === null)
|
|
8377
|
+
return { flushed: false };
|
|
8378
|
+
try {
|
|
8379
|
+
let lstat;
|
|
8380
|
+
try {
|
|
8381
|
+
lstat = lstatSync(path);
|
|
8382
|
+
} catch (err) {
|
|
8383
|
+
if (!isEnoent(err))
|
|
8384
|
+
throw err;
|
|
8385
|
+
}
|
|
8386
|
+
if (lstat === undefined)
|
|
8387
|
+
return { flushed: false };
|
|
8388
|
+
if (!lstat.isFile()) {
|
|
8389
|
+
throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
|
|
8390
|
+
}
|
|
8391
|
+
const buf = readFileSync4(path);
|
|
8392
|
+
const startOffset = buf.byteLength;
|
|
8393
|
+
const rawLines = buf.toString("utf8").split(`
|
|
8394
|
+
`).filter((l) => l.length > 0);
|
|
8395
|
+
if (rawLines.length === 0)
|
|
8396
|
+
return { flushed: false };
|
|
8397
|
+
const postLines = [];
|
|
8398
|
+
for (let i = 0;i < rawLines.length; i++) {
|
|
8399
|
+
const record = classifyStoredLine(rawLines[i], homedir2());
|
|
8400
|
+
if (record.status !== "ok") {
|
|
8401
|
+
throw new WebhookDrainError("log-webhook-drain-corrupt-line", `log webhook drain: outbox line ${i} failed schema re-validation — ${record.reason}`);
|
|
8402
|
+
}
|
|
8403
|
+
postLines.push(record.postLine);
|
|
8404
|
+
}
|
|
8405
|
+
const body = `${postLines.join(`
|
|
8406
|
+
`)}
|
|
8407
|
+
`;
|
|
8408
|
+
const bytes = Buffer.byteLength(body, "utf8");
|
|
8409
|
+
if (bytes > MAX_WEBHOOK_BODY_BYTES) {
|
|
8410
|
+
throw new WebhookDrainError("log-webhook-drain-too-large", `log webhook drain: outbox body is ${bytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-call cap — flush more often to drain it.`);
|
|
8411
|
+
}
|
|
8412
|
+
let response;
|
|
8413
|
+
try {
|
|
8414
|
+
response = await fetch(webhookUrl, {
|
|
8415
|
+
method: "POST",
|
|
8416
|
+
headers: { "content-type": "application/x-ndjson", ...headers },
|
|
8417
|
+
body,
|
|
8418
|
+
signal: AbortSignal.timeout(fetchTimeoutMs)
|
|
8419
|
+
});
|
|
8420
|
+
} catch (err) {
|
|
8421
|
+
const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
|
|
8422
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed: ${reason}`);
|
|
8423
|
+
}
|
|
8424
|
+
if (!response.ok) {
|
|
8425
|
+
throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}`);
|
|
8426
|
+
}
|
|
8427
|
+
const liveNow = readFileSync4(path);
|
|
8428
|
+
const tail = liveNow.subarray(Math.min(startOffset, liveNow.byteLength));
|
|
8429
|
+
writeFileSync2(path, tail);
|
|
8430
|
+
return { flushed: true, lineCount: postLines.length, bytes };
|
|
8431
|
+
} finally {
|
|
8432
|
+
releaseDrainLock(lockPath, lockToken);
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
|
|
8436
|
+
// src/lib/log-sink.ts
|
|
8437
|
+
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8438
|
+
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8439
|
+
function withDeadline(work, ms, fallback) {
|
|
8440
|
+
return new Promise((resolve) => {
|
|
8441
|
+
const timer = setTimeout(() => resolve(fallback), ms);
|
|
8442
|
+
timer.unref?.();
|
|
8443
|
+
work.then((value) => {
|
|
8444
|
+
clearTimeout(timer);
|
|
8445
|
+
resolve(value);
|
|
8446
|
+
}, () => {
|
|
8447
|
+
clearTimeout(timer);
|
|
8448
|
+
resolve(fallback);
|
|
8449
|
+
});
|
|
8450
|
+
});
|
|
8451
|
+
}
|
|
8452
|
+
async function safeLoadTrustAnchorConfig() {
|
|
8453
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8454
|
+
}
|
|
8455
|
+
function logsCredentialMissing(headers, env) {
|
|
8456
|
+
if (!headers)
|
|
8457
|
+
return false;
|
|
8458
|
+
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8459
|
+
for (const value of Object.values(headers)) {
|
|
8460
|
+
for (const match of value.matchAll(varPattern)) {
|
|
8461
|
+
if (!env[match[1]])
|
|
8462
|
+
return true;
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
return false;
|
|
8466
|
+
}
|
|
8467
|
+
function resolveLogDestinationFrom(input) {
|
|
8468
|
+
const local = resolveLogsSetting(input.localConfig);
|
|
8469
|
+
let effective = null;
|
|
8470
|
+
if (input.unattended) {
|
|
8471
|
+
effective = local ? resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig) : resolveLogsSetting(input.trustAnchorConfig);
|
|
8472
|
+
} else {
|
|
8473
|
+
effective = local;
|
|
8474
|
+
}
|
|
8475
|
+
if (hostFromEnv(input.env) === "ci") {
|
|
8476
|
+
if (effective && "url" in effective) {
|
|
8477
|
+
if (logsCredentialMissing(effective.headers, input.env)) {
|
|
8478
|
+
return {
|
|
8479
|
+
kind: "none",
|
|
8480
|
+
reason: "a logs.url server destination is configured, but this job holds no delivery credential (a fork pull request, or a missing repository secret)"
|
|
8481
|
+
};
|
|
8482
|
+
}
|
|
8483
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8484
|
+
}
|
|
8485
|
+
return {
|
|
8486
|
+
kind: "none",
|
|
8487
|
+
reason: "no server destination is configured for CI delivery (vinaya.config.json logs.url)"
|
|
8488
|
+
};
|
|
8489
|
+
}
|
|
8490
|
+
if (effective && "url" in effective) {
|
|
8491
|
+
return { kind: "server", url: effective.url, headers: resolveLogsHeaderValues(effective.headers, input.env) };
|
|
8492
|
+
}
|
|
8493
|
+
if (effective && "folder" in effective && isInsideRepo(effective.folder, input.repoRoot)) {
|
|
8494
|
+
effective = null;
|
|
8495
|
+
}
|
|
8496
|
+
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8497
|
+
return { kind: "folder", folder };
|
|
8498
|
+
}
|
|
8499
|
+
var processTrustAnchorOnce;
|
|
8500
|
+
function processTrustAnchor() {
|
|
8501
|
+
if (processTrustAnchorOnce === undefined)
|
|
8502
|
+
processTrustAnchorOnce = safeLoadTrustAnchorConfig();
|
|
8503
|
+
return processTrustAnchorOnce;
|
|
8504
|
+
}
|
|
8505
|
+
async function defaultResolveLogDestination(repo, env) {
|
|
8506
|
+
const localConfig = loadConfig();
|
|
8507
|
+
const unattended = isUnattendedProcess(process.env);
|
|
8508
|
+
return resolveLogDestinationFrom({
|
|
8509
|
+
localConfig,
|
|
8510
|
+
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8511
|
+
unattended,
|
|
8512
|
+
env,
|
|
8513
|
+
defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8514
|
+
repoRoot: repoRootSync()
|
|
8515
|
+
});
|
|
8516
|
+
}
|
|
8517
|
+
function isEnoent2(err) {
|
|
8056
8518
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
8057
8519
|
}
|
|
8058
|
-
|
|
8520
|
+
var execFileAsync5 = promisify5(execFile5);
|
|
8521
|
+
async function resolveDoctrine(cwd, vinayaVersion) {
|
|
8059
8522
|
let toplevel;
|
|
8060
8523
|
try {
|
|
8061
|
-
toplevel =
|
|
8062
|
-
encoding: "utf8",
|
|
8063
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8064
|
-
}).trim();
|
|
8524
|
+
toplevel = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { encoding: "utf8" })).stdout.trim();
|
|
8065
8525
|
} catch (err) {
|
|
8066
|
-
return
|
|
8526
|
+
return isEnoent2(err) ? "unknown" : vinayaVersion;
|
|
8067
8527
|
}
|
|
8068
|
-
if (!
|
|
8528
|
+
if (!existsSync6(join7(toplevel, "aeg-root", "roles")))
|
|
8069
8529
|
return vinayaVersion;
|
|
8070
8530
|
try {
|
|
8071
|
-
const sha =
|
|
8072
|
-
encoding: "utf8",
|
|
8073
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
8074
|
-
}).trim();
|
|
8531
|
+
const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
|
|
8075
8532
|
return `aeg-root@${sha}`;
|
|
8076
8533
|
} catch {
|
|
8077
8534
|
return vinayaVersion;
|
|
@@ -8079,20 +8536,20 @@ function resolveDoctrine(cwd, vinayaVersion) {
|
|
|
8079
8536
|
}
|
|
8080
8537
|
function readVinayaVersion() {
|
|
8081
8538
|
try {
|
|
8082
|
-
const pkg = JSON.parse(
|
|
8539
|
+
const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8083
8540
|
return pkg.version ?? "unknown";
|
|
8084
8541
|
} catch {
|
|
8085
8542
|
return "unknown";
|
|
8086
8543
|
}
|
|
8087
8544
|
}
|
|
8088
|
-
var
|
|
8089
|
-
function
|
|
8090
|
-
return
|
|
8545
|
+
var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8546
|
+
function isSafeRepoSegment3(segment) {
|
|
8547
|
+
return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
|
|
8091
8548
|
}
|
|
8092
8549
|
function outboxPathFor(deps, repo, issue) {
|
|
8093
8550
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8094
8551
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
8095
|
-
return
|
|
8552
|
+
return join7(deps.outboxRoot(), dirName, fileName);
|
|
8096
8553
|
}
|
|
8097
8554
|
function hostFromEnv(env) {
|
|
8098
8555
|
if (env.GITHUB_ACTIONS)
|
|
@@ -8103,28 +8560,34 @@ function hostFromEnv(env) {
|
|
|
8103
8560
|
return "loop";
|
|
8104
8561
|
return "cli";
|
|
8105
8562
|
}
|
|
8563
|
+
var warnedThisProcess = false;
|
|
8564
|
+
function defaultStderr(message) {
|
|
8565
|
+
if (warnedThisProcess)
|
|
8566
|
+
return;
|
|
8567
|
+
warnedThisProcess = true;
|
|
8568
|
+
process.stderr.write(message);
|
|
8569
|
+
}
|
|
8106
8570
|
function defaultDeps() {
|
|
8107
8571
|
return {
|
|
8108
|
-
outboxRoot: () =>
|
|
8109
|
-
home: () =>
|
|
8572
|
+
outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
|
|
8573
|
+
home: () => homedir3(),
|
|
8110
8574
|
hostname: () => osHostname(),
|
|
8111
8575
|
cwd: () => process.cwd(),
|
|
8112
8576
|
now: () => new Date,
|
|
8113
8577
|
env: () => process.env,
|
|
8114
8578
|
resolveRepo: () => resolveRepo(),
|
|
8115
8579
|
vinayaVersion: () => readVinayaVersion(),
|
|
8116
|
-
stderr:
|
|
8117
|
-
process.stderr.write(message);
|
|
8118
|
-
},
|
|
8580
|
+
stderr: defaultStderr,
|
|
8119
8581
|
inputVersions: () => {
|
|
8120
8582
|
return;
|
|
8121
|
-
}
|
|
8583
|
+
},
|
|
8584
|
+
resolveLogDestination: defaultResolveLogDestination
|
|
8122
8585
|
};
|
|
8123
8586
|
}
|
|
8124
|
-
var APPEND_OPEN_FLAGS =
|
|
8587
|
+
var APPEND_OPEN_FLAGS = fsConstants3.O_WRONLY | fsConstants3.O_APPEND | fsConstants3.O_CREAT | fsConstants3.O_NOFOLLOW | fsConstants3.O_NONBLOCK;
|
|
8125
8588
|
function guardedAppendOpen(path) {
|
|
8126
8589
|
try {
|
|
8127
|
-
return
|
|
8590
|
+
return openSync3(path, APPEND_OPEN_FLAGS, 384);
|
|
8128
8591
|
} catch {
|
|
8129
8592
|
return;
|
|
8130
8593
|
}
|
|
@@ -8132,7 +8595,7 @@ function guardedAppendOpen(path) {
|
|
|
8132
8595
|
function reportRotationOverflow(backupPath, warn) {
|
|
8133
8596
|
let raw;
|
|
8134
8597
|
try {
|
|
8135
|
-
raw =
|
|
8598
|
+
raw = readFileSync5(backupPath, "utf8");
|
|
8136
8599
|
} catch {
|
|
8137
8600
|
return;
|
|
8138
8601
|
}
|
|
@@ -8155,7 +8618,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8155
8618
|
}
|
|
8156
8619
|
function appendLine(path, line, warn) {
|
|
8157
8620
|
try {
|
|
8158
|
-
|
|
8621
|
+
mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
|
|
8159
8622
|
let fd = guardedAppendOpen(path);
|
|
8160
8623
|
if (fd === undefined) {
|
|
8161
8624
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8171,11 +8634,11 @@ function appendLine(path, line, warn) {
|
|
|
8171
8634
|
return;
|
|
8172
8635
|
}
|
|
8173
8636
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
8174
|
-
|
|
8637
|
+
closeSync3(fd);
|
|
8175
8638
|
closed = true;
|
|
8176
8639
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
8177
8640
|
reportRotationOverflow(backupPath, warn);
|
|
8178
|
-
|
|
8641
|
+
renameSync2(path, backupPath);
|
|
8179
8642
|
const rotated = guardedAppendOpen(path);
|
|
8180
8643
|
if (rotated === undefined) {
|
|
8181
8644
|
warn(`vinaya: log outbox target could not be reopened after rotation — refusing: ${path}
|
|
@@ -8185,10 +8648,10 @@ function appendLine(path, line, warn) {
|
|
|
8185
8648
|
fd = rotated;
|
|
8186
8649
|
closed = false;
|
|
8187
8650
|
}
|
|
8188
|
-
|
|
8651
|
+
writeSync2(fd, line);
|
|
8189
8652
|
} finally {
|
|
8190
8653
|
if (!closed)
|
|
8191
|
-
|
|
8654
|
+
closeSync3(fd);
|
|
8192
8655
|
}
|
|
8193
8656
|
} catch (err) {
|
|
8194
8657
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -8197,8 +8660,8 @@ function appendLine(path, line, warn) {
|
|
|
8197
8660
|
}
|
|
8198
8661
|
function createLogSink(overrides = {}) {
|
|
8199
8662
|
const deps = { ...defaultDeps(), ...overrides };
|
|
8200
|
-
const runId = deps.env().VINAYA_RUN_ID ||
|
|
8201
|
-
const processId =
|
|
8663
|
+
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8664
|
+
const processId = randomUUID2();
|
|
8202
8665
|
let seq = 0;
|
|
8203
8666
|
let warned = false;
|
|
8204
8667
|
const warnOnce = (message) => {
|
|
@@ -8211,8 +8674,9 @@ function createLogSink(overrides = {}) {
|
|
|
8211
8674
|
};
|
|
8212
8675
|
let doctrineCache;
|
|
8213
8676
|
const doctrine = () => {
|
|
8214
|
-
if (doctrineCache === undefined)
|
|
8215
|
-
doctrineCache = resolveDoctrine(deps.cwd(), deps.vinayaVersion());
|
|
8677
|
+
if (doctrineCache === undefined) {
|
|
8678
|
+
doctrineCache = withDeadline(resolveDoctrine(deps.cwd(), deps.vinayaVersion()), LOG_CONTEXT_LOOKUP_DEADLINE_MS, deps.vinayaVersion());
|
|
8679
|
+
}
|
|
8216
8680
|
return doctrineCache;
|
|
8217
8681
|
};
|
|
8218
8682
|
let resolveRepoCache;
|
|
@@ -8221,6 +8685,30 @@ function createLogSink(overrides = {}) {
|
|
|
8221
8685
|
resolveRepoCache = deps.resolveRepo();
|
|
8222
8686
|
return resolveRepoCache;
|
|
8223
8687
|
};
|
|
8688
|
+
let contextCache;
|
|
8689
|
+
const context = () => {
|
|
8690
|
+
if (contextCache === undefined) {
|
|
8691
|
+
const env = deps.env();
|
|
8692
|
+
contextCache = Promise.all([
|
|
8693
|
+
withDeadline(resolveRepoOnce(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null),
|
|
8694
|
+
doctrine()
|
|
8695
|
+
]).then(async ([resolved, doctrineValue]) => {
|
|
8696
|
+
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
8697
|
+
return { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
8698
|
+
});
|
|
8699
|
+
}
|
|
8700
|
+
return contextCache;
|
|
8701
|
+
};
|
|
8702
|
+
let drainChain = Promise.resolve();
|
|
8703
|
+
const pendingWrites = new Set;
|
|
8704
|
+
const scheduleWebhookDrain = (issue, url, headers) => {
|
|
8705
|
+
drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
|
|
8706
|
+
return;
|
|
8707
|
+
}).catch((err) => {
|
|
8708
|
+
warnOnce(`vinaya: log delivery to ${url} failed — queued in the local outbox, retried on the next event: ${err instanceof Error ? err.message : String(err)}
|
|
8709
|
+
`);
|
|
8710
|
+
});
|
|
8711
|
+
};
|
|
8224
8712
|
function log(e) {
|
|
8225
8713
|
try {
|
|
8226
8714
|
const env = deps.env();
|
|
@@ -8235,22 +8723,26 @@ function createLogSink(overrides = {}) {
|
|
|
8235
8723
|
attempt: env.VINAYA_ATTEMPT,
|
|
8236
8724
|
parent: env.VINAYA_PARENT_EVENT
|
|
8237
8725
|
};
|
|
8238
|
-
|
|
8239
|
-
const repo = resolved && isSafeRepoSegment(resolved.owner) && isSafeRepoSegment(resolved.repo) ? resolved : null;
|
|
8726
|
+
const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
|
|
8240
8727
|
const header = buildHeader({
|
|
8241
8728
|
now,
|
|
8242
8729
|
runId,
|
|
8243
8730
|
seq: mySeq,
|
|
8244
8731
|
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
8245
8732
|
vinaya: deps.vinayaVersion(),
|
|
8246
|
-
doctrine:
|
|
8733
|
+
doctrine: doctrineValue,
|
|
8247
8734
|
host,
|
|
8248
8735
|
hostname: deps.hostname(),
|
|
8249
8736
|
env: envFields,
|
|
8250
|
-
eventId:
|
|
8737
|
+
eventId: randomUUID2(),
|
|
8251
8738
|
processId,
|
|
8252
8739
|
inputVersions: deps.inputVersions()
|
|
8253
8740
|
});
|
|
8741
|
+
if (resolvedDestination.kind === "none") {
|
|
8742
|
+
warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
|
|
8743
|
+
`);
|
|
8744
|
+
return;
|
|
8745
|
+
}
|
|
8254
8746
|
const full = { ...e, ...header };
|
|
8255
8747
|
const parsed = LogEventSchema.safeParse(full);
|
|
8256
8748
|
if (!parsed.success) {
|
|
@@ -8260,25 +8752,42 @@ function createLogSink(overrides = {}) {
|
|
|
8260
8752
|
}
|
|
8261
8753
|
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
8262
8754
|
`;
|
|
8263
|
-
|
|
8755
|
+
const destination = resolvedDestination;
|
|
8756
|
+
if (destination.kind === "server") {
|
|
8757
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
8758
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
8759
|
+
} else {
|
|
8760
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
8761
|
+
}
|
|
8264
8762
|
}).catch((err) => {
|
|
8265
8763
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8266
8764
|
`);
|
|
8267
8765
|
});
|
|
8766
|
+
pendingWrites.add(written);
|
|
8767
|
+
written.finally(() => pendingWrites.delete(written));
|
|
8268
8768
|
} catch (err) {
|
|
8269
8769
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8270
8770
|
`);
|
|
8271
8771
|
}
|
|
8272
8772
|
}
|
|
8273
8773
|
const warmup = () => {
|
|
8274
|
-
doctrine();
|
|
8275
8774
|
const originalWarn = console.warn;
|
|
8276
8775
|
console.warn = () => {};
|
|
8277
8776
|
resolveRepoOnce().finally(() => {
|
|
8278
8777
|
console.warn = originalWarn;
|
|
8279
8778
|
});
|
|
8779
|
+
context().catch(() => {
|
|
8780
|
+
return;
|
|
8781
|
+
});
|
|
8782
|
+
};
|
|
8783
|
+
const drain = async () => {
|
|
8784
|
+
if (pendingWrites.size > 0)
|
|
8785
|
+
await Promise.allSettled(Array.from(pendingWrites));
|
|
8786
|
+
await drainChain.catch(() => {
|
|
8787
|
+
return;
|
|
8788
|
+
});
|
|
8280
8789
|
};
|
|
8281
|
-
return { log, runId, warmup };
|
|
8790
|
+
return { log, runId, warmup, drain };
|
|
8282
8791
|
}
|
|
8283
8792
|
var defaultSink = createLogSink();
|
|
8284
8793
|
|
|
@@ -8329,7 +8838,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
8329
8838
|
function fileDiffAgainst(ref, path) {
|
|
8330
8839
|
let out;
|
|
8331
8840
|
try {
|
|
8332
|
-
out =
|
|
8841
|
+
out = execFileSync5("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
8333
8842
|
encoding: "utf8",
|
|
8334
8843
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8335
8844
|
}).trim();
|
|
@@ -8340,7 +8849,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
8340
8849
|
}
|
|
8341
8850
|
function revParse(ref) {
|
|
8342
8851
|
try {
|
|
8343
|
-
return
|
|
8852
|
+
return execFileSync5("git", ["rev-parse", "--verify", ref], {
|
|
8344
8853
|
encoding: "utf8",
|
|
8345
8854
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8346
8855
|
}).trim();
|
|
@@ -8350,7 +8859,7 @@ function revParse(ref) {
|
|
|
8350
8859
|
}
|
|
8351
8860
|
function repoRoot() {
|
|
8352
8861
|
try {
|
|
8353
|
-
return
|
|
8862
|
+
return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
|
|
8354
8863
|
encoding: "utf8",
|
|
8355
8864
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8356
8865
|
}).trim();
|
|
@@ -8361,7 +8870,7 @@ function repoRoot() {
|
|
|
8361
8870
|
function changedFiles(base) {
|
|
8362
8871
|
let out;
|
|
8363
8872
|
try {
|
|
8364
|
-
out =
|
|
8873
|
+
out = execFileSync5("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
8365
8874
|
encoding: "utf8",
|
|
8366
8875
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8367
8876
|
}).trim();
|
|
@@ -8386,7 +8895,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
8386
8895
|
const relPaths = changedFiles(ref);
|
|
8387
8896
|
if (relPaths === null)
|
|
8388
8897
|
continue;
|
|
8389
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
8898
|
+
return { base: ref, root, files: relPaths.map((p) => join8(root, p)) };
|
|
8390
8899
|
}
|
|
8391
8900
|
return null;
|
|
8392
8901
|
}
|
|
@@ -8428,17 +8937,17 @@ function isTestFile(path) {
|
|
|
8428
8937
|
function collectAllPaths(dir, out = []) {
|
|
8429
8938
|
let entries;
|
|
8430
8939
|
try {
|
|
8431
|
-
entries =
|
|
8940
|
+
entries = readdirSync2(dir);
|
|
8432
8941
|
} catch {
|
|
8433
8942
|
return out;
|
|
8434
8943
|
}
|
|
8435
8944
|
for (const name of entries) {
|
|
8436
8945
|
if (EXCLUDED_DIRS.has(name))
|
|
8437
8946
|
continue;
|
|
8438
|
-
const full =
|
|
8947
|
+
const full = join9(dir, name);
|
|
8439
8948
|
let isDir;
|
|
8440
8949
|
try {
|
|
8441
|
-
isDir =
|
|
8950
|
+
isDir = statSync2(full).isDirectory();
|
|
8442
8951
|
} catch {
|
|
8443
8952
|
continue;
|
|
8444
8953
|
}
|
|
@@ -8451,7 +8960,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
8451
8960
|
function main() {
|
|
8452
8961
|
const allPaths = WORKSPACE_DIRS.flatMap((d) => collectAllPaths(d)).map((p) => p.split("\\").join("/"));
|
|
8453
8962
|
const knownPaths = new Set(allPaths);
|
|
8454
|
-
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content:
|
|
8963
|
+
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content: readFileSync6(p, "utf8") }));
|
|
8455
8964
|
const findings = findWorkspaceEscapes(sourceFiles, knownPaths, WORKSPACE_DIRS);
|
|
8456
8965
|
const reportable = findingsInThisDiff(findings);
|
|
8457
8966
|
console.log(`${CHECK_NAME}: ${sourceFiles.length} source file(s) scanned under ${WORKSPACE_DIRS.join("/")}; ${findings.length} finding(s), ${reportable.length} in this diff`);
|