@sublang/playbook 13.0.0 → 13.2.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.
Files changed (68) hide show
  1. package/README.md +7 -5
  2. package/docs/cli.md +28 -9
  3. package/docs/configuration.md +21 -5
  4. package/docs/embedding.md +1 -1
  5. package/package.json +41 -3
  6. package/reference/sdlc/branch.md +37 -0
  7. package/reference/sdlc/branch.playbook/branch.fsm.d.ts +169 -0
  8. package/reference/sdlc/branch.playbook/branch.fsm.js +325 -0
  9. package/reference/sdlc/branch.playbook/branch.fsm.ts +458 -0
  10. package/reference/sdlc/branch.playbook/branch.gears.md +44 -0
  11. package/reference/sdlc/branch.playbook/branch.playbook.d.ts +20 -0
  12. package/reference/sdlc/branch.playbook/branch.playbook.js +121 -0
  13. package/reference/sdlc/branch.playbook/branch.playbook.ts +217 -0
  14. package/reference/sdlc/branch.playbook/branch.registry.d.ts +40 -0
  15. package/reference/sdlc/branch.playbook/branch.registry.js +63 -0
  16. package/reference/sdlc/branch.playbook/branch.registry.ts +121 -0
  17. package/reference/sdlc/code.md +7 -0
  18. package/reference/sdlc/code.playbook/code.fsm.js +5 -5
  19. package/reference/sdlc/code.playbook/code.fsm.ts +5 -5
  20. package/reference/sdlc/code.playbook/code.gears.md +5 -5
  21. package/reference/sdlc/code.playbook/code.playbook.d.ts +1 -1
  22. package/reference/sdlc/code.playbook/code.playbook.js +6 -16
  23. package/reference/sdlc/code.playbook/code.playbook.ts +7 -17
  24. package/reference/sdlc/code.playbook/playbook-captain.js +4 -1
  25. package/reference/sdlc/code.playbook/playbook-captain.ts +4 -1
  26. package/reference/sdlc/code.playbook/playbook.config.template.yaml +16 -2
  27. package/reference/sdlc/decide.md +2 -0
  28. package/reference/sdlc/decide.playbook/decide.fsm.js +1 -1
  29. package/reference/sdlc/decide.playbook/decide.fsm.ts +1 -1
  30. package/reference/sdlc/decide.playbook/decide.gears.md +2 -2
  31. package/reference/sdlc/decide.playbook/decide.playbook.d.ts +1 -2
  32. package/reference/sdlc/decide.playbook/decide.playbook.js +8 -22
  33. package/reference/sdlc/decide.playbook/decide.playbook.ts +8 -25
  34. package/reference/sdlc/dev.md +45 -4
  35. package/reference/sdlc/dev.playbook/dev.fsm.d.ts +100 -9
  36. package/reference/sdlc/dev.playbook/dev.fsm.js +245 -28
  37. package/reference/sdlc/dev.playbook/dev.fsm.ts +381 -37
  38. package/reference/sdlc/dev.playbook/dev.gears.md +60 -22
  39. package/reference/sdlc/dev.playbook/dev.playbook.d.ts +1 -1
  40. package/reference/sdlc/dev.playbook/dev.playbook.js +20 -18
  41. package/reference/sdlc/dev.playbook/dev.playbook.ts +21 -21
  42. package/reference/sdlc/dev.playbook/dev.registry.d.ts +1 -1
  43. package/reference/sdlc/dev.playbook/dev.registry.js +7 -2
  44. package/reference/sdlc/dev.playbook/dev.registry.ts +7 -2
  45. package/reference/sdlc/pr.md +108 -0
  46. package/reference/sdlc/pr.playbook/pr.fsm.d.ts +352 -0
  47. package/reference/sdlc/pr.playbook/pr.fsm.js +902 -0
  48. package/reference/sdlc/pr.playbook/pr.fsm.ts +1251 -0
  49. package/reference/sdlc/pr.playbook/pr.gears.md +155 -0
  50. package/reference/sdlc/pr.playbook/pr.playbook.d.ts +27 -0
  51. package/reference/sdlc/pr.playbook/pr.playbook.js +133 -0
  52. package/reference/sdlc/pr.playbook/pr.playbook.ts +235 -0
  53. package/reference/sdlc/pr.playbook/pr.registry.d.ts +40 -0
  54. package/reference/sdlc/pr.playbook/pr.registry.js +68 -0
  55. package/reference/sdlc/pr.playbook/pr.registry.ts +124 -0
  56. package/reference/sdlc/review.md +18 -0
  57. package/reference/sdlc/review.playbook/review.fsm.js +8 -8
  58. package/reference/sdlc/review.playbook/review.fsm.ts +8 -8
  59. package/reference/sdlc/review.playbook/review.gears.md +8 -8
  60. package/reference/sdlc/review.playbook/review.playbook.d.ts +1 -1
  61. package/reference/sdlc/review.playbook/review.playbook.js +5 -15
  62. package/reference/sdlc/review.playbook/review.playbook.ts +6 -16
  63. package/slc/link.md +12 -24
  64. package/src/runtime.d.ts +2 -0
  65. package/src/runtime.ts +2 -0
  66. package/src/xstate-playbook-runtime.d.ts +4 -2
  67. package/src/xstate-playbook-runtime.js +18 -13
  68. package/src/xstate-playbook-runtime.ts +26 -14
@@ -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;