@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.
package/src/index.ts CHANGED
@@ -1,22 +1,233 @@
1
+ import { Approved, ApprovalRefused, approved, ChangesWanted, LeftToPerson } from './approved'
2
+ import backport from './backport'
1
3
  import build from './build'
2
- import errand from './errand'
4
+ import deploy, {
5
+ claimed,
6
+ Cleared,
7
+ guard,
8
+ Held,
9
+ promotedTo,
10
+ Ran,
11
+ ran,
12
+ recorded,
13
+ Recovered,
14
+ recovered,
15
+ Reported
16
+ } from './deploy'
17
+ import errand, { Blocked, Done, done, TooBig } from './errand'
3
18
  import fileTasks from './file-tasks'
4
- import hillclimb from './hillclimb'
5
- import firewatch from './firewatch'
6
- import plan from './plan'
7
- import projectUpdate from './project-update'
8
- import release from './release'
9
- import research from './research'
10
- import hindsight from './hindsight'
19
+ import hillclimb, {
20
+ Calibrated,
21
+ ChecksFailed,
22
+ climbed,
23
+ Discovered,
24
+ discovered,
25
+ Exhausted,
26
+ external,
27
+ Filed as ExternalFiled,
28
+ GainGone,
29
+ harnessed,
30
+ Improved,
31
+ Kept,
32
+ measured,
33
+ NoGain,
34
+ Reverted,
35
+ RevertUnconfirmed,
36
+ TooNoisy,
37
+ Unfiled,
38
+ Unsafe
39
+ } from './hillclimb'
40
+ import firewatch, {
41
+ AlertResolved,
42
+ Concluded,
43
+ concluded,
44
+ FixDeclined,
45
+ FixFailed,
46
+ fixOffered,
47
+ FixStarted,
48
+ Folded,
49
+ folded,
50
+ investigated,
51
+ Placed
52
+ } from './firewatch'
53
+ import { Implemented, implemented } from './implemented'
54
+ import { landed } from './landed'
55
+ import { Opened, opened } from './opened'
56
+ import plan, {
57
+ buildTried,
58
+ Built,
59
+ chosen,
60
+ delivered,
61
+ Delivered,
62
+ drafted,
63
+ Drafted,
64
+ Failed,
65
+ failureAnswered,
66
+ FileAsTasks,
67
+ filed,
68
+ Filed,
69
+ Finish,
70
+ ImplementNow,
71
+ MergeAgain,
72
+ Merged,
73
+ mergeTried,
74
+ PlanApproved,
75
+ planReviewed,
76
+ Rebuild,
77
+ Refine,
78
+ refined,
79
+ retried,
80
+ SkipIt,
81
+ Skipped,
82
+ Steer,
83
+ StopHere,
84
+ Stopped,
85
+ ticketBuilt
86
+ } from './plan'
87
+ import projectUpdate, { posted, written } from './project-update'
88
+ import {
89
+ BaseUnpinned,
90
+ DisputeStands,
91
+ FindingsReturned,
92
+ Fixed,
93
+ fixed,
94
+ Halted,
95
+ rallied,
96
+ Reviewed,
97
+ reviewed,
98
+ RoundCap,
99
+ SameEvidence,
100
+ Settled
101
+ } from './rallied'
102
+ import { BaseVerified, NotNeeded, Reproduced, reproduced } from './reproduced'
103
+ import release, {
104
+ approve,
105
+ Approved as ReleaseApproved,
106
+ Cut,
107
+ cut,
108
+ Deployed,
109
+ DeployFailed,
110
+ deployStep,
111
+ Drafted as ReleaseDrafted,
112
+ Edit,
113
+ gate,
114
+ Gated,
115
+ GateFailed,
116
+ Landed as ReleaseLanded,
117
+ landStep,
118
+ NothingToLand,
119
+ NothingToRelease,
120
+ NotDeployed,
121
+ NotLanded,
122
+ notes,
123
+ publish,
124
+ Published,
125
+ Rejected,
126
+ TagTaken,
127
+ VersionTaken
128
+ } from './release'
129
+ import releaseSet, { setApproved, setDrafted, setReleased } from './release-set'
130
+ import research, { researched, researchReviewed } from './research'
131
+ import hindsight, { found, improved, proposed } from './hindsight'
132
+ import land from './land'
11
133
  import landEpic from './land-epic'
12
- import review from './review'
13
- import shepherd from './shepherd'
14
- import sweep from './sweep'
15
- import tidy from './tidy'
134
+ import revert from './revert'
135
+ import review, {
136
+ Built as ReviewBuilt,
137
+ Checked,
138
+ checked,
139
+ Done as ReviewDone,
140
+ Fixed as ReviewFixed,
141
+ followedUp,
142
+ judged,
143
+ Posted,
144
+ Ranged,
145
+ ranged,
146
+ ReviewBaseUnpinned,
147
+ ReviewDiffEmpty,
148
+ Reviewed as ReviewReviewed,
149
+ ReviewSeat,
150
+ ReviewSeats,
151
+ reviewSeats,
152
+ ReviewTargetMissing,
153
+ seated,
154
+ SeatOutput
155
+ } from './review'
156
+ import shepherd, {
157
+ Again,
158
+ answered,
159
+ backported,
160
+ backportStarted,
161
+ blockerRechecked,
162
+ caughtUp,
163
+ Charge as ShepherdCharge,
164
+ CiFixDue,
165
+ ciFixed,
166
+ epicLanded,
167
+ filesReviewed,
168
+ handedBack,
169
+ HandedBack,
170
+ headFixed,
171
+ headReviewed,
172
+ heldReady,
173
+ landingTried,
174
+ Landed,
175
+ Left,
176
+ looked,
177
+ MergedElsewhere,
178
+ mergedOnTurn,
179
+ NeedsYou,
180
+ Onward,
181
+ Passed,
182
+ pushSeen,
183
+ pushShown,
184
+ Ready,
185
+ released,
186
+ replied,
187
+ reran,
188
+ reviewReused,
189
+ roundAllowed,
190
+ RoundsSpent,
191
+ RoundTaken,
192
+ Shepherding,
193
+ targetChecked,
194
+ targetLooked,
195
+ TargetMoved,
196
+ TargetPassed,
197
+ targetReread,
198
+ targetVerified,
199
+ targetWatched,
200
+ Waited,
201
+ waitedOut,
202
+ Wanted,
203
+ Watching
204
+ } from './shepherd'
205
+ import { BuildBlocked, Rebuilt, standing, TakenOver } from './standing'
206
+ import sweep, {
207
+ Assessed,
208
+ assessed,
209
+ batched,
210
+ Closed,
211
+ closed,
212
+ LeftOpen,
213
+ Listed,
214
+ listed,
215
+ Mended,
216
+ mended,
217
+ Moved,
218
+ NothingLeft,
219
+ NothingToSweep,
220
+ Superseded,
221
+ superseded,
222
+ Verified
223
+ } from './sweep'
224
+ import tidy, { NothingWorthIt, Surveyed, surveyed, Tidied, tidied } from './tidy'
16
225
 
17
226
  /** The Kit's Loops, by id; a fork spreads the one it replaces. */
18
227
  export const loops = {
228
+ backport,
19
229
  build,
230
+ deploy,
20
231
  errand,
21
232
  'file-tasks': fileTasks,
22
233
  hillclimb,
@@ -24,17 +235,302 @@ export const loops = {
24
235
  plan,
25
236
  'project-update': projectUpdate,
26
237
  release,
238
+ 'release-set': releaseSet,
27
239
  research,
28
240
  hindsight,
241
+ land,
29
242
  'land-epic': landEpic,
30
243
  review,
244
+ revert,
31
245
  shepherd,
32
246
  sweep,
33
247
  tidy
34
248
  } as const
35
249
 
250
+ /** The Steps the Kit defines, by name, for a Loop of your own to call or a fork to replace with a Layer. */
251
+ export const steps = {
252
+ approved,
253
+ buildTried,
254
+ chosen,
255
+ delivered,
256
+ done,
257
+ drafted,
258
+ failureAnswered,
259
+ filed,
260
+ implemented,
261
+ landed,
262
+ mergeTried,
263
+ opened,
264
+ planReviewed,
265
+ rallied,
266
+ reviewed,
267
+ fixed,
268
+ refined,
269
+ reproduced,
270
+ retried,
271
+ standing,
272
+ ticketBuilt,
273
+ listed,
274
+ assessed,
275
+ batched,
276
+ mended,
277
+ superseded,
278
+ closed,
279
+ discovered,
280
+ harnessed,
281
+ climbed,
282
+ external,
283
+ measured,
284
+ surveyed,
285
+ tidied,
286
+ ranged,
287
+ checked,
288
+ seated,
289
+ judged,
290
+ followedUp,
291
+ looked,
292
+ pushShown,
293
+ pushSeen,
294
+ reviewReused,
295
+ blockerRechecked,
296
+ caughtUp,
297
+ targetChecked,
298
+ targetReread,
299
+ waitedOut,
300
+ roundAllowed,
301
+ ciFixed,
302
+ reran,
303
+ replied,
304
+ answered,
305
+ filesReviewed,
306
+ headReviewed,
307
+ headFixed,
308
+ handedBack,
309
+ targetVerified,
310
+ targetLooked,
311
+ targetWatched,
312
+ heldReady,
313
+ mergedOnTurn,
314
+ landingTried,
315
+ epicLanded,
316
+ released,
317
+ backported,
318
+ backportStarted,
319
+ guard,
320
+ claim: claimed,
321
+ run: ran,
322
+ record: recorded,
323
+ recover: recovered,
324
+ gate,
325
+ cut,
326
+ notes,
327
+ approve,
328
+ land: landStep,
329
+ publish,
330
+ deploy: deployStep,
331
+ setDrafted,
332
+ setApproved,
333
+ setReleased,
334
+ promote: promotedTo,
335
+ folded,
336
+ investigated,
337
+ concluded,
338
+ fixOffered,
339
+ researched,
340
+ researchReviewed,
341
+ found,
342
+ proposed,
343
+ improved,
344
+ written,
345
+ posted
346
+ } as const
347
+
348
+ export { Approved, ApprovalRefused, approved, ChangesWanted, LeftToPerson }
349
+
350
+ export { Blocked, Done, done, TooBig }
351
+
352
+ export { BaseVerified, NotNeeded, Reproduced, reproduced }
353
+
354
+ export { Implemented, implemented }
355
+
356
+ export { Opened, opened }
357
+
358
+ export { BuildBlocked, Rebuilt, standing, TakenOver }
359
+
360
+ export { landed }
361
+
362
+ /** What Release's Steps end in, for a Layer that replaces one. */
363
+ export {
364
+ ReleaseApproved,
365
+ Cut,
366
+ Deployed,
367
+ DeployFailed,
368
+ ReleaseDrafted,
369
+ Edit,
370
+ Gated,
371
+ GateFailed,
372
+ ReleaseLanded,
373
+ NothingToLand,
374
+ NothingToRelease,
375
+ NotDeployed,
376
+ NotLanded,
377
+ Published,
378
+ Rejected,
379
+ TagTaken,
380
+ VersionTaken
381
+ }
382
+
383
+ /** What the Deploy Loop's Steps end in, for a Layer that replaces one. */
384
+ export { Cleared, Held, Ran, Recovered, Reported }
385
+
386
+ /** What Sweep's and Hillclimb's Steps end in, for a Layer that replaces one. */
387
+ export {
388
+ Assessed,
389
+ Closed,
390
+ LeftOpen,
391
+ Listed,
392
+ Mended,
393
+ Moved,
394
+ NothingLeft,
395
+ NothingToSweep,
396
+ Superseded,
397
+ Verified,
398
+ Calibrated,
399
+ ChecksFailed,
400
+ Discovered,
401
+ Exhausted,
402
+ ExternalFiled,
403
+ GainGone,
404
+ Improved,
405
+ Kept,
406
+ NoGain,
407
+ Reverted,
408
+ RevertUnconfirmed,
409
+ TooNoisy,
410
+ Unfiled,
411
+ Unsafe
412
+ }
413
+
414
+ export {
415
+ BaseUnpinned,
416
+ DisputeStands,
417
+ FindingsReturned,
418
+ Fixed,
419
+ fixed,
420
+ Halted,
421
+ rallied,
422
+ Reviewed,
423
+ reviewed,
424
+ RoundCap,
425
+ SameEvidence,
426
+ Settled
427
+ }
428
+
429
+ export { NothingWorthIt, Surveyed, surveyed, Tidied, tidied }
430
+
431
+ /** What Firewatch's Steps end in, for a Layer that replaces one. */
432
+ export {
433
+ AlertResolved,
434
+ Concluded,
435
+ concluded,
436
+ FixDeclined,
437
+ FixFailed,
438
+ fixOffered,
439
+ FixStarted,
440
+ Folded,
441
+ folded,
442
+ investigated,
443
+ Placed
444
+ }
445
+
446
+ export { researched, researchReviewed }
447
+
448
+ export { found, improved, proposed }
449
+
450
+ export { posted, written }
451
+
452
+ export {
453
+ buildTried,
454
+ Built,
455
+ chosen,
456
+ delivered,
457
+ Delivered,
458
+ drafted,
459
+ Drafted,
460
+ Failed,
461
+ failureAnswered,
462
+ FileAsTasks,
463
+ filed,
464
+ Filed,
465
+ Finish,
466
+ ImplementNow,
467
+ MergeAgain,
468
+ Merged,
469
+ mergeTried,
470
+ PlanApproved,
471
+ planReviewed,
472
+ Rebuild,
473
+ Refine,
474
+ refined,
475
+ retried,
476
+ SkipIt,
477
+ Skipped,
478
+ Steer,
479
+ StopHere,
480
+ Stopped,
481
+ ticketBuilt
482
+ }
483
+
484
+ /** What Shepherd's Steps end in, and what they carry, for a Layer that replaces one. */
485
+ export {
486
+ Again,
487
+ CiFixDue,
488
+ HandedBack,
489
+ Landed,
490
+ Left,
491
+ MergedElsewhere,
492
+ NeedsYou,
493
+ Onward,
494
+ Passed,
495
+ Ready,
496
+ RoundsSpent,
497
+ RoundTaken,
498
+ ShepherdCharge,
499
+ Shepherding,
500
+ TargetMoved,
501
+ TargetPassed,
502
+ Waited,
503
+ Wanted,
504
+ Watching
505
+ }
506
+
507
+ /** What Review's Steps end in; those named as another Step's result take `Review` before their names. */
508
+ export {
509
+ ReviewBuilt,
510
+ Checked,
511
+ checked,
512
+ ReviewDone,
513
+ ReviewFixed,
514
+ followedUp,
515
+ judged,
516
+ Posted,
517
+ Ranged,
518
+ ranged,
519
+ ReviewBaseUnpinned,
520
+ ReviewDiffEmpty,
521
+ ReviewReviewed,
522
+ ReviewSeat,
523
+ ReviewSeats,
524
+ reviewSeats,
525
+ ReviewTargetMissing,
526
+ seated,
527
+ SeatOutput
528
+ }
529
+
36
530
  export {
531
+ backport,
37
532
  build,
533
+ deploy,
38
534
  errand,
39
535
  fileTasks,
40
536
  hillclimb,
@@ -42,10 +538,13 @@ export {
42
538
  plan,
43
539
  projectUpdate,
44
540
  release,
541
+ releaseSet,
45
542
  research,
46
543
  hindsight,
544
+ land,
47
545
  landEpic,
48
546
  review,
547
+ revert,
49
548
  shepherd,
50
549
  sweep,
51
550
  tidy
package/src/land-epic.ts CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  type CalledLoop,
4
4
  changeRequest,
5
5
  ChangeRequestResult,
6
- Continuing,
6
+ runContext,
7
7
  defineLoop,
8
8
  ResolvedDeliveryTarget,
9
9
  syncBase,
@@ -16,14 +16,14 @@ import shepherd from './shepherd'
16
16
  import { ShepherdOutput } from './shepherd-output'
17
17
 
18
18
  export const LandEpicInput = Schema.Struct({
19
- /** The epic: a Task with sub-tasks. */
20
- taskId: Schema.String,
21
- /** Marks the Loop that works on the epic's own branch: Kitman puts the Run there, never force-pushing it. */
22
- landsEpic: Schema.optional(Schema.Boolean),
23
- /** Merges the epic's ChangeRequest once it is approved, green and mergeable, without asking. */
24
- merge: Schema.optional(Schema.Boolean),
25
- /** The epic's open ChangeRequest an earlier Run opened, as Kitman puts the Run on it. */
26
- continuing: Schema.optional(Continuing),
19
+ taskId: Schema.String.annotate({ description: 'The epic: a Task with sub-tasks.' }),
20
+ landsEpic: Schema.optional(Schema.Boolean).annotate({
21
+ description:
22
+ "Marks the Loop that works on the epic's own branch: Kitman puts the Run there, never force-pushing it."
23
+ }),
24
+ merge: Schema.optional(Schema.Boolean).annotate({
25
+ description: "Merges the epic's ChangeRequest once it is approved, green and mergeable, without asking."
26
+ }),
27
27
  ...DeliveryFields
28
28
  })
29
29
 
@@ -39,11 +39,18 @@ export const LandEpicOutput = Schema.Struct({
39
39
  'conflict',
40
40
  /** Every sub-task is done: the epic's ChangeRequest is open, and Shepherd saw it as far as `landed` says. */
41
41
  'opened'
42
- ]),
43
- reason: Schema.String,
44
- changeRequest: Schema.optional(ChangeRequestResult),
45
- landed: Schema.optional(ShepherdOutput),
46
- deliversTo: Schema.optional(ResolvedDeliveryTarget)
42
+ ]).annotate({
43
+ description:
44
+ "not_epic, synced with the default branch, landed already, conflict, or opened the epic's ChangeRequest."
45
+ }),
46
+ reason: Schema.String.annotate({ description: 'Why it ended as it did, in a line.' }),
47
+ changeRequest: Schema.optional(ChangeRequestResult).annotate({
48
+ description: "The epic's ChangeRequest into the default branch, once it is open."
49
+ }),
50
+ landed: Schema.optional(ShepherdOutput).annotate({ description: "What Shepherd did with the epic's ChangeRequest." }),
51
+ deliversTo: Schema.optional(ResolvedDeliveryTarget).annotate({
52
+ description: "Where the Run's delivery landed and the layer it came from."
53
+ })
47
54
  })
48
55
 
49
56
  type Output = typeof LandEpicOutput.Type
@@ -56,8 +63,9 @@ type Output = typeof LandEpicOutput.Type
56
63
  */
57
64
  const landEpic = defineLoop({
58
65
  id: 'land-epic',
59
- version: '1.0.0',
66
+ version: '1.2.0',
60
67
  title: 'Land epic',
68
+ description: "Keeps an epic's branch up to date and, once every sub-task is done, merges it to the default branch.",
61
69
  input: LandEpicInput,
62
70
  output: LandEpicOutput,
63
71
  agents: { implementer: 'implementer' },
@@ -96,7 +104,10 @@ const landEpic = defineLoop({
96
104
  ...recorded
97
105
  } satisfies Output
98
106
 
99
- if (!epic.subTasksDone && input.continuing === undefined)
107
+ // The epic's open ChangeRequest an earlier Run opened, as Kitman puts the Run on it.
108
+ const { continuing } = yield* runContext
109
+
110
+ if (!epic.subTasksDone && continuing === undefined)
100
111
  return {
101
112
  status: 'synced',
102
113
  reason: `${epic.branch} is up to date with ${epic.defaultBranch}; ${epic.key} lands once every sub-task is done`,
@@ -104,7 +115,7 @@ const landEpic = defineLoop({
104
115
  } satisfies Output
105
116
 
106
117
  const opened =
107
- input.continuing === undefined
118
+ continuing === undefined
108
119
  ? yield* changeRequest('epic-change-request', {
109
120
  title: `${epic.key} Land the epic`,
110
121
  body: [
@@ -112,9 +123,9 @@ const landEpic = defineLoop({
112
123
  `${epic.branch} took in ${epic.defaultBranch} before this opened.`
113
124
  ].join('\n\n')
114
125
  })
115
- : { id: input.continuing.changeRequestId, number: input.continuing.number, url: input.continuing.url }
126
+ : { id: continuing.changeRequestId, number: continuing.number, url: continuing.url }
116
127
 
117
- if (input.continuing === undefined)
128
+ if (continuing === undefined)
118
129
  yield* writeBack('write-back', { milestone: 'change_request_opened', changeRequestUrl: opened.url })
119
130
 
120
131
  const landed = yield* call('shepherd', shepherd, {