@kitman-sh/software-engineering 0.13.6 → 0.13.8

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/agents/planner.md CHANGED
@@ -10,10 +10,10 @@ You are a planner. You turn what someone asked for into a spec and tickets an im
10
10
 
11
11
  ## Tickets
12
12
 
13
- - Write vertical slices: each ticket lands on its own as one ChangeRequest and is verifiable on its own. Keep to the fewest tickets that do that.
13
+ - Before you write tickets, load `skills({ name: 'scope-tasks' })` from the Kitman MCP and scope each ticket as it says.
14
+ - Write vertical slices: each ticket lands on its own as one ChangeRequest and is verifiable on its own.
14
15
  - Give every ticket Acceptance Criteria that a reviewer can check against the change.
15
16
  - Give the plan an explicit out-of-scope list, so what was left out is a decision and not an omission.
16
- - Name each ticket's blockers by the tickets whose code it needs.
17
17
  - Check the documentation when an API detail affects the plan.
18
18
 
19
19
  ## Boundaries
package/dist/bundle.js CHANGED
@@ -19364,6 +19364,8 @@ var PlanTicket = Struct({
19364
19364
  title: String5,
19365
19365
  body: String5,
19366
19366
  acceptanceCriteria: ArraySchema(String5),
19367
+ promise: optional2(String5),
19368
+ outOfScope: optional2(ArraySchema(String5)),
19367
19369
  repoBindingId: optional2(String5),
19368
19370
  blockedBy: ArraySchema(String5),
19369
19371
  outcome: optional2(LoopOutcome)
@@ -21172,6 +21174,12 @@ var deliveryLayerWords = {
21172
21174
  workspace: "the Workspace"
21173
21175
  };
21174
21176
 
21177
+ // src/reviewed-scope.ts
21178
+ var ReviewedScope = Struct({
21179
+ ...ScopeJudgement.fields,
21180
+ reported: optional2(ArraySchema(String5))
21181
+ });
21182
+
21175
21183
  // src/text-limits.ts
21176
21184
  var bounded2 = (maxLength, description) => String5.check(isMaxLength(maxLength)).annotate({ description });
21177
21185
  var OneSentence = bounded2(300, "One sentence, at most 300 characters.");
@@ -21207,6 +21215,7 @@ var Input = Struct({
21207
21215
  claims: optional2(ArraySchema(String5)),
21208
21216
  earlier: optional2(ArraySchema(MergedFinding)),
21209
21217
  reviewed: optional2(String5),
21218
+ scope: optional2(ReviewedScope),
21210
21219
  failing: optional2(ArraySchema(String5)),
21211
21220
  notRun: optional2(ArraySchema(String5)),
21212
21221
  next: optional2(Literals(choices)),
@@ -21222,11 +21231,14 @@ var SeatFinding = Struct({
21222
21231
  checked: optional2(ArraySchema(ShortStatement)),
21223
21232
  outsideFix: optional2(Boolean3)
21224
21233
  });
21225
- var ReviewedScope = Struct({
21226
- ...ScopeJudgement.fields,
21227
- reported: optional2(ArraySchema(String5))
21228
- });
21229
21234
  var agreedScope = (scope) => scope.unmet.length === 0 && (scope.reported ?? []).length > 0 ? { ...scope, met: true } : scope;
21235
+ var carriedScope = (judged, earlier) => {
21236
+ if (judged === undefined)
21237
+ return earlier;
21238
+ const scope = agreedScope(judged);
21239
+ const reported = [...new Set([...earlier?.reported ?? [], ...scope.reported ?? []])].filter((item) => !scope.unmet.includes(item));
21240
+ return earlier === undefined || reported.length === 0 ? scope : { ...scope, reported };
21241
+ };
21230
21242
  var SeatOutput = Struct({
21231
21243
  summary: OneSentence,
21232
21244
  findings: ArraySchema(SeatFinding),
@@ -21263,13 +21275,14 @@ class ReviewBaseUnpinned extends TaggedError3()("ReviewBaseUnpinned", {
21263
21275
  message: String5
21264
21276
  }) {
21265
21277
  }
21278
+ var unfetchable = (head) => `If the Runner cannot fetch revision ${head} (a fork, say), report exactly that as your only finding, a blocker, and stop.`;
21266
21279
  var targetOf = (input, { base, head, branches, epic }) => {
21267
21280
  if (epic !== undefined)
21268
21281
  return `the epic's whole change \`git diff ${base}...${head}\` in your checkout: epic branch \`${epic.branch}\` against default branch \`${epic.defaultBranch}\`, as they stood when this review started. Fetch both from \`origin\` and diff exactly those commits, even if either branch has moved since.`;
21269
21282
  if (input.changeRequestId !== undefined && branches !== undefined) {
21270
21283
  const { source, target } = branches;
21271
21284
  const from = source === undefined ? "" : ` from source branch \`${source}\``;
21272
- return `ChangeRequest ${input.changeRequestId} at revision ${head}: \`git diff ${base}...${head}\`, its change${from} into target branch \`${target}\` as that stood when this review started. This names all you need of the ChangeRequest, so look nothing up: fetch \`${source ?? head}\` and \`${target}\` from \`origin\`, and diff exactly those commits even if either branch has moved since. If the Runner cannot fetch revision ${head} (a fork, say), report exactly that as your only finding, a blocker, and stop.`;
21285
+ return `ChangeRequest ${input.changeRequestId} at revision ${head}: \`git diff ${base}...${head}\`, its change${from} into target branch \`${target}\` as that stood when this review started. This names all you need of the ChangeRequest, so look nothing up: fetch \`${source ?? head}\` and \`${target}\` from \`origin\`, and diff exactly those commits even if either branch has moved since. ${unfetchable(head)}`;
21273
21286
  }
21274
21287
  if (input.files === undefined && input.approved !== undefined)
21275
21288
  return [
@@ -21310,39 +21323,78 @@ var pinnedRange = (input) => gen2(function* () {
21310
21323
  return { base, head };
21311
21324
  });
21312
21325
  var wholeChange = (input) => input.files === undefined && input.approved === undefined;
21313
- var scopePrompt = (input) => [
21314
- "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.",
21315
- ...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
21316
- ...input.claims === undefined || input.claims.length === 0 ? [] : [
21317
- "The implementer claims it built these. Check them against the code rather than taking them on trust:",
21318
- ...input.claims.map((claim) => `- ${claim}`)
21319
- ]
21326
+ var wholeScopePrompt = "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.";
21327
+ var rejudgedScopePrompt = (unmet) => [
21328
+ [
21329
+ "If your brief has a Task, judge its scope again and give it as `scope`. An earlier round judged what the Task's description and Acceptance Criteria ask, and that stands, so do not judge all of it again.",
21330
+ ...unmet.length === 0 ? ["It found nothing unmet."] : [
21331
+ "It found these unmet. Judge each of these again, against the code at the head, and list each that is still not done in `unmet`, in the same words:",
21332
+ ...unmet.map((item) => `- ${item}`)
21333
+ ]
21334
+ ].join(`
21335
+ `),
21336
+ "Also list in `unmet`, one line each, any criterion or part the fix undoes. What an answer under your brief's Answers so far put out of scope is reported, not unmet: list each of these in `reported` instead. Set `met` to true only if `unmet` is empty. If your brief has no Task, leave `scope` out."
21320
21337
  ].join(`
21321
21338
 
21322
21339
  `);
21323
- var exhaustivePrompt = [
21324
- "Review exhaustively, in this one pass. For each rule or check the change adds or alters, such as who may read or change what, a validation, a limit or a state transition, trace it through every caller and every input it can get before you report: each kind of actor, each visibility, Team and Project scope, and ids the caller gives.",
21340
+ var fixRound = (input) => (input.earlier?.length ?? 0) > 0 || input.reviewed !== undefined;
21341
+ var scopeToRejudge = (input) => fixRound(input) && (input.scope?.met === true || (input.scope?.unmet.length ?? 0) > 0) ? input.scope : undefined;
21342
+ var scopePrompt = (input) => {
21343
+ const earlier = scopeToRejudge(input);
21344
+ return [
21345
+ earlier === undefined ? wholeScopePrompt : rejudgedScopePrompt(earlier.unmet),
21346
+ ...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
21347
+ ...input.claims === undefined || input.claims.length === 0 ? [] : [
21348
+ earlier === undefined ? "The implementer claims it built these. Check them against the code rather than taking them on trust:" : "The implementer claims these. Check those about the fix or an unmet item against the code rather than taking them on trust:",
21349
+ ...input.claims.map((claim) => `- ${claim}`)
21350
+ ]
21351
+ ].join(`
21352
+
21353
+ `);
21354
+ };
21355
+ var exhaustivePrompt = (subject) => [
21356
+ `Review exhaustively, in this one pass. For each rule or check ${subject} adds or alters, such as who may read or change what, a validation, a limit or a state transition, trace it through every caller and every input it can get before you report: each kind of actor, each visibility, Team and Project scope, and ids the caller gives.`,
21325
21357
  "Report every finding of every severity in this one pass, grouped by the rule it breaks: do not stop at the first serious one in an area, and hold none back for a later round. Give each its `rule`, worded alike for every finding that breaks the same rule, and its `checked`: the sibling cases of that rule you checked and found fine, so the next round need not explore them again."
21326
21358
  ].join(" ");
21327
21359
  var earlierPrompt = (earlier) => [
21328
- "An earlier review found these. Give each as a `followUps` entry with its id: fixed, changed (the code moved but the problem stands) or still_there. Do not report them again as findings.",
21360
+ "Earlier rounds, by both reviewers, left these findings open. Give each as a `followUps` entry with its id: fixed, changed (the code moved but the problem stands) or still_there. Do not report them again as findings.",
21329
21361
  ...earlier.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`)
21330
21362
  ].join(`
21331
21363
  `);
21332
- var fixRound = (input) => (input.earlier?.length ?? 0) > 0 || input.reviewed !== undefined;
21333
- var fixPrompt = (fix) => `This round reviews ${fix} and the code it touches, exhaustively as above. Raise a new problem outside the fix and the code it touches only if it is a blocker; report one that is not as a minor with \`outsideFix\` set to true, which does not block landing.`;
21334
- var fixOf = (input, head) => input.reviewed === undefined ? "the fix since the earlier review" : `the fix, \`git diff ${input.reviewed}..${head}\` (the target branch merged into it is not the fix),`;
21335
- var promptFor = (seat, target, head, input, failing, notRun) => [
21336
- `You are one of two reviewers. Follow your \`${seats[seat].skill}\` skill; if you do not have it: ${seats[seat].focus}`,
21364
+ var outsideFixPrompt = "Raise a new problem outside the fix and the code it touches only if it is a blocker; report one that is not as a minor with `outsideFix` set to true, which does not block landing.";
21365
+ var fixTargetOf = (input, { head, branches, epic }) => {
21366
+ const from = input.reviewed ?? (input.files === undefined ? undefined : input.since);
21367
+ const branch = branches === undefined ? epic?.branch : branches.source ?? head;
21368
+ return [
21369
+ `${from === undefined ? `the fix made since the earlier review, up to revision ${head}, which you find from the open findings and \`git log\`,` : `the fix, \`git diff ${from}..${head}\`,`} and the code it touches. An empty fix means nothing was changed, so judge only what is asked below. An earlier round reviewed the rest of the change, so do not review that again. You may read any other code you need.`,
21370
+ "The commits merging the target branch brought in are not the fix; what such a merge changed in this change, such as a settled conflict, is.",
21371
+ ...input.files === undefined ? input.approved === undefined ? [] : [
21372
+ `The change was approved at ${input.approved}. Report a problem in code it already had there only if it matters, with \`approvedCode\` set to true: such findings are kept apart and do not block.`
21373
+ ] : [
21374
+ [
21375
+ "Whatever changed in these files since then, even by merging the target branch, counts as the fix:",
21376
+ ...input.files.map((file) => `- ${file}`)
21377
+ ].join(`
21378
+ `)
21379
+ ],
21380
+ ...branch === undefined ? [] : [
21381
+ `Look nothing up: fetch \`${branch}\` from \`origin\`, and read exactly revision ${head} even if it has moved since. ${unfetchable(head)}`
21382
+ ]
21383
+ ].join(`
21384
+
21385
+ `);
21386
+ };
21387
+ var promptFor = (seat, target, input, failing, notRun) => [
21388
+ `You are ${fixRound(input) ? "the only reviewer of this round" : "one of two reviewers"}. Follow your \`${seats[seat].skill}\` skill; if you do not have it: ${seats[seat].focus}`,
21337
21389
  `Review ${target}`,
21338
21390
  "Give `summary`: one sentence on whether it can merge and what matters most.",
21339
21391
  "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.",
21340
- exhaustivePrompt,
21392
+ exhaustivePrompt(fixRound(input) ? "the fix" : "the change"),
21341
21393
  "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.",
21342
21394
  "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.",
21343
21395
  ...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
21344
21396
  ...input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)],
21345
- ...fixRound(input) ? [fixPrompt(fixOf(input, head))] : [],
21397
+ ...fixRound(input) ? [outsideFixPrompt] : [],
21346
21398
  ...failing.length === 0 ? [] : [
21347
21399
  `These checks fail on this head and pass on the base: ${failing.join(", ")}. The implementer has their output, so do not report them as findings, and do not say it can merge while they fail.`
21348
21400
  ],
@@ -21367,6 +21419,19 @@ var detailOf = (detail, rule, checked) => [
21367
21419
  detail,
21368
21420
  ...checked.length === 0 ? [] : [`Checked and fine: ${checked.join("; ")}.`]
21369
21421
  ].join(" ");
21422
+ var severityRank = { blocker: 0, major: 1, minor: 2 };
21423
+ var blockingSeatsOf = (finding) => isBlocking(finding) ? finding.blockingSeats ?? finding.seats : [];
21424
+ var withEarlier = (worse, earlier) => {
21425
+ const { blockingSeats: _, ...finding } = worse;
21426
+ const seats = [...new Set([...earlier.seats, ...worse.seats])];
21427
+ const blockingSeats = [...new Set([...blockingSeatsOf(earlier), ...blockingSeatsOf(worse)])];
21428
+ return {
21429
+ ...finding,
21430
+ detail: `${finding.detail} Still open on this line: ${earlier.detail}`,
21431
+ seats,
21432
+ ...blockingSeats.length === seats.length ? undefined : { blockingSeats }
21433
+ };
21434
+ };
21370
21435
  var idOf = (finding) => `${finding.file}:${finding.line}`;
21371
21436
  var groupedByRule = (bySeat) => {
21372
21437
  const rules = new Map;
@@ -21418,14 +21483,15 @@ ${followUps.map((entry) => `- \`${entry.id}\` ${entry.status.replace("_", " ")}`
21418
21483
  ].join(`
21419
21484
 
21420
21485
  `);
21421
- var fixBrief = (changeRequestId, findings) => [
21486
+ var fixBrief = (changeRequestId, findings, unmet) => [
21422
21487
  `Fix what a review of ChangeRequest ${changeRequestId} found, on its branch:`,
21423
- ...findings.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`)
21488
+ ...findings.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`),
21489
+ ...unmet.length === 0 ? [] : ["Do what it found unmet:", ...unmet.map((item) => `- ${item}`)]
21424
21490
  ].join(`
21425
21491
  `);
21426
21492
  var review_default = defineLoop({
21427
21493
  id: "review",
21428
- version: "3.9.0",
21494
+ version: "3.10.0",
21429
21495
  title: "Review",
21430
21496
  input: Input,
21431
21497
  output: Output,
@@ -21455,37 +21521,45 @@ var review_default = defineLoop({
21455
21521
  return yield* new ReviewDiffEmpty({
21456
21522
  message: `Base and head are both commit ${range.head}, so the diff is empty: give the base the change is to merge into`
21457
21523
  });
21458
- const target = targetOf(input, range);
21524
+ const target = fixRound(input) ? fixTargetOf(input, range) : targetOf(input, range);
21459
21525
  const verified = head === undefined ? { failing: [], notRun: [] } : yield* verifyHead("verify", head);
21460
21526
  const failing = [...new Set([...input.failing ?? [], ...verified.failing])];
21461
21527
  const notRun = [...new Set([...input.notRun ?? [], ...verified.notRun])];
21462
- const outputs = yield* forEach2(seatNames, (seat) => agentWork(`review:${seat}`, {
21528
+ const outputs = yield* forEach2(fixRound(input) ? [scopeSeat] : seatNames, (seat) => agentWork(`review:${seat}`, {
21463
21529
  agent: seat,
21464
- prompt: promptFor(seat, target, range.head, input, failing, notRun),
21530
+ prompt: promptFor(seat, target, input, failing, notRun),
21465
21531
  output: SeatOutput
21466
21532
  }).pipe(map8((output) => [seat, output])), { concurrency: "unbounded" });
21467
21533
  const earlier = input.earlier ?? [];
21468
- const earlierIds = new Set(earlier.map((finding) => finding.id));
21534
+ const earlierById = new Map(earlier.map((finding) => [finding.id, finding]));
21469
21535
  const answered = followUpsOf(earlier, outputs.flatMap(([, output]) => output.followUps ?? []));
21470
21536
  const standing = new Set(answered.flatMap((entry) => entry.status === "fixed" ? [] : [entry.id]));
21471
- const verdicts = outputs.flatMap(([, output]) => output.verdicts ?? []);
21472
- const settled = settleRound({ findings: earlier, rebuttals: input.rebuttals ?? [], verdicts });
21537
+ const given = outputs.flatMap(([, output]) => output.verdicts ?? []);
21538
+ const settled = settleRound({ findings: earlier, rebuttals: input.rebuttals ?? [], verdicts: given });
21473
21539
  const withdrawn = new Set(settled.withdrawn.map((entry) => entry.finding.id));
21474
- const carried = earlier.filter((finding) => standing.has(finding.id) && !withdrawn.has(finding.id));
21540
+ const open = new Map([...earlierById].filter(([id]) => standing.has(id) && !withdrawn.has(id)));
21475
21541
  const followUps = answered.filter((entry) => !withdrawn.has(entry.id));
21476
21542
  const sinceApproval = input.approved !== undefined && input.files === undefined;
21543
+ const isNew = (finding) => {
21544
+ const before = earlierById.get(idOf(finding));
21545
+ return before === undefined || severityRank[finding.severity] < severityRank[before.severity] || !standing.has(before.id) && !withdrawn.has(before.id);
21546
+ };
21477
21547
  const merged = (approvedCode) => groupedByRule(Object.fromEntries(outputs.map(([seat, output]) => [
21478
21548
  seat,
21479
- output.findings.filter((finding) => !earlierIds.has(`${finding.file}:${finding.line}`) && (sinceApproval && finding.approvedCode === true) === approvedCode).map((finding) => fixRound(input) ? outsideFixAsMinor(finding) : finding)
21549
+ output.findings.map((finding) => fixRound(input) ? outsideFixAsMinor(finding) : finding).filter((finding) => isNew(finding) && (sinceApproval && finding.approvedCode === true) === approvedCode)
21480
21550
  ])));
21481
- const fresh = merged(false);
21551
+ const fresh = merged(false).map((finding) => {
21552
+ const before = open.get(finding.id);
21553
+ return before === undefined ? finding : withEarlier(finding, before);
21554
+ });
21555
+ const freshIds = new Set(fresh.map((finding) => finding.id));
21482
21556
  const approvedFindings = sinceApproval ? merged(true) : [];
21483
- const findings = [...carried, ...fresh];
21557
+ const findings = [...[...open.values()].filter((finding) => !freshIds.has(finding.id)), ...fresh];
21558
+ const verdicts = given.map((verdict) => freshIds.has(verdict.findingId) ? { ...verdict, accepted: false } : verdict);
21484
21559
  const blockers = findings.filter(isBlocking);
21485
- const judged = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
21486
- const scope = judged === undefined ? undefined : agreedScope(judged);
21560
+ const judged = outputs.find(([seat]) => seat === scopeSeat)?.[1].scope;
21561
+ const scope = wholeChange(input) ? carriedScope(judged, fixRound(input) ? input.scope : undefined) : undefined;
21487
21562
  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(" ");
21488
- const freshIds = new Set(fresh.map((finding) => finding.id));
21489
21563
  const text = reviewText(summary, findings, followUps, approvedFindings, notRun, scope?.reported ?? []);
21490
21564
  const stored = yield* artifact("findings", {
21491
21565
  kind: "review-findings",
@@ -21535,18 +21609,19 @@ What next?`,
21535
21609
  }
21536
21610
  if (choice === "Fix here") {
21537
21611
  const fixed = yield* call("fix", buildLoop(), {
21538
- words: fixBrief(changeRequestId, findings),
21612
+ words: fixBrief(changeRequestId, findings, scope?.unmet ?? []),
21539
21613
  changeRequestId,
21540
21614
  maxRounds: 2,
21541
21615
  reviewed: range.head,
21542
21616
  ...findings.length === 0 ? undefined : { earlier: findings },
21617
+ ...scope === undefined ? undefined : { scope },
21543
21618
  ...ownDeliveryTarget(input)
21544
21619
  });
21545
21620
  return { choice, detail: fixed.settled ? "Fixed and pushed" : `Pushed; left: ${fixed.unsettled.join("; ")}` };
21546
21621
  }
21547
21622
  if (choice === "Build from it") {
21548
21623
  const built = yield* call("build", buildLoop(), {
21549
- words: fixBrief(changeRequestId, findings),
21624
+ words: fixBrief(changeRequestId, findings, scope?.unmet ?? []),
21550
21625
  ...ownDeliveryTarget(input)
21551
21626
  });
21552
21627
  return { choice, detail: built.changeRequest.url };
@@ -22102,7 +22177,8 @@ var ShepherdOutput = Struct({
22102
22177
  taskId: optional2(String5),
22103
22178
  branch: optional2(String5),
22104
22179
  reviewed: optional2(String5),
22105
- earlier: optional2(ArraySchema(MergedFinding))
22180
+ earlier: optional2(ArraySchema(MergedFinding)),
22181
+ scope: optional2(ReviewedScope)
22106
22182
  }))
22107
22183
  });
22108
22184
 
@@ -22292,7 +22368,7 @@ var repliesPrompt = (threads) => [
22292
22368
  var threadKey = (thread) => `${thread.id}:${thread.comments.length}`;
22293
22369
  var shepherd_default = defineLoop({
22294
22370
  id: "shepherd",
22295
- version: "1.9.0",
22371
+ version: "1.10.0",
22296
22372
  title: "Shepherd",
22297
22373
  input: Input3,
22298
22374
  output: Output3,
@@ -22329,6 +22405,7 @@ var shepherd_default = defineLoop({
22329
22405
  const leftToPerson = new Set;
22330
22406
  let headFindings = [];
22331
22407
  let headFindingsAt;
22408
+ let headScope;
22332
22409
  const unranAt = new Map;
22333
22410
  const rounds = { "ci-fix": 0, "head-fix": 0 };
22334
22411
  const allowed = { "ci-fix": 0, "head-fix": 0 };
@@ -22542,7 +22619,13 @@ ${open}`,
22542
22619
  unreviewed = caught.from === unreviewed.synced ? { ...unreviewed, files, synced: caught.head } : { ...unreviewed, files };
22543
22620
  } else if (caught !== undefined && verdict.kind === "review") {
22544
22621
  notCarried = undefined;
22545
- unreviewed = { files: verdict.files, synced: caught.head, sync: `sync:${cycle}`, earlier: [] };
22622
+ unreviewed = {
22623
+ files: verdict.files,
22624
+ synced: caught.head,
22625
+ sync: `sync:${cycle}`,
22626
+ from: caught.from,
22627
+ earlier: []
22628
+ };
22546
22629
  } else if (caught !== undefined) {
22547
22630
  notCarried = undefined;
22548
22631
  const carried = yield* approveChangeRequest(`carry:${cycle}`, {
@@ -22625,7 +22708,8 @@ ${open}`,
22625
22708
  }
22626
22709
  return stop(ready);
22627
22710
  });
22628
- const reviewMergedFiles = (cycle, head, files) => gen2(function* () {
22711
+ const reviewMergedFiles = (cycle, pipeline, files) => gen2(function* () {
22712
+ const { head } = pipeline;
22629
22713
  yield* passTurn();
22630
22714
  const reviewed = yield* call(`review:${cycle}`, reviewLoop(), {
22631
22715
  base: `origin/${target}`,
@@ -22638,7 +22722,7 @@ ${open}`,
22638
22722
  if (reviewed.blocking) {
22639
22723
  const blocking = reviewed.findings.filter(isBlocking);
22640
22724
  if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
22641
- return stop(handBack(`The review of the catch-up merge's files still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, findingLines2(blocking), { reviewed: head, earlier: reviewed.findings }));
22725
+ return stop(handBack(`The review of the catch-up merge's files still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, findingLines2(blocking), pipeline.approved === files.from ? { reviewed: head, earlier: reviewed.findings } : undefined));
22642
22726
  rounds["head-fix"]++;
22643
22727
  const fix = yield* agentWork(`review-fix:${cycle}`, {
22644
22728
  agent: "implementer",
@@ -22698,12 +22782,18 @@ ${open}`,
22698
22782
  ...notRun.length === 0 ? undefined : { notRun },
22699
22783
  ...since === undefined ? undefined : { approved: since },
22700
22784
  ...headFindings.length === 0 ? undefined : { earlier: headFindings },
22701
- ...headFindingsAt === undefined ? undefined : { reviewed: headFindingsAt }
22785
+ ...headFindingsAt === undefined ? undefined : { reviewed: headFindingsAt },
22786
+ ...headScope === undefined ? undefined : { scope: headScope }
22702
22787
  });
22703
22788
  if (reviewed.blocking) {
22704
22789
  const blocking = reviewed.findings.filter(isBlocking);
22705
22790
  if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
22706
- return stop(handBack(`The review of ${head} still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, findingLines2(blocking), { reviewed: head, earlier: reviewed.findings }));
22791
+ return stop(handBack(`The review of ${head} still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, [findingLines2(blocking), ...(reviewed.scope?.unmet ?? []).map((item) => `- Not done: ${item}`)].join(`
22792
+ `), {
22793
+ reviewed: head,
22794
+ earlier: reviewed.findings,
22795
+ ...reviewed.scope === undefined ? undefined : { scope: reviewed.scope }
22796
+ }));
22707
22797
  rounds["head-fix"]++;
22708
22798
  const fix = yield* agentWork(`head-fix:${cycle}`, {
22709
22799
  agent: "implementer",
@@ -22713,11 +22803,13 @@ ${open}`,
22713
22803
  });
22714
22804
  headFindings = reviewed.findings;
22715
22805
  headFindingsAt = head;
22806
+ headScope = reviewed.scope;
22716
22807
  fixedFrom = { head, changed: fix.changed, looks: 0 };
22717
22808
  return { kind: "fixing" };
22718
22809
  }
22719
22810
  headFindings = [];
22720
22811
  headFindingsAt = undefined;
22812
+ headScope = undefined;
22721
22813
  if (notRun.length > 0)
22722
22814
  unranAt.set(head, { notRun, review: `head-review:${cycle}` });
22723
22815
  else {
@@ -22763,7 +22855,7 @@ ${open}`,
22763
22855
  if (head !== pipeline.head)
22764
22856
  return;
22765
22857
  if (unreviewed !== undefined)
22766
- return yield* reviewMergedFiles(cycle, head, unreviewed);
22858
+ return yield* reviewMergedFiles(cycle, pipeline, unreviewed);
22767
22859
  if (notCarried !== undefined && pipeline.approved !== head)
22768
22860
  return yield* reviewHead(cycle, pipeline, "the head its catch-up merge pushed");
22769
22861
  return;
@@ -22988,7 +23080,7 @@ ${open}`,
22988
23080
  }
22989
23081
  let reviewedHere = reviewedHeads.has(pipeline.head) && (pipeline.approved === pipeline.head || unranAt.has(pipeline.head));
22990
23082
  if (unreviewed !== undefined) {
22991
- const reviewing = yield* reviewMergedFiles(cycle, pipeline.head, unreviewed);
23083
+ const reviewing = yield* reviewMergedFiles(cycle, pipeline, unreviewed);
22992
23084
  if (reviewing.kind === "stop")
22993
23085
  return reviewing.output;
22994
23086
  if (reviewing.kind === "fixing")
@@ -23175,6 +23267,7 @@ var BuildInput = Struct({
23175
23267
  maxRebuilds: optional2(Int.check(isGreaterThanOrEqualTo2(0))),
23176
23268
  reviewed: optional2(String5),
23177
23269
  earlier: optional2(ArraySchema(MergedFinding)),
23270
+ scope: optional2(ReviewedScope),
23178
23271
  ...DeliveryFields
23179
23272
  });
23180
23273
  var CriterionAnswer = Struct({
@@ -23222,6 +23315,7 @@ var BuildOutput = Struct({
23222
23315
  criteria: ArraySchema(CriterionAnswer),
23223
23316
  notRun: optional2(ArraySchema(String5)),
23224
23317
  findings: optional2(ArraySchema(MergedFinding)),
23318
+ scope: optional2(ReviewedScope),
23225
23319
  blockingCounts: optional2(ArraySchema(Int)),
23226
23320
  approval: optional2(ApproveChangeRequestResult),
23227
23321
  landed: optional2(ShepherdOutput),
@@ -23298,7 +23392,7 @@ var reproducedOnBranchPrompt = (task) => [
23298
23392
  var findingLine = (finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail}`;
23299
23393
  var disputeLine = ({ finding, rebuttal }) => `${findingLine(finding)}
23300
23394
  You rebutted: ${rebuttal.reason}`;
23301
- var fixPrompt2 = (settled) => {
23395
+ var fixPrompt = (settled) => {
23302
23396
  const checks = settled.open.filter((finding) => isCheckFinding(finding.id));
23303
23397
  const findings = settled.open.filter((finding) => !isCheckFinding(finding.id));
23304
23398
  return [
@@ -23363,12 +23457,14 @@ var rally = (input) => gen2(function* () {
23363
23457
  };
23364
23458
  const failing = brokenChecks(head).map((check) => check.name);
23365
23459
  const notRun = testsNotRunReasons(head);
23460
+ const scope = last === undefined ? input.scope : last.scope;
23366
23461
  const reviewed = yield* call(`review:${round}`, review_default, {
23367
23462
  base,
23368
23463
  head: head.revision,
23369
23464
  ...rebuttals.length === 0 ? undefined : { rebuttals },
23370
23465
  ...earlier.length === 0 ? undefined : { earlier },
23371
23466
  ...last === undefined ? input.reviewed === undefined ? undefined : { reviewed: input.reviewed } : { reviewed: last.head.revision },
23467
+ ...scope === undefined ? undefined : { scope },
23372
23468
  ...input.outcome === undefined ? undefined : { outcome: input.outcome },
23373
23469
  ...failing.length === 0 ? undefined : { failing },
23374
23470
  ...notRun.length === 0 ? undefined : { notRun },
@@ -23405,7 +23501,7 @@ var rally = (input) => gen2(function* () {
23405
23501
  shown.add(finding.detail);
23406
23502
  const fixed = yield* agentWork(`fix:${round}`, {
23407
23503
  agent: "implementer",
23408
- prompt: fixPrompt2(settled),
23504
+ prompt: fixPrompt(settled),
23409
23505
  output: Fixed
23410
23506
  });
23411
23507
  claims.push(...fixed.claims, ...fixed.rebuttals.flatMap((rebuttal) => isCheckFinding(rebuttal.findingId) ? [`Rebutted ${rebuttal.findingId}: ${rebuttal.reason}`] : []));
@@ -23420,7 +23516,7 @@ var rally = (input) => gen2(function* () {
23420
23516
  });
23421
23517
  var build2 = defineLoop({
23422
23518
  id: "build",
23423
- version: "2.10.0",
23519
+ version: "2.11.0",
23424
23520
  title: "Build",
23425
23521
  input: BuildInput,
23426
23522
  output: BuildOutput,
@@ -23482,7 +23578,8 @@ var build2 = defineLoop({
23482
23578
  suggested: implemented.checks ?? [],
23483
23579
  reproducing: reproduced?.check,
23484
23580
  reviewed: input.reviewed,
23485
- earlier: input.earlier ?? []
23581
+ earlier: input.earlier ?? [],
23582
+ scope: input.scope
23486
23583
  });
23487
23584
  const verdict = evidenceGate({
23488
23585
  ...outcome === undefined ? undefined : { outcome },
@@ -23533,6 +23630,7 @@ var build2 = defineLoop({
23533
23630
  criteria,
23534
23631
  ...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
23535
23632
  ...last.earlier.length === 0 ? undefined : { findings: last.earlier },
23633
+ ...last.scope === undefined ? undefined : { scope: last.scope },
23536
23634
  blockingCounts: last.blockingCounts,
23537
23635
  ...approval === undefined ? undefined : { approval }
23538
23636
  };
@@ -23597,6 +23695,7 @@ var build2 = defineLoop({
23597
23695
  land: false,
23598
23696
  reviewed: settledAs.revision,
23599
23697
  ...settledAs.findings === undefined ? undefined : { earlier: settledAs.findings },
23698
+ ...settledAs.scope === undefined ? undefined : { scope: settledAs.scope },
23600
23699
  ...ownDeliveryTarget(input)
23601
23700
  }, { constraints: standing.map(standingConstraint) });
23602
23701
  settledAs = rebuilt;
@@ -23811,7 +23910,7 @@ var changePrompt = (discovery, plan, tried, cycle) => [
23811
23910
 
23812
23911
  `);
23813
23912
  var revertPrompt = (start, cycle) => `Cycle ${cycle}'s change did not prove faster. Revert its commits, and only those: run \`git revert --no-edit ${start}..HEAD\`. Touch no commit at or before ${start}, never reset or force-push, and change nothing else.`;
23814
- var fixPrompt3 = (findings) => [
23913
+ var fixPrompt2 = (findings) => [
23815
23914
  "The review of the climb found these. Fix each, keep behaviour exactly as it is and keep the gain, and commit. Kitman verifies and measures again; a fix that costs the gain ends the climb.",
23816
23915
  ...findings.map((finding) => `- ${finding.id}: ${finding.detail}`)
23817
23916
  ].join(`
@@ -23874,7 +23973,7 @@ var steadier = (plan) => {
23874
23973
  };
23875
23974
  var hillclimb_default = defineLoop({
23876
23975
  id: "hillclimb",
23877
- version: "1.4.0",
23976
+ version: "1.5.0",
23878
23977
  title: "Hillclimb",
23879
23978
  outcome: "performance",
23880
23979
  input: Input5,
@@ -24008,7 +24107,7 @@ var hillclimb_default = defineLoop({
24008
24107
  const blocking = reviewed.findings.filter(isBlocking);
24009
24108
  yield* agentWork(`fix:${round}`, {
24010
24109
  agent: "implementer",
24011
- prompt: fixPrompt3(blocking),
24110
+ prompt: fixPrompt2(blocking),
24012
24111
  output: Struct({ summary: OneSentence })
24013
24112
  });
24014
24113
  const fixed = yield* verify(`verify:fix:${round}`, {});
@@ -24027,8 +24126,9 @@ var hillclimb_default = defineLoop({
24027
24126
  outcome: "performance",
24028
24127
  ...notRunOf(fixed),
24029
24128
  claims,
24030
- earlier: blocking,
24031
- reviewed: fixedFrom
24129
+ earlier: reviewed.findings,
24130
+ reviewed: fixedFrom,
24131
+ ...reviewed.scope === undefined ? undefined : { scope: reviewed.scope }
24032
24132
  });
24033
24133
  }
24034
24134
  const notRun = testsNotRunReasons(head);
@@ -24313,10 +24413,13 @@ var planText = (plan) => [
24313
24413
  ].join(`
24314
24414
 
24315
24415
  `);
24416
+ var outOfScopeText = ({ outOfScope = [] }) => outOfScope.length === 0 ? [] : ["Out of scope:", ...outOfScope.map((item) => `- ${item}`)];
24316
24417
  var ticketText = (ticket) => [
24317
24418
  `### ${ticket.key}: ${ticket.title}`,
24318
24419
  ticket.body,
24420
+ ...ticket.promise === undefined ? [] : [`Promise: ${ticket.promise}`],
24319
24421
  ...ticket.acceptanceCriteria.map((criterion) => `- [ ] ${criterion}`),
24422
+ ...outOfScopeText(ticket),
24320
24423
  ...ticket.blockedBy.length === 0 ? [] : [`Blocked by: ${ticket.blockedBy.join(", ")}`]
24321
24424
  ].join(`
24322
24425
 
@@ -24379,10 +24482,12 @@ var storePlan = (plan, suffix, revision, answered) => gen2(function* () {
24379
24482
  text: plan.tickets.map(ticketText).join(`
24380
24483
 
24381
24484
  `),
24382
- data: plan.tickets.map(({ repoBindingId, outcome, ...ticket }) => ({
24485
+ data: plan.tickets.map(({ repoBindingId, outcome, promise, outOfScope, ...ticket }) => ({
24383
24486
  ...ticket,
24384
24487
  acceptanceCriteria: [...ticket.acceptanceCriteria],
24385
24488
  blockedBy: [...ticket.blockedBy],
24489
+ ...promise === undefined ? undefined : { promise },
24490
+ ...outOfScope === undefined ? undefined : { outOfScope: [...outOfScope] },
24386
24491
  ...repoBindingId === undefined ? undefined : { repoBindingId },
24387
24492
  ...outcome === undefined ? undefined : { outcome }
24388
24493
  }))
@@ -24420,7 +24525,9 @@ var changelog = (before, after, words) => {
24420
24525
  var buildWords = (ticket) => [
24421
24526
  ticket.title,
24422
24527
  ticket.body,
24423
- ...ticket.acceptanceCriteria.length === 0 ? [] : ["Acceptance criteria:", ...ticket.acceptanceCriteria.map((criterion) => `- ${criterion}`)]
24528
+ ...ticket.promise === undefined ? [] : [`Promise: ${ticket.promise}`],
24529
+ ...ticket.acceptanceCriteria.length === 0 ? [] : ["Acceptance criteria:", ...ticket.acceptanceCriteria.map((criterion) => `- ${criterion}`)],
24530
+ ...outOfScopeText(ticket)
24424
24531
  ].join(`
24425
24532
 
24426
24533
  `);
@@ -25268,7 +25375,7 @@ var batchPrompt = (requests, target) => [
25268
25375
  ].join(`
25269
25376
 
25270
25377
  `);
25271
- var fixPrompt4 = (failed, applied) => [
25378
+ var fixPrompt3 = (failed, applied) => [
25272
25379
  `The batch of ${applied.map((number) => `!${number}`).join(", ")} fails these checks:`,
25273
25380
  ...failed.checks.filter((check) => check.status === "failed").map((check) => `- ${check.name}: \`${check.command}\``),
25274
25381
  "Fix what an update broke, the way its changelog says to. If an update cannot be fixed in a small change, take it back out and drop it with the reason. Commit nothing yourself."
@@ -25401,7 +25508,7 @@ var sweep_default = defineLoop({
25401
25508
  for (let round = 1;!checked.passed && round <= maxFixRounds && batched.applied.length > 0; round++) {
25402
25509
  batched = yield* agentWork(`fix:${round}`, {
25403
25510
  agent: "implementer",
25404
- prompt: fixPrompt4(checked, batched.applied),
25511
+ prompt: fixPrompt3(checked, batched.applied),
25405
25512
  output: Batched
25406
25513
  });
25407
25514
  for (const drop of batched.dropped)
@@ -25677,7 +25784,7 @@ var fallbacks = [{ harness: "pi" }];
25677
25784
  var reviewer = {
25678
25785
  harness: "pi",
25679
25786
  model: "openai-codex/gpt-6.2-sol",
25680
- fallbacks: [{ harness: "claude", model: "opus", effort: "high" }]
25787
+ fallbacks: [{ harness: "claude", model: "opus", effort: "medium" }]
25681
25788
  };
25682
25789
  var kitman_config_default = defineKit({
25683
25790
  loops: [
@@ -25711,6 +25818,8 @@ var kitman_config_default = defineKit({
25711
25818
  skills: ["code-review-and-quality", "security-and-hardening"]
25712
25819
  },
25713
25820
  planner: {
25821
+ harness: "claude",
25822
+ model: "claude-fable-5-2",
25714
25823
  effort: "high",
25715
25824
  fallbacks,
25716
25825
  skills: ["grilling", "domain-modeling"],
@@ -28686,6 +28795,8 @@ class RunnerCapabilityRpcs extends make31(make30("PutQuestion", {
28686
28795
  title: String5,
28687
28796
  body: String5,
28688
28797
  acceptanceCriteria: ArraySchema(String5),
28798
+ promise: optionalKey2(String5),
28799
+ outOfScope: optionalKey2(ArraySchema(String5)),
28689
28800
  blockedBy: ArraySchema(String5),
28690
28801
  outcome: optionalKey2(Literals(["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"])),
28691
28802
  repoBindingId: optionalKey2(String5)
@@ -29228,6 +29339,8 @@ var rpcProgramPorts = (rpc, work) => {
29228
29339
  title: ticket.title,
29229
29340
  body: ticket.body,
29230
29341
  acceptanceCriteria: ticket.acceptanceCriteria,
29342
+ ...ticket.promise === undefined ? undefined : { promise: ticket.promise },
29343
+ ...ticket.outOfScope === undefined ? undefined : { outOfScope: ticket.outOfScope },
29231
29344
  blockedBy: ticket.blockedBy,
29232
29345
  ...ticket.outcome === undefined ? undefined : { outcome: ticket.outcome },
29233
29346
  ...ticket.repoBindingId === undefined ? undefined : { repoBindingId: ticket.repoBindingId }
@@ -31505,4 +31618,4 @@ var runKit = (config, identity, packages) => {
31505
31618
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31506
31619
  };
31507
31620
  // .kitman-build-entry.ts
31508
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.6" }, []);
31621
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.8" }, []);