@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.
Files changed (244) hide show
  1. package/README.md +14 -256
  2. package/dist/bin.js +11 -0
  3. package/dist/sous.js +1094 -0
  4. package/docs/markdown/README.md +5 -4
  5. package/docs/markdown/_sidebar.md +21 -1
  6. package/docs/markdown/commands.md +294 -431
  7. package/docs/markdown/config-discovery.md +25 -14
  8. package/docs/markdown/config-inspection.md +53 -31
  9. package/docs/markdown/config-layers.md +168 -66
  10. package/docs/markdown/config-variables.md +44 -11
  11. package/docs/markdown/configuration.md +104 -17
  12. package/docs/markdown/design-principles.md +4 -1
  13. package/docs/markdown/repositories-authoring.md +30 -0
  14. package/docs/markdown/repositories-consuming.md +72 -14
  15. package/docs/markdown/repositories-file-formats.md +31 -13
  16. package/docs/markdown/repositories-providers.md +48 -57
  17. package/docs/markdown/repositories-quickstart.md +3 -2
  18. package/docs/markdown/repositories-troubleshooting.md +27 -1
  19. package/docs/markdown/repositories-variables.md +6 -1
  20. package/docs/markdown/repositories.md +18 -8
  21. package/package.json +48 -107
  22. package/recipes/core/sous-skills/skills/about-liquid-templates/SKILL.tpl.md +4 -6
  23. package/recipes/core/sous-skills/skills/about-liquid-templates/references/liquid-filters.tpl.md +2 -0
  24. package/recipes/core/sous-skills/skills/about-sous/SKILL.tpl.md +10 -9
  25. package/recipes/core/sous-skills/skills/about-sous-configuration/SKILL.tpl.md +35 -14
  26. package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +51 -20
  27. package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
  28. package/sous.config.schema.json +351 -132
  29. package/bin/run.js +0 -51
  30. package/src/base-command.ts +0 -457
  31. package/src/commands/build.ts +0 -181
  32. package/src/commands/clear.ts +0 -79
  33. package/src/commands/compile.ts +0 -155
  34. package/src/commands/config/get.ts +0 -110
  35. package/src/commands/config/show.ts +0 -32
  36. package/src/commands/config/validate.ts +0 -53
  37. package/src/commands/help.ts +0 -46
  38. package/src/commands/init.ts +0 -289
  39. package/src/commands/launch.ts +0 -139
  40. package/src/commands/lock/rebuild.ts +0 -239
  41. package/src/commands/lock/show.ts +0 -115
  42. package/src/commands/namespace/list.ts +0 -138
  43. package/src/commands/namespace/show.ts +0 -130
  44. package/src/commands/prune.ts +0 -43
  45. package/src/commands/recipe/list.ts +0 -112
  46. package/src/commands/recipe/show.ts +0 -439
  47. package/src/commands/repo/add.ts +0 -145
  48. package/src/commands/repo/contribute.ts +0 -604
  49. package/src/commands/repo/gc.ts +0 -173
  50. package/src/commands/repo/init.ts +0 -136
  51. package/src/commands/repo/link.ts +0 -899
  52. package/src/commands/repo/list.ts +0 -236
  53. package/src/commands/repo/release.ts +0 -685
  54. package/src/commands/repo/remove.ts +0 -194
  55. package/src/commands/repo/search.ts +0 -243
  56. package/src/commands/repo/submit.ts +0 -341
  57. package/src/commands/repo/unlink.ts +0 -461
  58. package/src/commands/subscription/add.ts +0 -286
  59. package/src/commands/subscription/list.ts +0 -208
  60. package/src/commands/subscription/remove.ts +0 -182
  61. package/src/commands/subscription/update.ts +0 -216
  62. package/src/commands/update.ts +0 -178
  63. package/src/commands/vars/ask.ts +0 -417
  64. package/src/commands/vars/index.ts +0 -79
  65. package/src/commands/vars/list.ts +0 -67
  66. package/src/commands/vars/show.ts +0 -77
  67. package/src/config-command.ts +0 -30
  68. package/src/lib/build-preparation.ts +0 -128
  69. package/src/lib/build-service.ts +0 -580
  70. package/src/lib/config-discovery.ts +0 -378
  71. package/src/lib/config-inspect.ts +0 -145
  72. package/src/lib/config-kernel.mjs +0 -379
  73. package/src/lib/config-schema.ts +0 -401
  74. package/src/lib/env-file.ts +0 -328
  75. package/src/lib/env-local.ts +0 -212
  76. package/src/lib/errors.ts +0 -32
  77. package/src/lib/glob-pattern.ts +0 -24
  78. package/src/lib/include-resolver.ts +0 -523
  79. package/src/lib/interactive.ts +0 -165
  80. package/src/lib/markdown-compiler.ts +0 -947
  81. package/src/lib/package-info.ts +0 -25
  82. package/src/lib/pid-service.ts +0 -99
  83. package/src/lib/project-install.d.mts +0 -44
  84. package/src/lib/project-install.mjs +0 -234
  85. package/src/lib/project-scaffold/index.ts +0 -332
  86. package/src/lib/project-scaffold/templates.ts +0 -240
  87. package/src/lib/repos/catalog-display.ts +0 -215
  88. package/src/lib/repos/catalog-inputs.ts +0 -288
  89. package/src/lib/repos/catalog.ts +0 -842
  90. package/src/lib/repos/contribute.ts +0 -452
  91. package/src/lib/repos/core-recipe.ts +0 -105
  92. package/src/lib/repos/declarations.ts +0 -187
  93. package/src/lib/repos/defaults.ts +0 -175
  94. package/src/lib/repos/formats/common.ts +0 -440
  95. package/src/lib/repos/formats/index-file.ts +0 -253
  96. package/src/lib/repos/formats/links-map.ts +0 -98
  97. package/src/lib/repos/formats/lockfile.ts +0 -169
  98. package/src/lib/repos/formats/patterns.ts +0 -57
  99. package/src/lib/repos/formats/recipe-manifest.ts +0 -205
  100. package/src/lib/repos/formats/repo-manifest.ts +0 -97
  101. package/src/lib/repos/formats/store-entry.ts +0 -84
  102. package/src/lib/repos/formats/variable-definition.ts +0 -268
  103. package/src/lib/repos/freshness.ts +0 -264
  104. package/src/lib/repos/git-clone.ts +0 -850
  105. package/src/lib/repos/identity.ts +0 -89
  106. package/src/lib/repos/index.ts +0 -57
  107. package/src/lib/repos/links.ts +0 -356
  108. package/src/lib/repos/load-manifest.ts +0 -237
  109. package/src/lib/repos/lock-service.ts +0 -454
  110. package/src/lib/repos/locked-namespace-resolver.ts +0 -232
  111. package/src/lib/repos/locked-recipe-lookup.ts +0 -123
  112. package/src/lib/repos/locked-recipes.ts +0 -254
  113. package/src/lib/repos/managed-layer.ts +0 -422
  114. package/src/lib/repos/memories-hash-name.ts +0 -33
  115. package/src/lib/repos/namespace-resolver.ts +0 -527
  116. package/src/lib/repos/providers/base.ts +0 -268
  117. package/src/lib/repos/providers/git.ts +0 -245
  118. package/src/lib/repos/providers/github.ts +0 -589
  119. package/src/lib/repos/providers/gitlab.ts +0 -332
  120. package/src/lib/repos/providers/http.ts +0 -128
  121. package/src/lib/repos/providers/index-cache.ts +0 -421
  122. package/src/lib/repos/providers/index.ts +0 -106
  123. package/src/lib/repos/providers/local.ts +0 -410
  124. package/src/lib/repos/providers/provider.ts +0 -615
  125. package/src/lib/repos/recipe-config-layers.ts +0 -316
  126. package/src/lib/repos/recipe-key-matcher.ts +0 -62
  127. package/src/lib/repos/recipe-memories.ts +0 -178
  128. package/src/lib/repos/recipe-targets.ts +0 -236
  129. package/src/lib/repos/ref-search.ts +0 -46
  130. package/src/lib/repos/release/bump.ts +0 -161
  131. package/src/lib/repos/release/changelog.ts +0 -461
  132. package/src/lib/repos/release/git-state.ts +0 -460
  133. package/src/lib/repos/release/index-builder.ts +0 -1108
  134. package/src/lib/repos/release/index.ts +0 -19
  135. package/src/lib/repos/release/plan.ts +0 -521
  136. package/src/lib/repos/release/settle.ts +0 -154
  137. package/src/lib/repos/release/submissions.ts +0 -214
  138. package/src/lib/repos/release/submit-checkout.ts +0 -290
  139. package/src/lib/repos/release/submit-questions.ts +0 -153
  140. package/src/lib/repos/release/submit-service.ts +0 -898
  141. package/src/lib/repos/release/tags.ts +0 -239
  142. package/src/lib/repos/release/validate.ts +0 -463
  143. package/src/lib/repos/resolver.ts +0 -1028
  144. package/src/lib/repos/scaffold/index.ts +0 -245
  145. package/src/lib/repos/scaffold/templates.ts +0 -517
  146. package/src/lib/repos/seed.ts +0 -473
  147. package/src/lib/repos/store/contract.ts +0 -64
  148. package/src/lib/repos/store/hash.ts +0 -191
  149. package/src/lib/repos/store/recipe-store.ts +0 -599
  150. package/src/lib/repos/store/settings.ts +0 -58
  151. package/src/lib/repos/subscription-service.ts +0 -3859
  152. package/src/lib/repos/trust.ts +0 -447
  153. package/src/lib/repos/update-plan.ts +0 -235
  154. package/src/lib/self-update/index.ts +0 -14
  155. package/src/lib/self-update/installs.ts +0 -413
  156. package/src/lib/self-update/managers.ts +0 -126
  157. package/src/lib/self-update/plan.ts +0 -315
  158. package/src/lib/self-update/registry.ts +0 -99
  159. package/src/lib/self-update/run.ts +0 -506
  160. package/src/lib/self-update/versions.ts +0 -243
  161. package/src/lib/settings.ts +0 -1107
  162. package/src/lib/sous-home.ts +0 -104
  163. package/src/lib/state.ts +0 -167
  164. package/src/lib/vars/answers.ts +0 -192
  165. package/src/lib/vars/ask.ts +0 -1152
  166. package/src/lib/vars/definition-source.ts +0 -261
  167. package/src/lib/vars/display.ts +0 -231
  168. package/src/lib/vars/index.ts +0 -20
  169. package/src/lib/vars/ladder.ts +0 -282
  170. package/src/lib/vars/mappings.ts +0 -260
  171. package/src/lib/vars/names.ts +0 -94
  172. package/src/lib/vars/preanswers.ts +0 -395
  173. package/src/lib/vars/question-plan.ts +0 -241
  174. package/src/lib/vars/report.ts +0 -228
  175. package/src/lib/vars/safe-regex.ts +0 -235
  176. package/src/lib/vars/secrets.ts +0 -131
  177. package/src/lib/vars/validate.ts +0 -312
  178. package/src/lib/version-report.ts +0 -90
  179. package/src/lib/watch-loop.ts +0 -148
  180. package/src/lib/watch-service.ts +0 -116
  181. package/src/services/ref-resolver/container.ts +0 -107
  182. package/src/services/ref-resolver/dependency.ts +0 -60
  183. package/src/services/ref-resolver/format.ts +0 -197
  184. package/src/services/ref-resolver/glob.ts +0 -115
  185. package/src/services/ref-resolver/hash-names.ts +0 -155
  186. package/src/services/ref-resolver/index.ts +0 -55
  187. package/src/services/ref-resolver/injectable.ts +0 -36
  188. package/src/services/ref-resolver/location.ts +0 -62
  189. package/src/services/ref-resolver/lookups/cached-index-lookup.ts +0 -53
  190. package/src/services/ref-resolver/lookups/catalog-lookup.ts +0 -23
  191. package/src/services/ref-resolver/lookups/catalog-matcher.ts +0 -261
  192. package/src/services/ref-resolver/lookups/chained-lookup.ts +0 -27
  193. package/src/services/ref-resolver/lookups/env-var-lookup.ts +0 -65
  194. package/src/services/ref-resolver/lookups/fetched-index-lookup.ts +0 -150
  195. package/src/services/ref-resolver/lookups/recorded-dependency-lookup.ts +0 -62
  196. package/src/services/ref-resolver/lookups/ref-lookup.ts +0 -54
  197. package/src/services/ref-resolver/lookups/variable-lookup.ts +0 -123
  198. package/src/services/ref-resolver/named-refs.ts +0 -144
  199. package/src/services/ref-resolver/parser/env-var-splitter.ts +0 -27
  200. package/src/services/ref-resolver/parser/location-splitter.ts +0 -239
  201. package/src/services/ref-resolver/parser/name-path-splitter.ts +0 -200
  202. package/src/services/ref-resolver/parser/partial-ref.ts +0 -84
  203. package/src/services/ref-resolver/parser/query-splitter.ts +0 -61
  204. package/src/services/ref-resolver/parser/range-splitter.ts +0 -52
  205. package/src/services/ref-resolver/parser/ref-parser.ts +0 -115
  206. package/src/services/ref-resolver/parser/repo-qualifier-splitter.ts +0 -51
  207. package/src/services/ref-resolver/parts.ts +0 -115
  208. package/src/services/ref-resolver/pruners/command-line-pruner.ts +0 -47
  209. package/src/services/ref-resolver/pruners/include-pruner.ts +0 -66
  210. package/src/services/ref-resolver/pruners/manifest-pruner.ts +0 -130
  211. package/src/services/ref-resolver/pruners/ref-pruner.ts +0 -135
  212. package/src/services/ref-resolver/pruners/rule-helpers.ts +0 -44
  213. package/src/services/ref-resolver/pruners/stored-key-pruner.ts +0 -136
  214. package/src/services/ref-resolver/ref-helpers.ts +0 -62
  215. package/src/services/ref-resolver/ref-picker-service.ts +0 -204
  216. package/src/services/ref-resolver/ref-report.ts +0 -84
  217. package/src/services/ref-resolver/ref-resolve-arguments.ts +0 -47
  218. package/src/services/ref-resolver/ref-resolve-result.ts +0 -36
  219. package/src/services/ref-resolver/ref-resolver-service.ts +0 -323
  220. package/src/services/ref-resolver/source.ts +0 -48
  221. package/src/services/ref-resolver/tokens.ts +0 -25
  222. package/src/services/ref-resolver/types.ts +0 -155
  223. package/src/templating/filters/bullet-list.ts +0 -9
  224. package/src/templating/filters/index.ts +0 -8
  225. package/src/templating/init-liquid-engine.ts +0 -139
  226. package/src/templating/lib/glob-files.ts +0 -74
  227. package/src/templating/lib/import-export.ts +0 -32
  228. package/src/templating/lib/secret-scope.ts +0 -41
  229. package/src/templating/lib/tag-args.ts +0 -19
  230. package/src/templating/tags/exportScalarVarsJs.ts +0 -46
  231. package/src/templating/tags/getFiles.ts +0 -89
  232. package/src/templating/tags/index.ts +0 -14
  233. package/src/templating/tags/listFiles.ts +0 -54
  234. package/src/templating/tags/showVars.ts +0 -28
  235. package/src/utils/choice-prompt.ts +0 -143
  236. package/src/utils/command-errors.ts +0 -186
  237. package/src/utils/command-help.ts +0 -45
  238. package/src/utils/confirm-prompt.ts +0 -110
  239. package/src/utils/flags.ts +0 -177
  240. package/src/utils/formatting.ts +0 -849
  241. package/src/utils/prompts.ts +0 -53
  242. package/src/utils/sous-directory.ts +0 -245
  243. package/src/utils/table.ts +0 -603
  244. package/src/utils/value-prompt.ts +0 -119
package/README.md CHANGED
@@ -1,273 +1,31 @@
1
- <p align="center">
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
- # sous
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
- sous compiles AI coding agent configuration from templates. You write skills, memories, and
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
- sous update --dry-run # show what would be installed where, and install nothing
8
+ npm install -g @sous-io/sous
9
+ sous --help
53
10
  ```
54
11
 
55
- Or run it from a clone (useful when developing sous itself):
12
+ Or add it to one project:
56
13
 
57
14
  ```bash
58
- git clone git@github.com:sous-io/sous.git
59
- cd sous
60
- npm install
61
- npm link
15
+ npm install --save-dev @sous-io/sous
16
+ npx sous --help
62
17
  ```
63
18
 
64
- Then set up a project:
19
+ Requires Node.js 22 or later.
65
20
 
66
- ```bash
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
- The config it writes compiles one file:
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
- ```js
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
- `${sousDir}` is the `.sous/` directory sous found, so a config can name paths relative to
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 build
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");