@sublang/playbook 13.1.0 → 13.3.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/README.md +7 -5
- package/docs/cli.md +28 -9
- package/docs/configuration.md +27 -14
- package/docs/embedding.md +1 -1
- package/package.json +40 -2
- package/reference/sdlc/branch.md +37 -0
- package/reference/sdlc/branch.playbook/branch.fsm.d.ts +169 -0
- package/reference/sdlc/branch.playbook/branch.fsm.js +325 -0
- package/reference/sdlc/branch.playbook/branch.fsm.ts +458 -0
- package/reference/sdlc/branch.playbook/branch.gears.md +44 -0
- package/reference/sdlc/branch.playbook/branch.playbook.d.ts +20 -0
- package/reference/sdlc/branch.playbook/branch.playbook.js +121 -0
- package/reference/sdlc/branch.playbook/branch.playbook.ts +217 -0
- package/reference/sdlc/branch.playbook/branch.registry.d.ts +40 -0
- package/reference/sdlc/branch.playbook/branch.registry.js +63 -0
- package/reference/sdlc/branch.playbook/branch.registry.ts +121 -0
- package/reference/sdlc/code.playbook/bin/session-host.js +13 -3
- package/reference/sdlc/code.playbook/playbook-captain.d.ts +26 -1
- package/reference/sdlc/code.playbook/playbook-captain.js +218 -6
- package/reference/sdlc/code.playbook/playbook-captain.ts +281 -6
- package/reference/sdlc/code.playbook/playbook.config.template.yaml +21 -8
- package/reference/sdlc/code.playbook/session-host.d.ts +26 -0
- package/reference/sdlc/dev.md +24 -3
- package/reference/sdlc/dev.playbook/dev.fsm.d.ts +100 -9
- package/reference/sdlc/dev.playbook/dev.fsm.js +235 -18
- package/reference/sdlc/dev.playbook/dev.fsm.ts +368 -24
- package/reference/sdlc/dev.playbook/dev.gears.md +45 -7
- package/reference/sdlc/dev.playbook/dev.playbook.js +13 -1
- package/reference/sdlc/dev.playbook/dev.playbook.ts +13 -1
- package/reference/sdlc/dev.playbook/dev.registry.d.ts +1 -1
- package/reference/sdlc/dev.playbook/dev.registry.js +7 -2
- package/reference/sdlc/dev.playbook/dev.registry.ts +7 -2
- package/reference/sdlc/pr.md +108 -0
- package/reference/sdlc/pr.playbook/pr.fsm.d.ts +352 -0
- package/reference/sdlc/pr.playbook/pr.fsm.js +902 -0
- package/reference/sdlc/pr.playbook/pr.fsm.ts +1251 -0
- package/reference/sdlc/pr.playbook/pr.gears.md +155 -0
- package/reference/sdlc/pr.playbook/pr.playbook.d.ts +27 -0
- package/reference/sdlc/pr.playbook/pr.playbook.js +133 -0
- package/reference/sdlc/pr.playbook/pr.playbook.ts +235 -0
- package/reference/sdlc/pr.playbook/pr.registry.d.ts +40 -0
- package/reference/sdlc/pr.playbook/pr.registry.js +68 -0
- package/reference/sdlc/pr.playbook/pr.registry.ts +124 -0
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
// BOSS_REPLY
|
|
10
10
|
// Adjudication: LLM judge for the one Analyst state; planningResult is
|
|
11
11
|
// carried verbatim
|
|
12
|
-
// Nested calls: literal code and
|
|
12
|
+
// Nested calls: literal code, decide, branch, and pr targets through the
|
|
13
|
+
// shared bridge; branch, revision, commit, and pull-request
|
|
14
|
+
// identities enter only from canonical child results
|
|
13
15
|
// Compat: artifact schema 3 / runtime ABI 1
|
|
14
16
|
import { createXStatePlaybookRuntime, composePlayerContinuation, snapshotJsonValue, } from '@sublang/playbook/xstate-runtime';
|
|
15
17
|
import { devMachine, } from './dev.fsm.js';
|
|
@@ -116,6 +118,16 @@ const runtimeSpec = {
|
|
|
116
118
|
fields: { planningResult: 'presentation' },
|
|
117
119
|
repositoryDisposition: 'unchanged',
|
|
118
120
|
},
|
|
121
|
+
// DR-050: reading a GitHub issue during planning is not an effect, so
|
|
122
|
+
// the two pull-request outcomes stay `unchanged` like the plain ones.
|
|
123
|
+
codeViaPullRequest: {
|
|
124
|
+
fields: { planningResult: 'presentation' },
|
|
125
|
+
repositoryDisposition: 'unchanged',
|
|
126
|
+
},
|
|
127
|
+
decideThenCodeViaPullRequest: {
|
|
128
|
+
fields: { planningResult: 'presentation' },
|
|
129
|
+
repositoryDisposition: 'unchanged',
|
|
130
|
+
},
|
|
119
131
|
needsBossReply: {
|
|
120
132
|
fields: { question: 'presentation' },
|
|
121
133
|
repositoryDisposition: 'unchanged',
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
// BOSS_REPLY
|
|
10
10
|
// Adjudication: LLM judge for the one Analyst state; planningResult is
|
|
11
11
|
// carried verbatim
|
|
12
|
-
// Nested calls: literal code and
|
|
12
|
+
// Nested calls: literal code, decide, branch, and pr targets through the
|
|
13
|
+
// shared bridge; branch, revision, commit, and pull-request
|
|
14
|
+
// identities enter only from canonical child results
|
|
13
15
|
// Compat: artifact schema 3 / runtime ABI 1
|
|
14
16
|
|
|
15
17
|
import {
|
|
@@ -205,6 +207,16 @@ const runtimeSpec = {
|
|
|
205
207
|
fields: { planningResult: 'presentation' },
|
|
206
208
|
repositoryDisposition: 'unchanged',
|
|
207
209
|
},
|
|
210
|
+
// DR-050: reading a GitHub issue during planning is not an effect, so
|
|
211
|
+
// the two pull-request outcomes stay `unchanged` like the plain ones.
|
|
212
|
+
codeViaPullRequest: {
|
|
213
|
+
fields: { planningResult: 'presentation' },
|
|
214
|
+
repositoryDisposition: 'unchanged',
|
|
215
|
+
},
|
|
216
|
+
decideThenCodeViaPullRequest: {
|
|
217
|
+
fields: { planningResult: 'presentation' },
|
|
218
|
+
repositoryDisposition: 'unchanged',
|
|
219
|
+
},
|
|
208
220
|
needsBossReply: {
|
|
209
221
|
fields: { question: 'presentation' },
|
|
210
222
|
repositoryDisposition: 'unchanged',
|
|
@@ -29,7 +29,7 @@ export interface DevPlaybookRegistryEntry {
|
|
|
29
29
|
export declare const devStateCountLabels: {
|
|
30
30
|
readonly planAnalysis: "planning round";
|
|
31
31
|
};
|
|
32
|
-
export declare const devCopyPasteGuardNames: readonly ["code", "decideThenCode"];
|
|
32
|
+
export declare const devCopyPasteGuardNames: readonly ["code", "decideThenCode", "codeViaPullRequest", "decideThenCodeViaPullRequest"];
|
|
33
33
|
export declare function devSavedCountsLine(counts: {
|
|
34
34
|
interruptions: number;
|
|
35
35
|
copyPastes: number;
|
|
@@ -7,7 +7,12 @@ import createPlaybookRuntime from './dev.playbook.js';
|
|
|
7
7
|
export const devStateCountLabels = {
|
|
8
8
|
planAnalysis: 'planning round',
|
|
9
9
|
};
|
|
10
|
-
export const devCopyPasteGuardNames = [
|
|
10
|
+
export const devCopyPasteGuardNames = [
|
|
11
|
+
'code',
|
|
12
|
+
'decideThenCode',
|
|
13
|
+
'codeViaPullRequest',
|
|
14
|
+
'decideThenCodeViaPullRequest',
|
|
15
|
+
];
|
|
11
16
|
function countNoun(count, singular, plural = `${singular}s`) {
|
|
12
17
|
return `${count} ${count === 1 ? singular : plural}`;
|
|
13
18
|
}
|
|
@@ -44,7 +49,7 @@ export function validateDevOptions(optionSlice) {
|
|
|
44
49
|
export const devPlaybookRegistryEntry = {
|
|
45
50
|
id: 'dev',
|
|
46
51
|
command: 'dev',
|
|
47
|
-
intent: 'analyze a development request that needs planning before choosing direct implementation or a durable decision first',
|
|
52
|
+
intent: 'analyze a development request that needs planning before choosing direct implementation or a durable decision first, delivered through a pull request when the request names a GitHub issue or asks for one',
|
|
48
53
|
artifactSchema: 3,
|
|
49
54
|
runtimeProfile: Object.freeze({
|
|
50
55
|
kind: 'shared-factory',
|
|
@@ -46,7 +46,12 @@ export const devStateCountLabels = {
|
|
|
46
46
|
planAnalysis: 'planning round',
|
|
47
47
|
} as const;
|
|
48
48
|
|
|
49
|
-
export const devCopyPasteGuardNames = [
|
|
49
|
+
export const devCopyPasteGuardNames = [
|
|
50
|
+
'code',
|
|
51
|
+
'decideThenCode',
|
|
52
|
+
'codeViaPullRequest',
|
|
53
|
+
'decideThenCodeViaPullRequest',
|
|
54
|
+
] as const;
|
|
50
55
|
|
|
51
56
|
function countNoun(
|
|
52
57
|
count: number,
|
|
@@ -99,7 +104,7 @@ export const devPlaybookRegistryEntry: DevPlaybookRegistryEntry = {
|
|
|
99
104
|
id: 'dev',
|
|
100
105
|
command: 'dev',
|
|
101
106
|
intent:
|
|
102
|
-
'analyze a development request that needs planning before choosing direct implementation or a durable decision first',
|
|
107
|
+
'analyze a development request that needs planning before choosing direct implementation or a durable decision first, delivered through a pull request when the request names a GitHub issue or asks for one',
|
|
103
108
|
artifactSchema: 3,
|
|
104
109
|
runtimeProfile: Object.freeze({
|
|
105
110
|
kind: 'shared-factory',
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
<!-- AI agents: do not edit this file without human approval. -->
|
|
4
|
+
|
|
5
|
+
# PR
|
|
6
|
+
|
|
7
|
+
Roles:
|
|
8
|
+
|
|
9
|
+
- Coder
|
|
10
|
+
|
|
11
|
+
The caller supplies:
|
|
12
|
+
|
|
13
|
+
- the original request, including the issue it names, if any;
|
|
14
|
+
- the issue summary;
|
|
15
|
+
- the branch to deliver and the base revision it was created from;
|
|
16
|
+
- the last `code`-owned commit and the exact evaluated repository revision;
|
|
17
|
+
- optional relevant context.
|
|
18
|
+
|
|
19
|
+
`pr` delivers a reviewed branch into the repository default branch through a GitHub pull request: it publishes the branch, waits for the pull request's checks, fixes red checks through playbook `code` no more than once, and merges.
|
|
20
|
+
It changes no files and owns no repository commit; the one fix it may request is owned by `code`.
|
|
21
|
+
The check waits, the fix publication, the merge, and the local update are mechanical steps: each runs one fixed command whose exit status alone decides its two outcomes, reads no conversation, and produces no prose.
|
|
22
|
+
`gh` infers the pull request from the checked-out branch, so no mechanical step needs a runtime value.
|
|
23
|
+
|
|
24
|
+
When the caller gives its input, Captain shall relay the complete caller input in quotes (`>`) to Coder, along with the following instruction:
|
|
25
|
+
|
|
26
|
+
> Original request: <caller-input>
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
Publish the branch and open its pull request without changing any file or making any commit.
|
|
30
|
+
Confirm that the working tree is clean and that the checked-out branch is the branch to deliver, not the repository default branch.
|
|
31
|
+
Push the branch to the repository's GitHub remote with its upstream set; never force-push.
|
|
32
|
+
If an open pull request for this branch already exists, use it; otherwise open one against the repository default branch with `gh pr create`.
|
|
33
|
+
Give the pull request a title naming the change and a body with a summary of what changed and why from the base revision to the last commit, the verification the commits report, and a `Closes #N` line for issue number N when the request names one.
|
|
34
|
+
Report the pull request number and URL exactly.
|
|
35
|
+
If the working tree is not clean, the checked-out branch is wrong, the push is rejected, or the pull request cannot be opened, open nothing further and report the failure with its reason.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The result has two semantic outcomes: opened and not published.
|
|
39
|
+
Each outcome requires affirmative support in Coder's result, and no outcome depends on a fixed presentation format of Coder's reply.
|
|
40
|
+
Every outcome keeps the repository exact: pushing a branch and opening a pull request change neither HEAD's commit nor the working tree.
|
|
41
|
+
For not published, `pr` fails and reports Coder's complete result with its reason to its caller.
|
|
42
|
+
|
|
43
|
+
When the pull request is open and no fix has been attempted, Captain shall wait for the pull request's checks by running exactly the following command in the repository, with no other action and without reading its output:
|
|
44
|
+
|
|
45
|
+
> n=0
|
|
46
|
+
> while gh pr checks 2>&1 | grep -q 'no checks reported'; do
|
|
47
|
+
> n=$((n + 1))
|
|
48
|
+
> [ "$n" -ge 6 ] && exit 0
|
|
49
|
+
> sleep 10
|
|
50
|
+
> done
|
|
51
|
+
> gh pr checks --watch --fail-fast >/dev/null 2>&1
|
|
52
|
+
|
|
53
|
+
The wait has exactly two outcomes decided by the command's exit status alone: checks passed on status zero and checks failed otherwise.
|
|
54
|
+
A pull request whose repository still reports no checks after a brief wait for them to register counts as passed.
|
|
55
|
+
|
|
56
|
+
When the checks fail before any fix attempt, Captain shall call playbook `code` with the original request, the pull request, and the coding request in quotes (`>`):
|
|
57
|
+
|
|
58
|
+
> Original request: <caller-input>
|
|
59
|
+
> Pull request: <pull-request-url>
|
|
60
|
+
> Coding request: The pull request's checks are red on the checked-out branch. Inspect the failing checks with `gh pr checks` and `gh run view --log-failed`, fix their cause on this branch with a minimal change, and make the checks pass.
|
|
61
|
+
|
|
62
|
+
`pr` makes no more than one fix attempt.
|
|
63
|
+
Only after `code` succeeds shall `pr` publish the fix and wait for the checks again.
|
|
64
|
+
When `code` returns an authored abort or failure, or a terminal result that does not prove its success, `pr` shall fail relaying that canonical result and shall leave the pull request open.
|
|
65
|
+
When the nested `code` call fails outside that authored result contract, `pr` shall park as failed and retain the control-plane error instead of reporting an authored outcome.
|
|
66
|
+
|
|
67
|
+
When `code` succeeds, Captain shall publish the fix to the pull request by running exactly the following command in the repository, with no other action and without reading its output:
|
|
68
|
+
|
|
69
|
+
> git push || exit 1
|
|
70
|
+
> n=0
|
|
71
|
+
> until [ "$(gh pr view --json headRefOid --jq .headRefOid 2>/dev/null)" = "$(git rev-parse HEAD)" ]; do
|
|
72
|
+
> n=$((n + 1))
|
|
73
|
+
> [ "$n" -ge 12 ] && exit 1
|
|
74
|
+
> sleep 5
|
|
75
|
+
> done
|
|
76
|
+
|
|
77
|
+
The publication has exactly two outcomes decided by the exit status alone: fix published on status zero, once the pull request's head is the pushed commit, and fix not published otherwise.
|
|
78
|
+
Fix not published is an authored failure that leaves the pull request open.
|
|
79
|
+
|
|
80
|
+
When the fix is published, Captain shall wait for the pull request's checks again by running exactly the same command as the first wait in the repository, with no other action and without reading its output:
|
|
81
|
+
|
|
82
|
+
> n=0
|
|
83
|
+
> while gh pr checks 2>&1 | grep -q 'no checks reported'; do
|
|
84
|
+
> n=$((n + 1))
|
|
85
|
+
> [ "$n" -ge 6 ] && exit 0
|
|
86
|
+
> sleep 10
|
|
87
|
+
> done
|
|
88
|
+
> gh pr checks --watch --fail-fast >/dev/null 2>&1
|
|
89
|
+
|
|
90
|
+
This wait has exactly two outcomes decided by the exit status alone: checks passed on status zero and checks still failing otherwise.
|
|
91
|
+
Checks still failing is an authored failure that leaves the pull request open; there is no second fix attempt.
|
|
92
|
+
|
|
93
|
+
When the checks pass, before or after the one fix attempt, Captain shall merge the pull request by running exactly the following command in the repository, with no other action and without reading its output:
|
|
94
|
+
|
|
95
|
+
> gh pr merge --merge --delete-branch --match-head-commit "$(git rev-parse HEAD)"
|
|
96
|
+
|
|
97
|
+
The merge creates a merge commit on the repository default branch, deletes the remote and local branch, and checks out the local default branch; GitHub closes the linked issue on merge.
|
|
98
|
+
The merge has exactly two outcomes decided by the exit status alone: merged on status zero and merge refused otherwise.
|
|
99
|
+
Merge refused is an authored failure that leaves the pull request in the state GitHub reports: GitHub refused the merge for a conflict, a branch protection, a forbidden merge method, or a head that moved, or the merge landed but the local switch to the default branch or the branch deletion failed.
|
|
100
|
+
|
|
101
|
+
When the pull request is merged, Captain shall bring the local default branch to the merged head by running exactly the following command in the repository, with no other action and without reading its output:
|
|
102
|
+
|
|
103
|
+
> git pull --ff-only
|
|
104
|
+
|
|
105
|
+
The update has exactly two outcomes decided by the exit status alone: local default updated on status zero and local default not updated otherwise.
|
|
106
|
+
Both complete `pr`: the pull request is merged either way, and the result states whether the local default branch was fast-forwarded to the merged head.
|
|
107
|
+
|
|
108
|
+
On completion, `pr` returns the pull request number and URL, the fact that the pull request is merged, and whether the local default branch was fast-forwarded to the merged head.
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
2
|
+
readonly [key: string]: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
export type PrStateId = 'openPullRequest' | 'waitForChecks' | 'fixChecks' | 'publishFix' | 'waitForChecksAfterFix' | 'mergePullRequest' | 'updateLocalDefault';
|
|
5
|
+
export type PrSourceItem = 'PR-1' | 'PR-2' | 'PR-3' | 'PR-4' | 'PR-5' | 'PR-6' | 'PR-7';
|
|
6
|
+
export type PrScriptStateId = 'waitForChecks' | 'publishFix' | 'waitForChecksAfterFix' | 'mergePullRequest' | 'updateLocalDefault';
|
|
7
|
+
export type PrScriptSourceItem = 'PR-2' | 'PR-4' | 'PR-5' | 'PR-6' | 'PR-7';
|
|
8
|
+
export type PrChildPlaybookId = 'code';
|
|
9
|
+
export type PendingBossQuestion = {
|
|
10
|
+
readonly questionId: 'openPullRequest';
|
|
11
|
+
readonly resumeStateId: 'openPullRequest';
|
|
12
|
+
readonly sourceItem: 'PR-1';
|
|
13
|
+
readonly asker: {
|
|
14
|
+
readonly kind: 'role';
|
|
15
|
+
readonly roleId: 'coder';
|
|
16
|
+
};
|
|
17
|
+
readonly question: string;
|
|
18
|
+
};
|
|
19
|
+
export type PlayerInput = {
|
|
20
|
+
readonly stateId: 'openPullRequest';
|
|
21
|
+
readonly role: 'coder';
|
|
22
|
+
readonly sourceItem: 'PR-1';
|
|
23
|
+
readonly prompt: string;
|
|
24
|
+
readonly result: Readonly<Record<string, string>>;
|
|
25
|
+
readonly callerInput: string;
|
|
26
|
+
readonly pendingBossQuestion?: PendingBossQuestion;
|
|
27
|
+
readonly bossReply?: string;
|
|
28
|
+
};
|
|
29
|
+
export type PlayerOutput = {
|
|
30
|
+
readonly guard: 'opened';
|
|
31
|
+
readonly pullRequest: string;
|
|
32
|
+
readonly pullRequestUrl: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly guard: 'notPublished';
|
|
35
|
+
readonly coderOutput: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly guard: 'needsBossReply';
|
|
38
|
+
readonly question: string;
|
|
39
|
+
};
|
|
40
|
+
export type PlaybookInput = {
|
|
41
|
+
readonly stateId: 'fixChecks';
|
|
42
|
+
readonly sourceItem: 'PR-3';
|
|
43
|
+
readonly playbookId: PrChildPlaybookId;
|
|
44
|
+
readonly text: string;
|
|
45
|
+
};
|
|
46
|
+
export type ScriptInput = {
|
|
47
|
+
readonly stateId: PrScriptStateId;
|
|
48
|
+
readonly sourceItem: PrScriptSourceItem;
|
|
49
|
+
readonly command: string;
|
|
50
|
+
readonly result: Readonly<Record<string, string>>;
|
|
51
|
+
};
|
|
52
|
+
export type ScriptOutput = {
|
|
53
|
+
readonly guard: 'checksPassed';
|
|
54
|
+
readonly exitStatus: number;
|
|
55
|
+
} | {
|
|
56
|
+
readonly guard: 'checksFailed';
|
|
57
|
+
readonly exitStatus: number;
|
|
58
|
+
} | {
|
|
59
|
+
readonly guard: 'fixPublished';
|
|
60
|
+
readonly exitStatus: number;
|
|
61
|
+
} | {
|
|
62
|
+
readonly guard: 'fixNotPublished';
|
|
63
|
+
readonly exitStatus: number;
|
|
64
|
+
} | {
|
|
65
|
+
readonly guard: 'checksStillFailing';
|
|
66
|
+
readonly exitStatus: number;
|
|
67
|
+
} | {
|
|
68
|
+
readonly guard: 'merged';
|
|
69
|
+
readonly exitStatus: number;
|
|
70
|
+
} | {
|
|
71
|
+
readonly guard: 'mergeRefused';
|
|
72
|
+
readonly exitStatus: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly guard: 'localDefaultUpdated';
|
|
75
|
+
readonly exitStatus: number;
|
|
76
|
+
} | {
|
|
77
|
+
readonly guard: 'localDefaultNotUpdated';
|
|
78
|
+
readonly exitStatus: number;
|
|
79
|
+
};
|
|
80
|
+
export type CompactError = {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly message: string;
|
|
83
|
+
};
|
|
84
|
+
/** Sanitized canonical child result relayed as PR's own failure outcome. */
|
|
85
|
+
export type CompletedChildResult = {
|
|
86
|
+
readonly playbookId: PrChildPlaybookId;
|
|
87
|
+
readonly status: 'ok';
|
|
88
|
+
readonly output?: JsonValue;
|
|
89
|
+
} | {
|
|
90
|
+
readonly playbookId: PrChildPlaybookId;
|
|
91
|
+
readonly status: 'aborted' | 'error';
|
|
92
|
+
readonly error: CompactError;
|
|
93
|
+
};
|
|
94
|
+
export type PrPlaybookOutput = {
|
|
95
|
+
readonly status: 'merged';
|
|
96
|
+
/** The pull request number, exactly as Coder reported it. */
|
|
97
|
+
readonly pullRequest: string;
|
|
98
|
+
/** The pull request URL, exactly as Coder reported it. */
|
|
99
|
+
readonly pullRequestUrl: string;
|
|
100
|
+
/** Whether the local default branch was fast-forwarded to the merged head. */
|
|
101
|
+
readonly localDefaultUpdated: boolean;
|
|
102
|
+
} | {
|
|
103
|
+
readonly status: 'not-merged';
|
|
104
|
+
readonly reason: 'not-published';
|
|
105
|
+
/** Coder's complete result carrying the reason. */
|
|
106
|
+
readonly coderOutput: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly status: 'not-merged';
|
|
109
|
+
readonly reason: 'fix-failed';
|
|
110
|
+
readonly pullRequest: string;
|
|
111
|
+
readonly pullRequestUrl: string;
|
|
112
|
+
/** The relayed canonical `code` result that ended the one fix attempt. */
|
|
113
|
+
readonly childResult: CompletedChildResult;
|
|
114
|
+
} | {
|
|
115
|
+
readonly status: 'not-merged';
|
|
116
|
+
readonly reason: 'fix-not-published' | 'checks-failed' | 'merge-refused';
|
|
117
|
+
readonly pullRequest: string;
|
|
118
|
+
readonly pullRequestUrl: string;
|
|
119
|
+
};
|
|
120
|
+
export type PrCompletion = 'merged' | 'not-published' | 'fix-failed' | 'fix-not-published' | 'checks-failed' | 'merge-refused';
|
|
121
|
+
/** The machine reads no input: the caller input arrives on `START_PR`. */
|
|
122
|
+
export type PrInput = Readonly<Record<never, never>>;
|
|
123
|
+
export type PrContext = {
|
|
124
|
+
readonly callerInput?: string;
|
|
125
|
+
readonly pullRequest?: string;
|
|
126
|
+
readonly pullRequestUrl?: string;
|
|
127
|
+
readonly completion?: PrCompletion;
|
|
128
|
+
readonly localDefaultUpdated?: boolean;
|
|
129
|
+
readonly coderOutput?: string;
|
|
130
|
+
readonly childFailure?: CompletedChildResult;
|
|
131
|
+
readonly lastError?: unknown;
|
|
132
|
+
readonly pendingBossQuestion?: PendingBossQuestion;
|
|
133
|
+
readonly bossReply?: string;
|
|
134
|
+
};
|
|
135
|
+
export type PrEvent = {
|
|
136
|
+
readonly type: 'START_PR';
|
|
137
|
+
readonly callerInput: string;
|
|
138
|
+
} | {
|
|
139
|
+
readonly type: 'BOSS_REPLY';
|
|
140
|
+
readonly answer: string;
|
|
141
|
+
readonly questionId?: 'openPullRequest';
|
|
142
|
+
};
|
|
143
|
+
/** PR-3's composed child input: the caller input, the pull request, and the static coding request. */
|
|
144
|
+
export declare function fixChecksCallText(context: PrContext): string;
|
|
145
|
+
export declare const prMachine: import("xstate").StateMachine<PrContext, {
|
|
146
|
+
readonly type: "START_PR";
|
|
147
|
+
readonly callerInput: string;
|
|
148
|
+
} | {
|
|
149
|
+
readonly type: "BOSS_REPLY";
|
|
150
|
+
readonly answer: string;
|
|
151
|
+
readonly questionId?: "openPullRequest";
|
|
152
|
+
}, {
|
|
153
|
+
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<JsonValue | undefined, PlaybookInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<ScriptOutput, ScriptInput, import("xstate").EventObject>> | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
src: "playbook";
|
|
156
|
+
logic: import("xstate").PromiseActorLogic<JsonValue | undefined, PlaybookInput, import("xstate").EventObject>;
|
|
157
|
+
id: string | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
src: "player";
|
|
160
|
+
logic: import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>;
|
|
161
|
+
id: string | undefined;
|
|
162
|
+
} | {
|
|
163
|
+
src: "script";
|
|
164
|
+
logic: import("xstate").PromiseActorLogic<ScriptOutput, ScriptInput, import("xstate").EventObject>;
|
|
165
|
+
id: string | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
type: "playbook.acceptedOutcome";
|
|
168
|
+
params: {
|
|
169
|
+
readonly source: string;
|
|
170
|
+
readonly target: string;
|
|
171
|
+
readonly acceptedOutcome: string;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
type: "rememberActorError";
|
|
175
|
+
params: import("xstate").NonReducibleUnknown;
|
|
176
|
+
} | {
|
|
177
|
+
type: "rememberPendingQuestion";
|
|
178
|
+
params: import("xstate").NonReducibleUnknown;
|
|
179
|
+
} | {
|
|
180
|
+
type: "rememberBossReply";
|
|
181
|
+
params: import("xstate").NonReducibleUnknown;
|
|
182
|
+
} | {
|
|
183
|
+
type: "rememberEmptyBossReplyError";
|
|
184
|
+
params: import("xstate").NonReducibleUnknown;
|
|
185
|
+
} | {
|
|
186
|
+
type: "rememberMalformedPlayerOutput";
|
|
187
|
+
params: import("xstate").NonReducibleUnknown;
|
|
188
|
+
} | {
|
|
189
|
+
type: "completeWithInsufficientCodeResult";
|
|
190
|
+
params: import("xstate").NonReducibleUnknown;
|
|
191
|
+
} | {
|
|
192
|
+
type: "completeWithCodeFailure";
|
|
193
|
+
params: import("xstate").NonReducibleUnknown;
|
|
194
|
+
} | {
|
|
195
|
+
type: "startPr";
|
|
196
|
+
params: import("xstate").NonReducibleUnknown;
|
|
197
|
+
} | {
|
|
198
|
+
type: "rememberPullRequest";
|
|
199
|
+
params: import("xstate").NonReducibleUnknown;
|
|
200
|
+
} | {
|
|
201
|
+
type: "completeNotPublished";
|
|
202
|
+
params: import("xstate").NonReducibleUnknown;
|
|
203
|
+
} | {
|
|
204
|
+
type: "completeFixNotPublished";
|
|
205
|
+
params: import("xstate").NonReducibleUnknown;
|
|
206
|
+
} | {
|
|
207
|
+
type: "completeChecksStillFailing";
|
|
208
|
+
params: import("xstate").NonReducibleUnknown;
|
|
209
|
+
} | {
|
|
210
|
+
type: "completeMergeRefused";
|
|
211
|
+
params: import("xstate").NonReducibleUnknown;
|
|
212
|
+
} | {
|
|
213
|
+
type: "completeMerged";
|
|
214
|
+
params: import("xstate").NonReducibleUnknown;
|
|
215
|
+
} | {
|
|
216
|
+
type: "completeMergedLocalBehind";
|
|
217
|
+
params: import("xstate").NonReducibleUnknown;
|
|
218
|
+
} | {
|
|
219
|
+
type: "rememberMalformedScriptOutput";
|
|
220
|
+
params: {
|
|
221
|
+
readonly sourceItem: PrScriptSourceItem;
|
|
222
|
+
};
|
|
223
|
+
}, {
|
|
224
|
+
type: "needsBossReply";
|
|
225
|
+
params: unknown;
|
|
226
|
+
} | {
|
|
227
|
+
type: "emptyBossReply";
|
|
228
|
+
params: unknown;
|
|
229
|
+
} | {
|
|
230
|
+
type: "authoredCodeFailure";
|
|
231
|
+
params: unknown;
|
|
232
|
+
} | {
|
|
233
|
+
type: "checksPassed";
|
|
234
|
+
params: unknown;
|
|
235
|
+
} | {
|
|
236
|
+
type: "checksFailed";
|
|
237
|
+
params: unknown;
|
|
238
|
+
} | {
|
|
239
|
+
type: "fixPublished";
|
|
240
|
+
params: unknown;
|
|
241
|
+
} | {
|
|
242
|
+
type: "fixNotPublished";
|
|
243
|
+
params: unknown;
|
|
244
|
+
} | {
|
|
245
|
+
type: "checksStillFailing";
|
|
246
|
+
params: unknown;
|
|
247
|
+
} | {
|
|
248
|
+
type: "merged";
|
|
249
|
+
params: unknown;
|
|
250
|
+
} | {
|
|
251
|
+
type: "mergeRefused";
|
|
252
|
+
params: unknown;
|
|
253
|
+
} | {
|
|
254
|
+
type: "localDefaultUpdated";
|
|
255
|
+
params: unknown;
|
|
256
|
+
} | {
|
|
257
|
+
type: "localDefaultNotUpdated";
|
|
258
|
+
params: unknown;
|
|
259
|
+
} | {
|
|
260
|
+
type: "isOpened";
|
|
261
|
+
params: unknown;
|
|
262
|
+
} | {
|
|
263
|
+
type: "isNotPublished";
|
|
264
|
+
params: unknown;
|
|
265
|
+
} | {
|
|
266
|
+
type: "isCodeSuccess";
|
|
267
|
+
params: unknown;
|
|
268
|
+
} | {
|
|
269
|
+
type: "resumesOpenPullRequest";
|
|
270
|
+
params: unknown;
|
|
271
|
+
}, never, "failed" | "awaitBossReply" | "ready" | "openPullRequest" | "waitForChecks" | "fixChecks" | "publishFix" | "waitForChecksAfterFix" | "mergePullRequest" | "updateLocalDefault" | "notPublished" | "fixNotPublished" | "checksStillFailing" | "merged" | "mergeRefused" | "mergedLocalBehind" | "fixFailed", string, Readonly<Record<never, never>>, {
|
|
272
|
+
readonly status: "merged";
|
|
273
|
+
/** The pull request number, exactly as Coder reported it. */
|
|
274
|
+
readonly pullRequest: string;
|
|
275
|
+
/** The pull request URL, exactly as Coder reported it. */
|
|
276
|
+
readonly pullRequestUrl: string;
|
|
277
|
+
/** Whether the local default branch was fast-forwarded to the merged head. */
|
|
278
|
+
readonly localDefaultUpdated: boolean;
|
|
279
|
+
} | {
|
|
280
|
+
readonly status: "not-merged";
|
|
281
|
+
readonly reason: "not-published";
|
|
282
|
+
/** Coder's complete result carrying the reason. */
|
|
283
|
+
readonly coderOutput: string;
|
|
284
|
+
} | {
|
|
285
|
+
readonly status: "not-merged";
|
|
286
|
+
readonly reason: "fix-failed";
|
|
287
|
+
readonly pullRequest: string;
|
|
288
|
+
readonly pullRequestUrl: string;
|
|
289
|
+
/** The relayed canonical `code` result that ended the one fix attempt. */
|
|
290
|
+
readonly childResult: CompletedChildResult;
|
|
291
|
+
} | {
|
|
292
|
+
readonly status: "not-merged";
|
|
293
|
+
readonly reason: "fix-not-published" | "checks-failed" | "merge-refused";
|
|
294
|
+
readonly pullRequest: string;
|
|
295
|
+
readonly pullRequestUrl: string;
|
|
296
|
+
}, import("xstate").EventObject, import("xstate").MetaObject, {
|
|
297
|
+
id: "pr";
|
|
298
|
+
states: {
|
|
299
|
+
readonly ready: {
|
|
300
|
+
id: "ready";
|
|
301
|
+
};
|
|
302
|
+
readonly openPullRequest: {
|
|
303
|
+
id: "openPullRequest";
|
|
304
|
+
};
|
|
305
|
+
readonly waitForChecks: {
|
|
306
|
+
id: "waitForChecks";
|
|
307
|
+
};
|
|
308
|
+
readonly fixChecks: {
|
|
309
|
+
id: "fixChecks";
|
|
310
|
+
};
|
|
311
|
+
readonly publishFix: {
|
|
312
|
+
id: "publishFix";
|
|
313
|
+
};
|
|
314
|
+
readonly waitForChecksAfterFix: {
|
|
315
|
+
id: "waitForChecksAfterFix";
|
|
316
|
+
};
|
|
317
|
+
readonly mergePullRequest: {
|
|
318
|
+
id: "mergePullRequest";
|
|
319
|
+
};
|
|
320
|
+
readonly updateLocalDefault: {
|
|
321
|
+
id: "updateLocalDefault";
|
|
322
|
+
};
|
|
323
|
+
readonly awaitBossReply: {
|
|
324
|
+
id: "awaitBossReply";
|
|
325
|
+
};
|
|
326
|
+
readonly failed: {
|
|
327
|
+
id: "failed";
|
|
328
|
+
};
|
|
329
|
+
readonly merged: {
|
|
330
|
+
id: "merged";
|
|
331
|
+
};
|
|
332
|
+
readonly mergedLocalBehind: {
|
|
333
|
+
id: "mergedLocalBehind";
|
|
334
|
+
};
|
|
335
|
+
readonly notPublished: {
|
|
336
|
+
id: "notPublished";
|
|
337
|
+
};
|
|
338
|
+
readonly fixFailed: {
|
|
339
|
+
id: "fixFailed";
|
|
340
|
+
};
|
|
341
|
+
readonly fixNotPublished: {
|
|
342
|
+
id: "fixNotPublished";
|
|
343
|
+
};
|
|
344
|
+
readonly checksStillFailing: {
|
|
345
|
+
id: "checksStillFailing";
|
|
346
|
+
};
|
|
347
|
+
readonly mergeRefused: {
|
|
348
|
+
id: "mergeRefused";
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
}>;
|
|
352
|
+
export default prMachine;
|