@sous-io/sous 1.0.19 → 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.
@@ -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
 
@@ -77,10 +102,12 @@ contents: # what a subscriber actually receives
77
102
  | `version` | yes | An exact semantic version; the manifest is the source of truth and the git tag follows it |
78
103
  | `description` | no | Copied into the index at release time; shown by `sous recipe list` and `sous repo search` |
79
104
  | `depends`, `subscribes` | no | Build dependencies and co-subscriptions; within either list, no entry may repeat |
80
- | `contents`, `variables` | no | Contents default to an empty list, which is what a curated bundle publishes; a duplicated variable name, or two definitions claiming one `env`, is an error |
105
+ | `contents`, `variables` | no | Contents default to an empty list, which is what a curated bundle publishes; a duplicated variable name, or two definitions claiming one `env`, is an error. Any value in `contents` may be an expression; see [Contents are config](#contents-are-config) |
106
+ | `edits` | no | Changes to document files the recipe does not own; see [Edits](#edits) |
81
107
  | `submissions` | no | Whether this recipe takes proposed changes, winning over the repository's block; see [The submissions block](#the-submissions-block) |
82
108
  | `plugin` | no | A sous plugin the recipe ships: `bundle`, the path of one self-contained bundled file, and optionally `types`, its `.d.ts` file; see [Recipes that ship sous plugins](repositories-authoring.md#recipes-that-ship-sous-plugins) |
83
109
  | `requires` | no | `requires.plugins` maps npm sous plugin names to version ranges the recipe needs |
110
+ | `handlers` | no | For each purpose (`check`, `configure`, `beforeBuild`, `afterBuild`, `uninstall`, `migrate`), a list of `{ file, handler }`: a self-contained JavaScript file in the recipe and the function it exports, run in the order listed; see [Handlers](handlers.md) |
84
111
 
85
112
  ```yaml
86
113
  plugin:
@@ -89,15 +116,118 @@ plugin:
89
116
  requires:
90
117
  plugins:
91
118
  sous-plugin-claude-code: "^1.0.0"
119
+ handlers:
120
+ check:
121
+ - file: handlers/prerequisites.js
122
+ handler: checkCommands
92
123
  ```
93
124
 
94
- `contents[].kind` is `skills`, `memories`, `prompts` or `config`; a sous plugin is not a content kind but the
95
- `plugin` field above. `skills` are
125
+ `contents[].kind` names a content kind. Sous registers `skills`, `memories`, `prompts` and `config`, and its
126
+ Claude Code plugin registers `claude-code-plugin` and `claude-code-agent` (see
127
+ [Kinds for Claude Code](#kinds-for-claude-code)); a sous plugin can register more (a `content-kind` entity), so
128
+ any lowercase, hyphenated name is accepted here. A sous plugin is
129
+ not a content kind but the `plugin` field above. `skills` are
96
130
  written to the destinations named by [`recipes`](#recipes-what-each-content-kind-does); `memories` are included
97
- into your instruction files by one line (see [Recipe memories](repositories-consuming.md#recipe-memories));
131
+ into each coding tool's memories file by one line (see [Recipe memories](repositories-consuming.md#recipe-memories));
98
132
  each `config` file joins the subscriber's config, under the project's own files so the project wins; nothing takes `prompts` yet, and the build warns about a recipe that
99
133
  publishes them. `include` needs at least one glob, and both lists are recipe-relative.
100
134
 
135
+ A kind no plugin registers stops a subscriber's build, naming the kind and the recipe. `sous repo release`
136
+ refuses one when nothing the recipe names could register it (no `requires.plugins`, no `subscribes`, no
137
+ `plugin` of its own), and warns otherwise.
138
+
139
+ ### Kinds for Claude Code
140
+
141
+ Two kinds carry files only Claude Code reads. Only Claude Code's part of Sous takes them, so a recipe needs no
142
+ harness condition for them, and other coding tools never receive them.
143
+
144
+ ```yaml
145
+ contents:
146
+ - kind: claude-code-plugin
147
+ include:
148
+ - plugins/** # each folder directly under plugins/ is one plugin
149
+ - kind: claude-code-agent
150
+ include:
151
+ - agents/**/*.md
152
+ ```
153
+
154
+ | Recipe file | Written to |
155
+ |---|---|
156
+ | `plugins/session-harness/.claude-plugin/plugin.json` | `.claude/skills/session-harness/.claude-plugin/plugin.json` |
157
+ | `plugins/session-harness/scripts/start.tpl.sh` | `.claude/skills/session-harness/scripts/start.sh` (rendered) |
158
+ | `agents/reviewer.tpl.md` | `.claude/agents/reviewer.md` (rendered) |
159
+ | `agents/review/security.md` | `.claude/agents/review/security.md` |
160
+
161
+ - `claude-code-plugin`: a Claude Code plugin folder, one holding `.claude-plugin/plugin.json`. Each folder directly
162
+ under an `include` pattern's fixed part is one plugin, written under Claude Code's skills directory with the
163
+ folder name the recipe gives it; Claude Code loads it from there as a plugin.
164
+ - `claude-code-agent`: agent files (Markdown with frontmatter), written to `.claude/agents/` with their
165
+ sub-folders kept. An agent here keeps its plain name, where an agent inside a plugin is named `<plugin>:<name>`.
166
+ - A file whose name holds `.tpl.` is rendered, so an agent's `model` can be a recipe variable each person answers
167
+ for themselves; any other file is written as it is.
168
+ - When a build adds, changes or removes a file of a Claude Code plugin (any folder holding
169
+ `.claude-plugin/plugin.json`, however the recipe shipped it), the build ends with one line: run
170
+ `/reload-plugins` in any open Claude Code session, since Claude Code loads plugins only when a session starts or
171
+ on that command.
172
+
173
+ A plugin folder may also be listed among a recipe's `skills`, with an `exclude` entry carrying
174
+ `harness.id != 'claude-code'` so other tools do not receive it (see [Authoring](repositories-authoring.md)).
175
+
176
+ ### Contents are config
177
+
178
+ A subscriber's build adds each group of `contents` to its config under `recipes.contents`, so any value in a
179
+ group may be a [config expression](configuration.md#config-expressions) (`$if`, `$elseif`, `$else`, `$expr`) or a
180
+ `$file`, evaluated in the subscriber's project. A condition can read the recipe's own answers, `host.platform`,
181
+ `harness.id` and `env.<NAME>`. An `include` item may also be inline content, with the path it is treated as
182
+ having:
183
+
184
+ ```yaml
185
+ contents:
186
+ - $if: # a whole group, only for Claude Code
187
+ expr: "harness.id == 'claude-code'"
188
+ then:
189
+ kind: skills
190
+ include: [claude/**]
191
+ - kind: skills
192
+ include:
193
+ - skills/**/*
194
+ - $inline: | # inline content needs a path
195
+ Say hello.
196
+ path: skills/hello/SKILL.md
197
+ exclude:
198
+ - $if: # one item, gated by a yes-or-no question
199
+ expr: "jiraEnabled != true"
200
+ then: skills/jira-*/**/*
201
+ ```
202
+
203
+ `sous config show recipes.contents` shows what the groups gave. Inline content is never interpolated; it is a
204
+ Liquid template only when its path contains `.tpl.`.
205
+
206
+ ### Edits
207
+
208
+ `edits` lists changes to document files the recipe does not own, such as a setting in `.claude/settings.json`.
209
+ Each entry names `file` (relative to the project root) and one or more operations, each holding its own
210
+ parameters, or a file-less operation such as `ensureDirectoryExists`. A subscriber's build appends each entry to
211
+ the config key `editor.edits`, with the recipe that declared it, and the editor plugin applies them. An entry may
212
+ be an expression, and a value may come from a `$file`:
213
+
214
+ ```yaml
215
+ edits:
216
+ - file: .claude/settings.json
217
+ ensureIncludes:
218
+ path: permissions.allow
219
+ items: ["Bash(git-commit.sh:*)"]
220
+ - $if:
221
+ expr: "harness.id == 'claude-code'"
222
+ then:
223
+ file: .claude/settings.json
224
+ set:
225
+ path: permissions.deny
226
+ value: { $file: documents/deny-rules.json }
227
+ ```
228
+
229
+ The manifest checks only that each entry is an object naming an operation; the editor checks the operations.
230
+
101
231
  ### The submissions block
102
232
 
103
233
  Both manifests accept a `submissions` block. On `sous.repo.yaml` it covers every recipe in the repository; on
@@ -242,6 +372,8 @@ fetches only this file; nothing more is downloaded until a project subscribes.
242
372
  | `dependencies` | per version | The range each dependency may take, keyed `namespace/recipe`; see below |
243
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 |
244
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) |
245
377
 
246
378
  Dependencies are recorded at release time and keyed `namespace/recipe`. Each entry carries `range`: the range
247
379
  the manifest declares, or `^<the sibling's version at release>` for a sibling named with no range (`*` when the
@@ -290,6 +422,18 @@ forward with those fields intact.
290
422
  repository released with `declared`, `kind`, `variables`, `depends` or `subscribes` in it, the official
291
423
  one included. A project pinned to such a sous fails to read that index until it moves to 0.2.26 or later.
292
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
+
293
437
  **The `seeded` field.** Sous ships the `core` recipe in its own npm package, so a project can build before
294
438
  reaching the network. That copy is folded into the official repository's index in memory and resolved like
295
439
  any other, marked `seeded: true`; if the repository already publishes it, the published copy wins. Sous
@@ -352,6 +496,8 @@ $SOUS_HOME/
352
496
  cache/<repository identity>/<namespace>/<name>/<version>/ .sous.entry.json, then the files
353
497
  cache/_indexes/<repository identity>.json the cached index
354
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)
355
501
  repos/ checkouts cloned by 'sous repo link --global'
356
502
  sous.links.json the machine-wide links map
357
503
  ```
@@ -407,6 +553,7 @@ store: # every value is a default you can change
407
553
  maxBytes: 1073741824 # one gigabyte; past it, 'sous repo gc' evicts unpinned entries
408
554
  freshnessSeconds: 300 # how long a fetched index stays fresh
409
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
410
557
  recipes: # what each content kind a subscribed recipe publishes does
411
558
  skills: { outputs: ["${projectRoot}/.codex/skills"] } # added to the skills directories agent plugins name
412
559
  memories: { first: ["communication/*"], exclude: ["tool-usage/automated-browser-tasks"] }
@@ -421,6 +568,7 @@ varMappings:
421
568
  | `enabled: false` | either of the two above | The opt-out for the entries sous provides itself, the `sous-recipes` repository and the `core` subscription |
422
569
  | `store` | fixed fields | Plain numbers, all optional; the values sous ships are defaults, not assumptions |
423
570
  | `recipes` | content kind | What each kind does; see [recipes: what each content kind does](#recipes-what-each-content-kind-does) |
571
+ | `recipes.handlers` | a list | Written by sous while the config is built: one `{ recipe, purpose, file, handler }` entry for each handler a subscribed recipe from a trusted repository lists; see [Handlers](handlers.md) |
424
572
  | `varMappings` | environment variable name | Binds one name to one recipe variable, written `namespace/recipe/variableName` with an optional `repo:` qualifier |
425
573
 
426
574
  A repository's `url` may be a URL or an absolute path to one on this machine, read by the `local` provider
@@ -447,6 +595,10 @@ includes, so it is dropped from a recipe's layer with a warning.
447
595
 
448
596
  There is no `prompts` block.
449
597
 
598
+ `recipes.contents` is a list sous writes itself while it builds the config: one entry per `contents` group of
599
+ each subscribed recipe (`recipe`, `dir`, `kind`, `include`, `exclude`), its expressions evaluated. Read it with
600
+ `sous config show recipes.contents`; plugins that publish a kind read it too.
601
+
450
602
  ## Managed config layers
451
603
 
452
604
  Three files in a project's `conf.d/` are written by sous rather than by a person, in the machine-written
@@ -125,8 +125,10 @@ for different repositories. Keying by identity is what lets them share one cache
125
125
  colliding. See [The store on disk](repositories-file-formats.md#the-store-on-disk).
126
126
 
127
127
  Canonicalizing also produces the two clone URLs sous hands to git, `https://<host>/<owner>/<name>.git`
128
- and `git@<host>:<owner>/<name>.git`. For the `local` provider the HTTPS slot carries the
129
- absolute directory, because that is what git is given when a recipe is fetched.
128
+ and `git@<host>:<owner>/<name>.git`. A port in an HTTPS URL stays in the HTTPS URL and never reaches
129
+ the SSH one; an SSH port comes only from an SSH URL that names one (`ssh://git@<host>:2222/...`). For
130
+ the `local` provider the HTTPS slot carries the absolute directory, because that is what git is given
131
+ when a recipe is fetched.
130
132
 
131
133
  ?> A published manifest names a dependency in another repository by location, such as a locator
132
134
  whose scheme is the provider's identifier: `github://sous-io/sous-recipes/workflow/sat@^1.1`. A
@@ -178,9 +180,24 @@ A token is looked for in these places, in this order, and a missing one is skipp
178
180
  A command's output counts as a token only when the command exits `0` and prints exactly one non-empty
179
181
  line holding no whitespace.
180
182
 
183
+ When the host refuses a token (a `401` or `403`), sous sends the next place's token instead, and
184
+ passes over a token it was already refused (glab hands back `GITLAB_TOKEN` when that is set). When the
185
+ read then works some other way, sous warns once per command, naming where the refused token came from
186
+ and how to fix it:
187
+
188
+ ```text
189
+ GITLAB_TOKEN holds a token gitlab.com refused (401: the token was refused), so sous read
190
+ gitlab.com/acme/private-recipes with HTTP with token, using the token from git credential fill.
191
+ Replace the token in GITLAB_TOKEN with one that can read the repository (export GITLAB_TOKEN=<a
192
+ token with read_repository>), or unset GITLAB_TOKEN.
193
+ ```
194
+
181
195
  Sous remembers, per repository, which way worked, in `$SOUS_HOME/cache/read-strategies.json`, and tries it
182
- first next time; after a failure it forgets it and walks the whole list again. When every way fails, one
183
- error lists each attempt and why it failed, then names the fixes:
196
+ first for the next seven days, counted from when it became first. After that, the better-ranked ways are
197
+ tried first again, so a repository read through git while its token was broken goes back to HTTP once the
198
+ token works. `store.strategyMemorySeconds` sets the time (`604800`, seven days, by default; `0` always
199
+ tries the usual order first). After a failure sous forgets the remembered way and walks the whole list
200
+ again. When every way fails, one error lists each attempt and why it failed, then names the fixes:
184
201
 
185
202
  ```text
186
203
  Error: could not read gitlab.com/acme/private-recipes.
@@ -190,7 +207,6 @@ Error: could not read gitlab.com/acme/private-recipes.
190
207
  Fix one of these:
191
208
  export GITLAB_TOKEN=<a token with read_repository>
192
209
  set up git access to gitlab.com (an SSH key, or a credential helper)
193
- A token reads only the index. Recipe files are downloaded with git, so building also needs git access.
194
210
  ```
195
211
 
196
212
  The fixes depend on what the attempts said:
@@ -199,8 +215,8 @@ The fixes depend on what the attempts said:
199
215
  that the machine can reach the host, or to set `HTTPS_PROXY`. No token is offered.
200
216
  - git reached the repository and said it has no `sous.index.json`: the fix is to check the URL. No
201
217
  token is offered, since the repository is not private.
202
- - A token was found and refused: the fix names where it came from (`GITLAB_TOKEN`, `git credential
203
- fill`, `glab`) instead of asking you to set it.
218
+ - A token was found and refused: the attempt and the fix name where it came from (`GITLAB_TOKEN`,
219
+ `git credential fill`, `glab`) instead of asking you to set it.
204
220
  - `gh` or `glab` is installed but printed no token: the fixes include `gh auth login` or
205
221
  `glab auth login` for the host.
206
222
 
@@ -210,14 +226,32 @@ once, and the error is told once, naming every recipe it stopped.
210
226
  The HTTP reads honor `HTTPS_PROXY`, `HTTP_PROXY` and `NO_PROXY` (or their lowercase spellings), as
211
227
  git does.
212
228
 
229
+ A cached index is checked again once its freshness window lapses. GitHub answers that check with
230
+ "not modified" through the index's `ETag`. GitLab sends no `ETag` for a file, so sous keeps the
231
+ `X-Gitlab-Content-Sha256` header GitLab sends instead, asks for that header alone with one `HEAD`
232
+ request, and downloads the index again only when the hash changed.
233
+
213
234
  **A recipe's files** come from git itself: a shallow, blobless, sparse clone at the version's
214
235
  tag, fetching only the blobs inside that one recipe folder. That means git's own credentials
215
236
  apply, exactly as they would for a manual clone: credential helpers, the SSH agent, proxies and
216
- `insteadOf` rewrites are all inherited from your git configuration, and sous adds nothing of its
217
- own. Cloning a working copy with `sous repo link` works the same way.
237
+ `insteadOf` rewrites are all inherited from your git configuration. Cloning a working copy with
238
+ `sous repo link` works the same way.
239
+
240
+ Sous adds one thing: the token it found for the index (from the environment or the host's command
241
+ line tool) is handed to the HTTPS clone, so a machine with only a token can build. The token travels
242
+ as an `Authorization` header set through git's environment for that one clone
243
+ (`GIT_CONFIG_COUNT`, `GIT_CONFIG_KEY_<n>` and `GIT_CONFIG_VALUE_<n>`, for
244
+ `http.https://<host>/.extraHeader`); it is never put in a URL, so git never prints it and never writes
245
+ it into the clone's `.git/config`. A token from `git credential fill` is not handed over, because git
246
+ sends that one itself. When the clone with the token fails, the same URL is tried once more without
247
+ it, so a refused token never stops credentials git already had.
218
248
 
219
- ?> For a private repository, git access (a credential helper or an SSH key) covers both the index
220
- and the recipe files. A token in the environment makes reading the index faster.
249
+ The clone tries the HTTPS URL, then the SSH URL. The one that worked is remembered beside the read
250
+ strategy in `read-strategies.json` and tried first for the same seven days (`store.strategyMemorySeconds`),
251
+ so a repository only SSH can reach stops trying HTTPS for every recipe.
252
+
253
+ ?> For a private repository, either git access (a credential helper or an SSH key) or a token covers
254
+ both the index and the recipe files.
221
255
 
222
256
  ## Proposing a change
223
257
 
@@ -228,12 +262,12 @@ remote. Providers differ, and sous says so rather than pretending otherwise:
228
262
  | Provider | Tool | Push permission | Forking | Proposal | Following it up |
229
263
  |---|---|---|---|---|---|
230
264
  | `github` | `gh` | read from GitHub, so a contributor without it is forked automatically | `gh repo fork`, with a `fork` remote added for you | pull request | `gh pr list`, `gh pr view` and `gh pr edit`, matching a fork's pull request by its owner |
231
- | `gitlab` | `glab` | sous cannot tell, so it pushes to `origin` and says so | not done for you | merge request | not done: every run opens a merge request, and `--status` is refused |
265
+ | `gitlab` | `glab` | sous cannot tell, so it pushes to `origin` and says so | not done for you | merge request | `glab mr list`, `glab mr view` and `glab mr update`, matching a fork's merge request by its author |
232
266
  | `local` | none | not applicable | not applicable | not applicable | not applicable |
233
267
 
234
- **GitLab cannot follow a proposal up yet.** It does not declare `proposals`, so a submission cannot
235
- look for a merge request that is already open; it says so, pushes, and opens one. When the branch
236
- already has one, the push updates it and GitLab may refuse the second.
268
+ **GitLab follows a merge request up as GitHub does a pull request.** It declares `proposals`, so a
269
+ submission finds the merge request already open for the branch and updates it instead of opening a
270
+ second, and `sous repo submit --status` reports its state, its pipeline and whether it can be merged.
237
271
 
238
272
  **GitLab reports "cannot tell" rather than guessing.** Sous has no cheap, reliable way to ask
239
273
  whether you may push, and a wrong guess would send you down a fork path this provider cannot
@@ -277,10 +311,49 @@ That block goes at the top level of your primary config or of a `conf.d/` file o
277
311
  writes its own entries to the `conf.d/500-repos.jsonc` file it manages. Every key is listed under
278
312
  [configuration keys](repositories-file-formats.md#configuration-keys).
279
313
 
280
- Everything downstream then works normally: the index is read from that host's own raw endpoint,
281
- a token comes from the sources above, and the identity is
282
- `git.example.com/platform/recipes`. Group paths of any depth are preserved, so
283
- `group/subgroup/project` stays one repository rather than being mistaken for a namespace.
314
+ Everything downstream then works normally: the index is read from that host's API address, a token
315
+ comes from the sources above, and the identity is `git.example.com/platform/recipes`. Group paths of
316
+ any depth are preserved, so `group/subgroup/project` stays one repository rather than being mistaken
317
+ for a namespace.
318
+
319
+ The GitLab plugin's `hosts` option names more hosts that are GitLab, so their URLs are recognized
320
+ without a `provider` on each entry. An entry matches a URL with or without a port, and may name the
321
+ HTTPS port and the sub-path GitLab is installed under:
322
+
323
+ ```jsonc
324
+ {
325
+ "plugins": {
326
+ "options": {
327
+ "@sous-io/sous-plugin-gitlab": { "hosts": ["git.example.com:8443/gitlab"] }
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ **A port.** For `https://git.example.com:8443/platform/recipes`, the port stays in the HTTPS clone
334
+ URL and the API address (`https://git.example.com:8443/api/v4/...`), and the SSH URL is
335
+ `git@git.example.com:platform/recipes.git`. An SSH URL with its own port,
336
+ `ssh://git@git.example.com:2222/platform/recipes`, keeps that port in the SSH URL alone; its HTTPS
337
+ address takes the port a `hosts` entry names, or none.
338
+
339
+ **A sub-path.** A URL alone cannot tell GitLab installed under `/gitlab` from a group named `gitlab`.
340
+ For a path with room for one, sous asks the server once where its API answers
341
+ (`https://<host>/api/v4/version`, then `https://<host>/gitlab/api/v4/version`, and so on), remembers
342
+ the answer for the host in `$SOUS_HOME/cache/gitlab-instances.json`, and says what it found:
343
+
344
+ ```text
345
+ GitLab on git.example.com is installed under a sub-path
346
+ Host : git.example.com
347
+ Installed under: /gitlab
348
+ API address : https://git.example.com/gitlab/api/v4
349
+ SSH clone URL : git@git.example.com:platform/recipes.git
350
+ Remembered in : /home/me/.sous/cache/gitlab-instances.json
351
+ ```
352
+
353
+ The API address and the SSH URL then leave `/gitlab` out of the project path, and the HTTPS clone URL
354
+ keeps it. A sub-path named in a `hosts` entry (`git.example.com/gitlab`) is used as given, and the
355
+ server is never asked. The identity keeps the whole path either way:
356
+ `git.example.com/gitlab/platform/recipes`.
284
357
 
285
358
  `sous repo submit` is the exception: it runs inside the repository checkout and never reads a
286
359
  project's config, so it picks the provider from the `origin` remote URL alone. A host that does not
@@ -27,8 +27,9 @@ Everything else has a default: skills compile into `<project root>/.claude/skill
27
27
  Claude Code plugin built into sous puts them), and the lockfile, the state file and the `conf.d`
28
28
  files sous writes land under `.sous/`. Outside a
29
29
  walkthrough, `sous init` writes a fuller starting point (it imports the project's existing
30
- `CLAUDE.md`, `AGENTS.md` and skills, and writes a commented config, the source both instruction
31
- files compile from, the env files and the ignore blocks) and runs the first build for you; the one-line config is
30
+ `CLAUDE.md`, `AGENTS.md` and skills, and writes a commented `sous.config.jsonc`, the memories
31
+ source `.sous/MEMORIES.tpl.md`, the env files and the ignore blocks, and offers the git hooks) and runs the first
32
+ build for you; the one-line config is
32
33
  used here so that each step shows one thing. `SOUS_HOME` puts
33
34
  the machine-wide store somewhere throwaway, so this walkthrough leaves your real one alone. See
34
35
  [The config file](configuration.md) for the keys you will want later.
@@ -49,6 +50,9 @@ $ sous build
49
50
  ✓ .claude/skills/about-sous-repos/SKILL.md (~1,579 tokens)
50
51
  ✓ .claude/skills/about-sous-recipes/SKILL.md (~1,639 tokens)
51
52
  ✓ .claude/skills/create-skill/SKILL.md (~655 tokens)
53
+
54
+ Files: 7 written (7 new), 0 unchanged.
55
+
52
56
  ✓ Done.
53
57
  ```
54
58
 
@@ -174,8 +178,11 @@ sous repo init ~/projects/my-recipes --name my-recipes --namespace workflow
174
178
  wrote .gitignore
175
179
  ```
176
180
 
177
- The output goes on with what `sous init` writes and with its first build, which compiles
178
- `CLAUDE.md` and `AGENTS.md`. The scaffold validates as written, and every file it leaves is heavily commented. `sous.repo.yaml`
181
+ On GitLab (an `origin` remote on GitLab, or `--host gitlab`) the scaffold writes `.gitlab-ci.yml` instead of
182
+ `.github/workflows/sous-release.yml`, and warns that its release job needs a masked CI/CD variable named
183
+ `SOUS_RELEASE_TOKEN`; see [the scaffolded workflow](repositories-authoring.md#the-scaffolded-workflow). The
184
+ output goes on with what `sous init` writes and with its first build, which compiles the
185
+ memories file. The scaffold validates as written, and every file it leaves is heavily commented. `sous.repo.yaml`
179
186
  declares the namespaces and lists every recipe folder; each folder's `sous.recipe.yaml` is one
180
187
  recipe, with its own version.
181
188
 
@@ -331,6 +338,9 @@ $ sous build
331
338
  restored: workflow/task-files
332
339
  ▶ Building:
333
340
  ✓ .claude/skills/about-task-files/SKILL.md (~942 tokens)
341
+
342
+ Files: 1 written (1 new), 7 unchanged.
343
+
334
344
  ✓ Done.
335
345
  ```
336
346
 
@@ -246,9 +246,12 @@ or remove the lockfile and subscribe again to have sous rebuild it.
246
246
 
247
247
  The repair for a lockfile that has drifted from the config, whether from a hand edit, a bad merge or
248
248
  a subscription removed by hand, is `sous lock rebuild`, with `--dry-run` first. It resolves every
249
- subscription against the cached indexes and replaces the lockfile outright, downloading nothing,
250
- asking nothing and granting no trust; a subscription whose repository is not added, or whose index is
251
- missing, is reported by name.
249
+ subscription against the cached indexes and replaces the lockfile outright, asking nothing and
250
+ granting no trust; a subscription whose repository is not added, or whose index is missing, is
251
+ reported by name. It downloads only a recipe whose index does not record what it depends on, to read
252
+ its manifest; when that download fails, nothing is written and the recipe is named, since a lockfile
253
+ written without it would drop the pins of its dependencies. `sous doctor` and `sous build` hold to the
254
+ same rule.
252
255
 
253
256
  ## Core skills missing after a sous upgrade
254
257
 
@@ -347,13 +350,15 @@ Error: could not read gitlab.com/acme/private-recipes.
347
350
  Fix one of these:
348
351
  export GITLAB_TOKEN=<a token with read_repository>
349
352
  set up git access to gitlab.com (an SSH key, or a credential helper)
350
- A token reads only the index. Recipe files are downloaded with git, so building also needs git access.
351
353
  ```
352
354
 
353
355
  Sous tried every way it has to read the repository's index, and each line says why that one failed. Any
354
- one fix lets sous read the index. Recipe files are a different matter: sous downloads them with git alone,
355
- so a build needs git access to the host (an SSH key, or a credential helper) even when a token is set. A
356
- token in the environment only makes reading the index faster. `gh` and `glab` are not needed to read.
356
+ one fix lets sous read the index and download recipe files: sous hands the token it found to git for an
357
+ HTTPS download, so a token alone is enough to build. `gh` and `glab` are not needed to read.
358
+
359
+ A token the host refused is named by where it came from, on its attempt's line and in the fix. When
360
+ another way then works, the build goes on and warns once that the token was refused; replace the token
361
+ there, or unset the variable.
357
362
  The order sous tries, and where it finds a token, are under
358
363
  [Private repositories](repositories-providers.md#private-repositories).
359
364
 
@@ -273,7 +273,8 @@ lists them and asks which one, and `--accept-first` takes the first.
273
273
  | `sous vars ask --all` | Asks every variable again, including the ones already answered |
274
274
  | `sous vars ask --accept-first` | When the name matches several things, takes the first one listed |
275
275
  | `sous vars ask --file <path>` | Reads definitions from a standalone definitions file |
276
- | `sous vars ask --env-file <file>` | Stores every answer of the run in `.sous/.env` (committed) or `.sous/.env.local` (this machine only); any spelling that names one is accepted, and a secret or machine-specific variable sent to the committed file needs a yes (`--yes`) |
276
+ | `sous vars ask --save-locally` | Stores every answer of the run in `.sous/.env.local` (gitignored, this machine only) |
277
+ | `sous vars ask --save-shared` | Stores every answer of the run in `.sous/.env` (committed); a secret or machine-specific variable sent there needs a yes (`--yes`). It cannot be used with `--save-locally` |
277
278
  | `sous vars ask --answer <name>=<value>` | Answers one question ahead of time; repeat it for each answer |
278
279
  | `sous vars ask --answers-file <path>` | Reads answers from a YAML or JSON file of `name: value` pairs |
279
280
  | `sous vars ask --dry-run` | Reports what would be asked and written, without writing anything; with no terminal, it lists the questions it would ask instead of failing |
@@ -382,7 +383,10 @@ answer while everything else, your templates included, renders the first definit
382
383
  tells you which names are in play.
383
384
 
384
385
  An answer is laid in exactly as it is stored: a path stays the string you typed, relative or absolute, and a
385
- number stays text. A template that needs an absolute path from a relative answer composes one under another
386
+ number stays text. A `boolean` is the exception: its answer is `true` or `false` whatever word stored it
387
+ (`yes`, `off`, `1`), and a template or a config condition sees a real boolean, so `{% if jiraEnabled %}` and
388
+ `$if: jiraEnabled` take the false branch for an answer, or a default, of `false`. `${jiraEnabled}` still gives
389
+ the text `false`. Compare a boolean with `true`, not with the text `"true"`. A template that needs an absolute path from a relative answer composes one under another
386
390
  name in `_vars`, for instance `taskFileDir: "${projectRoot}/${taskFileRoot}"`. `projectRoot` is set by sous
387
391
  (the directory holding `.sous/`); setting it in any `_vars` is an error.
388
392
 
@@ -289,6 +289,8 @@ $ sous build
289
289
  ▷ SKILL.tpl.md:
290
290
  Entry Point: ~/.sous/cache/github.com/my-team/agent-recipes/workflow/task-files/1.0.2/skills/start-task/SKILL.tpl.md
291
291
  ✓ /home/me/my-project/.claude/skills/start-task/SKILL.md (~1,996 tokens)
292
+
293
+ Files: 1 written (1 new), 7 unchanged.
292
294
  ```
293
295
 
294
296
  Skills go to `<project root>/.claude/skills`, the skills directory the built-in Claude Code plugin names, and the
@@ -348,7 +350,10 @@ published identity and then the path inside it, on a line of its own. Any part m
348
350
  @~workflow/qa-helper/_partials/*.md
349
351
  ```
350
352
 
351
- A glob includes every file it matches, in bytewise path order. The `~` is required. A bare `@path` is always a relative path or a declared alias, so an include
353
+ A glob includes every file it matches: at each folder its own files first, then its sub-folders, names
354
+ compared ignoring case, with `_` first, then digits, then letters (see
355
+ [Include syntax](configuration.md#include-syntax)); a glob that matches nothing includes nothing and its line
356
+ is removed. The `~` is required. A bare `@path` is always a relative path or a declared alias, so an include
352
357
  line can never quietly stop meaning a file on disk. In your own templates, `~<namespace>`
353
358
  resolves against every recipe the lockfile pins, whatever brought it in: a recipe you subscribe
354
359
  to, a member of a set you subscribe to, or a library another recipe depends on. Inside a recipe,
@@ -361,7 +366,7 @@ listed it), the error names it:
361
366
 
362
367
  ```text
363
368
  Error: Include not found: @~workflow/member/memories/member.md
364
- in file: .sous/memories/instructions.tpl.md
369
+ in file: .sous/MEMORIES.tpl.md
365
370
  namespace: workflow
366
371
  recipe: workflow/member
367
372
  The namespace "workflow" holds no recipe named "workflow/member".