@sublang/playbook 0.1.3 → 0.4.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 +98 -30
- package/package.json +24 -23
- package/reference/sdlc/code.playbook/bin/playbook-code.js +278 -0
- package/{code.fsm.d.ts → reference/sdlc/code.playbook/code.fsm.d.ts} +18 -0
- package/{code.fsm.introspect.d.ts → reference/sdlc/code.playbook/code.fsm.introspect.d.ts} +24 -0
- package/{code.fsm.introspect.js → reference/sdlc/code.playbook/code.fsm.introspect.js} +28 -1
- package/{code.fsm.introspect.ts → reference/sdlc/code.playbook/code.fsm.introspect.ts} +73 -6
- package/{code.fsm.js → reference/sdlc/code.playbook/code.fsm.js} +264 -115
- package/{code.fsm.ts → reference/sdlc/code.playbook/code.fsm.ts} +327 -119
- package/{code.gears.md → reference/sdlc/code.playbook/code.gears.md} +17 -16
- package/{code.playbook.d.ts → reference/sdlc/code.playbook/code.playbook.d.ts} +16 -6
- package/{code.playbook.js → reference/sdlc/code.playbook/code.playbook.js} +228 -129
- package/{code.playbook.ts → reference/sdlc/code.playbook/code.playbook.ts} +316 -122
- package/{code.tmux-play.js → reference/sdlc/code.playbook/code.tmux-play.js} +22 -10
- package/{code.tmux-play.ts → reference/sdlc/code.playbook/code.tmux-play.ts} +26 -13
- package/reference/sdlc/code.playbook/playbook-code.config.template.yaml +38 -0
- package/{tmux-play.config.yaml → reference/sdlc/code.playbook/tmux-play.config.yaml} +14 -10
- package/{tmux-play.production.config.yaml → reference/sdlc/code.playbook/tmux-play.production.config.yaml} +7 -4
- package/bin/playbook-code.js +0 -43
- /package/{code.tmux-play.d.ts → reference/sdlc/code.playbook/code.tmux-play.d.ts} +0 -0
|
@@ -34,6 +34,28 @@ export interface CaptainTransition {
|
|
|
34
34
|
readonly index: number;
|
|
35
35
|
readonly target: string;
|
|
36
36
|
readonly guard: TransitionGuard;
|
|
37
|
+
readonly actions: unknown;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AwaitBossReplyInfo {
|
|
41
|
+
readonly stateId: string;
|
|
42
|
+
readonly bossReplyTransitions: ReadonlyArray<BossReplyTransition>;
|
|
43
|
+
readonly transitions: ReadonlyArray<AwaitBossReplyTransition>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface BossReplyTransition {
|
|
47
|
+
readonly index: number;
|
|
48
|
+
readonly target: string;
|
|
49
|
+
readonly guard: TransitionGuard;
|
|
50
|
+
readonly actions: unknown;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface AwaitBossReplyTransition {
|
|
54
|
+
readonly eventType: string;
|
|
55
|
+
readonly index: number;
|
|
56
|
+
readonly target: string;
|
|
57
|
+
readonly guard: TransitionGuard;
|
|
58
|
+
readonly actions: unknown;
|
|
37
59
|
}
|
|
38
60
|
|
|
39
61
|
export type TransitionGuard = (args: {
|
|
@@ -46,6 +68,10 @@ export interface RootEventTable {
|
|
|
46
68
|
readonly continueIr: { readonly target: string };
|
|
47
69
|
readonly summarizeIr: { readonly target: string };
|
|
48
70
|
readonly bossInterruptTargets: ReadonlyArray<string>;
|
|
71
|
+
readonly bossInterruptTargetDescriptions: ReadonlyArray<{
|
|
72
|
+
readonly stateId: string;
|
|
73
|
+
readonly description: string;
|
|
74
|
+
}>;
|
|
49
75
|
}
|
|
50
76
|
|
|
51
77
|
type RawInvoke = {
|
|
@@ -54,9 +80,14 @@ type RawInvoke = {
|
|
|
54
80
|
onDone?: unknown;
|
|
55
81
|
};
|
|
56
82
|
|
|
57
|
-
type RawStateDef = {
|
|
83
|
+
type RawStateDef = {
|
|
84
|
+
description?: unknown;
|
|
85
|
+
invoke?: RawInvoke;
|
|
86
|
+
on?: Record<string, unknown>;
|
|
87
|
+
};
|
|
58
88
|
|
|
59
89
|
type RawArm = { target?: unknown; guard?: TransitionGuard };
|
|
90
|
+
type RawArmWithActions = RawArm & { actions?: unknown };
|
|
60
91
|
|
|
61
92
|
type RawConfig = {
|
|
62
93
|
states?: Record<string, RawStateDef>;
|
|
@@ -82,6 +113,7 @@ export function enumerateCaptainStates(
|
|
|
82
113
|
index,
|
|
83
114
|
target: stripIdPrefix(String(arm.target ?? '')),
|
|
84
115
|
guard: arm.guard ?? alwaysTrue,
|
|
116
|
+
actions: arm.actions,
|
|
85
117
|
}),
|
|
86
118
|
);
|
|
87
119
|
out.push({
|
|
@@ -103,23 +135,58 @@ export function enumerateRootEvents(
|
|
|
103
135
|
{ target?: string }
|
|
104
136
|
>;
|
|
105
137
|
const rootOn = (cfg.on ?? {}) as Record<string, unknown>;
|
|
138
|
+
const bossInterruptTargets = toArmArray(rootOn.BOSS_INTERRUPT).map((arm) =>
|
|
139
|
+
stripIdPrefix(String(arm.target ?? '')),
|
|
140
|
+
);
|
|
106
141
|
return {
|
|
107
142
|
startCoding: { target: stripIdPrefix(String(readyOn.START_CODING?.target ?? '')) },
|
|
108
143
|
continueIr: { target: stripIdPrefix(String(readyOn.CONTINUE_IR?.target ?? '')) },
|
|
109
144
|
summarizeIr: { target: stripIdPrefix(String(readyOn.SUMMARIZE_IR?.target ?? '')) },
|
|
110
|
-
bossInterruptTargets
|
|
111
|
-
|
|
112
|
-
|
|
145
|
+
bossInterruptTargets,
|
|
146
|
+
bossInterruptTargetDescriptions: bossInterruptTargets.map((stateId) => {
|
|
147
|
+
const description = cfg.states?.[stateId]?.description;
|
|
148
|
+
return {
|
|
149
|
+
stateId,
|
|
150
|
+
description: typeof description === 'string' ? description : '',
|
|
151
|
+
};
|
|
152
|
+
}),
|
|
113
153
|
};
|
|
114
154
|
}
|
|
115
155
|
|
|
156
|
+
export function enumerateAwaitBossReply(
|
|
157
|
+
machine: typeof codingMachine,
|
|
158
|
+
): AwaitBossReplyInfo {
|
|
159
|
+
const stateId = 'awaitBossReply';
|
|
160
|
+
const awaitOn = getRawConfig(machine).states?.[stateId]?.on ?? {};
|
|
161
|
+
const transitions = Object.entries(awaitOn).flatMap(([eventType, value]) =>
|
|
162
|
+
toArmArray(value).map(
|
|
163
|
+
(arm, index): AwaitBossReplyTransition => ({
|
|
164
|
+
eventType,
|
|
165
|
+
index,
|
|
166
|
+
target: stripIdPrefix(String(arm.target ?? '')),
|
|
167
|
+
guard: arm.guard ?? alwaysTrue,
|
|
168
|
+
actions: arm.actions,
|
|
169
|
+
}),
|
|
170
|
+
),
|
|
171
|
+
);
|
|
172
|
+
const bossReplyTransitions = toArmArray(awaitOn.BOSS_REPLY).map(
|
|
173
|
+
(arm, index): BossReplyTransition => ({
|
|
174
|
+
index,
|
|
175
|
+
target: stripIdPrefix(String(arm.target ?? '')),
|
|
176
|
+
guard: arm.guard ?? alwaysTrue,
|
|
177
|
+
actions: arm.actions,
|
|
178
|
+
}),
|
|
179
|
+
);
|
|
180
|
+
return { stateId, bossReplyTransitions, transitions };
|
|
181
|
+
}
|
|
182
|
+
|
|
116
183
|
function getRawConfig(machine: typeof codingMachine): RawConfig {
|
|
117
184
|
return (machine as unknown as { config: RawConfig }).config;
|
|
118
185
|
}
|
|
119
186
|
|
|
120
|
-
function toArmArray(value: unknown):
|
|
187
|
+
function toArmArray(value: unknown): RawArmWithActions[] {
|
|
121
188
|
if (value === undefined || value === null) return [];
|
|
122
|
-
return (Array.isArray(value) ? value : [value]) as
|
|
189
|
+
return (Array.isArray(value) ? value : [value]) as RawArmWithActions[];
|
|
123
190
|
}
|
|
124
191
|
|
|
125
192
|
function stripIdPrefix(target: string): string {
|