@sous-io/sous 0.2.1 → 0.2.3
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/docs/markdown/README.md +4 -0
- package/docs/markdown/_sidebar.md +5 -1
- package/docs/markdown/commands.md +293 -274
- package/docs/markdown/configuration.md +7 -0
- package/docs/markdown/repositories-authoring.md +210 -302
- package/docs/markdown/repositories-consuming.md +221 -468
- package/docs/markdown/repositories-file-formats.md +216 -980
- package/docs/markdown/repositories-providers.md +322 -0
- package/docs/markdown/repositories-quickstart.md +340 -0
- package/docs/markdown/repositories-troubleshooting.md +336 -0
- package/docs/markdown/repositories-variables.md +250 -298
- package/docs/markdown/repositories.md +262 -228
- package/package.json +1 -1
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/src/commands/compile.ts +4 -2
- package/src/lib/build-service.ts +52 -4
- package/src/lib/markdown-compiler.ts +20 -1
- package/src/lib/repos/recipe-targets.ts +9 -1
- package/src/lib/settings.ts +51 -3
- package/src/lib/vars/answers.ts +184 -0
- package/src/lib/vars/definition-source.ts +9 -0
- package/src/lib/vars/index.ts +1 -0
package/docs/markdown/README.md
CHANGED
|
@@ -21,7 +21,11 @@ far; more will follow.
|
|
|
21
21
|
|
|
22
22
|
- Watch the [animated introduction](../) for the full pitch
|
|
23
23
|
- Learn [how sous is configured](configuration.md)
|
|
24
|
+
- Get a project subscribed to shared recipes in ten minutes with the
|
|
25
|
+
[repositories quickstart](repositories-quickstart.md)
|
|
24
26
|
- Share configuration between projects with [repositories](repositories.md)
|
|
27
|
+
- See how each hosting provider behaves in the [provider reference](repositories-providers.md)
|
|
25
28
|
- Look up a command in the [command reference](commands.md)
|
|
29
|
+
- Work out what an error is telling you in [repositories troubleshooting](repositories-troubleshooting.md)
|
|
26
30
|
- Read the [design principles](design-principles.md) that constrain every feature
|
|
27
31
|
- Read the [source on GitHub](https://github.com/sous-io/sous)
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
- [Inspecting and validating](config-inspection.md)
|
|
11
11
|
- **Repositories**
|
|
12
12
|
- [Overview](repositories.md)
|
|
13
|
+
- [Quickstart](repositories-quickstart.md)
|
|
13
14
|
- [Consuming recipes](repositories-consuming.md)
|
|
14
|
-
- [Recipe variables](repositories-variables.md)
|
|
15
15
|
- [Authoring a repository](repositories-authoring.md)
|
|
16
|
+
- [Recipe variables](repositories-variables.md)
|
|
17
|
+
- [Providers](repositories-providers.md)
|
|
16
18
|
- [File formats](repositories-file-formats.md)
|
|
19
|
+
- [Troubleshooting](repositories-troubleshooting.md)
|
|
17
20
|
- **ADRs**
|
|
18
21
|
- [0001: Repositories](adrs/0001-repositories.md)
|
|
22
|
+
- [0002: Recipe answers in the template scope](adrs/0002-recipe-answers-in-templates.md)
|
|
@@ -1,308 +1,327 @@
|
|
|
1
1
|
# Command Reference
|
|
2
2
|
|
|
3
|
-
Every command the `sous` CLI ships, with its arguments
|
|
4
|
-
|
|
3
|
+
Every command the `sous` CLI ships, with its arguments, its own flags and one example. The same text is in your
|
|
4
|
+
terminal: `sous <command> --help`, or `sous help <command>`. Flags that mean the same thing everywhere are
|
|
5
|
+
explained once, below, and only named under the commands that take them.
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
These four locate the configuration and are accepted by every command that works on a project.
|
|
9
|
-
They are listed once here rather than repeated in every table below.
|
|
7
|
+
## Flags that locate the configuration
|
|
10
8
|
|
|
11
9
|
| Flag | What it does |
|
|
12
10
|
|------|--------------|
|
|
13
|
-
| `-c, --config <path>` |
|
|
11
|
+
| `-c, --config <path>` | A sous config file, or a directory holding one. Overrides `.sous/` discovery |
|
|
14
12
|
| `--sous-config <path>` | Alias of `--config` |
|
|
15
|
-
| `--sous-dir <path>` |
|
|
16
|
-
| `--sous-confd <path>` |
|
|
17
|
-
|
|
18
|
-
The environment variables `SOUS_CONFIG`, `SOUS_DIR` and `SOUS_CONFD` do the same jobs; a flag
|
|
19
|
-
beats the matching variable, and both beat walk-up discovery.
|
|
20
|
-
[Discovery and overrides](config-discovery.md) covers the precedence in full. One more variable,
|
|
21
|
-
`SOUS_DEBUG`, is read by every command: it turns stack traces back on when something fails
|
|
22
|
-
(see [Exit behavior](#exit-behavior)).
|
|
13
|
+
| `--sous-dir <path>` | The `.sous` directory to use, overriding walk-up discovery |
|
|
14
|
+
| `--sous-confd <path>` | The `conf.d/` drop-in layer directory, overriding `<sousDir>/conf.d` |
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
repository has no `.sous/` directory to discover. All three do take `--non-interactive`:
|
|
27
|
-
`repo init` and `repo submit` accept it without ever having a question to suppress, and
|
|
28
|
-
`repo release` reads the flag, the terminal and the `CI` environment variable to decide whether
|
|
29
|
-
it may ask, with `--ci` or `--yes` settling it outright.
|
|
16
|
+
Every command that works on a project takes these four. `SOUS_CONFIG`, `SOUS_DIR` and `SOUS_CONFD` do the same;
|
|
17
|
+
a flag beats its variable, and both beat walk-up discovery. See [Discovery and overrides](config-discovery.md).
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
?> `repo init`, `repo release` and `repo submit` take none of these. They run inside a recipe repository, which
|
|
20
|
+
has no `.sous/` directory to discover. All three still take `--non-interactive`.
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
explaining them again.
|
|
22
|
+
## Flags that answer questions
|
|
35
23
|
|
|
36
24
|
| Flag | What it does |
|
|
37
25
|
|------|--------------|
|
|
38
|
-
| `-y, --yes` |
|
|
39
|
-
| `--non-interactive` |
|
|
40
|
-
| `--dry-run` |
|
|
41
|
-
| `-h, --help` |
|
|
42
|
-
|
|
43
|
-
`sous clear`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
sous --help
|
|
52
|
-
sous repo add
|
|
53
|
-
sous
|
|
54
|
-
|
|
55
|
-
|
|
26
|
+
| `-y, --yes` | Answer yes to every confirmation the command would ask. `-f` and `--force` are the same flag, and so is `--trust` on the commands that trust a repository |
|
|
27
|
+
| `--non-interactive` | Never ask anything. A run that would have prompted fails instead, naming the question and the flag that would have answered it |
|
|
28
|
+
| `--dry-run` | Print what the command would do, and write, download and ask nothing |
|
|
29
|
+
| `-h, --help` | Print this command's help and exit |
|
|
30
|
+
|
|
31
|
+
`sous clear` spells its confirmation `-f, --force` first, with `-y` and `--yes` as aliases of it, and is the one
|
|
32
|
+
exception to the rule above: without `-f` it asks even under `--non-interactive` or `CI`, so pass `-f` whenever
|
|
33
|
+
you script it. `sous repo init --force` is not a confirmation; it overwrites a repository that already exists.
|
|
34
|
+
|
|
35
|
+
Sous asks a question only when it can; piping output, redirecting it to a file and running in CI therefore do
|
|
36
|
+
what `--non-interactive` does, and a run that needs an answer fails saying why. The exact conditions are listed
|
|
37
|
+
under [When sous cannot ask](repositories-consuming.md#when-sous-cannot-ask).
|
|
38
|
+
|
|
39
|
+
Help has four spellings. `sous --help` prints the root screen; `sous repo add --help`, `sous repo add -h` and
|
|
40
|
+
`sous help repo add` all print that one command's. `sous help` alone lists the topics and commands, and
|
|
41
|
+
`sous --version` prints the version, platform and Node build.
|
|
42
|
+
|
|
43
|
+
Every topic answers to both spellings of its name: `repo` and `repos`, `subscription` and `subscriptions`,
|
|
44
|
+
`namespace` and `namespaces`, `recipe` and `recipes`, `lock` and `locks`, `vars` and `var`, `config` and
|
|
45
|
+
`configs`. Three commands also answer to one word: `sous search`, `sous subscribe` and `sous unsubscribe`.
|
|
46
|
+
|
|
47
|
+
## Top-level commands
|
|
48
|
+
|
|
49
|
+
### `sous build`
|
|
50
|
+
Compiles this project's outputs, then removes the ones its config no longer produces. It is compile plus prune,
|
|
51
|
+
and the command you want almost always. Takes `--dry-run`.
|
|
52
|
+
|
|
53
|
+
- `--no-prune`, `--no-compile`: skip one half of the run.
|
|
54
|
+
- `--rebuild`: ignore cached hashes and reprocess every output.
|
|
55
|
+
- `--strict`: fail on any compilation error rather than reporting it and continuing.
|
|
56
|
+
- `-w, --watch`: rebuild on every change to a source file, a config layer or a linked checkout.
|
|
57
|
+
|
|
58
|
+
Example: `sous build --rebuild`
|
|
59
|
+
|
|
60
|
+
### `sous compile`
|
|
61
|
+
Compiles markdown templates into output files, and prunes nothing. Takes `--rebuild`, `--strict`, `--dry-run`
|
|
62
|
+
and `-w, --watch`, each meaning what it means on `build`. Example: `sous compile --strict`
|
|
63
|
+
|
|
64
|
+
### `sous prune`
|
|
65
|
+
Removes output files no longer in the current config. Takes `--dry-run` only. Example: `sous prune --dry-run`
|
|
66
|
+
|
|
67
|
+
### `sous clear`
|
|
68
|
+
Deletes every file and directory sous has written for the project, and asks first; `-f, --force` answers that
|
|
69
|
+
confirmation ahead of time. Example: `sous clear --force`
|
|
56
70
|
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
### `sous launch TOOL...`
|
|
72
|
+
Builds this project's outputs, then starts a coding agent configured under `tools` in its config. `--no-build`
|
|
73
|
+
launches without building; `--continuous` restarts the agent whenever it exits.
|
|
59
74
|
|
|
60
|
-
|
|
75
|
+
Any argument `launch` does not recognize is forwarded to the tool; a flag that collides with one of sous's own
|
|
76
|
+
goes after a bare `--`: `sous launch claude --resume`, `sous launch claude -- -c`.
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
sous prefers: `repo` and `repos`, `subscription` and `subscriptions`, `namespace` and
|
|
64
|
-
`namespaces`, `recipe` and `recipes`, `lock` and `locks`, `var` and `vars`, `config`
|
|
65
|
-
and `configs`. The tables below print the spelling `sous --help` shows; the other one runs
|
|
66
|
-
exactly the same command.
|
|
78
|
+
Example: `sous launch claude --continuous`
|
|
67
79
|
|
|
68
|
-
|
|
80
|
+
### `sous search TEXT`
|
|
81
|
+
Searches the recipes every trusted repository publishes, by name or description; reads the cached indexes only,
|
|
82
|
+
so it works offline. `--limit <n>` sets how many matches to show, defaulting to 25. Also spelled
|
|
83
|
+
`sous repo search`. Example: `sous search task --limit 50`
|
|
69
84
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
| `sous compile` | none | `--strict`, `--rebuild`, `--dry-run`, `-w, --watch` |
|
|
74
|
-
| `sous prune` | none | `--dry-run` |
|
|
75
|
-
| `sous clear` | none | `-f, --force` (also `-y, --yes`) |
|
|
76
|
-
| `sous launch` | `TOOL...` | `--no-build`, `--continuous` |
|
|
85
|
+
### `sous help [COMMAND]`
|
|
86
|
+
Prints the help for sous, or for one command or topic. Works from any directory, including one with no config
|
|
87
|
+
above it. Example: `sous help repo add`
|
|
77
88
|
|
|
78
|
-
|
|
79
|
-
cached hashes and reprocesses every output; `--strict` fails on the first compilation error
|
|
80
|
-
rather than reporting and continuing; `--watch` rebuilds on every change to a source file, a
|
|
81
|
-
config layer, or a linked recipe checkout.
|
|
89
|
+
## config
|
|
82
90
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
Inspects the merged configuration. `show` and `get` write machine-readable output to standard out and route the
|
|
92
|
+
header and any error block to standard error, so a pipeline survives a broken config. See
|
|
93
|
+
[Inspecting and validating](config-inspection.md).
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
### `sous config show`
|
|
96
|
+
Prints the merged config (every `conf.d` layer merged, before variable resolution) as JSON.
|
|
97
|
+
Example: `sous config show | jq .compilation`
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
### `sous config get PATH`
|
|
100
|
+
Prints one value by dot-path, with `[n]` for array indices; a scalar prints raw, and an object or array prints
|
|
101
|
+
as pretty JSON. `--layers` adds one `old -> new` line per config layer that changed the value.
|
|
102
|
+
Example: `sous config get compilation.targets[0].entryPoint --layers`
|
|
103
|
+
|
|
104
|
+
### `sous config validate`
|
|
105
|
+
Validates the merged config: the schema first, then full variable resolution, which is what surfaces reference
|
|
106
|
+
cycles and undefined `${var}` references. Example: `sous config validate`
|
|
107
|
+
|
|
108
|
+
## repo
|
|
109
|
+
|
|
110
|
+
Manages the recipe repositories this project trusts; see [Repositories](repositories.md) for the model and
|
|
111
|
+
[Consuming recipes](repositories-consuming.md) for the workflow.
|
|
112
|
+
|
|
113
|
+
### `sous repo add URL`
|
|
114
|
+
Adds a repository to this project, which is also how you trust it, and fetches its index so its recipes are
|
|
115
|
+
listable. `URL` is the repository's address, or the path of one on this machine. Takes `--dry-run`.
|
|
116
|
+
|
|
117
|
+
- `--name <name>`: set the short name refs will use. Defaults to the URL's last segment. (`sous repo link` on
|
|
118
|
+
a path instead takes the name that checkout's own manifest suggests.)
|
|
119
|
+
- `--provider github|gitlab|local`: name the provider, for a host the URL does not give away; each provider's
|
|
120
|
+
behaviour is in the [provider reference](repositories-providers.md).
|
|
121
|
+
- `-y, --yes`: answer the trust question ahead of time (also `-f`, `--force`, `--trust`).
|
|
122
|
+
|
|
123
|
+
Example: `sous repo add https://github.com/sous-io/sous-recipes --name recipes`
|
|
124
|
+
|
|
125
|
+
### `sous repo remove REPO`
|
|
126
|
+
Stops trusting a repository, named by the short name this project records, and removes everything it brought in.
|
|
127
|
+
It first prints what goes with it: the entry, the subscriptions that resolve into it, the recipes those alone
|
|
128
|
+
held, the files the next build prunes, and the linked checkout if one points at it. Takes `-y, --yes`,
|
|
129
|
+
`--dry-run` and `--no-build` (remove without rebuilding). Example: `sous repo remove my-recipes --dry-run`
|
|
130
|
+
|
|
131
|
+
### `sous repo list`
|
|
132
|
+
Lists the repositories this project trusts, with the provider, where the entry came from, whether it is linked,
|
|
133
|
+
how many recipes it publishes (`not fetched` until its index has been downloaded) and its URL. `--verbose` adds
|
|
134
|
+
the namespaces each one publishes, on a line under its row.
|
|
135
|
+
|
|
136
|
+
```term
|
|
137
|
+
$ sous repo list
|
|
138
|
+
Repository Provider Origin Linked Recipes URL
|
|
139
|
+
------------ -------- -------- ------ ----------- ---------------------------------------
|
|
140
|
+
sous-recipes github built in no not fetched https://github.com/sous-io/sous-recipes
|
|
94
141
|
```
|
|
95
142
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
| Command | Arguments | Own flags |
|
|
99
|
-
|---------|-----------|-----------|
|
|
100
|
-
| `sous config show` | none | none |
|
|
101
|
-
| `sous config get` | `PATH` | `--layers` |
|
|
102
|
-
| `sous config validate` | none | none |
|
|
103
|
-
|
|
104
|
-
`show` and `get` write machine-readable output to standard output, with the decorative header and
|
|
105
|
-
any error block routed to standard error, so `sous config show | jq` works even when the config is
|
|
106
|
-
broken. `PATH` is a dot-path with `[n]` for array indices, such as
|
|
107
|
-
`compilation.targets[0].entryPoint`, and `--layers` prints one `old -> new` line per config layer
|
|
108
|
-
that changed the value. `validate` runs the resolvers that schema validation alone cannot,
|
|
109
|
-
surfacing reference cycles and undefined `${var}` references.
|
|
110
|
-
|
|
111
|
-
See [Inspecting and validating](config-inspection.md).
|
|
112
|
-
|
|
113
|
-
## Repositories
|
|
114
|
-
|
|
115
|
-
| Command | Arguments | Own flags |
|
|
116
|
-
|---------|-----------|-----------|
|
|
117
|
-
| `sous repo add` | `URL` | `--name <name>`, `--provider github\|gitlab\|local`, `-y, --yes` (also `--trust`), `--dry-run` |
|
|
118
|
-
| `sous repo remove` | `REPO` | `-y, --yes` (also `-f, --force`), `--dry-run`, `--no-build` |
|
|
119
|
-
| `sous repo list` | none | `--verbose` |
|
|
120
|
-
| `sous repo search` | `TEXT` | `--limit <n>` (default 25) |
|
|
121
|
-
| `sous repo gc` | none | `--max-bytes <n>`, `--dry-run` |
|
|
122
|
-
| `sous repo link` | `REPO` (a short name, a URL or a path) `[PATH]` | `--global`, `-y, --yes` (also `--trust`), `--dry-run` |
|
|
123
|
-
| `sous repo unlink` | `REPO` | `--global`, `--dry-run` |
|
|
124
|
-
|
|
125
|
-
`repo add` is the trust ceremony; it asks inline, and the confirmation flag is how a run with no
|
|
126
|
-
terminal acknowledges instead. `--trust` is the spelling the ceremony reads best with, and it is
|
|
127
|
-
the same flag as `-y`, `--yes`, `-f` and `--force`. `URL` may be an address or an absolute path to a repository on this
|
|
128
|
-
machine. `list` and `search` read only what is already cached, so both work offline and neither
|
|
129
|
-
downloads anything.
|
|
130
|
-
|
|
131
|
-
`repo remove` is the reverse of `repo add`: it stops trusting a repository. Before it writes
|
|
132
|
-
anything it prints what goes with it, so the decision is made on facts: the entry itself, every
|
|
133
|
-
subscription that resolves into the repository, every locked recipe those subscriptions alone held,
|
|
134
|
-
the output files the next build prunes, and the linked checkout, if one points at it. Then it asks
|
|
135
|
-
once, and the confirmation flag answers ahead of time. The link entry is removed with the
|
|
136
|
-
repository; the checkout itself stays on disk. The command finishes by building the project, the
|
|
137
|
-
same way the subscription commands do, so the files those recipes wrote are gone when it returns;
|
|
138
|
-
`--no-build` leaves the outputs alone. Removing the built-in `sous-recipes` repository records
|
|
139
|
-
`sous-recipes: { enabled: false }` in the managed repositories layer rather than deleting an entry,
|
|
140
|
-
because the entry sous provides comes back on every run.
|
|
141
|
-
|
|
142
|
-
`repo search` is also a top-level `sous search`, because searching is how you find something to
|
|
143
|
-
subscribe to before you know what any of it is called.
|
|
144
|
-
|
|
145
|
-
## Browsing what a project trusts
|
|
146
|
-
|
|
147
|
-
| Command | Arguments | Own flags |
|
|
148
|
-
|---------|-----------|-----------|
|
|
149
|
-
| `sous namespace list` | none | none |
|
|
150
|
-
| `sous namespace show` | `REF` (a namespace, optionally `repo:namespace`) | none |
|
|
151
|
-
| `sous recipe list` | none | none |
|
|
152
|
-
| `sous recipe show` | `REF` (a recipe, a recipe name on its own, or either with a `repo:` qualifier) | none |
|
|
153
|
-
|
|
154
|
-
All four read the cached repository indexes and the lockfile, so they work offline and download
|
|
155
|
-
nothing. A trusted repository whose index has never been fetched is named at the end of a listing
|
|
156
|
-
rather than left out of it.
|
|
157
|
-
|
|
158
|
-
`namespace list` shows every namespace, how many recipes it holds, and how much of it this project
|
|
159
|
-
subscribes to: the whole namespace, some recipes, or none. `namespace show` adds every recipe in
|
|
160
|
-
one namespace, with the latest published version, the version this project pins, and whether it is
|
|
161
|
-
subscribed.
|
|
162
|
-
|
|
163
|
-
`recipe list` shows the same per-recipe columns across every namespace. `recipe show` describes one
|
|
164
|
-
recipe completely: the repository and its location, every published version labeled as the latest
|
|
165
|
-
one, the pinned one or an earlier one, what the version depends on (both as the recipe's manifest
|
|
166
|
-
declares it and as its repository's index resolved it at release time), the questions it asks with
|
|
167
|
-
the environment variable each answer is stored under, and the directories its files are written
|
|
168
|
-
into. The questions and the file list come from the recipe's own manifest, so a recipe this machine
|
|
169
|
-
does not hold yet is described from its index alone and says so.
|
|
170
|
-
|
|
171
|
-
## The lockfile
|
|
172
|
-
|
|
173
|
-
| Command | Arguments | Own flags |
|
|
174
|
-
|---------|-----------|-----------|
|
|
175
|
-
| `sous lock show` | none | none |
|
|
176
|
-
| `sous lock rebuild` | none | `--dry-run` |
|
|
177
|
-
|
|
178
|
-
`lock show` prints what `.sous/sous.lock.json` pins: the recipe, the version, the repository it came
|
|
179
|
-
from, and who holds it (this project, or the recipes that require it).
|
|
180
|
-
|
|
181
|
-
`lock rebuild` recomputes the whole file from the subscriptions the config declares and the cached
|
|
182
|
-
indexes, then writes it. It starts from an empty lockfile, so an entry nothing holds any more is
|
|
183
|
-
dropped rather than carried through; that makes it the repair for a file that has drifted from the
|
|
184
|
-
config through a hand edit or a bad merge. It asks nothing and grants no trust: a subscription whose
|
|
185
|
-
closure reaches a repository this project has not added fails, naming the repository. It downloads
|
|
186
|
-
nothing, so a recipe whose files are not on this machine has its own dependencies left out, and is
|
|
187
|
-
named when that happens. `--dry-run` prints the same summary and writes nothing.
|
|
188
|
-
|
|
189
|
-
## Subscriptions
|
|
190
|
-
|
|
191
|
-
| Command | Arguments | Own flags |
|
|
192
|
-
|---------|-----------|-----------|
|
|
193
|
-
| `sous subscription list` | none | none |
|
|
194
|
-
| `sous subscription add` | `REF` | `--prerelease`, `--always-pull`, `-y, --yes` (also `--trust`), `--accept-first`, `--answer <name>=<value>`, `--answers-file <path>`, `--dry-run`, `--no-build` |
|
|
195
|
-
| `sous subscription remove` | `REF` | `--dry-run`, `--no-build` |
|
|
196
|
-
|
|
197
|
-
`sous subscribe` and `sous unsubscribe` are the original spellings of `subscription add` and
|
|
198
|
-
`subscription remove`, and both still work.
|
|
199
|
-
|
|
200
|
-
Adding or removing a subscription changes what the project compiles, so both commands finish by
|
|
201
|
-
building it: the same compile and prune `sous build` runs, so a newly subscribed recipe's files
|
|
202
|
-
are on disk when the command returns and a removed one's files are gone. `--no-build` changes the
|
|
203
|
-
subscription and leaves the outputs alone. A build that fails leaves the subscription change in
|
|
204
|
-
place, since it is already written and locked, and says so.
|
|
205
|
-
|
|
206
|
-
`REF` is a ref: `namespace`, `namespace/recipe`, either with an `@<range>`, and optionally
|
|
207
|
-
qualified with `repo:`. See
|
|
208
|
-
[Refs: how anything is named](repositories-file-formats.md#refs-how-anything-is-named).
|
|
209
|
-
|
|
210
|
-
`subscription add --dry-run` installs nothing and, after the plan, prints every question the
|
|
211
|
-
recipes would ask: what each variable is for, where its answer would be stored, and whether
|
|
212
|
-
anything answers it already. `--answer <name>=<value>`, repeated, answers those questions ahead of
|
|
213
|
-
time, and `--answers-file <path>` reads the same pairs from a YAML or JSON file; together they are
|
|
214
|
-
how a run with no terminal subscribes to a recipe that asks questions. See
|
|
215
|
-
[Answering questions ahead of time](repositories-consuming.md#answering-questions-ahead-of-time).
|
|
216
|
-
|
|
217
|
-
`subscription list` reads the config and the lockfile only, so it works offline. It reports every
|
|
218
|
-
subscription the project declares, switched-off ones included, with the range it resolves within,
|
|
219
|
-
the versions the lockfile pins for it, where it came from, and whether it is on.
|
|
220
|
-
|
|
221
|
-
Removing the `core` subscription sous provides itself records `core: { enabled: false }` in the
|
|
222
|
-
managed subscriptions layer rather than deleting an entry, because the default would otherwise
|
|
223
|
-
come back on the next run. Adding it back clears the opt-out. Either way the `sous-recipes`
|
|
224
|
-
repository stays trusted and keeps appearing in `repo list` as built in.
|
|
225
|
-
|
|
226
|
-
`repo link` is written three ways. `REPO` on its own, as the short name of a repository this
|
|
227
|
-
project has already added, clones it into `.sous/repos/<owner>/<name>`, or into
|
|
228
|
-
`$SOUS_HOME/repos/<owner>/<name>` with `--global`. `REPO` followed by a `PATH` links the checkout
|
|
229
|
-
at that path to that repository and clones nothing. A path in the `REPO` slot, on its own, links
|
|
230
|
-
the checkout already at that path where it is, under the short name its repo manifest suggests.
|
|
231
|
-
Naming a repository this project has not added, by URL or by path, runs the same trust ceremony
|
|
232
|
-
`repo add` runs, since a linked repository's recipes are read with no version, lockfile or hash
|
|
233
|
-
check; it asks inline, and `--trust` (or any other spelling of the confirmation flag)
|
|
234
|
-
acknowledges instead for a run with no terminal.
|
|
235
|
-
|
|
236
|
-
## Authoring a repository
|
|
237
|
-
|
|
238
|
-
These three run inside a recipe repository and take none of the config-locating flags.
|
|
239
|
-
|
|
240
|
-
| Command | Arguments | Own flags |
|
|
241
|
-
|---------|-----------|-----------|
|
|
242
|
-
| `sous repo init` | `[DIRECTORY]` | `--name <name>`, `--namespace <name>`, `--force`, `--dry-run` |
|
|
243
|
-
| `sous repo release` | none | `--namespace <ns>`, `--recipe <ns/name>`, `--bump patch\|minor\|major\|prerelease`, `--no-bump`, `--include-unchanged`, `--tag`, `--push`, `--yes`, `--check`, `--ci`, `--dry-run` |
|
|
244
|
-
| `sous repo submit` | none | `--title <text>`, `--body <text>`, `--draft`, `--dry-run` |
|
|
245
|
-
|
|
246
|
-
`sous repo release` plans first, asks once, and then bumps, regenerates the index, commits and
|
|
247
|
-
tags in one run. `--namespace` and `--recipe` are repeatable and narrow the run; `--check` reads
|
|
248
|
-
only and cannot be combined with `--bump`, `--tag` or `--push`; `--ci` is the merge preset and
|
|
249
|
-
implies both `--no-bump` and `--yes`, so it prints the plan and carries it out without asking. See [Authoring a repository](repositories-authoring.md).
|
|
250
|
-
|
|
251
|
-
## Variables
|
|
252
|
-
|
|
253
|
-
| Command | Arguments | Own flags |
|
|
254
|
-
|---------|-----------|-----------|
|
|
255
|
-
| `sous vars list` | none | `--file <path>` |
|
|
256
|
-
| `sous vars show` | `NAME` | `--file <path>` |
|
|
257
|
-
| `sous vars ask` | `[NAME]` | `--repo <name>`, `--namespace <name>`, `--var <name>`, `--accept-first`, `--all`, `--file <path>`, `--answer <name>=<value>`, `--answers-file <path>`, `--dry-run` |
|
|
258
|
-
|
|
259
|
-
`vars list` prints every variable in play, with the environment variable that answered each one
|
|
260
|
-
and where the value came from. `vars show` prints one variable in full, including every
|
|
261
|
-
environment variable on the resolution ladder and which rung answered. `NAME` is a bare variable
|
|
262
|
-
name or a full `namespace/recipe.name` key.
|
|
263
|
-
|
|
264
|
-
On `vars ask`, `NAME` is a reference like any other: a variable, an environment variable that
|
|
265
|
-
answers one, a recipe, a namespace or a repository, at any level of qualification, and anything
|
|
266
|
-
larger than a variable asks every question it publishes. `--repo`, `--namespace` and `--var`
|
|
267
|
-
(repeatable) narrow the same way, and `--accept-first` takes the first candidate when the name
|
|
268
|
-
means more than one thing. `--file` reads definitions from a standalone
|
|
269
|
-
definitions file instead of the project's subscribed recipes. `--answer` and `--answers-file`
|
|
270
|
-
answer questions ahead of time, exactly as they do on `subscription add`.
|
|
271
|
-
|
|
272
|
-
Bare `sous vars` is shorthand for `vars list`, and `sous vars <name>` for `vars show <name>`. A
|
|
273
|
-
variable whose name is also a subcommand name (`list`, `show` or `ask`) has to be reached the
|
|
274
|
-
long way, as `sous vars show list`.
|
|
143
|
+
### `sous repo search TEXT`
|
|
144
|
+
Same command as `sous search`, under its own topic; takes `--limit <n>`. Example: `sous repo search browser`
|
|
275
145
|
|
|
276
|
-
|
|
146
|
+
### `sous repo gc`
|
|
147
|
+
Collects the machine-wide recipe store down to its size cap. `--max-bytes <n>` collects to that cap instead of
|
|
148
|
+
the one the config sets; `--dry-run` prints what it would evict. Example: `sous repo gc --max-bytes 268435456`
|
|
149
|
+
|
|
150
|
+
### `sous repo link REPO [PATH]`
|
|
151
|
+
Points a repository at a working copy on this machine instead of a published version; see
|
|
152
|
+
[Edit a repository in place](repositories-authoring.md#edit-a-repository-in-place). A name or URL on its own
|
|
153
|
+
clones it into `.sous/repos` and links the clone; a name or URL with a `PATH` links the checkout at that path; a
|
|
154
|
+
path alone links that checkout where it is, adding the repository first if needed. Takes `--dry-run`.
|
|
155
|
+
|
|
156
|
+
- `--global`: link for every project on this machine, sharing one checkout.
|
|
157
|
+
- `-y, --yes`: answer the trust question a not-yet-added repository raises (also `--trust`).
|
|
158
|
+
|
|
159
|
+
Example: `sous repo link sous-recipes ~/Projects/sous-recipes`
|
|
277
160
|
|
|
278
|
-
|
|
161
|
+
### `sous repo unlink REPO`
|
|
162
|
+
Stops reading a repository from a working copy and goes back to published versions; `REPO` is the short name as
|
|
163
|
+
it appears in `sous.links.json` (see [File formats](repositories-file-formats.md)). `--global` removes the
|
|
164
|
+
machine-wide link, not this project's; `--dry-run` prints what changes. Example: `sous repo unlink sous-recipes`
|
|
279
165
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
everything, the columns that matter least step aside, and one line under the table names them:
|
|
284
|
-
`Hidden at this width: URL. Widen the terminal to see it.` Nothing is hidden when the output is
|
|
285
|
-
not a terminal (a pipe, a file, a CI log), which is laid out at a fixed width instead, so a
|
|
286
|
-
recorded run always shows every column.
|
|
166
|
+
### `sous repo init [DIRECTORY]`
|
|
167
|
+
Creates a new recipe repository in a directory, defaulting to the current one; `--dry-run` prints the files it
|
|
168
|
+
would write. See [Authoring a repository](repositories-authoring.md).
|
|
287
169
|
|
|
288
|
-
|
|
289
|
-
|
|
170
|
+
- `--name <name>`: set the short name for the repository. Defaults to the directory's own name.
|
|
171
|
+
- `--namespace <name>`: name the one namespace to declare. Defaults to the repository's name.
|
|
172
|
+
- `--force`: write the scaffold over a repository that already exists.
|
|
290
173
|
|
|
291
|
-
|
|
174
|
+
Example: `sous repo init ./my-recipes --name team-recipes --namespace workflow`
|
|
292
175
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
176
|
+
### `sous repo release`
|
|
177
|
+
Publishes new versions of this repository's recipes: bump, regenerate the index, commit and tag. It plans first
|
|
178
|
+
and asks once, and it refuses to run until git has a commit identity in the repository (`git config user.name`
|
|
179
|
+
and `git config user.email`), because it commits and cuts annotated tags. Takes `-y, --yes` and `--dry-run`.
|
|
296
180
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
181
|
+
- `--namespace <ns>`, `--recipe <ns/name>`: narrow the run. Both repeat.
|
|
182
|
+
- `--bump patch|minor|major|prerelease`: how far to raise a changed version. Defaults to a patch step.
|
|
183
|
+
- `--no-bump`: raise nothing; a changed recipe that was never raised is then an error.
|
|
184
|
+
- `--include-unchanged`: release every recipe in scope, changed or not.
|
|
185
|
+
- `--tag`, `--push`: tag even on a non-default branch, and push the commit and this run's tags.
|
|
186
|
+
- `--check`: only validate, and fail when the committed index is out of date.
|
|
187
|
+
- `--ci`: the merge preset. Never bump, never ask, and fail on anything unbumped. It still needs `--yes` to
|
|
188
|
+
accept the plan it prints, so a merge job runs `sous repo release --ci --yes --push`.
|
|
301
189
|
|
|
302
|
-
|
|
303
|
-
failure prints its stack trace to standard error underneath the message. It is there for
|
|
304
|
-
debugging sous itself; nothing else changes when it is set.
|
|
190
|
+
Example: `sous repo release --recipe workflow/task-files --bump minor --push`
|
|
305
191
|
|
|
306
|
-
|
|
307
|
-
|
|
192
|
+
### `sous repo submit`
|
|
193
|
+
Proposes this repository's committed changes to its maintainers. `--title <text>` defaults to the last commit's
|
|
194
|
+
subject and `--body <text>` to a summary sous writes; `--draft` opens the proposal as a draft, and `--dry-run`
|
|
195
|
+
prints the plan without sending anything. Example: `sous repo submit --title "Add a linting recipe" --draft`
|
|
196
|
+
|
|
197
|
+
## subscription
|
|
198
|
+
|
|
199
|
+
Manages which recipes this project subscribes to. `REF` is `namespace` or `namespace/recipe`, either of them
|
|
200
|
+
optionally carrying an `@<range>` and a `repo:` qualifier; see
|
|
201
|
+
[Refs](repositories-file-formats.md#refs-how-anything-is-named).
|
|
202
|
+
|
|
203
|
+
### `sous subscription add REF`
|
|
204
|
+
Subscribes this project to a recipe, or to a whole namespace of them, then builds the project so the recipe's
|
|
205
|
+
files are on disk when the command returns. Also spelled `sous subscribe`. Takes `-y, --yes`, `--no-build`, and
|
|
206
|
+
`--dry-run`, which also prints the questions of every recipe this machine already holds; a recipe not held here
|
|
207
|
+
yet is named instead, because a dry run downloads nothing.
|
|
208
|
+
|
|
209
|
+
- `--prerelease`: let prerelease versions take part in range matching.
|
|
210
|
+
- `--always-pull`: install a newer in-range version whenever one exists, rather than holding the lock.
|
|
211
|
+
- `--accept-first`: when a one-word ref matches several things, take the first one listed.
|
|
212
|
+
- `--answer <name>=<value>`: answer one question ahead of time. Repeat it for each answer.
|
|
213
|
+
- `--answers-file <path>`: read the same pairs from a YAML or JSON file. An `--answer` wins over the file.
|
|
214
|
+
|
|
215
|
+
Example: `sous subscription add workflow/task-files@^1.2.0 --answer apiUrl=https://api.example.com`
|
|
216
|
+
|
|
217
|
+
### `sous subscription remove REF`
|
|
218
|
+
Removes a subscription and everything only it brought in, then rebuilds so those files are gone. Also spelled
|
|
219
|
+
`sous unsubscribe`. Takes `--dry-run` and `--no-build`. Example: `sous subscription remove workflow/task-files`
|
|
220
|
+
|
|
221
|
+
### `sous subscription list`
|
|
222
|
+
Lists the subscriptions this project declares, switched-off ones included, with the range each resolves within,
|
|
223
|
+
the versions the lockfile pins, where it came from and whether it is on. Reads the config and the lockfile only.
|
|
224
|
+
Example: `sous subscription list`
|
|
225
|
+
|
|
226
|
+
## namespace
|
|
227
|
+
|
|
228
|
+
`namespace` reads the cached indexes and the lockfile, so it works offline. A trusted repository whose index has
|
|
229
|
+
never been fetched is named at the end of a listing, not left out.
|
|
230
|
+
|
|
231
|
+
### `sous namespace list`
|
|
232
|
+
Lists every namespace the trusted repositories publish, how many recipes each holds, and how much of it this
|
|
233
|
+
project subscribes to: all of it, some recipes, or none. Example: `sous namespace list`
|
|
234
|
+
|
|
235
|
+
### `sous namespace show REF`
|
|
236
|
+
Shows one namespace and every recipe in it, with the latest published version, the version this project pins,
|
|
237
|
+
and whether it is subscribed. `REF` is a namespace, optionally written as `repository:namespace`.
|
|
238
|
+
Example: `sous namespace show sous-recipes:core`
|
|
239
|
+
|
|
240
|
+
## recipe
|
|
241
|
+
|
|
242
|
+
Browses the recipes the trusted repositories publish; like `namespace`, it works offline.
|
|
243
|
+
|
|
244
|
+
### `sous recipe list`
|
|
245
|
+
Lists the recipes the trusted repositories publish, across every namespace, with the same per-recipe columns
|
|
246
|
+
`namespace show` prints. Example: `sous recipe list`
|
|
247
|
+
|
|
248
|
+
### `sous recipe show REF`
|
|
249
|
+
Describes one recipe completely: its repository and location, every published version, its dependencies as
|
|
250
|
+
declared and as resolved at release time, the questions it asks with the environment variable each answer is
|
|
251
|
+
stored under, and the directories its files are written into. `REF` is `namespace/recipe`, a recipe name alone,
|
|
252
|
+
or either with a `repository:` qualifier. Example: `sous recipe show sous-recipes:core/about-sous`
|
|
253
|
+
|
|
254
|
+
## lock
|
|
255
|
+
|
|
256
|
+
Inspects and repairs this project's lockfile; both commands work from what is on disk and fetch nothing.
|
|
257
|
+
|
|
258
|
+
### `sous lock show`
|
|
259
|
+
Prints what `.sous/sous.lock.json` pins: the recipe, the version, the repository it came from, and who holds it
|
|
260
|
+
(this project, or the recipes that require it). Example: `sous lock show`
|
|
261
|
+
|
|
262
|
+
### `sous lock rebuild`
|
|
263
|
+
Recomputes the whole lockfile from the subscriptions the config declares and the cached indexes, starting from
|
|
264
|
+
empty, so an entry nothing holds any more is dropped rather than carried through: the repair for a file that
|
|
265
|
+
drifted through a hand edit or a bad merge. It asks nothing, grants no trust and downloads nothing. Takes
|
|
266
|
+
`--dry-run`. Example: `sous lock rebuild --dry-run`
|
|
267
|
+
|
|
268
|
+
## vars
|
|
269
|
+
|
|
270
|
+
Inspects the variables this project's recipes define, and the answers they hold. `NAME` is a bare variable name
|
|
271
|
+
or a full `namespace/recipe.name` key. Bare `sous vars` is shorthand for `vars list` and `sous vars <name>` for
|
|
272
|
+
`vars show <name>`; a variable named `list`, `show` or `ask` is reached the long way, as `sous vars show list`.
|
|
273
|
+
See [Recipe variables](repositories-variables.md).
|
|
274
|
+
|
|
275
|
+
### `sous vars list`
|
|
276
|
+
Lists every variable this project's recipes define, with the environment variable that answered each one and
|
|
277
|
+
where the value came from. `--file <path>` reads the definitions from a standalone definitions file instead.
|
|
278
|
+
Example: `sous vars list --file ./questions.yaml`
|
|
279
|
+
|
|
280
|
+
### `sous vars show NAME`
|
|
281
|
+
Shows everything about one variable, including every environment variable on the resolution ladder and which
|
|
282
|
+
rung answered; takes `--file <path>`. Example: `sous vars show workflow/task-files.apiUrl`
|
|
283
|
+
|
|
284
|
+
### `sous vars ask [NAME]`
|
|
285
|
+
Asks the variables this project's recipes define and stores the answers in the `.sous` env files. `NAME` is a
|
|
286
|
+
variable, an environment variable name, a recipe, a namespace or a repository; anything larger than a variable
|
|
287
|
+
asks every question it publishes. Takes `--file <path>` and `--dry-run`.
|
|
288
|
+
|
|
289
|
+
- `--repo <name>`, `--namespace <name>`, `--var <name>`: narrow the run. `--var` repeats.
|
|
290
|
+
- `--all`: ask every variable again, including the ones already answered.
|
|
291
|
+
- `--accept-first`: take the first candidate when a name means more than one thing.
|
|
292
|
+
- `--answer <name>=<value>`, `--answers-file <path>`: as on `subscription add`.
|
|
293
|
+
|
|
294
|
+
Example: `sous vars ask --namespace workflow --var apiUrl`
|
|
295
|
+
|
|
296
|
+
## Exit behavior and error shape
|
|
297
|
+
|
|
298
|
+
A command that succeeds exits `0`. A command line sous could not parse (a missing argument, an unknown flag, a
|
|
299
|
+
value outside a flag's options) exits `2`. Every other failure exits `1`. A broken config halts sous rather than
|
|
300
|
+
producing output built on a guess. Compilation is the one place sous reports a failure and carries on;
|
|
301
|
+
`--strict` on `build` and `compile` turns those reports into a failed run.
|
|
302
|
+
|
|
303
|
+
A failure prints one error block, in plain language, and nothing else; a usage mistake gets the command's own
|
|
304
|
+
help under it, on standard error. An error sous raises names the cause and the cure:
|
|
305
|
+
|
|
306
|
+
```term
|
|
307
|
+
$ sous subscription add workflow --non-interactive
|
|
308
|
+
Error: Sous has to ask which 'workflow' you meant, and it is not running where it can ask.
|
|
309
|
+
Why: the '--non-interactive' flag was passed.
|
|
310
|
+
'workflow' matched 2 things:
|
|
311
|
+
sous-recipes:workflow (the whole namespace 'workflow' in the repository 'sous-recipes')
|
|
312
|
+
qa:workflow (the whole namespace 'workflow' in the repository 'qa')
|
|
313
|
+
Answer it ahead of time: write the full reference (for example 'sous-recipes:workflow'), or
|
|
314
|
+
pass '--accept-first' to take the first candidate listed above.
|
|
308
315
|
```
|
|
316
|
+
|
|
317
|
+
No expected failure prints a stack trace. A failure sous did not expect prints the message and one more sentence
|
|
318
|
+
asking you to set `SOUS_DEBUG=1` and run the command again. Set `SOUS_DEBUG` to anything but `0`, `false`, `no`
|
|
319
|
+
or `off` and every reported failure prints its stack to standard error underneath the message:
|
|
320
|
+
`SOUS_DEBUG=1 sous build`. Nothing else changes when it is set.
|
|
321
|
+
|
|
322
|
+
Every listing fits itself to the terminal it runs in: columns shrink, descriptions wrap, and a path or URL is
|
|
323
|
+
cut in the middle so the host and the last segment both survive. On a terminal too narrow, the least important
|
|
324
|
+
columns step aside and a line under the table names them; nothing is hidden when the output is not a terminal.
|
|
325
|
+
|
|
326
|
+
For what a particular repository error is telling you, and how to clear it, see
|
|
327
|
+
[Repositories troubleshooting](repositories-troubleshooting.md).
|