@colony2/c2j 0.0.53 → 0.0.55
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 +117 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,24 +98,23 @@ If the current directory does not resolve as a cell, either:
|
|
|
98
98
|
- create `.c2j/config.yaml`, or
|
|
99
99
|
- pass `--cell <repo-or-path>` explicitly to `submit` or `list`
|
|
100
100
|
|
|
101
|
-
### 2. Submit and run a
|
|
101
|
+
### 2. Submit and run a build or evolve job
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
Build is the default. Add `--evolve` to select the evolve recipe:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
c2j submit
|
|
107
|
-
|
|
108
|
-
--run \
|
|
109
|
-
--embed
|
|
106
|
+
c2j submit "Implement the new endpoint" --run --embed
|
|
107
|
+
c2j submit "Improve retry behavior" --evolve --run --embed
|
|
110
108
|
```
|
|
111
109
|
|
|
112
110
|
That does all of the following:
|
|
113
111
|
|
|
114
|
-
- loads the local YAML file
|
|
115
|
-
- embeds that recipe into the submitted job
|
|
116
112
|
- starts an embedded JobDB runtime
|
|
117
113
|
- submits the job
|
|
118
|
-
-
|
|
114
|
+
- resolves the named recipe in the target cell, falling back to the shared recipe if absent
|
|
115
|
+
- immediately executes it against the target cell
|
|
116
|
+
|
|
117
|
+
See [submitting jobs](#submitting-jobs) for the hosted recipe names and [advanced recipe selection](#advanced-recipe-selection) for custom local files.
|
|
119
118
|
|
|
120
119
|
### 3. Continue or inspect a job later
|
|
121
120
|
|
|
@@ -197,35 +196,95 @@ npx skills add colony-2/c2j
|
|
|
197
196
|
|
|
198
197
|
### Basic forms
|
|
199
198
|
|
|
200
|
-
Submit a
|
|
199
|
+
Submit a build job (the default), or choose evolve:
|
|
201
200
|
|
|
202
201
|
```bash
|
|
203
|
-
c2j submit
|
|
202
|
+
c2j submit "Implement the new endpoint" --embed
|
|
203
|
+
c2j submit "Implement the new endpoint" --build --embed
|
|
204
|
+
c2j submit "Improve the retry behavior" --evolve --embed
|
|
204
205
|
```
|
|
205
206
|
|
|
206
|
-
|
|
207
|
+
These submit the names `build` and `evolve` through the existing recipe resolution system. At execution time, c2j first looks for `.c2j/recipes/build.yaml` or `.c2j/recipes/evolve.yaml` in the **target cell's repository**, at its configured ref. This also applies to `--cell`; the submitting project's recipes do not override another target cell's recipes. As with other named recipes, uncommitted files are not used.
|
|
208
|
+
|
|
209
|
+
If that recipe file is absent, c2j resolves one of these shared recipes instead:
|
|
210
|
+
|
|
211
|
+
- `git+https://github.com/colony-2/recipes.git//build.yaml@main`
|
|
212
|
+
- `git+https://github.com/colony-2/recipes.git//evolve.yaml@main`
|
|
213
|
+
|
|
214
|
+
The shared repository must provide `build.yaml` and `evolve.yaml` at its root on `main`. These recipes are not bundled with c2j; until published, jobs needing the fallback cannot execute. Missing refs, authentication/network failures, and invalid recipes remain errors rather than triggering fallback. Resolution is pinned and cached by the existing job execution machinery. A shared recipe still operates on the target cell's worktree.
|
|
207
215
|
|
|
208
|
-
|
|
216
|
+
Every submission requires a non-empty prompt, passed as `inputs.prompt`. Omit the argument in a terminal to enter it interactively:
|
|
209
217
|
|
|
210
218
|
```bash
|
|
211
|
-
c2j submit --
|
|
219
|
+
c2j submit --evolve --embed
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
For automation, provide the positional prompt or a string `prompt` in `--inputs-json`/`--inputs-file`; missing prompts with non-terminal stdin fail immediately. Interactive prompts go to stderr, so `--json` stdout stays machine-readable.
|
|
223
|
+
|
|
224
|
+
### Build/evolve input contract
|
|
225
|
+
|
|
226
|
+
c2j automatically includes the selected type alongside the prompt:
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{"prompt": "Implement the new endpoint", "type": "build"}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{"prompt": "Improve retry behavior", "type": "evolve"}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
`type` is derived from the selected recipe, not used to select it: use `--evolve` to submit an evolve job. A matching `type` in `--inputs-json` or `--inputs-file` is accepted; a conflicting or non-string value is rejected before submission. The same contract applies to target-cell recipes and shared fallbacks, including explicit selection of the names `build` and `evolve`.
|
|
237
|
+
|
|
238
|
+
Both conventional recipes must declare these inputs and bind them for recipe logic:
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
input_schema:
|
|
242
|
+
prompt:
|
|
243
|
+
type: string
|
|
244
|
+
required: true
|
|
245
|
+
type:
|
|
246
|
+
type: string
|
|
247
|
+
required: true
|
|
248
|
+
inputs:
|
|
249
|
+
prompt: "{{ inputs.prompt }}"
|
|
250
|
+
type: "{{ inputs.type }}"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Custom recipe names, explicit Git selectors, and local recipe files do not receive an automatic `type`; their own input contracts apply and any supplied `type` is preserved.
|
|
254
|
+
|
|
255
|
+
### Advanced recipe selection
|
|
256
|
+
|
|
257
|
+
For a custom recipe, explicitly opt into advanced selection:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
c2j submit "Review the changes" --advanced-recipe review --embed
|
|
261
|
+
c2j submit "Review the changes" --advanced-recipe-file ./recipes/review.yaml --embed
|
|
212
262
|
```
|
|
213
263
|
|
|
214
264
|
Submit and run immediately:
|
|
215
265
|
|
|
216
266
|
```bash
|
|
217
|
-
c2j submit --recipe-file ./recipes/
|
|
267
|
+
c2j submit "Review the changes" --advanced-recipe-file ./recipes/review.yaml --run --embed
|
|
218
268
|
```
|
|
219
269
|
|
|
220
|
-
|
|
270
|
+
`--advanced-recipe` accepts a target-cell recipe name or explicit git selector. `--advanced-recipe-file` embeds a local YAML file, including uncommitted changes. These flags are mutually exclusive with each other and with `--build`/`--evolve`. The old `--recipe`/`--recipe-file` flags remain hidden, deprecated aliases on `submit`; `c2j test` retains its existing flag names. Custom names and explicit selectors do not get a hosted fallback; the conventional names `build` and `evolve` do.
|
|
271
|
+
|
|
272
|
+
Custom recipes submitted through the CLI must also declare the prompt in their input schema:
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
input_schema:
|
|
276
|
+
prompt:
|
|
277
|
+
type: string
|
|
278
|
+
required: true
|
|
279
|
+
```
|
|
221
280
|
|
|
222
281
|
### Passing inputs
|
|
223
282
|
|
|
224
283
|
Inline JSON:
|
|
225
284
|
|
|
226
285
|
```bash
|
|
227
|
-
c2j submit \
|
|
228
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
286
|
+
c2j submit "Run the requested task" \
|
|
287
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
229
288
|
--inputs-json '{"message":"hello"}' \
|
|
230
289
|
--run \
|
|
231
290
|
--embed
|
|
@@ -234,8 +293,8 @@ c2j submit \
|
|
|
234
293
|
Inputs file in JSON or YAML:
|
|
235
294
|
|
|
236
295
|
```bash
|
|
237
|
-
c2j submit \
|
|
238
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
296
|
+
c2j submit "Run the requested task" \
|
|
297
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
239
298
|
--inputs-file ./recipes/test-inputs.yaml \
|
|
240
299
|
--run \
|
|
241
300
|
--embed
|
|
@@ -244,7 +303,7 @@ c2j submit \
|
|
|
244
303
|
Positional prompt shortcut:
|
|
245
304
|
|
|
246
305
|
```bash
|
|
247
|
-
c2j submit "Summarize the repo" --recipe my-prompt-recipe --embed
|
|
306
|
+
c2j submit "Summarize the repo" --advanced-recipe my-prompt-recipe --embed
|
|
248
307
|
```
|
|
249
308
|
|
|
250
309
|
The positional argument is merged as `inputs.prompt`.
|
|
@@ -259,8 +318,8 @@ Rules:
|
|
|
259
318
|
Attach local files as job artifacts with repeatable `--artifact` flags:
|
|
260
319
|
|
|
261
320
|
```bash
|
|
262
|
-
c2j submit \
|
|
263
|
-
--recipe-file ./recipes/review-docs.yaml \
|
|
321
|
+
c2j submit "Run the requested task" \
|
|
322
|
+
--advanced-recipe-file ./recipes/review-docs.yaml \
|
|
264
323
|
--artifact ./docs/brief.md \
|
|
265
324
|
--artifact requirements=./docs/requirements.md \
|
|
266
325
|
--run \
|
|
@@ -287,14 +346,13 @@ sequence:
|
|
|
287
346
|
Use the current cell:
|
|
288
347
|
|
|
289
348
|
```bash
|
|
290
|
-
c2j submit
|
|
349
|
+
c2j submit "Implement the new endpoint" --self --embed
|
|
291
350
|
```
|
|
292
351
|
|
|
293
352
|
Use another cell explicitly:
|
|
294
353
|
|
|
295
354
|
```bash
|
|
296
|
-
c2j submit \
|
|
297
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
355
|
+
c2j submit "Improve retry behavior" --evolve \
|
|
298
356
|
--cell github.com/colony-2/root \
|
|
299
357
|
--embed
|
|
300
358
|
```
|
|
@@ -316,8 +374,7 @@ Rules:
|
|
|
316
374
|
If you only want the submitted job identity:
|
|
317
375
|
|
|
318
376
|
```bash
|
|
319
|
-
c2j submit \
|
|
320
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
377
|
+
c2j submit "Implement the new endpoint" \
|
|
321
378
|
--json \
|
|
322
379
|
--embed
|
|
323
380
|
```
|
|
@@ -328,7 +385,7 @@ This emits:
|
|
|
328
385
|
{
|
|
329
386
|
"tenant_id": "0",
|
|
330
387
|
"job_id": "job-...",
|
|
331
|
-
"recipe": "
|
|
388
|
+
"recipe": "build"
|
|
332
389
|
}
|
|
333
390
|
```
|
|
334
391
|
|
|
@@ -336,6 +393,22 @@ Note:
|
|
|
336
393
|
|
|
337
394
|
- `--json` and `--run` are mutually exclusive
|
|
338
395
|
|
|
396
|
+
## Node workspaces
|
|
397
|
+
|
|
398
|
+
Use `workspace: {cell: cellB}` on a recipe node to run against another cell's data. Every explicit declaration starts a fresh workspace; descendants share its durable Git snapshots. Cell and optional `ref` values accept runtime templates. When the node exits, execution resumes in the enclosing workspace without adopting its changes or publishing to the target cell.
|
|
399
|
+
|
|
400
|
+
```yaml
|
|
401
|
+
sequence:
|
|
402
|
+
- id: inspect
|
|
403
|
+
workspace: {cell: cellB, ref: main}
|
|
404
|
+
op: command_execution
|
|
405
|
+
inputs:
|
|
406
|
+
working_directory: "{{ context.environment.op.worktree_path }}"
|
|
407
|
+
run: "cat README.md"
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
`context.workflow.cell` remains the owning job's cell; `context.workspace.cell` and `context.git.*` describe the active workspace. See [Run a recipe node in another cell](GUIDE-Node-Workspaces.md) for scope, replay, child-job, and deployment details.
|
|
411
|
+
|
|
339
412
|
## Testing Recipes
|
|
340
413
|
|
|
341
414
|
`c2j test` compiles, validates, and runs recipe test suites locally. It does not call the old Colony2 API.
|
|
@@ -549,6 +622,13 @@ List JSON exposes `next_route` (`jobType`, optional `taskType`) and `task_wait`
|
|
|
549
622
|
instead of the old `next_need` and flat `task_wait_*` fields. The human-readable
|
|
550
623
|
`NEXT` column also shows the route as JSON.
|
|
551
624
|
|
|
625
|
+
## Parent and child jobs
|
|
626
|
+
|
|
627
|
+
Commands and extensions can run nested `c2j submit` calls that automatically
|
|
628
|
+
record parentage through the current job's child-submission broker. See the
|
|
629
|
+
[parent and child jobs guide](C2J_CHILD_JOBS_GUIDE.md) for setup, complete recipe
|
|
630
|
+
examples, child listing, result handling, environment variables, and limits.
|
|
631
|
+
|
|
552
632
|
## Embedded Runtime
|
|
553
633
|
|
|
554
634
|
`--embed` is shorthand for:
|
|
@@ -611,21 +691,21 @@ jobdb: embed:///
|
|
|
611
691
|
|
|
612
692
|
```bash
|
|
613
693
|
c2j self
|
|
614
|
-
c2j submit --recipe-file ./recipes/my-recipe.yaml --run --embed
|
|
694
|
+
c2j submit "Run the requested task" --advanced-recipe-file ./recipes/my-recipe.yaml --run --embed
|
|
615
695
|
```
|
|
616
696
|
|
|
617
697
|
### Detached submit, then later run
|
|
618
698
|
|
|
619
699
|
```bash
|
|
620
|
-
c2j submit
|
|
700
|
+
c2j submit "Implement the new endpoint" --json --embed
|
|
621
701
|
c2j run --job-id <job-id> --embed
|
|
622
702
|
```
|
|
623
703
|
|
|
624
704
|
### Run against a remote runtime instead of embed
|
|
625
705
|
|
|
626
706
|
```bash
|
|
627
|
-
c2j submit \
|
|
628
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
707
|
+
c2j submit "Run the requested task" \
|
|
708
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
629
709
|
--jobdb http://localhost:9047/my-tenant \
|
|
630
710
|
--run
|
|
631
711
|
```
|
|
@@ -633,8 +713,8 @@ c2j submit \
|
|
|
633
713
|
### Target another cell explicitly
|
|
634
714
|
|
|
635
715
|
```bash
|
|
636
|
-
c2j submit \
|
|
637
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
716
|
+
c2j submit "Run the requested task" \
|
|
717
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
638
718
|
--cell github.com/colony-2/root \
|
|
639
719
|
--run \
|
|
640
720
|
--embed
|
|
@@ -642,14 +722,14 @@ c2j submit \
|
|
|
642
722
|
|
|
643
723
|
## Gotchas
|
|
644
724
|
|
|
645
|
-
- `--recipe
|
|
725
|
+
- `--build`, `--evolve`, `--advanced-recipe`, and `--advanced-recipe-file` are mutually exclusive on `submit`
|
|
646
726
|
- `--json` and `--run` are mutually exclusive on `submit`
|
|
647
727
|
- `--inputs-json` and `--inputs-file` are mutually exclusive
|
|
648
728
|
- `--self` and `--cell` are mutually exclusive
|
|
649
729
|
- `--artifact` names must be unique relative paths; directories are not supported yet
|
|
650
730
|
- `self`, `cells`, and implicit current-cell submission depend on config or supported auto-detection succeeding
|
|
651
731
|
- short cell names require a config pattern; without config, use an explicit repo or path
|
|
652
|
-
-
|
|
732
|
+
- `submit --advanced-recipe-file` is clearer than passing a local file path through `--advanced-recipe`
|
|
653
733
|
|
|
654
734
|
## Related Files
|
|
655
735
|
|