@kitman-sh/software-engineering 0.11.7 → 0.12.0-rc.2
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/dist/bundle.js +55 -17
- package/dist/declarations.json +14 -1
- package/package.json +3 -3
- package/src/build.ts +1 -1
- package/src/review.ts +22 -6
package/dist/bundle.js
CHANGED
|
@@ -12605,8 +12605,23 @@ var LOCAL_PATH_KEYS = new Set([
|
|
|
12605
12605
|
"docker_socket",
|
|
12606
12606
|
"ssh_agent_socket"
|
|
12607
12607
|
]);
|
|
12608
|
-
var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _
|
|
12608
|
+
var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _.|-]*>|\$\{[^{}\s]*\}|\{\{[^{}]*\}\}|proxy-ep=[A-Za-z0-9.-]+;kitmanref(?:[0-9a-f]{2})+(?![A-Za-z0-9._~+/-])`;
|
|
12609
|
+
var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
|
|
12610
|
+
var placeholderNamePart = `(?:[A-Z]?[a-z]+|[A-Z]+)(?:[A-Z][a-z]+)*[0-9]{0,4}`;
|
|
12611
|
+
var anglePlaceholder = `<${placeholderWord}[0-9]{0,2}(?:[ _.|-]${placeholderWord}[0-9]{0,2})*>`;
|
|
12612
|
+
var secretReferencePart = String.raw`(?:[A-Za-z0-9_.-]+|${anglePlaceholder}|\$\{[A-Za-z_][A-Za-z0-9_]*\}|\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}|\*|\u2026)`;
|
|
12613
|
+
var describedSecretReference = new RegExp(`^secret://${secretReferencePart}/(?:${secretReferencePart})?$`, "u");
|
|
12609
12614
|
var secretReferenceTail = String.raw`(?<=secret:)\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?![^\s,;}"')\]\x60])`;
|
|
12615
|
+
var referenceInText = new RegExp(String.raw`secret:\/\/${secretReferencePart}\/${secretReferencePart}(?![^\s,;}"')\]\x60])`, "gu");
|
|
12616
|
+
function inSecretReference(text, start, end) {
|
|
12617
|
+
for (const reference of text.matchAll(referenceInText)) {
|
|
12618
|
+
const referenceEnd = reference.index + reference[0].length;
|
|
12619
|
+
if (reference.index <= start && end <= referenceEnd)
|
|
12620
|
+
return isPlaceholder(unwrapped(reference[0]));
|
|
12621
|
+
}
|
|
12622
|
+
return false;
|
|
12623
|
+
}
|
|
12624
|
+
var placeholderTokenName = new RegExp(`^<?(?:ghp_|github_pat_|glpat-|ksa1\\.|sk-|xox[baprs]-)${placeholderNamePart}(?:[_.-]${placeholderNamePart})*>?$`, "u");
|
|
12610
12625
|
var bearerValue = /[0-9]|[._~+/:-][A-Za-z0-9]|[<{]/u;
|
|
12611
12626
|
var VALUE_RULES = [
|
|
12612
12627
|
{ classification: "secret", name: "private-key", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u },
|
|
@@ -12620,7 +12635,7 @@ var VALUE_RULES = [
|
|
|
12620
12635
|
classification: "credential",
|
|
12621
12636
|
name: "provider-token",
|
|
12622
12637
|
pattern: /(?:^|[^A-Za-z0-9])(?<value><?(?:ghp_|github_pat_|glpat-|ksa1\.|sk-[A-Za-z0-9_-]{8,}|xox[baprs]-)[A-Za-z0-9._*-]*[A-Za-z0-9_*-]>?)/u,
|
|
12623
|
-
holds: (value) => !isPlaceholder(value)
|
|
12638
|
+
holds: (value, _matched, text, start) => !isPlaceholder(value) && !(placeholderTokenName.test(value) && inSecretReference(text, start, start + value.length))
|
|
12624
12639
|
},
|
|
12625
12640
|
{
|
|
12626
12641
|
classification: "credential",
|
|
@@ -12651,10 +12666,10 @@ var VALUE_RULES = [
|
|
|
12651
12666
|
{ classification: "transcript", name: "transcript-content", pattern: /(?:^|\n)\s*(?:user|assistant|system)\s*:/iu }
|
|
12652
12667
|
];
|
|
12653
12668
|
var maskedToken = /^(?:ghp_|github_pat_|glpat-|ksa1\.|xox[baprs]-|sk-(?:ant-(?:[a-z]+[0-9]*-)?|proj-|or-v[0-9]+-)?)(?:x{4,}|X{4,}|\*{4,})$/u;
|
|
12654
|
-
var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
|
|
12655
12669
|
var placeholders = [
|
|
12656
12670
|
maskedToken,
|
|
12657
|
-
new RegExp(
|
|
12671
|
+
new RegExp(`^${anglePlaceholder}$`, "u"),
|
|
12672
|
+
describedSecretReference,
|
|
12658
12673
|
/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/u,
|
|
12659
12674
|
/^\$[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
12660
12675
|
/^\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}$/u,
|
|
@@ -12670,6 +12685,8 @@ function looksLikeCredential(raw, matched) {
|
|
|
12670
12685
|
const value = unwrapped(raw);
|
|
12671
12686
|
if (isPlaceholder(raw) || isPlaceholder(value))
|
|
12672
12687
|
return false;
|
|
12688
|
+
if (matched === `secret:${raw}` && isPlaceholder(`secret:${value}`))
|
|
12689
|
+
return false;
|
|
12673
12690
|
return /^[^\s:=]+=\S/u.test(matched) || value.length >= 6 && /[0-9]/u.test(value) || value.length >= 20 && /[a-z]/u.test(value) && /[A-Z]/u.test(value);
|
|
12674
12691
|
}
|
|
12675
12692
|
var globalPatterns = new WeakMap;
|
|
@@ -13391,6 +13408,11 @@ var WaitingOn = Struct({ keys: ArraySchema(String5), hidden: Int });
|
|
|
13391
13408
|
// ../../packages/core/src/run-queue.ts
|
|
13392
13409
|
var ClaimRanks = ["in_progress", "finishing", "new"];
|
|
13393
13410
|
|
|
13411
|
+
// ../../packages/core/src/tokens.ts
|
|
13412
|
+
var TokenCount = Int.check(isGreaterThanOrEqualTo2(0));
|
|
13413
|
+
var TokenUsage = Struct({ input: TokenCount, output: TokenCount, cached: TokenCount });
|
|
13414
|
+
var AttemptTokens = Union2([TokenUsage, Literal2("none")]);
|
|
13415
|
+
|
|
13394
13416
|
// ../../packages/core/src/loop.ts
|
|
13395
13417
|
var LoopStatuses = ["draft", "active", "disabled", "archived"];
|
|
13396
13418
|
var LoopStepImplementationKinds = [
|
|
@@ -13942,7 +13964,8 @@ var RunWaiting = Union2([
|
|
|
13942
13964
|
rank: Literals(ClaimRanks),
|
|
13943
13965
|
position: Int.check(isGreaterThanOrEqualTo2(1)),
|
|
13944
13966
|
reason: String5,
|
|
13945
|
-
movesUpAt: optionalKey2(String5)
|
|
13967
|
+
movesUpAt: optionalKey2(String5),
|
|
13968
|
+
unrunnable: optionalKey2(String5)
|
|
13946
13969
|
})
|
|
13947
13970
|
]);
|
|
13948
13971
|
var RunEvidence = Struct({
|
|
@@ -14283,8 +14306,10 @@ var RunStepSummary = Struct({
|
|
|
14283
14306
|
status: StepAttemptStatus,
|
|
14284
14307
|
failureSummary: optionalKey2(String5),
|
|
14285
14308
|
output: optionalKey2(Unknown2),
|
|
14286
|
-
revision: optionalKey2(String5)
|
|
14287
|
-
|
|
14309
|
+
revision: optionalKey2(String5),
|
|
14310
|
+
tokens: optionalKey2(AttemptTokens)
|
|
14311
|
+
})),
|
|
14312
|
+
tokens: optionalKey2(TokenUsage)
|
|
14288
14313
|
});
|
|
14289
14314
|
var RunSteerDeliveries = ["queued", "delivered", "failed"];
|
|
14290
14315
|
var RunSteer = Struct({
|
|
@@ -14395,7 +14420,8 @@ var RunShow = Struct({
|
|
|
14395
14420
|
evidence: ArraySchema(RunEvidence),
|
|
14396
14421
|
steers: ArraySchema(RunSteer),
|
|
14397
14422
|
waiting: ArraySchema(RunWaiting),
|
|
14398
|
-
closures: ArraySchema(RunClosure)
|
|
14423
|
+
closures: ArraySchema(RunClosure),
|
|
14424
|
+
tokens: optionalKey2(TokenUsage)
|
|
14399
14425
|
});
|
|
14400
14426
|
var RunStartPreview = Struct({
|
|
14401
14427
|
loop: Struct({ id: String5, title: String5, outcome: optionalKey2(String5) }),
|
|
@@ -20270,7 +20296,8 @@ var WorkUnitHeartbeatResult = Struct({
|
|
|
20270
20296
|
var WorkUnitReleaseInput = Struct({
|
|
20271
20297
|
workUnitId: Id,
|
|
20272
20298
|
lease: WorkUnitLeaseInput,
|
|
20273
|
-
crashed: optionalKey2(Struct({ reason: String5.check(isMinLength(1), isMaxLength(500)) }))
|
|
20299
|
+
crashed: optionalKey2(Struct({ reason: String5.check(isMinLength(1), isMaxLength(500)) })),
|
|
20300
|
+
tokens: optionalKey2(AttemptTokens)
|
|
20274
20301
|
});
|
|
20275
20302
|
var CheckEvidence = Struct({
|
|
20276
20303
|
name: String5.check(isMinLength(1), isMaxLength(120)),
|
|
@@ -20340,6 +20367,7 @@ var WorkUnitOutcome = Struct({
|
|
|
20340
20367
|
cleanSync: optionalKey2(Literals(["up_to_date", "merged"])),
|
|
20341
20368
|
harnessHold: optionalKey2(HarnessHold),
|
|
20342
20369
|
restart: optionalKey2(StepRestart),
|
|
20370
|
+
tokens: optionalKey2(AttemptTokens),
|
|
20343
20371
|
failureSummary: optionalKey2(String5.check(isMinLength(1), isMaxLength(4000)))
|
|
20344
20372
|
});
|
|
20345
20373
|
var WorkUnitCompletion = Struct({
|
|
@@ -21098,11 +21126,16 @@ var SeatFinding = Struct({
|
|
|
21098
21126
|
detail: FindingDetail,
|
|
21099
21127
|
approvedCode: optional2(Boolean3)
|
|
21100
21128
|
});
|
|
21129
|
+
var ReviewedScope = Struct({
|
|
21130
|
+
...ScopeJudgement.fields,
|
|
21131
|
+
reported: optional2(ArraySchema(String5))
|
|
21132
|
+
});
|
|
21133
|
+
var agreedScope = (scope) => scope.unmet.length === 0 && (scope.reported ?? []).length > 0 ? { ...scope, met: true } : scope;
|
|
21101
21134
|
var SeatOutput = Struct({
|
|
21102
21135
|
summary: OneSentence,
|
|
21103
21136
|
findings: ArraySchema(SeatFinding),
|
|
21104
21137
|
verdicts: optional2(ArraySchema(RebuttalVerdict)),
|
|
21105
|
-
scope: optional2(
|
|
21138
|
+
scope: optional2(ReviewedScope),
|
|
21106
21139
|
followUps: optional2(ArraySchema(FollowUp))
|
|
21107
21140
|
});
|
|
21108
21141
|
var Output = Struct({
|
|
@@ -21113,7 +21146,7 @@ var Output = Struct({
|
|
|
21113
21146
|
verdicts: ArraySchema(RebuttalVerdict),
|
|
21114
21147
|
blocking: Boolean3,
|
|
21115
21148
|
artifactId: String5,
|
|
21116
|
-
scope: optional2(
|
|
21149
|
+
scope: optional2(ReviewedScope),
|
|
21117
21150
|
approval: optional2(Struct({ head: String5, approved: Boolean3, reason: optional2(String5) })),
|
|
21118
21151
|
next: optional2(Struct({ choice: Literals(choices), detail: optional2(String5) })),
|
|
21119
21152
|
deliversTo: optional2(ResolvedDeliveryTarget)
|
|
@@ -21174,7 +21207,7 @@ var pinnedRange = (input) => gen2(function* () {
|
|
|
21174
21207
|
});
|
|
21175
21208
|
var wholeChange = (input) => input.files === undefined && input.approved === undefined;
|
|
21176
21209
|
var scopePrompt = (input) => [
|
|
21177
|
-
"If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Set `met` to true only if
|
|
21210
|
+
"If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Judge it against what is still agreed: a criterion or part an answer under your brief's Answers so far put out of scope is reported, not unmet; list each in `reported`, one line each, and leave it out of `unmet`. Set `met` to true only if the change does all the rest, and list in `unmet` one line for each other criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
|
|
21178
21211
|
...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
|
|
21179
21212
|
...input.claims === undefined || input.claims.length === 0 ? [] : [
|
|
21180
21213
|
"The implementer claims it built these. Check them against the code rather than taking them on trust:",
|
|
@@ -21193,6 +21226,7 @@ var promptFor = (seat, target, input, failing, notRun) => [
|
|
|
21193
21226
|
`Review ${target}`,
|
|
21194
21227
|
"Give `summary`: one sentence on whether it can merge and what matters most.",
|
|
21195
21228
|
"Report each problem as a finding: severity blocker (must not ship), major (fix before merge) or minor (optional); the file path from the repository root; the line; and the detail. When it is one instance of a class of bug, name every other instance in the diff in its detail. Report nothing you have not checked in the code.",
|
|
21229
|
+
"What an answer under your brief's Answers so far put out of scope is reported, not missing: do not report it as a finding.",
|
|
21196
21230
|
"If the diff is too big to review in one go, review it directory by directory and say so in a finding on the first file you skipped.",
|
|
21197
21231
|
...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
|
|
21198
21232
|
...input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)],
|
|
@@ -21223,8 +21257,11 @@ var followUpsOf = (earlier, answers) => earlier.map((finding) => {
|
|
|
21223
21257
|
});
|
|
21224
21258
|
var findingLines = (findings) => findings.map((finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail} _(${finding.seats.join(", ")})_`).join(`
|
|
21225
21259
|
`);
|
|
21226
|
-
var reviewText = (summary, findings, followUps, approvedFindings, notRun) => [
|
|
21260
|
+
var reviewText = (summary, findings, followUps, approvedFindings, notRun, reported) => [
|
|
21227
21261
|
`**Kitman review.** ${summary}`,
|
|
21262
|
+
...reported.length === 0 ? [] : [`Out of scope by an answer, so reported, not blocking:
|
|
21263
|
+
${reported.map((item) => `- ${item}`).join(`
|
|
21264
|
+
`)}`],
|
|
21228
21265
|
...notRun.length === 0 ? [] : [`Verify never ran these tests, so they are unverified:
|
|
21229
21266
|
${notRun.map((item) => `- ${item}`).join(`
|
|
21230
21267
|
`)}`],
|
|
@@ -21303,10 +21340,11 @@ var review_default = defineLoop({
|
|
|
21303
21340
|
const approvedFindings = sinceApproval ? merged(true) : [];
|
|
21304
21341
|
const findings = [...carried, ...fresh];
|
|
21305
21342
|
const blockers = findings.filter(isBlocking);
|
|
21306
|
-
const
|
|
21343
|
+
const judged = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
|
|
21344
|
+
const scope = judged === undefined ? undefined : agreedScope(judged);
|
|
21307
21345
|
const summary = blockers.length > 0 ? `Blocking: fix ${blockers.map((finding) => finding.id).join(", ")} before merging.` : scope?.met === false ? "Not ready: the change does not yet do what was asked." : failing.length > 0 ? `Not ready: ${failing.join(", ")} fails on this head.` : notRun.length > 0 ? "Not ready: verify never ran some of its tests, so they are unverified." : findings.length === 0 ? sinceApproval ? `No findings in what changed since ${input.approved}: nothing stands in the way of merging.` : "No findings: nothing stands in the way of merging." : ["Can merge: nothing blocks it.", ...outputs.map(([, output]) => output.summary)].join(" ");
|
|
21308
21346
|
const freshIds = new Set(fresh.map((finding) => finding.id));
|
|
21309
|
-
const text = reviewText(summary, findings, followUps, approvedFindings, notRun);
|
|
21347
|
+
const text = reviewText(summary, findings, followUps, approvedFindings, notRun, scope?.reported ?? []);
|
|
21310
21348
|
const stored = yield* artifact("findings", {
|
|
21311
21349
|
kind: "review-findings",
|
|
21312
21350
|
title: "Review findings",
|
|
@@ -23045,7 +23083,7 @@ var implementPrompt = (task, outcome, continuing) => [
|
|
|
23045
23083
|
|
|
23046
23084
|
`);
|
|
23047
23085
|
var criteriaPrompt = (unanswered, unmet) => [
|
|
23048
|
-
unanswered ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change." : "These acceptance criteria are not met yet. Meet them, or say why they cannot be met here:",
|
|
23086
|
+
unanswered ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change." : "These acceptance criteria are not met yet. Meet them, or say why they cannot be met here, such as an answer under Answers so far that put them out of scope; do not ask that Question again:",
|
|
23049
23087
|
...unmet.map((answer) => `- ${answer.criterion}: ${answer.detail}`),
|
|
23050
23088
|
criteriaGuidance
|
|
23051
23089
|
].join(`
|
|
@@ -31138,4 +31176,4 @@ var runKit = (config, identity, packages) => {
|
|
|
31138
31176
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
31139
31177
|
};
|
|
31140
31178
|
// .kitman-build-entry.ts
|
|
31141
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.
|
|
31179
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.12.0-rc.2" }, []);
|
package/dist/declarations.json
CHANGED
|
@@ -3861,6 +3861,19 @@
|
|
|
3861
3861
|
"items": {
|
|
3862
3862
|
"type": "string"
|
|
3863
3863
|
}
|
|
3864
|
+
},
|
|
3865
|
+
"reported": {
|
|
3866
|
+
"anyOf": [
|
|
3867
|
+
{
|
|
3868
|
+
"type": "array",
|
|
3869
|
+
"items": {
|
|
3870
|
+
"type": "string"
|
|
3871
|
+
}
|
|
3872
|
+
},
|
|
3873
|
+
{
|
|
3874
|
+
"type": "null"
|
|
3875
|
+
}
|
|
3876
|
+
]
|
|
3864
3877
|
}
|
|
3865
3878
|
},
|
|
3866
3879
|
"required": [
|
|
@@ -5108,7 +5121,7 @@
|
|
|
5108
5121
|
"carried": [
|
|
5109
5122
|
{
|
|
5110
5123
|
"name": "@kitman-sh/software-engineering",
|
|
5111
|
-
"version": "0.
|
|
5124
|
+
"version": "0.12.0-rc.2",
|
|
5112
5125
|
"setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
|
|
5113
5126
|
"loops": [
|
|
5114
5127
|
"build",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/software-engineering",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-rc.2",
|
|
4
4
|
"description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"tsconfig.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kitman-sh/sdk": "0.
|
|
20
|
+
"@kitman-sh/sdk": "0.12.0-rc.2",
|
|
21
21
|
"effect": "^4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"kitman": {
|
|
24
24
|
"bundle": "dist/bundle.js",
|
|
25
|
-
"digest": "
|
|
25
|
+
"digest": "6f3825aa54f2adb3cad20ee1c1b74c935d0a39dde6fcca70366e513e83243d49",
|
|
26
26
|
"protocolVersion": 5,
|
|
27
27
|
"declarations": "dist/declarations.json",
|
|
28
28
|
"setup": {
|
package/src/build.ts
CHANGED
|
@@ -211,7 +211,7 @@ const criteriaPrompt = (unanswered: boolean, unmet: readonly CriterionAnswer[])
|
|
|
211
211
|
[
|
|
212
212
|
unanswered
|
|
213
213
|
? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change."
|
|
214
|
-
: 'These acceptance criteria are not met yet. Meet them, or say why they cannot be met here:',
|
|
214
|
+
: 'These acceptance criteria are not met yet. Meet them, or say why they cannot be met here, such as an answer under Answers so far that put them out of scope; do not ask that Question again:',
|
|
215
215
|
...unmet.map(answer => `- ${answer.criterion}: ${answer.detail}`),
|
|
216
216
|
criteriaGuidance
|
|
217
217
|
].join('\n\n')
|
package/src/review.ts
CHANGED
|
@@ -96,12 +96,22 @@ const SeatFinding = Schema.Struct({
|
|
|
96
96
|
approvedCode: Schema.optional(Schema.Boolean)
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
+
/** A scope judgement with what an answer put out of scope, which is reported and never unmet. */
|
|
100
|
+
const ReviewedScope = Schema.Struct({
|
|
101
|
+
...ScopeJudgement.fields,
|
|
102
|
+
reported: Schema.optional(Schema.Array(Schema.String))
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
/** Met when nothing is unmet but what an answer put out of scope, so a waived criterion never blocks. */
|
|
106
|
+
const agreedScope = (scope: typeof ReviewedScope.Type): typeof ReviewedScope.Type =>
|
|
107
|
+
scope.unmet.length === 0 && (scope.reported ?? []).length > 0 ? { ...scope, met: true } : scope
|
|
108
|
+
|
|
99
109
|
const SeatOutput = Schema.Struct({
|
|
100
110
|
/** One sentence: can it merge, and what matters most. */
|
|
101
111
|
summary: OneSentence,
|
|
102
112
|
findings: Schema.Array(SeatFinding),
|
|
103
113
|
verdicts: Schema.optional(Schema.Array(RebuttalVerdict)),
|
|
104
|
-
scope: Schema.optional(
|
|
114
|
+
scope: Schema.optional(ReviewedScope),
|
|
105
115
|
followUps: Schema.optional(Schema.Array(FollowUp))
|
|
106
116
|
})
|
|
107
117
|
|
|
@@ -117,7 +127,7 @@ const Output = Schema.Struct({
|
|
|
117
127
|
blocking: Schema.Boolean,
|
|
118
128
|
artifactId: Schema.String,
|
|
119
129
|
/** The scope seat's judgement of the Task's scope; absent when there was no Task to judge against. */
|
|
120
|
-
scope: Schema.optional(
|
|
130
|
+
scope: Schema.optional(ReviewedScope),
|
|
121
131
|
/** Kitman's approval of the ChangeRequest's head, recorded when nothing blocks it; or why it was refused. */
|
|
122
132
|
approval: Schema.optional(
|
|
123
133
|
Schema.Struct({ head: Schema.String, approved: Schema.Boolean, reason: Schema.optional(Schema.String) })
|
|
@@ -211,7 +221,7 @@ const wholeChange = (input: typeof Input.Type) => input.files === undefined && i
|
|
|
211
221
|
|
|
212
222
|
const scopePrompt = (input: typeof Input.Type) =>
|
|
213
223
|
[
|
|
214
|
-
"If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Set `met` to true only if
|
|
224
|
+
"If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Judge it against what is still agreed: a criterion or part an answer under your brief's Answers so far put out of scope is reported, not unmet; list each in `reported`, one line each, and leave it out of `unmet`. Set `met` to true only if the change does all the rest, and list in `unmet` one line for each other criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
|
|
215
225
|
...(input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`]),
|
|
216
226
|
...(input.claims === undefined || input.claims.length === 0
|
|
217
227
|
? []
|
|
@@ -239,6 +249,7 @@ const promptFor = (
|
|
|
239
249
|
`Review ${target}`,
|
|
240
250
|
'Give `summary`: one sentence on whether it can merge and what matters most.',
|
|
241
251
|
'Report each problem as a finding: severity blocker (must not ship), major (fix before merge) or minor (optional); the file path from the repository root; the line; and the detail. When it is one instance of a class of bug, name every other instance in the diff in its detail. Report nothing you have not checked in the code.',
|
|
252
|
+
"What an answer under your brief's Answers so far put out of scope is reported, not missing: do not report it as a finding.",
|
|
242
253
|
'If the diff is too big to review in one go, review it directory by directory and say so in a finding on the first file you skipped.',
|
|
243
254
|
...(seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : []),
|
|
244
255
|
...(input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)]),
|
|
@@ -289,10 +300,14 @@ const reviewText = (
|
|
|
289
300
|
findings: readonly MergedFinding[],
|
|
290
301
|
followUps: readonly (typeof FollowUp.Type)[],
|
|
291
302
|
approvedFindings: readonly MergedFinding[],
|
|
292
|
-
notRun: readonly string[]
|
|
303
|
+
notRun: readonly string[],
|
|
304
|
+
reported: readonly string[]
|
|
293
305
|
) =>
|
|
294
306
|
[
|
|
295
307
|
`**Kitman review.** ${summary}`,
|
|
308
|
+
...(reported.length === 0
|
|
309
|
+
? []
|
|
310
|
+
: [`Out of scope by an answer, so reported, not blocking:\n${reported.map(item => `- ${item}`).join('\n')}`]),
|
|
296
311
|
...(notRun.length === 0
|
|
297
312
|
? []
|
|
298
313
|
: [`Verify never ran these tests, so they are unverified:\n${notRun.map(item => `- ${item}`).join('\n')}`]),
|
|
@@ -419,7 +434,8 @@ export default defineLoop({
|
|
|
419
434
|
const findings = [...carried, ...fresh]
|
|
420
435
|
|
|
421
436
|
const blockers = findings.filter(isBlocking)
|
|
422
|
-
const
|
|
437
|
+
const judged = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined
|
|
438
|
+
const scope = judged === undefined ? undefined : agreedScope(judged)
|
|
423
439
|
|
|
424
440
|
// A seat's own summary is kept only when nothing blocks, so it cannot contradict the verdict.
|
|
425
441
|
const summary =
|
|
@@ -438,7 +454,7 @@ export default defineLoop({
|
|
|
438
454
|
: ['Can merge: nothing blocks it.', ...outputs.map(([, output]) => output.summary)].join(' ')
|
|
439
455
|
|
|
440
456
|
const freshIds = new Set(fresh.map(finding => finding.id))
|
|
441
|
-
const text = reviewText(summary, findings, followUps, approvedFindings, notRun)
|
|
457
|
+
const text = reviewText(summary, findings, followUps, approvedFindings, notRun, scope?.reported ?? [])
|
|
442
458
|
|
|
443
459
|
const stored = yield* artifact('findings', {
|
|
444
460
|
kind: 'review-findings',
|