@kitman-sh/software-engineering 0.11.0-rc.5 → 0.11.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/dist/bundle.js +595 -158
- package/dist/declarations.json +1294 -84
- package/kitman.config.ts +2 -5
- package/package.json +3 -3
- package/src/build.ts +21 -7
- package/src/delivery.ts +29 -0
- package/src/index.ts +3 -0
- package/src/land-epic.ts +137 -0
- package/src/release.ts +239 -95
- package/src/review.ts +27 -16
- package/src/shepherd-output.ts +5 -1
- package/src/shepherd.ts +240 -15
- package/src/sweep.ts +15 -2
- package/agents/deployer.md +0 -11
package/dist/bundle.js
CHANGED
|
@@ -12323,6 +12323,27 @@ var shippedScope = (scope) => ({
|
|
|
12323
12323
|
taskIds: scope.tasks.map((task) => task.id)
|
|
12324
12324
|
});
|
|
12325
12325
|
|
|
12326
|
+
// ../../packages/core/src/delivery-target.ts
|
|
12327
|
+
var DeliveryTarget = Literals(["default_branch", "epic_branch"]);
|
|
12328
|
+
var DeliveryTargetLayer = Literals(["run", "project", "team", "workspace"]);
|
|
12329
|
+
var ResolvedDeliveryTarget = Struct({ target: DeliveryTarget, layer: DeliveryTargetLayer });
|
|
12330
|
+
var DeliveryTargetSetting = Struct({
|
|
12331
|
+
target: NullOr(DeliveryTarget),
|
|
12332
|
+
resolved: optionalKey2(ResolvedDeliveryTarget)
|
|
12333
|
+
});
|
|
12334
|
+
var DeliveryTargetUpdate = Struct({
|
|
12335
|
+
target: NullOr(DeliveryTarget)
|
|
12336
|
+
});
|
|
12337
|
+
var EpicDelivery = Struct({
|
|
12338
|
+
taskId: String5,
|
|
12339
|
+
key: String5,
|
|
12340
|
+
branch: String5,
|
|
12341
|
+
defaultBranch: String5,
|
|
12342
|
+
subTasksDone: Boolean3,
|
|
12343
|
+
done: Boolean3,
|
|
12344
|
+
own: optional2(Boolean3)
|
|
12345
|
+
});
|
|
12346
|
+
|
|
12326
12347
|
// ../../packages/core/src/context-pack.ts
|
|
12327
12348
|
var ContextPackIndexEntryKinds = [
|
|
12328
12349
|
"task",
|
|
@@ -13946,6 +13967,7 @@ var ApprovedVerification = Struct({
|
|
|
13946
13967
|
command: String5,
|
|
13947
13968
|
workingDirectory: optionalKey2(String5),
|
|
13948
13969
|
pipeline: optionalKey2(Boolean3),
|
|
13970
|
+
readsTarget: optionalKey2(Boolean3),
|
|
13949
13971
|
approvedByUserId: String5,
|
|
13950
13972
|
createdAt: Timestamp
|
|
13951
13973
|
});
|
|
@@ -14160,10 +14182,17 @@ var QuestionResponderPolicy = Struct({
|
|
|
14160
14182
|
eligibleMemberIds: ArraySchema(Id).check(isMaxLength(100), isUnique()),
|
|
14161
14183
|
allowWorkspaceAdmins: Boolean3
|
|
14162
14184
|
}).check(makeFilter2((policy) => policy.eligibleMemberIds.length > 0 || policy.allowWorkspaceAdmins || "someone who may answer"));
|
|
14185
|
+
var EvidenceRef2 = String5.check(isMinLength(1), isMaxLength(240));
|
|
14186
|
+
var QuestionEvidence = Struct({
|
|
14187
|
+
review: optionalKey2(EvidenceRef2),
|
|
14188
|
+
head: optionalKey2(EvidenceRef2)
|
|
14189
|
+
});
|
|
14163
14190
|
var QuestionAnswer = Struct({
|
|
14164
14191
|
value: LoopSafeText,
|
|
14165
14192
|
answeredByUserId: optionalKey2(Id),
|
|
14166
14193
|
byDefault: optionalKey2(Boolean3),
|
|
14194
|
+
byAuto: optionalKey2(Boolean3),
|
|
14195
|
+
evidence: optionalKey2(QuestionEvidence),
|
|
14167
14196
|
answeredAt: Timestamp,
|
|
14168
14197
|
idempotencyKey: String5.check(isMinLength(1), isMaxLength(240))
|
|
14169
14198
|
});
|
|
@@ -14335,7 +14364,9 @@ var RunHeader = Struct({
|
|
|
14335
14364
|
Struct({ kind: Literal2("event"), event: String5 })
|
|
14336
14365
|
])),
|
|
14337
14366
|
releaseWhen: optionalKey2(ResolvedReleaseTrigger),
|
|
14338
|
-
releaseScope: optionalKey2(ReleaseScope)
|
|
14367
|
+
releaseScope: optionalKey2(ReleaseScope),
|
|
14368
|
+
deliversTo: optionalKey2(ResolvedDeliveryTarget),
|
|
14369
|
+
epic: optionalKey2(EpicDelivery)
|
|
14339
14370
|
});
|
|
14340
14371
|
var RunShow = Struct({
|
|
14341
14372
|
run: Run,
|
|
@@ -14578,6 +14609,14 @@ var LoopCapabilities = [
|
|
|
14578
14609
|
var JsonObject2 = Record(String5, Json2);
|
|
14579
14610
|
var SecretName2 = String5.check(isPattern2(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/));
|
|
14580
14611
|
var EventFilterValue = Union2([String5, Finite, Boolean3, Null2]);
|
|
14612
|
+
var WhenClause = Struct({
|
|
14613
|
+
event: String5,
|
|
14614
|
+
filter: optionalKey2(Record(String5, Union2([EventFilterValue, ArraySchema(EventFilterValue)]))),
|
|
14615
|
+
input: Record(String5, String5),
|
|
14616
|
+
values: optionalKey2(JsonObject2),
|
|
14617
|
+
optIn: optionalKey2(Boolean3),
|
|
14618
|
+
description: optionalKey2(String5)
|
|
14619
|
+
});
|
|
14581
14620
|
var LoopManifest = Struct({
|
|
14582
14621
|
id: String5,
|
|
14583
14622
|
title: String5,
|
|
@@ -14587,12 +14626,7 @@ var LoopManifest = Struct({
|
|
|
14587
14626
|
outcome: optionalKey2(Literals(["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"])),
|
|
14588
14627
|
agents: Record(String5, String5),
|
|
14589
14628
|
checkout: Literals(["none", "read", "write"]),
|
|
14590
|
-
when: ArraySchema(
|
|
14591
|
-
event: String5,
|
|
14592
|
-
filter: optionalKey2(Record(String5, Union2([EventFilterValue, ArraySchema(EventFilterValue)]))),
|
|
14593
|
-
input: Record(String5, String5),
|
|
14594
|
-
values: optionalKey2(JsonObject2)
|
|
14595
|
-
})),
|
|
14629
|
+
when: ArraySchema(WhenClause),
|
|
14596
14630
|
offers: ArraySchema(Struct({
|
|
14597
14631
|
id: String5,
|
|
14598
14632
|
title: String5,
|
|
@@ -14610,7 +14644,7 @@ var LoopDetail = Struct({
|
|
|
14610
14644
|
resolved: optionalKey2(Struct({
|
|
14611
14645
|
...ProgramLoop.fields,
|
|
14612
14646
|
agents: LoopManifest.fields.agents,
|
|
14613
|
-
when:
|
|
14647
|
+
when: ArraySchema(Struct({ ...WhenClause.fields, on: optionalKey2(Boolean3) })),
|
|
14614
14648
|
schedule: optionalKey2(Struct({
|
|
14615
14649
|
rule: ScheduleRule,
|
|
14616
14650
|
timezone: String5,
|
|
@@ -19010,7 +19044,8 @@ var outcomeGate = (input) => {
|
|
|
19010
19044
|
// ../../packages/sdk/src/loop/steps.ts
|
|
19011
19045
|
class StepFailed extends TaggedError3()("StepFailed", {
|
|
19012
19046
|
step: String5,
|
|
19013
|
-
reason: String5
|
|
19047
|
+
reason: String5,
|
|
19048
|
+
code: optional2(String5)
|
|
19014
19049
|
}) {
|
|
19015
19050
|
get message() {
|
|
19016
19051
|
return `Step "${this.step}" failed: ${this.reason}`;
|
|
@@ -19177,6 +19212,7 @@ var ask = (name, question) => takeStep(name, "ask", "ask", gen2(function* () {
|
|
|
19177
19212
|
...fallback === undefined ? undefined : { default: fallback },
|
|
19178
19213
|
...question.auto === undefined ? undefined : { auto: question.auto },
|
|
19179
19214
|
...question.unattendedAuto === undefined ? undefined : { unattendedAuto: question.unattendedAuto },
|
|
19215
|
+
...question.evidence === undefined ? undefined : { evidence: question.evidence },
|
|
19180
19216
|
...question.timeout === undefined ? undefined : { timeoutMillis: toMillis(fromInputUnsafe2(question.timeout)) },
|
|
19181
19217
|
token: token2
|
|
19182
19218
|
}));
|
|
@@ -19340,7 +19376,10 @@ var AlertTaskResult = Struct({
|
|
|
19340
19376
|
resolved: optionalKey2(Boolean3),
|
|
19341
19377
|
joined: optionalKey2(Struct({ kind: Literals(["run", "recent"]), runId: String5 }))
|
|
19342
19378
|
});
|
|
19343
|
-
var IntegrationBranchRequest = Struct({
|
|
19379
|
+
var IntegrationBranchRequest = Struct({
|
|
19380
|
+
repoBindingId: optional2(String5),
|
|
19381
|
+
base: optional2(Boolean3)
|
|
19382
|
+
});
|
|
19344
19383
|
var IntegrationBranch = Struct({
|
|
19345
19384
|
repoBindingId: String5,
|
|
19346
19385
|
branch: String5,
|
|
@@ -19421,6 +19460,7 @@ var PipelineStatus = Struct({
|
|
|
19421
19460
|
jobs: ArraySchema(PipelineJob),
|
|
19422
19461
|
readAt: optionalKey2(String5),
|
|
19423
19462
|
runnerChecks: optionalKey2(ArraySchema(String5)),
|
|
19463
|
+
targetChecks: optionalKey2(ArraySchema(String5)),
|
|
19424
19464
|
approved: optionalKey2(String5),
|
|
19425
19465
|
repository: optionalKey2(String5),
|
|
19426
19466
|
sourceBranch: optionalKey2(String5),
|
|
@@ -19610,6 +19650,9 @@ var alertTask = (name, request) => hostActivity(name, "create_tasks", "create_ta
|
|
|
19610
19650
|
var integrationBranch = (name, request) => hostActivity(name, "integration_branch", "merge_change_request", IntegrationBranch, gen2(function* () {
|
|
19611
19651
|
return yield* (yield* IntegrationBranchActivity).run(request, name);
|
|
19612
19652
|
}));
|
|
19653
|
+
var deliveryBase = (name) => hostActivity(name, "integration_branch", "change_request", IntegrationBranch, gen2(function* () {
|
|
19654
|
+
return yield* (yield* IntegrationBranchActivity).run({ base: true }, name);
|
|
19655
|
+
}));
|
|
19613
19656
|
var mergeChangeRequest = (name, request) => hostActivity(name, "merge_change_request", "merge_change_request", MergeResult, gen2(function* () {
|
|
19614
19657
|
return yield* (yield* MergeChangeRequestActivity).run(request, name);
|
|
19615
19658
|
}));
|
|
@@ -20099,7 +20142,8 @@ var ApprovedCheck = Struct({
|
|
|
20099
20142
|
});
|
|
20100
20143
|
var RepositoryCheck = Struct({
|
|
20101
20144
|
...ApprovedCheck.fields,
|
|
20102
|
-
pipeline: optionalKey2(Boolean3)
|
|
20145
|
+
pipeline: optionalKey2(Boolean3),
|
|
20146
|
+
readsTarget: optionalKey2(Boolean3)
|
|
20103
20147
|
});
|
|
20104
20148
|
var MetricName = String5.check(isMinLength(1), isMaxLength(80), isPattern2(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
|
|
20105
20149
|
var MeasurePlan = Struct({
|
|
@@ -20133,6 +20177,20 @@ var ResolveSpec = Struct({
|
|
|
20133
20177
|
var ResolvedRevisions = Struct({
|
|
20134
20178
|
commits: ArraySchema(String5.check(isPattern2(new RegExp("^[0-9a-f]{40}([0-9a-f]{24})?$", "u"))))
|
|
20135
20179
|
});
|
|
20180
|
+
var ReleaseTag = String5.check(isMinLength(1), isMaxLength(240));
|
|
20181
|
+
var DeploySpec = Struct({
|
|
20182
|
+
tag: ReleaseTag,
|
|
20183
|
+
previousTag: optionalKey2(ReleaseTag)
|
|
20184
|
+
});
|
|
20185
|
+
var DeployWork = Struct({
|
|
20186
|
+
...DeploySpec.fields,
|
|
20187
|
+
runsScript: optionalKey2(Literal2(true))
|
|
20188
|
+
});
|
|
20189
|
+
var DeployOutcome = Struct({
|
|
20190
|
+
status: Literals(["deployed", "failed", "rolled_back", "rollback_failed", "none"]),
|
|
20191
|
+
exitCode: optionalKey2(Int),
|
|
20192
|
+
detail: String5.check(isMaxLength(1200))
|
|
20193
|
+
});
|
|
20136
20194
|
var VerificationWorkUnit = Struct({
|
|
20137
20195
|
kind: Literal2("verification"),
|
|
20138
20196
|
id: Id,
|
|
@@ -20146,6 +20204,7 @@ var VerificationWorkUnit = Struct({
|
|
|
20146
20204
|
checks: ArraySchema(RepositoryCheck).check(isMaxLength(50)),
|
|
20147
20205
|
measure: optionalKey2(MeasureSpec),
|
|
20148
20206
|
resolve: optionalKey2(ResolveSpec),
|
|
20207
|
+
deploy: optionalKey2(DeployWork),
|
|
20149
20208
|
hosts: optionalKey2(ArraySchema(NetworkHost)),
|
|
20150
20209
|
storageOrigin: StorageOrigin
|
|
20151
20210
|
});
|
|
@@ -20195,7 +20254,9 @@ var VerificationEvidence = Struct({
|
|
|
20195
20254
|
head: TreeEvidence,
|
|
20196
20255
|
baseline: optionalKey2(TreeEvidence),
|
|
20197
20256
|
measurement: optionalKey2(MeasureEvidence),
|
|
20198
|
-
resolved: optionalKey2(ResolvedRevisions)
|
|
20257
|
+
resolved: optionalKey2(ResolvedRevisions),
|
|
20258
|
+
deployed: optionalKey2(DeployOutcome),
|
|
20259
|
+
deployScriptFound: optionalKey2(Literal2(true))
|
|
20199
20260
|
});
|
|
20200
20261
|
var BoundaryChange = Struct({
|
|
20201
20262
|
kind: Literal2("change"),
|
|
@@ -20378,6 +20439,21 @@ var resolveRevisions = (name, revisions) => takeStep(name, "verify", "verify", g
|
|
|
20378
20439
|
return (yield* await_2(deferred)).commits;
|
|
20379
20440
|
}));
|
|
20380
20441
|
|
|
20442
|
+
// ../../packages/sdk/src/loop/deploy.ts
|
|
20443
|
+
var deployDeferred = (step) => make14(`deploy/${step}`, { success: DeployOutcome, error: StepFailed });
|
|
20444
|
+
var runDeploy = (name, request) => takeStep(name, "verify", "publish_release", gen2(function* () {
|
|
20445
|
+
const deferred = deployDeferred(name);
|
|
20446
|
+
yield* launch(deferred, (host, token) => host.startVerification({
|
|
20447
|
+
step: name,
|
|
20448
|
+
deploy: {
|
|
20449
|
+
tag: request.tag,
|
|
20450
|
+
...request.previousTag === undefined ? undefined : { previousTag: request.previousTag }
|
|
20451
|
+
},
|
|
20452
|
+
token
|
|
20453
|
+
}));
|
|
20454
|
+
return yield* await_2(deferred);
|
|
20455
|
+
}));
|
|
20456
|
+
|
|
20381
20457
|
// ../../packages/sdk/src/loop/test-loop.ts
|
|
20382
20458
|
var LoopJournal = Struct({
|
|
20383
20459
|
activities: Record(String5, Json2),
|
|
@@ -20469,7 +20545,7 @@ var journaled = (engine, journal, ran) => ({
|
|
|
20469
20545
|
})
|
|
20470
20546
|
});
|
|
20471
20547
|
var scriptedExit = (scripted, failure) => scripted === undefined ? fail5(failure("nothing was scripted for this Step")) : scripted instanceof ScriptedFailure ? fail5(failure(scripted.reason)) : succeed4(scripted);
|
|
20472
|
-
var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyLaunches) => {
|
|
20548
|
+
var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyLaunches, deployLaunches, questions, answers) => {
|
|
20473
20549
|
const resolve = (deferred, token, exit) => done4(deferred, { token, exit }).pipe(provideService2(WorkflowEngine, engine));
|
|
20474
20550
|
return {
|
|
20475
20551
|
startAgentWork: (launch) => andThen2(sync2(() => agentLaunches.push({
|
|
@@ -20484,15 +20560,25 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
20484
20560
|
putQuestion: (launch) => {
|
|
20485
20561
|
const attended = script.attended === true;
|
|
20486
20562
|
const auto = script.fullAuto === true ? launch.auto ?? (attended ? undefined : launch.unattendedAuto) : undefined;
|
|
20487
|
-
const
|
|
20488
|
-
|
|
20563
|
+
const scripted = script.answers?.[launch.step];
|
|
20564
|
+
const answer = scripted ?? auto ?? (attended ? undefined : launch.default);
|
|
20565
|
+
if (answer !== undefined)
|
|
20566
|
+
answers.push({
|
|
20567
|
+
step: launch.step,
|
|
20568
|
+
value: answer,
|
|
20569
|
+
...scripted === undefined && auto !== undefined ? { byAuto: true, ...launch.evidence === undefined ? undefined : { evidence: launch.evidence } } : undefined
|
|
20570
|
+
});
|
|
20571
|
+
return andThen2(sync2(() => questions.push({ step: launch.step, prompt: launch.prompt })), resolve(answerDeferred(launch.step), launch.token, answer === undefined ? fail5(new StepFailed({ step: launch.step, reason: "no answer was scripted" })) : succeed4(answer)));
|
|
20572
|
+
},
|
|
20573
|
+
admitChild: (launch) => {
|
|
20574
|
+
const refused = script.refusedChildren?.[launch.step];
|
|
20575
|
+
return refused !== undefined ? fail7(new StepFailed(isString2(refused) ? { step: launch.step, reason: refused } : { step: launch.step, ...refused })) : andThen2(sync2(() => childLaunches.push({
|
|
20576
|
+
step: launch.step,
|
|
20577
|
+
loop: launch.loop,
|
|
20578
|
+
input: launch.input,
|
|
20579
|
+
...launch.constraints === undefined ? undefined : { constraints: launch.constraints }
|
|
20580
|
+
})), resolve(childDeferred(launch.step), launch.token, scriptedExit(script.children?.[launch.step], (reason) => new ChildFailed({ step: launch.step, loop: launch.loop, reason }))));
|
|
20489
20581
|
},
|
|
20490
|
-
admitChild: (launch) => andThen2(sync2(() => childLaunches.push({
|
|
20491
|
-
step: launch.step,
|
|
20492
|
-
loop: launch.loop,
|
|
20493
|
-
input: launch.input,
|
|
20494
|
-
...launch.constraints === undefined ? undefined : { constraints: launch.constraints }
|
|
20495
|
-
})), resolve(childDeferred(launch.step), launch.token, scriptedExit(script.children?.[launch.step], (reason) => new ChildFailed({ step: launch.step, loop: launch.loop, reason })))),
|
|
20496
20582
|
awaitEvent: (launch) => {
|
|
20497
20583
|
const event = script.events?.[launch.step];
|
|
20498
20584
|
waits.push({
|
|
@@ -20508,6 +20594,11 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
20508
20594
|
claimResource: (launch) => flatMap3(script.claimed?.({ step: launch.step, resource: launch.resource, action: launch.action }) ?? undefined_2, (settled) => launch.action === "let_go" ? resolve(letGoDeferred(launch.step), launch.token, succeed4(null)) : resolve(claimDeferred(launch.step), launch.token, succeed4(settled ?? script.claims?.[launch.step] ?? { status: "granted", resource: launch.resource }))),
|
|
20509
20595
|
startVerification: (launch) => {
|
|
20510
20596
|
const scripted = script.verifications?.[launch.step];
|
|
20597
|
+
if (launch.deploy !== undefined) {
|
|
20598
|
+
const deployed = script.deploys?.[launch.step];
|
|
20599
|
+
deployLaunches.push({ step: launch.step, ...launch.deploy });
|
|
20600
|
+
return resolve(deployDeferred(launch.step), launch.token, deployed instanceof ScriptedFailure ? fail5(new StepFailed({ step: launch.step, reason: deployed.reason })) : succeed4(deployed ?? { status: "none", detail: "The repository has no .kitman/deploy" }));
|
|
20601
|
+
}
|
|
20511
20602
|
if (launch.resolve !== undefined) {
|
|
20512
20603
|
const commits = launch.resolve.revisions.map((revision) => {
|
|
20513
20604
|
const scriptedCommit = script.commits?.[revision];
|
|
@@ -20586,6 +20677,9 @@ var testLoop = (loop, script) => {
|
|
|
20586
20677
|
const childLaunches = [];
|
|
20587
20678
|
const waits = [];
|
|
20588
20679
|
const verifyLaunches = [];
|
|
20680
|
+
const deployLaunches = [];
|
|
20681
|
+
const questions = [];
|
|
20682
|
+
const answers = [];
|
|
20589
20683
|
let latestSteps = [];
|
|
20590
20684
|
const declared = capabilitiesOf(loop);
|
|
20591
20685
|
const granted = new Set((script.grant ?? declared).filter((capability) => declared.includes(capability)));
|
|
@@ -20598,7 +20692,7 @@ var testLoop = (loop, script) => {
|
|
|
20598
20692
|
const execute = (payload) => gen2(function* () {
|
|
20599
20693
|
const engine = yield* WorkflowEngine;
|
|
20600
20694
|
return yield* executeLoop(loop, {
|
|
20601
|
-
host: scriptedHost(script, engine, agentLaunches, childLaunches, waits, verifyLaunches),
|
|
20695
|
+
host: scriptedHost(script, engine, agentLaunches, childLaunches, waits, verifyLaunches, deployLaunches, questions, answers),
|
|
20602
20696
|
activities,
|
|
20603
20697
|
granted,
|
|
20604
20698
|
onRun: (run) => {
|
|
@@ -20608,7 +20702,19 @@ var testLoop = (loop, script) => {
|
|
|
20608
20702
|
});
|
|
20609
20703
|
return gen2(function* () {
|
|
20610
20704
|
const result = yield* exit2(workflow.execute({ input: script.input }).pipe(provideService2(ConfigProvider, fromUnknown(script.secrets ?? {}))));
|
|
20611
|
-
return {
|
|
20705
|
+
return {
|
|
20706
|
+
result,
|
|
20707
|
+
steps: latestSteps,
|
|
20708
|
+
journal,
|
|
20709
|
+
activities: ran,
|
|
20710
|
+
agentLaunches,
|
|
20711
|
+
childLaunches,
|
|
20712
|
+
waits,
|
|
20713
|
+
verifyLaunches,
|
|
20714
|
+
deployLaunches,
|
|
20715
|
+
questions,
|
|
20716
|
+
answers
|
|
20717
|
+
};
|
|
20612
20718
|
}).pipe(provide4(workflow.toLayer(execute).pipe(provideMerge(layerMemory))));
|
|
20613
20719
|
};
|
|
20614
20720
|
// ../../packages/sdk/src/loop/review.ts
|
|
@@ -20893,6 +20999,21 @@ var changeRequestBody = (build) => [
|
|
|
20893
20999
|
|
|
20894
21000
|
`);
|
|
20895
21001
|
|
|
21002
|
+
// src/delivery.ts
|
|
21003
|
+
var DeliveryFields = {
|
|
21004
|
+
deliveryTarget: optional2(DeliveryTarget),
|
|
21005
|
+
deliversTo: optional2(ResolvedDeliveryTarget),
|
|
21006
|
+
epic: optional2(EpicDelivery)
|
|
21007
|
+
};
|
|
21008
|
+
var ownDeliveryTarget = (input) => input.deliversTo?.layer === "run" ? { deliveryTarget: input.deliversTo.target } : undefined;
|
|
21009
|
+
var epicOf = (input) => input.deliversTo?.target === "epic_branch" ? input.epic : undefined;
|
|
21010
|
+
var deliveryLayerWords = {
|
|
21011
|
+
run: "this Run",
|
|
21012
|
+
project: "its Project",
|
|
21013
|
+
team: "its Team",
|
|
21014
|
+
workspace: "the Workspace"
|
|
21015
|
+
};
|
|
21016
|
+
|
|
20896
21017
|
// src/text-limits.ts
|
|
20897
21018
|
var bounded2 = (maxLength, description) => String5.check(isMaxLength(maxLength)).annotate({ description });
|
|
20898
21019
|
var OneSentence = bounded2(300, "One sentence, at most 300 characters.");
|
|
@@ -20929,7 +21050,8 @@ var Input = Struct({
|
|
|
20929
21050
|
earlier: optional2(ArraySchema(MergedFinding)),
|
|
20930
21051
|
failing: optional2(ArraySchema(String5)),
|
|
20931
21052
|
notRun: optional2(ArraySchema(String5)),
|
|
20932
|
-
next: optional2(Literals(choices))
|
|
21053
|
+
next: optional2(Literals(choices)),
|
|
21054
|
+
...DeliveryFields
|
|
20933
21055
|
});
|
|
20934
21056
|
var FollowUpStatus = Literals(["fixed", "changed", "still_there"]);
|
|
20935
21057
|
var FollowUp = Struct({ id: String5, status: FollowUpStatus });
|
|
@@ -20955,7 +21077,8 @@ var Output = Struct({
|
|
|
20955
21077
|
artifactId: String5,
|
|
20956
21078
|
scope: optional2(ScopeJudgement),
|
|
20957
21079
|
approval: optional2(Struct({ head: String5, approved: Boolean3, reason: optional2(String5) })),
|
|
20958
|
-
next: optional2(Struct({ choice: Literals(choices), detail: optional2(String5) }))
|
|
21080
|
+
next: optional2(Struct({ choice: Literals(choices), detail: optional2(String5) })),
|
|
21081
|
+
deliversTo: optional2(ResolvedDeliveryTarget)
|
|
20959
21082
|
});
|
|
20960
21083
|
|
|
20961
21084
|
class ReviewTargetMissing extends TaggedError3()("ReviewTargetMissing", {
|
|
@@ -21085,7 +21208,7 @@ var fixBrief = (changeRequestId, findings) => [
|
|
|
21085
21208
|
`);
|
|
21086
21209
|
var review_default = defineLoop({
|
|
21087
21210
|
id: "review",
|
|
21088
|
-
version: "3.
|
|
21211
|
+
version: "3.8.0",
|
|
21089
21212
|
title: "Review",
|
|
21090
21213
|
input: Input,
|
|
21091
21214
|
output: Output,
|
|
@@ -21129,13 +21252,10 @@ var review_default = defineLoop({
|
|
|
21129
21252
|
const answered = followUpsOf(earlier, outputs.flatMap(([, output]) => output.followUps ?? []));
|
|
21130
21253
|
const standing = new Set(answered.flatMap((entry) => entry.status === "fixed" ? [] : [entry.id]));
|
|
21131
21254
|
const verdicts = outputs.flatMap(([, output]) => output.verdicts ?? []);
|
|
21132
|
-
const
|
|
21133
|
-
const withdrawn = (
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
};
|
|
21137
|
-
const carried = earlier.filter((finding) => standing.has(finding.id) && !withdrawn(finding.id));
|
|
21138
|
-
const followUps = answered.filter((entry) => !withdrawn(entry.id));
|
|
21255
|
+
const settled = settleRound({ findings: earlier, rebuttals: input.rebuttals ?? [], verdicts });
|
|
21256
|
+
const withdrawn = new Set(settled.withdrawn.map((entry) => entry.finding.id));
|
|
21257
|
+
const carried = earlier.filter((finding) => standing.has(finding.id) && !withdrawn.has(finding.id));
|
|
21258
|
+
const followUps = answered.filter((entry) => !withdrawn.has(entry.id));
|
|
21139
21259
|
const sinceApproval = input.approved !== undefined && input.files === undefined;
|
|
21140
21260
|
const merged = (approvedCode) => mergeFindings(Object.fromEntries(outputs.map(([seat, output]) => [
|
|
21141
21261
|
seat,
|
|
@@ -21163,7 +21283,8 @@ var review_default = defineLoop({
|
|
|
21163
21283
|
blocking: findings.some(isBlocking),
|
|
21164
21284
|
artifactId: stored.artifactId,
|
|
21165
21285
|
...approvedFindings.length === 0 ? undefined : { approvedFindings },
|
|
21166
|
-
...scope === undefined ? undefined : { scope }
|
|
21286
|
+
...scope === undefined ? undefined : { scope },
|
|
21287
|
+
...input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo }
|
|
21167
21288
|
};
|
|
21168
21289
|
const changeRequestId = input.changeRequestId;
|
|
21169
21290
|
if (changeRequestId === undefined || head === undefined)
|
|
@@ -21197,32 +21318,47 @@ What next?`,
|
|
|
21197
21318
|
const fixed = yield* call("fix", buildLoop(), {
|
|
21198
21319
|
words: fixBrief(changeRequestId, findings),
|
|
21199
21320
|
changeRequestId,
|
|
21200
|
-
maxRounds: 2
|
|
21321
|
+
maxRounds: 2,
|
|
21322
|
+
...ownDeliveryTarget(input)
|
|
21201
21323
|
});
|
|
21202
21324
|
return { choice, detail: fixed.settled ? "Fixed and pushed" : `Pushed; left: ${fixed.unsettled.join("; ")}` };
|
|
21203
21325
|
}
|
|
21204
21326
|
if (choice === "Build from it") {
|
|
21205
|
-
const built = yield* call("build", buildLoop(), {
|
|
21327
|
+
const built = yield* call("build", buildLoop(), {
|
|
21328
|
+
words: fixBrief(changeRequestId, findings),
|
|
21329
|
+
...ownDeliveryTarget(input)
|
|
21330
|
+
});
|
|
21206
21331
|
return { choice, detail: built.changeRequest.url };
|
|
21207
21332
|
}
|
|
21208
21333
|
return { choice, detail: "The review is kept as an artifact" };
|
|
21209
21334
|
}).pipe(catchTag2("ChildFailed", (failed) => succeed7({ choice, detail: failed.reason })));
|
|
21210
|
-
return {
|
|
21335
|
+
return {
|
|
21336
|
+
...reviewed,
|
|
21337
|
+
...approval === undefined ? undefined : { approval },
|
|
21338
|
+
next
|
|
21339
|
+
};
|
|
21211
21340
|
})
|
|
21212
21341
|
});
|
|
21213
21342
|
|
|
21214
21343
|
// src/release.ts
|
|
21344
|
+
var ApprovalRef = String5.check(isMinLength(1), isMaxLength(240));
|
|
21345
|
+
var approvalRef = (event) => [event?.payload.reviewId, event?.payload.approvalId].find(is2(ApprovalRef));
|
|
21215
21346
|
var Input2 = Struct({
|
|
21216
21347
|
tag: optional2(String5),
|
|
21217
21348
|
revision: optional2(String5),
|
|
21349
|
+
review: optional2(ApprovalRef),
|
|
21218
21350
|
changeRequestId: optional2(String5),
|
|
21351
|
+
taskId: optional2(String5),
|
|
21219
21352
|
deployTarget: optional2(String5),
|
|
21220
21353
|
deployEvent: optional2(String5),
|
|
21221
21354
|
deployTimeoutMinutes: optional2(Int),
|
|
21222
21355
|
repoBindingId: optional2(String5),
|
|
21223
21356
|
releaseTrigger: optional2(ReleaseTrigger),
|
|
21224
21357
|
releaseWhen: optional2(ResolvedReleaseTrigger),
|
|
21225
|
-
releaseScope: optional2(ReleaseScope)
|
|
21358
|
+
releaseScope: optional2(ReleaseScope),
|
|
21359
|
+
version: optional2(String5),
|
|
21360
|
+
candidate: optional2(Boolean3),
|
|
21361
|
+
...DeliveryFields
|
|
21226
21362
|
});
|
|
21227
21363
|
var Drafted = Struct({
|
|
21228
21364
|
tag: String5,
|
|
@@ -21235,19 +21371,6 @@ var Picked = Struct({
|
|
|
21235
21371
|
...Drafted.fields,
|
|
21236
21372
|
releasedIn: optional2(String5)
|
|
21237
21373
|
});
|
|
21238
|
-
var Deployed = Struct({
|
|
21239
|
-
status: Literals(["deployed", "failed", "rolled_back", "rollback_failed", "none"]),
|
|
21240
|
-
detail: FindingDetail
|
|
21241
|
-
});
|
|
21242
|
-
var deployPrompt = (tag, previousTag) => [
|
|
21243
|
-
`Deploy the release ${tag}, which Kitman has just tagged and pushed.`,
|
|
21244
|
-
`Fetch the base branch and tags (\`git fetch origin --tags\`). If neither the base branch head nor ${tag} has an executable \`.kitman/deploy\`, change nothing and answer status none.`,
|
|
21245
|
-
`Otherwise run \`.kitman/deploy ${tag}${previousTag === undefined ? "" : ` ${previousTag}`}\` from a checkout of the base branch head when it has the script, so a rerun of an older tag gets the script's later fixes, or else from the checkout of ${tag}, and do nothing else: it deploys the tag it is given, backs up, publishes, verifies and rolls back by itself, and may take an hour. Run it in the background with its output in a log file, and wait for it to exit, checking every few minutes; never start it twice.`,
|
|
21246
|
-
"Answer with the status its last line `kitman-deploy: <status> <detail>` names, and that detail. If it exited without that line, answer failed with its exit code and the end of its log.",
|
|
21247
|
-
"Never print, copy or summarise the variables or secrets it pulls."
|
|
21248
|
-
].join(`
|
|
21249
|
-
|
|
21250
|
-
`);
|
|
21251
21374
|
var Output2 = Struct({
|
|
21252
21375
|
status: Literals([
|
|
21253
21376
|
"gate_failed",
|
|
@@ -21265,9 +21388,11 @@ var Output2 = Struct({
|
|
|
21265
21388
|
reason: String5,
|
|
21266
21389
|
tag: optional2(String5),
|
|
21267
21390
|
notesArtifactId: optional2(String5),
|
|
21391
|
+
leftUndeployed: optional2(Boolean3),
|
|
21268
21392
|
revision: optional2(String5),
|
|
21269
21393
|
url: optional2(String5),
|
|
21270
21394
|
releaseWhen: optional2(ResolvedReleaseTrigger),
|
|
21395
|
+
deliversTo: optional2(ResolvedDeliveryTarget),
|
|
21271
21396
|
shipped: optional2(ShippedScope)
|
|
21272
21397
|
});
|
|
21273
21398
|
var triggerWords = {
|
|
@@ -21286,16 +21411,33 @@ var scopePrompt2 = (scope) => scope === undefined ? [] : [
|
|
|
21286
21411
|
scope.tasks.map((task) => `- ${task.key} ${task.title}`).join(`
|
|
21287
21412
|
`)
|
|
21288
21413
|
];
|
|
21289
|
-
var
|
|
21414
|
+
var nextCandidateWords = (version) => `the next release candidate of ${version} after the latest the repository has: one past the highest N of any ${version}-rc.N tag, or ${version}-rc.1 when there is none`;
|
|
21415
|
+
var tagWords = (tag, cut) => {
|
|
21416
|
+
if (cut?.candidate === true)
|
|
21417
|
+
return `The release is a release candidate of ${cut.version}, numbered again once it is tagged. Give as tag ${nextCandidateWords(cut.version)}.`;
|
|
21418
|
+
const given = tag ?? cut?.version;
|
|
21419
|
+
return given === undefined ? "Propose the next version tag, following the scheme earlier tags use. With no earlier tag, propose v0.1.0 and say so in the notes." : `The release is tagged ${given}.`;
|
|
21420
|
+
};
|
|
21421
|
+
var draftPrompt = (tag, cut, changeRequestId, scope) => [
|
|
21422
|
+
"Fetch the base branch and tags first (`git fetch origin --tags`).",
|
|
21290
21423
|
"Draft the release notes for the ChangeRequests merged since the last release tag on the base branch, including those with no linked Task.",
|
|
21291
21424
|
...scopePrompt2(scope),
|
|
21292
21425
|
...changeRequestId === undefined ? [] : [`The release ChangeRequest ${changeRequestId} is part of it.`],
|
|
21293
21426
|
"Group them by what a user of the software notices, and name each ChangeRequest you cover.",
|
|
21294
|
-
tag
|
|
21427
|
+
tagWords(tag, cut),
|
|
21295
21428
|
"Give the latest earlier release tag as previousTag, or leave it out when there is none."
|
|
21296
21429
|
].join(`
|
|
21297
21430
|
|
|
21298
21431
|
`);
|
|
21432
|
+
var regexSpecial = /[.*+?^$()|[\]{}\\]/g;
|
|
21433
|
+
var escaped = (text) => text.replaceAll(regexSpecial, "\\$&");
|
|
21434
|
+
var candidateNumber = (tag, version) => {
|
|
21435
|
+
const [, number] = new RegExp(`^${escaped(version)}-rc\\.(\\d+)$`).exec(tag) ?? [];
|
|
21436
|
+
return number === undefined ? undefined : Number(number);
|
|
21437
|
+
};
|
|
21438
|
+
var renameTag = (text, taken, tag) => text.replaceAll(new RegExp(`${escaped(taken)}(?!\\d)`, "g"), tag);
|
|
21439
|
+
var isTagElsewhere = (failed) => failed.reason.includes("TAG_ELSEWHERE");
|
|
21440
|
+
var isReleasedByOther = (failed) => failed.reason.includes("TAG_RELEASED");
|
|
21299
21441
|
var redraftPrompt = (drafted, edit) => [
|
|
21300
21442
|
"Redraft these release notes as asked, keeping the tag and everything not mentioned.",
|
|
21301
21443
|
`Asked: ${edit}`,
|
|
@@ -21305,19 +21447,26 @@ var redraftPrompt = (drafted, edit) => [
|
|
|
21305
21447
|
].join(`
|
|
21306
21448
|
|
|
21307
21449
|
`);
|
|
21308
|
-
var
|
|
21450
|
+
var pickInstructions = (drafted, revision, givenTag, cut) => {
|
|
21451
|
+
if (cut !== undefined)
|
|
21452
|
+
return [
|
|
21453
|
+
`Fetch the tags (\`git fetch origin --tags\`). ${cut.candidate ? `Give as tag ${nextCandidateWords(cut.version)}, naming it in the title and notes where they name ${drafted.tag}, and` : `The release is tagged ${cut.version}: give the draft unchanged but for`} the latest release tag as previousTag. It is released even when another tag already contains ${revision}: leave releasedIn out.`
|
|
21454
|
+
];
|
|
21309
21455
|
const ownTag = givenTag ?? drafted.tag;
|
|
21310
21456
|
return [
|
|
21311
|
-
"This Release now holds the deploy target, so no other Release tags until it settles. Another Release may have tagged since these notes were drafted: pick their version again.",
|
|
21312
21457
|
`Fetch the tags (\`git fetch origin --tags\`) and list the release tags that contain ${revision} (\`git tag --contains ${revision}\`). ${ownTag} at ${revision} itself, as \`git rev-list -n 1 ${ownTag}\` tells, is this Release tagged on an earlier attempt: ignore it. Any other, ${ownTag} at another commit included, means ${revision} is released already: give that tag as releasedIn and the draft unchanged.`,
|
|
21313
|
-
givenTag === undefined ? `Otherwise, when ${drafted.tag} is still free and the latest release tag is still ${drafted.previousTag ?? "none"}, give the draft unchanged. When not, give the next version tag after the latest release tag, that latest tag as previousTag, and drop from the notes and changeRequests what it already released.` : `Otherwise give the draft unchanged. The release is tagged ${givenTag}
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21458
|
+
givenTag === undefined ? `Otherwise, when ${drafted.tag} is still free and the latest release tag is still ${drafted.previousTag ?? "none"}, give the draft unchanged. When not, give the next version tag after the latest release tag, that latest tag as previousTag, and drop from the notes and changeRequests what it already released.` : `Otherwise give the draft unchanged. The release is tagged ${givenTag}.`
|
|
21459
|
+
];
|
|
21460
|
+
};
|
|
21461
|
+
var pickPrompt = (drafted, revision, givenTag, cut) => [
|
|
21462
|
+
"This Release now holds the deploy target, so no other Release tags until it settles. Another Release may have tagged since these notes were drafted: pick their version again.",
|
|
21463
|
+
...pickInstructions(drafted, revision, givenTag, cut),
|
|
21464
|
+
"```json",
|
|
21465
|
+
JSON.stringify(drafted, null, 2),
|
|
21466
|
+
"```"
|
|
21467
|
+
].join(`
|
|
21318
21468
|
|
|
21319
21469
|
`);
|
|
21320
|
-
};
|
|
21321
21470
|
var readyToMerge = (changeRequestId, round = 1) => gen2(function* () {
|
|
21322
21471
|
for (let pass = 1;; pass++) {
|
|
21323
21472
|
const at = (name) => {
|
|
@@ -21362,7 +21511,8 @@ var readyToMerge = (changeRequestId, round = 1) => gen2(function* () {
|
|
|
21362
21511
|
status: "not_mergeable",
|
|
21363
21512
|
reason: `ChangeRequest ${changeRequestId} does not merge cleanly; bring it up to date first`
|
|
21364
21513
|
};
|
|
21365
|
-
|
|
21514
|
+
const review = approvalRef(approved);
|
|
21515
|
+
return { passed: read.head, ...review === undefined ? undefined : { review } };
|
|
21366
21516
|
}
|
|
21367
21517
|
}).pipe(catchTags2({
|
|
21368
21518
|
WaitTimedOut: (timedOut) => succeed7({
|
|
@@ -21377,21 +21527,29 @@ var readyToMerge = (changeRequestId, round = 1) => gen2(function* () {
|
|
|
21377
21527
|
var recovery = (previous) => previous === undefined ? ["Retry the deploy", "Leave it"] : ["Retry the deploy", `Roll back to ${previous}`, "Leave it"];
|
|
21378
21528
|
var release_default = defineLoop({
|
|
21379
21529
|
id: "release",
|
|
21380
|
-
version: "2.
|
|
21530
|
+
version: "2.4.0",
|
|
21381
21531
|
title: "Release",
|
|
21382
21532
|
input: Input2,
|
|
21383
21533
|
output: Output2,
|
|
21384
|
-
agents: { releaser: "releaser"
|
|
21534
|
+
agents: { releaser: "releaser" },
|
|
21385
21535
|
checkout: "read",
|
|
21386
21536
|
when: [
|
|
21387
21537
|
{
|
|
21388
21538
|
event: "release.due",
|
|
21389
21539
|
input: {
|
|
21390
|
-
|
|
21540
|
+
version: "version",
|
|
21541
|
+
candidate: "candidate",
|
|
21391
21542
|
releaseScope: "releaseScope",
|
|
21392
21543
|
releaseWhen: "releaseWhen",
|
|
21393
21544
|
repoBindingId: "repoBindingId"
|
|
21394
21545
|
}
|
|
21546
|
+
},
|
|
21547
|
+
{
|
|
21548
|
+
event: "change_request.ready",
|
|
21549
|
+
filter: { busy: false },
|
|
21550
|
+
input: { changeRequestId: "changeRequestId", taskId: "taskId" },
|
|
21551
|
+
optIn: true,
|
|
21552
|
+
description: "Releases a ChangeRequest delivering a Task once it is approved and green and no Run works it, only under a merge release trigger; under a Milestone or Project trigger each such Run ends not_due."
|
|
21395
21553
|
}
|
|
21396
21554
|
],
|
|
21397
21555
|
capabilities: [
|
|
@@ -21410,7 +21568,13 @@ var release_default = defineLoop({
|
|
|
21410
21568
|
status: "not_due",
|
|
21411
21569
|
reason: `Release runs when ${triggerWords[when.trigger]}, as ${layerWords[when.layer]} says; this Run did not override that`
|
|
21412
21570
|
};
|
|
21413
|
-
|
|
21571
|
+
const epic = epicOf(input);
|
|
21572
|
+
if (epic !== undefined && !epic.done)
|
|
21573
|
+
return {
|
|
21574
|
+
status: "not_due",
|
|
21575
|
+
reason: `Its Task lands on ${epic.branch}, as ${deliveryLayerWords[input.deliversTo?.layer ?? "workspace"]} says; Release runs once epic ${epic.key} merges into ${epic.defaultBranch}`
|
|
21576
|
+
};
|
|
21577
|
+
if (input.releaseScope !== undefined && input.tag === undefined && input.version === undefined)
|
|
21414
21578
|
return {
|
|
21415
21579
|
status: "no_version",
|
|
21416
21580
|
reason: "Kitman cut no version for this Milestone or Project: its Project is not named by a full semver version. Release it with a tag.",
|
|
@@ -21418,6 +21582,7 @@ var release_default = defineLoop({
|
|
|
21418
21582
|
};
|
|
21419
21583
|
const changeRequestId = input.changeRequestId;
|
|
21420
21584
|
let gated;
|
|
21585
|
+
let review = input.review;
|
|
21421
21586
|
if (changeRequestId === undefined) {
|
|
21422
21587
|
const gate = yield* verify("gate", {
|
|
21423
21588
|
...input.revision === undefined ? undefined : { revision: input.revision },
|
|
@@ -21461,16 +21626,35 @@ var release_default = defineLoop({
|
|
|
21461
21626
|
if (!("passed" in ready))
|
|
21462
21627
|
return ready;
|
|
21463
21628
|
gated = ready.passed;
|
|
21464
|
-
|
|
21629
|
+
review = ready.review;
|
|
21630
|
+
}
|
|
21631
|
+
const cut = input.tag === undefined && input.version !== undefined ? { version: input.version, candidate: input.candidate === true } : undefined;
|
|
21632
|
+
const tagOf = (proposed, fallback) => {
|
|
21633
|
+
if (cut === undefined)
|
|
21634
|
+
return input.tag ?? proposed;
|
|
21635
|
+
if (!cut.candidate)
|
|
21636
|
+
return cut.version;
|
|
21637
|
+
return candidateNumber(proposed, cut.version) === undefined ? fallback : proposed;
|
|
21638
|
+
};
|
|
21465
21639
|
let drafted = yield* agentWork("draft-notes", {
|
|
21466
21640
|
agent: "releaser",
|
|
21467
|
-
prompt: draftPrompt(input.tag, changeRequestId, input.releaseScope),
|
|
21641
|
+
prompt: draftPrompt(input.tag, cut, changeRequestId, input.releaseScope),
|
|
21468
21642
|
output: Drafted
|
|
21469
21643
|
});
|
|
21470
|
-
let tag =
|
|
21644
|
+
let tag = tagOf(drafted.tag, cut === undefined ? drafted.tag : `${cut.version}-rc.1`);
|
|
21645
|
+
const recordNotes = (step) => artifact(step, {
|
|
21646
|
+
kind: "release_notes",
|
|
21647
|
+
title: drafted.title,
|
|
21648
|
+
text: drafted.notes,
|
|
21649
|
+
data: {
|
|
21650
|
+
tag,
|
|
21651
|
+
changeRequests: drafted.changeRequests,
|
|
21652
|
+
...input.releaseScope === undefined ? undefined : { shipped: shippedScope(input.releaseScope) }
|
|
21653
|
+
}
|
|
21654
|
+
});
|
|
21471
21655
|
for (let round = 1;; round++) {
|
|
21472
21656
|
const answer = yield* ask(round === 1 ? "approve" : `approve:${round}`, {
|
|
21473
|
-
prompt: `Release ${tag} with these notes?
|
|
21657
|
+
prompt: `Release ${cut?.candidate === true ? `${tag}, or the next release candidate of ${cut.version} still free when it is tagged,` : tag} with these notes?
|
|
21474
21658
|
|
|
21475
21659
|
${drafted.notes}`,
|
|
21476
21660
|
options: [
|
|
@@ -21481,7 +21665,8 @@ ${drafted.notes}`,
|
|
|
21481
21665
|
recommended: "Approve",
|
|
21482
21666
|
recommendationReason: "The release is proved: its checks pass, or its ChangeRequest is green, approved and mergeable.",
|
|
21483
21667
|
default: null,
|
|
21484
|
-
auto: "Approve"
|
|
21668
|
+
auto: "Approve",
|
|
21669
|
+
evidence: { ...review === undefined ? undefined : { review }, head: gated }
|
|
21485
21670
|
});
|
|
21486
21671
|
if (answer === "Approve")
|
|
21487
21672
|
break;
|
|
@@ -21494,16 +21679,7 @@ ${drafted.notes}`,
|
|
|
21494
21679
|
default: "No reason given",
|
|
21495
21680
|
timeout: "1 day"
|
|
21496
21681
|
});
|
|
21497
|
-
const kept = yield*
|
|
21498
|
-
kind: "release_notes",
|
|
21499
|
-
title: drafted.title,
|
|
21500
|
-
text: drafted.notes,
|
|
21501
|
-
data: {
|
|
21502
|
-
tag,
|
|
21503
|
-
changeRequests: drafted.changeRequests,
|
|
21504
|
-
...input.releaseScope === undefined ? undefined : { shipped: shippedScope(input.releaseScope) }
|
|
21505
|
-
}
|
|
21506
|
-
});
|
|
21682
|
+
const kept = yield* recordNotes("notes");
|
|
21507
21683
|
return { status: "rejected", reason: why, tag, notesArtifactId: kept.artifactId };
|
|
21508
21684
|
}
|
|
21509
21685
|
const edit = yield* ask(`edit:${round}`, {
|
|
@@ -21522,16 +21698,7 @@ ${drafted.notes}`,
|
|
|
21522
21698
|
output: Drafted
|
|
21523
21699
|
});
|
|
21524
21700
|
}
|
|
21525
|
-
let notes = yield*
|
|
21526
|
-
kind: "release_notes",
|
|
21527
|
-
title: drafted.title,
|
|
21528
|
-
text: drafted.notes,
|
|
21529
|
-
data: {
|
|
21530
|
-
tag,
|
|
21531
|
-
changeRequests: drafted.changeRequests,
|
|
21532
|
-
...input.releaseScope === undefined ? undefined : { shipped: shippedScope(input.releaseScope) }
|
|
21533
|
-
}
|
|
21534
|
-
});
|
|
21701
|
+
let notes = yield* recordNotes("notes");
|
|
21535
21702
|
let revision = gated;
|
|
21536
21703
|
if (changeRequestId !== undefined) {
|
|
21537
21704
|
for (let round = 1;; round++) {
|
|
@@ -21561,56 +21728,79 @@ ${drafted.notes}`,
|
|
|
21561
21728
|
if (!("passed" in ready))
|
|
21562
21729
|
return { ...ready, tag, notesArtifactId: notes.artifactId };
|
|
21563
21730
|
gated = ready.passed;
|
|
21731
|
+
review = ready.review;
|
|
21732
|
+
const again = yield* ask(`approve:merge:${round + 1}`, {
|
|
21733
|
+
prompt: `ChangeRequest ${changeRequestId} moved to ${gated} after ${tag} was approved; its pipeline passed and it is approved again. Release ${tag} from it?`,
|
|
21734
|
+
options: [
|
|
21735
|
+
{ value: "Approve", description: "Merges this head, then tags, publishes and deploys it." },
|
|
21736
|
+
{ value: "Reject", description: "Keeps the draft and releases nothing." }
|
|
21737
|
+
],
|
|
21738
|
+
recommended: "Approve",
|
|
21739
|
+
recommendationReason: "This head is green, approved and mergeable, like the one you approved.",
|
|
21740
|
+
default: null,
|
|
21741
|
+
auto: "Approve",
|
|
21742
|
+
evidence: { ...review === undefined ? undefined : { review }, head: gated }
|
|
21743
|
+
});
|
|
21744
|
+
if (again !== "Approve")
|
|
21745
|
+
return {
|
|
21746
|
+
status: "rejected",
|
|
21747
|
+
reason: `Not released from ${gated}, the head ChangeRequest ${changeRequestId} moved to`,
|
|
21748
|
+
tag,
|
|
21749
|
+
notesArtifactId: notes.artifactId
|
|
21750
|
+
};
|
|
21564
21751
|
}
|
|
21565
21752
|
}
|
|
21566
21753
|
const deployEvent = input.deployEvent ?? "deploy";
|
|
21567
21754
|
yield* claim("deploy-target", { resource: `deploy:${input.deployTarget ?? deployEvent}`, takeOverOwnLoop: true });
|
|
21568
21755
|
const { releasedIn, ...picked } = yield* agentWork("pick-version", {
|
|
21569
21756
|
agent: "releaser",
|
|
21570
|
-
prompt: pickPrompt({ ...drafted, tag }, revision, input.tag),
|
|
21757
|
+
prompt: pickPrompt({ ...drafted, tag }, revision, input.tag, cut),
|
|
21571
21758
|
output: Picked
|
|
21572
21759
|
});
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21760
|
+
const alreadyReleased = (released, reason) => ({
|
|
21761
|
+
status: "nothing_to_release",
|
|
21762
|
+
reason,
|
|
21763
|
+
tag: released,
|
|
21764
|
+
notesArtifactId: notes.artifactId,
|
|
21765
|
+
revision
|
|
21766
|
+
});
|
|
21767
|
+
if (cut === undefined && releasedIn !== undefined)
|
|
21768
|
+
return alreadyReleased(releasedIn, `${revision} is already released in ${releasedIn}`);
|
|
21769
|
+
const pickedTag = tagOf(picked.tag, tag);
|
|
21770
|
+
const repicked = cut === undefined ? picked : {
|
|
21771
|
+
...picked,
|
|
21772
|
+
title: renameTag(picked.title, tag, pickedTag),
|
|
21773
|
+
notes: renameTag(picked.notes, tag, pickedTag)
|
|
21774
|
+
};
|
|
21775
|
+
const changed = pickedTag !== tag || repicked.notes !== drafted.notes || repicked.title !== drafted.title;
|
|
21776
|
+
drafted = repicked;
|
|
21777
|
+
tag = pickedTag;
|
|
21778
|
+
if (changed)
|
|
21779
|
+
notes = yield* recordNotes("notes:picked");
|
|
21780
|
+
const publish = (step) => release2(step, { tag, revision, title: drafted.title, notes: drafted.notes }).pipe(catchTag2("StepFailed", (failed) => isTagElsewhere(failed) || isReleasedByOther(failed) ? succeed7(failed) : fail7(failed)));
|
|
21781
|
+
const approved = { tag, title: drafted.title, notes: drafted.notes };
|
|
21782
|
+
let released = yield* publish("tag");
|
|
21783
|
+
if (released instanceof StepFailed && cut === undefined && isReleasedByOther(released))
|
|
21784
|
+
return alreadyReleased(tag, `${tag} is already released at ${revision} by another Run`);
|
|
21785
|
+
for (let round = 2;released instanceof StepFailed; round++) {
|
|
21786
|
+
if (cut?.candidate !== true || round > 20)
|
|
21787
|
+
return yield* released;
|
|
21788
|
+
tag = `${cut.version}-rc.${(candidateNumber(tag, cut.version) ?? 0) + 1}`;
|
|
21789
|
+
drafted = {
|
|
21790
|
+
...drafted,
|
|
21791
|
+
title: renameTag(approved.title, approved.tag, tag),
|
|
21792
|
+
notes: renameTag(approved.notes, approved.tag, tag)
|
|
21580
21793
|
};
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
notes = yield* artifact("notes:picked", {
|
|
21584
|
-
kind: "release_notes",
|
|
21585
|
-
title: picked.title,
|
|
21586
|
-
text: picked.notes,
|
|
21587
|
-
data: {
|
|
21588
|
-
tag: pickedTag,
|
|
21589
|
-
changeRequests: picked.changeRequests,
|
|
21590
|
-
...input.releaseScope === undefined ? undefined : { shipped: shippedScope(input.releaseScope) }
|
|
21591
|
-
}
|
|
21592
|
-
});
|
|
21794
|
+
notes = yield* recordNotes(`notes:${round}`);
|
|
21795
|
+
released = yield* publish(`tag:${round}`);
|
|
21593
21796
|
}
|
|
21594
|
-
drafted = picked;
|
|
21595
|
-
tag = pickedTag;
|
|
21596
|
-
const released = yield* release2("tag", {
|
|
21597
|
-
tag,
|
|
21598
|
-
revision,
|
|
21599
|
-
title: drafted.title,
|
|
21600
|
-
notes: drafted.notes
|
|
21601
|
-
});
|
|
21602
21797
|
const deployed = (step, deployTag) => waitFor(step, {
|
|
21603
21798
|
event: deployEvent,
|
|
21604
21799
|
filter: { tag: deployTag },
|
|
21605
21800
|
timeout: `${input.deployTimeoutMinutes ?? 60} minutes`
|
|
21606
21801
|
}).pipe(map8((deploy) => deploy.payload.status === "failed" ? "deploy_failed" : "deployed"), catchTag2("WaitTimedOut", () => succeed7("timed_out")));
|
|
21607
21802
|
const settled = { tag, notesArtifactId: notes.artifactId, revision: released.revision, url: released.url };
|
|
21608
|
-
const ran = yield*
|
|
21609
|
-
agent: "deployer",
|
|
21610
|
-
prompt: deployPrompt(tag, drafted.previousTag),
|
|
21611
|
-
output: Deployed,
|
|
21612
|
-
timeout: "3 hours"
|
|
21613
|
-
});
|
|
21803
|
+
const ran = yield* runDeploy("run-deploy", { tag, previousTag: drafted.previousTag });
|
|
21614
21804
|
if (ran.status !== "none") {
|
|
21615
21805
|
const status = ran.status === "failed" ? "deploy_failed" : ran.status;
|
|
21616
21806
|
const outcome = {
|
|
@@ -21635,11 +21825,15 @@ ${drafted.notes}`,
|
|
|
21635
21825
|
options,
|
|
21636
21826
|
recommended: "Retry the deploy",
|
|
21637
21827
|
recommendationReason: "A failed or late deploy is often passing, and a retry runs only the failed jobs of the same tag.",
|
|
21638
|
-
default:
|
|
21639
|
-
timeout: "1 hour"
|
|
21828
|
+
default: null
|
|
21640
21829
|
});
|
|
21641
21830
|
if (answer === "Leave it")
|
|
21642
|
-
return {
|
|
21831
|
+
return {
|
|
21832
|
+
status,
|
|
21833
|
+
reason: `${tag} at ${released.revision} was left undeployed`,
|
|
21834
|
+
leftUndeployed: true,
|
|
21835
|
+
...settled
|
|
21836
|
+
};
|
|
21643
21837
|
if (answer === "Retry the deploy") {
|
|
21644
21838
|
yield* rerunPipeline(`deploy:rerun-${round}`, { ref: tag });
|
|
21645
21839
|
status = yield* deployed(`deploy:retry-${round}`, tag);
|
|
@@ -21662,6 +21856,7 @@ ${drafted.notes}`,
|
|
|
21662
21856
|
}).pipe(map8((output) => ({
|
|
21663
21857
|
...output,
|
|
21664
21858
|
...input.releaseWhen === undefined ? undefined : { releaseWhen: input.releaseWhen },
|
|
21859
|
+
...input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo },
|
|
21665
21860
|
...input.releaseScope === undefined ? undefined : { shipped: shippedScope(input.releaseScope) }
|
|
21666
21861
|
})))
|
|
21667
21862
|
});
|
|
@@ -21675,6 +21870,8 @@ var ShepherdOutput = Struct({
|
|
|
21675
21870
|
unsettled: optional2(ArraySchema(String5)),
|
|
21676
21871
|
release: optional2(Struct({ runStatus: String5, reason: String5, tag: optional2(String5) })),
|
|
21677
21872
|
releaseWhen: optional2(ResolvedReleaseTrigger),
|
|
21873
|
+
deliversTo: optional2(ResolvedDeliveryTarget),
|
|
21874
|
+
epicLanding: optional2(Struct({ status: String5, reason: String5 })),
|
|
21678
21875
|
handBack: optional2(Struct({
|
|
21679
21876
|
changeRequestId: String5,
|
|
21680
21877
|
words: String5,
|
|
@@ -21683,11 +21880,105 @@ var ShepherdOutput = Struct({
|
|
|
21683
21880
|
}))
|
|
21684
21881
|
});
|
|
21685
21882
|
|
|
21883
|
+
// src/land-epic.ts
|
|
21884
|
+
var LandEpicInput = Struct({
|
|
21885
|
+
taskId: String5,
|
|
21886
|
+
landsEpic: optional2(Boolean3),
|
|
21887
|
+
merge: optional2(Boolean3),
|
|
21888
|
+
continuing: optional2(Continuing),
|
|
21889
|
+
...DeliveryFields
|
|
21890
|
+
});
|
|
21891
|
+
var LandEpicOutput = Struct({
|
|
21892
|
+
status: Literals([
|
|
21893
|
+
"not_epic",
|
|
21894
|
+
"synced",
|
|
21895
|
+
"landed",
|
|
21896
|
+
"conflict",
|
|
21897
|
+
"opened"
|
|
21898
|
+
]),
|
|
21899
|
+
reason: String5,
|
|
21900
|
+
changeRequest: optional2(ChangeRequestResult),
|
|
21901
|
+
landed: optional2(ShepherdOutput),
|
|
21902
|
+
deliversTo: optional2(ResolvedDeliveryTarget)
|
|
21903
|
+
});
|
|
21904
|
+
var landEpic = defineLoop({
|
|
21905
|
+
id: "land-epic",
|
|
21906
|
+
version: "1.0.0",
|
|
21907
|
+
title: "Land epic",
|
|
21908
|
+
input: LandEpicInput,
|
|
21909
|
+
output: LandEpicOutput,
|
|
21910
|
+
agents: { implementer: "implementer" },
|
|
21911
|
+
checkout: "write",
|
|
21912
|
+
capabilities: ["agent_work", "change_request", "write_back", "call"],
|
|
21913
|
+
calls: () => [shepherd_default],
|
|
21914
|
+
when: [{ event: "epic.ready", input: { taskId: "taskId" } }],
|
|
21915
|
+
run: (input) => gen2(function* () {
|
|
21916
|
+
const epic = epicOf(input);
|
|
21917
|
+
const recorded = input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo };
|
|
21918
|
+
if (epic === undefined)
|
|
21919
|
+
return {
|
|
21920
|
+
status: "not_epic",
|
|
21921
|
+
reason: input.deliversTo === undefined ? "The Task delivers to no epic branch" : `The Task lands ${input.deliversTo.target === "epic_branch" ? "on no epic" : "on the default branch"}, as ${deliveryLayerWords[input.deliversTo.layer]} says`,
|
|
21922
|
+
...recorded
|
|
21923
|
+
};
|
|
21924
|
+
if (epic.done)
|
|
21925
|
+
return {
|
|
21926
|
+
status: "landed",
|
|
21927
|
+
reason: `Epic ${epic.key} is done: its ChangeRequest merged into ${epic.defaultBranch}`,
|
|
21928
|
+
...recorded
|
|
21929
|
+
};
|
|
21930
|
+
const synced = yield* syncBase("sync-default", { agent: "implementer", target: epic.defaultBranch });
|
|
21931
|
+
if (synced.status === "conflict")
|
|
21932
|
+
return {
|
|
21933
|
+
status: "conflict",
|
|
21934
|
+
reason: `${epic.defaultBranch} conflicts with ${epic.branch} in ${synced.files.join(", ")}: ${synced.reason}`,
|
|
21935
|
+
...recorded
|
|
21936
|
+
};
|
|
21937
|
+
if (!epic.subTasksDone && input.continuing === undefined)
|
|
21938
|
+
return {
|
|
21939
|
+
status: "synced",
|
|
21940
|
+
reason: `${epic.branch} is up to date with ${epic.defaultBranch}; ${epic.key} lands once every sub-task is done`,
|
|
21941
|
+
...recorded
|
|
21942
|
+
};
|
|
21943
|
+
const opened = input.continuing === undefined ? yield* changeRequest("epic-change-request", {
|
|
21944
|
+
title: `${epic.key} Land the epic`,
|
|
21945
|
+
body: [
|
|
21946
|
+
`Lands epic ${epic.key} on ${epic.defaultBranch}: every sub-task is done, and each merged into ${epic.branch} through its own ChangeRequest.`,
|
|
21947
|
+
`${epic.branch} took in ${epic.defaultBranch} before this opened.`
|
|
21948
|
+
].join(`
|
|
21949
|
+
|
|
21950
|
+
`)
|
|
21951
|
+
}) : { id: input.continuing.changeRequestId, number: input.continuing.number, url: input.continuing.url };
|
|
21952
|
+
if (input.continuing === undefined)
|
|
21953
|
+
yield* writeBack("write-back", { milestone: "change_request_opened", changeRequestUrl: opened.url });
|
|
21954
|
+
const landed = yield* call("shepherd", shepherd_default, {
|
|
21955
|
+
changeRequestId: opened.id,
|
|
21956
|
+
taskId: epic.taskId,
|
|
21957
|
+
...input.merge === undefined ? undefined : { merge: input.merge },
|
|
21958
|
+
...ownDeliveryTarget(input)
|
|
21959
|
+
});
|
|
21960
|
+
return {
|
|
21961
|
+
status: "opened",
|
|
21962
|
+
reason: `${opened.url} lands ${epic.key}; Shepherd ended ${landed.status}: ${landed.reason}`,
|
|
21963
|
+
changeRequest: opened,
|
|
21964
|
+
landed,
|
|
21965
|
+
...recorded
|
|
21966
|
+
};
|
|
21967
|
+
})
|
|
21968
|
+
});
|
|
21969
|
+
var land_epic_default = landEpic;
|
|
21970
|
+
|
|
21686
21971
|
// src/shepherd.ts
|
|
21687
21972
|
var reviewLoop = () => ({ id: "review", input: Input, output: Output });
|
|
21973
|
+
var landEpicLoop = () => ({ id: "land-epic", input: LandEpicInput, output: LandEpicOutput });
|
|
21974
|
+
var landingCalls = 6;
|
|
21975
|
+
var landingRetry = "10 minutes";
|
|
21976
|
+
var landingStatus = (code) => code === "epic_landing" ? "landing" : code === "task_branch_busy" ? "busy" : "refused";
|
|
21688
21977
|
var stepBudget = "45 minutes";
|
|
21689
21978
|
var pipelineRun = "10 minutes";
|
|
21690
21979
|
var targetLooks = 6;
|
|
21980
|
+
var watchLook = "6 hours";
|
|
21981
|
+
var watchLooks = 28;
|
|
21691
21982
|
var roundLimits = { "ci-fix": 1, "head-fix": 2 };
|
|
21692
21983
|
var handBackAnswer = "Hand back to Build";
|
|
21693
21984
|
var Input3 = Struct({
|
|
@@ -21699,7 +21990,8 @@ var Input3 = Struct({
|
|
|
21699
21990
|
continuing: optional2(Continuing),
|
|
21700
21991
|
maxCycles: optional2(Int),
|
|
21701
21992
|
releaseTrigger: optional2(ReleaseTrigger),
|
|
21702
|
-
releaseWhen: optional2(ResolvedReleaseTrigger)
|
|
21993
|
+
releaseWhen: optional2(ResolvedReleaseTrigger),
|
|
21994
|
+
...DeliveryFields
|
|
21703
21995
|
});
|
|
21704
21996
|
var layerWords2 = { run: "this Run", project: "its Project", team: "its Team", workspace: "the Workspace" };
|
|
21705
21997
|
var Output3 = ShepherdOutput;
|
|
@@ -21774,12 +22066,20 @@ var repliesPrompt = (threads) => [
|
|
|
21774
22066
|
var threadKey = (thread) => `${thread.id}:${thread.comments.length}`;
|
|
21775
22067
|
var shepherd_default = defineLoop({
|
|
21776
22068
|
id: "shepherd",
|
|
21777
|
-
version: "1.
|
|
22069
|
+
version: "1.8.0",
|
|
21778
22070
|
title: "Shepherd",
|
|
21779
22071
|
input: Input3,
|
|
21780
22072
|
output: Output3,
|
|
21781
22073
|
agents: { implementer: "implementer" },
|
|
21782
22074
|
checkout: "write",
|
|
22075
|
+
when: [
|
|
22076
|
+
{
|
|
22077
|
+
event: "change_request.pipeline",
|
|
22078
|
+
filter: { status: "failed", source: "forge", linked: true },
|
|
22079
|
+
input: { changeRequestId: "changeRequestId", taskId: "taskId" },
|
|
22080
|
+
optIn: true
|
|
22081
|
+
}
|
|
22082
|
+
],
|
|
21783
22083
|
capabilities: [
|
|
21784
22084
|
"agent_work",
|
|
21785
22085
|
"read_change_request",
|
|
@@ -21792,7 +22092,7 @@ var shepherd_default = defineLoop({
|
|
|
21792
22092
|
"verify",
|
|
21793
22093
|
"claim"
|
|
21794
22094
|
],
|
|
21795
|
-
calls: () => [review_default, release_default],
|
|
22095
|
+
calls: () => [review_default, release_default, land_epic_default],
|
|
21796
22096
|
offers: [{ id: "build", title: "Hand back to Build", loop: "build", from: "handBack" }],
|
|
21797
22097
|
run: (input) => {
|
|
21798
22098
|
const changeRequestId = input.changeRequestId;
|
|
@@ -21812,6 +22112,7 @@ var shepherd_default = defineLoop({
|
|
|
21812
22112
|
let reviewOnceShown;
|
|
21813
22113
|
let pipelineFirst;
|
|
21814
22114
|
const reviewedHeads = new Set;
|
|
22115
|
+
const approvalOf = new Map;
|
|
21815
22116
|
let notCarried;
|
|
21816
22117
|
let behind = false;
|
|
21817
22118
|
let pushed;
|
|
@@ -21820,6 +22121,8 @@ var shepherd_default = defineLoop({
|
|
|
21820
22121
|
const syncedKey = (head, targetHead) => `${head}@${targetHead}`;
|
|
21821
22122
|
const blockerSynced = new Set;
|
|
21822
22123
|
const blockerRechecks = new Map;
|
|
22124
|
+
let lastSync;
|
|
22125
|
+
let targetChecked;
|
|
21823
22126
|
let turn;
|
|
21824
22127
|
let turns = 0;
|
|
21825
22128
|
let passes = 0;
|
|
@@ -21832,9 +22135,36 @@ var shepherd_default = defineLoop({
|
|
|
21832
22135
|
fixRounds: fixRounds(),
|
|
21833
22136
|
replies,
|
|
21834
22137
|
...input.releaseWhen === undefined ? undefined : { releaseWhen: input.releaseWhen },
|
|
22138
|
+
...input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo },
|
|
21835
22139
|
...status === "needs_you" || status === "handed_back" ? { unsettled: [reason] } : undefined
|
|
21836
22140
|
});
|
|
21837
22141
|
const releaseWhen = input.releaseWhen;
|
|
22142
|
+
const epic = epicOf(input);
|
|
22143
|
+
const landEpicAfter = (landing) => gen2(function* () {
|
|
22144
|
+
for (let attempt = 1;; attempt++) {
|
|
22145
|
+
const step = attempt === 1 ? "land-epic" : `land-epic:${attempt}`;
|
|
22146
|
+
const called = yield* call(step, landEpicLoop(), {
|
|
22147
|
+
taskId: landing.taskId,
|
|
22148
|
+
...ownDeliveryTarget(input)
|
|
22149
|
+
}).pipe(map8((landed) => ({ status: landed.status, reason: landed.reason })), catchTags2({
|
|
22150
|
+
ChildFailed: (failed) => succeed7({ status: "failed", reason: failed.reason }),
|
|
22151
|
+
StepFailed: (refused) => succeed7({ status: landingStatus(refused.code), reason: refused.reason })
|
|
22152
|
+
}));
|
|
22153
|
+
if (called.status !== "busy")
|
|
22154
|
+
return called;
|
|
22155
|
+
if (attempt === landingCalls)
|
|
22156
|
+
return { status: "refused", reason: called.reason };
|
|
22157
|
+
yield* waitFor(`land-epic-busy:${attempt}`, {
|
|
22158
|
+
event: "change_request.closed",
|
|
22159
|
+
filter: {
|
|
22160
|
+
merged: true,
|
|
22161
|
+
targetBranch: landing.branch,
|
|
22162
|
+
...repository === undefined ? undefined : { repository }
|
|
22163
|
+
},
|
|
22164
|
+
timeout: landingRetry
|
|
22165
|
+
}).pipe(catchTag2("WaitTimedOut", () => void_3));
|
|
22166
|
+
}
|
|
22167
|
+
});
|
|
21838
22168
|
const handBack = (reason, open) => ({
|
|
21839
22169
|
...done("handed_back", reason),
|
|
21840
22170
|
handBack: {
|
|
@@ -21965,6 +22295,7 @@ ${open}`,
|
|
|
21965
22295
|
if (refused !== undefined)
|
|
21966
22296
|
return done("needs_you", `The turn to merge into ${target} was refused: ${refused}`);
|
|
21967
22297
|
const synced = yield* syncBase(`sync:${cycle}`, { agent: "implementer", target });
|
|
22298
|
+
lastSync = synced.status;
|
|
21968
22299
|
if (synced.status === "conflict")
|
|
21969
22300
|
return handBack(`Merging ${target} in conflicts on ${synced.files.join(", ")}: ${synced.reason}`, synced.files.map((file) => `- ${file}`).join(`
|
|
21970
22301
|
`));
|
|
@@ -22009,6 +22340,60 @@ ${open}`,
|
|
|
22009
22340
|
return;
|
|
22010
22341
|
});
|
|
22011
22342
|
const stop = (output) => ({ kind: "stop", output });
|
|
22343
|
+
const watchTarget = (cycle, pipeline, ready) => gen2(function* () {
|
|
22344
|
+
const checks = pipeline.targetChecks ?? [];
|
|
22345
|
+
if (checks.length === 0)
|
|
22346
|
+
return stop(ready);
|
|
22347
|
+
yield* passTurn();
|
|
22348
|
+
const runChecks = (step, targetHead) => gen2(function* () {
|
|
22349
|
+
const checked = yield* verify(step, { revision: pipeline.head, checks }).pipe(catchTag2("StepFailed", (error) => succeed7({ failed: error.reason })));
|
|
22350
|
+
if ("failed" in checked)
|
|
22351
|
+
return stop(done("needs_you", `${checks.join(", ")} could not run against ${target} as it moved: ${checked.failed}`));
|
|
22352
|
+
if (targetHead !== undefined)
|
|
22353
|
+
targetChecked = { head: pipeline.head, targetHead };
|
|
22354
|
+
if (checked.passed)
|
|
22355
|
+
return;
|
|
22356
|
+
const stopped = yield* catchUp(cycle, targetHead);
|
|
22357
|
+
if (stopped !== undefined)
|
|
22358
|
+
return stop(stopped);
|
|
22359
|
+
if (lastSync === "up_to_date")
|
|
22360
|
+
return stop(done("needs_you", `${checks.join(", ")} failed at ${pipeline.head} against ${target}, which has nothing new to merge in`));
|
|
22361
|
+
return { kind: "again" };
|
|
22362
|
+
});
|
|
22363
|
+
const isChecked = (targetHead) => targetHead !== undefined && targetChecked?.head === pipeline.head && targetChecked.targetHead === targetHead;
|
|
22364
|
+
if (!isChecked(pipeline.target?.head)) {
|
|
22365
|
+
const first = yield* runChecks(`target-verify:${cycle}:0`, pipeline.target?.head);
|
|
22366
|
+
if (first !== undefined)
|
|
22367
|
+
return first;
|
|
22368
|
+
}
|
|
22369
|
+
let since = pipeline.readAt;
|
|
22370
|
+
for (let look = 1;look <= watchLooks; look++) {
|
|
22371
|
+
const woke = yield* waitFor(`watch:${cycle}:${look}`, {
|
|
22372
|
+
event: "change_request.closed",
|
|
22373
|
+
filter: {
|
|
22374
|
+
merged: true,
|
|
22375
|
+
...target === "HEAD" ? undefined : { targetBranch: target },
|
|
22376
|
+
...repository === undefined ? undefined : { repository }
|
|
22377
|
+
},
|
|
22378
|
+
or: [{ event: "change_request.closed", filter: { changeRequestId } }],
|
|
22379
|
+
timeout: watchLook,
|
|
22380
|
+
...since === undefined ? undefined : { since }
|
|
22381
|
+
}).pipe(catchTag2("WaitTimedOut", () => undefined_2));
|
|
22382
|
+
if (woke?.payload.changeRequestId === changeRequestId)
|
|
22383
|
+
return stop(woke.payload.merged === true ? done("merged", "A person merged the ChangeRequest") : done("needs_you", "The ChangeRequest was closed"));
|
|
22384
|
+
const again = yield* pipelineStatus(`watch-read:${cycle}:${look}`, { changeRequestId });
|
|
22385
|
+
since = again.readAt ?? since;
|
|
22386
|
+
if (again.head !== pipeline.head)
|
|
22387
|
+
return { kind: "again" };
|
|
22388
|
+
const targetHead = again.target?.head;
|
|
22389
|
+
if (woke === undefined && (targetHead === undefined || isChecked(targetHead)))
|
|
22390
|
+
continue;
|
|
22391
|
+
const ran = yield* runChecks(`target-verify:${cycle}:${look}`, targetHead);
|
|
22392
|
+
if (ran !== undefined)
|
|
22393
|
+
return ran;
|
|
22394
|
+
}
|
|
22395
|
+
return stop(ready);
|
|
22396
|
+
});
|
|
22012
22397
|
const reviewMergedFiles = (cycle, head, files) => gen2(function* () {
|
|
22013
22398
|
yield* passTurn();
|
|
22014
22399
|
const reviewed = yield* call(`review:${cycle}`, reviewLoop(), {
|
|
@@ -22045,6 +22430,7 @@ ${open}`,
|
|
|
22045
22430
|
notCarried = `merging ${target} in, whose files' review passed but did not approve it: ${approval.reason}`;
|
|
22046
22431
|
return { kind: "unapproved" };
|
|
22047
22432
|
}
|
|
22433
|
+
approvalOf.set(head, approval.reviewId);
|
|
22048
22434
|
reviewedHeads.add(head);
|
|
22049
22435
|
return { kind: "approved" };
|
|
22050
22436
|
});
|
|
@@ -22064,6 +22450,7 @@ ${open}`,
|
|
|
22064
22450
|
recommendationReason: "A passing Review of the change is what approved the head Build shipped.",
|
|
22065
22451
|
default: "Wait",
|
|
22066
22452
|
auto: "Review",
|
|
22453
|
+
evidence: { head },
|
|
22067
22454
|
timeout: "1 hour"
|
|
22068
22455
|
});
|
|
22069
22456
|
yield* passTurn();
|
|
@@ -22107,6 +22494,7 @@ ${open}`,
|
|
|
22107
22494
|
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
|
|
22108
22495
|
if (!recorded.approved)
|
|
22109
22496
|
return stop(done("needs_you", `The review of ${head} passed, but did not approve it: ${recorded.reason}`));
|
|
22497
|
+
approvalOf.set(head, recorded.reviewId);
|
|
22110
22498
|
}
|
|
22111
22499
|
reviewedHeads.add(head);
|
|
22112
22500
|
return { kind: "reviewed" };
|
|
@@ -22383,6 +22771,11 @@ ${open}`,
|
|
|
22383
22771
|
continue;
|
|
22384
22772
|
const unapproved = unranAt.get(pipeline.head);
|
|
22385
22773
|
const notRun = unapproved?.notRun ?? input.notRun ?? [];
|
|
22774
|
+
const approvedBy = () => approvalOf.get(pipeline.head) ?? approvalRef(approved);
|
|
22775
|
+
const evidenceAt = (head) => {
|
|
22776
|
+
const review = approvedBy();
|
|
22777
|
+
return { ...review === undefined ? undefined : { review }, head };
|
|
22778
|
+
};
|
|
22386
22779
|
const merge = input.merge === true && notRun.length === 0 ? "Merge" : yield* ask(`merge:${cycle}`, {
|
|
22387
22780
|
prompt: notRun.length === 0 ? "The ChangeRequest is approved, green and mergeable. Merge now?" : `The ChangeRequest is ${unapproved === undefined ? "approved" : "reviewed with nothing blocking but not approved"}, green and mergeable, but verify never ran some of its tests:
|
|
22388
22781
|
${notRun.map((item) => `- ${item}`).join(`
|
|
@@ -22396,11 +22789,15 @@ Merge now?`,
|
|
|
22396
22789
|
recommended: notRun.length === 0 ? "Merge" : "Wait",
|
|
22397
22790
|
recommendationReason: notRun.length === 0 ? "It is approved, green and mergeable, which is everything a merge waits for." : "Nobody has seen those tests pass, so run them by hand before it lands.",
|
|
22398
22791
|
default: "Wait",
|
|
22399
|
-
...notRun.length === 0 ? { auto: "Merge" } : undefined,
|
|
22792
|
+
...notRun.length === 0 ? { auto: "Merge", evidence: evidenceAt(pipeline.head) } : undefined,
|
|
22400
22793
|
timeout: "1 hour"
|
|
22401
22794
|
});
|
|
22402
|
-
if (merge === "Wait")
|
|
22403
|
-
|
|
22795
|
+
if (merge === "Wait") {
|
|
22796
|
+
const watched = yield* watchTarget(cycle, pipeline, done("ready", unapproved === undefined ? "Approved, green and mergeable; left for a person to merge" : "Reviewed, green and mergeable, but verify never ran some of its tests; left for a person to merge"));
|
|
22797
|
+
if (watched.kind === "stop")
|
|
22798
|
+
return watched.output;
|
|
22799
|
+
continue;
|
|
22800
|
+
}
|
|
22404
22801
|
if (unapproved !== undefined) {
|
|
22405
22802
|
const recorded = yield* approveChangeRequest(`head-approve:${cycle}`, {
|
|
22406
22803
|
changeRequestId,
|
|
@@ -22410,6 +22807,7 @@ Merge now?`,
|
|
|
22410
22807
|
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
|
|
22411
22808
|
if (!recorded.approved)
|
|
22412
22809
|
return done("needs_you", `The review of ${pipeline.head} passed, but did not approve it: ${recorded.reason}`);
|
|
22810
|
+
approvalOf.set(pipeline.head, recorded.reviewId);
|
|
22413
22811
|
}
|
|
22414
22812
|
const refused = yield* takeTurn();
|
|
22415
22813
|
if (refused !== undefined)
|
|
@@ -22424,6 +22822,13 @@ Merge now?`,
|
|
|
22424
22822
|
continue;
|
|
22425
22823
|
yield* passTurn();
|
|
22426
22824
|
yield* writeBack("write-back", { milestone: "merged" });
|
|
22825
|
+
if (epic !== undefined && target === epic.branch) {
|
|
22826
|
+
const landing = yield* landEpicAfter(epic);
|
|
22827
|
+
return {
|
|
22828
|
+
...done("merged", `Merged into ${epic.branch} at ${merged.revision}; Release waits for epic ${epic.key} to land on ${epic.defaultBranch}`),
|
|
22829
|
+
epicLanding: landing
|
|
22830
|
+
};
|
|
22831
|
+
}
|
|
22427
22832
|
if (releaseWhen !== undefined && releaseWhen.trigger !== "merge")
|
|
22428
22833
|
return done("merged", `Merged at ${merged.revision}; Release runs when its ${releaseWhen.trigger === "milestone" ? "Milestone" : "Project"} is done, as ${layerWords2[releaseWhen.layer]} says`);
|
|
22429
22834
|
const ship = yield* ask("ship", {
|
|
@@ -22436,13 +22841,17 @@ Merge now?`,
|
|
|
22436
22841
|
recommendationReason: "The merge is approved and green, so it is ready to ship.",
|
|
22437
22842
|
default: "Not now",
|
|
22438
22843
|
auto: "Release",
|
|
22844
|
+
evidence: evidenceAt(merged.revision),
|
|
22439
22845
|
timeout: "1 hour"
|
|
22440
22846
|
});
|
|
22441
22847
|
if (ship === "Not now")
|
|
22442
22848
|
return done("merged", `Merged at ${merged.revision}`);
|
|
22849
|
+
const review = approvedBy();
|
|
22443
22850
|
const released = yield* call("release", release_default, {
|
|
22444
22851
|
revision: merged.revision,
|
|
22445
|
-
...
|
|
22852
|
+
...review === undefined ? undefined : { review },
|
|
22853
|
+
...releaseWhen?.layer === "run" ? { releaseTrigger: releaseWhen.trigger } : undefined,
|
|
22854
|
+
...epic !== undefined && epic.own !== true ? { deliveryTarget: "default_branch" } : ownDeliveryTarget(input)
|
|
22446
22855
|
});
|
|
22447
22856
|
const handedOn = released.status === "gate_failed" && (yield* ask("release-gate-failed", {
|
|
22448
22857
|
prompt: `Merged at ${merged.revision}, but its Release gate failed: ${released.reason}`,
|
|
@@ -22463,7 +22872,7 @@ Merge now?`,
|
|
|
22463
22872
|
...done("merged", `Merged at ${merged.revision}; its Release gate failed, so the next Release ships it`),
|
|
22464
22873
|
release: { runStatus: released.status, reason: released.reason }
|
|
22465
22874
|
};
|
|
22466
|
-
if (released.status !== "deployed" && released.status !== "rejected" && released.status !== "gate_failed" && released.status !== "not_due" && released.status !== "nothing_to_release")
|
|
22875
|
+
if (released.leftUndeployed !== true && released.status !== "deployed" && released.status !== "rejected" && released.status !== "gate_failed" && released.status !== "not_due" && released.status !== "nothing_to_release")
|
|
22467
22876
|
yield* ask("release-failed", {
|
|
22468
22877
|
prompt: `Merged at ${merged.revision}, but its Release ended ${released.status}: ${released.reason}`,
|
|
22469
22878
|
options: [{ value: "Taken over", description: "A person looks at the release and production from here." }],
|
|
@@ -22499,7 +22908,8 @@ var BuildInput = Struct({
|
|
|
22499
22908
|
continuing: optional2(Continuing),
|
|
22500
22909
|
land: optional2(Boolean3),
|
|
22501
22910
|
changeRequestId: optional2(String5),
|
|
22502
|
-
maxRebuilds: optional2(Int.check(isGreaterThanOrEqualTo2(0)))
|
|
22911
|
+
maxRebuilds: optional2(Int.check(isGreaterThanOrEqualTo2(0))),
|
|
22912
|
+
...DeliveryFields
|
|
22503
22913
|
});
|
|
22504
22914
|
var CriterionAnswer = Struct({
|
|
22505
22915
|
criterion: String5,
|
|
@@ -22547,7 +22957,8 @@ var BuildOutput = Struct({
|
|
|
22547
22957
|
notRun: optional2(ArraySchema(String5)),
|
|
22548
22958
|
approval: optional2(ApproveChangeRequestResult),
|
|
22549
22959
|
landed: optional2(ShepherdOutput),
|
|
22550
|
-
next: Struct({ changeRequestId: String5 })
|
|
22960
|
+
next: Struct({ changeRequestId: String5 }),
|
|
22961
|
+
deliversTo: optional2(ResolvedDeliveryTarget)
|
|
22551
22962
|
});
|
|
22552
22963
|
|
|
22553
22964
|
class BuildBlocked extends TaggedError3()("BuildBlocked", {
|
|
@@ -22720,7 +23131,7 @@ var rally = (input) => gen2(function* () {
|
|
|
22720
23131
|
});
|
|
22721
23132
|
var build2 = defineLoop({
|
|
22722
23133
|
id: "build",
|
|
22723
|
-
version: "2.
|
|
23134
|
+
version: "2.7.0",
|
|
22724
23135
|
title: "Build",
|
|
22725
23136
|
input: BuildInput,
|
|
22726
23137
|
output: BuildOutput,
|
|
@@ -22744,7 +23155,10 @@ var build2 = defineLoop({
|
|
|
22744
23155
|
yield* writeBack("write-back:started", { milestone: "started" });
|
|
22745
23156
|
const task = input.words === undefined ? "the Task your brief describes." : `this: ${input.words}`;
|
|
22746
23157
|
const outcome = input.outcome;
|
|
22747
|
-
const
|
|
23158
|
+
const epic = epicOf(input);
|
|
23159
|
+
const target = input.continuing?.targetBranch ?? input.branch ?? epic?.branch;
|
|
23160
|
+
if (epic !== undefined && input.continuing === undefined && input.branch === undefined)
|
|
23161
|
+
yield* deliveryBase("epic-branch");
|
|
22748
23162
|
if (input.changeRequestId !== undefined && input.continuing?.changeRequestId !== input.changeRequestId)
|
|
22749
23163
|
return yield* new BuildTargetMissing({
|
|
22750
23164
|
message: `Kitman did not put this Run on ChangeRequest ${input.changeRequestId}'s branch`
|
|
@@ -22877,7 +23291,8 @@ var build2 = defineLoop({
|
|
|
22877
23291
|
...input.outcome === undefined ? undefined : { outcome: input.outcome },
|
|
22878
23292
|
...input.maxRounds === undefined ? undefined : { maxRounds: input.maxRounds },
|
|
22879
23293
|
changeRequestId: opened.id,
|
|
22880
|
-
land: false
|
|
23294
|
+
land: false,
|
|
23295
|
+
...ownDeliveryTarget(input)
|
|
22881
23296
|
}, { constraints: standing.map(standingConstraint) });
|
|
22882
23297
|
settledAs = rebuilt;
|
|
22883
23298
|
}
|
|
@@ -22885,13 +23300,15 @@ var build2 = defineLoop({
|
|
|
22885
23300
|
changeRequestId: opened.id,
|
|
22886
23301
|
...settledAs.notRun === undefined ? undefined : { notRun: settledAs.notRun },
|
|
22887
23302
|
...input.taskId === undefined ? undefined : { taskId: input.taskId },
|
|
22888
|
-
...input.branch === undefined ? undefined : { branch: input.branch }
|
|
23303
|
+
...input.branch === undefined ? undefined : { branch: input.branch },
|
|
23304
|
+
...ownDeliveryTarget(input)
|
|
22889
23305
|
}) : undefined;
|
|
22890
23306
|
return {
|
|
22891
23307
|
changeRequest: opened,
|
|
22892
23308
|
...settledAs,
|
|
22893
23309
|
...landed === undefined ? undefined : { landed },
|
|
22894
|
-
next: { changeRequestId: opened.id }
|
|
23310
|
+
next: { changeRequestId: opened.id },
|
|
23311
|
+
...input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo }
|
|
22895
23312
|
};
|
|
22896
23313
|
}).pipe(tapError2((error) => error instanceof BuildBlocked ? void_3 : ignore2(writeBack("write-back:failed", { milestone: "failed" }))))
|
|
22897
23314
|
});
|
|
@@ -24490,7 +24907,7 @@ var reportText = (landing, left, heading) => [
|
|
|
24490
24907
|
`);
|
|
24491
24908
|
var sweep_default = defineLoop({
|
|
24492
24909
|
id: "sweep",
|
|
24493
|
-
version: "1.
|
|
24910
|
+
version: "1.2.0",
|
|
24494
24911
|
title: "Sweep",
|
|
24495
24912
|
input: Input11,
|
|
24496
24913
|
output: Output12,
|
|
@@ -24510,7 +24927,15 @@ var sweep_default = defineLoop({
|
|
|
24510
24927
|
merge: notRun.length === 0,
|
|
24511
24928
|
...notRun.length === 0 ? undefined : { notRun },
|
|
24512
24929
|
...input.branch === undefined ? undefined : { branch: input.branch }
|
|
24513
|
-
});
|
|
24930
|
+
}).pipe(catchTag2("StepFailed", (refused) => refused.code === "task_branch_busy" ? succeed7({ held: refused.reason }) : fail7(refused)));
|
|
24931
|
+
if ("held" in landed)
|
|
24932
|
+
return {
|
|
24933
|
+
status: "opened",
|
|
24934
|
+
summary: `${earlier.url}, from an earlier Sweep, is still open, and another Run works its branch, so Sweep left it to that Run: ${landed.held}`,
|
|
24935
|
+
landed: [],
|
|
24936
|
+
left: [],
|
|
24937
|
+
changeRequest: { id: earlier.id, number: earlier.number, url: earlier.url }
|
|
24938
|
+
};
|
|
24514
24939
|
const summary = `${earlier.url}, from an earlier Sweep, is still open; Sweep took it on instead of batching again: ${landed.status}. ${landed.reason}`;
|
|
24515
24940
|
const landing = supersededIn(earlier.body);
|
|
24516
24941
|
const settled = afterClosing(landing, [], landed.status === "merged" ? yield* closeSuperseded(landing, earlier.url) : []);
|
|
@@ -24862,6 +25287,7 @@ var kitman_config_default = defineKit({
|
|
|
24862
25287
|
release_default,
|
|
24863
25288
|
research_default,
|
|
24864
25289
|
hindsight_default,
|
|
25290
|
+
land_epic_default,
|
|
24865
25291
|
review_default,
|
|
24866
25292
|
shepherd_default,
|
|
24867
25293
|
sweep_default,
|
|
@@ -24892,11 +25318,6 @@ var kitman_config_default = defineKit({
|
|
|
24892
25318
|
skills: ["git-workflow-and-versioning", "shipping-and-launch"],
|
|
24893
25319
|
instructions: { file: "agents/releaser.md" }
|
|
24894
25320
|
},
|
|
24895
|
-
deployer: {
|
|
24896
|
-
effort: "low",
|
|
24897
|
-
fallbacks,
|
|
24898
|
-
instructions: { file: "agents/deployer.md" }
|
|
24899
|
-
},
|
|
24900
25321
|
investigator: {
|
|
24901
25322
|
effort: "high",
|
|
24902
25323
|
fallbacks,
|
|
@@ -27525,6 +27946,7 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
27525
27946
|
default: optional2(String5),
|
|
27526
27947
|
auto: optional2(String5),
|
|
27527
27948
|
unattendedAuto: optional2(String5),
|
|
27949
|
+
evidence: optional2(QuestionEvidence),
|
|
27528
27950
|
timeoutMillis: optional2(Finite),
|
|
27529
27951
|
deferredName: String5
|
|
27530
27952
|
},
|
|
@@ -27561,7 +27983,8 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
27561
27983
|
samples: Int,
|
|
27562
27984
|
calibrate: Boolean3
|
|
27563
27985
|
})),
|
|
27564
|
-
resolve: optionalKey2(ResolveSpec)
|
|
27986
|
+
resolve: optionalKey2(ResolveSpec),
|
|
27987
|
+
deploy: optionalKey2(DeploySpec)
|
|
27565
27988
|
},
|
|
27566
27989
|
success: Struct({ verificationId: String5 }),
|
|
27567
27990
|
error: RunnerRpcError
|
|
@@ -27709,6 +28132,7 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
27709
28132
|
})),
|
|
27710
28133
|
readAt: optionalKey2(String5),
|
|
27711
28134
|
runnerChecks: optionalKey2(ArraySchema(String5)),
|
|
28135
|
+
targetChecks: optionalKey2(ArraySchema(String5)),
|
|
27712
28136
|
approved: optionalKey2(String5),
|
|
27713
28137
|
repository: optionalKey2(String5),
|
|
27714
28138
|
sourceBranch: optionalKey2(String5),
|
|
@@ -27855,6 +28279,10 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
27855
28279
|
payload: { lease: ProgramLease, repoBindingId: optionalKey2(String5) },
|
|
27856
28280
|
success: Struct({ repoBindingId: String5, branch: String5, revision: String5 }),
|
|
27857
28281
|
error: RunnerRpcError
|
|
28282
|
+
}), make29("DeliveryBase", {
|
|
28283
|
+
payload: { lease: ProgramLease },
|
|
28284
|
+
success: Struct({ repoBindingId: String5, branch: String5, revision: String5 }),
|
|
28285
|
+
error: RunnerRpcError
|
|
27858
28286
|
}), make29("MergeChangeRequest", {
|
|
27859
28287
|
payload: {
|
|
27860
28288
|
lease: ProgramLease,
|
|
@@ -28057,7 +28485,11 @@ var refusedStep = (cause) => {
|
|
|
28057
28485
|
return true;
|
|
28058
28486
|
return isRunnerRpcError(cause) && cause.status >= 400 && cause.status < 500 && !replayStatuses.has(cause.status);
|
|
28059
28487
|
};
|
|
28060
|
-
var requested = (step, request) => request.pipe(catch_2((cause) => refusedStep(cause) ? fail7(new StepFailed({
|
|
28488
|
+
var requested = (step, request) => request.pipe(catch_2((cause) => refusedStep(cause) ? fail7(new StepFailed({
|
|
28489
|
+
step,
|
|
28490
|
+
reason: cause.message,
|
|
28491
|
+
...isRunnerRpcError(cause) ? { code: cause.code } : undefined
|
|
28492
|
+
})) : die4(new JournalWriteFailed({ cause }))), catchDefect2((defect) => defect instanceof Error && isIssue(defect.cause) ? fail7(new StepFailed({
|
|
28061
28493
|
step,
|
|
28062
28494
|
reason: `Kitman cannot take this Step's request: invalid ${refusedFields(defect.cause)}`
|
|
28063
28495
|
})) : die4(defect)));
|
|
@@ -28072,17 +28504,19 @@ var runnerHost = (capabilities) => ({
|
|
|
28072
28504
|
...launch.default === undefined ? undefined : { default: launch.default },
|
|
28073
28505
|
...launch.auto === undefined ? undefined : { auto: launch.auto },
|
|
28074
28506
|
...launch.unattendedAuto === undefined ? undefined : { unattendedAuto: launch.unattendedAuto },
|
|
28507
|
+
...launch.evidence === undefined ? undefined : { evidence: launch.evidence },
|
|
28075
28508
|
...launch.timeoutMillis === undefined ? undefined : { timeoutMillis: launch.timeoutMillis }
|
|
28076
28509
|
})).pipe(asVoid2),
|
|
28077
28510
|
startVerification: (launch) => requested(launch.step, capabilities.startVerification({
|
|
28078
28511
|
step: launch.step,
|
|
28079
|
-
deferredName: (launch.resolve !== undefined ? resolveDeferred : launch.measure === undefined ? verifyDeferred : measureDeferred)(launch.step).name,
|
|
28512
|
+
deferredName: (launch.deploy !== undefined ? deployDeferred : launch.resolve !== undefined ? resolveDeferred : launch.measure === undefined ? verifyDeferred : measureDeferred)(launch.step).name,
|
|
28080
28513
|
...launch.revision === undefined ? undefined : { revision: launch.revision },
|
|
28081
28514
|
...launch.checks === undefined ? undefined : { checks: launch.checks },
|
|
28082
28515
|
...launch.suggested === undefined ? undefined : { suggested: launch.suggested },
|
|
28083
28516
|
...launch.rerunFailed === undefined ? undefined : { rerunFailed: launch.rerunFailed },
|
|
28084
28517
|
...launch.measure === undefined ? undefined : { measure: launch.measure },
|
|
28085
|
-
...launch.resolve === undefined ? undefined : { resolve: launch.resolve }
|
|
28518
|
+
...launch.resolve === undefined ? undefined : { resolve: launch.resolve },
|
|
28519
|
+
...launch.deploy === undefined ? undefined : { deploy: launch.deploy }
|
|
28086
28520
|
})).pipe(asVoid2),
|
|
28087
28521
|
startAgentWork: (launch) => requested(launch.step, capabilities.startAgentStep({
|
|
28088
28522
|
step: launch.step,
|
|
@@ -28197,7 +28631,7 @@ var runnerActivities = (capabilities, services) => ({
|
|
|
28197
28631
|
},
|
|
28198
28632
|
alertTask: { run: (request, step) => requested(step, capabilities.alertTask({ step, ...request })) },
|
|
28199
28633
|
integrationBranch: {
|
|
28200
|
-
run: (request, step) => requested(step, capabilities.integrationBranch(request.repoBindingId))
|
|
28634
|
+
run: (request, step) => requested(step, capabilities.integrationBranch(request.repoBindingId, request.base))
|
|
28201
28635
|
},
|
|
28202
28636
|
transcripts: { run: (request, step) => requested(step, capabilities.readTranscripts({ step, ...request })) },
|
|
28203
28637
|
changeRequestRead: {
|
|
@@ -28298,6 +28732,7 @@ var rpcProgramPorts = (rpc, work) => {
|
|
|
28298
28732
|
...question.default === undefined ? undefined : { default: question.default },
|
|
28299
28733
|
...question.auto === undefined ? undefined : { auto: question.auto },
|
|
28300
28734
|
...question.unattendedAuto === undefined ? undefined : { unattendedAuto: question.unattendedAuto },
|
|
28735
|
+
...question.evidence === undefined ? undefined : { evidence: question.evidence },
|
|
28301
28736
|
...question.timeoutMillis === undefined ? undefined : { timeoutMillis: question.timeoutMillis }
|
|
28302
28737
|
}),
|
|
28303
28738
|
startVerification: (verification) => rpc.startVerification({
|
|
@@ -28309,7 +28744,8 @@ var rpcProgramPorts = (rpc, work) => {
|
|
|
28309
28744
|
...verification.suggested === undefined ? undefined : { suggested: [...verification.suggested] },
|
|
28310
28745
|
...verification.rerunFailed === undefined ? undefined : { rerunFailed: verification.rerunFailed },
|
|
28311
28746
|
...verification.measure === undefined ? undefined : { measure: verification.measure },
|
|
28312
|
-
...verification.resolve === undefined ? undefined : { resolve: { revisions: [...verification.resolve.revisions] } }
|
|
28747
|
+
...verification.resolve === undefined ? undefined : { resolve: { revisions: [...verification.resolve.revisions] } },
|
|
28748
|
+
...verification.deploy === undefined ? undefined : { deploy: verification.deploy }
|
|
28313
28749
|
}),
|
|
28314
28750
|
startAgentStep: ({ secrets, ...step }) => rpc.startAgentStep({ lease, ...step, ...secrets === undefined ? undefined : { secrets: [...secrets] } }),
|
|
28315
28751
|
awaitEvent: (wait) => rpc.awaitEvent({ lease, ...wait }),
|
|
@@ -28335,7 +28771,7 @@ var rpcProgramPorts = (rpc, work) => {
|
|
|
28335
28771
|
...ticket.outcome === undefined ? undefined : { outcome: ticket.outcome }
|
|
28336
28772
|
}))
|
|
28337
28773
|
}),
|
|
28338
|
-
integrationBranch: (repoBindingId) => rpc.integrationBranch({ lease, ...repoBindingId === undefined ? undefined : { repoBindingId } }),
|
|
28774
|
+
integrationBranch: (repoBindingId, base) => base === true ? rpc.deliveryBase({ lease }) : rpc.integrationBranch({ lease, ...repoBindingId === undefined ? undefined : { repoBindingId } }),
|
|
28339
28775
|
alertTask: (request) => rpc.alertTask({ lease, ...request }),
|
|
28340
28776
|
readTranscripts: (request) => rpc.readTranscripts({ lease, ...request }),
|
|
28341
28777
|
pipelineStatus: (request) => rpc.pipelineStatus({ lease, ...request }),
|
|
@@ -28425,6 +28861,7 @@ var makeProgramRpcClient = (options) => gen2(function* () {
|
|
|
28425
28861
|
readProject: (input) => authorized(client.ReadProject(input)),
|
|
28426
28862
|
draftUpdate: (input) => authorized(client.DraftUpdate(input)),
|
|
28427
28863
|
integrationBranch: (input) => authorized(client.IntegrationBranch(input)),
|
|
28864
|
+
deliveryBase: (input) => authorized(client.DeliveryBase(input)),
|
|
28428
28865
|
mergeChangeRequest: (input) => authorized(client.MergeChangeRequest(input)),
|
|
28429
28866
|
closeChangeRequest: (input) => authorized(client.CloseChangeRequest(input)),
|
|
28430
28867
|
approveChangeRequest: (input) => authorized(client.ApproveChangeRequest(input)),
|
|
@@ -30605,4 +31042,4 @@ var runKit = (config, identity, packages) => {
|
|
|
30605
31042
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
30606
31043
|
};
|
|
30607
31044
|
// .kitman-build-entry.ts
|
|
30608
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.11.0
|
|
31045
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.11.0" }, []);
|