@lonca/baron-recipes 0.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # @lonca/baron-recipes
2
+
3
+ Baron recipe engine: run declarative YAML workflows over Baron primitives, deterministically.
4
+
5
+ Part of **[Baron](https://github.com/loncadev/baron)** — a platform-agnostic work-orchestration layer for AI coding agents:
6
+ one pane of glass (issues, scm, ci, deploy, notify) across providers, via MCP + CLI.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @lonca/baron-recipes
12
+ ```
13
+
14
+ ## Documentation
15
+
16
+ See the [Baron documentation](https://github.com/loncadev/baron#readme). Source: [`packages/recipes`](https://github.com/loncadev/baron/tree/main/packages/recipes).
17
+
18
+ ## License
19
+
20
+ [Apache-2.0](./LICENSE) © Baron contributors.
@@ -0,0 +1,156 @@
1
+ import { IssuesPort, ScmPort, CiPort, DeployPort, NotifyPort } from '@lonca/baron-core';
2
+ import { KnowledgeLoop } from '@lonca/baron-knowledge-loop';
3
+
4
+ /**
5
+ * The primitive operations a recipe step may invoke, mapped 1:1 onto the issues/scm port methods.
6
+ * Centralized so step `do:` values are not magic strings and the engine dispatch stays exhaustive.
7
+ */
8
+ declare const RECIPE_OPS: {
9
+ readonly issueCreate: "issue.create";
10
+ readonly issueTransition: "issue.transition";
11
+ readonly issueComment: "issue.comment";
12
+ readonly issueLink: "issue.link";
13
+ readonly issueQuery: "issue.query";
14
+ readonly scmBranchCreate: "scm.branch.create";
15
+ readonly scmPrCreate: "scm.pr.create";
16
+ readonly scmPrThread: "scm.pr.thread";
17
+ readonly scmPrStatus: "scm.pr.status";
18
+ readonly ciRunTrigger: "ci.run.trigger";
19
+ readonly ciRunCancel: "ci.run.cancel";
20
+ readonly deployDeployments: "deploy.deployments";
21
+ readonly notifySend: "notify.send";
22
+ readonly learningAppend: "learning.append";
23
+ readonly learningQuery: "learning.query";
24
+ readonly followupAppend: "followup.append";
25
+ readonly followupList: "followup.list";
26
+ };
27
+ type RecipeOp = (typeof RECIPE_OPS)[keyof typeof RECIPE_OPS];
28
+ declare function isRecipeOp(value: string): value is RecipeOp;
29
+ declare const ASK_TYPES: readonly ["text", "confirm", "choice"];
30
+ type AskType = (typeof ASK_TYPES)[number];
31
+ /** A typed prompt for human input (decision #7); rendered per harness by the {@link RecipeAsker}. */
32
+ interface AskSpec {
33
+ /** Context variable the answer is bound to. */
34
+ readonly as: string;
35
+ readonly type: AskType;
36
+ readonly message: string;
37
+ /** Allowed values for `type: choice`. */
38
+ readonly choices?: readonly string[];
39
+ /** When true, a `text` ask may be skipped (yields undefined). */
40
+ readonly optional?: boolean;
41
+ }
42
+ interface AskStep {
43
+ readonly ask: AskSpec;
44
+ }
45
+ interface DoStep {
46
+ readonly do: RecipeOp;
47
+ /** Step parameters; string values may contain `${path}` references into the run context. */
48
+ readonly with?: Record<string, unknown>;
49
+ /** Context variable the step result is bound to. */
50
+ readonly as?: string;
51
+ }
52
+ interface MessageStep {
53
+ readonly message: string;
54
+ }
55
+ type Step = AskStep | DoStep | MessageStep;
56
+ interface Recipe {
57
+ readonly name: string;
58
+ readonly description?: string;
59
+ readonly steps: readonly Step[];
60
+ }
61
+ /** A declared input a recipe gathers via an `ask` step — surfaced so a caller can collect them upfront. */
62
+ interface RecipeInput {
63
+ readonly name: string;
64
+ readonly message: string;
65
+ readonly type: AskType;
66
+ readonly optional: boolean;
67
+ readonly choices?: readonly string[];
68
+ }
69
+ /** The inputs a recipe's `ask` steps gather, in order — used to drive non-interactive runs. */
70
+ declare function recipeInputs(recipe: Recipe): RecipeInput[];
71
+ declare function isAskStep(step: Step): step is AskStep;
72
+ declare function isDoStep(step: Step): step is DoStep;
73
+ declare function isMessageStep(step: Step): step is MessageStep;
74
+ /**
75
+ * Validate an untrusted object (typically `YAML.parse` of a recipe file) into a typed {@link Recipe}.
76
+ * Throws {@link BaronError} (`RECIPE_PARSE`) with an actionable, pathed message on any violation.
77
+ */
78
+ declare function parseRecipe(raw: unknown): Recipe;
79
+ /** Parse a recipe from YAML text. */
80
+ declare function loadRecipe(yamlText: string): Recipe;
81
+
82
+ type RecipeContext = Record<string, unknown>;
83
+ /**
84
+ * Replace `${path}` references in a value against the run context. A string that is exactly a single
85
+ * `${path}` yields the raw resolved value (preserving non-string types and `undefined`, so an
86
+ * optional `parentId: ${parent}` becomes undefined rather than the literal "undefined"); strings
87
+ * with embedded references are interpolated to text. Arrays/objects are walked recursively.
88
+ */
89
+ declare function interpolate(value: unknown, context: RecipeContext): unknown;
90
+
91
+ /**
92
+ * The typed human-input surface a recipe's `ask` steps render through (decision #7). Each harness
93
+ * provides its own: the CLI uses stdin prompts; tests use a scripted answerer. Kept separate from
94
+ * the engine so recipes run without any terminal.
95
+ */
96
+ interface RecipeAsker {
97
+ /** Free-text answer; may resolve to undefined when the ask is optional. */
98
+ text(message: string, optional: boolean): Promise<string | undefined>;
99
+ confirm(message: string): Promise<boolean>;
100
+ /** A single choice from the allowed set. */
101
+ choice(message: string, choices: readonly string[]): Promise<string>;
102
+ /** Surface an informational line (recipe `message` steps). */
103
+ note(message: string): void;
104
+ }
105
+
106
+ interface RecipePorts {
107
+ readonly issues?: IssuesPort;
108
+ readonly scm?: ScmPort;
109
+ readonly ci?: CiPort;
110
+ readonly deploy?: DeployPort;
111
+ readonly notify?: NotifyPort;
112
+ readonly knowledge?: KnowledgeLoop;
113
+ }
114
+ interface RunRecipeOptions {
115
+ readonly ports: RecipePorts;
116
+ readonly asker: RecipeAsker;
117
+ /** Pre-seed context variables; an `ask` whose variable is already set is skipped. */
118
+ readonly inputs?: RecipeContext;
119
+ }
120
+ interface RunRecipeResult {
121
+ /** Final run context: seeded inputs + each `ask`/`do` step's bound variable. */
122
+ readonly context: RecipeContext;
123
+ }
124
+ /**
125
+ * Execute a recipe step by step against the injected ports, threading a context: `ask` steps gather
126
+ * typed human input (skipped when pre-seeded), `do` steps call a primitive and bind its result,
127
+ * `message` steps surface a line. All workflow opinion lives in the recipe; this engine is pure
128
+ * mechanism (invariant #3) and does no role/native translation (that stays in the ports, #4).
129
+ */
130
+ declare function runRecipe(recipe: Recipe, options: RunRecipeOptions): Promise<RunRecipeResult>;
131
+
132
+ /** The recipes Baron ships out of the box, runnable by name (no file path). */
133
+ declare const BUILTIN_RECIPE_NAMES: readonly ["task-start", "task-finish", "ship"];
134
+ type BuiltinRecipeName = (typeof BUILTIN_RECIPE_NAMES)[number];
135
+ declare function isBuiltinRecipe(name: string): name is BuiltinRecipeName;
136
+ /** Raw YAML of a built-in recipe (the canonical file — no inlined copy, so it can never drift). */
137
+ declare function loadBuiltinRecipeText(name: BuiltinRecipeName): string;
138
+ declare function loadBuiltinRecipe(name: BuiltinRecipeName): Recipe;
139
+
140
+ interface RecipeSummary {
141
+ readonly name: string;
142
+ readonly description?: string;
143
+ readonly inputs: RecipeInput[];
144
+ }
145
+ /**
146
+ * Runs Baron's declarative recipes deterministically (the engine enforces order/rules, not the agent),
147
+ * with inputs supplied upfront — so a workflow is one atomic, rule-enforced call. Resolves built-in
148
+ * recipes by name plus any project recipes under `<root>/.baron/recipes/*.yaml`.
149
+ */
150
+ interface RecipeService {
151
+ list(): RecipeSummary[];
152
+ run(name: string, inputs: Record<string, unknown>): Promise<RecipeContext>;
153
+ }
154
+ declare function createRecipeService(ports: RecipePorts, root: string): RecipeService;
155
+
156
+ export { ASK_TYPES, type AskSpec, type AskStep, type AskType, BUILTIN_RECIPE_NAMES, type BuiltinRecipeName, type DoStep, type MessageStep, RECIPE_OPS, type Recipe, type RecipeAsker, type RecipeContext, type RecipeInput, type RecipeOp, type RecipePorts, type RecipeService, type RecipeSummary, type RunRecipeOptions, type RunRecipeResult, type Step, createRecipeService, interpolate, isAskStep, isBuiltinRecipe, isDoStep, isMessageStep, isRecipeOp, loadBuiltinRecipe, loadBuiltinRecipeText, loadRecipe, parseRecipe, recipeInputs, runRecipe };
package/dist/index.js ADDED
@@ -0,0 +1,576 @@
1
+ // src/recipe.ts
2
+ import { BaronError } from "@lonca/baron-core";
3
+ import { parse as parseYaml } from "yaml";
4
+ var RECIPE_OPS = {
5
+ issueCreate: "issue.create",
6
+ issueTransition: "issue.transition",
7
+ issueComment: "issue.comment",
8
+ issueLink: "issue.link",
9
+ issueQuery: "issue.query",
10
+ scmBranchCreate: "scm.branch.create",
11
+ scmPrCreate: "scm.pr.create",
12
+ scmPrThread: "scm.pr.thread",
13
+ scmPrStatus: "scm.pr.status",
14
+ ciRunTrigger: "ci.run.trigger",
15
+ ciRunCancel: "ci.run.cancel",
16
+ deployDeployments: "deploy.deployments",
17
+ notifySend: "notify.send",
18
+ learningAppend: "learning.append",
19
+ learningQuery: "learning.query",
20
+ followupAppend: "followup.append",
21
+ followupList: "followup.list"
22
+ };
23
+ var RECIPE_OP_VALUES = Object.values(RECIPE_OPS);
24
+ function isRecipeOp(value) {
25
+ return RECIPE_OP_VALUES.includes(value);
26
+ }
27
+ var ASK_TYPES = ["text", "confirm", "choice"];
28
+ function recipeInputs(recipe) {
29
+ return recipe.steps.filter(isAskStep).map((step) => ({
30
+ name: step.ask.as,
31
+ message: step.ask.message,
32
+ type: step.ask.type,
33
+ optional: step.ask.optional === true,
34
+ ...step.ask.choices !== void 0 ? { choices: step.ask.choices } : {}
35
+ }));
36
+ }
37
+ function isAskStep(step) {
38
+ return "ask" in step;
39
+ }
40
+ function isDoStep(step) {
41
+ return "do" in step;
42
+ }
43
+ function isMessageStep(step) {
44
+ return "message" in step;
45
+ }
46
+ var PARSE_CODE = "RECIPE_PARSE";
47
+ function fail(message) {
48
+ throw new BaronError(message, PARSE_CODE);
49
+ }
50
+ function isRecord(value) {
51
+ return typeof value === "object" && value !== null && !Array.isArray(value);
52
+ }
53
+ function parseAsk(raw, where) {
54
+ const ask = isRecord(raw) ? raw.ask : void 0;
55
+ if (!isRecord(ask)) fail(`${where}: 'ask' must be an object.`);
56
+ const { as, type, message, choices, optional } = ask;
57
+ if (typeof as !== "string" || as.length === 0)
58
+ fail(`${where}: ask.as must be a non-empty string.`);
59
+ if (typeof type !== "string" || !ASK_TYPES.includes(type)) {
60
+ fail(`${where}: ask.type must be one of ${ASK_TYPES.join(", ")}.`);
61
+ }
62
+ if (typeof message !== "string" || message.length === 0) {
63
+ fail(`${where}: ask.message must be a non-empty string.`);
64
+ }
65
+ if (type === "choice" && (!Array.isArray(choices) || choices.length === 0)) {
66
+ fail(`${where}: ask.choices is required and must be non-empty for a 'choice' ask.`);
67
+ }
68
+ if (choices !== void 0 && (!Array.isArray(choices) || choices.some((c) => typeof c !== "string"))) {
69
+ fail(`${where}: ask.choices must be an array of strings.`);
70
+ }
71
+ if (optional !== void 0 && typeof optional !== "boolean") {
72
+ fail(`${where}: ask.optional must be a boolean.`);
73
+ }
74
+ return {
75
+ ask: {
76
+ as,
77
+ type,
78
+ message,
79
+ ...choices !== void 0 ? { choices } : {},
80
+ ...optional !== void 0 ? { optional } : {}
81
+ }
82
+ };
83
+ }
84
+ function parseDo(raw, where) {
85
+ const op = raw.do;
86
+ if (typeof op !== "string" || !isRecipeOp(op)) {
87
+ fail(`${where}: 'do' must be one of ${RECIPE_OP_VALUES.join(", ")}.`);
88
+ }
89
+ const { with: withParams, as } = raw;
90
+ if (withParams !== void 0 && !isRecord(withParams)) {
91
+ fail(`${where}: 'with' must be an object.`);
92
+ }
93
+ if (as !== void 0 && (typeof as !== "string" || as.length === 0)) {
94
+ fail(`${where}: 'as' must be a non-empty string.`);
95
+ }
96
+ return {
97
+ do: op,
98
+ ...withParams !== void 0 ? { with: withParams } : {},
99
+ ...as !== void 0 ? { as } : {}
100
+ };
101
+ }
102
+ function parseStep(raw, index) {
103
+ const where = `steps[${index}]`;
104
+ if (!isRecord(raw)) fail(`${where} must be an object.`);
105
+ const kinds = ["ask", "do", "message"].filter((kind) => kind in raw);
106
+ if (kinds.length !== 1) {
107
+ fail(
108
+ `${where} must have exactly one of 'ask', 'do', or 'message' (found: ${kinds.join(", ") || "none"}).`
109
+ );
110
+ }
111
+ if ("ask" in raw) return parseAsk(raw, where);
112
+ if ("do" in raw) return parseDo(raw, where);
113
+ if (typeof raw.message !== "string") fail(`${where}: 'message' must be a string.`);
114
+ return { message: raw.message };
115
+ }
116
+ function parseRecipe(raw) {
117
+ if (!isRecord(raw)) fail("recipe must be an object.");
118
+ if (typeof raw.name !== "string" || raw.name.length === 0) {
119
+ fail("recipe.name must be a non-empty string.");
120
+ }
121
+ if (raw.description !== void 0 && typeof raw.description !== "string") {
122
+ fail("recipe.description must be a string.");
123
+ }
124
+ if (!Array.isArray(raw.steps) || raw.steps.length === 0) {
125
+ fail("recipe.steps must be a non-empty array.");
126
+ }
127
+ return {
128
+ name: raw.name,
129
+ ...raw.description !== void 0 ? { description: raw.description } : {},
130
+ steps: raw.steps.map(parseStep)
131
+ };
132
+ }
133
+ function loadRecipe(yamlText) {
134
+ return parseRecipe(parseYaml(yamlText));
135
+ }
136
+
137
+ // src/interpolate.ts
138
+ function isRecord2(value) {
139
+ return typeof value === "object" && value !== null && !Array.isArray(value);
140
+ }
141
+ function resolvePath(context, path) {
142
+ return path.split(".").reduce((acc, key) => isRecord2(acc) ? acc[key] : void 0, context);
143
+ }
144
+ function interpolate(value, context) {
145
+ if (typeof value === "string") {
146
+ const whole = value.match(/^\$\{([^}]+)\}$/);
147
+ if (whole?.[1] !== void 0) {
148
+ return resolvePath(context, whole[1].trim());
149
+ }
150
+ return value.replace(/\$\{([^}]+)\}/g, (_match, path) => {
151
+ const resolved = resolvePath(context, path.trim());
152
+ return resolved === void 0 || resolved === null ? "" : String(resolved);
153
+ });
154
+ }
155
+ if (Array.isArray(value)) {
156
+ return value.map((item) => interpolate(item, context));
157
+ }
158
+ if (isRecord2(value)) {
159
+ const out = {};
160
+ for (const [key, item] of Object.entries(value)) {
161
+ out[key] = interpolate(item, context);
162
+ }
163
+ return out;
164
+ }
165
+ return value;
166
+ }
167
+
168
+ // src/engine.ts
169
+ import {
170
+ BaronError as BaronError2,
171
+ ISSUE_LINK_TYPES,
172
+ WORKFLOW_ROLES,
173
+ WORK_ITEM_TYPE_ROLES,
174
+ isIssueLinkType,
175
+ isWorkItemTypeRole,
176
+ isWorkflowRole
177
+ } from "@lonca/baron-core";
178
+ import {
179
+ isFollowupStatus
180
+ } from "@lonca/baron-knowledge-loop";
181
+ var ARGS = "RECIPE_ARGS";
182
+ function reqStr(params, key, op) {
183
+ const value = params[key];
184
+ if (typeof value !== "string" || value.length === 0) {
185
+ throw new BaronError2(`Step '${op}' requires a non-empty string '${key}'.`, ARGS);
186
+ }
187
+ return value;
188
+ }
189
+ function optStr(params, key, op) {
190
+ const value = params[key];
191
+ if (value === void 0) return void 0;
192
+ if (typeof value !== "string") {
193
+ throw new BaronError2(`Step '${op}' argument '${key}' must be a string.`, ARGS);
194
+ }
195
+ return value;
196
+ }
197
+ function reqRole(params, key, op) {
198
+ const value = reqStr(params, key, op);
199
+ if (!isWorkflowRole(value)) {
200
+ throw new BaronError2(
201
+ `Step '${op}' '${key}'='${value}' is not a role (${WORKFLOW_ROLES.join(", ")}).`,
202
+ ARGS
203
+ );
204
+ }
205
+ return value;
206
+ }
207
+ function reqTypeRole(params, key, op) {
208
+ const value = reqStr(params, key, op);
209
+ if (!isWorkItemTypeRole(value)) {
210
+ throw new BaronError2(
211
+ `Step '${op}' '${key}'='${value}' is not a type role (${WORK_ITEM_TYPE_ROLES.join(", ")}).`,
212
+ ARGS
213
+ );
214
+ }
215
+ return value;
216
+ }
217
+ function reqLinkType(params, key, op) {
218
+ const value = reqStr(params, key, op);
219
+ if (!isIssueLinkType(value)) {
220
+ throw new BaronError2(
221
+ `Step '${op}' '${key}'='${value}' is not a link type (${ISSUE_LINK_TYPES.join(", ")}).`,
222
+ ARGS
223
+ );
224
+ }
225
+ return value;
226
+ }
227
+ function optNum(params, key, op) {
228
+ const value = params[key];
229
+ if (value === void 0) return void 0;
230
+ if (typeof value !== "number" || !Number.isFinite(value)) {
231
+ throw new BaronError2(`Step '${op}' argument '${key}' must be a number.`, ARGS);
232
+ }
233
+ return value;
234
+ }
235
+ function optBool(params, key, op) {
236
+ const value = params[key];
237
+ if (value === void 0) return void 0;
238
+ if (typeof value !== "boolean") {
239
+ throw new BaronError2(`Step '${op}' argument '${key}' must be a boolean.`, ARGS);
240
+ }
241
+ return value;
242
+ }
243
+ function optStrArray(params, key, op) {
244
+ const value = params[key];
245
+ if (value === void 0) return void 0;
246
+ if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
247
+ throw new BaronError2(`Step '${op}' '${key}' must be an array of strings.`, ARGS);
248
+ }
249
+ return value;
250
+ }
251
+ function optStatus(params, op) {
252
+ const value = optStr(params, "status", op);
253
+ if (value === void 0) return void 0;
254
+ if (!isFollowupStatus(value)) {
255
+ throw new BaronError2(`Step '${op}' 'status'='${value}' must be 'open' or 'done'.`, ARGS);
256
+ }
257
+ return value;
258
+ }
259
+ function issues(ports, op) {
260
+ if (ports.issues === void 0) {
261
+ throw new BaronError2(
262
+ `Step '${op}' needs the issues port, which is not configured.`,
263
+ "PORT_UNBOUND"
264
+ );
265
+ }
266
+ return ports.issues;
267
+ }
268
+ function scm(ports, op) {
269
+ if (ports.scm === void 0) {
270
+ throw new BaronError2(
271
+ `Step '${op}' needs the scm port, which is not configured.`,
272
+ "PORT_UNBOUND"
273
+ );
274
+ }
275
+ return ports.scm;
276
+ }
277
+ function knowledge(ports, op) {
278
+ if (ports.knowledge === void 0) {
279
+ throw new BaronError2(
280
+ `Step '${op}' needs the knowledge loop, which is not configured.`,
281
+ "PORT_UNBOUND"
282
+ );
283
+ }
284
+ return ports.knowledge;
285
+ }
286
+ function ci(ports, op) {
287
+ if (ports.ci === void 0) {
288
+ throw new BaronError2(
289
+ `Step '${op}' needs the ci port, which is not configured.`,
290
+ "PORT_UNBOUND"
291
+ );
292
+ }
293
+ return ports.ci;
294
+ }
295
+ function deploy(ports, op) {
296
+ if (ports.deploy === void 0) {
297
+ throw new BaronError2(
298
+ `Step '${op}' needs the deploy port, which is not configured.`,
299
+ "PORT_UNBOUND"
300
+ );
301
+ }
302
+ return ports.deploy;
303
+ }
304
+ function notify(ports, op) {
305
+ if (ports.notify === void 0) {
306
+ throw new BaronError2(
307
+ `Step '${op}' needs the notify port, which is not configured.`,
308
+ "PORT_UNBOUND"
309
+ );
310
+ }
311
+ return ports.notify;
312
+ }
313
+ function optStrRecord(params, key, op) {
314
+ const value = params[key];
315
+ if (value === void 0) return void 0;
316
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
317
+ throw new BaronError2(`Step '${op}' '${key}' must be an object of string values.`, ARGS);
318
+ }
319
+ const out = {};
320
+ for (const [k, v] of Object.entries(value)) {
321
+ if (typeof v !== "string") {
322
+ throw new BaronError2(`Step '${op}' '${key}.${k}' must be a string.`, ARGS);
323
+ }
324
+ out[k] = v;
325
+ }
326
+ return out;
327
+ }
328
+ async function dispatchOp(ports, op, params) {
329
+ switch (op) {
330
+ case RECIPE_OPS.issueCreate:
331
+ return issues(ports, op).create({
332
+ title: reqStr(params, "title", op),
333
+ typeRole: reqTypeRole(params, "typeRole", op),
334
+ ...optStr(params, "body", op) !== void 0 ? { body: optStr(params, "body", op) } : {},
335
+ ...optStr(params, "parentId", op) !== void 0 ? { parentId: optStr(params, "parentId", op) } : {},
336
+ ...optStrArray(params, "labels", op) !== void 0 ? { labels: optStrArray(params, "labels", op) } : {},
337
+ ...optStr(params, "initialRole", op) !== void 0 ? { initialRole: reqRole(params, "initialRole", op) } : {}
338
+ });
339
+ case RECIPE_OPS.issueTransition:
340
+ return issues(ports, op).transition(reqStr(params, "id", op), reqRole(params, "role", op));
341
+ case RECIPE_OPS.issueComment:
342
+ return issues(ports, op).comment(reqStr(params, "id", op), reqStr(params, "body", op));
343
+ case RECIPE_OPS.issueLink:
344
+ return issues(ports, op).link(
345
+ reqStr(params, "fromId", op),
346
+ reqStr(params, "toId", op),
347
+ reqLinkType(params, "type", op)
348
+ );
349
+ case RECIPE_OPS.issueQuery: {
350
+ const limit = optNum(params, "limit", op);
351
+ const query = {
352
+ ...optStr(params, "role", op) !== void 0 ? { role: reqRole(params, "role", op) } : {},
353
+ ...optStr(params, "typeRole", op) !== void 0 ? { typeRole: reqTypeRole(params, "typeRole", op) } : {},
354
+ ...limit !== void 0 ? { limit } : {}
355
+ };
356
+ return issues(ports, op).query(query);
357
+ }
358
+ case RECIPE_OPS.scmBranchCreate:
359
+ return scm(ports, op).createBranch({
360
+ name: reqStr(params, "name", op),
361
+ ...optStr(params, "fromBranch", op) !== void 0 ? { fromBranch: optStr(params, "fromBranch", op) } : {}
362
+ });
363
+ case RECIPE_OPS.scmPrCreate:
364
+ return scm(ports, op).createPullRequest({
365
+ title: reqStr(params, "title", op),
366
+ sourceBranch: reqStr(params, "sourceBranch", op),
367
+ ...optStr(params, "targetBranch", op) !== void 0 ? { targetBranch: optStr(params, "targetBranch", op) } : {},
368
+ ...optStr(params, "body", op) !== void 0 ? { body: optStr(params, "body", op) } : {},
369
+ ...optBool(params, "draft", op) !== void 0 ? { draft: optBool(params, "draft", op) } : {}
370
+ });
371
+ case RECIPE_OPS.scmPrThread:
372
+ return scm(ports, op).addPullRequestThread(
373
+ reqStr(params, "pullRequestId", op),
374
+ reqStr(params, "body", op)
375
+ );
376
+ case RECIPE_OPS.scmPrStatus:
377
+ return scm(ports, op).prStatus(reqStr(params, "pullRequestId", op));
378
+ case RECIPE_OPS.ciRunTrigger: {
379
+ const ref = optStr(params, "ref", op);
380
+ const variables = optStrRecord(params, "variables", op);
381
+ return ci(ports, op).trigger({
382
+ pipelineId: reqStr(params, "pipelineId", op),
383
+ ...ref !== void 0 ? { ref } : {},
384
+ ...variables !== void 0 ? { variables } : {}
385
+ });
386
+ }
387
+ case RECIPE_OPS.ciRunCancel:
388
+ return ci(ports, op).cancel(reqStr(params, "runId", op));
389
+ case RECIPE_OPS.deployDeployments: {
390
+ const environment = optStr(params, "environment", op);
391
+ const limit = optNum(params, "limit", op);
392
+ return deploy(ports, op).deployments({
393
+ ...environment !== void 0 ? { environment } : {},
394
+ ...limit !== void 0 ? { limit } : {}
395
+ });
396
+ }
397
+ case RECIPE_OPS.notifySend: {
398
+ const channel = optStr(params, "channel", op);
399
+ const threadKey = optStr(params, "threadKey", op);
400
+ return notify(ports, op).send({
401
+ text: reqStr(params, "text", op),
402
+ ...channel !== void 0 ? { channel } : {},
403
+ ...threadKey !== void 0 ? { threadKey } : {}
404
+ });
405
+ }
406
+ case RECIPE_OPS.learningAppend: {
407
+ const tags = optStrArray(params, "tags", op);
408
+ return knowledge(ports, op).learningAppend({
409
+ title: reqStr(params, "title", op),
410
+ body: reqStr(params, "body", op),
411
+ ...tags !== void 0 ? { tags } : {}
412
+ });
413
+ }
414
+ case RECIPE_OPS.learningQuery: {
415
+ const tag = optStr(params, "tag", op);
416
+ const text = optStr(params, "text", op);
417
+ const limit = optNum(params, "limit", op);
418
+ return knowledge(ports, op).learningQuery({
419
+ ...tag !== void 0 ? { tag } : {},
420
+ ...text !== void 0 ? { text } : {},
421
+ ...limit !== void 0 ? { limit } : {}
422
+ });
423
+ }
424
+ case RECIPE_OPS.followupAppend: {
425
+ const body = optStr(params, "body", op);
426
+ const tags = optStrArray(params, "tags", op);
427
+ return knowledge(ports, op).followupAppend({
428
+ title: reqStr(params, "title", op),
429
+ ...body !== void 0 ? { body } : {},
430
+ ...tags !== void 0 ? { tags } : {}
431
+ });
432
+ }
433
+ case RECIPE_OPS.followupList: {
434
+ const status = optStatus(params, op);
435
+ const tag = optStr(params, "tag", op);
436
+ const limit = optNum(params, "limit", op);
437
+ return knowledge(ports, op).followupList({
438
+ ...status !== void 0 ? { status } : {},
439
+ ...tag !== void 0 ? { tag } : {},
440
+ ...limit !== void 0 ? { limit } : {}
441
+ });
442
+ }
443
+ default: {
444
+ const unreachable = op;
445
+ throw new BaronError2(`Unhandled recipe op '${String(unreachable)}'.`, "RECIPE_OP");
446
+ }
447
+ }
448
+ }
449
+ async function runRecipe(recipe, options) {
450
+ const context = { ...options.inputs };
451
+ for (const step of recipe.steps) {
452
+ if (isAskStep(step)) {
453
+ const { as, type, message, choices, optional } = step.ask;
454
+ if (context[as] !== void 0) continue;
455
+ if (type === "confirm") {
456
+ context[as] = await options.asker.confirm(message);
457
+ } else if (type === "choice") {
458
+ context[as] = await options.asker.choice(message, choices ?? []);
459
+ } else {
460
+ context[as] = await options.asker.text(message, optional === true);
461
+ }
462
+ continue;
463
+ }
464
+ if (isMessageStep(step)) {
465
+ options.asker.note(String(interpolate(step.message, context)));
466
+ continue;
467
+ }
468
+ if (isDoStep(step)) {
469
+ const params = interpolate(step.with ?? {}, context) ?? {};
470
+ const result = await dispatchOp(options.ports, step.do, params);
471
+ if (step.as !== void 0) context[step.as] = result;
472
+ }
473
+ }
474
+ return { context };
475
+ }
476
+
477
+ // src/builtins.ts
478
+ import { readFileSync } from "fs";
479
+ import { fileURLToPath } from "url";
480
+ var RECIPES_DIR = fileURLToPath(new URL("../recipes/", import.meta.url));
481
+ var BUILTIN_RECIPE_NAMES = ["task-start", "task-finish", "ship"];
482
+ function isBuiltinRecipe(name) {
483
+ return BUILTIN_RECIPE_NAMES.includes(name);
484
+ }
485
+ function loadBuiltinRecipeText(name) {
486
+ return readFileSync(`${RECIPES_DIR}${name}.yaml`, "utf8");
487
+ }
488
+ function loadBuiltinRecipe(name) {
489
+ return loadRecipe(loadBuiltinRecipeText(name));
490
+ }
491
+
492
+ // src/service.ts
493
+ import { existsSync, readFileSync as readFileSync2, readdirSync } from "fs";
494
+ import { BaronError as BaronError3 } from "@lonca/baron-core";
495
+ var RECIPE_DIR_REL = ".baron/recipes";
496
+ var YAML_EXT = ".yaml";
497
+ var nonInteractiveAsker = {
498
+ async text(_message, optional) {
499
+ if (optional) return void 0;
500
+ throw new BaronError3("Recipe needs an input that was not provided.", "RECIPE_INPUT_MISSING");
501
+ },
502
+ async confirm() {
503
+ throw new BaronError3(
504
+ "Recipe needs a confirmation that was not provided.",
505
+ "RECIPE_INPUT_MISSING"
506
+ );
507
+ },
508
+ async choice() {
509
+ throw new BaronError3("Recipe needs a choice that was not provided.", "RECIPE_INPUT_MISSING");
510
+ },
511
+ note() {
512
+ }
513
+ };
514
+ function projectRecipePath(root, name) {
515
+ return `${root}/${RECIPE_DIR_REL}/${name}${YAML_EXT}`;
516
+ }
517
+ function resolveRecipe(name, root) {
518
+ if (isBuiltinRecipe(name)) return loadBuiltinRecipe(name);
519
+ const path = projectRecipePath(root, name);
520
+ if (!existsSync(path)) {
521
+ throw new BaronError3(
522
+ `Unknown recipe '${name}'. Built-ins: ${BUILTIN_RECIPE_NAMES.join(", ")}; or add ${RECIPE_DIR_REL}/${name}${YAML_EXT}.`,
523
+ "RECIPE_NOT_FOUND"
524
+ );
525
+ }
526
+ return loadRecipe(readFileSync2(path, "utf8"));
527
+ }
528
+ function summarize(name, recipe) {
529
+ return {
530
+ name,
531
+ ...recipe.description !== void 0 ? { description: recipe.description } : {},
532
+ inputs: recipeInputs(recipe)
533
+ };
534
+ }
535
+ function createRecipeService(ports, root) {
536
+ return {
537
+ list() {
538
+ const builtins = BUILTIN_RECIPE_NAMES.map((name) => summarize(name, loadBuiltinRecipe(name)));
539
+ const dir = `${root}/${RECIPE_DIR_REL}`;
540
+ const project = !existsSync(dir) ? [] : readdirSync(dir).filter((f) => f.endsWith(YAML_EXT)).map((f) => f.slice(0, -YAML_EXT.length)).filter((name) => !isBuiltinRecipe(name)).map(
541
+ (name) => summarize(name, loadRecipe(readFileSync2(projectRecipePath(root, name), "utf8")))
542
+ );
543
+ return [...builtins, ...project];
544
+ },
545
+ async run(name, inputs) {
546
+ const recipe = resolveRecipe(name, root);
547
+ const missing = recipeInputs(recipe).filter((i) => !(i.type === "text" && i.optional)).filter((i) => inputs[i.name] === void 0);
548
+ if (missing.length > 0) {
549
+ throw new BaronError3(
550
+ `Recipe '${name}' needs input(s): ${missing.map((i) => `${i.name} \u2014 ${i.message}`).join("; ")}.`,
551
+ "RECIPE_INPUT_MISSING"
552
+ );
553
+ }
554
+ const result = await runRecipe(recipe, { ports, asker: nonInteractiveAsker, inputs });
555
+ return result.context;
556
+ }
557
+ };
558
+ }
559
+ export {
560
+ ASK_TYPES,
561
+ BUILTIN_RECIPE_NAMES,
562
+ RECIPE_OPS,
563
+ createRecipeService,
564
+ interpolate,
565
+ isAskStep,
566
+ isBuiltinRecipe,
567
+ isDoStep,
568
+ isMessageStep,
569
+ isRecipeOp,
570
+ loadBuiltinRecipe,
571
+ loadBuiltinRecipeText,
572
+ loadRecipe,
573
+ parseRecipe,
574
+ recipeInputs,
575
+ runRecipe
576
+ };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@lonca/baron-recipes",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "recipes"
17
+ ],
18
+ "dependencies": {
19
+ "yaml": "^2.6.0",
20
+ "@lonca/baron-core": "0.1.0",
21
+ "@lonca/baron-knowledge-loop": "0.1.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.0.0",
25
+ "@lonca/baron-conformance": "0.1.0",
26
+ "@lonca/baron-adapter-github": "0.1.0"
27
+ },
28
+ "description": "Baron recipe engine: run declarative YAML workflows over Baron primitives, deterministically.",
29
+ "keywords": [
30
+ "baron",
31
+ "ai-agents",
32
+ "mcp",
33
+ "work-orchestration",
34
+ "devops",
35
+ "recipes",
36
+ "workflows",
37
+ "yaml"
38
+ ],
39
+ "author": "Baron contributors",
40
+ "homepage": "https://github.com/loncadev/baron#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/loncadev/baron/issues"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/loncadev/baron.git",
47
+ "directory": "packages/recipes"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup src/index.ts --format esm --dts --clean",
51
+ "typecheck": "tsc --noEmit"
52
+ }
53
+ }
@@ -0,0 +1,27 @@
1
+ name: ship
2
+ description: Open a draft PR for a branch, move the issue to review, trigger its CI pipeline, and notify the team — a single-pane "ship it" across scm + issues + ci + notify.
3
+ steps:
4
+ - ask: { as: issueId, type: text, message: "Issue id?" }
5
+ - ask: { as: branch, type: text, message: "Source branch?" }
6
+ - ask: { as: title, type: text, message: "Pull request title?" }
7
+ - ask: { as: pipelineId, type: text, message: "CI pipeline id to run?" }
8
+ - do: scm.pr.create
9
+ as: pr
10
+ with:
11
+ # targetBranch omitted — defaults to the repo's default branch (portable).
12
+ title: ${title}
13
+ sourceBranch: ${branch}
14
+ draft: true
15
+ - do: issue.transition
16
+ with:
17
+ id: ${issueId}
18
+ role: in_review
19
+ - do: ci.run.trigger
20
+ as: run
21
+ with:
22
+ pipelineId: ${pipelineId}
23
+ ref: ${branch}
24
+ - do: notify.send
25
+ with:
26
+ text: "PR ${pr.url} opened for issue ${issueId}; CI pipeline ${pipelineId} triggered."
27
+ - message: "Shipped ${issueId}: PR ${pr.url}, CI run accepted, team notified."
@@ -0,0 +1,22 @@
1
+ name: task-finish
2
+ description: Open a pull request for a branch and move its issue to review.
3
+ steps:
4
+ - ask: { as: issueId, type: text, message: "Issue id?" }
5
+ - ask: { as: branch, type: text, message: "Source branch?" }
6
+ - ask: { as: title, type: text, message: "Pull request title?" }
7
+ - do: scm.pr.create
8
+ as: pr
9
+ with:
10
+ # targetBranch omitted — defaults to the repo's default branch, keeping the recipe portable.
11
+ title: ${title}
12
+ sourceBranch: ${branch}
13
+ draft: true
14
+ - do: issue.transition
15
+ with:
16
+ id: ${issueId}
17
+ role: in_review
18
+ - do: scm.pr.thread
19
+ with:
20
+ pullRequestId: ${pr.id}
21
+ body: "Opened for issue ${issueId}."
22
+ - message: "Opened PR ${pr.url}; moved ${issueId} to review."
@@ -0,0 +1,25 @@
1
+ name: task-start
2
+ description: Create a task, branch for it, and move it into progress.
3
+ steps:
4
+ - ask: { as: title, type: text, message: "Task title?" }
5
+ - do: issue.create
6
+ as: issue
7
+ with:
8
+ title: ${title}
9
+ typeRole: task
10
+ - do: scm.branch.create
11
+ as: branch
12
+ with:
13
+ # fromBranch omitted on purpose — defaults to the repo's default branch (main/release/master),
14
+ # so this recipe is portable across repos instead of assuming 'main'.
15
+ name: feature/${issue.id}
16
+ - do: issue.transition
17
+ as: issue
18
+ with:
19
+ id: ${issue.id}
20
+ role: in_progress
21
+ - do: issue.comment
22
+ with:
23
+ id: ${issue.id}
24
+ body: "Started on branch ${branch.name}."
25
+ - message: "Task ${issue.key} is in progress on ${branch.name}."