@colony2/c2j 0.0.52 → 0.0.54
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 +122 -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
|
|
205
|
+
```
|
|
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.
|
|
215
|
+
|
|
216
|
+
Every submission requires a non-empty prompt, passed as `inputs.prompt`. Omit the argument in a terminal to enter it interactively:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
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 }}"
|
|
204
251
|
```
|
|
205
252
|
|
|
206
|
-
|
|
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
|
|
207
256
|
|
|
208
|
-
|
|
257
|
+
For a custom recipe, explicitly opt into advanced selection:
|
|
209
258
|
|
|
210
259
|
```bash
|
|
211
|
-
c2j submit --
|
|
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.
|
|
@@ -494,6 +567,11 @@ lease happen in one runtime operation.
|
|
|
494
567
|
|
|
495
568
|
## Listing Jobs
|
|
496
569
|
|
|
570
|
+
Go applications can list remote jobs without invoking the CLI using the
|
|
571
|
+
supported [`pkg/joblist` API](pkg/joblist/README.md). See the
|
|
572
|
+
[standalone example](examples/listjobs/main.go) and
|
|
573
|
+
[implementation response](C2J_FEATURE_REQUESTS_RESPONSE.md).
|
|
574
|
+
|
|
497
575
|
List jobs for the current cell:
|
|
498
576
|
|
|
499
577
|
```bash
|
|
@@ -544,6 +622,13 @@ List JSON exposes `next_route` (`jobType`, optional `taskType`) and `task_wait`
|
|
|
544
622
|
instead of the old `next_need` and flat `task_wait_*` fields. The human-readable
|
|
545
623
|
`NEXT` column also shows the route as JSON.
|
|
546
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
|
+
|
|
547
632
|
## Embedded Runtime
|
|
548
633
|
|
|
549
634
|
`--embed` is shorthand for:
|
|
@@ -606,21 +691,21 @@ jobdb: embed:///
|
|
|
606
691
|
|
|
607
692
|
```bash
|
|
608
693
|
c2j self
|
|
609
|
-
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
|
|
610
695
|
```
|
|
611
696
|
|
|
612
697
|
### Detached submit, then later run
|
|
613
698
|
|
|
614
699
|
```bash
|
|
615
|
-
c2j submit
|
|
700
|
+
c2j submit "Implement the new endpoint" --json --embed
|
|
616
701
|
c2j run --job-id <job-id> --embed
|
|
617
702
|
```
|
|
618
703
|
|
|
619
704
|
### Run against a remote runtime instead of embed
|
|
620
705
|
|
|
621
706
|
```bash
|
|
622
|
-
c2j submit \
|
|
623
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
707
|
+
c2j submit "Run the requested task" \
|
|
708
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
624
709
|
--jobdb http://localhost:9047/my-tenant \
|
|
625
710
|
--run
|
|
626
711
|
```
|
|
@@ -628,8 +713,8 @@ c2j submit \
|
|
|
628
713
|
### Target another cell explicitly
|
|
629
714
|
|
|
630
715
|
```bash
|
|
631
|
-
c2j submit \
|
|
632
|
-
--recipe-file ./recipes/my-recipe.yaml \
|
|
716
|
+
c2j submit "Run the requested task" \
|
|
717
|
+
--advanced-recipe-file ./recipes/my-recipe.yaml \
|
|
633
718
|
--cell github.com/colony-2/root \
|
|
634
719
|
--run \
|
|
635
720
|
--embed
|
|
@@ -637,14 +722,14 @@ c2j submit \
|
|
|
637
722
|
|
|
638
723
|
## Gotchas
|
|
639
724
|
|
|
640
|
-
- `--recipe
|
|
725
|
+
- `--build`, `--evolve`, `--advanced-recipe`, and `--advanced-recipe-file` are mutually exclusive on `submit`
|
|
641
726
|
- `--json` and `--run` are mutually exclusive on `submit`
|
|
642
727
|
- `--inputs-json` and `--inputs-file` are mutually exclusive
|
|
643
728
|
- `--self` and `--cell` are mutually exclusive
|
|
644
729
|
- `--artifact` names must be unique relative paths; directories are not supported yet
|
|
645
730
|
- `self`, `cells`, and implicit current-cell submission depend on config or supported auto-detection succeeding
|
|
646
731
|
- short cell names require a config pattern; without config, use an explicit repo or path
|
|
647
|
-
-
|
|
732
|
+
- `submit --advanced-recipe-file` is clearer than passing a local file path through `--advanced-recipe`
|
|
648
733
|
|
|
649
734
|
## Related Files
|
|
650
735
|
|