@sous-io/sous 1.1.12 → 1.2.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/dist/sous.js +101 -91
- package/docs/markdown/_sidebar.md +2 -0
- package/docs/markdown/commands.md +40 -14
- package/docs/markdown/configuration.md +43 -0
- package/docs/markdown/handlers.md +3 -1
- package/docs/markdown/project-recipes.md +193 -0
- package/docs/markdown/repositories-authoring.md +37 -1
- package/docs/markdown/repositories-consuming.md +56 -1
- package/docs/markdown/repositories-file-formats.md +64 -9
- package/docs/markdown/repositories.md +22 -0
- package/package.json +38 -38
- package/recipes/core/sous-skills/skills/about-sous/SKILL.tpl.md +14 -1
- package/recipes/core/sous-skills/skills/about-sous-configuration/SKILL.tpl.md +5 -0
- package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +53 -7
- package/recipes/core/sous-skills/skills/about-sous-repos/SKILL.tpl.md +7 -4
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/sous.config.schema.json +77 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- [Overview](repositories.md)
|
|
15
15
|
- [Quickstart](repositories-quickstart.md)
|
|
16
16
|
- [Consuming recipes](repositories-consuming.md)
|
|
17
|
+
- [Your project's own recipes](project-recipes.md)
|
|
17
18
|
- [Contributing a change](repositories-contributing.md)
|
|
18
19
|
- [Authoring a repository](repositories-authoring.md)
|
|
19
20
|
- [Recipe variables](repositories-variables.md)
|
|
@@ -85,3 +86,4 @@
|
|
|
85
86
|
- [0041: A target one harness's build holds reaches that harness](adrs/0041-harness-only-targets.md)
|
|
86
87
|
- [0042: Retired recipes stay in the index and name their replacements](adrs/0042-retired-recipes.md)
|
|
87
88
|
- [0043: Every command runs the waiting migrations first](adrs/0043-migrations-before-every-command.md)
|
|
89
|
+
- [0044: A recipe can recommend other recipes, and sous asks before subscribing to them](adrs/0044-recipe-recommendations.md)
|
|
@@ -23,7 +23,11 @@ finds by walking up from the working directory.
|
|
|
23
23
|
|
|
24
24
|
- `-y, --yes` answers yes to every confirmation the command would ask, and runs any
|
|
25
25
|
[waiting migrations](#sous-migrate) without asking, taking each question's default. Every command takes it.
|
|
26
|
-
`-f`, `--force` and, on the commands that trust a repository, `--trust` are the same flag.
|
|
26
|
+
`-f`, `--force` and, on the commands that trust a repository, `--trust` are the same flag. It does not accept a
|
|
27
|
+
recipe's [recommendations](repositories-consuming.md#recommended-recipes); `--accept-recommendations` does.
|
|
28
|
+
- `--accept-recommendations` and `--decline-recommendations`, on `subscription add` and `update`, subscribe to
|
|
29
|
+
or decline every recipe a subscribed recipe recommends, without asking. Without a terminal and without
|
|
30
|
+
either, a recommendation stays pending and the output lists it; the command does not fail.
|
|
27
31
|
- `--skip-failed-migrations` skips a waiting migration that fails, or asks a question nothing answers, and runs
|
|
28
32
|
the command anyway. The skipped migration is not recorded as run: the next command tries it again. Every
|
|
29
33
|
command takes it.
|
|
@@ -263,8 +267,8 @@ sous init hooks --dry-run
|
|
|
263
267
|
### `sous build`
|
|
264
268
|
|
|
265
269
|
Compiles the project's outputs, then removes the ones the config no longer produces. It is the command you want
|
|
266
|
-
almost always. `-w, --watch` rebuilds on every change to a source file, a config file
|
|
267
|
-
and reloads the config when a file is added to or removed from a glob target's folder;
|
|
270
|
+
almost always. `-w, --watch` rebuilds on every change to a source file, a config file, a linked checkout or
|
|
271
|
+
anything under the project's own recipe paths, and reloads the config when a file is added to or removed from a glob target's folder;
|
|
268
272
|
`--rebuild` ignores cached hashes and reprocesses everything; `--strict` makes compile warnings fail the build.
|
|
269
273
|
|
|
270
274
|
Before it compiles, a build prepares the project's recipes: it pins any new subscription, restores whatever this
|
|
@@ -275,6 +279,15 @@ each replacement of a recipe the project subscribes to by name, then to remove t
|
|
|
275
279
|
[Retired recipes](repositories-consuming.md#retired-recipes)). The other commands
|
|
276
280
|
that build (`init`, `launch`, `prune`, `subscription add` and the like) run this same build.
|
|
277
281
|
|
|
282
|
+
A build also uses the project's own recipes, read from the working tree as they are now (see
|
|
283
|
+
[Your project's own recipes](project-recipes.md)), and pins what they need from other repositories. When
|
|
284
|
+
one has the same key as a subscribed recipe, the subscribed one is not built, and every build says so
|
|
285
|
+
(unless the subscribed one is `core`):
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
Skipped the subscribed sous-recipes:tooling/linting: this project's own recipe project:tooling/linting is used instead.
|
|
289
|
+
```
|
|
290
|
+
|
|
278
291
|
A build compiles only the recipes whose subscriptions are switched on on this machine. Each one it skips gets a
|
|
279
292
|
line saying why:
|
|
280
293
|
|
|
@@ -413,8 +426,8 @@ sous launch claude-code -- -c
|
|
|
413
426
|
|
|
414
427
|
### `sous search TEXT`
|
|
415
428
|
|
|
416
|
-
Searches the recipes every trusted repository publishes, by name or description.
|
|
417
|
-
`sous repo search`.
|
|
429
|
+
Searches the recipes every trusted repository publishes, by name or description. A result lists the recipes
|
|
430
|
+
it recommends. Also spelled `sous repo search`.
|
|
418
431
|
|
|
419
432
|
```bash
|
|
420
433
|
sous search task
|
|
@@ -425,7 +438,10 @@ sous search task
|
|
|
425
438
|
Moves the lockfile's pins to the newest versions their ranges allow, then rebuilds: every subscription, or only
|
|
426
439
|
the repository, namespace or recipe `REF` names. `--dry-run` prints the plan and changes nothing. It asks before
|
|
427
440
|
it changes anything and before trusting a repository a newer version needs; `--yes` answers yes, and
|
|
428
|
-
`--answer <name>=<value>` or `--answers-file <path>` answer a new version's questions ahead of time.
|
|
441
|
+
`--answer <name>=<value>` or `--answers-file <path>` answer a new version's questions ahead of time. Every
|
|
442
|
+
recommendation the project has not answered yet is offered, whether a newer version brings it or an earlier run left
|
|
443
|
+
it pending, and the plan lists them; `--accept-recommendations` or `--decline-recommendations` answers them ahead of
|
|
444
|
+
time, and `--yes` does not.
|
|
429
445
|
`sous subscription update` and `sous recipe update` are other spellings of it. See
|
|
430
446
|
[Moving to newer versions](repositories-consuming.md#moving-to-newer-versions).
|
|
431
447
|
|
|
@@ -665,7 +681,9 @@ Publishes new versions of the repository's recipes: raises their versions, regen
|
|
|
665
681
|
tags. It plans first and asks once, and it needs a git commit identity (`user.name` and `user.email`) in the
|
|
666
682
|
repository. `--check` only validates, and `--ci` is the setting for a merge job. A recipe the repository no
|
|
667
683
|
longer lists keeps its published versions in the index, marked retired, with any replacements `sous.repo.yaml`
|
|
668
|
-
names (see [Retire or move a recipe](repositories-authoring.md#retire-or-move-a-recipe)).
|
|
684
|
+
names (see [Retire or move a recipe](repositories-authoring.md#retire-or-move-a-recipe)). It warns about every
|
|
685
|
+
recipe that uses `recommends`, which needs sous 1.2.0 or later in every subscribing project (see
|
|
686
|
+
[Recommend other recipes](repositories-authoring.md#recommend-other-recipes)).
|
|
669
687
|
|
|
670
688
|
```bash
|
|
671
689
|
sous repo release --recipe workflow/task-files --bump minor --push
|
|
@@ -695,7 +713,10 @@ Manages which recipes the project subscribes to. `REF` is `namespace` or `namesp
|
|
|
695
713
|
trust, the subscription, the lockfile and the answers written, so a failed subscription, a declined question
|
|
696
714
|
or Ctrl-C leaves the project as it was. Without `@<range>` the subscription accepts any version,
|
|
697
715
|
so an update may move it to a new major version; the plan shown before the question, and the result, name
|
|
698
|
-
the range recorded.
|
|
716
|
+
the range recorded. A recipe it installs may recommend others; each is offered, with its reason, and
|
|
717
|
+
`--accept-recommendations` or `--decline-recommendations` answers every one ahead of time (see
|
|
718
|
+
[Recommended recipes](repositories-consuming.md#recommended-recipes)). A declined one is recorded under
|
|
719
|
+
`declinedRecommendations`, and adding it later with `subscription add` removes it from there.
|
|
699
720
|
- `subscription remove` (or `sous unsubscribe`) removes a subscription and everything only it brought in. The
|
|
700
721
|
built-in `core` subscription is switched off instead, keeping its pin.
|
|
701
722
|
- `subscription update [REF]` is [`sous update`](#sous-update-ref).
|
|
@@ -711,14 +732,18 @@ sous sub ls
|
|
|
711
732
|
|
|
712
733
|
## namespace and recipe
|
|
713
734
|
|
|
714
|
-
Browse what the trusted repositories publish, offline
|
|
735
|
+
Browse what the trusted repositories publish, offline, and the project's own recipes, which are listed
|
|
736
|
+
under the reserved repository name `project` (see [Your project's own recipes](project-recipes.md)). For
|
|
737
|
+
those, `Latest` reads `working copy` and `Subscribed` reads `yes, its own`; a "Namespace from" column (in
|
|
738
|
+
`recipe show`, a field) says where each namespace was worked out from, and `recipe list` adds a note
|
|
739
|
+
explaining the repository `project`.
|
|
715
740
|
|
|
716
741
|
- `namespace list` lists every namespace and how much of it the project subscribes to.
|
|
717
742
|
- `namespace show REF` lists one namespace's recipes, with their latest and pinned versions.
|
|
718
743
|
- `recipe list` lists every recipe, across every namespace. A description takes at most three lines, the
|
|
719
744
|
third ending in `...` when more is left out; `recipe show` prints it whole.
|
|
720
|
-
- `recipe show REF` describes one recipe completely: its versions, dependencies, the questions it
|
|
721
|
-
its files go, even before anything installs it.
|
|
745
|
+
- `recipe show REF` describes one recipe completely: its versions, dependencies, recommendations, the questions it
|
|
746
|
+
asks and where its files go, even before anything installs it.
|
|
722
747
|
|
|
723
748
|
```bash
|
|
724
749
|
sous namespace show sous-recipes:core
|
|
@@ -730,8 +755,8 @@ sous recipe show omakase/house
|
|
|
730
755
|
Inspects and repairs the project's lockfile, `.sous/sous.lock.json`.
|
|
731
756
|
|
|
732
757
|
- `lock show` prints what the lockfile pins, and why each recipe is there.
|
|
733
|
-
- `lock rebuild` recomputes the lockfile from scratch from the subscriptions
|
|
734
|
-
for a lockfile damaged by a hand edit or a bad merge. A recipe whose index does not record what it depends on
|
|
758
|
+
- `lock rebuild` recomputes the lockfile from scratch from the subscriptions, the project's own recipes and the
|
|
759
|
+
cached indexes: the repair for a lockfile damaged by a hand edit or a bad merge. A recipe whose index does not record what it depends on
|
|
735
760
|
is downloaded to read its manifest; when one cannot be, nothing is written and the command fails, naming it.
|
|
736
761
|
`--dry-run` downloads nothing.
|
|
737
762
|
|
|
@@ -744,7 +769,8 @@ sous lock rebuild --dry-run
|
|
|
744
769
|
Inspects the questions the project's recipes ask, and the answers they hold; see
|
|
745
770
|
[Recipe variables](repositories-variables.md). `sous vars` alone is `vars list`.
|
|
746
771
|
|
|
747
|
-
- `vars list` lists every variable, with where its value came from.
|
|
772
|
+
- `vars list` lists every variable, with where its value came from. A variable of one of the project's own
|
|
773
|
+
recipes names it as "this project's own recipe (its working copy)" instead of a version and a repository.
|
|
748
774
|
- `vars show NAME` shows everything about one variable. `NAME` may also be an environment variable name that
|
|
749
775
|
answers it.
|
|
750
776
|
- `vars ask [NAME]` asks the questions and stores the answers in the `.sous` env files. `--save-shared` stores
|
|
@@ -101,6 +101,32 @@ sous for editor autocompletion; sous accepts and ignores the key.
|
|
|
101
101
|
?> Configs use `${var}` syntax. Template files use LiquidJS double-brace syntax instead; the two
|
|
102
102
|
are resolved at different stages and never mix.
|
|
103
103
|
|
|
104
|
+
### The project's own recipes
|
|
105
|
+
|
|
106
|
+
`projectRecipes` says where the project keeps recipes of its own, which every build reads from the
|
|
107
|
+
working tree with no subscription, release or lockfile entry. See
|
|
108
|
+
[Your project's own recipes](project-recipes.md).
|
|
109
|
+
|
|
110
|
+
- `projectRecipes.paths` (`string[] = [".sous/recipes/*"]`): folders or glob patterns, relative to
|
|
111
|
+
the project root. A matched folder holding a recipe manifest is a recipe; any other matched
|
|
112
|
+
folder is searched for recipe folders beneath it (never inside a recipe, `node_modules`, or a
|
|
113
|
+
folder whose name starts with a dot). `[]` turns the project's own recipes off.
|
|
114
|
+
- `projectRecipes.exclude` (`string[] = []`): recipes to leave out. Each entry is a namespace (every
|
|
115
|
+
recipe in it), a `namespace/recipe` key, a glob over keys, or a regular expression between two
|
|
116
|
+
slashes; the same forms as `recipes.memories.exclude`, plus bare namespaces.
|
|
117
|
+
|
|
118
|
+
```jsonc
|
|
119
|
+
{
|
|
120
|
+
"projectRecipes": {
|
|
121
|
+
"paths": [".sous/recipes/*", "tools/agent-recipes"],
|
|
122
|
+
"exclude": ["tooling/draft-*"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The repository name `project` is reserved for these recipes, so a `repos.project` entry is an
|
|
128
|
+
error.
|
|
129
|
+
|
|
104
130
|
## Templates and the `.tpl.` convention
|
|
105
131
|
|
|
106
132
|
A file's own name decides whether sous renders it, every time. A file with `.tpl.` in its name is rendered
|
|
@@ -430,6 +456,23 @@ Two more keys settle what plugins do:
|
|
|
430
456
|
`sous plugins show` lists every plugin and what it adds. Recipes may ship plugins too; see
|
|
431
457
|
[where plugins come from](architecture/specifications/S1-engine.md#where-plugins-come-from).
|
|
432
458
|
|
|
459
|
+
## Declined recommendations
|
|
460
|
+
|
|
461
|
+
`declinedRecommendations` (`string[]`, default `[]`) lists the recipes this project said no to when a
|
|
462
|
+
subscribed recipe [recommended](repositories-consuming.md#recommended-recipes) them, so sous does not offer
|
|
463
|
+
them again. Each entry is a recipe (`namespace/recipe`) or a whole namespace (`namespace`), in canonical form.
|
|
464
|
+
|
|
465
|
+
Sous writes it to `.sous/conf.d/510-subscriptions.jsonc` when you decline a recommendation, or pass
|
|
466
|
+
`--decline-recommendations` to `sous subscription add` or `sous update`. `sous subscription add` with a
|
|
467
|
+
declined ref removes that entry. You may edit the list by hand too; once an entry is deleted, sous offers
|
|
468
|
+
that recommendation again the next time a subscription or an update brings it.
|
|
469
|
+
|
|
470
|
+
```jsonc
|
|
471
|
+
{
|
|
472
|
+
"declinedRecommendations": ["quality/lint-rules", "workflow"]
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
433
476
|
## Outputs, the state file and backups
|
|
434
477
|
|
|
435
478
|
Sous records every file it writes in the state file, `.sous/sous.state.json` by default
|
|
@@ -96,7 +96,9 @@ export async function checkJiraSignIn(sous) {
|
|
|
96
96
|
The rules for a recipe's handlers:
|
|
97
97
|
|
|
98
98
|
- **Trust.** A handler is code, so it runs only from a repository the project trusts, as a recipe's
|
|
99
|
-
plugin does. Nothing inside a repository runs before it is trusted.
|
|
99
|
+
plugin does. Nothing inside a repository runs before it is trusted. A handler of one of the project's
|
|
100
|
+
own recipes (see [Your project's own recipes](project-recipes.md)) runs with no trust question, since
|
|
101
|
+
it is code in the project itself.
|
|
100
102
|
- **One self-contained file each.** sous never runs `npm install` for a recipe, so a handler file cannot
|
|
101
103
|
import packages. Bundle anything it needs into the file.
|
|
102
104
|
- **Only subscribed recipes.** A recipe held only through `depends` is a library and contributes no
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Your Project's Own Recipes
|
|
2
|
+
|
|
3
|
+
A project can keep recipes of its own, inside its own repository, and use them without publishing
|
|
4
|
+
anything. Sous reads them from the working tree on every build, so an edit shows up on the next
|
|
5
|
+
`sous build`: no release, no version raise, no lockfile change.
|
|
6
|
+
|
|
7
|
+
Use one for agent configuration that belongs to this project alone (a review checklist, a deploy
|
|
8
|
+
skill, the hooks your team's tools need), or to try a recipe out before it goes to a shared
|
|
9
|
+
repository. A project recipe is an ordinary recipe: the same `sous.recipe.yaml`, the same
|
|
10
|
+
`contents`, variables, plugin and handlers as one you subscribe to (see
|
|
11
|
+
[Authoring a repository](repositories-authoring.md)). What differs is where it comes from.
|
|
12
|
+
|
|
13
|
+
## A first recipe
|
|
14
|
+
|
|
15
|
+
By default, sous looks for recipes under `.sous/recipes/`. Put a folder there holding a manifest
|
|
16
|
+
and the files it publishes:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
.sous/recipes/
|
|
20
|
+
tooling/
|
|
21
|
+
review-helpers/
|
|
22
|
+
sous.recipe.yaml
|
|
23
|
+
skills/
|
|
24
|
+
review-helpers/
|
|
25
|
+
SKILL.md
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
# .sous/recipes/tooling/review-helpers/sous.recipe.yaml
|
|
30
|
+
formatVersion: 1
|
|
31
|
+
name: review-helpers
|
|
32
|
+
description: Our pre-merge review checklist.
|
|
33
|
+
contents:
|
|
34
|
+
- kind: skills
|
|
35
|
+
include: [skills/**]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then build:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
sous build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The skill is written to `.claude/skills/review-helpers/SKILL.md`, as a subscribed recipe's skill
|
|
45
|
+
would be. There was nothing to subscribe to: every recipe the project's recipe paths cover is in
|
|
46
|
+
use. The manifest needs no `namespace` and no `version`. The namespace, `tooling`, came from the
|
|
47
|
+
folder holding the recipe (see [Namespaces](#namespaces)), and a version is needed only to publish.
|
|
48
|
+
|
|
49
|
+
Sous lists project recipes under the reserved repository name `project`, so the full ref of this
|
|
50
|
+
one is `project:tooling/review-helpers`:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
$ sous recipe list
|
|
54
|
+
Recipe Repository Latest Pinned Subscribed What it is Namespace from
|
|
55
|
+
----------------------- ----------- ------------ ------ ------------ ------------------------------- ---------------------
|
|
56
|
+
tooling/review-helpers project working copy yes, its own Our pre-merge review checklist. the folder holding it
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The table above is trimmed to the project's own recipe. The real list shows every recipe of every
|
|
60
|
+
repository the project trusts, with a note under it explaining the repository `project`.
|
|
61
|
+
|
|
62
|
+
`sous recipe show project:tooling/review-helpers` says it is used from its working copy, with no
|
|
63
|
+
lockfile entry, and where its namespace came from. `sous namespace list` shows the namespace with a
|
|
64
|
+
"Namespace from" column too.
|
|
65
|
+
|
|
66
|
+
## Where sous looks: `projectRecipes`
|
|
67
|
+
|
|
68
|
+
`projectRecipes.paths` (`string[] = [".sous/recipes/*"]`) lists the folders that hold the project's
|
|
69
|
+
own recipes, relative to the project root. Each entry is a folder or a glob pattern:
|
|
70
|
+
|
|
71
|
+
- A matched folder that holds a recipe manifest (`sous.recipe.yaml`, `.yml`, `.json` or `.jsonc`)
|
|
72
|
+
is a recipe.
|
|
73
|
+
- A matched folder that does not is searched for recipe folders beneath it, at any depth. The
|
|
74
|
+
search never looks inside a recipe, inside `node_modules`, or inside a folder whose name starts
|
|
75
|
+
with a dot.
|
|
76
|
+
- `[]` turns the project's own recipes off.
|
|
77
|
+
|
|
78
|
+
`projectRecipes.exclude` (`string[] = []`) leaves recipes out. Each entry is one of:
|
|
79
|
+
|
|
80
|
+
- a namespace, which leaves out every recipe in it: `tooling`;
|
|
81
|
+
- a `namespace/recipe` key: `tooling/review-helpers`;
|
|
82
|
+
- a glob over keys: `tooling/draft-*`;
|
|
83
|
+
- a regular expression between two slashes, matched against keys: `/^tooling\//`.
|
|
84
|
+
|
|
85
|
+
```jsonc
|
|
86
|
+
// .sous/sous.config.jsonc
|
|
87
|
+
{
|
|
88
|
+
"projectRecipes": {
|
|
89
|
+
"paths": [".sous/recipes/*", "tools/agent-recipes"],
|
|
90
|
+
"exclude": ["tooling/draft-*"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The name `project` is reserved for these recipes. A `repos.project` entry is an error, which points
|
|
96
|
+
at `projectRecipes.paths: []` and `projectRecipes.exclude` as the way to turn them off.
|
|
97
|
+
|
|
98
|
+
## Namespaces
|
|
99
|
+
|
|
100
|
+
A recipe's namespace is the one its manifest names, when it names one. Otherwise sous works it out,
|
|
101
|
+
taking the first of these that gives a name:
|
|
102
|
+
|
|
103
|
+
1. The nearest `sous.namespace.yaml` above the recipe that sets a `name`.
|
|
104
|
+
2. The first folder under the path that found the recipe. With the path `.sous/recipes/*`, the
|
|
105
|
+
recipe in `.sous/recipes/a/b/review-helpers` gets `a`. A recipe directly under the path's folder,
|
|
106
|
+
such as `.sous/recipes/review-helpers`, gets nothing from this step.
|
|
107
|
+
3. The `name` in the project's sous config.
|
|
108
|
+
4. The `name` in the nearest `package.json`, without its npm scope: `@acme/widget` gives `widget`.
|
|
109
|
+
5. The repository name of the git `origin` remote.
|
|
110
|
+
6. The project folder's name.
|
|
111
|
+
|
|
112
|
+
Every search stops at the project root, and every name worked out this way is kebab-cased:
|
|
113
|
+
`Acme Tools` gives `acme-tools`. `recipe list`, `recipe show` and `namespace list` show which of
|
|
114
|
+
these each namespace came from.
|
|
115
|
+
|
|
116
|
+
A `sous.namespace.yaml` file names a namespace and describes it. It holds two optional fields:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
# .sous/recipes/tooling/sous.namespace.yaml
|
|
120
|
+
name: tooling
|
|
121
|
+
description: Helpers for the team's own tools.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`namespace list` shows its `description`. Two recipes that end up with the same
|
|
125
|
+
`namespace/recipe` key are a warning, and only the first (by folder) is used.
|
|
126
|
+
|
|
127
|
+
## When a subscribed recipe has the same key
|
|
128
|
+
|
|
129
|
+
A project recipe and a subscribed recipe may have the same key, for example when you copy a
|
|
130
|
+
published recipe into `.sous/recipes/` to change it. The project recipe is used. The subscribed one
|
|
131
|
+
keeps its pin in the lockfile but is not built, and every build says so:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
Skipped the subscribed sous-recipes:tooling/linting: this project's own recipe project:tooling/linting is used instead.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Delete the project recipe, or leave it out with `projectRecipes.exclude`, and the next build uses
|
|
138
|
+
the subscribed one again. A recipe that replaces one in the built-in `core` subscription does it
|
|
139
|
+
without the line.
|
|
140
|
+
|
|
141
|
+
## Depending on other repositories
|
|
142
|
+
|
|
143
|
+
A project recipe may list recipes from the project's trusted repositories under `depends` and
|
|
144
|
+
`subscribes`. Sous resolves and pins them as it does a subscription's, and records the project
|
|
145
|
+
recipe as their holder in the lockfile:
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
# .sous/recipes/tooling/review-helpers/sous.recipe.yaml
|
|
149
|
+
formatVersion: 1
|
|
150
|
+
name: review-helpers
|
|
151
|
+
subscribes:
|
|
152
|
+
- workflow/task-files
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
"workflow/task-files": { "kind": "subscribes", "repo": "sous-recipes", "version": "1.0.2",
|
|
157
|
+
"requestedBy": ["tooling/review-helpers"], "hash": "sha256-..." }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
A bare `namespace/recipe` in a project recipe's manifest means one of the project's own recipes
|
|
161
|
+
first (as does anything written `project:namespace/recipe`), then the project's trusted
|
|
162
|
+
repositories, as for any ref. When a project recipe stops needing one, the next build removes it
|
|
163
|
+
from the lockfile. `sous lock rebuild` and `sous doctor` take project recipes into account.
|
|
164
|
+
|
|
165
|
+
## Code in a project recipe
|
|
166
|
+
|
|
167
|
+
A project recipe's [sous plugin](repositories-authoring.md#recipes-that-ship-sous-plugins) and its
|
|
168
|
+
[handlers](handlers.md) run with no trust question: they are files in your own repository, as any
|
|
169
|
+
script in it is. Review a change to them as you would review any code the project runs.
|
|
170
|
+
|
|
171
|
+
The config files a project recipe publishes may set the same keys as any recipe's (see
|
|
172
|
+
[recipes: what each content kind does](repositories-file-formats.md#recipes-what-each-content-kind-does)).
|
|
173
|
+
Its variables are asked like any recipe's; `sous vars list` names the recipe as "this project's own
|
|
174
|
+
recipe (its working copy)".
|
|
175
|
+
|
|
176
|
+
## Watch mode
|
|
177
|
+
|
|
178
|
+
`sous build --watch` rebuilds when anything changes under one of the project recipe paths,
|
|
179
|
+
including a new recipe folder. A glob path is watched from the folder before its first pattern
|
|
180
|
+
character, so `.sous/recipes/*` watches all of `.sous/recipes/`.
|
|
181
|
+
|
|
182
|
+
## Publishing
|
|
183
|
+
|
|
184
|
+
A project recipe is never published by being there. A project that is also a recipe repository
|
|
185
|
+
publishes the recipes its own `sous.repo.yaml` lists, through `sous repo release`; see
|
|
186
|
+
[Authoring a repository](repositories-authoring.md).
|
|
187
|
+
|
|
188
|
+
## Where to go next
|
|
189
|
+
|
|
190
|
+
- [Consuming recipes](repositories-consuming.md): subscribing to recipes others publish
|
|
191
|
+
- [Authoring a repository](repositories-authoring.md): the manifest, releasing and proposing
|
|
192
|
+
- [Repository file formats](repositories-file-formats.md): every manifest field and config key
|
|
193
|
+
- [Handlers](handlers.md): code a recipe runs during a build
|
|
@@ -117,6 +117,10 @@ relative to the recipe folder (and optional `exclude` patterns). Sous registers
|
|
|
117
117
|
[recipe manifest](repositories-file-formats.md#sousrecipeyaml-the-recipe-manifest) reference, and recipe
|
|
118
118
|
metadata is the source of truth for the version: never edit `sous.index.json` by hand.
|
|
119
119
|
|
|
120
|
+
?> To write a recipe for one project only, or to try one out before it is published, put it under that
|
|
121
|
+
project's `.sous/recipes/` instead: every build uses it from the working tree, with no release. See
|
|
122
|
+
[Your project's own recipes](project-recipes.md).
|
|
123
|
+
|
|
120
124
|
### Conditional contents, inline content and edits
|
|
121
125
|
|
|
122
126
|
`contents` is added to the subscriber's config, so any of its values may be a
|
|
@@ -197,7 +201,9 @@ plugin:
|
|
|
197
201
|
```
|
|
198
202
|
|
|
199
203
|
Nothing in a repository runs until the subscriber trusts the repository, so the trust question is the
|
|
200
|
-
gate for a recipe's plugin as for its other content.
|
|
204
|
+
gate for a recipe's plugin as for its other content. A project's own recipe (see
|
|
205
|
+
[Your project's own recipes](project-recipes.md)) asks no trust question: its plugin is code in the project
|
|
206
|
+
itself. Sous copies a recipe plugin's `.d.ts` file into the
|
|
201
207
|
subscriber's `.sous/types/`, so other plugins in that project see its types; a plugin with no `.d.ts`
|
|
202
208
|
still works. A recipe may also require plugins from npm, each with a version range:
|
|
203
209
|
|
|
@@ -310,6 +316,36 @@ short names are refused: a local repository is a consumer's convenience, and a s
|
|
|
310
316
|
private label. See [Dependencies named by location](repositories-file-formats.md#dependencies-named-by-location)
|
|
311
317
|
and every accepted spelling in [Ref forms](repositories-file-formats.md#ref-forms).
|
|
312
318
|
|
|
319
|
+
### Recommend other recipes
|
|
320
|
+
|
|
321
|
+
`recommends` names recipes that make yours work better but that it does not need. Sous offers each one to the
|
|
322
|
+
subscriber, showing your `reason`, and subscribes to it only when the subscriber says yes; a subscriber who says
|
|
323
|
+
no is not asked again. Use it for anything a subscriber could reasonably do without, and keep `subscribes` for
|
|
324
|
+
what your recipe cannot work without.
|
|
325
|
+
|
|
326
|
+
```yaml
|
|
327
|
+
recommends:
|
|
328
|
+
- quality/lint-rules
|
|
329
|
+
- ref: quality/test-coverage
|
|
330
|
+
reason: >-
|
|
331
|
+
/review flags untested changes much more precisely when the coverage skill is present. Skip it if your
|
|
332
|
+
project has no test suite.
|
|
333
|
+
- ref: github://sous-io/sous-recipes/workflow/task-files@^1.2
|
|
334
|
+
reason: Lets /review attach its findings to the current task file.
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
An entry is a ref, written exactly as a `subscribes` entry is, or `{ ref, reason }`. Write the `reason` for
|
|
338
|
+
someone deciding whether to say yes: what the other recipe adds to yours, and when to skip it. It is shown
|
|
339
|
+
shortened when it is long, so put the point in its first sentence.
|
|
340
|
+
|
|
341
|
+
!> A sous older than 1.2.0 refuses a manifest that holds `recommends`, so every subscriber needs sous 1.2.0 or
|
|
342
|
+
later once your recipe uses it. `sous repo release` warns about each recipe that does.
|
|
343
|
+
|
|
344
|
+
A recommended recipe may be missing, because the subscriber declined it, so a recommendation gives your
|
|
345
|
+
templates nothing: an include line resolves only against your recipe and what it lists under `depends` or
|
|
346
|
+
`subscribes`, and a recommended recipe's questions are asked only when the subscriber accepts it. Write your
|
|
347
|
+
instructions so they still read correctly without it ("if the task-files skill is present, ...").
|
|
348
|
+
|
|
313
349
|
## Cut a release
|
|
314
350
|
|
|
315
351
|
`sous repo release` publishes new versions: one run raises versions, regenerates `sous.index.json`, commits both,
|
|
@@ -122,7 +122,8 @@ major version; with one, it stays in that range. The plan shown before the quest
|
|
|
122
122
|
both name the range recorded (`any version`, or `^1.2.0`).
|
|
123
123
|
|
|
124
124
|
A few flags change how it runs: `--yes` answers yes to the subscribe confirmation and the trust
|
|
125
|
-
question
|
|
125
|
+
question (but not to [recommendations](#recommended-recipes)), `--accept-recommendations` and
|
|
126
|
+
`--decline-recommendations` answer every recommendation, `--answer <name>=<value>` answers a recipe's question ahead of time, `--dry-run` prints what
|
|
126
127
|
would be installed without writing or downloading anything, and `--non-interactive` fails instead of
|
|
127
128
|
asking, naming the flag that would have answered. `sous subscription add --help` lists every flag.
|
|
128
129
|
|
|
@@ -186,6 +187,50 @@ like `workflow/qa-helper` above, is fetched and pinned but stays out of your out
|
|
|
186
187
|
lists have their questions asked. See
|
|
187
188
|
[Dependencies](repositories.md#dependencies).
|
|
188
189
|
|
|
190
|
+
### Recommended recipes
|
|
191
|
+
|
|
192
|
+
A recipe may recommend other recipes: ones that make it work better but that it does not need. Sous asks
|
|
193
|
+
about each one, showing the recipe author's reason, and subscribes to it only when you say yes. It asks:
|
|
194
|
+
|
|
195
|
+
- when `sous subscription add` subscribes to a recipe that recommends others;
|
|
196
|
+
- when `sous update` runs, for every recommendation not answered yet: one a newer version brings, and one an
|
|
197
|
+
earlier run left pending ([Moving to newer versions](#moving-to-newer-versions)).
|
|
198
|
+
|
|
199
|
+
It never asks during `sous build`. The recommendations of a recipe you subscribe to, or that one of your
|
|
200
|
+
recipes lists under `subscribes`, are offered; those of a recipe held only through `depends` are not. A recipe
|
|
201
|
+
your project already subscribes to or holds is not offered. This
|
|
202
|
+
shows the flow; the exact wording is the command's own:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
'quality/code-review' recommends 'quality/test-coverage':
|
|
206
|
+
/review flags untested changes much more precisely when the coverage skill is present. Skip it
|
|
207
|
+
if your project has no test suite.
|
|
208
|
+
? Subscribe to 'quality/test-coverage' too? (y/N)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
What each answer does:
|
|
212
|
+
|
|
213
|
+
- **Yes** makes the recommended recipe a subscription of your project's own, exactly as if you had run
|
|
214
|
+
`sous subscription add` with it: removing the recipe that recommended it later leaves it in place. Its own
|
|
215
|
+
recommendations are offered in turn.
|
|
216
|
+
- **No** declines it. The ref is added to `declinedRecommendations` in `.sous/conf.d/510-subscriptions.jsonc`,
|
|
217
|
+
so sous does not ask about it again, whichever recipe recommends it.
|
|
218
|
+
|
|
219
|
+
Two switches answer every recommendation ahead of time: `--accept-recommendations` subscribes to each one,
|
|
220
|
+
and `--decline-recommendations` declines each one. `--yes` does neither, so a scripted run never subscribes
|
|
221
|
+
to something you did not name. With `--yes` (or `--trust`), `--accept-recommendations` also trusts a
|
|
222
|
+
repository a recommended recipe lives in that the project has not added. With `--accept-recommendations`, an
|
|
223
|
+
`--answer` may also answer a question of a recipe it subscribes to; one that names nothing any subscribed
|
|
224
|
+
recipe asks is reported as unused.
|
|
225
|
+
|
|
226
|
+
Without a terminal and without either switch, sous neither accepts nor declines: each recommendation stays
|
|
227
|
+
**pending**, the command finishes, and its output lists every pending one with the recipe that recommends it.
|
|
228
|
+
Nothing is recorded for a pending recommendation; to take one, run `sous subscription add` with its ref.
|
|
229
|
+
|
|
230
|
+
To change your mind about a declined one, run `sous subscription add` with its ref: that subscribes to it and
|
|
231
|
+
removes it from `declinedRecommendations`. To be asked again instead, delete its entry from
|
|
232
|
+
`declinedRecommendations` in `.sous/conf.d/510-subscriptions.jsonc` by hand.
|
|
233
|
+
|
|
189
234
|
## Choose where the files land
|
|
190
235
|
|
|
191
236
|
Recipe files compile under the [`.tpl.` convention](configuration.md#templates-and-the-tpl-convention): a file
|
|
@@ -345,6 +390,11 @@ What it will and will not do:
|
|
|
345
390
|
fails naming the flag. With nothing to update it says so and asks nothing.
|
|
346
391
|
- A repository a newer version needs that the project does not trust goes through the usual trust
|
|
347
392
|
question, and new questions the newer versions ask are asked the way subscribing asks them.
|
|
393
|
+
- Every recommendation the project has not answered yet is offered, as subscribing offers it
|
|
394
|
+
([Recommended recipes](#recommended-recipes)): one a newer version brings, and one an earlier run
|
|
395
|
+
left pending. A declined one is not. The plan lists them, marking the ones a new version brings.
|
|
396
|
+
`--yes` accepts the plan but not the recommendations; `--accept-recommendations` and
|
|
397
|
+
`--decline-recommendations` answer them.
|
|
348
398
|
- A repository whose index cannot be fetched is skipped and named, and its pins stay put.
|
|
349
399
|
- A linked repository's pins move too, and the plan notes that builds keep reading the checkout
|
|
350
400
|
until it is unlinked.
|
|
@@ -580,6 +630,10 @@ So a pipeline or an agent needs three things and nothing else: `--yes` for the c
|
|
|
580
630
|
`--accept-first` for an ambiguous one-word ref, and either `--answer` or those environment
|
|
581
631
|
variables. The command's help prints under the error, on stderr, and the error itself on stdout.
|
|
582
632
|
|
|
633
|
+
A [recommendation](#recommended-recipes) does not fail such a run. It is an offer, not something the command
|
|
634
|
+
needs, so it stays pending and the output lists it. Pass `--accept-recommendations` or
|
|
635
|
+
`--decline-recommendations` to answer every recommendation instead.
|
|
636
|
+
|
|
583
637
|
## Where to go next
|
|
584
638
|
|
|
585
639
|
- [Troubleshooting](repositories-troubleshooting.md): what a failed add, subscribe or build is
|
|
@@ -587,5 +641,6 @@ variables. The command's help prints under the error, on stderr, and the error i
|
|
|
587
641
|
- [Recipe variables](repositories-variables.md): answers, the ladder, `sous vars`
|
|
588
642
|
- [Providers](repositories-providers.md): how a URL is matched, and reading a path on this machine
|
|
589
643
|
- [Authoring a repository](repositories-authoring.md): publishing recipes of your own
|
|
644
|
+
- [Your project's own recipes](project-recipes.md): recipes kept in the project, used without publishing
|
|
590
645
|
- [Repository file formats](repositories-file-formats.md): every schema
|
|
591
646
|
- [Command reference](commands.md): every command and flag
|