@sous-io/sous 1.1.0 → 1.1.1
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/dist/sous.js +174 -160
- package/docs/markdown/_sidebar.md +2 -0
- package/docs/markdown/commands.md +74 -18
- package/docs/markdown/config-inspection.md +9 -1
- package/docs/markdown/configuration.md +6 -0
- package/docs/markdown/editing-files.md +2 -1
- package/docs/markdown/handlers.md +30 -12
- package/docs/markdown/repositories-authoring.md +37 -3
- package/docs/markdown/repositories-consuming.md +51 -9
- package/docs/markdown/repositories-file-formats.md +42 -0
- package/docs/markdown/repositories-providers.md +92 -19
- package/docs/markdown/repositories-quickstart.md +10 -1
- package/docs/markdown/repositories-troubleshooting.md +12 -7
- package/docs/markdown/repositories-variables.md +2 -1
- package/docs/markdown/repositories.md +2 -0
- package/package.json +38 -38
- package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +4 -0
- package/recipes/core/sous-skills/skills/about-sous-repos/SKILL.tpl.md +27 -4
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/sous.config.schema.json +5 -0
|
@@ -82,3 +82,5 @@
|
|
|
82
82
|
- [0038: A boolean recipe answer is a boolean in Liquid](adrs/0038-boolean-answers.md)
|
|
83
83
|
- [0039: Codex's memories go to a git-ignored `AGENTS.override.md`](adrs/0039-codex-memories.md)
|
|
84
84
|
- [0040: One config build per harness](adrs/0040-one-config-build-per-harness.md)
|
|
85
|
+
- [0041: A target one harness's build holds reaches that harness](adrs/0041-harness-only-targets.md)
|
|
86
|
+
- [0042: Retired recipes stay in the index and name their replacements](adrs/0042-retired-recipes.md)
|
|
@@ -41,6 +41,15 @@ already exists.
|
|
|
41
41
|
- `--timings` prints how long each step of the run took.
|
|
42
42
|
- `--json`, on the commands that print a listing or a report, prints it as JSON instead.
|
|
43
43
|
|
|
44
|
+
A table fits the terminal's width, and steps aside its least important columns when the window is too narrow.
|
|
45
|
+
Sent to a pipe or a file, a table keeps every column and follows the `COLUMNS` environment variable when it is
|
|
46
|
+
set; when it is not, the table is laid out 2,000 characters wide, so each row stays on one line for `grep`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
sous recipe list | grep workflow
|
|
50
|
+
COLUMNS=120 sous vars list > vars.txt
|
|
51
|
+
```
|
|
52
|
+
|
|
44
53
|
Sous reports, at the `debug` level, when a step takes longer than its time budget, so the report shows only
|
|
45
54
|
with `--debug` or `--log-level debug`. It goes to standard error, so it never mixes with `--json` output. Time
|
|
46
55
|
spent waiting for you to answer a question does not count. The `budgets` config key changes a budget, and
|
|
@@ -254,7 +263,10 @@ and reloads the config when a file is added to or removed from a glob target's f
|
|
|
254
263
|
|
|
255
264
|
Before it compiles, a build prepares the project's recipes: it pins any new subscription, restores whatever this
|
|
256
265
|
machine's recipe store is missing, and lists each recipe that has a newer version within its range (it moves no
|
|
257
|
-
pin; see [Moving to newer versions](repositories-consuming.md#moving-to-newer-versions)).
|
|
266
|
+
pin; see [Moving to newer versions](repositories-consuming.md#moving-to-newer-versions)). It warns about each
|
|
267
|
+
recipe it builds that its repository retired, naming the replacements; in a terminal it offers to subscribe to
|
|
268
|
+
each replacement of a recipe the project subscribes to by name, then to remove the old subscription (see
|
|
269
|
+
[Retired recipes](repositories-consuming.md#retired-recipes)). The other commands
|
|
258
270
|
that build (`init`, `launch`, `prune`, `subscription add` and the like) run this same build.
|
|
259
271
|
|
|
260
272
|
A build compiles only the recipes whose subscriptions are switched on on this machine. Each one it skips gets a
|
|
@@ -266,6 +278,32 @@ Skipped tool-usage/automated-browser-tasks: its subscription is switched off (co
|
|
|
266
278
|
Pruned 4 outputs it had written.
|
|
267
279
|
```
|
|
268
280
|
|
|
281
|
+
A build opens with its Command Variables (the project, its config file and the flags that change the run) and
|
|
282
|
+
then prints a block for each file it wrote, removed or could not write. A file that was already up to date gets
|
|
283
|
+
no block unless you pass `--debug`, which shows every unchanged file too, with its size in tokens. Every build
|
|
284
|
+
ends with one line counting the files, before `Done.`:
|
|
285
|
+
|
|
286
|
+
```text
|
|
287
|
+
$ sous build
|
|
288
|
+
$ Command Variables:
|
|
289
|
+
Project: my-project
|
|
290
|
+
Config : /home/me/my-project/.sous/sous.config.jsonc
|
|
291
|
+
|
|
292
|
+
▷ SKILL.tpl.md
|
|
293
|
+
Entry Point: /home/me/my-project/.sous/skills/review/SKILL.tpl.md
|
|
294
|
+
✓ /home/me/my-project/.claude/skills/review/SKILL.md (~2,905 tokens)
|
|
295
|
+
|
|
296
|
+
Files: 1 written (1 updated), 14 unchanged.
|
|
297
|
+
|
|
298
|
+
Done.
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
With `--debug`, an unchanged file reads `⊘ /home/me/my-project/.claude/skills/plan/SKILL.md (unchanged, ~1,240
|
|
302
|
+
tokens)`. The count adds "removed" and "not written" only when there are some, and a dry run says what it
|
|
303
|
+
would do: `Files: 2 would be written (1 new, 1 updated), 13 unchanged.` `init` and `launch` print the same
|
|
304
|
+
blocks and the same line, since they run this build. All of it goes to standard error; with `--json`, standard
|
|
305
|
+
output holds the build's result as data.
|
|
306
|
+
|
|
269
307
|
A compile error (a missing or circular include, a template that fails to render, a file sous cannot read) fails
|
|
270
308
|
the build, but only after every target is compiled and every error listed. An output whose target had an error is
|
|
271
309
|
not written, so the copy from the last good build stays in place. A build also warns about every recipe memory
|
|
@@ -411,7 +449,9 @@ problem it finds, asking before each fix. Its checks, in order:
|
|
|
411
449
|
|
|
412
450
|
1. The config loads.
|
|
413
451
|
2. The lockfile agrees with the subscriptions (fix: write the lockfile the subscriptions make, keeping every pin
|
|
414
|
-
their ranges still allow).
|
|
452
|
+
their ranges still allow). To know what each recipe depends on, sous reads its files, downloading into this
|
|
453
|
+
machine's recipe store any it lacks, and says which it downloaded. A recipe it still cannot read is a
|
|
454
|
+
problem with no fix, naming it: a lockfile written then would drop the pins of what it depends on.
|
|
415
455
|
3. Required recipe variables have answers (fix: ask them).
|
|
416
456
|
4. Every migration for this version of sous has run (fix: run them). This check runs even when the config does
|
|
417
457
|
not load, since a migration may be what makes it load again (an option a newer sous removed). When it does,
|
|
@@ -427,11 +467,14 @@ problem it finds, asking before each fix. Its checks, in order:
|
|
|
427
467
|
error is a problem; one at level warn is a warning. No fix.
|
|
428
468
|
8. The files sous wrote are present and unchanged (fix: build).
|
|
429
469
|
|
|
430
|
-
Plugins add checks of their own. `--dry-run` reports and changes nothing
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
470
|
+
Plugins add checks of their own. `--dry-run` reports and changes nothing in the project (it may download
|
|
471
|
+
recipes into this machine's recipe store, and says so); `--yes` applies every fix without asking and takes the
|
|
472
|
+
default answer to each migration's question; `--answer <name>=<value>` answers one question, a migration's or a
|
|
473
|
+
recipe variable's; `--only <check>` runs one check. It ends with exit code 1 when a problem remains. Migrations
|
|
474
|
+
waiting for an answer nobody could give (no terminal, no `--yes`, no `--answer`) are listed by name, each with
|
|
475
|
+
its questions and the `--answer` that gives each one; a migration that asks nothing waits too, because
|
|
476
|
+
migrations run in order and none runs until every question is answered. They do not change the exit code, and
|
|
477
|
+
the last line says they wait: "Nothing failed, but 3 migrations are waiting for an answer."
|
|
435
478
|
|
|
436
479
|
A migration brings a project's files in line with a newer version of sous. Each runs once for the project: the
|
|
437
480
|
lockfile records the version of sous whose migrations the project last ran. While one is waiting, every other
|
|
@@ -485,7 +528,7 @@ Inspects the built configuration; see [Inspecting and validating](config-inspect
|
|
|
485
528
|
- `sous config show` prints the built config as JSON, with config expressions evaluated: what sous will do on
|
|
486
529
|
this machine. `--layers` shows each change in order and what made it.
|
|
487
530
|
- `sous config get PATH` prints one value by dot-path. `--layers` shows every file, recipe or plugin that
|
|
488
|
-
changed it.
|
|
531
|
+
changed it, each named in full, and each value as pretty-printed JSON, never cut short.
|
|
489
532
|
- `sous config validate` checks the config against its schema, then resolves every variable, which is what
|
|
490
533
|
finds circular and undefined `${var}` references.
|
|
491
534
|
|
|
@@ -554,8 +597,10 @@ sous repo contribute workflow/task-files --finish --title "Clarify the resume st
|
|
|
554
597
|
Creates a new recipe repository, then runs [`sous init`](#sous-init-directory) in the same directory, so the
|
|
555
598
|
repository is also a sous project whose memories file and `.claude/skills/` are build output. It
|
|
556
599
|
passes `--yes`, `--move-includes`, `--copy-includes`, `--leave-includes`, `--no-build` and `--dry-run` through to
|
|
557
|
-
init. A directory that already holds a sous config keeps it, and init is skipped with a note.
|
|
558
|
-
|
|
600
|
+
init. A directory that already holds a sous config keeps it, and init is skipped with a note. `--host github`
|
|
601
|
+
writes `.github/workflows/sous-release.yml` and `--host gitlab` writes `.gitlab-ci.yml` (default: the host of
|
|
602
|
+
the `origin` remote, else `github`); on GitLab it warns that the release job needs the masked CI/CD variable
|
|
603
|
+
`SOUS_RELEASE_TOKEN`. See [Authoring a repository](repositories-authoring.md).
|
|
559
604
|
|
|
560
605
|
```bash
|
|
561
606
|
sous repo init ./my-recipes --name team-recipes --namespace workflow
|
|
@@ -565,7 +610,9 @@ sous repo init ./my-recipes --name team-recipes --namespace workflow
|
|
|
565
610
|
|
|
566
611
|
Publishes new versions of the repository's recipes: raises their versions, regenerates the index, commits and
|
|
567
612
|
tags. It plans first and asks once, and it needs a git commit identity (`user.name` and `user.email`) in the
|
|
568
|
-
repository. `--check` only validates, and `--ci` is the setting for a merge job.
|
|
613
|
+
repository. `--check` only validates, and `--ci` is the setting for a merge job. A recipe the repository no
|
|
614
|
+
longer lists keeps its published versions in the index, marked retired, with any replacements `sous.repo.yaml`
|
|
615
|
+
names (see [Retire or move a recipe](repositories-authoring.md#retire-or-move-a-recipe)).
|
|
569
616
|
|
|
570
617
|
```bash
|
|
571
618
|
sous repo release --recipe workflow/task-files --bump minor --push
|
|
@@ -589,7 +636,13 @@ Manages which recipes the project subscribes to. `REF` is `namespace` or `namesp
|
|
|
589
636
|
|
|
590
637
|
- `subscription add` (or `sous subscribe`) subscribes, then builds so the recipe's files are on disk. Answer a
|
|
591
638
|
recipe's questions ahead of time with `--answer <name>=<value>` or `--answers-file <path>`, and let it install
|
|
592
|
-
the sous plugins it requires with `--install-plugins`.
|
|
639
|
+
the sous plugins it requires with `--install-plugins`. It checks everything before it writes anything: a
|
|
640
|
+
repository it has to trust is trusted in memory only, every recipe it installs is downloaded, and the recipes'
|
|
641
|
+
questions are asked (without a terminal, a required question nothing answers fails it). Only then are the
|
|
642
|
+
trust, the subscription, the lockfile and the answers written, so a failed subscription, a declined question
|
|
643
|
+
or Ctrl-C leaves the project as it was. Without `@<range>` the subscription accepts any version,
|
|
644
|
+
so an update may move it to a new major version; the plan shown before the question, and the result, name
|
|
645
|
+
the range recorded.
|
|
593
646
|
- `subscription remove` (or `sous unsubscribe`) removes a subscription and everything only it brought in. The
|
|
594
647
|
built-in `core` subscription is switched off instead, keeping its pin.
|
|
595
648
|
- `subscription update [REF]` is [`sous update`](#sous-update-ref).
|
|
@@ -609,7 +662,8 @@ Browse what the trusted repositories publish, offline.
|
|
|
609
662
|
|
|
610
663
|
- `namespace list` lists every namespace and how much of it the project subscribes to.
|
|
611
664
|
- `namespace show REF` lists one namespace's recipes, with their latest and pinned versions.
|
|
612
|
-
- `recipe list` lists every recipe, across every namespace.
|
|
665
|
+
- `recipe list` lists every recipe, across every namespace. A description takes at most three lines, the
|
|
666
|
+
third ending in `...` when more is left out; `recipe show` prints it whole.
|
|
613
667
|
- `recipe show REF` describes one recipe completely: its versions, dependencies, the questions it asks and where
|
|
614
668
|
its files go, even before anything installs it.
|
|
615
669
|
|
|
@@ -620,11 +674,13 @@ sous recipe show omakase/house
|
|
|
620
674
|
|
|
621
675
|
## lock
|
|
622
676
|
|
|
623
|
-
Inspects and repairs the project's lockfile, `.sous/sous.lock.json
|
|
677
|
+
Inspects and repairs the project's lockfile, `.sous/sous.lock.json`.
|
|
624
678
|
|
|
625
679
|
- `lock show` prints what the lockfile pins, and why each recipe is there.
|
|
626
680
|
- `lock rebuild` recomputes the lockfile from scratch from the subscriptions and the cached indexes: the repair
|
|
627
|
-
for a lockfile damaged by a hand edit or a bad merge.
|
|
681
|
+
for a lockfile damaged by a hand edit or a bad merge. A recipe whose index does not record what it depends on
|
|
682
|
+
is downloaded to read its manifest; when one cannot be, nothing is written and the command fails, naming it.
|
|
683
|
+
`--dry-run` downloads nothing.
|
|
628
684
|
|
|
629
685
|
```bash
|
|
630
686
|
sous lock rebuild --dry-run
|
|
@@ -638,9 +694,9 @@ Inspects the questions the project's recipes ask, and the answers they hold; see
|
|
|
638
694
|
- `vars list` lists every variable, with where its value came from.
|
|
639
695
|
- `vars show NAME` shows everything about one variable. `NAME` may also be an environment variable name that
|
|
640
696
|
answers it.
|
|
641
|
-
- `vars ask [NAME]` asks the questions and stores the answers in the `.sous` env files. `--
|
|
642
|
-
|
|
643
|
-
secret or machine-specific variable headed for the committed `.env` is warned about and needs a yes (`--yes`).
|
|
697
|
+
- `vars ask [NAME]` asks the questions and stores the answers in the `.sous` env files. `--save-shared` stores
|
|
698
|
+
every answer of the run in `.sous/.env` (committed), and `--save-locally` in `.sous/.env.local` (this machine
|
|
699
|
+
only); the two cannot be used together. A secret or machine-specific variable headed for the committed `.env` is warned about and needs a yes (`--yes`).
|
|
644
700
|
|
|
645
701
|
```bash
|
|
646
702
|
sous vars show workflow/task-files.apiUrl
|
|
@@ -85,11 +85,19 @@ it. This answers "which file or plugin set this?" directly:
|
|
|
85
85
|
```text
|
|
86
86
|
$ sous config get subscriptions."tool-usage/automated-browser-tasks".enabled --layers
|
|
87
87
|
conf.d/510-subscriptions.jsonc (not set)
|
|
88
|
-
conf.d/610-mac.jsonc {
|
|
88
|
+
conf.d/610-mac.jsonc {
|
|
89
|
+
"$if": {
|
|
90
|
+
"expr": "host.platform == 'darwin'",
|
|
91
|
+
"then": false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
89
94
|
→ false (host.platform = "darwin")
|
|
90
95
|
result false (settled after 1 pass)
|
|
91
96
|
```
|
|
92
97
|
|
|
98
|
+
Each layer is named in full, wrapping onto a second line when the column is too narrow for it, and each
|
|
99
|
+
value is pretty-printed JSON, never cut short.
|
|
100
|
+
|
|
93
101
|
`--harness <id>` reads the value from that harness's own config build:
|
|
94
102
|
|
|
95
103
|
```bash
|
|
@@ -312,6 +312,12 @@ from that harness's build:
|
|
|
312
312
|
|
|
313
313
|
- a compilation output marked with a harness (`"harness": "codex"`) comes from that harness's build,
|
|
314
314
|
with the `_vars` written on it;
|
|
315
|
+
- a compilation target whose outputs are all marked with one harness comes whole from that
|
|
316
|
+
harness's build, so a memory a condition gives one harness reaches that harness's memories file;
|
|
317
|
+
- a compilation target only a harness's build holds (a condition on `harness.id` left it out of the
|
|
318
|
+
build with no harness, such as a recipe's skills folder excluded for every other harness) is
|
|
319
|
+
added after the other targets, with only its outputs marked with that harness; a target with no
|
|
320
|
+
such output is left out;
|
|
315
321
|
- an entry of `editor.edits` or `recipes.contents` that only a harness's build holds (a condition on
|
|
316
322
|
`harness.id` put it there) is added, marked with that harness;
|
|
317
323
|
- everything else keeps the value of the build with no harness.
|
|
@@ -118,7 +118,8 @@ edits:
|
|
|
118
118
|
|
|
119
119
|
`ensureFileExists` writes the file only when it is missing, so the project's later edits stay. If
|
|
120
120
|
the recipe goes away, the file is backed up and removed, and each folder Sous created is removed if it
|
|
121
|
-
is empty
|
|
121
|
+
is empty, including the folders Sous created to hold a new file (`.claude/` for a new
|
|
122
|
+
`.claude/settings.json`); a folder that was already there, or that holds anything, stays.
|
|
122
123
|
|
|
123
124
|
## Operations
|
|
124
125
|
|
|
@@ -167,7 +167,7 @@ async function removeSessionFiles(sous) {
|
|
|
167
167
|
export default definePlugin({
|
|
168
168
|
name: "sous-plugin-knowledge-worker",
|
|
169
169
|
version: "1.0.0",
|
|
170
|
-
description: "Example: registers handlers for
|
|
170
|
+
description: "Example: registers handlers for two purposes.",
|
|
171
171
|
|
|
172
172
|
register(sous) {
|
|
173
173
|
// The "configure" purpose. This is the call plugins already use.
|
|
@@ -178,24 +178,33 @@ export default definePlugin({
|
|
|
178
178
|
id: "knowledge-worker/commands",
|
|
179
179
|
handle: checkCommands,
|
|
180
180
|
});
|
|
181
|
-
|
|
182
|
-
// The "uninstall" purpose.
|
|
183
|
-
sous.handlers.add("uninstall", {
|
|
184
|
-
id: "knowledge-worker/session-files",
|
|
185
|
-
handle: removeSessionFiles,
|
|
186
|
-
});
|
|
187
181
|
},
|
|
188
182
|
});
|
|
183
|
+
|
|
184
|
+
// The "uninstall" purpose: exported for the recipe's manifest to point at (see below).
|
|
185
|
+
export { removeSessionFiles };
|
|
189
186
|
```
|
|
190
187
|
|
|
191
188
|
The handler functions are identical either way: the same function body works whether a manifest points at
|
|
192
189
|
it or a plugin registers it. A plugin may also pass `order` (a number, default `500`; lower runs earlier).
|
|
193
|
-
A recipe's handlers are named `<namespace>/<recipe>/<purpose>/<function>`, such as
|
|
194
|
-
`voltagrid/knowledge-worker/check/checkCommands`.
|
|
190
|
+
A recipe's handlers are named `<namespace>/<recipe>/<purpose>/<file>#<function>`, such as
|
|
191
|
+
`voltagrid/knowledge-worker/check/handlers/prerequisites.js#checkCommands`.
|
|
192
|
+
|
|
193
|
+
A plugin cannot add `uninstall` or `migrate` handlers: sous runs them only when a recipe is removed or
|
|
194
|
+
moves to a new version, so `sous.handlers.add("uninstall", ...)` and `sous.handlers.add("migrate", ...)`
|
|
195
|
+
stop the plugin from loading with an error naming it. A plugin a recipe ships declares them in the recipe's
|
|
196
|
+
manifest instead, whose entry may point at a function the plugin's bundle exports:
|
|
195
197
|
|
|
196
|
-
|
|
198
|
+
```yaml
|
|
199
|
+
handlers:
|
|
200
|
+
uninstall:
|
|
201
|
+
- file: plugin/index.js
|
|
202
|
+
handler: removeSessionFiles
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`uninstall` runs only when the recipe is removed through sous. Removing a plugin by hand (with
|
|
197
206
|
`npm uninstall`, or by deleting a line from the config) is the manual path, and sous does not clean up
|
|
198
|
-
after it.
|
|
207
|
+
after it.
|
|
199
208
|
|
|
200
209
|
## What a handler receives
|
|
201
210
|
|
|
@@ -218,4 +227,13 @@ project's folder, the reporter, `run` for starting another intent), plus these h
|
|
|
218
227
|
Paths are relative to the project's folder. Each answer of `isAppAvailable` and `appVersion` is looked
|
|
219
228
|
up once per run, however many handlers ask.
|
|
220
229
|
|
|
221
|
-
|
|
230
|
+
Every line a handler reports is printed with who reported it in front: the recipe or plugin, then the
|
|
231
|
+
purpose and the handler (a recipe's by its function, a plugin's by its id):
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
workflow/github-projects (check: hasGh): the gh command is not installed.
|
|
235
|
+
sous-plugin-knowledge-worker (check: knowledge-worker/commands): jq is not installed.
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
A handler that throws is reported as an error the same way (`voltagrid/knowledge-worker (uninstall:
|
|
239
|
+
removeSessionFiles): failed: <what it threw>`), and the handlers after it still run.
|
|
@@ -29,7 +29,9 @@ $ sous repo init ./my-recipes --name my-recipes --namespace workflow
|
|
|
29
29
|
|
|
30
30
|
`--name` is the repository's short name (default: the directory's own name), `--namespace` the one namespace to
|
|
31
31
|
declare (default: the repository's name), `--force` overwrites a repository that already exists, and `--dry-run`
|
|
32
|
-
lists the files without writing them.
|
|
32
|
+
lists the files without writing them. `--host` names the repository host whose release automation to add:
|
|
33
|
+
`github` writes `.github/workflows/sous-release.yml`, and `gitlab` writes `.gitlab-ci.yml`. Without it, the host is
|
|
34
|
+
read from the directory's `origin` remote, and is `github` when there is none. Names are lowercase kebab-case, so `My-Recipes` yields `my-recipes`. Every
|
|
33
35
|
file is read back through the schemas sous uses on published repositories, so the scaffold validates. The scaffold
|
|
34
36
|
is files only: run `git init`, commit it, and add the remote you publish from before releasing, since
|
|
35
37
|
`sous repo release` reads and writes tags and fails in a directory git does not track.
|
|
@@ -375,9 +377,28 @@ uncommitted, because a tag names one commit and the index records what each reci
|
|
|
375
377
|
refuses when git does not know who is committing: set `git config user.name` and `git config user.email` first, or
|
|
376
378
|
give that identity to the account a continuous integration job runs as (the scaffolded workflow already does).
|
|
377
379
|
|
|
380
|
+
### Retire or move a recipe
|
|
381
|
+
|
|
382
|
+
To retire a recipe, remove its folder and its line under `recipes` in `sous.repo.yaml`; never delete its
|
|
383
|
+
tags. The next release keeps every version it published in the index, marked retired, so projects that pin
|
|
384
|
+
it keep building. To point subscribers somewhere, name replacements under `retired`:
|
|
385
|
+
|
|
386
|
+
```yaml
|
|
387
|
+
retired:
|
|
388
|
+
acme/widget:
|
|
389
|
+
replacements:
|
|
390
|
+
- acme/gadget # a recipe this repository publishes
|
|
391
|
+
- github://other/recipes/tools/widget # a recipe in another repository
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
A recipe that moved to another repository is retired the same way, naming its new home. Like every index
|
|
395
|
+
change, a retirement reaches the index with the next release that publishes a version. The fields and what
|
|
396
|
+
the release checks are in [Retired recipes](repositories-file-formats.md#retired-recipes); what a
|
|
397
|
+
subscriber sees is in [Retired recipes](repositories-consuming.md#retired-recipes).
|
|
398
|
+
|
|
378
399
|
### The scaffolded workflow
|
|
379
400
|
|
|
380
|
-
`sous repo init` writes `.github/workflows/sous-release.yml`, which runs the same command in its two presets,
|
|
401
|
+
On GitHub, `sous repo init` writes `.github/workflows/sous-release.yml`, which runs the same command in its two presets,
|
|
381
402
|
calling the CLI from npm so nothing is installed into the repository. On a **pull request** it runs
|
|
382
403
|
`npx --yes @sous-io/sous repo release --check`, which only reads, so it is safe on an untrusted branch and
|
|
383
404
|
fails the pull request when a manifest is wrong or a published version changed, and notes how the merge will
|
|
@@ -387,6 +408,18 @@ default branch has another name. `--ci` accepts the plan on its own, the redunda
|
|
|
387
408
|
working with an older published sous. Both jobs check out with `fetch-depth: 0`, so existing tags are visible
|
|
388
409
|
and no version is cut twice; the release job also takes `contents: write` and sets a git identity for the commit.
|
|
389
410
|
|
|
411
|
+
On GitLab, it writes `.gitlab-ci.yml` with the same two jobs: `check` on a merge request and `release` on a push to
|
|
412
|
+
the default branch. GitLab's job token cannot push, so the release job pushes with a project access token (the
|
|
413
|
+
`write_repository` scope and the Maintainer role) saved as a masked CI/CD variable named `SOUS_RELEASE_TOKEN`, under
|
|
414
|
+
**Settings, CI/CD, Variables**. `sous repo init` warns about it, and the release job checks for it before it
|
|
415
|
+
commits or tags, failing with a message that names it when it is not set:
|
|
416
|
+
|
|
417
|
+
```text
|
|
418
|
+
Warning: The release job in .gitlab-ci.yml needs a masked CI/CD variable named SOUS_RELEASE_TOKEN, holding a
|
|
419
|
+
project access token with the write_repository scope and the Maintainer role. Until it is set, every release
|
|
420
|
+
job fails before it commits or tags. Set it in the GitLab project under Settings, CI/CD, Variables.
|
|
421
|
+
```
|
|
422
|
+
|
|
390
423
|
## Edit a repository in place
|
|
391
424
|
|
|
392
425
|
This is also how a recipe you have not released yet is run: link the checkout into a project and build. Edits
|
|
@@ -539,7 +572,8 @@ answer the two questions at a terminal (Tab opens your editor for a longer descr
|
|
|
539
572
|
commit message. The body is your description followed by a changelog sous generates by comparing the manifests
|
|
540
573
|
your change carries with the default branch:
|
|
541
574
|
|
|
542
|
-
- recipes added, and recipes retired
|
|
575
|
+
- recipes added, and recipes retired with the replacements `sous.repo.yaml` names for each (a renamed recipe
|
|
576
|
+
shows as one of each);
|
|
543
577
|
- version changes;
|
|
544
578
|
- recipes whose files changed without a version raise, with a warning that a release run with `--ci` (as the
|
|
545
579
|
scaffolded workflow runs it after a merge) refuses a changed recipe whose version was not raised;
|
|
@@ -109,8 +109,17 @@ whatever this project calls that repository; one the project does not trust yet
|
|
|
109
109
|
trust question first, and nothing is fetched from it before the answer. The subscription is
|
|
110
110
|
recorded in its canonical form, `namespace/recipe`.
|
|
111
111
|
|
|
112
|
-
The whole dependency closure resolves before anything is
|
|
113
|
-
|
|
112
|
+
The whole dependency closure resolves before anything is written, and so is everything else that
|
|
113
|
+
could make the subscription fail: a repository you agree to trust along the way is trusted in memory
|
|
114
|
+
only, every recipe the subscription installs is downloaded into this machine's store, and the
|
|
115
|
+
recipes' questions are asked (without a terminal, a required question nothing answers, with no
|
|
116
|
+
`--answer`, no value in scope and no default, is an error). Only then are the trust, the
|
|
117
|
+
subscription, the lockfile and the answers written; an install is whole or not at all, and a failed
|
|
118
|
+
one, a declined question or Ctrl-C leaves the project as it was.
|
|
119
|
+
|
|
120
|
+
Written without `@<range>`, a subscription accepts any version, so `sous update` may move it to a new
|
|
121
|
+
major version; with one, it stays in that range. The plan shown before the question, and the result,
|
|
122
|
+
both name the range recorded (`any version`, or `^1.2.0`).
|
|
114
123
|
|
|
115
124
|
A few flags change how it runs: `--yes` answers yes to the subscribe confirmation and the trust
|
|
116
125
|
question, `--answer <name>=<value>` answers a recipe's question ahead of time, `--dry-run` prints what
|
|
@@ -146,13 +155,15 @@ $ sous subscription add workflow/qa-variables
|
|
|
146
155
|
'workflow'.
|
|
147
156
|
Here is what that does:
|
|
148
157
|
|
|
158
|
+
• It is recorded with the version range 'any version', so an update may move it to any
|
|
159
|
+
newer version, a new major version included.
|
|
149
160
|
• The files it ships are compiled into this project on the next build, which writes them
|
|
150
161
|
into this project's agent directories.
|
|
151
162
|
• Any scripts it ships can be run on this machine when an agent uses them. Sous does not
|
|
152
163
|
run them itself, and it cannot vouch for what they do.
|
|
153
164
|
// two more bullets: the variables it publishes that require an answer and have none yet are
|
|
154
|
-
// asked about
|
|
155
|
-
// dependencies are pinned in the lockfile
|
|
165
|
+
// asked about before anything is written, and the answers are written into this project's env
|
|
166
|
+
// files with the subscription; and its dependencies are pinned in the lockfile
|
|
156
167
|
• If a dependency turns out to live in a repository this project does not trust, sous stops
|
|
157
168
|
and asks about that repository by name before fetching anything from it.
|
|
158
169
|
? Proceed? (y/N) y
|
|
@@ -162,10 +173,12 @@ $ sous subscription add workflow/qa-variables
|
|
|
162
173
|
workflow/qa-variables 0.1.0 qa-recipes you subscribed to it
|
|
163
174
|
```
|
|
164
175
|
|
|
165
|
-
Answering no ends the command with nothing downloaded and no change to your config.
|
|
166
|
-
|
|
167
|
-
`.sous/
|
|
168
|
-
|
|
176
|
+
Answering no ends the command with nothing downloaded and no change to your config. When you say
|
|
177
|
+
yes, the machine-wide store under `~/.sous/cache` gains the files and the recipes' questions are
|
|
178
|
+
asked; then `.sous/conf.d/510-subscriptions.jsonc` records the subscription, `.sous/sous.lock.json`
|
|
179
|
+
records the exact versions and hashes, the answers go to the env files, and any repository you
|
|
180
|
+
agreed to trust goes to `.sous/conf.d/500-repos.jsonc` (all but the store and `.env.local` are
|
|
181
|
+
committed). It then builds, so
|
|
169
182
|
the new skills are on disk when it returns; `--no-build` defers that, and a failed build keeps it.
|
|
170
183
|
|
|
171
184
|
?> Only a recipe a manifest lists under `subscribes` contributes files; one listed under `depends`,
|
|
@@ -293,7 +306,8 @@ build` instead. The `Latest version` column beside it is read from the cache, or
|
|
|
293
306
|
recipe count and its URL; `--verbose` adds a `Namespaces:` line under each row. `sous lock show`
|
|
294
307
|
prints the other half: every version your lockfile pins, where it came from and who holds it. When
|
|
295
308
|
that file has drifted, `sous lock rebuild` recomputes it from your subscriptions and the cached
|
|
296
|
-
indexes,
|
|
309
|
+
indexes. It downloads a recipe only to read what it depends on when its index does not say, and
|
|
310
|
+
writes nothing while one cannot be read.
|
|
297
311
|
|
|
298
312
|
## Moving to newer versions
|
|
299
313
|
|
|
@@ -464,6 +478,34 @@ rather than stopping the build, and the build prints a warning naming it before
|
|
|
464
478
|
`sous vars ask` from a terminal to fill it in. How an answer reaches a template is described in
|
|
465
479
|
[How a template reads an answer](repositories-variables.md#how-a-template-reads-an-answer).
|
|
466
480
|
|
|
481
|
+
## Retired recipes
|
|
482
|
+
|
|
483
|
+
A repository retires a recipe by no longer listing it, and may name replacements for it, in the same
|
|
484
|
+
repository or in another one ([Retired recipes](repositories-file-formats.md#retired-recipes)). Its
|
|
485
|
+
published versions stay in the index, so a project that pins one keeps building it, on a fresh clone too,
|
|
486
|
+
and gets no more updates for it. Every build says so:
|
|
487
|
+
|
|
488
|
+
```text
|
|
489
|
+
The repository 'recipes' retired 'acme/widget'. This project still builds it at the pinned version,
|
|
490
|
+
and it gets no more updates:
|
|
491
|
+
• Pinned version: 0.1.2
|
|
492
|
+
• Used by: this project's subscription to 'acme/widget'
|
|
493
|
+
• Replacement: recipes:acme/gadget
|
|
494
|
+
• Replacement: https://github.com/other/recipes/tools/widget, in a repository this project has not added
|
|
495
|
+
To swap it, run 'sous subscription remove acme/widget', then 'sous subscribe' with each replacement you want.
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
In a terminal, for a recipe the project subscribes to by name, the build offers each replacement in turn
|
|
499
|
+
(`Subscribe to 'recipes:acme/gadget' in place of 'acme/widget'?`, no by default); you may take any of them,
|
|
500
|
+
or none. A yes subscribes as `sous subscription add` does, so a replacement in a repository the project has
|
|
501
|
+
not added goes through the trust question first. Once one is added, the build offers to remove the old
|
|
502
|
+
subscription, unless a replacement of the same name (a recipe that moved) took its place. Nothing changes
|
|
503
|
+
without a yes, and the question comes back on the next build until the subscription is swapped or removed.
|
|
504
|
+
Without a terminal, on a dry run, or in watch mode the build never asks; the warning names the commands
|
|
505
|
+
instead. A retired recipe reached only through a namespace or another recipe's dependencies is reported
|
|
506
|
+
without a question: a namespace never picks up a retired recipe on its next resolve, and a recipe that
|
|
507
|
+
depends on one decides for itself when to stop.
|
|
508
|
+
|
|
467
509
|
## Control freshness and the store
|
|
468
510
|
|
|
469
511
|
A build holds the versions the lockfile pins and does not talk to the network on every run. Sous
|
|
@@ -46,6 +46,11 @@ namespaces:
|
|
|
46
46
|
recipes: # every recipe folder, relative to the repository root
|
|
47
47
|
- recipes/workflow/qa-variables
|
|
48
48
|
- recipes/quality/qa-remote-dep
|
|
49
|
+
retired: # optional: replacements for recipes no longer listed above
|
|
50
|
+
quality/qa-old-dep:
|
|
51
|
+
replacements:
|
|
52
|
+
- quality/qa-remote-dep # in this repository
|
|
53
|
+
- github://acme/recipes/quality/qa-remote-dep # in another repository
|
|
49
54
|
```
|
|
50
55
|
|
|
51
56
|
| Field | Required | Notes |
|
|
@@ -55,6 +60,26 @@ recipes: # every recipe folder, relative to the repos
|
|
|
55
60
|
| `namespaces` | yes | Keyed by namespace name; each entry takes an optional `description` |
|
|
56
61
|
| `recipes` | yes | Relative paths, each holding a recipe manifest; a path listed twice is an error |
|
|
57
62
|
| `submissions` | no | Whether the repository's recipes take proposed changes; see [The submissions block](#the-submissions-block) |
|
|
63
|
+
| `retired` | no | Keyed `namespace/recipe`; see [Retired recipes](#retired-recipes) |
|
|
64
|
+
|
|
65
|
+
### Retired recipes
|
|
66
|
+
|
|
67
|
+
A recipe is retired when the repository stops listing its folder under `recipes`. Nothing else is
|
|
68
|
+
needed: the next release keeps every version it published in the index, under `retired`, so a project
|
|
69
|
+
whose lockfile pins one still restores it on a fresh machine. Release tags are never deleted; the tags
|
|
70
|
+
and the index together are the archive.
|
|
71
|
+
|
|
72
|
+
An entry under `retired` names `replacements`: zero or more recipes subscribers are offered in its
|
|
73
|
+
place, in the order listed. Each is written as a `depends` entry is: `namespace/recipe` for a recipe
|
|
74
|
+
this repository publishes, or a locator ([Ref forms](#ref-forms)) for a recipe in another repository.
|
|
75
|
+
A recipe that moved to another repository is retired here, naming its new home as a replacement; there
|
|
76
|
+
is no separate "moved" record.
|
|
77
|
+
|
|
78
|
+
The release refuses an entry for a recipe `recipes` still lists (a recipe is published or retired, never
|
|
79
|
+
both), a replacement in this repository that it does not publish, and a replacement that names a
|
|
80
|
+
namespace or a repository rather than one recipe. An entry for a recipe the repository never published
|
|
81
|
+
is a warning, and records nothing. What a build does about a retired recipe is in
|
|
82
|
+
[Retired recipes](repositories-consuming.md#retired-recipes).
|
|
58
83
|
|
|
59
84
|
## `sous.recipe.yaml`: the recipe manifest
|
|
60
85
|
|
|
@@ -347,6 +372,8 @@ fetches only this file; nothing more is downloaded until a project subscribes.
|
|
|
347
372
|
| `dependencies` | per version | The range each dependency may take, keyed `namespace/recipe`; see below |
|
|
348
373
|
| `variables` | per version | The version's variable definitions, exactly as its manifest publishes them (see [Variable definitions](#variable-definitions)), with `required`, `secret` and `scope` filled in; `[]` when it asks nothing |
|
|
349
374
|
| `depends`, `subscribes` | per version | The version's manifest lists, exactly as written; `[]` when empty |
|
|
375
|
+
| `retired` | top level | Recipes the repository published and no longer lists, keyed `namespace/recipe`; absent when there are none. Each entry carries `path`, `description` and `versions` as a recipe under `recipes` does, plus `replacements`; see below |
|
|
376
|
+
| `replacements` | per retired recipe | The recipes offered in its place, in order. Each carries `key` (`namespace/recipe`), `repo` (the identity of another repository; absent for this one) and `declared` (the entry exactly as `sous.repo.yaml` wrote it) |
|
|
350
377
|
|
|
351
378
|
Dependencies are recorded at release time and keyed `namespace/recipe`. Each entry carries `range`: the range
|
|
352
379
|
the manifest declares, or `^<the sibling's version at release>` for a sibling named with no range (`*` when the
|
|
@@ -395,6 +422,18 @@ forward with those fields intact.
|
|
|
395
422
|
repository released with `declared`, `kind`, `variables`, `depends` or `subscribes` in it, the official
|
|
396
423
|
one included. A project pinned to such a sous fails to read that index until it moves to 0.2.26 or later.
|
|
397
424
|
|
|
425
|
+
**Retired recipes.** A release keeps every version a retired recipe published: the entries the committed
|
|
426
|
+
index held, and any version a tag carries that it lacks, rebuilt from the tag (the folder and description
|
|
427
|
+
come from the newest tag when the index never recorded them). A retired version whose tag no longer exists
|
|
428
|
+
is an error, as for a published one. A key is under `recipes` or under `retired`, never both, and a retired
|
|
429
|
+
recipe's namespace need not be declared any more. Retired recipes sit outside `recipes`, so a namespace
|
|
430
|
+
never reaches one and a new subscription cannot find one; a subscription or a dependency that already names
|
|
431
|
+
one still resolves to its versions.
|
|
432
|
+
|
|
433
|
+
?> A sous older than this change (0.2.26 or later) ignores `retired`, as it ignores any field it does not
|
|
434
|
+
define: it reads the index without error and treats a retired recipe as gone, so a pin to one fails to
|
|
435
|
+
restore there, as before, until the project moves to a newer sous.
|
|
436
|
+
|
|
398
437
|
**The `seeded` field.** Sous ships the `core` recipe in its own npm package, so a project can build before
|
|
399
438
|
reaching the network. That copy is folded into the official repository's index in memory and resolved like
|
|
400
439
|
any other, marked `seeded: true`; if the repository already publishes it, the published copy wins. Sous
|
|
@@ -457,6 +496,8 @@ $SOUS_HOME/
|
|
|
457
496
|
cache/<repository identity>/<namespace>/<name>/<version>/ .sous.entry.json, then the files
|
|
458
497
|
cache/_indexes/<repository identity>.json the cached index
|
|
459
498
|
cache/_indexes/<repository identity>.meta.json etag, fetchedAt, lastCheckedAt, ref
|
|
499
|
+
cache/read-strategies.json per repository: the read strategy and clone URL that worked, and since when
|
|
500
|
+
cache/gitlab-instances.json per GitLab host: the sub-path GitLab is installed under ("" at the root)
|
|
460
501
|
repos/ checkouts cloned by 'sous repo link --global'
|
|
461
502
|
sous.links.json the machine-wide links map
|
|
462
503
|
```
|
|
@@ -512,6 +553,7 @@ store: # every value is a default you can change
|
|
|
512
553
|
maxBytes: 1073741824 # one gigabyte; past it, 'sous repo gc' evicts unpinned entries
|
|
513
554
|
freshnessSeconds: 300 # how long a fetched index stays fresh
|
|
514
555
|
watchPollSeconds: 300 # how often watch mode polls upstream
|
|
556
|
+
strategyMemorySeconds: 604800 # how long a way of reading or downloading that worked is tried first
|
|
515
557
|
recipes: # what each content kind a subscribed recipe publishes does
|
|
516
558
|
skills: { outputs: ["${projectRoot}/.codex/skills"] } # added to the skills directories agent plugins name
|
|
517
559
|
memories: { first: ["communication/*"], exclude: ["tool-usage/automated-browser-tasks"] }
|