@kitman-sh/software-engineering 0.10.101 → 0.10.102
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 +63 -26
- package/dist/declarations.json +1 -1
- package/package.json +3 -3
- package/src/plan.ts +63 -25
package/dist/bundle.js
CHANGED
|
@@ -19312,11 +19312,15 @@ var IntegrationBranch = Struct({
|
|
|
19312
19312
|
});
|
|
19313
19313
|
var MergeChangeRequestRequest = Struct({
|
|
19314
19314
|
changeRequestId: String5,
|
|
19315
|
-
head: optionalKey2(String5)
|
|
19315
|
+
head: optionalKey2(String5),
|
|
19316
|
+
rebase: optionalKey2(Boolean3)
|
|
19316
19317
|
});
|
|
19317
19318
|
var MergeResult = Union2([
|
|
19318
19319
|
Struct({ status: Literal2("merged"), revision: String5 }),
|
|
19319
|
-
Struct({
|
|
19320
|
+
Struct({
|
|
19321
|
+
status: Literal2("conflict"),
|
|
19322
|
+
reason: optionalKey2(Literals(["conflicts", "behind", "not_ready"]))
|
|
19323
|
+
}),
|
|
19320
19324
|
Struct({ status: Literal2("moved"), head: String5 })
|
|
19321
19325
|
]);
|
|
19322
19326
|
var ApproveChangeRequestRequest = Struct({
|
|
@@ -23394,6 +23398,8 @@ var menuDescriptions = {
|
|
|
23394
23398
|
Refine: "You say what to change and the planner rewrites it.",
|
|
23395
23399
|
Finish: "Ends the Run with the plan as it is."
|
|
23396
23400
|
};
|
|
23401
|
+
var onConflict = ["Rebuild on the integration branch", "Skip"];
|
|
23402
|
+
var onHeld = ["Merge again", ...onConflict];
|
|
23397
23403
|
var onFailure = ["Retry with a steer", "Skip it and its dependents", "Stop here"];
|
|
23398
23404
|
var ticketRules = [
|
|
23399
23405
|
"Each ticket is one Build: a vertical slice an agent can implement, review and deliver as one ChangeRequest. Give it a short unique key, and list in blockedBy the keys of the tickets whose code it needs; tickets never block each other in a cycle. Set repoBindingId only when it changes another repository than the plan, keep one repository per ticket, and no cycle across repositories. Set outcome to the kind of change: feature, bug, refactor, docs, migration, investigation or performance.",
|
|
@@ -23546,28 +23552,55 @@ Merge it once they pass by hand, or skip it and the tickets it blocks?`,
|
|
|
23546
23552
|
if (unverified === "Skip")
|
|
23547
23553
|
return settled(ticket, { status: "skipped", ...delivered, reason: "Verify never ran some of its tests" });
|
|
23548
23554
|
}
|
|
23549
|
-
const
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
}
|
|
23553
|
-
|
|
23554
|
-
|
|
23555
|
-
|
|
23556
|
-
|
|
23557
|
-
|
|
23558
|
-
|
|
23559
|
-
|
|
23560
|
-
|
|
23561
|
-
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
|
|
23565
|
-
|
|
23566
|
-
|
|
23567
|
-
|
|
23568
|
-
|
|
23555
|
+
const rebuild = {
|
|
23556
|
+
value: "Rebuild on the integration branch",
|
|
23557
|
+
description: "Builds the ticket again from the branch as it is now."
|
|
23558
|
+
};
|
|
23559
|
+
const skip = { value: "Skip", description: "Leaves it and the tickets it blocks undelivered." };
|
|
23560
|
+
let choice = "Merge again";
|
|
23561
|
+
let refusal = `It conflicted with ${head.branch}`;
|
|
23562
|
+
for (let again = 0;choice === "Merge again"; again++) {
|
|
23563
|
+
const label = again === 0 ? suffix : `${suffix}:again:${again}`;
|
|
23564
|
+
const merged = yield* mergeChangeRequest(`merge:${name}${label}`, {
|
|
23565
|
+
changeRequestId: built.changeRequest.id,
|
|
23566
|
+
head: built.revision,
|
|
23567
|
+
rebase: true
|
|
23568
|
+
});
|
|
23569
|
+
if (merged.status === "merged")
|
|
23570
|
+
return settled(ticket, { status: "merged", ...delivered });
|
|
23571
|
+
const request = `The ChangeRequest for ${ticket.key} (${built.changeRequest.url})`;
|
|
23572
|
+
if (merged.status === "conflict" && merged.reason === "not_ready") {
|
|
23573
|
+
refusal = `The forge held it back from ${head.branch}`;
|
|
23574
|
+
choice = yield* ask(`conflict:${name}${label}`, {
|
|
23575
|
+
prompt: `${request} cannot merge into ${head.branch} yet: the forge holds it back, as for approvals, unresolved discussions, a draft or a pipeline that must pass first. Merge it again once that is settled, rebuild ${ticket.key} on the integration branch as it is now, or skip it and the tickets it blocks?`,
|
|
23576
|
+
options: [
|
|
23577
|
+
{
|
|
23578
|
+
value: "Merge again",
|
|
23579
|
+
description: "Tries the merge again, for once whatever holds it back is settled."
|
|
23580
|
+
},
|
|
23581
|
+
rebuild,
|
|
23582
|
+
skip
|
|
23583
|
+
],
|
|
23584
|
+
recommended: "Merge again",
|
|
23585
|
+
recommendationReason: "Nothing conflicts, so a rebuild meets the same hold, and skipping also drops every ticket it blocks.",
|
|
23586
|
+
default: "Skip",
|
|
23587
|
+
timeout: "1 hour"
|
|
23588
|
+
});
|
|
23589
|
+
} else {
|
|
23590
|
+
const behind = merged.status === "conflict" && merged.reason === "behind";
|
|
23591
|
+
refusal = `${behind ? "It stayed behind" : "It conflicted with"} ${head.branch}`;
|
|
23592
|
+
choice = yield* ask(`conflict:${name}${label}`, {
|
|
23593
|
+
prompt: `${request} ${merged.status === "moved" ? "changed after it was built" : `${behind ? "is behind" : "conflicts with"} ${head.branch}`}. Rebuild ${ticket.key} on the integration branch as it is now, or skip it and the tickets it blocks?`,
|
|
23594
|
+
options: [rebuild, skip],
|
|
23595
|
+
recommended: "Rebuild on the integration branch",
|
|
23596
|
+
recommendationReason: "A rebuild on the current branch usually resolves a conflict, and skipping also drops every ticket it blocks.",
|
|
23597
|
+
default: "Skip",
|
|
23598
|
+
timeout: "1 hour"
|
|
23599
|
+
});
|
|
23600
|
+
}
|
|
23601
|
+
}
|
|
23569
23602
|
if (choice === "Skip")
|
|
23570
|
-
return settled(ticket, { status: "failed", ...delivered, reason:
|
|
23603
|
+
return settled(ticket, { status: "failed", ...delivered, reason: refusal });
|
|
23571
23604
|
head = yield* integrationBranch(`rebuild-from:${name}:${attempt + 1}`, {
|
|
23572
23605
|
repoBindingId: head.repoBindingId
|
|
23573
23606
|
});
|
|
@@ -27673,11 +27706,15 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
27673
27706
|
lease: ProgramLease,
|
|
27674
27707
|
step: String5,
|
|
27675
27708
|
changeRequestId: String5,
|
|
27676
|
-
head: optionalKey2(String5)
|
|
27709
|
+
head: optionalKey2(String5),
|
|
27710
|
+
rebase: optionalKey2(Boolean3)
|
|
27677
27711
|
},
|
|
27678
27712
|
success: Union2([
|
|
27679
27713
|
Struct({ status: Literal2("merged"), revision: String5 }),
|
|
27680
|
-
Struct({
|
|
27714
|
+
Struct({
|
|
27715
|
+
status: Literal2("conflict"),
|
|
27716
|
+
reason: optionalKey2(Literals(["conflicts", "behind", "not_ready"]))
|
|
27717
|
+
}),
|
|
27681
27718
|
Struct({ status: Literal2("moved"), head: String5 })
|
|
27682
27719
|
]),
|
|
27683
27720
|
error: RunnerRpcError
|
|
@@ -30414,4 +30451,4 @@ var runKit = (config, identity, packages) => {
|
|
|
30414
30451
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
30415
30452
|
};
|
|
30416
30453
|
// .kitman-build-entry.ts
|
|
30417
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.
|
|
30454
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.102" }, []);
|
package/dist/declarations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/software-engineering",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.102",
|
|
4
4
|
"description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"tsconfig.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kitman-sh/sdk": "0.10.
|
|
20
|
+
"@kitman-sh/sdk": "0.10.102",
|
|
21
21
|
"effect": "^4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"kitman": {
|
|
24
24
|
"bundle": "dist/bundle.js",
|
|
25
|
-
"digest": "
|
|
25
|
+
"digest": "790e075dcc25cd2cd6a0d0228fc1ac568b5920efcddb5622dcefe2cccc7102fe",
|
|
26
26
|
"protocolVersion": 5,
|
|
27
27
|
"declarations": "dist/declarations.json",
|
|
28
28
|
"setup": {
|
package/src/plan.ts
CHANGED
|
@@ -106,6 +106,8 @@ const menuDescriptions: Record<Choice, string> = {
|
|
|
106
106
|
|
|
107
107
|
const onConflict = ['Rebuild on the integration branch', 'Skip'] as const
|
|
108
108
|
|
|
109
|
+
const onHeld = ['Merge again', ...onConflict] as const
|
|
110
|
+
|
|
109
111
|
const onUnverified = ['Skip', 'Merge'] as const
|
|
110
112
|
|
|
111
113
|
const onFailure = ['Retry with a steer', 'Skip it and its dependents', 'Stop here'] as const
|
|
@@ -260,8 +262,8 @@ const settled = (ticket: PlanTicket, result: Omit<TicketResult, 'key' | 'title'>
|
|
|
260
262
|
/**
|
|
261
263
|
* Builds a ticket from the integration head, then merges its ChangeRequest into the integration branch. When verify
|
|
262
264
|
* never ran some of its tests, the user chooses to merge it or skip it. On a conflict the user chooses to rebuild from
|
|
263
|
-
* the head as it is now, or to give the ticket up
|
|
264
|
-
* apart from the first try's.
|
|
265
|
+
* the head as it is now, or to give the ticket up; on a merge the forge only holds back, also to merge it again.
|
|
266
|
+
* `steer` is a person's words for a retry; `label` names its Steps apart from the first try's.
|
|
265
267
|
*/
|
|
266
268
|
const buildTicket = (
|
|
267
269
|
ticket: PlanTicket,
|
|
@@ -315,32 +317,68 @@ const buildTicket = (
|
|
|
315
317
|
return settled(ticket, { status: 'skipped', ...delivered, reason: 'Verify never ran some of its tests' })
|
|
316
318
|
}
|
|
317
319
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
})
|
|
320
|
+
const rebuild = {
|
|
321
|
+
value: 'Rebuild on the integration branch',
|
|
322
|
+
description: 'Builds the ticket again from the branch as it is now.'
|
|
323
|
+
} as const
|
|
323
324
|
|
|
324
|
-
|
|
325
|
+
const skip = { value: 'Skip', description: 'Leaves it and the tickets it blocks undelivered.' } as const
|
|
326
|
+
let choice: (typeof onHeld)[number] = 'Merge again'
|
|
327
|
+
let refusal = `It conflicted with ${head.branch}`
|
|
325
328
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
329
|
+
for (let again = 0; choice === 'Merge again'; again++) {
|
|
330
|
+
const label = again === 0 ? suffix : `${suffix}:again:${again}`
|
|
331
|
+
|
|
332
|
+
// Only what the Build verified merges; a commit pushed to its branch since is rebuilt or skipped like a
|
|
333
|
+
// conflict. The integration branch's own ChangeRequest is verified again, so one behind it is rebased onto it.
|
|
334
|
+
const merged = yield* mergeChangeRequest(`merge:${name}${label}`, {
|
|
335
|
+
changeRequestId: built.changeRequest.id,
|
|
336
|
+
head: built.revision,
|
|
337
|
+
rebase: true
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
if (merged.status === 'merged') return settled(ticket, { status: 'merged', ...delivered })
|
|
341
|
+
const request = `The ChangeRequest for ${ticket.key} (${built.changeRequest.url})`
|
|
342
|
+
|
|
343
|
+
if (merged.status === 'conflict' && merged.reason === 'not_ready') {
|
|
344
|
+
refusal = `The forge held it back from ${head.branch}`
|
|
345
|
+
|
|
346
|
+
choice = yield* ask(`conflict:${name}${label}`, {
|
|
347
|
+
prompt: `${request} cannot merge into ${head.branch} yet: the forge holds it back, as for approvals, unresolved discussions, a draft or a pipeline that must pass first. Merge it again once that is settled, rebuild ${ticket.key} on the integration branch as it is now, or skip it and the tickets it blocks?`,
|
|
348
|
+
options: [
|
|
349
|
+
{
|
|
350
|
+
value: 'Merge again',
|
|
351
|
+
description: 'Tries the merge again, for once whatever holds it back is settled.'
|
|
352
|
+
},
|
|
353
|
+
rebuild,
|
|
354
|
+
skip
|
|
355
|
+
] satisfies { readonly value: (typeof onHeld)[number]; readonly description: string }[],
|
|
356
|
+
recommended: 'Merge again',
|
|
357
|
+
recommendationReason:
|
|
358
|
+
'Nothing conflicts, so a rebuild meets the same hold, and skipping also drops every ticket it blocks.',
|
|
359
|
+
default: 'Skip',
|
|
360
|
+
timeout: '1 hour'
|
|
361
|
+
})
|
|
362
|
+
} else {
|
|
363
|
+
const behind = merged.status === 'conflict' && merged.reason === 'behind'
|
|
364
|
+
refusal = `${behind ? 'It stayed behind' : 'It conflicted with'} ${head.branch}`
|
|
365
|
+
|
|
366
|
+
choice = yield* ask(`conflict:${name}${label}`, {
|
|
367
|
+
prompt: `${request} ${merged.status === 'moved' ? 'changed after it was built' : `${behind ? 'is behind' : 'conflicts with'} ${head.branch}`}. Rebuild ${ticket.key} on the integration branch as it is now, or skip it and the tickets it blocks?`,
|
|
368
|
+
options: [rebuild, skip] satisfies {
|
|
369
|
+
readonly value: (typeof onConflict)[number]
|
|
370
|
+
readonly description: string
|
|
371
|
+
}[],
|
|
372
|
+
recommended: 'Rebuild on the integration branch',
|
|
373
|
+
recommendationReason:
|
|
374
|
+
'A rebuild on the current branch usually resolves a conflict, and skipping also drops every ticket it blocks.',
|
|
375
|
+
default: 'Skip',
|
|
376
|
+
timeout: '1 hour'
|
|
377
|
+
})
|
|
378
|
+
}
|
|
379
|
+
}
|
|
341
380
|
|
|
342
|
-
if (choice === 'Skip')
|
|
343
|
-
return settled(ticket, { status: 'failed', ...delivered, reason: `It conflicted with ${head.branch}` })
|
|
381
|
+
if (choice === 'Skip') return settled(ticket, { status: 'failed', ...delivered, reason: refusal })
|
|
344
382
|
|
|
345
383
|
head = yield* integrationBranch(`rebuild-from:${name}:${attempt + 1}`, {
|
|
346
384
|
repoBindingId: head.repoBindingId
|