@hesed/recipe 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 +202 -0
- package/README.md +304 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/recipe/create.d.ts +18 -0
- package/dist/commands/recipe/create.js +60 -0
- package/dist/commands/recipe/export.d.ts +19 -0
- package/dist/commands/recipe/export.js +51 -0
- package/dist/commands/recipe/import.d.ts +18 -0
- package/dist/commands/recipe/import.js +33 -0
- package/dist/commands/recipe/index.d.ts +9 -0
- package/dist/commands/recipe/index.js +27 -0
- package/dist/commands/recipe/remove.d.ts +15 -0
- package/dist/commands/recipe/remove.js +23 -0
- package/dist/commands/recipe/run.d.ts +16 -0
- package/dist/commands/recipe/run.js +64 -0
- package/dist/commands/recipe/show.d.ts +12 -0
- package/dist/commands/recipe/show.js +19 -0
- package/dist/commands/recipe/validate.d.ts +14 -0
- package/dist/commands/recipe/validate.js +21 -0
- package/dist/recipe/condition.d.ts +2 -0
- package/dist/recipe/condition.js +78 -0
- package/dist/recipe/engine.d.ts +14 -0
- package/dist/recipe/engine.js +80 -0
- package/dist/recipe/exec.d.ts +4 -0
- package/dist/recipe/exec.js +9 -0
- package/dist/recipe/interpolate.d.ts +5 -0
- package/dist/recipe/interpolate.js +85 -0
- package/dist/recipe/store.d.ts +23 -0
- package/dist/recipe/store.js +46 -0
- package/dist/recipe/types.d.ts +48 -0
- package/dist/recipe/types.js +1 -0
- package/oclif.manifest.json +382 -0
- package/package.json +70 -0
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 2026 Hesed
|
|
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,304 @@
|
|
|
1
|
+
# recipe
|
|
2
|
+
|
|
3
|
+
Extensible CLI recipe for running configurable AI coding agents
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.org/package/@hesed/recipe)
|
|
6
|
+
[](https://npmjs.org/package/@hesed/recipe)
|
|
7
|
+
|
|
8
|
+
# Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
sdkck plugins install @hesed/recipe
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
<!-- toc -->
|
|
15
|
+
* [recipe](#recipe)
|
|
16
|
+
* [Install](#install)
|
|
17
|
+
* [Usage](#usage)
|
|
18
|
+
* [Commands](#commands)
|
|
19
|
+
<!-- tocstop -->
|
|
20
|
+
# Usage
|
|
21
|
+
<!-- usage -->
|
|
22
|
+
```sh-session
|
|
23
|
+
$ npm install -g @hesed/recipe
|
|
24
|
+
$ recipe COMMAND
|
|
25
|
+
running command...
|
|
26
|
+
$ recipe (--version)
|
|
27
|
+
@hesed/recipe/0.1.0 darwin-arm64 node-v22.22.3
|
|
28
|
+
$ recipe --help [COMMAND]
|
|
29
|
+
USAGE
|
|
30
|
+
$ recipe COMMAND
|
|
31
|
+
...
|
|
32
|
+
```
|
|
33
|
+
<!-- usagestop -->
|
|
34
|
+
# Commands
|
|
35
|
+
<!-- commands -->
|
|
36
|
+
* [`recipe recipe`](#recipe-recipe)
|
|
37
|
+
* [`recipe recipe create NAME`](#recipe-recipe-create-name)
|
|
38
|
+
* [`recipe recipe delete RECIPE`](#recipe-recipe-delete-recipe)
|
|
39
|
+
* [`recipe recipe export RECIPE`](#recipe-recipe-export-recipe)
|
|
40
|
+
* [`recipe recipe import PATH`](#recipe-recipe-import-path)
|
|
41
|
+
* [`recipe recipe remove RECIPE`](#recipe-recipe-remove-recipe)
|
|
42
|
+
* [`recipe recipe run RECIPE`](#recipe-recipe-run-recipe)
|
|
43
|
+
* [`recipe recipe show RECIPE`](#recipe-recipe-show-recipe)
|
|
44
|
+
* [`recipe recipe validate RECIPE`](#recipe-recipe-validate-recipe)
|
|
45
|
+
|
|
46
|
+
## `recipe recipe`
|
|
47
|
+
|
|
48
|
+
List saved recipes.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
USAGE
|
|
52
|
+
$ recipe recipe [--json]
|
|
53
|
+
|
|
54
|
+
GLOBAL FLAGS
|
|
55
|
+
--json Format output as json.
|
|
56
|
+
|
|
57
|
+
DESCRIPTION
|
|
58
|
+
List saved recipes.
|
|
59
|
+
|
|
60
|
+
List saved recipes.
|
|
61
|
+
|
|
62
|
+
EXAMPLES
|
|
63
|
+
$ recipe recipe
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
_See code: [src/commands/recipe/index.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/index.ts)_
|
|
67
|
+
|
|
68
|
+
## `recipe recipe create NAME`
|
|
69
|
+
|
|
70
|
+
Scaffold a new recipe.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
USAGE
|
|
74
|
+
$ recipe recipe create NAME [--json] [-d <value>] [-f]
|
|
75
|
+
|
|
76
|
+
ARGUMENTS
|
|
77
|
+
NAME Name for the new recipe.
|
|
78
|
+
|
|
79
|
+
FLAGS
|
|
80
|
+
-d, --description=<value> Description for the recipe.
|
|
81
|
+
-f, --force Overwrite an existing recipe with the same name.
|
|
82
|
+
|
|
83
|
+
GLOBAL FLAGS
|
|
84
|
+
--json Format output as json.
|
|
85
|
+
|
|
86
|
+
DESCRIPTION
|
|
87
|
+
Scaffold a new recipe.
|
|
88
|
+
|
|
89
|
+
Creates a starter recipe in the recipe store that you can edit and run.
|
|
90
|
+
|
|
91
|
+
EXAMPLES
|
|
92
|
+
$ recipe recipe create close-user-tickets
|
|
93
|
+
|
|
94
|
+
$ recipe recipe create close-user-tickets --description "Close all tickets for a user"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
_See code: [src/commands/recipe/create.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/create.ts)_
|
|
98
|
+
|
|
99
|
+
## `recipe recipe delete RECIPE`
|
|
100
|
+
|
|
101
|
+
Remove a saved recipe.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
USAGE
|
|
105
|
+
$ recipe recipe delete RECIPE [--json]
|
|
106
|
+
|
|
107
|
+
ARGUMENTS
|
|
108
|
+
RECIPE Name of the saved recipe to remove.
|
|
109
|
+
|
|
110
|
+
GLOBAL FLAGS
|
|
111
|
+
--json Format output as json.
|
|
112
|
+
|
|
113
|
+
DESCRIPTION
|
|
114
|
+
Remove a saved recipe.
|
|
115
|
+
|
|
116
|
+
Delete a recipe from the recipe store.
|
|
117
|
+
|
|
118
|
+
ALIASES
|
|
119
|
+
$ recipe recipe delete
|
|
120
|
+
|
|
121
|
+
EXAMPLES
|
|
122
|
+
$ recipe recipe delete close-user-tickets
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## `recipe recipe export RECIPE`
|
|
126
|
+
|
|
127
|
+
Export a recipe to a file.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
USAGE
|
|
131
|
+
$ recipe recipe export RECIPE [--json] [-f] [-o <value>] [--stdout]
|
|
132
|
+
|
|
133
|
+
ARGUMENTS
|
|
134
|
+
RECIPE Name of the saved recipe to export.
|
|
135
|
+
|
|
136
|
+
FLAGS
|
|
137
|
+
-f, --force Overwrite the output file if it already exists.
|
|
138
|
+
-o, --output=<value> Output file path. Defaults to ./<name>.json.
|
|
139
|
+
--stdout Print the recipe to stdout instead of writing a file.
|
|
140
|
+
|
|
141
|
+
GLOBAL FLAGS
|
|
142
|
+
--json Format output as json.
|
|
143
|
+
|
|
144
|
+
DESCRIPTION
|
|
145
|
+
Export a recipe to a file.
|
|
146
|
+
|
|
147
|
+
Write a saved recipe to a JSON file so it can be shared or version-controlled.
|
|
148
|
+
|
|
149
|
+
With --stdout the recipe is printed instead of written to a file.
|
|
150
|
+
|
|
151
|
+
EXAMPLES
|
|
152
|
+
$ recipe recipe export close-user-tickets
|
|
153
|
+
|
|
154
|
+
$ recipe recipe export close-user-tickets --output ./shared/close-user-tickets.json
|
|
155
|
+
|
|
156
|
+
$ recipe recipe export close-user-tickets --stdout
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
_See code: [src/commands/recipe/export.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/export.ts)_
|
|
160
|
+
|
|
161
|
+
## `recipe recipe import PATH`
|
|
162
|
+
|
|
163
|
+
Import a recipe from a file.
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
USAGE
|
|
167
|
+
$ recipe recipe import PATH [--json] [-f] [--name <value>]
|
|
168
|
+
|
|
169
|
+
ARGUMENTS
|
|
170
|
+
PATH Path to a recipe JSON file to import.
|
|
171
|
+
|
|
172
|
+
FLAGS
|
|
173
|
+
-f, --force Overwrite an existing recipe with the same name.
|
|
174
|
+
--name=<value> Save the imported recipe under a different name.
|
|
175
|
+
|
|
176
|
+
GLOBAL FLAGS
|
|
177
|
+
--json Format output as json.
|
|
178
|
+
|
|
179
|
+
DESCRIPTION
|
|
180
|
+
Import a recipe from a file.
|
|
181
|
+
|
|
182
|
+
Import a recipe from a JSON file into the recipe store so it can be run by name.
|
|
183
|
+
|
|
184
|
+
EXAMPLES
|
|
185
|
+
$ recipe recipe import ./close-user-tickets.json
|
|
186
|
+
|
|
187
|
+
$ recipe recipe import ./shared-recipe.json --name my-copy
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
_See code: [src/commands/recipe/import.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/import.ts)_
|
|
191
|
+
|
|
192
|
+
## `recipe recipe remove RECIPE`
|
|
193
|
+
|
|
194
|
+
Remove a saved recipe.
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
USAGE
|
|
198
|
+
$ recipe recipe remove RECIPE [--json]
|
|
199
|
+
|
|
200
|
+
ARGUMENTS
|
|
201
|
+
RECIPE Name of the saved recipe to remove.
|
|
202
|
+
|
|
203
|
+
GLOBAL FLAGS
|
|
204
|
+
--json Format output as json.
|
|
205
|
+
|
|
206
|
+
DESCRIPTION
|
|
207
|
+
Remove a saved recipe.
|
|
208
|
+
|
|
209
|
+
Delete a recipe from the recipe store.
|
|
210
|
+
|
|
211
|
+
ALIASES
|
|
212
|
+
$ recipe recipe delete
|
|
213
|
+
|
|
214
|
+
EXAMPLES
|
|
215
|
+
$ recipe recipe remove close-user-tickets
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
_See code: [src/commands/recipe/remove.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/remove.ts)_
|
|
219
|
+
|
|
220
|
+
## `recipe recipe run RECIPE`
|
|
221
|
+
|
|
222
|
+
Run a recipe: a sequence of commands chained with conditions, loops and JSON operations.
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
USAGE
|
|
226
|
+
$ recipe recipe run RECIPE [--json] [--dry-run] [--var <value>...]
|
|
227
|
+
|
|
228
|
+
ARGUMENTS
|
|
229
|
+
RECIPE Name of a saved recipe, or a path to a recipe file.
|
|
230
|
+
|
|
231
|
+
FLAGS
|
|
232
|
+
--dry-run Print the commands that would run without executing them.
|
|
233
|
+
--var=<value>... Override a recipe variable (key=value). Repeatable. Values are parsed as JSON when possible.
|
|
234
|
+
|
|
235
|
+
GLOBAL FLAGS
|
|
236
|
+
--json Format output as json.
|
|
237
|
+
|
|
238
|
+
DESCRIPTION
|
|
239
|
+
Run a recipe: a sequence of commands chained with conditions, loops and JSON operations.
|
|
240
|
+
|
|
241
|
+
Each step runs a command, with optional conditions, loops and JSON operations between them.
|
|
242
|
+
|
|
243
|
+
Use --var to override the recipe's default variables, and --dry-run to preview the commands without running them.
|
|
244
|
+
|
|
245
|
+
EXAMPLES
|
|
246
|
+
$ recipe recipe run close-user-tickets
|
|
247
|
+
|
|
248
|
+
$ recipe recipe run close-user-tickets --var assignee=jdoe
|
|
249
|
+
|
|
250
|
+
$ recipe recipe run ./my-recipe.json --dry-run
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
_See code: [src/commands/recipe/run.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/run.ts)_
|
|
254
|
+
|
|
255
|
+
## `recipe recipe show RECIPE`
|
|
256
|
+
|
|
257
|
+
Print a recipe definition.
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
USAGE
|
|
261
|
+
$ recipe recipe show RECIPE [--json]
|
|
262
|
+
|
|
263
|
+
ARGUMENTS
|
|
264
|
+
RECIPE Name of a saved recipe, or a path to a recipe file.
|
|
265
|
+
|
|
266
|
+
GLOBAL FLAGS
|
|
267
|
+
--json Format output as json.
|
|
268
|
+
|
|
269
|
+
DESCRIPTION
|
|
270
|
+
Print a recipe definition.
|
|
271
|
+
|
|
272
|
+
Print the full definition of a recipe.
|
|
273
|
+
|
|
274
|
+
EXAMPLES
|
|
275
|
+
$ recipe recipe show close-user-tickets
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
_See code: [src/commands/recipe/show.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/show.ts)_
|
|
279
|
+
|
|
280
|
+
## `recipe recipe validate RECIPE`
|
|
281
|
+
|
|
282
|
+
Validate a recipe.
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
USAGE
|
|
286
|
+
$ recipe recipe validate RECIPE [--json]
|
|
287
|
+
|
|
288
|
+
ARGUMENTS
|
|
289
|
+
RECIPE Name of a saved recipe, or a path to a recipe file.
|
|
290
|
+
|
|
291
|
+
GLOBAL FLAGS
|
|
292
|
+
--json Format output as json.
|
|
293
|
+
|
|
294
|
+
DESCRIPTION
|
|
295
|
+
Validate a recipe.
|
|
296
|
+
|
|
297
|
+
Check that a recipe is well-formed without running it.
|
|
298
|
+
|
|
299
|
+
EXAMPLES
|
|
300
|
+
$ recipe recipe validate ./my-recipe.json
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
_See code: [src/commands/recipe/validate.ts](https://github.com/hesedcasa/recipe/blob/v0.1.0/src/commands/recipe/validate.ts)_
|
|
304
|
+
<!-- commandsstop -->
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class RecipeCreate extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static enableJsonFlag: boolean;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
static summary: string;
|
|
14
|
+
run(): Promise<{
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// The starter recipe intentionally contains literal `${...}` placeholders and a
|
|
2
|
+
// `then` branch key, both of which are core to the recipe syntax.
|
|
3
|
+
/* eslint-disable no-template-curly-in-string, unicorn/no-thenable */
|
|
4
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
5
|
+
import { cyan } from 'ansis';
|
|
6
|
+
import { recipeExists, saveRecipe } from '../../recipe/store.js';
|
|
7
|
+
/** Builds a runnable, self-documenting starter recipe. */
|
|
8
|
+
function starterRecipe(name, description) {
|
|
9
|
+
return {
|
|
10
|
+
description: description ?? 'Describe what this recipe does.',
|
|
11
|
+
name,
|
|
12
|
+
steps: [
|
|
13
|
+
{ log: 'Hello, ${greeting}!' },
|
|
14
|
+
{ set: 'count', value: 2 },
|
|
15
|
+
{
|
|
16
|
+
as: 'i',
|
|
17
|
+
repeat: '${count}',
|
|
18
|
+
steps: [{ log: 'Iteration ${i}' }],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
else: [{ log: 'Nothing to do.' }],
|
|
22
|
+
if: '${count} > 0',
|
|
23
|
+
then: [{ log: 'There is something to do.' }],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
vars: {
|
|
27
|
+
greeting: 'world',
|
|
28
|
+
},
|
|
29
|
+
version: '1.0',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default class RecipeCreate extends Command {
|
|
33
|
+
static args = {
|
|
34
|
+
name: Args.string({ description: 'Name for the new recipe.', required: true }),
|
|
35
|
+
};
|
|
36
|
+
static description = 'Creates a starter recipe in the recipe store that you can edit and run.';
|
|
37
|
+
static enableJsonFlag = true;
|
|
38
|
+
static examples = [
|
|
39
|
+
'<%= config.bin %> <%= command.id %> close-user-tickets',
|
|
40
|
+
'<%= config.bin %> <%= command.id %> close-user-tickets --description "Close all tickets for a user"',
|
|
41
|
+
];
|
|
42
|
+
static flags = {
|
|
43
|
+
description: Flags.string({ char: 'd', description: 'Description for the recipe.' }),
|
|
44
|
+
force: Flags.boolean({ char: 'f', description: 'Overwrite an existing recipe with the same name.' }),
|
|
45
|
+
};
|
|
46
|
+
static summary = 'Scaffold a new recipe.';
|
|
47
|
+
async run() {
|
|
48
|
+
const { args, flags } = await this.parse(RecipeCreate);
|
|
49
|
+
if (!flags.force && (await recipeExists(this.config, args.name))) {
|
|
50
|
+
this.error(`Recipe "${args.name}" already exists. Use --force to overwrite.`);
|
|
51
|
+
}
|
|
52
|
+
const recipe = starterRecipe(args.name, flags.description);
|
|
53
|
+
const path = await saveRecipe(this.config, recipe);
|
|
54
|
+
if (!this.jsonEnabled()) {
|
|
55
|
+
this.log(`Created recipe ${cyan(args.name)} at ${path}`);
|
|
56
|
+
this.log(`Edit it, then run it with "${this.config.bin} recipe run ${args.name}".`);
|
|
57
|
+
}
|
|
58
|
+
return { name: args.name, path };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class RecipeExport extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
recipe: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static enableJsonFlag: boolean;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
stdout: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
static summary: string;
|
|
15
|
+
run(): Promise<{
|
|
16
|
+
path?: string;
|
|
17
|
+
recipe: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { cyan } from 'ansis';
|
|
3
|
+
import { writeFile } from 'node:fs/promises';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
import { readRecipe } from '../../recipe/store.js';
|
|
6
|
+
export default class RecipeExport extends Command {
|
|
7
|
+
static args = {
|
|
8
|
+
recipe: Args.string({ description: 'Name of the saved recipe to export.', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static description = `Write a saved recipe to a JSON file so it can be shared or version-controlled.
|
|
11
|
+
|
|
12
|
+
With --stdout the recipe is printed instead of written to a file.`;
|
|
13
|
+
static enableJsonFlag = true;
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> close-user-tickets',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> close-user-tickets --output ./shared/close-user-tickets.json',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> close-user-tickets --stdout',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
force: Flags.boolean({ char: 'f', description: 'Overwrite the output file if it already exists.' }),
|
|
21
|
+
output: Flags.string({ char: 'o', description: 'Output file path. Defaults to ./<name>.json.' }),
|
|
22
|
+
stdout: Flags.boolean({ description: 'Print the recipe to stdout instead of writing a file.' }),
|
|
23
|
+
};
|
|
24
|
+
static summary = 'Export a recipe to a file.';
|
|
25
|
+
async run() {
|
|
26
|
+
const { args, flags } = await this.parse(RecipeExport);
|
|
27
|
+
const recipe = await readRecipe(this.config, args.recipe);
|
|
28
|
+
const content = `${JSON.stringify(recipe, null, 2)}\n`;
|
|
29
|
+
if (flags.stdout) {
|
|
30
|
+
this.log(content.trimEnd());
|
|
31
|
+
return { recipe: recipe.name };
|
|
32
|
+
}
|
|
33
|
+
const output = resolve(flags.output ?? `${recipe.name}.json`);
|
|
34
|
+
if (!flags.force) {
|
|
35
|
+
const { access } = await import('node:fs/promises');
|
|
36
|
+
try {
|
|
37
|
+
await access(output);
|
|
38
|
+
this.error(`${output} already exists. Use --force to overwrite.`);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error.code !== 'ENOENT')
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
await writeFile(output, content);
|
|
46
|
+
if (!this.jsonEnabled()) {
|
|
47
|
+
this.log(`Exported recipe ${cyan(recipe.name)} to ${output}`);
|
|
48
|
+
}
|
|
49
|
+
return { path: output, recipe: recipe.name };
|
|
50
|
+
}
|
|
51
|
+
}
|