@kitman-sh/software-engineering 0.13.16 → 0.13.17
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/implementer.md +1 -0
- package/agents/reviewer.md +3 -2
- package/dist/bundle.js +573 -87
- package/dist/declarations.json +1026 -58
- package/package.json +3 -3
- package/src/build.ts +124 -14
- package/src/change-request-body.ts +4 -0
- package/src/hillclimb.ts +7 -2
- package/src/out-of-scope.ts +35 -0
- package/src/review.ts +755 -77
- package/src/reviewed-scope.ts +18 -2
- package/src/shepherd-output.ts +2 -0
- package/src/shepherd.ts +17 -5
- package/src/tidy.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/software-engineering",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.17",
|
|
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.13.
|
|
20
|
+
"@kitman-sh/sdk": "0.13.17",
|
|
21
21
|
"effect": "^4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"kitman": {
|
|
24
24
|
"bundle": "dist/bundle.js",
|
|
25
|
-
"digest": "
|
|
25
|
+
"digest": "197375c4f54b7fbbde67c518c4eb571df8f91283ffb091b72c380241a72c7908",
|
|
26
26
|
"protocolVersion": 5,
|
|
27
27
|
"declarations": "dist/declarations.json",
|
|
28
28
|
"setup": {
|
package/src/build.ts
CHANGED
|
@@ -44,6 +44,15 @@ import {
|
|
|
44
44
|
unsettledItems
|
|
45
45
|
} from './change-request-body'
|
|
46
46
|
import { blockingCount, rebuildRefusal } from './convergence'
|
|
47
|
+
import {
|
|
48
|
+
caseOf,
|
|
49
|
+
inCase,
|
|
50
|
+
listedCases,
|
|
51
|
+
numberedCases,
|
|
52
|
+
OutOfScopeFinding,
|
|
53
|
+
outOfScopeCase,
|
|
54
|
+
outOfScopeLines
|
|
55
|
+
} from './out-of-scope'
|
|
47
56
|
import review from './review'
|
|
48
57
|
import { ReviewedScope } from './reviewed-scope'
|
|
49
58
|
import shepherd from './shepherd'
|
|
@@ -83,6 +92,8 @@ export const BuildInput = Schema.Struct({
|
|
|
83
92
|
/** The head an earlier review read, whose `earlier` findings this Build fixes: its first review reviews the fix. */
|
|
84
93
|
reviewed: Schema.optional(Schema.String),
|
|
85
94
|
earlier: Schema.optional(Schema.Array(MergedFinding)),
|
|
95
|
+
outOfScopeFindings: Schema.optional(Schema.Array(OutOfScopeFinding)),
|
|
96
|
+
taskOutOfScope: Schema.optional(Schema.Array(Schema.String)),
|
|
86
97
|
/** That review's scope judgement, whose unmet items this Build's first review judges again. */
|
|
87
98
|
scope: Schema.optional(ReviewedScope),
|
|
88
99
|
/**
|
|
@@ -98,7 +109,8 @@ const CriterionAnswer = Schema.Struct({
|
|
|
98
109
|
criterion: Schema.String,
|
|
99
110
|
status: Schema.Literals(['met', 'after_merge', 'not_met']),
|
|
100
111
|
/** The test or file that shows it met, or why it is after merge or not met. */
|
|
101
|
-
detail: ShortStatement
|
|
112
|
+
detail: ShortStatement,
|
|
113
|
+
...outOfScopeCase
|
|
102
114
|
})
|
|
103
115
|
|
|
104
116
|
type CriterionAnswer = typeof CriterionAnswer.Type
|
|
@@ -160,6 +172,8 @@ export const BuildOutput = Schema.Struct({
|
|
|
160
172
|
notRun: Schema.optional(Schema.Array(Schema.String)),
|
|
161
173
|
/** The last review's code findings still open or disputed, which a Build fixing them takes as `earlier`. */
|
|
162
174
|
findings: Schema.optional(Schema.Array(MergedFinding)),
|
|
175
|
+
/** The reviews' findings kept apart as out of scope, which a Build fixing what it left takes as its own. */
|
|
176
|
+
outOfScopeFindings: Schema.optional(Schema.Array(OutOfScopeFinding)),
|
|
163
177
|
/** The last review's scope judgement, which a Build fixing what it left takes as `scope`. */
|
|
164
178
|
scope: Schema.optional(ReviewedScope),
|
|
165
179
|
/** Each Review round's blocking count, first to last, which decides whether a Rebuild may follow. */
|
|
@@ -206,6 +220,17 @@ export class BuildOutcomeRefused extends Schema.TaggedError<BuildOutcomeRefused>
|
|
|
206
220
|
const criteriaGuidance =
|
|
207
221
|
'If your brief has a Task, answer each of its acceptance criteria in `criteria`: met, with the test or file that shows it; after_merge, with why it can only be seen once merged; or not_met, with why. Give an empty `criteria` when the Task has none.'
|
|
208
222
|
|
|
223
|
+
const outOfScopeGuidance = (cases: readonly string[]) =>
|
|
224
|
+
cases.length === 0
|
|
225
|
+
? []
|
|
226
|
+
: [
|
|
227
|
+
[
|
|
228
|
+
"The Task's Out of scope list is these numbered cases. Do not build them: Review reports a problem in one without holding the change for it, unless it is a blocker, such as a security hole or lost data.",
|
|
229
|
+
...numberedCases(cases),
|
|
230
|
+
"A criterion that is not met only because it falls in one of these is not_met, with `outOfScope` set to the case's number; Review says whether it agrees."
|
|
231
|
+
].join('\n')
|
|
232
|
+
]
|
|
233
|
+
|
|
209
234
|
const checksGuidance =
|
|
210
235
|
'If your brief lists no approved verifications for this repository, name in `checks` the commands from its package scripts or CI config that test, lint and typecheck it, each with a `name` of letters, digits, `.`, `_`, `:` and `-` only, such as `unit-tests`; Kitman runs them and labels them as suggested by you.'
|
|
211
236
|
|
|
@@ -213,28 +238,76 @@ const checksGuidance =
|
|
|
213
238
|
export const implementAdaptation =
|
|
214
239
|
'You run the implement skill as a Kitman Step. The work is in this prompt and your brief, so fetch no ticket. Leave your changes uncommitted: the Run owns the branch. Skip its final code-review: a Review run or a person reviews the change.'
|
|
215
240
|
|
|
216
|
-
const implementPrompt = (
|
|
241
|
+
const implementPrompt = (
|
|
242
|
+
task: string,
|
|
243
|
+
outcome: LoopOutcome | undefined,
|
|
244
|
+
continuing: Continuing | undefined,
|
|
245
|
+
cases: readonly string[]
|
|
246
|
+
) =>
|
|
217
247
|
[
|
|
218
248
|
...(continuing === undefined ? [] : [continuingBrief(continuing), 'Fix forward from there.']),
|
|
219
249
|
`Build ${task}`,
|
|
220
250
|
implementAdaptation,
|
|
221
251
|
...(outcome === undefined ? [] : [outcomeGuidance[outcome]]),
|
|
222
252
|
'Commit nothing yourself: Kitman pushes what you leave in the workspace. Give the ChangeRequest a title and a summary, and list as claims what you believe but Kitman has not checked, such as "the tests pass".',
|
|
253
|
+
...outOfScopeGuidance(cases),
|
|
223
254
|
criteriaGuidance,
|
|
224
255
|
checksGuidance
|
|
225
256
|
].join('\n\n')
|
|
226
257
|
|
|
227
|
-
const criteriaPrompt = (unanswered: boolean, unmet: readonly CriterionAnswer[]) =>
|
|
258
|
+
const criteriaPrompt = (unanswered: boolean, unmet: readonly CriterionAnswer[], cases: readonly string[]) =>
|
|
228
259
|
[
|
|
229
260
|
unanswered
|
|
230
261
|
? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change."
|
|
231
262
|
: '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:',
|
|
232
263
|
...unmet.map(answer => `- ${answer.criterion}: ${answer.detail}`),
|
|
264
|
+
...outOfScopeGuidance(cases),
|
|
233
265
|
criteriaGuidance
|
|
234
266
|
].join('\n\n')
|
|
235
267
|
|
|
236
|
-
const answerLine = (answer: CriterionAnswer) =>
|
|
237
|
-
`${answer.criterion}: ${answer.status.replaceAll('_', ' ')}, ${answer.detail}`
|
|
268
|
+
const answerLine = (answer: CriterionAnswer, cases: readonly string[]) => {
|
|
269
|
+
const line = `${answer.criterion}: ${answer.status.replaceAll('_', ' ')}, ${answer.detail}`
|
|
270
|
+
const item = answer.status === 'not_met' ? caseOf(cases, answer) : undefined
|
|
271
|
+
|
|
272
|
+
return item === undefined ? line : `${line} (proposed Out of scope: ${item})`
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Only the last review, judging the head that ships, settles a criterion; a Task without a list keeps every one unsettled. */
|
|
276
|
+
const reviewedAs = (criterion: string, cases: readonly string[], scope: ReviewedScope | undefined) => {
|
|
277
|
+
if (cases.length === 0 || scope === undefined) return undefined
|
|
278
|
+
const judged = scope.criteria?.find(entry => entry.criterion === criterion)
|
|
279
|
+
|
|
280
|
+
if (judged?.status === 'open' || scope.unmet.includes(criterion)) return { status: 'open' } as const
|
|
281
|
+
|
|
282
|
+
if (judged?.status === 'met') return { status: 'met' } as const
|
|
283
|
+
|
|
284
|
+
if (judged?.status === 'reported' || scope.reported?.includes(criterion)) return { status: 'reported' } as const
|
|
285
|
+
|
|
286
|
+
const item = judged?.item ?? scope.outOfScope?.find(entry => entry.part === criterion)?.item
|
|
287
|
+
|
|
288
|
+
return item !== undefined && cases.includes(item) ? ({ status: 'out_of_scope', item } as const) : undefined
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** A criterion as the ChangeRequest reports it: the review's judgement, with the implementer's answer as its claim. */
|
|
292
|
+
const criterionLine = (answer: CriterionAnswer, cases: readonly string[], scope: ReviewedScope | undefined) => {
|
|
293
|
+
const final = reviewedAs(answer.criterion, cases, scope)
|
|
294
|
+
const answered = `answered ${answer.status.replaceAll('_', ' ')}: ${answer.detail}`
|
|
295
|
+
|
|
296
|
+
if (final === undefined || (final.status === 'met' && answer.status === 'met')) return answerLine(answer, cases)
|
|
297
|
+
|
|
298
|
+
if (final.status === 'open')
|
|
299
|
+
return answer.status === 'not_met'
|
|
300
|
+
? answerLine(answer, cases)
|
|
301
|
+
: `${answer.criterion}: not met, as Review judged it (${answered})`
|
|
302
|
+
|
|
303
|
+
if (final.status === 'met') return `${answer.criterion}: met, as Review judged it (${answered})`
|
|
304
|
+
|
|
305
|
+
if (final.status === 'reported') return `${answer.criterion}: out of scope by an answer (${answered})`
|
|
306
|
+
|
|
307
|
+
return answer.status === 'not_met'
|
|
308
|
+
? inCase(`${answer.criterion}: not met, ${answer.detail}`, final.item)
|
|
309
|
+
: inCase(`${answer.criterion}: not done, as Review judged it (${answered})`, final.item)
|
|
310
|
+
}
|
|
238
311
|
|
|
239
312
|
const reproducingCheckGuidance =
|
|
240
313
|
'Give in `check` the command that runs only that test, with a `name` of letters, digits, `.`, `_`, `:` and `-` that no approved verification of the repository has, unless it is exactly that approved check. Kitman runs it before the fix, where it must fail, and on every head after, where it must pass.'
|
|
@@ -305,7 +378,8 @@ type Round = {
|
|
|
305
378
|
readonly settled: SettledRound
|
|
306
379
|
readonly decision: RallyDecision & { readonly stop: true }
|
|
307
380
|
readonly claims: readonly string[]
|
|
308
|
-
readonly scope:
|
|
381
|
+
readonly scope: ReviewedScope | undefined
|
|
382
|
+
readonly outOfScope: readonly OutOfScopeFinding[]
|
|
309
383
|
readonly conflicts: readonly string[]
|
|
310
384
|
readonly earlier: readonly MergedFinding[]
|
|
311
385
|
readonly blockingCounts: readonly number[]
|
|
@@ -324,8 +398,13 @@ const rally = (input: {
|
|
|
324
398
|
/** The bug's reproducing check, run on every head besides the approved ones. */
|
|
325
399
|
readonly reproducing: typeof SuggestedCheck.Type | undefined
|
|
326
400
|
readonly reviewed: string | undefined
|
|
401
|
+
readonly deliveredBy: string | undefined
|
|
327
402
|
readonly earlier: readonly MergedFinding[]
|
|
328
|
-
readonly
|
|
403
|
+
readonly outOfScope: readonly OutOfScopeFinding[]
|
|
404
|
+
readonly unmetCriteria: readonly string[]
|
|
405
|
+
readonly metCriteria: readonly string[]
|
|
406
|
+
readonly afterMergeCriteria: readonly string[]
|
|
407
|
+
readonly scope: ReviewedScope | undefined
|
|
329
408
|
}) =>
|
|
330
409
|
Effect.gen(function* () {
|
|
331
410
|
const claims = [...input.claims]
|
|
@@ -333,6 +412,7 @@ const rally = (input: {
|
|
|
333
412
|
const blockingCounts: number[] = []
|
|
334
413
|
let rebuttals: readonly Rebuttal[] = []
|
|
335
414
|
let earlier = input.earlier
|
|
415
|
+
let outOfScope = input.outOfScope
|
|
336
416
|
let previous: readonly string[] | undefined
|
|
337
417
|
let last: Pick<Round, 'head' | 'settled' | 'scope'> | undefined
|
|
338
418
|
const shown = new Set<string>()
|
|
@@ -372,6 +452,7 @@ const rally = (input: {
|
|
|
372
452
|
head,
|
|
373
453
|
decision: { stop: true, reason: 'findings_returned', unsettled: blockingIds(last.settled) },
|
|
374
454
|
claims,
|
|
455
|
+
outOfScope,
|
|
375
456
|
conflicts,
|
|
376
457
|
earlier,
|
|
377
458
|
blockingCounts
|
|
@@ -385,6 +466,7 @@ const rally = (input: {
|
|
|
385
466
|
const reviewed = yield* call(`review:${round}`, review, {
|
|
386
467
|
base,
|
|
387
468
|
head: head.revision,
|
|
469
|
+
...(input.deliveredBy === undefined ? undefined : { deliveredBy: input.deliveredBy }),
|
|
388
470
|
...(rebuttals.length === 0 ? undefined : { rebuttals }),
|
|
389
471
|
...(earlier.length === 0 ? undefined : { earlier }),
|
|
390
472
|
...(last === undefined
|
|
@@ -392,6 +474,10 @@ const rally = (input: {
|
|
|
392
474
|
? undefined
|
|
393
475
|
: { reviewed: input.reviewed }
|
|
394
476
|
: { reviewed: last.head.revision }),
|
|
477
|
+
...(outOfScope.length === 0 ? undefined : { outOfScopeFindings: outOfScope }),
|
|
478
|
+
...(input.unmetCriteria.length === 0 ? undefined : { unmetCriteria: input.unmetCriteria }),
|
|
479
|
+
...(input.metCriteria.length === 0 ? undefined : { metCriteria: input.metCriteria }),
|
|
480
|
+
...(input.afterMergeCriteria.length === 0 ? undefined : { afterMergeCriteria: input.afterMergeCriteria }),
|
|
395
481
|
...(scope === undefined ? undefined : { scope }),
|
|
396
482
|
...(input.outcome === undefined ? undefined : { outcome: input.outcome }),
|
|
397
483
|
...(failing.length === 0 ? undefined : { failing }),
|
|
@@ -399,6 +485,7 @@ const rally = (input: {
|
|
|
399
485
|
claims: [...claims]
|
|
400
486
|
})
|
|
401
487
|
|
|
488
|
+
outOfScope = reviewed.outOfScopeFindings ?? []
|
|
402
489
|
const checks = checkFindings(head)
|
|
403
490
|
|
|
404
491
|
const settled = settleRound({
|
|
@@ -432,6 +519,7 @@ const rally = (input: {
|
|
|
432
519
|
decision,
|
|
433
520
|
claims,
|
|
434
521
|
scope: reviewed.scope,
|
|
522
|
+
outOfScope,
|
|
435
523
|
conflicts,
|
|
436
524
|
earlier,
|
|
437
525
|
blockingCounts
|
|
@@ -476,7 +564,7 @@ const rally = (input: {
|
|
|
476
564
|
*/
|
|
477
565
|
const build = defineLoop({
|
|
478
566
|
id: 'build',
|
|
479
|
-
version: '2.
|
|
567
|
+
version: '2.13.0',
|
|
480
568
|
title: 'Build',
|
|
481
569
|
input: BuildInput,
|
|
482
570
|
output: BuildOutput,
|
|
@@ -505,6 +593,7 @@ const build = defineLoop({
|
|
|
505
593
|
|
|
506
594
|
const task = input.words === undefined ? 'the Task your brief describes.' : `this: ${input.words}`
|
|
507
595
|
const outcome = input.outcome
|
|
596
|
+
const cases = listedCases(input.taskOutOfScope)
|
|
508
597
|
// A retry given an earlier Run's branch starts there; Kitman leaves `branch` as what it merges into.
|
|
509
598
|
const epic = epicOf(input)
|
|
510
599
|
const target = input.continuing?.targetBranch ?? input.branch ?? epic?.branch
|
|
@@ -541,20 +630,23 @@ const build = defineLoop({
|
|
|
541
630
|
const implemented = yield* agentWorkOnce('implement', {
|
|
542
631
|
agent: input.planReviewed === true ? 'planned-implementer' : 'implementer',
|
|
543
632
|
skill: 'implement',
|
|
544
|
-
prompt: implementPrompt(task, outcome, input.continuing),
|
|
633
|
+
prompt: implementPrompt(task, outcome, input.continuing, cases),
|
|
545
634
|
output: Implemented
|
|
546
635
|
})
|
|
547
636
|
|
|
548
637
|
// Every criterion is answered before a reviewer reads the change; what is missing or unmet goes back once.
|
|
549
638
|
// An empty list says the Task has none; only a missing one goes back.
|
|
550
639
|
const unanswered = input.taskId !== undefined && implemented.criteria === undefined
|
|
551
|
-
|
|
640
|
+
|
|
641
|
+
const unmet = (implemented.criteria ?? []).filter(
|
|
642
|
+
answer => answer.status === 'not_met' && caseOf(cases, answer) === undefined
|
|
643
|
+
)
|
|
552
644
|
|
|
553
645
|
const criteria =
|
|
554
646
|
unanswered || unmet.length > 0
|
|
555
647
|
? (yield* agentWorkOnce('criteria', {
|
|
556
648
|
agent: 'implementer',
|
|
557
|
-
prompt: criteriaPrompt(unanswered, unmet),
|
|
649
|
+
prompt: criteriaPrompt(unanswered, unmet, cases),
|
|
558
650
|
output: Criteria
|
|
559
651
|
})).criteria
|
|
560
652
|
: (implemented.criteria ?? [])
|
|
@@ -563,11 +655,21 @@ const build = defineLoop({
|
|
|
563
655
|
maxRounds: input.maxRounds ?? 3,
|
|
564
656
|
target,
|
|
565
657
|
outcome,
|
|
566
|
-
claims: [...implemented.claims, ...criteria.map(answer => `Criterion ${answerLine(answer)}`)],
|
|
658
|
+
claims: [...implemented.claims, ...criteria.map(answer => `Criterion ${answerLine(answer, cases)}`)],
|
|
567
659
|
suggested: implemented.checks ?? [],
|
|
568
660
|
reproducing: reproduced?.check,
|
|
569
661
|
reviewed: input.reviewed,
|
|
662
|
+
deliveredBy: input.changeRequestId,
|
|
570
663
|
earlier: input.earlier ?? [],
|
|
664
|
+
outOfScope: input.outOfScopeFindings ?? [],
|
|
665
|
+
unmetCriteria:
|
|
666
|
+
cases.length === 0 ? [] : criteria.flatMap(answer => (answer.status === 'not_met' ? [answer.criterion] : [])),
|
|
667
|
+
metCriteria:
|
|
668
|
+
cases.length === 0 ? [] : criteria.flatMap(answer => (answer.status === 'met' ? [answer.criterion] : [])),
|
|
669
|
+
afterMergeCriteria:
|
|
670
|
+
cases.length === 0
|
|
671
|
+
? []
|
|
672
|
+
: criteria.flatMap(answer => (answer.status === 'after_merge' ? [answer.criterion] : [])),
|
|
571
673
|
scope: input.scope
|
|
572
674
|
})
|
|
573
675
|
|
|
@@ -591,7 +693,10 @@ const build = defineLoop({
|
|
|
591
693
|
...unsettledItems(last.settled, last.decision),
|
|
592
694
|
...last.conflicts,
|
|
593
695
|
...criteria.flatMap(answer =>
|
|
594
|
-
answer.status === 'not_met'
|
|
696
|
+
answer.status === 'not_met' &&
|
|
697
|
+
(reviewedAs(answer.criterion, cases, last.scope)?.status ?? 'open') === 'open'
|
|
698
|
+
? [`Criterion not met: ${answer.criterion} (${answer.detail})`]
|
|
699
|
+
: []
|
|
595
700
|
)
|
|
596
701
|
])
|
|
597
702
|
]
|
|
@@ -601,10 +706,11 @@ const build = defineLoop({
|
|
|
601
706
|
head: last.head,
|
|
602
707
|
claims: last.claims,
|
|
603
708
|
unsettled,
|
|
604
|
-
criteria: criteria.map(
|
|
709
|
+
criteria: criteria.map(answer => criterionLine(answer, cases, last.scope)),
|
|
605
710
|
later: last.settled.open
|
|
606
711
|
.filter(finding => !isBlocking(finding))
|
|
607
712
|
.map(finding => `${finding.id}: ${finding.detail}`),
|
|
713
|
+
outOfScope: outOfScopeLines(last.outOfScope, last.scope),
|
|
608
714
|
rounds: last.round,
|
|
609
715
|
stopped: last.decision.reason
|
|
610
716
|
})
|
|
@@ -645,6 +751,7 @@ const build = defineLoop({
|
|
|
645
751
|
criteria,
|
|
646
752
|
...(lastNotRun.length === 0 ? undefined : { notRun: lastNotRun }),
|
|
647
753
|
...(last.earlier.length === 0 ? undefined : { findings: last.earlier }),
|
|
754
|
+
...(last.outOfScope.length === 0 ? undefined : { outOfScopeFindings: last.outOfScope }),
|
|
648
755
|
...(last.scope === undefined ? undefined : { scope: last.scope }),
|
|
649
756
|
blockingCounts: last.blockingCounts,
|
|
650
757
|
...(approval === undefined ? undefined : { approval })
|
|
@@ -727,6 +834,9 @@ const build = defineLoop({
|
|
|
727
834
|
// Its first review reviews the fix of what the last review read.
|
|
728
835
|
reviewed: settledAs.revision,
|
|
729
836
|
...(settledAs.findings === undefined ? undefined : { earlier: settledAs.findings }),
|
|
837
|
+
...(settledAs.outOfScopeFindings === undefined
|
|
838
|
+
? undefined
|
|
839
|
+
: { outOfScopeFindings: settledAs.outOfScopeFindings }),
|
|
730
840
|
...(settledAs.scope === undefined ? undefined : { scope: settledAs.scope }),
|
|
731
841
|
...ownDeliveryTarget(input)
|
|
732
842
|
},
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type VerifyResult
|
|
9
9
|
} from '@kitman-sh/sdk/loop'
|
|
10
10
|
import * as Effect from 'effect/Effect'
|
|
11
|
+
import { outOfScopeSection } from './out-of-scope'
|
|
11
12
|
|
|
12
13
|
/** Each part of the Task the reviewer found not done, as a blocker the implementer fixes or rebuts like any other. */
|
|
13
14
|
export const scopeFindings = (scope: ScopeJudgement | undefined): readonly MergedFinding[] =>
|
|
@@ -144,6 +145,8 @@ export const changeRequestBody = (build: {
|
|
|
144
145
|
readonly criteria?: readonly string[]
|
|
145
146
|
/** Minor findings left for later; they never cost a round. */
|
|
146
147
|
readonly later?: readonly string[]
|
|
148
|
+
/** The findings in cases the Task lists as Out of scope; they never hold the change. */
|
|
149
|
+
readonly outOfScope?: readonly string[]
|
|
147
150
|
readonly rounds: number
|
|
148
151
|
readonly stopped: string
|
|
149
152
|
}) =>
|
|
@@ -162,6 +165,7 @@ export const changeRequestBody = (build: {
|
|
|
162
165
|
...(build.later === undefined || build.later.length === 0
|
|
163
166
|
? []
|
|
164
167
|
: ['## Left for later', ...build.later.map(item => `- ${item}`)]),
|
|
168
|
+
...outOfScopeSection(build.outOfScope ?? []),
|
|
165
169
|
'## Review',
|
|
166
170
|
`${build.rounds} review round${build.rounds === 1 ? '' : 's'}; the rally stopped: ${build.stopped.replaceAll('_', ' ')}.`
|
|
167
171
|
].join('\n\n')
|
package/src/hillclimb.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
import * as Effect from 'effect/Effect'
|
|
22
22
|
import * as Schema from 'effect/Schema'
|
|
23
23
|
import { notVerifiedSection, scopeFindings } from './change-request-body'
|
|
24
|
+
import { outOfScopeLines, outOfScopeSection } from './out-of-scope'
|
|
24
25
|
import review from './review'
|
|
25
26
|
import { FindingDetail, OneSentence } from './text-limits'
|
|
26
27
|
|
|
@@ -185,7 +186,7 @@ const steadier = (plan: MeasurePlan): MeasurePlan | undefined => {
|
|
|
185
186
|
*/
|
|
186
187
|
export default defineLoop({
|
|
187
188
|
id: 'hillclimb',
|
|
188
|
-
version: '1.
|
|
189
|
+
version: '1.6.0',
|
|
189
190
|
title: 'Hillclimb',
|
|
190
191
|
outcome: 'performance',
|
|
191
192
|
input: Input,
|
|
@@ -391,6 +392,9 @@ export default defineLoop({
|
|
|
391
392
|
claims,
|
|
392
393
|
earlier: reviewed.findings,
|
|
393
394
|
reviewed: fixedFrom,
|
|
395
|
+
...(reviewed.outOfScopeFindings === undefined
|
|
396
|
+
? undefined
|
|
397
|
+
: { outOfScopeFindings: reviewed.outOfScopeFindings }),
|
|
394
398
|
...(reviewed.scope === undefined ? undefined : { scope: reviewed.scope })
|
|
395
399
|
})
|
|
396
400
|
}
|
|
@@ -420,7 +424,8 @@ export default defineLoop({
|
|
|
420
424
|
...(notVerified === undefined ? [] : [notVerified]),
|
|
421
425
|
...(unsettled.length + caveats.length === 0
|
|
422
426
|
? []
|
|
423
|
-
: [`## Unsettled\n\n${[...unsettled, ...caveats].map(entry => `- ${entry}`).join('\n')}`])
|
|
427
|
+
: [`## Unsettled\n\n${[...unsettled, ...caveats].map(entry => `- ${entry}`).join('\n')}`]),
|
|
428
|
+
...outOfScopeSection(outOfScopeLines(reviewed.outOfScopeFindings ?? [], reviewed.scope))
|
|
424
429
|
].join('\n\n')
|
|
425
430
|
})
|
|
426
431
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MergedFinding } from '@kitman-sh/sdk/loop'
|
|
2
|
+
import * as Schema from 'effect/Schema'
|
|
3
|
+
import type { ReviewedScope } from './reviewed-scope'
|
|
4
|
+
|
|
5
|
+
/** The number, from 1, of the case on the Task's Out of scope list it falls in. */
|
|
6
|
+
export const outOfScopeCase = { outOfScope: Schema.optional(Schema.Int) }
|
|
7
|
+
|
|
8
|
+
/** The Task's cases a waiver may name; a blank entry describes none. */
|
|
9
|
+
export const listedCases = (cases: readonly string[] | undefined) => (cases ?? []).filter(item => item.trim() !== '')
|
|
10
|
+
|
|
11
|
+
export const caseOf = (cases: readonly string[], marked: { readonly outOfScope?: number | undefined }) =>
|
|
12
|
+
marked.outOfScope === undefined ? undefined : cases[marked.outOfScope - 1]
|
|
13
|
+
|
|
14
|
+
export const numberedCases = (cases: readonly string[]) => cases.map((item, index) => `${index + 1}. ${item}`)
|
|
15
|
+
|
|
16
|
+
export const inCase = (text: string, item: string) => `${text} (Out of scope: ${item})`
|
|
17
|
+
|
|
18
|
+
/** A finding kept apart, with its case, so a later review judges it again once the Task no longer lists that case. */
|
|
19
|
+
export const OutOfScopeFinding = Schema.Struct({
|
|
20
|
+
...MergedFinding.fields,
|
|
21
|
+
severity: Schema.Literals(['major', 'minor']),
|
|
22
|
+
item: Schema.String,
|
|
23
|
+
/** The problem as the seat worded it, without the rule and checked cases a round adds, so a repeat is known. */
|
|
24
|
+
problem: Schema.optionalKey(Schema.String)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export type OutOfScopeFinding = typeof OutOfScopeFinding.Type
|
|
28
|
+
|
|
29
|
+
export const outOfScopeLines = (findings: readonly OutOfScopeFinding[], scope: ReviewedScope | undefined) => [
|
|
30
|
+
...findings.map(finding => `${finding.id} (${finding.severity}): ${inCase(finding.detail, finding.item)}`),
|
|
31
|
+
...(scope?.outOfScope ?? []).map(({ part, item }) => inCase(part, item))
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export const outOfScopeSection = (lines: readonly string[]) =>
|
|
35
|
+
lines.length === 0 ? [] : ['## Out of scope', lines.map(line => `- ${line}`).join('\n')]
|