@sous-io/sous 0.2.37 → 1.0.2
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/README.md +14 -256
- package/dist/bin.js +11 -0
- package/dist/sous.js +1094 -0
- package/docs/markdown/README.md +5 -4
- package/docs/markdown/_sidebar.md +21 -1
- package/docs/markdown/commands.md +294 -431
- package/docs/markdown/config-discovery.md +25 -14
- package/docs/markdown/config-inspection.md +53 -31
- package/docs/markdown/config-layers.md +168 -66
- package/docs/markdown/config-variables.md +44 -11
- package/docs/markdown/configuration.md +104 -17
- package/docs/markdown/design-principles.md +4 -1
- package/docs/markdown/repositories-authoring.md +30 -0
- package/docs/markdown/repositories-consuming.md +72 -14
- package/docs/markdown/repositories-file-formats.md +31 -13
- package/docs/markdown/repositories-providers.md +48 -57
- package/docs/markdown/repositories-quickstart.md +3 -2
- package/docs/markdown/repositories-troubleshooting.md +27 -1
- package/docs/markdown/repositories-variables.md +6 -1
- package/docs/markdown/repositories.md +18 -8
- package/package.json +48 -107
- package/recipes/core/sous-skills/skills/about-liquid-templates/SKILL.tpl.md +4 -6
- package/recipes/core/sous-skills/skills/about-liquid-templates/references/liquid-filters.tpl.md +2 -0
- package/recipes/core/sous-skills/skills/about-sous/SKILL.tpl.md +10 -9
- package/recipes/core/sous-skills/skills/about-sous-configuration/SKILL.tpl.md +35 -14
- package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +51 -20
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/sous.config.schema.json +351 -132
- package/bin/run.js +0 -51
- package/src/base-command.ts +0 -457
- package/src/commands/build.ts +0 -181
- package/src/commands/clear.ts +0 -79
- package/src/commands/compile.ts +0 -155
- package/src/commands/config/get.ts +0 -110
- package/src/commands/config/show.ts +0 -32
- package/src/commands/config/validate.ts +0 -53
- package/src/commands/help.ts +0 -46
- package/src/commands/init.ts +0 -289
- package/src/commands/launch.ts +0 -139
- package/src/commands/lock/rebuild.ts +0 -239
- package/src/commands/lock/show.ts +0 -115
- package/src/commands/namespace/list.ts +0 -138
- package/src/commands/namespace/show.ts +0 -130
- package/src/commands/prune.ts +0 -43
- package/src/commands/recipe/list.ts +0 -112
- package/src/commands/recipe/show.ts +0 -439
- package/src/commands/repo/add.ts +0 -145
- package/src/commands/repo/contribute.ts +0 -604
- package/src/commands/repo/gc.ts +0 -173
- package/src/commands/repo/init.ts +0 -136
- package/src/commands/repo/link.ts +0 -899
- package/src/commands/repo/list.ts +0 -236
- package/src/commands/repo/release.ts +0 -685
- package/src/commands/repo/remove.ts +0 -194
- package/src/commands/repo/search.ts +0 -243
- package/src/commands/repo/submit.ts +0 -341
- package/src/commands/repo/unlink.ts +0 -461
- package/src/commands/subscription/add.ts +0 -286
- package/src/commands/subscription/list.ts +0 -208
- package/src/commands/subscription/remove.ts +0 -182
- package/src/commands/subscription/update.ts +0 -216
- package/src/commands/update.ts +0 -178
- package/src/commands/vars/ask.ts +0 -417
- package/src/commands/vars/index.ts +0 -79
- package/src/commands/vars/list.ts +0 -67
- package/src/commands/vars/show.ts +0 -77
- package/src/config-command.ts +0 -30
- package/src/lib/build-preparation.ts +0 -128
- package/src/lib/build-service.ts +0 -580
- package/src/lib/config-discovery.ts +0 -378
- package/src/lib/config-inspect.ts +0 -145
- package/src/lib/config-kernel.mjs +0 -379
- package/src/lib/config-schema.ts +0 -401
- package/src/lib/env-file.ts +0 -328
- package/src/lib/env-local.ts +0 -212
- package/src/lib/errors.ts +0 -32
- package/src/lib/glob-pattern.ts +0 -24
- package/src/lib/include-resolver.ts +0 -523
- package/src/lib/interactive.ts +0 -165
- package/src/lib/markdown-compiler.ts +0 -947
- package/src/lib/package-info.ts +0 -25
- package/src/lib/pid-service.ts +0 -99
- package/src/lib/project-install.d.mts +0 -44
- package/src/lib/project-install.mjs +0 -234
- package/src/lib/project-scaffold/index.ts +0 -332
- package/src/lib/project-scaffold/templates.ts +0 -240
- package/src/lib/repos/catalog-display.ts +0 -215
- package/src/lib/repos/catalog-inputs.ts +0 -288
- package/src/lib/repos/catalog.ts +0 -842
- package/src/lib/repos/contribute.ts +0 -452
- package/src/lib/repos/core-recipe.ts +0 -105
- package/src/lib/repos/declarations.ts +0 -187
- package/src/lib/repos/defaults.ts +0 -175
- package/src/lib/repos/formats/common.ts +0 -440
- package/src/lib/repos/formats/index-file.ts +0 -253
- package/src/lib/repos/formats/links-map.ts +0 -98
- package/src/lib/repos/formats/lockfile.ts +0 -169
- package/src/lib/repos/formats/patterns.ts +0 -57
- package/src/lib/repos/formats/recipe-manifest.ts +0 -205
- package/src/lib/repos/formats/repo-manifest.ts +0 -97
- package/src/lib/repos/formats/store-entry.ts +0 -84
- package/src/lib/repos/formats/variable-definition.ts +0 -268
- package/src/lib/repos/freshness.ts +0 -264
- package/src/lib/repos/git-clone.ts +0 -850
- package/src/lib/repos/identity.ts +0 -89
- package/src/lib/repos/index.ts +0 -57
- package/src/lib/repos/links.ts +0 -356
- package/src/lib/repos/load-manifest.ts +0 -237
- package/src/lib/repos/lock-service.ts +0 -454
- package/src/lib/repos/locked-namespace-resolver.ts +0 -232
- package/src/lib/repos/locked-recipe-lookup.ts +0 -123
- package/src/lib/repos/locked-recipes.ts +0 -254
- package/src/lib/repos/managed-layer.ts +0 -422
- package/src/lib/repos/memories-hash-name.ts +0 -33
- package/src/lib/repos/namespace-resolver.ts +0 -527
- package/src/lib/repos/providers/base.ts +0 -268
- package/src/lib/repos/providers/git.ts +0 -245
- package/src/lib/repos/providers/github.ts +0 -589
- package/src/lib/repos/providers/gitlab.ts +0 -332
- package/src/lib/repos/providers/http.ts +0 -128
- package/src/lib/repos/providers/index-cache.ts +0 -421
- package/src/lib/repos/providers/index.ts +0 -106
- package/src/lib/repos/providers/local.ts +0 -410
- package/src/lib/repos/providers/provider.ts +0 -615
- package/src/lib/repos/recipe-config-layers.ts +0 -316
- package/src/lib/repos/recipe-key-matcher.ts +0 -62
- package/src/lib/repos/recipe-memories.ts +0 -178
- package/src/lib/repos/recipe-targets.ts +0 -236
- package/src/lib/repos/ref-search.ts +0 -46
- package/src/lib/repos/release/bump.ts +0 -161
- package/src/lib/repos/release/changelog.ts +0 -461
- package/src/lib/repos/release/git-state.ts +0 -460
- package/src/lib/repos/release/index-builder.ts +0 -1108
- package/src/lib/repos/release/index.ts +0 -19
- package/src/lib/repos/release/plan.ts +0 -521
- package/src/lib/repos/release/settle.ts +0 -154
- package/src/lib/repos/release/submissions.ts +0 -214
- package/src/lib/repos/release/submit-checkout.ts +0 -290
- package/src/lib/repos/release/submit-questions.ts +0 -153
- package/src/lib/repos/release/submit-service.ts +0 -898
- package/src/lib/repos/release/tags.ts +0 -239
- package/src/lib/repos/release/validate.ts +0 -463
- package/src/lib/repos/resolver.ts +0 -1028
- package/src/lib/repos/scaffold/index.ts +0 -245
- package/src/lib/repos/scaffold/templates.ts +0 -517
- package/src/lib/repos/seed.ts +0 -473
- package/src/lib/repos/store/contract.ts +0 -64
- package/src/lib/repos/store/hash.ts +0 -191
- package/src/lib/repos/store/recipe-store.ts +0 -599
- package/src/lib/repos/store/settings.ts +0 -58
- package/src/lib/repos/subscription-service.ts +0 -3859
- package/src/lib/repos/trust.ts +0 -447
- package/src/lib/repos/update-plan.ts +0 -235
- package/src/lib/self-update/index.ts +0 -14
- package/src/lib/self-update/installs.ts +0 -413
- package/src/lib/self-update/managers.ts +0 -126
- package/src/lib/self-update/plan.ts +0 -315
- package/src/lib/self-update/registry.ts +0 -99
- package/src/lib/self-update/run.ts +0 -506
- package/src/lib/self-update/versions.ts +0 -243
- package/src/lib/settings.ts +0 -1107
- package/src/lib/sous-home.ts +0 -104
- package/src/lib/state.ts +0 -167
- package/src/lib/vars/answers.ts +0 -192
- package/src/lib/vars/ask.ts +0 -1152
- package/src/lib/vars/definition-source.ts +0 -261
- package/src/lib/vars/display.ts +0 -231
- package/src/lib/vars/index.ts +0 -20
- package/src/lib/vars/ladder.ts +0 -282
- package/src/lib/vars/mappings.ts +0 -260
- package/src/lib/vars/names.ts +0 -94
- package/src/lib/vars/preanswers.ts +0 -395
- package/src/lib/vars/question-plan.ts +0 -241
- package/src/lib/vars/report.ts +0 -228
- package/src/lib/vars/safe-regex.ts +0 -235
- package/src/lib/vars/secrets.ts +0 -131
- package/src/lib/vars/validate.ts +0 -312
- package/src/lib/version-report.ts +0 -90
- package/src/lib/watch-loop.ts +0 -148
- package/src/lib/watch-service.ts +0 -116
- package/src/services/ref-resolver/container.ts +0 -107
- package/src/services/ref-resolver/dependency.ts +0 -60
- package/src/services/ref-resolver/format.ts +0 -197
- package/src/services/ref-resolver/glob.ts +0 -115
- package/src/services/ref-resolver/hash-names.ts +0 -155
- package/src/services/ref-resolver/index.ts +0 -55
- package/src/services/ref-resolver/injectable.ts +0 -36
- package/src/services/ref-resolver/location.ts +0 -62
- package/src/services/ref-resolver/lookups/cached-index-lookup.ts +0 -53
- package/src/services/ref-resolver/lookups/catalog-lookup.ts +0 -23
- package/src/services/ref-resolver/lookups/catalog-matcher.ts +0 -261
- package/src/services/ref-resolver/lookups/chained-lookup.ts +0 -27
- package/src/services/ref-resolver/lookups/env-var-lookup.ts +0 -65
- package/src/services/ref-resolver/lookups/fetched-index-lookup.ts +0 -150
- package/src/services/ref-resolver/lookups/recorded-dependency-lookup.ts +0 -62
- package/src/services/ref-resolver/lookups/ref-lookup.ts +0 -54
- package/src/services/ref-resolver/lookups/variable-lookup.ts +0 -123
- package/src/services/ref-resolver/named-refs.ts +0 -144
- package/src/services/ref-resolver/parser/env-var-splitter.ts +0 -27
- package/src/services/ref-resolver/parser/location-splitter.ts +0 -239
- package/src/services/ref-resolver/parser/name-path-splitter.ts +0 -200
- package/src/services/ref-resolver/parser/partial-ref.ts +0 -84
- package/src/services/ref-resolver/parser/query-splitter.ts +0 -61
- package/src/services/ref-resolver/parser/range-splitter.ts +0 -52
- package/src/services/ref-resolver/parser/ref-parser.ts +0 -115
- package/src/services/ref-resolver/parser/repo-qualifier-splitter.ts +0 -51
- package/src/services/ref-resolver/parts.ts +0 -115
- package/src/services/ref-resolver/pruners/command-line-pruner.ts +0 -47
- package/src/services/ref-resolver/pruners/include-pruner.ts +0 -66
- package/src/services/ref-resolver/pruners/manifest-pruner.ts +0 -130
- package/src/services/ref-resolver/pruners/ref-pruner.ts +0 -135
- package/src/services/ref-resolver/pruners/rule-helpers.ts +0 -44
- package/src/services/ref-resolver/pruners/stored-key-pruner.ts +0 -136
- package/src/services/ref-resolver/ref-helpers.ts +0 -62
- package/src/services/ref-resolver/ref-picker-service.ts +0 -204
- package/src/services/ref-resolver/ref-report.ts +0 -84
- package/src/services/ref-resolver/ref-resolve-arguments.ts +0 -47
- package/src/services/ref-resolver/ref-resolve-result.ts +0 -36
- package/src/services/ref-resolver/ref-resolver-service.ts +0 -323
- package/src/services/ref-resolver/source.ts +0 -48
- package/src/services/ref-resolver/tokens.ts +0 -25
- package/src/services/ref-resolver/types.ts +0 -155
- package/src/templating/filters/bullet-list.ts +0 -9
- package/src/templating/filters/index.ts +0 -8
- package/src/templating/init-liquid-engine.ts +0 -139
- package/src/templating/lib/glob-files.ts +0 -74
- package/src/templating/lib/import-export.ts +0 -32
- package/src/templating/lib/secret-scope.ts +0 -41
- package/src/templating/lib/tag-args.ts +0 -19
- package/src/templating/tags/exportScalarVarsJs.ts +0 -46
- package/src/templating/tags/getFiles.ts +0 -89
- package/src/templating/tags/index.ts +0 -14
- package/src/templating/tags/listFiles.ts +0 -54
- package/src/templating/tags/showVars.ts +0 -28
- package/src/utils/choice-prompt.ts +0 -143
- package/src/utils/command-errors.ts +0 -186
- package/src/utils/command-help.ts +0 -45
- package/src/utils/confirm-prompt.ts +0 -110
- package/src/utils/flags.ts +0 -177
- package/src/utils/formatting.ts +0 -849
- package/src/utils/prompts.ts +0 -53
- package/src/utils/sous-directory.ts +0 -245
- package/src/utils/table.ts +0 -603
- package/src/utils/value-prompt.ts +0 -119
package/README.md
CHANGED
|
@@ -1,273 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://sous.io">
|
|
3
|
-
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/sous-io/sous/main/docs/img/logo-on-dark-sm.png">
|
|
5
|
-
<img src="https://raw.githubusercontent.com/sous-io/sous/main/docs/img/logo-on-white-sm.png" alt="Sous" height="180">
|
|
6
|
-
</picture>
|
|
7
|
-
</a>
|
|
8
|
-
</p>
|
|
1
|
+
# @sous-io/sous
|
|
9
2
|
|
|
10
|
-
|
|
3
|
+
sous compiles AI coding agent configuration (`CLAUDE.md`, skills, memories) from LiquidJS templates, so you write your rules once and every project gets its own rendered copy.
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
instructions once as LiquidJS templates in layered sources, then sous renders them into the
|
|
14
|
-
formats agents actually read: `.claude/` plus `CLAUDE.md` for Claude Code, `.codex/` plus
|
|
15
|
-
`AGENTS.md` for Codex. The CLI binary is named `sous`.
|
|
16
|
-
|
|
17
|
-
**New to sous? Watch the animated introduction at [sous.io](https://sous.io).**
|
|
18
|
-
|
|
19
|
-
## Why
|
|
20
|
-
|
|
21
|
-
- Share one set of agent configs across every project you work in, and with teammates.
|
|
22
|
-
- Write a rule once as a template with variables; each project gets its own rendered copy.
|
|
23
|
-
- Compile the same source to more than one agent's format.
|
|
24
|
-
- Keep machine-specific values (absolute paths, tokens) in an untracked env file, out of git,
|
|
25
|
-
with shared team defaults in a committed one.
|
|
26
|
-
|
|
27
|
-
## Quickstart
|
|
28
|
-
|
|
29
|
-
Install the CLI globally, or add it to a project, or both:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install -g @sous-io/sous # one sous for every project on the machine
|
|
33
|
-
npm install -D @sous-io/sous # the version this project's templates were written against
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
A project install pins the sous version a project builds with, and it always does the
|
|
37
|
-
building: a global `sous` run anywhere inside a project that holds `node_modules/@sous-io/sous`
|
|
38
|
-
hands the command to that copy, so `sous`, `npx sous` and a package script all produce the same
|
|
39
|
-
output. When the two versions differ, one line on standard error names the version handed off
|
|
40
|
-
to; `--verbose` announces every hand-off and adds where both installs are. Set
|
|
41
|
-
`SOUS_NO_DELEGATE=1` to run the copy you invoked instead.
|
|
42
|
-
|
|
43
|
-
To update, run `sous update`. It updates the global install, the project's own install, or both
|
|
44
|
-
(whichever this directory has), through the package manager that installed each one (npm, pnpm or
|
|
45
|
-
Yarn), and asks before each one. By default each install moves to the newest version in its current
|
|
46
|
-
major; `--major` goes past it, `--version <version|range|tag>` picks one (a downgrade included),
|
|
47
|
-
`--global` and `--project` narrow the run, `--yes` answers every question and `--dry-run` only
|
|
48
|
-
prints the plan. After a project update, the new copy builds the project, so its lockfile moves to
|
|
49
|
-
the new version too.
|
|
5
|
+
## Install
|
|
50
6
|
|
|
51
7
|
```bash
|
|
52
|
-
|
|
8
|
+
npm install -g @sous-io/sous
|
|
9
|
+
sous --help
|
|
53
10
|
```
|
|
54
11
|
|
|
55
|
-
Or
|
|
12
|
+
Or add it to one project:
|
|
56
13
|
|
|
57
14
|
```bash
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
npm install
|
|
61
|
-
npm link
|
|
15
|
+
npm install --save-dev @sous-io/sous
|
|
16
|
+
npx sous --help
|
|
62
17
|
```
|
|
63
18
|
|
|
64
|
-
|
|
19
|
+
Requires Node.js 22 or later.
|
|
65
20
|
|
|
66
|
-
|
|
67
|
-
cd /path/to/your/project
|
|
68
|
-
sous init
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
`sous init` writes the project's `.sous/` directory and runs the first build. It creates a
|
|
72
|
-
commented `sous.config.js` (pass `--format json` for a JSON config bound to the shipped
|
|
73
|
-
schema), a starter prompt at `.sous/memories/AGENTS.tpl.md` that the config compiles to `AGENTS.md`
|
|
74
|
-
at the project root (it includes every memory your subscribed recipes publish, with one line, `@#memories/**/*.md`), the two env files described below, and a `.sous/.gitignore` covering the
|
|
75
|
-
files sous keeps local to one machine. A project with a `package.json` also gains `@sous-io/sous`
|
|
76
|
-
as a devDependency at the running version, so the project pins the sous it builds with; run
|
|
77
|
-
your package manager's install afterwards. The first build compiles the starter prompt and the
|
|
78
|
-
`core` skills every project gets, and pins them in `.sous/sous.lock.json`. A project that
|
|
79
|
-
already holds a config is left untouched.
|
|
21
|
+
## Learn more
|
|
80
22
|
|
|
81
|
-
|
|
23
|
+
Guides, the command reference and the config reference are at [sous.io](https://sous.io). Source and issues: [github.com/sous-io/sous](https://github.com/sous-io/sous).
|
|
82
24
|
|
|
83
|
-
|
|
84
|
-
export const config = {
|
|
85
|
-
name: "My Project",
|
|
86
|
-
_vars: { projectRoot: "${sousDir}/.." },
|
|
87
|
-
compilation: {
|
|
88
|
-
targets: [
|
|
89
|
-
{
|
|
90
|
-
entryPoint: "${sousDir}/memories/AGENTS.tpl.md",
|
|
91
|
-
outputs: [{ destinationFile: "${projectRoot}/AGENTS.md" }],
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
recipes: { skills: { outputs: ["${projectRoot}/.claude/skills"] } },
|
|
96
|
-
};
|
|
97
|
-
```
|
|
25
|
+
## For contributors
|
|
98
26
|
|
|
99
|
-
|
|
100
|
-
itself without hardcoding anything machine-specific. One config describes one project. A
|
|
101
|
-
`.sous/` may hold one config file, named `sous.config.js`, `sous.config.mjs`,
|
|
102
|
-
`sous.config.json`, `sous.config.jsonc` or `sous.config.yaml`. After editing, build:
|
|
27
|
+
This package is the thin shell that starts the engine with the built-in plugins and hands the command line to them. The code lives in the other packages of the monorepo; see the root README.
|
|
103
28
|
|
|
104
29
|
```bash
|
|
105
|
-
sous
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
`sous build` compiles every configured target and prunes outputs that are no longer in the
|
|
109
|
-
config. Config discovery walks up from the current directory until it finds a `.sous/`
|
|
110
|
-
directory holding a config, so you can run it from anywhere inside the project. Pass
|
|
111
|
-
`--config <path>` to point at one explicitly instead.
|
|
112
|
-
|
|
113
|
-
Values reach the config through its top-level `_env` block, which maps a config variable
|
|
114
|
-
to an environment variable. Both env files use `KEY=value` lines and are loaded before
|
|
115
|
-
anything resolves. There are two layers:
|
|
116
|
-
|
|
117
|
-
- `.sous/.env` is committed. Put shared team defaults here, never secrets.
|
|
118
|
-
- `.sous/.env.local` is gitignored. Put machine-specific values and secrets here.
|
|
119
|
-
|
|
120
|
-
Precedence, highest first: your shell environment, then `.env.local`, then `.env`. So
|
|
121
|
-
`FOO=bar sous build` beats both files, and `.env.local` beats `.env` per key. This repo
|
|
122
|
-
ships `.sous/.env.local.example` documenting the layer.
|
|
123
|
-
|
|
124
|
-
Useful commands:
|
|
125
|
-
|
|
126
|
-
| Command | What it does |
|
|
127
|
-
|---|---|
|
|
128
|
-
| `sous init` | Set a project up: write `.sous/`, then run the first build |
|
|
129
|
-
| `sous build` | Compile, then prune stale outputs |
|
|
130
|
-
| `sous build --watch` | Rebuild on source changes |
|
|
131
|
-
| `sous compile` | Compile only |
|
|
132
|
-
| `sous prune` | Remove outputs no longer in the config |
|
|
133
|
-
| `sous clear` | Delete every file sous wrote for the project |
|
|
134
|
-
| `sous launch claude` | Build, then start the agent |
|
|
135
|
-
| `sous config show` | Print the merged config (all layers) as JSON |
|
|
136
|
-
| `sous config get <path>` | Read one value by dot-path; `--layers` shows which file set it |
|
|
137
|
-
| `sous config validate` | Validate the merged config: schema, then variable resolution |
|
|
138
|
-
|
|
139
|
-
## How it works
|
|
140
|
-
|
|
141
|
-
Sources are markdown files. A file with `.tpl.` in its name is rendered through LiquidJS and
|
|
142
|
-
the `.tpl.` is dropped from the output name (`skill.tpl.md` becomes `skill.md`). Files without
|
|
143
|
-
`.tpl.` are copied verbatim. Any line of the form `@path/to/file.md` pulls in another file, so
|
|
144
|
-
one instruction block can be composed into several outputs.
|
|
145
|
-
|
|
146
|
-
Config lists targets. Each target names an entry point or a glob, plus one or more outputs, and
|
|
147
|
-
each level can define variables:
|
|
148
|
-
|
|
149
|
-
```js
|
|
150
|
-
// One entry point to one file.
|
|
151
|
-
{
|
|
152
|
-
entryPoint: "${sousDir}/memory/MEMORY.root.tpl.md",
|
|
153
|
-
outputs: [{ destinationFile: "${projectRoot}/CLAUDE.md" }],
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// One glob to a directory, mirroring the source tree under it.
|
|
157
|
-
{
|
|
158
|
-
entryGlob: "${sousDir}/skills/**/*",
|
|
159
|
-
outputs: [{ destinationDir: "${projectRoot}/.claude/skills" }],
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Variables resolve later-wins across scopes: auto-injected, env, config, compilation,
|
|
164
|
-
target, output. Templates read them as `{{ varName }}`; config files reference them as `${varName}`.
|
|
165
|
-
The auto-injected ones include `${sousDir}` and `${sousConfigPath}` for the discovered
|
|
166
|
-
config, and `${sousTemplatePath}` for the template being rendered.
|
|
167
|
-
|
|
168
|
-
Sources come in three tiers, each able to build on the one above it:
|
|
169
|
-
|
|
170
|
-
1. **Published recipes**, fetched from a recipe repository and pinned in your project's
|
|
171
|
-
lockfile. The official repository publishes the `core` namespace, which teaches an agent
|
|
172
|
-
about sous itself and which every project gets without asking, plus recipes for skill
|
|
173
|
-
authoring, task tracking and more.
|
|
174
|
-
2. **Team-shared**, a recipe repository your team owns, holding the recipes everyone should
|
|
175
|
-
get.
|
|
176
|
-
3. **Per-project**, the project's own `.sous/` directory, for anything specific to it.
|
|
177
|
-
|
|
178
|
-
A recipe's files are reachable without knowing where anything is installed. An `@include`
|
|
179
|
-
path may name a recipe by its namespace, so
|
|
180
|
-
`@~workflow/task-files/_partials/resume-task.md` composes a block published by the recipe
|
|
181
|
-
`workflow/task-files`, at the version your project has pinned, into your own instruction
|
|
182
|
-
file. `@#project/...` names your project's root, `@~/...` names your home directory, and you
|
|
183
|
-
can define your own aliases with an `_aliases` block. A path may be a glob, and
|
|
184
|
-
`@#memories/**/*.md` includes the memories of every recipe your project subscribes to. Either spelling of a file finds it:
|
|
185
|
-
`@shared.md` also finds `shared.tpl.md`, and the other way round.
|
|
186
|
-
|
|
187
|
-
Sous records every file and directory it writes in a state file, `.sous/sous.state.json` by
|
|
188
|
-
default, which is what lets `prune` and `clear` clean up precisely instead of guessing.
|
|
189
|
-
|
|
190
|
-
## Composing config from layers
|
|
191
|
-
|
|
192
|
-
One config can grow large, so sous lets you split it. Alongside the primary
|
|
193
|
-
`sous.config.*`, any file matching `.sous/conf.d/*.{js,mjs,json,yaml}` is a layer. Sous loads
|
|
194
|
-
the primary first, then the `conf.d/` files sorted bytewise-lexicographically (identical order
|
|
195
|
-
on every machine), and merges them into one config: objects deep-merge key by key, scalars are
|
|
196
|
-
later-wins, and arrays concatenate in load order. Every layer is forced back to plain JSON
|
|
197
|
-
before merging, so functions, `RegExp`, `Date`, and `undefined` do not survive a layer.
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
.sous/
|
|
201
|
-
sous.config.js # base config
|
|
202
|
-
conf.d/
|
|
203
|
-
100-tools.json # adds or overrides tools
|
|
204
|
-
200-skills.yaml # adds compilation targets
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
For anything JSON cannot express, a `.js`/`.mjs` layer may export a `configure` function
|
|
208
|
-
instead of (or alongside) a `config` object. Sous calls it with the cumulative config so far
|
|
209
|
-
and a small builder, and merges the result:
|
|
210
|
-
|
|
211
|
-
```js
|
|
212
|
-
export function configure(currentConfig, builder) {
|
|
213
|
-
// currentConfig is the live merged config; mutate it by reference, or return
|
|
214
|
-
// an object to merge. builder.env(name, fallback), builder.loadConfig(path),
|
|
215
|
-
// builder.loadConfigs(glob), and builder.merge(obj) are available.
|
|
216
|
-
currentConfig._vars.apiBase = builder.env("API_BASE", "https://example.com");
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
`configure` may be async. Builder paths (`loadConfig`/`loadConfigs`) run before variable
|
|
221
|
-
resolution, so they accept only the auto-vars `${sousDir}`, `${sousConfDir}`, `${sousRootPath}`,
|
|
222
|
-
and `${sousVersion}`; any other `${var}` in a builder path is an error.
|
|
223
|
-
|
|
224
|
-
## Locating the config
|
|
225
|
-
|
|
226
|
-
By default sous walks up from the current directory to find the `.sous/` holding a config.
|
|
227
|
-
You can point it elsewhere with an environment variable or a flag; every command accepts these:
|
|
228
|
-
|
|
229
|
-
| Flag | Env var | What it overrides |
|
|
230
|
-
|---|---|---|
|
|
231
|
-
| `--config` / `-c` / `--sous-config` | `SOUS_CONFIG` | The exact primary config file |
|
|
232
|
-
| `--sous-dir` | `SOUS_DIR` | The `.sous/` directory to use |
|
|
233
|
-
| `--sous-confd` | `SOUS_CONFD` | The `conf.d/` directory (defaults to `<sousDir>/conf.d`) |
|
|
234
|
-
|
|
235
|
-
Precedence, highest first: flag, then env var, then walk-up discovery. These location inputs
|
|
236
|
-
are read from the real environment only, never from `.env` or `.env.local` (those files are
|
|
237
|
-
found by discovery, so they cannot decide where discovery looks).
|
|
238
|
-
|
|
239
|
-
## Validating and inspecting config
|
|
240
|
-
|
|
241
|
-
`sous config validate` runs the full pipeline: it merges every layer, checks it against the
|
|
242
|
-
schema, then resolves variables, reporting the first failure with a readable message.
|
|
243
|
-
`sous config show` prints the merged config as JSON, and `sous config get <dot.path>` reads a
|
|
244
|
-
single value; add `--layers` to see which layer file set it and to what.
|
|
245
|
-
|
|
246
|
-
Config is validated against a JSON Schema on every load. A config may declare a `version`
|
|
247
|
-
field; omit it or set it to `1`. JSON layers can point an editor at the shipped schema with a
|
|
248
|
-
`"$schema"` key for autocompletion and inline validation:
|
|
249
|
-
|
|
250
|
-
```json
|
|
251
|
-
{
|
|
252
|
-
"$schema": "./sous.config.schema.json",
|
|
253
|
-
"version": 1
|
|
254
|
-
}
|
|
30
|
+
pnpm --filter @sous-io/sous test
|
|
255
31
|
```
|
|
256
|
-
|
|
257
|
-
## Platform support
|
|
258
|
-
|
|
259
|
-
- **Ubuntu** is where sous is developed and tested.
|
|
260
|
-
- **macOS** should work for the core CLI, but is not tested yet. Reports welcome.
|
|
261
|
-
- **Windows** is not supported.
|
|
262
|
-
- The browser-automation skill bundle is **Linux only**. It depends on Linux Chrome paths and
|
|
263
|
-
the GNOME keyring.
|
|
264
|
-
|
|
265
|
-
Node 22 is required; the version is pinned in `.nvmrc`.
|
|
266
|
-
|
|
267
|
-
## Contributing
|
|
268
|
-
|
|
269
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md). Note the licensing terms for contributions.
|
|
270
|
-
|
|
271
|
-
## License
|
|
272
|
-
|
|
273
|
-
Apache License 2.0. See [LICENSE](LICENSE).
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { enableCompileCache } from "node:module";
|
|
3
|
+
|
|
4
|
+
// Keeps the compiled bundle on disk between runs (Node 22.1 and later); start-up is faster.
|
|
5
|
+
try {
|
|
6
|
+
enableCompileCache?.();
|
|
7
|
+
} catch {
|
|
8
|
+
// No cache: sous still runs, only a little slower to start.
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
await import("./sous.js");
|