@kitman-sh/software-engineering 0.14.8 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ import {
2
+ ApproveChangeRequestResult,
3
+ ChangeRequestResult,
4
+ LoopOutcome,
5
+ MergedFinding,
6
+ ResolvedDeliveryTarget
7
+ } from '@kitman-sh/sdk/loop'
8
+ import * as Schema from 'effect/Schema'
9
+ import * as Struct from 'effect/Struct'
10
+ import { DeliveryFields } from './delivery'
11
+ import { OutOfScopeFinding, outOfScopeCase } from './out-of-scope'
12
+ import { ReviewedScope } from './reviewed-scope'
13
+ import { ShepherdOutput } from './shepherd-output'
14
+ import { ShortStatement } from './text-limits'
15
+
16
+ export const BuildInput = Schema.Struct({
17
+ words: Schema.optional(Schema.String).annotate({ description: 'What to build, when no Task says it.' }),
18
+ taskId: Schema.optional(Schema.String).annotate({
19
+ description: 'The Task to build; its title, description and Acceptance Criteria say what to build.'
20
+ }),
21
+ repoBindingId: Schema.optional(Schema.String).annotate({
22
+ description: "The repository to build in; the Task's, else the Team's default, when left out."
23
+ }),
24
+ branch: Schema.optional(Schema.String).annotate({
25
+ description:
26
+ "The base branch; the repository's default branch when left out. Kitman reads an earlier Run's branch as where the Build starts and puts the branch it merges into here instead."
27
+ }),
28
+ revision: Schema.optional(Schema.String).annotate({
29
+ description: 'Where to start; the head of `branch` when left out.'
30
+ }),
31
+ outcome: Schema.optional(LoopOutcome).annotate({
32
+ description:
33
+ 'The Outcome the change must prove, such as feature or bug; read from the Task or the words when left out.'
34
+ }),
35
+ maxRounds: Schema.optional(Schema.Int).annotate({
36
+ description: 'Review rounds before the rally stops; 3 when left out.'
37
+ }),
38
+ land: Schema.optional(Schema.Boolean).annotate({
39
+ description:
40
+ 'Sees the ChangeRequest through to merge with Shepherd once it opens; false leaves it open for a person.'
41
+ }),
42
+ changeRequestId: Schema.optional(Schema.String).annotate({
43
+ description:
44
+ "An open ChangeRequest to fix forward on: the Run works its branch, never force-pushing, and reports in one comment on it, leaving the ChangeRequest's title and description to its author."
45
+ }),
46
+ maxRebuilds: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))).annotate({
47
+ description:
48
+ 'How many more Builds an unattended full-auto Run starts on its ChangeRequest while review findings still stand, before it fails with them; 1 when left out. None starts after Review rounds that were not converging.'
49
+ }),
50
+ reviewed: Schema.optional(Schema.String).annotate({
51
+ description:
52
+ 'The head an earlier review read, whose `earlier` findings this Build fixes: its first review reviews the fix.'
53
+ }),
54
+ earlier: Schema.optional(Schema.Array(MergedFinding)).annotate({
55
+ description: "An earlier review's open findings, which this Build fixes and its first review checks."
56
+ }),
57
+ outOfScopeFindings: Schema.optional(Schema.Array(OutOfScopeFinding)).annotate({
58
+ description: "Earlier reviews' findings kept apart as out of scope, which this Build's reviews keep apart too."
59
+ }),
60
+ taskOutOfScope: Schema.optional(Schema.Array(Schema.String)).annotate({
61
+ description:
62
+ "The Task's Out of scope list, which the implementer does not build; Kitman sets it when the Run starts."
63
+ }),
64
+ scope: Schema.optional(ReviewedScope).annotate({
65
+ description: "That earlier review's scope judgement, whose unmet items this Build's first review judges again."
66
+ }),
67
+ planReviewed: Schema.optional(Schema.Boolean).annotate({
68
+ description:
69
+ 'Plan review passed the Task, and this is its first implementation, which the `planned-implementer` makes; Kitman sets it when the Run starts.'
70
+ }),
71
+ ...DeliveryFields
72
+ })
73
+
74
+ /** The implementer's answer to one acceptance criterion of the Task. */
75
+ export const CriterionAnswer = Schema.Struct({
76
+ criterion: Schema.String,
77
+ status: Schema.Literals(['met', 'after_merge', 'not_met']),
78
+ /** The test or file that shows it met, or why it is after merge or not met. */
79
+ detail: ShortStatement,
80
+ ...outOfScopeCase
81
+ })
82
+
83
+ export type CriterionAnswer = typeof CriterionAnswer.Type
84
+
85
+ export const BuildOutput = Schema.Struct({
86
+ changeRequest: ChangeRequestResult.annotate({ description: 'The ChangeRequest the Build opened or fixed forward.' }),
87
+ revision: Schema.String.annotate({ description: 'The head commit the Build pushed.' }),
88
+ tree: Schema.String.annotate({
89
+ description: 'The tree of that head, which verifications and reviews key their evidence on.'
90
+ }),
91
+ settled: Schema.Boolean.annotate({ description: 'Whether the review rally ended with nothing left standing.' }),
92
+ unsettled: Schema.Array(Schema.String).annotate({
93
+ description: 'What still stands when the rally ended, one line each.'
94
+ }),
95
+ rounds: Schema.Int.annotate({ description: 'Review rounds the rally ran.' }),
96
+ stopped: Schema.Literals(['settled', 'dispute_stands', 'findings_returned', 'round_cap']).annotate({
97
+ description: 'Why the rally stopped: settled, a dispute stands, findings were returned, or the round cap.'
98
+ }),
99
+ criteria: Schema.Array(CriterionAnswer).annotate({
100
+ description: 'Each Acceptance Criterion with whether the change meets it, after merge, or not, and what shows it.'
101
+ }),
102
+ notRun: Schema.optional(Schema.Array(Schema.String)).annotate({
103
+ description: 'Why each head test verify never ran is unverified; absent when it ran them all.'
104
+ }),
105
+ findings: Schema.optional(Schema.Array(MergedFinding)).annotate({
106
+ description: "The last review's code findings still open or disputed, which a Build fixing them takes as `earlier`."
107
+ }),
108
+ outOfScopeFindings: Schema.optional(Schema.Array(OutOfScopeFinding)).annotate({
109
+ description: "The reviews' findings kept apart as out of scope, which a Build fixing what it left takes as its own."
110
+ }),
111
+ scope: Schema.optional(ReviewedScope).annotate({
112
+ description: "The last review's scope judgement, which a Build fixing what it left takes as `scope`."
113
+ }),
114
+ blockingCounts: Schema.optional(Schema.Array(Schema.Int)).annotate({
115
+ description: "Each Review round's blocking count, first to last, which decides whether a Rebuild may follow."
116
+ }),
117
+ approval: Schema.optional(ApproveChangeRequestResult).annotate({
118
+ description: "Whether the last Review's approval was recorded, or why not, when nothing was left unsettled."
119
+ }),
120
+ landed: Schema.optional(ShepherdOutput).annotate({
121
+ description: 'What Shepherd did with the ChangeRequest, when the Build was told to land it.'
122
+ }),
123
+ next: Schema.Struct({ changeRequestId: Schema.String }).annotate({
124
+ description: 'The input its Shepherd and Review offers start from.'
125
+ }),
126
+ deliversTo: Schema.optional(ResolvedDeliveryTarget).annotate({
127
+ description: "Where the Run's delivery landed and the layer it came from."
128
+ })
129
+ })
130
+
131
+ /** What a Build made, less its ChangeRequest and landing: a rebuild on that ChangeRequest replaces it. */
132
+ export const Built = Schema.Struct(Struct.omit(BuildOutput.fields, ['changeRequest', 'landed', 'next']))
133
+
134
+ export const taskOf = (words: string | undefined) =>
135
+ words === undefined ? 'the Task your brief describes.' : `this: ${words}`