@sous-io/sous 1.0.19 → 1.1.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 +437 -349
- package/docs/markdown/README.md +8 -7
- package/docs/markdown/_sidebar.md +28 -0
- package/docs/markdown/codex.md +129 -0
- package/docs/markdown/commands.md +238 -40
- package/docs/markdown/config-inspection.md +27 -5
- package/docs/markdown/config-layers.md +8 -8
- package/docs/markdown/config-variables.md +42 -3
- package/docs/markdown/configuration.md +270 -22
- package/docs/markdown/design-principles.md +1 -1
- package/docs/markdown/editing-files.md +599 -0
- package/docs/markdown/handlers.md +221 -0
- package/docs/markdown/repositories-authoring.md +54 -12
- package/docs/markdown/repositories-consuming.md +15 -13
- package/docs/markdown/repositories-contributing.md +1 -1
- package/docs/markdown/repositories-file-formats.md +114 -4
- package/docs/markdown/repositories-quickstart.md +5 -4
- package/docs/markdown/repositories-variables.md +4 -1
- package/docs/markdown/repositories.md +5 -2
- package/package.json +38 -33
- package/recipes/core/sous-skills/skills/about-sous/SKILL.tpl.md +13 -10
- package/recipes/core/sous-skills/skills/about-sous-configuration/SKILL.tpl.md +4 -4
- package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +4 -4
- package/recipes/core/sous-skills/skills/about-sous-repos/SKILL.tpl.md +4 -3
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/sous.config.schema.json +268 -20
package/docs/markdown/README.md
CHANGED
|
@@ -59,9 +59,9 @@ $ SOUS_NO_DELEGATE=1 sous --version
|
|
|
59
59
|
v0.3.0
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
###
|
|
62
|
+
### Upgrading
|
|
63
63
|
|
|
64
|
-
`sous
|
|
64
|
+
`sous upgrade` moves each copy of sous to a newer version (or one you choose) through the package
|
|
65
65
|
manager that installed it, so you never need to remember which one that was or its syntax:
|
|
66
66
|
|
|
67
67
|
- **Outside a project**, or in a project that does not install sous, it updates the global install.
|
|
@@ -73,7 +73,8 @@ manager that installed it, so you never need to remember which one that was or i
|
|
|
73
73
|
It updates the global install as well when there is one. A Yarn Plug'n'Play project, which has
|
|
74
74
|
no `node_modules`, counts as installing sous when its `package.json` declares it and a `.pnp.cjs`
|
|
75
75
|
sits beside it or above it; the installed version is read from `yarn.lock`.
|
|
76
|
-
- **After a project
|
|
76
|
+
- **After a project upgrade**, the newly installed copy runs the migrations its version brings (see
|
|
77
|
+
[`sous doctor`](commands.md#sous-doctor)), then builds the project, so
|
|
77
78
|
`.sous/sous.lock.json` pins the core recipe at the new version. Under Yarn Plug'n'Play, Yarn
|
|
78
79
|
runs that build (`yarn run --binaries-only sous build`). `--no-build` skips it.
|
|
79
80
|
|
|
@@ -84,7 +85,7 @@ it fails with `EBADF: bad file descriptor`. Unpack it in `package.json`, then ru
|
|
|
84
85
|
"dependenciesMeta": { "@sous-io/sous": { "unplugged": true } }
|
|
85
86
|
```
|
|
86
87
|
|
|
87
|
-
`
|
|
88
|
+
`upgrade` always runs in the copy you invoked, never handed off to the project's own; a project copy
|
|
88
89
|
may be too old to have the command. A project config this copy cannot load (one written for a newer
|
|
89
90
|
sous, say) is a warning rather than a stop, since installing a newer copy may be the fix.
|
|
90
91
|
|
|
@@ -98,16 +99,16 @@ its own question. Each is judged on its own version:
|
|
|
98
99
|
dist-tag such as `next` points at. This is how you downgrade, and the plan says when it is one.
|
|
99
100
|
|
|
100
101
|
`--dry-run` prints the plans, with the command each would run, and installs nothing. The other flags
|
|
101
|
-
(prereleases, one install only, answering every question) are in `sous
|
|
102
|
+
(prereleases, one install only, answering every question) are in `sous upgrade --help`.
|
|
102
103
|
|
|
103
104
|
A copy run through `npx`, or one managed by Volta or by a manager sous does not drive, is listed
|
|
104
105
|
with the command to run by hand, and the rest are still updated. A package manager's own failure
|
|
105
106
|
is printed as the manager reported it; sous never retries with `sudo`.
|
|
106
107
|
|
|
107
108
|
```term
|
|
108
|
-
$ sous
|
|
109
|
+
$ sous upgrade --dry-run
|
|
109
110
|
// every install's plan, and nothing installed
|
|
110
|
-
$ sous
|
|
111
|
+
$ sous upgrade --global --yes
|
|
111
112
|
```
|
|
112
113
|
|
|
113
114
|
## Where to look
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
- [Design principles](design-principles.md)
|
|
3
3
|
- [Skill categories](skill-categories.md)
|
|
4
4
|
- [Command reference](commands.md)
|
|
5
|
+
- [Codex](codex.md)
|
|
5
6
|
- **Configuration**
|
|
6
7
|
- [The config file](configuration.md)
|
|
7
8
|
- [Discovery and overrides](config-discovery.md)
|
|
8
9
|
- [Layers and merging](config-layers.md)
|
|
9
10
|
- [Variables](config-variables.md)
|
|
10
11
|
- [Inspecting and validating](config-inspection.md)
|
|
12
|
+
- [Editing files Sous does not own](editing-files.md)
|
|
11
13
|
- **Repositories**
|
|
12
14
|
- [Overview](repositories.md)
|
|
13
15
|
- [Quickstart](repositories-quickstart.md)
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
- [Contributing a change](repositories-contributing.md)
|
|
16
18
|
- [Authoring a repository](repositories-authoring.md)
|
|
17
19
|
- [Recipe variables](repositories-variables.md)
|
|
20
|
+
- [Handlers](handlers.md)
|
|
18
21
|
- [Providers](repositories-providers.md)
|
|
19
22
|
- [File formats](repositories-file-formats.md)
|
|
20
23
|
- [Troubleshooting](repositories-troubleshooting.md)
|
|
@@ -29,6 +32,15 @@
|
|
|
29
32
|
- [Config expressions](architecture/specifications/S5-config-expressions.md)
|
|
30
33
|
- [Which plugin does what](architecture/specifications/S6-concerns-and-owners.md)
|
|
31
34
|
- [Everything sous can do](architecture/specifications/S7-capabilities.md)
|
|
35
|
+
- [One config build per harness](architecture/specifications/S8-per-harness-config-builds.md)
|
|
36
|
+
- [The editor](architecture/specifications/S9-the-editor.md)
|
|
37
|
+
- [Includes](architecture/specifications/S10-includes.md)
|
|
38
|
+
- [Migrations, sous doctor, upgrade and update](architecture/specifications/S11-migrations-and-doctor.md)
|
|
39
|
+
- [Manifests as config](architecture/specifications/S12-manifests-as-config.md)
|
|
40
|
+
- [Handlers](architecture/specifications/S13-handlers.md)
|
|
41
|
+
- [What sous init writes, and sous init hooks](architecture/specifications/S14-init-and-git-hooks.md)
|
|
42
|
+
- [Claude Code](architecture/specifications/S15-claude-code.md)
|
|
43
|
+
- [Codex](architecture/specifications/S16-codex.md)
|
|
32
44
|
- **ADRs**
|
|
33
45
|
- [0001: Repositories](adrs/0001-repositories.md)
|
|
34
46
|
- [0002: Recipe answers in the template scope](adrs/0002-recipe-answers-in-templates.md)
|
|
@@ -54,3 +66,19 @@
|
|
|
54
66
|
- [0022: Intents return outputs](adrs/0022-intents-return-outputs.md)
|
|
55
67
|
- [0023: The project's lockfile is the only lock](adrs/0023-the-project-lockfile-is-the-only-lock.md)
|
|
56
68
|
- [0024: `sous init` imports a project's agent files](adrs/0024-init-imports-agent-files.md)
|
|
69
|
+
- [0025: Every document edit is surgical](adrs/0025-every-document-edit-is-surgical.md)
|
|
70
|
+
- [0026: Declared edits to files Sous does not own](adrs/0026-declared-edits-to-files-sous-does-not-own.md)
|
|
71
|
+
- [0027: Assertions on edited files](adrs/0027-assertions-on-edited-files.md)
|
|
72
|
+
- [0028: Includes follow Claude Code's imports](adrs/0028-includes-follow-claude-code-imports.md)
|
|
73
|
+
- [0029: Every output file is a config entry, and variables by output path](adrs/0029-outputs-are-config-entries-and-var-overrides.md)
|
|
74
|
+
- [0030: Migrations, and `sous doctor`](adrs/0030-migrations.md)
|
|
75
|
+
- [0031: `sous upgrade`, `sous update`, and short aliases](adrs/0031-upgrade-update-and-short-aliases.md)
|
|
76
|
+
- [0032: A recipe's manifest is added to the config](adrs/0032-manifests-as-config.md)
|
|
77
|
+
- [0033: Open content kinds, `$file`, and a literal `${`](adrs/0033-open-content-kinds-and-file-values.md)
|
|
78
|
+
- [0034: Handlers](adrs/0034-handlers.md)
|
|
79
|
+
- [0035: `sous init` writes a JSONC config and installs git hooks](adrs/0035-init-and-git-hooks.md)
|
|
80
|
+
- [0036: Claude Code's memories go to `.claude/rules/SOUS-MEMORIES.md`](adrs/0036-claude-code-memories-file.md)
|
|
81
|
+
- [0037: The harness id `claude-code`, and the Claude Code content kinds](adrs/0037-claude-code-content-kinds-and-harness-id.md)
|
|
82
|
+
- [0038: A boolean recipe answer is a boolean in Liquid](adrs/0038-boolean-answers.md)
|
|
83
|
+
- [0039: Codex's memories go to a git-ignored `AGENTS.override.md`](adrs/0039-codex-memories.md)
|
|
84
|
+
- [0040: One config build per harness](adrs/0040-one-config-build-per-harness.md)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Codex
|
|
2
|
+
|
|
3
|
+
Sous can write its instructions and skills for [Codex](https://github.com/openai/codex), OpenAI's coding
|
|
4
|
+
agent, and start it with `sous launch codex`. The part of Sous that does this is the built-in plugin
|
|
5
|
+
`@sous-io/sous-plugin-codex`.
|
|
6
|
+
|
|
7
|
+
!> **Untested.** Codex was not installed on the machine Sous's Codex support was built on, so none of it
|
|
8
|
+
has been run against Codex. It follows Codex's documentation and source code.
|
|
9
|
+
|
|
10
|
+
Three points in particular are unchecked:
|
|
11
|
+
|
|
12
|
+
1. that Codex reads an `AGENTS.override.md` at the project root in place of `AGENTS.md`;
|
|
13
|
+
2. that Codex reads that file when it is git-ignored, as Sous makes it;
|
|
14
|
+
3. what Codex does when its instruction files together pass its 32 KiB limit.
|
|
15
|
+
If you use Codex with Sous, please report what you see.
|
|
16
|
+
|
|
17
|
+
## Turning it on
|
|
18
|
+
|
|
19
|
+
The plugin is built in but does nothing until your project turns it on, so a project that never uses
|
|
20
|
+
Codex gets no Codex files. Write either of these in your config:
|
|
21
|
+
|
|
22
|
+
```jsonc
|
|
23
|
+
// .sous/sous.config.jsonc
|
|
24
|
+
{
|
|
25
|
+
"plugins": {
|
|
26
|
+
"options": {
|
|
27
|
+
// Even an empty object turns Codex on.
|
|
28
|
+
"@sous-io/sous-plugin-codex": {}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```jsonc
|
|
35
|
+
// .sous/sous.config.jsonc
|
|
36
|
+
{
|
|
37
|
+
"tools": {
|
|
38
|
+
// Settings for `sous launch codex`; writing this key also turns Codex on.
|
|
39
|
+
"codex": {
|
|
40
|
+
"args": ["--full-auto"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
To turn it off again, remove the key you wrote. To make sure it never loads, list it under
|
|
47
|
+
`plugins.disabled`.
|
|
48
|
+
|
|
49
|
+
## What Sous writes for Codex
|
|
50
|
+
|
|
51
|
+
Once it is on, every `sous build` writes:
|
|
52
|
+
|
|
53
|
+
| File | What it holds |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `AGENTS.override.md` at the project root | Your project's own `AGENTS.md`, then Sous's memories |
|
|
56
|
+
| `.agents/skills/<skill>/` | The skills of the recipes you subscribe to |
|
|
57
|
+
|
|
58
|
+
### Why `AGENTS.override.md`
|
|
59
|
+
|
|
60
|
+
Codex reads one instruction file per folder. When a folder holds an `AGENTS.override.md`, Codex reads it
|
|
61
|
+
instead of that folder's `AGENTS.md`. Sous never touches your `AGENTS.md`; it writes the override file
|
|
62
|
+
with the text of your `AGENTS.md` first and its memories after it, so Codex sees both.
|
|
63
|
+
|
|
64
|
+
- If you have no `AGENTS.md`, the override holds only the memories.
|
|
65
|
+
- If you edit `AGENTS.md`, run `sous build` again, or Codex keeps reading the old copy.
|
|
66
|
+
- If your project already has an `AGENTS.override.md` that Sous did not write, Sous copies it to
|
|
67
|
+
`.sous/backups/`, warns you, and writes its own.
|
|
68
|
+
- The file is build output, so Sous keeps it out of git: `sous init` adds `/AGENTS.override.md` to
|
|
69
|
+
the project's `.gitignore`, and the plugin also declares that line as an
|
|
70
|
+
[edit](editing-files.md), for projects set up before and for a file you have moved.
|
|
71
|
+
|
|
72
|
+
Codex cuts its project instruction files off at 32 KiB in total by default (its
|
|
73
|
+
`project_doc_max_bytes` setting). Your `AGENTS.md` plus Sous's memories can pass that, and the end of the
|
|
74
|
+
file is then lost.
|
|
75
|
+
|
|
76
|
+
Codex skips every project instruction file, `AGENTS.md` and the override alike, in a project you have
|
|
77
|
+
not marked as trusted in Codex.
|
|
78
|
+
|
|
79
|
+
### Where the memories come from
|
|
80
|
+
|
|
81
|
+
The same source as for Claude Code: `.sous/MEMORIES.tpl.md` when it exists, and otherwise your own files
|
|
82
|
+
under `.sous/memories/` followed by the memories of the recipes you subscribe to.
|
|
83
|
+
|
|
84
|
+
### Skills
|
|
85
|
+
|
|
86
|
+
Codex loads skills from `.agents/skills/` on demand, not into every session. Sous writes each recipe's
|
|
87
|
+
skills there. The folder is not added to `.gitignore`, because other tools read it too and a project
|
|
88
|
+
may keep its own skills there; add `/.agents/skills/` to your `.gitignore` yourself if every skill in it
|
|
89
|
+
comes from Sous. This location also comes from Codex's documentation and has not been tried.
|
|
90
|
+
|
|
91
|
+
## Options
|
|
92
|
+
|
|
93
|
+
Under `plugins.options."@sous-io/sous-plugin-codex"`:
|
|
94
|
+
|
|
95
|
+
| Option | Default | What it does |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `memoriesOutputPath` | `${projectRoot}/AGENTS.override.md` | Where the memories file is written. A relative path is under the project root. |
|
|
98
|
+
| `prependMemoriesWith` | `${projectRoot}/AGENTS.md` | The file whose text goes before the memories. Skipped silently when it does not exist. |
|
|
99
|
+
| `skillsDirectory` | `.agents/skills` | Where skills are written. |
|
|
100
|
+
| `memories` | `true` | `false` writes no memories file for Codex. |
|
|
101
|
+
|
|
102
|
+
```jsonc
|
|
103
|
+
{
|
|
104
|
+
"plugins": {
|
|
105
|
+
"options": {
|
|
106
|
+
"@sous-io/sous-plugin-codex": {
|
|
107
|
+
"prependMemoriesWith": "${projectRoot}/docs/AGENTS.md"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Starting Codex
|
|
115
|
+
|
|
116
|
+
`sous launch codex` builds the project, then starts the `codex` command in the project root. Settings
|
|
117
|
+
under `tools.codex` change the command and add arguments before yours:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
sous launch codex
|
|
121
|
+
sous launch codex -- resume
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Sous does not run Codex headless (`codex exec`).
|
|
125
|
+
|
|
126
|
+
## Conditions on Codex
|
|
127
|
+
|
|
128
|
+
Sous builds the config once more for Codex while it is on, so a config value can depend on it with
|
|
129
|
+
`harness.id == 'codex'`. See [Conditions on the harness](configuration.md#conditions-on-the-harness).
|
|
@@ -69,40 +69,74 @@ Every topic answers to both spellings of its name (`repo` and `repos`, `subscrip
|
|
|
69
69
|
so on), and `sous search`, `sous subscribe` and `sous unsubscribe` are one-word forms of `repo search`,
|
|
70
70
|
`subscription add` and `subscription remove`.
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### `sous init [DIRECTORY]`
|
|
72
|
+
Some topics and commands also have a short form. A topic's short form reaches every command under it, and the
|
|
73
|
+
short forms combine: `sous ns ls` is `sous namespace list`.
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`sous
|
|
75
|
+
| Short form | Stands for | Example |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `ns` | `namespace` | `sous ns show core` |
|
|
78
|
+
| `sub` | `subscription` | `sous sub add workflow/task-files` |
|
|
79
|
+
| `rc` | `recipe` | `sous rc show omakase/house` |
|
|
80
|
+
| `cfg` | `config` | `sous cfg get compilation` |
|
|
81
|
+
| `ls` | `list`, in `namespace`, `recipe`, `repo`, `subscription` and `vars` | `sous repo ls` |
|
|
82
|
+
| `rm` | `remove`, in `repo` and `subscription` | `sous sub rm workflow/task-files` |
|
|
80
83
|
|
|
81
|
-
|
|
82
|
-
config compiles into both `CLAUDE.md` and `AGENTS.md` at the project root, the `.sous/.env` and
|
|
83
|
-
`.sous/.env.local.example` files, the sous block in `.sous/.gitignore`, and a sous block in the project-root
|
|
84
|
-
`.gitignore` that ignores `/CLAUDE.md`, `/AGENTS.md` and `/.claude/skills/`. A project with a `package.json` also
|
|
85
|
-
gains `@sous-io/sous` as a devDependency at the running version; run your package manager's install afterwards.
|
|
84
|
+
Every command's `--help` lists the other spellings it answers to, under ALIASES.
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
## Top-level commands
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
@*/**/*.md
|
|
91
|
-
@#memories/**/*.md
|
|
92
|
-
```
|
|
88
|
+
### `sous init [DIRECTORY]`
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
Sets a project up for sous: it imports the project's existing agent files into a new `.sous/` directory, offers
|
|
91
|
+
the git hooks, then runs the first build. Sous owns all of a project's agent configuration from then on. What a
|
|
92
|
+
build writes (the memories file, such as `.claude/rules/SOUS-MEMORIES.md` for Claude Code, and `.claude/skills/`)
|
|
93
|
+
is build output, so edit the sources under `.sous/` and run `sous build` after cloning.
|
|
94
|
+
|
|
95
|
+
It writes:
|
|
96
|
+
|
|
97
|
+
- `.sous/sous.config.jsonc`, the primary config: JSON with comments that explain each block, and a `$schema`
|
|
98
|
+
pointing at the config schema published with the running version, so an editor completes and checks it. Its
|
|
99
|
+
one target compiles the project's own skills; it compiles no `AGENTS.md` or `CLAUDE.md`. A project may still
|
|
100
|
+
write a `sous.config.js` by hand instead.
|
|
101
|
+
- `.sous/MEMORIES.tpl.md`, the source of the memories file each coding-tool plugin compiles. It holds the two
|
|
102
|
+
default lines under a comment saying what each includes:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
@memories/**/*.md
|
|
106
|
+
@#memories/**/*.md
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The first includes the project's own memories, every markdown file under `.sous/memories/`; the second, every
|
|
110
|
+
memory the subscribed recipes publish. Removing a line removes that part, and moving a line changes the order.
|
|
111
|
+
- `.sous/memories/project.tpl.md`, a starter memory with generic text to replace ("Describe the project here: what
|
|
112
|
+
it is, how it is built, and how it is tested."), when there was nothing to import. In a recipe repository (one
|
|
113
|
+
with a `sous.repo.yaml`) it says instead that the repository is a Sous Repo, and names the core skills.
|
|
114
|
+
- `.sous/.env`, `.sous/.env.local.example`, and the sous block in `.sous/.gitignore` (which ignores, among
|
|
115
|
+
others, `backups/`).
|
|
116
|
+
- `.sous/sous.lock.json` with `migratedVersion` set to the running version, so a new project has no migrations
|
|
117
|
+
pending.
|
|
118
|
+
- Once, a sous block in the project's own `.gitignore`, listing what the builds write outside `.sous/`:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
# >>> sous managed (do not edit between these markers)
|
|
122
|
+
/.claude/rules/SOUS-MEMORIES.md
|
|
123
|
+
/.claude/skills/
|
|
124
|
+
/.claude/agents/
|
|
125
|
+
/AGENTS.override.md
|
|
126
|
+
# <<< sous managed
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
No build keeps this block current. A project that commits its own skills or agents removes that line.
|
|
130
|
+
|
|
131
|
+
A project with a `package.json` also gains `@sous-io/sous` as a devDependency at the running version.
|
|
100
132
|
|
|
101
133
|
What init imports, before the first build:
|
|
102
134
|
|
|
103
135
|
- **The instructions.** A root `CLAUDE.md` or `AGENTS.md` is copied to `.sous/memories/imported/` as plain `.md`,
|
|
104
136
|
so Liquid never touches it. A file that is a symlink to the other, holds the same text, or only points at the
|
|
105
|
-
other (at most 3 non-blank lines and 400 characters, naming the other file) is skipped.
|
|
137
|
+
other (at most 3 non-blank lines and 400 characters, naming the other file) is skipped. No build writes the
|
|
138
|
+
root files any more, so both are then backed up and removed, imported or skipped: a coding tool that read
|
|
139
|
+
them beside the memories file would read the same instructions twice.
|
|
106
140
|
- **The files they include.** A line holding only `@path.md` includes that file, and init follows those lines
|
|
107
141
|
through every included file. Each file is moved (the default), copied, or left where it is. A moved or copied
|
|
108
142
|
file goes to `.sous/includes/<its path from the project root>`, outside `memories/`, so it appears only where
|
|
@@ -116,28 +150,106 @@ What init imports, before the first build:
|
|
|
116
150
|
the build warns that the recipe's copy was not written.
|
|
117
151
|
|
|
118
152
|
Everything init moves is backed up first, to `.sous/backups/<YYYY-MM-DD>/<HHMM-SS>/<path>`, which git ignores.
|
|
119
|
-
Git stops tracking the root `CLAUDE.md`, `AGENTS.md` and each moved skill folder (`git rm -r --cached`)
|
|
120
|
-
|
|
121
|
-
`.claude/settings.json` are left alone.
|
|
153
|
+
Git stops tracking the root `CLAUDE.md`, `AGENTS.md` and each moved skill folder (`git rm -r --cached`).
|
|
154
|
+
`.claude/agents/`, `.claude/commands/` and `.claude/settings.json` are left alone.
|
|
122
155
|
|
|
123
156
|
What happens to the included files is one question, asked once after init lists them: move them, copy them,
|
|
124
157
|
leave them, or choose for each file. `--move-includes`, `--copy-includes` and `--leave-includes` answer it ahead
|
|
125
158
|
of time, one at a time, and `--yes` accepts the default, move. A run with no terminal and none of these flags
|
|
126
159
|
fails, naming them. `--dry-run` plans with the default and asks nothing.
|
|
127
160
|
|
|
161
|
+
In a project with a `.git` folder, init asks whether to install the git hooks, which
|
|
162
|
+
[`sous init hooks`](#sous-init-hooks-directory) describes, and then whether to add the ones that run after a pull.
|
|
163
|
+
`--hooks` and `--no-hooks` answer the first question, `--pull-hooks` and `--no-pull-hooks` the second, and `--yes`
|
|
164
|
+
installs the hooks without the pull ones. With a `package.json`, the hooks run the package manager's install,
|
|
165
|
+
and init then offers to run it (`--install`, `--no-install`; `--yes` runs it). That install runs `sous build`
|
|
166
|
+
through the package script, so init skips its own build; when the install is declined, init builds by itself.
|
|
167
|
+
`--no-build` also leaves the install out, unless `--install` asks for it.
|
|
168
|
+
|
|
128
169
|
A project whose `.sous/` already holds a config is left untouched. `--no-build` skips the first build.
|
|
129
170
|
|
|
130
171
|
```bash
|
|
131
172
|
sous init
|
|
132
173
|
sous init --name "My Project"
|
|
133
174
|
sous init --copy-includes
|
|
175
|
+
sous init --yes --pull-hooks
|
|
176
|
+
sous init --no-hooks
|
|
134
177
|
sous init --dry-run
|
|
135
178
|
```
|
|
136
179
|
|
|
180
|
+
### `sous init hooks [DIRECTORY]`
|
|
181
|
+
|
|
182
|
+
Installs the git hooks that give a new worktree, and each checked-out branch, Sous's output. Sous's output is
|
|
183
|
+
git-ignored, so a new worktree starts without it; git runs `post-checkout` whenever a worktree is created or a
|
|
184
|
+
branch is checked out, whoever runs git (a person, Claude Code, the Claude Desktop app, an IDE).
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
git worktree add / git checkout <branch>
|
|
188
|
+
-> .husky/post-checkout runs `pnpm install`
|
|
189
|
+
-> pnpm runs the "prepare" script
|
|
190
|
+
-> sous build
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- **With a `package.json`:** Husky is added as a dev dependency, and `.husky/post-checkout` runs the package
|
|
194
|
+
manager's install (`npm install`, `pnpm install` or `yarn install`, by the manager sous detects) on every
|
|
195
|
+
branch checkout. The script the manager runs after an install runs Husky and `sous build`: `prepare` for npm
|
|
196
|
+
and pnpm, `postinstall` for Yarn, whose newer versions skip `prepare` on install. A script already under that
|
|
197
|
+
name keeps what it has, and Sous's part runs after it. The guard `|| exit 0` means a missing `sous` command (an
|
|
198
|
+
install without dev dependencies) or a failed build prints its error and does not fail the install. At the
|
|
199
|
+
end, sous offers to run the install, which installs Husky and so turns the hooks on (`--install`,
|
|
200
|
+
`--no-install`; `--yes` runs it). Since sous has just added Husky to `package.json`, that install may update the
|
|
201
|
+
lockfile even where the manager would freeze it in CI (`pnpm install --no-frozen-lockfile`,
|
|
202
|
+
`yarn install --no-immutable` for Yarn 2 and later); the hook itself runs the plain install. Sous does not look for other hook managers: installing Husky points git at
|
|
203
|
+
`.husky/`, so another manager's hooks stop running until the project sorts that out.
|
|
204
|
+
- **Without one:** the repository's own `post-checkout` hook (in `.git/hooks/`, or wherever `core.hooksPath`
|
|
205
|
+
points) runs `sous build` directly, and does nothing when there is no `sous` command.
|
|
206
|
+
|
|
207
|
+
`post-checkout` is installed by default. Sous asks whether to add `post-merge` (after a pull that merges) and
|
|
208
|
+
`post-rewrite` (after a rebase, including a pull set to rebase); `--pull-hooks` and `--no-pull-hooks` answer, and
|
|
209
|
+
`--yes` leaves them out. Each hook prints a failure and exits 0, so git carries on.
|
|
210
|
+
|
|
211
|
+
The hook for pnpm, `.husky/post-checkout`:
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
# >>> sous managed: init hooks (do not edit between these markers)
|
|
215
|
+
# After a checkout, install the dependencies; the "prepare" script then runs `sous build`, so the
|
|
216
|
+
# files Sous writes match this checkout. A failure is printed, and git carries on.
|
|
217
|
+
if [ "$3" = "1" ]; then
|
|
218
|
+
pnpm install || echo "sous: 'pnpm install' failed after a checkout; git carried on." >&2
|
|
219
|
+
fi
|
|
220
|
+
# <<< sous managed: init hooks
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
And the script it adds to a `package.json` that had none:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"scripts": {
|
|
228
|
+
"prepare": "husky && sous build || exit 0"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
A hook file that already exists keeps its lines and gains Sous's block after them; running the command again
|
|
234
|
+
replaces the block and changes nothing else. Installing the hooks is a one-time action: no build puts them back,
|
|
235
|
+
since a project may change them.
|
|
236
|
+
|
|
237
|
+
Only a project whose `.sous/` is at the top of its git repository is supported, since the hook, the install and
|
|
238
|
+
the build all run there. Anywhere else (a project in a folder of a monorepo, say) the command stops, says why,
|
|
239
|
+
and prints the lines to add by hand. `--dry-run` shows the files and the install command and changes nothing.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
sous init hooks
|
|
243
|
+
sous init hooks --pull-hooks
|
|
244
|
+
sous init hooks --yes --no-install
|
|
245
|
+
sous init hooks --dry-run
|
|
246
|
+
```
|
|
247
|
+
|
|
137
248
|
### `sous build`
|
|
138
249
|
|
|
139
250
|
Compiles the project's outputs, then removes the ones the config no longer produces. It is the command you want
|
|
140
|
-
almost always. `-w, --watch` rebuilds on every change to a source file, a config file or a linked checkout
|
|
251
|
+
almost always. `-w, --watch` rebuilds on every change to a source file, a config file or a linked checkout,
|
|
252
|
+
and reloads the config when a file is added to or removed from a glob target's folder;
|
|
141
253
|
`--rebuild` ignores cached hashes and reprocesses everything; `--strict` makes compile warnings fail the build.
|
|
142
254
|
|
|
143
255
|
Before it compiles, a build prepares the project's recipes: it pins any new subscription, restores whatever this
|
|
@@ -159,9 +271,38 @@ the build, but only after every target is compiled and every error listed. An ou
|
|
|
159
271
|
not written, so the copy from the last good build stays in place. A build also warns about every recipe memory
|
|
160
272
|
that no output includes; see [Recipe memories](repositories-consuming.md#recipe-memories).
|
|
161
273
|
|
|
274
|
+
After preparing the recipes, one build runs these steps, in this order:
|
|
275
|
+
|
|
276
|
+
1. The `check` handlers of the recipes and plugins (see [Handlers](handlers.md)). An error from one stops the
|
|
277
|
+
build here, before anything in the project is written, and the build ends with exit code 1. A warning is
|
|
278
|
+
printed and the build goes on.
|
|
279
|
+
2. The `beforeBuild` handlers.
|
|
280
|
+
3. The compiler, then the prune of outputs the config no longer produces.
|
|
281
|
+
4. The declared edits to files sous does not own, and their assertions (see
|
|
282
|
+
[Editing files Sous does not own](editing-files.md)). An assertion at level error that fails leaves that one
|
|
283
|
+
file unwritten; every other file is written, and the build ends with exit code 1.
|
|
284
|
+
5. The `afterBuild` handlers.
|
|
285
|
+
|
|
286
|
+
A compile error skips steps 4 and 5. Three flags let a build finish in spite of failures. Each failure is still
|
|
287
|
+
printed, as a warning, and the build ends as successful. There is no setting that makes this permanent: it is a
|
|
288
|
+
choice made on each run.
|
|
289
|
+
|
|
290
|
+
| Flag | What it lets through |
|
|
291
|
+
| --- | --- |
|
|
292
|
+
| `--ignore-failed-checks` | An error a `check` handler reports |
|
|
293
|
+
| `--ignore-failed-assertions` | A failed assertion at level error; the file is then written |
|
|
294
|
+
| `--keep-going` | Both |
|
|
295
|
+
|
|
296
|
+
`--dry-run` runs the `check` handlers (they only report), works out every edit and checks every assertion, and
|
|
297
|
+
writes nothing; it runs no `beforeBuild` or `afterBuild` handler, since those act. Watch mode runs every step on
|
|
298
|
+
each rebuild, with the flags it was started with. `sous prune` runs none of the handlers and no edits. The other
|
|
299
|
+
commands that build (`init`, `launch`, `subscription add` and the like) run the same steps without these flags,
|
|
300
|
+
so a failed check stops them too; run `sous build --ignore-failed-checks` first when that is what you want.
|
|
301
|
+
|
|
162
302
|
```bash
|
|
163
303
|
sous build
|
|
164
304
|
sous build --watch
|
|
305
|
+
sous build --keep-going
|
|
165
306
|
```
|
|
166
307
|
|
|
167
308
|
### `sous compile`, `sous prune`, `sous clear`
|
|
@@ -211,15 +352,19 @@ Sous never deletes backups; remove old ones from `.sous/backups/` yourself.
|
|
|
211
352
|
### `sous launch TOOL...`
|
|
212
353
|
|
|
213
354
|
Builds the project, then starts a coding agent: one an agent plugin provides (the built-in Claude Code plugin
|
|
214
|
-
provides `claude
|
|
355
|
+
provides `claude-code`, and the built-in [Codex plugin](codex.md) provides `codex` once a project turns it on), or
|
|
356
|
+
one configured under `tools` in the config. A failed build starts nothing. The settings for the built-in Claude
|
|
357
|
+
Code one are under `tools.claude-code` (`command`, `args`, `promptFile`, `headless`). Before version 1.1.0 the
|
|
358
|
+
tool was named `claude`; `sous launch claude` is not kept as an alias, and when no tool has that name the error
|
|
359
|
+
suggests `sous launch claude-code`.
|
|
215
360
|
`--continuous` restarts the agent whenever it exits, and `--no-build` skips the build.
|
|
216
361
|
|
|
217
362
|
Arguments `launch` does not recognize are passed to the agent. Put one that clashes with a sous flag after a
|
|
218
363
|
bare `--`:
|
|
219
364
|
|
|
220
365
|
```bash
|
|
221
|
-
sous launch claude --resume
|
|
222
|
-
sous launch claude -- -c
|
|
366
|
+
sous launch claude-code --resume
|
|
367
|
+
sous launch claude-code -- -c
|
|
223
368
|
```
|
|
224
369
|
|
|
225
370
|
### `sous search TEXT`
|
|
@@ -231,16 +376,70 @@ Searches the recipes every trusted repository publishes, by name or description.
|
|
|
231
376
|
sous search task
|
|
232
377
|
```
|
|
233
378
|
|
|
234
|
-
### `sous update`
|
|
379
|
+
### `sous update [REF]`
|
|
380
|
+
|
|
381
|
+
Moves the lockfile's pins to the newest versions their ranges allow, then rebuilds: every subscription, or only
|
|
382
|
+
the repository, namespace or recipe `REF` names. `--dry-run` prints the plan and changes nothing. It asks before
|
|
383
|
+
it changes anything and before trusting a repository a newer version needs; `--yes` answers yes, and
|
|
384
|
+
`--answer <name>=<value>` or `--answers-file <path>` answer a new version's questions ahead of time.
|
|
385
|
+
`sous subscription update` and `sous recipe update` are other spellings of it. See
|
|
386
|
+
[Moving to newer versions](repositories-consuming.md#moving-to-newer-versions).
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
sous update --dry-run
|
|
390
|
+
sous update workflow/task-files --yes
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### `sous upgrade`
|
|
235
394
|
|
|
236
|
-
|
|
395
|
+
Upgrades sous itself: the global install, the project's own install, or both, each through the package manager
|
|
237
396
|
that installed it. It prints every plan and asks before each install. By default each install moves to the
|
|
238
397
|
newest version in its current major; `--major` goes past it and `--version <version|range|tag>` picks one, a
|
|
239
|
-
downgrade included.
|
|
398
|
+
downgrade included. After the project's install moves to a newer version, the new copy runs the
|
|
399
|
+
[migrations](#sous-doctor) that version brings, then builds the project; `--answer <name>=<value>` answers a
|
|
400
|
+
migration's question ahead of time. See [Upgrading](README.md#upgrading).
|
|
240
401
|
|
|
241
402
|
```bash
|
|
242
|
-
sous
|
|
243
|
-
sous
|
|
403
|
+
sous upgrade --dry-run
|
|
404
|
+
sous upgrade --version next
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### `sous doctor`
|
|
408
|
+
|
|
409
|
+
Checks the project's health, runs the migrations a newer version of sous brought, and offers to fix each
|
|
410
|
+
problem it finds, asking before each fix. Its checks, in order:
|
|
411
|
+
|
|
412
|
+
1. The config loads.
|
|
413
|
+
2. The lockfile agrees with the subscriptions (fix: write the lockfile the subscriptions make, keeping every pin
|
|
414
|
+
their ranges still allow).
|
|
415
|
+
3. Required recipe variables have answers (fix: ask them).
|
|
416
|
+
4. Every migration for this version of sous has run (fix: run them). This check runs even when the config does
|
|
417
|
+
not load, since a migration may be what makes it load again (an option a newer sous removed). When it does,
|
|
418
|
+
the config is read again in the same run: the first check shows as fixed, and the checks it had skipped run.
|
|
419
|
+
5. The git hooks are turned on, when the project was set up with them (fix: `sous init hooks --install`). Sous
|
|
420
|
+
reads what `sous init hooks` committed: hook files in `.husky/` holding its marked block. They are on when
|
|
421
|
+
git's hooks folder is Husky's `.husky/_`, which the package manager's install sets up; a fresh clone whose
|
|
422
|
+
install has not run is what this finds. A project without a `package.json` keeps its hook outside git, so a
|
|
423
|
+
new clone cannot tell, and the check says so.
|
|
424
|
+
6. The `check` handlers of the recipes and plugins report no errors. Their errors are a problem and their
|
|
425
|
+
warnings a warning, one line each. No fix: what they report is yours to put right.
|
|
426
|
+
7. Every assertion on the files sous edits holds, checked without writing anything. A failed assertion at level
|
|
427
|
+
error is a problem; one at level warn is a warning. No fix.
|
|
428
|
+
8. The files sous wrote are present and unchanged (fix: build).
|
|
429
|
+
|
|
430
|
+
Plugins add checks of their own. `--dry-run` reports and changes nothing; `--yes` applies every fix without
|
|
431
|
+
asking and takes the default answer to each migration's question; `--answer <name>=<value>` answers one
|
|
432
|
+
question, a migration's or a recipe variable's; `--only <check>` runs one check. It ends with exit code 1 when a
|
|
433
|
+
problem remains. A migration waiting for an answer nobody could give (no terminal, no `--yes`, no `--answer`)
|
|
434
|
+
is listed with the `--answer` that gives it, and does not change the exit code.
|
|
435
|
+
|
|
436
|
+
A migration brings a project's files in line with a newer version of sous. Each runs once for the project: the
|
|
437
|
+
lockfile records the version of sous whose migrations the project last ran. While one is waiting, every other
|
|
438
|
+
command prints one line saying so, and carries on.
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
sous doctor --dry-run
|
|
442
|
+
sous doctor --yes
|
|
244
443
|
```
|
|
245
444
|
|
|
246
445
|
### `sous mcp`
|
|
@@ -353,7 +552,7 @@ sous repo contribute workflow/task-files --finish --title "Clarify the resume st
|
|
|
353
552
|
### `sous repo init [DIRECTORY]`
|
|
354
553
|
|
|
355
554
|
Creates a new recipe repository, then runs [`sous init`](#sous-init-directory) in the same directory, so the
|
|
356
|
-
repository is also a sous project whose
|
|
555
|
+
repository is also a sous project whose memories file and `.claude/skills/` are build output. It
|
|
357
556
|
passes `--yes`, `--move-includes`, `--copy-includes`, `--leave-includes`, `--no-build` and `--dry-run` through to
|
|
358
557
|
init. A directory that already holds a sous config keeps it, and init is skipped with a note. See
|
|
359
558
|
[Authoring a repository](repositories-authoring.md).
|
|
@@ -393,8 +592,7 @@ Manages which recipes the project subscribes to. `REF` is `namespace` or `namesp
|
|
|
393
592
|
the sous plugins it requires with `--install-plugins`.
|
|
394
593
|
- `subscription remove` (or `sous unsubscribe`) removes a subscription and everything only it brought in. The
|
|
395
594
|
built-in `core` subscription is switched off instead, keeping its pin.
|
|
396
|
-
- `subscription update [REF]`
|
|
397
|
-
rebuilds. See [Moving to newer versions](repositories-consuming.md#moving-to-newer-versions).
|
|
595
|
+
- `subscription update [REF]` is [`sous update`](#sous-update-ref).
|
|
398
596
|
- `subscription disable REF` and `subscription enable REF` switch a subscription off or back on in
|
|
399
597
|
`conf.d/510-subscriptions.jsonc`, leaving the rest of that file as it is.
|
|
400
598
|
- `subscription list` lists the subscriptions, switched-off ones included, with their pins and latest versions.
|
|
@@ -402,7 +600,7 @@ Manages which recipes the project subscribes to. `REF` is `namespace` or `namesp
|
|
|
402
600
|
```bash
|
|
403
601
|
sous subscribe workflow/task-files@^1.2.0 --answer apiUrl=https://api.example.com
|
|
404
602
|
sous subscription disable tool-usage/automated-browser-tasks
|
|
405
|
-
sous
|
|
603
|
+
sous sub ls
|
|
406
604
|
```
|
|
407
605
|
|
|
408
606
|
## namespace and recipe
|