@sassywares/skills 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CONCEPTS.md +32 -15
  2. package/README.md +43 -36
  3. package/package.json +1 -1
  4. package/skills/sassy-overview/SKILL.md +2 -2
  5. package/skills/sassy-overview/references/identify.md +1 -1
  6. package/skills/sassy-setup/SKILL.md +12 -7
  7. package/skills/sassy-setup/assets/templates/worktrees-create +52 -0
  8. package/skills/sassy-setup/assets/templates/worktrees-remove +51 -0
  9. package/skills/sassy-setup/assets/worktree/_lib.sh +22 -55
  10. package/skills/sassy-setup/assets/worktree/create +21 -28
  11. package/skills/sassy-setup/assets/worktree/list +52 -11
  12. package/skills/sassy-setup/assets/worktree/remove +10 -83
  13. package/skills/sassy-setup/references/branching.md +2 -2
  14. package/skills/sassy-setup/references/check.md +46 -2
  15. package/skills/sassy-setup/references/config.md +70 -100
  16. package/skills/sassy-setup/references/dogfood.md +3 -3
  17. package/skills/sassy-setup/references/init.md +18 -16
  18. package/skills/sassy-setup/references/scaffold-header.md +63 -0
  19. package/skills/sassy-setup/references/worktree.md +135 -86
  20. package/skills/sassy-setup/scripts/detect.sh +708 -250
  21. package/skills/sassy-setup/scripts/worktree-check.mjs +32 -1
  22. package/skills/sassy-worktree/SKILL.md +9 -12
  23. package/skills/sassy-worktree/references/create.md +10 -3
  24. package/skills/sassy-worktree/references/list.md +4 -2
  25. package/skills/sassy-worktree/references/remove.md +30 -6
  26. package/skills/sassy-setup/assets/lifecycle/down +0 -29
  27. package/skills/sassy-setup/assets/lifecycle/up +0 -34
  28. package/skills/sassy-setup/assets/worktree/prune +0 -93
  29. package/skills/sassy-worktree/references/prune.md +0 -13
package/CONCEPTS.md CHANGED
@@ -4,10 +4,18 @@
4
4
 
5
5
  The repo's `skills/` directory is the only copy of the skills. Consumers install from it with `npx skills add sassywares/sassy-skills` — per project, which vendors the files and pins content hashes in `skills-lock.json`, or globally with `-g`, into `~/.agents/skills/`. See README.md's Installation section.
6
6
 
7
+ ## Consumer project
8
+
9
+ A project that installs the suite per project, so it vendors its own copy in `.agents/skills/` and pins it in `skills-lock.json`. It does not get the maintainer's `~/.agents/skills` link, so a push to this repo reaches it only through the `sassy-skills-sync` hook, which mirrors exactly the suite's roster, repins those skills, commits, and pushes to the branch recorded in `.sassywares/consumers`. Its setup is never auto-updated: the sync reports that it is out of date, and which project.
10
+
7
11
  ## Skill
8
12
 
9
13
  A directory containing `SKILL.md`, discovered by a harness from a project skills directory, a user skills directory, or an installed package. Skills are explicit workflows, not always-on instructions. The model may invoke any of them, and the user can invoke one directly through their harness (the `sassy-setup` skill's `references/harness.md` lists each harness's command).
10
14
 
15
+ ## Write boundary
16
+
17
+ The exact set of paths a skill's run may create or edit, and so the exact set its commit step may stage — stated as a hard rule in the skill's `SKILL.md` and repeated as its commit file list. It names every surface the skill owns by name, which is why deleting a config key has to reach it: a body still naming a removed file is a boundary that commits or reports something no longer real.
18
+
11
19
  ## Agent
12
20
 
13
21
  A specialized subagent from [sassy-agents](https://github.com/sassywares/sassy-agents), installed per harness (`~/.pi/agent/agents/`, `~/.claude/agents/`, or a project `.pi/agents/` / `.claude/agents/`) by `sassy-setup`. Skills delegate bounded work to agents such as `scout`, `worker`, `reviewer`, `simplifier`, and `validator`.
@@ -70,22 +78,31 @@ owns the workflow; the scripts in `.sassywares/worktree/` own the git.
70
78
  names the directory the checkout lives in, and the handle `list --path` and
71
79
  `remove` take — `remove` also accepts the branch.
72
80
  - **Namespace** — the slug prefixed with the repo (`shop-feat-catalog`), and the
73
- only name a hook should use for a database, a compose project, or a simulator.
74
- Derived once by `create`; never rebuilt by hand.
75
- - **Lifecycle** — the project's own pair of top-level config keys, `up:` and
76
- `down:`, each a script or a skill and its args. The suite supplies the shape
77
- and the `WT_*` environment, never the commands: `up` starts the stack in a
78
- checkout and `down` stops it, and `remove` runs `down` before deleting. Absent
79
- means no lifecycle, and nothing is invented. Addressing a checkout — a URL, a
80
- simulator, a window — is the project's business too; two checkouts running the
81
- same app collide unless the project's own `up:` keeps them apart.
81
+ only name a project script should use for a database, a compose project, or a
82
+ simulator. Derived once by `create`; never rebuilt by hand.
83
+ - **Identity block** — the four `WT_*` lines `create` mints and `list --env` hands
84
+ back: `WT_PATH`, `WT_BRANCH`, `WT_SLUG`, `WT_NAMESPACE`. The stream rule and the
85
+ unprepared case are the `sassy-setup` skill's `references/worktree.md`'s.
86
+ - **Project scripts** — the pair `<home>/worktrees/create` and
87
+ `<home>/worktrees/remove`, named by `worktrees.create` and `worktrees.remove`.
88
+ They are the lifecycle; the `sassy-setup` skill's `references/worktree.md` owns
89
+ their order, slots, and degrade rule, and `.sassywares/worktree/` ships only the
90
+ git mechanics. Addressing a checkout — a URL, a simulator, a window — is the
91
+ project's business too, and lives in those scripts.
92
+ - **Scaffold header** — the first line of a project-owned file setup plants,
93
+ `# sassywares:scaffold v1 skill=<name> version=<version> date=<YYYY-MM-DD>`.
94
+ The `sassy-setup` skill's `references/scaffold-header.md` owns its bytes and the
95
+ offer-only upgrade rule.
82
96
  - **Managed checkout** — one under `worktrees.dir` that also carries
83
- `.sassywares/config.yaml`. The tooling lists, prunes, and removes only those;
84
- anything else belongs to another tool or predates the wiring.
97
+ `.sassywares/config.yaml`. The tooling lists and removes only those; anything
98
+ else belongs to another tool or predates the wiring.
99
+ - **State** — each managed checkout's `merged`, `gone`, or `unmerged`
100
+ classification, from the branch's upstream. The `sassy-setup` skill's
101
+ `references/worktree.md` owns the definitions; `list` is where it prints.
85
102
 
86
- `create` and `remove` need an agent because their hooks — and a `down:` that names
87
- a skill — are project skills, and a script cannot dispatch one. So the
88
- orchestration is a skill and the git is a script.
103
+ `create` and `remove` need an agent because the run has to ask permission before
104
+ taking a checkout, report each refusal verbatim, and confirm a set before removing
105
+ several. The orchestration is the skill's; the git is the toolbox's.
89
106
 
90
107
  ## Overview
91
108
 
@@ -105,7 +122,7 @@ owns it; its `identify.sh` is the query.
105
122
 
106
123
  ## Modes
107
124
 
108
- Three shared mode tokens: `mode:manual` (default) asks at the skill's gate; `mode:auto` means pre-authorized, no review; `mode:return` reports and changes nothing. Some skills take their own modes instead: `sassy-goal`, `sassy-handoff` (`write`, `read`), `sassy-setup` (`init`, `check`), `sassy-overview` (`identify`), and `sassy-skill` (`create`, `retune`, `verify`).
125
+ Three shared mode tokens: `mode:manual` (default) asks at the skill's gate; `mode:auto` means pre-authorized, no review; `mode:return` reports and changes nothing. Some skills take their own modes instead: `sassy-goal`, `sassy-handoff` (`write`, `read`), `sassy-setup` (`init`, `check`), `sassy-overview` (`identify`), `sassy-worktree` (`list`, `create`, `remove`), and `sassy-skill` (`create`, `retune`, `verify`).
109
126
 
110
127
  - `sassy-ship` and `sassy-compound` accept `manual` and `auto`. Ship reviews the whole close-out in `mode:manual` and forwards `mode:auto` to compound once its own gate is answered.
111
128
  - `sassy-review`, `sassy-simplify`, and `sassy-validate` accept all three: `manual` asks which findings to fix, `auto` fixes them without asking, `return` hands the findings back to the caller.
package/README.md CHANGED
@@ -92,7 +92,7 @@ Debugging:
92
92
  | **`sassy-overview`** | Answers what a project is and how it runs — stack, runner, install, up, down, test, compose, env, wired — by inspecting files, read-only and with the source file for every value. `unknown` when the project hasn't said, and exit `3` so a caller branches instead of guessing. |
93
93
  | **`sassy-work`** | Executes exactly one plan phase, or one in-context brief, commits after code approval, then stops — the next phase is a run you start. A brief stops before ship. |
94
94
  | **`sassy-lfg`** | Executes every phase of a plan, or one in-context brief, then closes out via `sassy-ship` after code approval. |
95
- | **`sassy-worktree`** | One checkout per branch, each with its own derived namespace, so two agents can work in one repo — taken when you ask, never because the config allows it. `create`, `list`, `remove`, `prune`: cut a checkout, see what exists, delete one, or clear the leftovers. |
95
+ | **`sassy-worktree`** | One checkout per branch, each with its own derived namespace, so two agents can work in one repo — taken when you ask, never because the config allows it. `create`, `list`, `remove`: cut a checkout, see what exists and what is safe to delete, or delete one. |
96
96
  | **`sassy-cycle`** | Runs one unit of work through a tiered loop: implement → simplify + review + validate for `logic`, review for `surface`, nothing for mechanical → one fix pass. No verify. Also reworks finished work from failed QA rows and picked findings. |
97
97
  | **`sassy-debug`** | Diagnoses a bug, gates the fix, fixes via `sassy-work` (cycle, code approval, commit), then ships. Debug takes no mode and always leaves ship's review gate in place unless you invoke ship yourself with `mode:auto`. |
98
98
  | **`sassy-handoff`** | `mode:write` (default) writes a self-contained handoff file to `/tmp/sassywares/handoffs/` and gives you a `sassy-handoff mode:read <path>` command for a fresh session; `mode:read` explains what the handoff did, why, and where things stand now, then asks what to do next. Works in any harness. |
@@ -131,7 +131,7 @@ Each does one job and takes `mode:manual` (default: ask which to fix), `mode:aut
131
131
  | Skill | What it does |
132
132
  |---|---|
133
133
  | **`sassy-skill`** | Creates, retunes, or restructures Agent Skills. |
134
- | **`sassy-setup`** | Detects the project topology and writes `.sassywares/config.yaml`; installs the suite and the sassy-agents subagents, globally or per project, when missing; installs the snapshot tooling for a multi-repo workspace; commits the files it wrote. `mode:check` verifies an existing setup, including a project install's pin. |
134
+ | **`sassy-setup`** | Detects the project topology and writes `.sassywares/config.yaml`; installs the suite and the sassy-agents subagents, globally or per project, when missing; installs the snapshot tooling for a multi-repo workspace; commits the files it wrote. `mode:check` verifies an existing setup, including a project install's pin, and reports a config that has fallen behind the shipped template with the `--sync --write` merge that closes it. |
135
135
 
136
136
  ## Project config
137
137
 
@@ -177,16 +177,11 @@ hooks:
177
177
  push: # only under commit.branch: current
178
178
  "*":
179
179
  after_push: [] # right after the push succeeds
180
- # worktree: # worktrees only; keyed by the checkout's branch
181
- # "*":
182
- # after_create: [] # derive .env, seed, copy the session in
183
- # before_remove: [] # drop the database, shut the device
184
180
  worktrees: # parallel checkouts of this repo
185
181
  enabled: false # true = a run may offer its own checkout
186
182
  dir: ~/.sassywares/worktrees # parent of the per-repo folder
187
- # up:/down: are top level — not under worktrees: — each `<script> <args…>` or `<skill> <args…>`
188
- # up: ./bin/up
189
- # down: ./bin/down # absent = no lifecycle
183
+ create: scripts/worktrees/create # this project's prepare step; absent = built-in
184
+ remove: scripts/worktrees/remove # this project's teardown; absent = built-in
190
185
  dogfood: # agent QA: a stored procedure that proves a change runs
191
186
  enabled: false # true lets a plan write Mode: Auto QA rows
192
187
  recipe: .sassywares/dogfood/recipe.md # the procedure; never commands here
@@ -205,7 +200,7 @@ directory, a namespace, a database. `worktrees:` turns that on:
205
200
  └── feat-catalog-search/
206
201
  ```
207
202
 
208
- Only checkouts this tooling manages are listed or pruned: one under `worktrees.dir`
203
+ Only checkouts this tooling manages are listed or removed: one under `worktrees.dir`
209
204
  that also carries `.sassywares/config.yaml`. Anything else — another tool's
210
205
  worktree, or one cut from a ref that predates the wiring — is counted in a footer
211
206
  and left alone.
@@ -215,16 +210,25 @@ takes one and otherwise works in the main checkout, because two runs only collid
215
210
  when they are actually parallel. `sassy-worktree create` takes one whenever you
216
211
  ask for it, and a run carrying `worktree:on` has already been told yes.
217
212
 
218
- Setup installs the tooling as four scripts in `.sassywares/worktree/` — `create`,
219
- `list`, `remove`, `prune` — run by path, `.sassywares/worktree/create
220
- feat/catalog`. No command runner is required: if the project already has one that
221
- carries named commands, setup offers to wire `worktree:<script>` aliases into it,
222
- and never creates a manifest to hold them, so a Go, Python, or Dart project keeps
223
- its own tooling file and nothing else.
213
+ Setup installs the git mechanics as three scripts plus a shared helper in
214
+ `.sassywares/worktree/` — `create`, `list`, `remove`, and `_lib.sh` — run by path,
215
+ `.sassywares/worktree/create feat/catalog`. It also scaffolds this project's own
216
+ pair at `<home>/worktrees/create` and `remove`, recording them as
217
+ `worktrees.create` and `worktrees.remove`. `<home>` is probed: the first existing
218
+ of `scripts/`, `bin/`, `tool/`, `tools/`, else `tool/` for a Dart/Flutter stack
219
+ and `scripts/` otherwise. `sassy-worktree` runs the project's pair; those call
220
+ the toolbox when they need git. An absent pair falls back to the built-in
221
+ silently; a declared file that is gone or not executable warns, naming the key
222
+ and the file, then falls back — never a silent success when a key declares one.
223
+ No command runner is required: if the project already has one that carries named
224
+ commands, setup offers to wire `worktree:<script>` aliases into it, and never
225
+ creates a manifest to hold them, so a Go, Python, or Dart project keeps its own
226
+ tooling file and nothing else.
224
227
 
225
228
  `create` derives the identity from the branch and prints it — `WT_PATH`,
226
- `WT_BRANCH`, `WT_SLUG`, `WT_NAMESPACE` — so a project's hook derives `.env`, a
227
- database name, or a simulator from one source instead of inventing its own.
229
+ `WT_BRANCH`, `WT_SLUG`, `WT_NAMESPACE` — so the project's create script derives
230
+ `.env`, a database name, or a simulator from one source instead of inventing its
231
+ own. `list --env <slug|branch>` hands the same four lines back for scripting.
228
232
 
229
233
  A checkout's branch is cut **untracked**, and `create` prints the upstream it
230
234
  found — `none` on a fresh branch, and a plain-English warning when an existing
@@ -233,27 +237,32 @@ DWIM would have made `staging` that branch's upstream, so the branch's own `git
233
237
  push` would aim at the base: a run that looks healthy until it ships.
234
238
 
235
239
  **A checkout's address and its stack are the project's own business.** The suite
236
- derives no address and runs no app: how a checkout is looked at, and what command
237
- brings it up, are the top-level `up:` and `down:` keys — each one line, a script
238
- or a skill and its args. Two checkouts running the same app collide on the same
239
- fixed port unless the project's `up:` keeps them apart, so a project that needs a
240
- per-checkout value derives it there from `$WT_SLUG`. Nothing here claims or tracks
241
- one, and a collision surfaces in the project's own command.
240
+ derives no address and runs no app: how a checkout is looked at, and what brings
241
+ it up or tears it down, live in the project's `create` and `remove` scripts, whose
242
+ scaffold slots name where a project writes them. Two checkouts running the same
243
+ app collide on the same fixed port unless the project's script keeps them apart,
244
+ so a script that needs a per-checkout value derives it from `$WT_NAMESPACE` or
245
+ `$WT_SLUG`. Nothing here claims or tracks one, and a collision surfaces in the
246
+ project's own command.
247
+
248
+ A project's `remove` runs four steps in order: **identity** (`list --env`), **stop**
249
+ while the checkout still exists, **delete** through the toolbox, then **dispose**
250
+ after the tree is gone while `$WT_NAMESPACE` is still set.
242
251
 
243
252
  It needs `commit.branch: new`: under `current` a run commits where it stands and
244
253
  never cuts a branch, so nothing would create a checkout. `--check` says so rather
245
254
  than leaving a switch that cannot fire.
246
255
 
247
- `up:` runs in the foreground and is stopped with SIGTERM, so it must reap its
248
- children; `down:` terminates what `up:` started and exits. `remove` runs `down:`
249
- when the project declares one, then deletes the checkout. A worktree gets a fresh,
250
- empty `.sassywares/session/`, and most providers register one callback URL, so the
251
- usual answer is to copy or link the main checkout's session in the `after_create`
252
- hook: a cookie is host-scoped, while a `localStorage` session is origin-scoped and
253
- has to be injected per origin.
256
+ A worktree gets a fresh, empty `.sassywares/session/`, and most providers register
257
+ one callback URL, so the usual answer is to copy or link the main checkout's
258
+ session in the create script's after-the-checkout slot: a cookie is host-scoped,
259
+ while a `localStorage` session is origin-scoped and has to be injected per origin.
254
260
 
255
- Nothing here keeps state: `list` reports branch, path, dirty, and upstream, and
256
- `remove` refuses a dirty tree, unpushed commits, or the main checkout.
261
+ Nothing here keeps state: `list` reports branch, path, dirty, upstream, and a
262
+ state of `merged`, `gone`, or `unmerged`. `remove` refuses a dirty tree, unpushed
263
+ commits, or the main checkout, deletes the checkout, and leaves the branch so the
264
+ work stays reachable. There is no bulk sweep: removing several is `list`, one
265
+ confirmation, then one `remove <slug>` per checkout, sequentially.
257
266
 
258
267
  ### Extending the pipeline
259
268
 
@@ -266,8 +275,6 @@ A project adds its own steps by naming a skill that lives in its own `.agents/sk
266
275
  | `before_merge` | this run is about to merge | a final approval gate |
267
276
  | `after_merge` | this run observed the merge | sync a back-merge branch, tag, notify |
268
277
  | `hooks.push` `after_push` | `commit.branch: current` only: after ship's push | notify, trigger a follow-up step |
269
- | `hooks.worktree` `after_create` | just after a checkout exists | derive `.env`, seed the database, copy the session in |
270
- | `hooks.worktree` `before_remove` | before the checkout is deleted | drop the derived database, shut the simulator |
271
278
  | `hooks.goal` `before_slice` | `sassy-goal mode:next`: after the previous slice's merge is confirmed, before the slice is grilled | switch to the bases, pull, migrate, seed |
272
279
  | `hooks.goal` `after_close` | `sassy-goal mode:close`: after the goal's status is persisted | post the goal summary, notify, tear down per-slice environments |
273
280
 
@@ -492,4 +499,4 @@ pi install npm:@sassywares/skills
492
499
 
493
500
  ## Repository maintenance
494
501
 
495
- Work here lands on `main` through `sassy-ship` (`commit.branch: current`). After the approved push, the project's `hooks.push` `after_push` step runs the release: on `main`, when files consumers receive changed, it bumps the patch version and tags it, and the tag publishes `@sassywares/skills` to npm. [`AGENTS.md`](AGENTS.md) is the full guide: layout, adding a skill, testing, and releasing.
502
+ Work here lands on `main` through `sassy-ship` (`commit.branch: current`). After the approved push, the project's `hooks.push` `after_push` steps run in order: the release, which on `main`, when files consumers receive changed, bumps the patch version and tags it, and the tag publishes `@sassywares/skills` to npm; a self-check that syncs this repo's own config template; and a consumer sync that refreshes the projects listed in `.sassywares/consumers` — projects that vendor the suite themselves, committing and pushing to each one's recorded branch (the engine is `.agents/skills/sassy-skills-sync/scripts/sync`, with `scripts/lock.mjs` repinning the vendored skills). A consumer's setup is never rewritten: an out-of-date one is reported and nothing else. [`AGENTS.md`](AGENTS.md) is the full guide: layout, adding a skill, testing, and releasing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassywares/skills",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Lean, explicit-invocation Agent Skills for shipping fast: plan, work, review, validate, ship.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,5 +48,5 @@ argument-hint: "[mode:identify] [key...]"
48
48
 
49
49
  Any skill that needs project facts names it and runs the script; nothing copies its table.
50
50
 
51
- - `sassy-setup` is the intended consumer: it probes with this script before offering a project's `up:`/`down:` keys, so a project that already declares a command is pointed at it instead of being handed a stub. Once `.sassywares/config.yaml` names `up`/`down`, the config is the authority for those two facts and the worktree mechanics read it; this script keeps reporting what a manifest declares, never the suite's config.
52
- - Nobody else reads it yet. `sassy-worktree` must not: its `up`/`down` pointers already carry the stack, so an overview there would re-create the seam this replaced.
51
+ - `sassy-setup` is the intended consumer: it probes with this script before scaffolding a project's `worktrees.create`/`worktrees.remove` pair, so a project that already declares how it starts and stops is pointed at its own command instead of being handed a stub. This script keeps reporting what a manifest declares, never the suite's config.
52
+ - Nobody else reads it yet. `sassy-worktree` must not: the project's create and remove scripts already carry whatever a checkout needs, so an overview there would re-create the seam this replaced.
@@ -46,7 +46,7 @@ Everything is file inspection: no network, no executing the project's tooling (n
46
46
  | `env` | the env file in use | no env file |
47
47
  | `wired` | the suite is set up here | never — the answer is `yes` or `no` |
48
48
 
49
- `up` and `down` are the only keys a project might reasonably have and not declare, and this script reads only what a file declares: a `Makefile`/`justfile` target or a compose file. A project that states them in `.sassywares/config.yaml` (`up:`/`down:`, which `sassy-setup` initializes and the worktree mechanics read) is answering through the config — this script still reports `unknown` for them, because it never reads the suite's own config for a stack fact, and the config is the authority once it names one.
49
+ `up` and `down` are the only keys a project might reasonably have and not declare, and this script reads only what a file declares: a `Makefile`/`justfile` target or a compose file. A project that prepares and stops a checkout in its `worktrees.create`/`worktrees.remove` scripts is answering in code, not in a manifest — this script still reports `unknown` for them, because it never reads the suite's config or executes those scripts for a stack fact.
50
50
 
51
51
  `wired` is the one key that always has an answer: `yes` with the nearest `.sassywares/config.yaml` as its source, otherwise `no` with `-`. The search walks up from `--root` the same way `sassy-setup`'s `detect.sh` resolves a config, so a repo nested inside a folder that owns one is `wired: yes`; the source is then that config's absolute path, since it sits outside the root.
52
52
 
@@ -35,7 +35,12 @@ A check run never edits the config and never rewrites the tree. Its only possibl
35
35
 
36
36
  ## Steps 7–9 — shared by both modes
37
37
 
38
- 7. **Verify.** Run `scripts/detect.sh --root <path> --check`. It validates the config against the tree — topology and remotes, `base_map` shape and cycles, `repos` against each nested repo, hooks, artifacts paths, `knowledge`, `pr.*` booleans, `commit.branch`, the `worktrees` block, the top-level `up`/`down` pair (accepted there, and a stray nested `up.*`/`down.*` is an unknown key), the `dogfood` block, any unknown key, and in `workspace` mode the installed snapshot's version — plus, for a project-scope install, the pin: every suite-skill folder in `.agents/skills` (a name in the suite's roster, `assets/roster` in sassy-setup, not any `sassy-` prefix) hashed against `skills-lock.json`, the lock's coverage both ways, and whether git carries the lock. A user-scope install has no pin here; the check notes the scope it found. Report every `drift:` line verbatim, or that the config matches the tree. Drift blocks step 8.
38
+ 7. **Verify.** Run `scripts/detect.sh --root <path> --check`. It validates the config against the tree — topology and remotes, `base_map` shape and cycles, `repos` against each nested repo, hooks, artifacts paths, `knowledge`, `pr.*` booleans, `commit.branch`, the `worktrees` block, the removed legacy keys `up`, `down`, and `hooks.worktree` (a named error each), the `dogfood` block, any unknown key, and in `workspace` mode the installed snapshot's version — plus, for a project-scope install, the pin: every suite-skill folder in `.agents/skills` (a name in the suite's roster, `assets/roster` in sassy-setup, not any `sassy-` prefix) hashed against `skills-lock.json`, the lock's coverage both ways, and whether git carries the lock. A user-scope install has no pin here; the check notes the scope it found. Report every `drift:` line verbatim, or that the config matches the tree. A
39
+ passing check can still print a `template:` note: the config matches the tree
40
+ but is behind the shipped template — blocks, comment layers, or examples it
41
+ lacks. Report it as a note, not drift, and name `--sync --write` as its fix: it
42
+ merges the template onto the file and keeps every value the check accepts,
43
+ comment and all. Drift blocks step 8.
39
44
 
40
45
  The `worktrees` half checks what a run would read: the switch, that the tooling is installed with the shipped bytes, that no checkout sits inside the working tree, and that none holds a branch `base_map` names as a base.
41
46
 
@@ -45,7 +50,7 @@ A check run never edits the config and never rewrites the tree. Its only possibl
45
50
 
46
51
  8. **Commit what setup owns.** `repo` topology only, and only when step 7 is clean. The file list is exactly what setup wrote or found unwritten:
47
52
 
48
- `.sassywares/config.yaml`, `.sassywares/README.md`, `.sassywares/dogfood/recipe.md` and `.sassywares/.gitignore` when step 4 created them, the `up`/`down` stubs step 4 wrote (only those two named scripts — never their directory), `.sassywares/worktree/*` when step 6 installed the tooling, the runner file when the user accepted aliases in it, `.agents/skills/sassy-*` and `skills-lock.json` when the suite is in project scope, the project-scope agent files when step 5 copied them, and a root `.gitignore` when step 5 created one. Named files only — never `git add -A`, never `git add .`. The reports directory is never in this list: it is gitignored, and nothing setup writes lives there.
53
+ `.sassywares/config.yaml`, `.sassywares/README.md`, `.sassywares/dogfood/recipe.md` and `.sassywares/.gitignore` when step 4 created them, the two project scripts step 6 scaffolded at `<home>/worktrees/create` and `<home>/worktrees/remove` (only those two named files — never their directory), `.sassywares/worktree/*` when step 6 installed the tooling, the runner file when the user accepted aliases in it, `.agents/skills/sassy-*` and `skills-lock.json` when the suite is in project scope, the project-scope agent files when step 5 copied them, and a root `.gitignore` when step 5 created one. Named files only — never `git add -A`, never `git add .`. The reports directory is never in this list: it is gitignored, and nothing setup writes lives there.
49
54
 
50
55
  Dispatch `sassy-commit` with that list and `branch:current`. The token is explicit, not this skill's default: wiring is a one-time bootstrap commit, and cutting a branch would leave the project configured but uncommitted until someone ships it. Name the branch it landed on, base branch included.
51
56
 
@@ -54,7 +59,7 @@ A check run never edits the config and never rewrites the tree. Its only possibl
54
59
  - **`workspace`** — nothing to commit: the root is not a repo, and `references/workspace.md` forbids running the snapshot here. Say the root config and the pin land with the project's next snapshot.
55
60
  - **`none`** — nothing to commit, deliberately.
56
61
 
57
- 9. **Report.** The config path, the topology, the resolved artifact and knowledge paths, the lifecycle — the two values `up` and `down` name, or one line saying the project declares **no lifecycle** because the keys are absent, with no suggestion attached — whether agent QA is **off** — one line saying every QA row stays a human's, with no suggestion attached — or on, and then whether the recipe is ready or still a skeleton until `sassy-dogfood mode:discover` runs, where the skills are installed (scope) and where the agents are (scope and harness), or why either is not, the commit (hash and branch) or why there is none, and in `workspace` mode what was installed, with versions (`snapshot vN`, `workspace-git vN`), and where the `worktree:*` / `workspace:*` aliases went, or that none were wired because the project has no command-building file to put them in — naming the scripts' path instead, since that is how they are run either way. Remind: `/reload` so the harness rescans. Close with what is left over — at most dirt setup deliberately did not commit — and nothing else: a clean setup leaves the user good to go.
62
+ 9. **Report.** The config path, the topology, the resolved artifact and knowledge paths, the lifecycle — the two paths `worktrees.create` and `worktrees.remove` name, or one line saying the built-in is used because the keys are absent, with no suggestion attached — whether agent QA is **off** — one line saying every QA row stays a human's, with no suggestion attached — or on, and then whether the recipe is ready or still a skeleton until `sassy-dogfood mode:discover` runs, where the skills are installed (scope) and where the agents are (scope and harness), or why either is not, the commit (hash and branch) or why there is none, and in `workspace` mode what was installed, with versions (`snapshot vN`, `workspace-git vN`), and where the `worktree:*` / `workspace:*` aliases went, or that none were wired because the project has no command-building file to put them in — naming the scripts' path instead, since that is how they are run either way. Remind: `/reload` so the harness rescans. Close with what is left over — at most dirt setup deliberately did not commit — and nothing else: a clean setup leaves the user good to go.
58
63
 
59
64
  ## Hard rules — every mode
60
65
 
@@ -62,17 +67,17 @@ A check run never edits the config and never rewrites the tree. Its only possibl
62
67
  |------|-------------|
63
68
  | No `git init` | Setup never turns a folder into a repo, and never does remote or ref surgery. The step 8 commit is its only git write. |
64
69
  | Verify before commit | A config that fails `--check` is reported, never committed. |
65
- | Commit only what setup owns | The config, the setup README, the `up`/`down` stubs step 4 wrote, the vendored `sassy-*` folders and `skills-lock.json` (project scope), the project-scope agent files, and a `.gitignore` setup created. Never a file the user wrote or the repo already had, unless they name it. |
70
+ | Commit only what setup owns | The config, the setup README, the two project scripts step 6 scaffolded, the vendored `sassy-*` folders and `skills-lock.json` (project scope), the project-scope agent files, and a `.gitignore` setup created. Never a file the user wrote or the repo already had, unless they name it. |
66
71
  | No silent overwrite | An existing config or an existing `.sassywares/workspace/snapshot` is shown and asked about, never replaced blind. |
67
- | Write boundary | Only `.sassywares/` (the config, the setup README, the dogfood scaffold, and the worktree tooling), the two `up`/`down` stubs step 4 wrote at their probed path, the skills and agent files step 5 installed in the scope the user chose, `skills-lock.json` (project scope), `.sassywares/.gitignore` with its two lines, and at most one root `.gitignore` line that step 5 created. Never `package.json` outside step 6's `worktree:*` and `workspace:*` aliases, never a root `.gitignore` in a workspace. Workspace git helpers land in `.sassywares/workspace/`, never in a project's `bin/`. |
68
- | Install the tooling, never use it | Setup copies `.sassywares/worktree/` and offers the aliases. It never creates a checkout, never runs a script, and never starts or stops the project's stack — `up` is the project's or the user's, and `down` runs only from `remove`. |
72
+ | Write boundary | Only `.sassywares/` (the config, the setup README, the dogfood scaffold, and the worktree tooling), the two project scripts step 6 scaffolded at `<home>/worktrees/create` and `<home>/worktrees/remove` (new files only — never the whole `worktrees/` folder), the skills and agent files step 5 installed in the scope the user chose, `skills-lock.json` (project scope), `.sassywares/.gitignore` with its two lines, and at most one root `.gitignore` line that step 5 created. Never `package.json` outside step 6's `worktree:*` and `workspace:*` aliases, never a root `.gitignore` in a workspace. Workspace git helpers land in `.sassywares/workspace/`, never in a project's `bin/`. |
73
+ | Install the tooling, never use it | Setup copies `.sassywares/worktree/` and offers the aliases. It never creates a checkout, never runs a script, and never starts or stops the project's stack — that is the project's own `create`/`remove` script's job. |
69
74
  | Skills come from upstream | Install with `npx skills add`, `-g` for user scope; never hand-copy skill files or maintain the links yourself. |
70
75
  | Agents come from sassy-agents | Only the running harness's folder, as-is: linked by `install.sh` (user scope) or copied verbatim (project scope). Never edit, merge, or overwrite a differing agent file without asking. |
71
76
  | Never edit the manifest | No dependencies, no `postinstall`, no `skills:*` scripts. Step 6's `worktree:*` and `workspace:*` aliases may be added, and only into a file that already carries named commands: appended or corrected, never removed, nothing else in the file touched, and **never a manifest created to hold them**. A project with no such file gets no aliases and loses nothing — the scripts are run by path. Setup installs the suite; the user or project decides how it updates. |
72
77
  | Run output and sessions never ship | `.sassywares/.gitignore` holds `/session/` and `/dogfood/reports/`. Never remove a line, never add anything from either path to the commit, and never write a credential anywhere else. |
73
78
  | No secrets in setup's writes | Env var names only, in the config and in the skeleton. A credential never lands in a file setup commits. |
74
79
  | Version is reported | Setup names the snapshot and `workspace-git` versions it installed; `--check` flags an installed copy older than the skill's. |
75
- | Repair is `init` | `check` reports drift and never rewrites; closing it is `mode:init`, where every change is shown and approved first. |
80
+ | Repair is `init` | `check` reports drift and never rewrites; closing it is `mode:init`, where every change is shown and approved first. Template drift is the one stated exception: the check names `--sync --write`, and only the operator runs it. |
76
81
 
77
82
  ## What setup is not
78
83
 
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+ # sassywares:scaffold v1 skill=sassy-setup version=<version> date=<YYYY-MM-DD>
3
+ #
4
+ # worktrees/create — this project's own "prepare a checkout" step.
5
+ #
6
+ # Contract: called as `<home>/worktrees/create <branch> [--from <ref>]`, with the
7
+ # same arguments the toolbox takes. It must exit 0 and print the four WT_* lines
8
+ # on stdout — WT_PATH, WT_BRANCH, WT_SLUG, WT_NAMESPACE — with all narration on
9
+ # stderr. A run that exits 0 without them is reported as "checkout is real but
10
+ # unprepared".
11
+ #
12
+ # This file now belongs to the project. Setup wrote it once and never rewrites it:
13
+ # edit it freely. Nothing below the suite call runs until you add it.
14
+ set -euo pipefail
15
+
16
+ # The suite scripts resolve from the project root, whatever <home> is called.
17
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
18
+
19
+ # --help and --version belong to the toolbox, not to this wrapper: pass them
20
+ # through before the identity capture below would treat their output as one.
21
+ case "${1:-}" in
22
+ -h|--help|--version) exec "$ROOT/.sassywares/worktree/create" "$@" ;;
23
+ esac
24
+
25
+ # --- before the checkout exists (before git) --------------------------------
26
+ # Anything that has to exist before the checkout does goes here. Add only what
27
+ # this project really needs, then delete the examples you did not use. They are
28
+ # comments on purpose — setup writes no code here, because it cannot verify one.
29
+ #
30
+ # - claim a namespace or pre-create a resource the new checkout will attach to.
31
+ # - reserve a name or a slot from the project's own registry before git uses it.
32
+ # ---------------------------------------------------------------------------
33
+
34
+ # The toolbox cuts the checkout and prints the identity block. Capture it, echo it
35
+ # unchanged for the caller, then evaluate it so this script — and everything you
36
+ # add below — sees WT_PATH, WT_BRANCH, WT_SLUG, and WT_NAMESPACE.
37
+ block="$("$ROOT/.sassywares/worktree/create" "$@")"
38
+ printf '%s\n' "$block"
39
+ eval "$block"
40
+
41
+ # --- after the checkout exists (after git) ---------------------------------
42
+ # Everything a checkout needs beyond git goes here: the checkout exists and the
43
+ # WT_* names are set. Add only what this project really needs, then delete the
44
+ # examples you did not use. They are comments on purpose — setup writes no code
45
+ # here, because it cannot verify one.
46
+ #
47
+ # - install dependencies into $WT_PATH (the project's package manager).
48
+ # - derive a per-worktree .env from $WT_NAMESPACE, e.g.
49
+ # tool env --namespace "$WT_NAMESPACE" > "$WT_PATH/.env".
50
+ # - seed a database named from $WT_NAMESPACE, e.g. createdb "$WT_NAMESPACE".
51
+ # - create a preview deployment named from $WT_NAMESPACE.
52
+ # --------------------------------------------------------------------------
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+ # sassywares:scaffold v1 skill=sassy-setup version=<version> date=<YYYY-MM-DD>
3
+ #
4
+ # worktrees/remove — this project's own "tear a checkout down" step.
5
+ #
6
+ # Contract: called as `<home>/worktrees/remove <slug|branch> [--force]`, with the
7
+ # same arguments the toolbox takes. It must exit 0 once the checkout is gone.
8
+ #
9
+ # This file now belongs to the project. Setup wrote it once and never rewrites it:
10
+ # edit it freely. The two slots below are inert comments until you add to them.
11
+ set -euo pipefail
12
+
13
+ # The suite scripts resolve from the project root, whatever <home> is called.
14
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
15
+
16
+ # --help and --version belong to the toolbox, not to this wrapper: pass them
17
+ # through before the identity capture below would treat their output as one.
18
+ case "${1:-}" in
19
+ -h|--help|--version) exec "$ROOT/.sassywares/worktree/remove" "$@" ;;
20
+ esac
21
+
22
+ target="${1:-}"
23
+ [ -n "$target" ] || { printf 'Usage: %s <slug|branch> [--force]\n' "${BASH_SOURCE[0]}" >&2; exit 2; }
24
+
25
+ # The identity of the checkout this run is about to delete. Asking the toolbox —
26
+ # rather than rebuilding a slug here — means these are the names `create` minted.
27
+ # Capture only: nothing consumes remove's stdout, so this block is not echoed.
28
+ # Capture before evaluating, so a failed lookup aborts under set -e instead of
29
+ # deleting a tree with the variables unset.
30
+ block="$("$ROOT/.sassywares/worktree/list" --env "$target")"
31
+ eval "$block"
32
+
33
+ # --- stop, while the checkout still exists ---------------------------------
34
+ # Whatever the checkout is running has to stop before the tree goes: the folder is
35
+ # about to be deleted, and a process holding it is what makes a removal half-fail.
36
+ # Add only what this project starts per checkout.
37
+ #
38
+ # - stop the stack in $WT_PATH (e.g. a compose down run in "$WT_PATH").
39
+ # - shut the simulator or device named from $WT_NAMESPACE.
40
+ # ---------------------------------------------------------------------------
41
+
42
+ "$ROOT/.sassywares/worktree/remove" "$@"
43
+
44
+ # --- dispose, after the tree is gone ---------------------------------------
45
+ # The checkout is deleted, the branch survives, and WT_NAMESPACE is still set — the
46
+ # derived name is all that is needed to drop what was created for it.
47
+ #
48
+ # - drop the database derived from $WT_NAMESPACE, e.g. dropdb "$WT_NAMESPACE".
49
+ # - delete the preview deployment named from $WT_NAMESPACE.
50
+ # - shut the simulator started for $WT_NAMESPACE.
51
+ # ---------------------------------------------------------------------------
@@ -1,35 +1,29 @@
1
1
  #!/usr/bin/env bash
2
- # Shared helpers for the worktree scripts: create, list, remove, prune.
2
+ # Shared helpers for the worktree scripts: create, list, remove.
3
3
  #
4
4
  # Installed next to those scripts by sassy-setup. Suite-owned and read-only, so
5
5
  # every project runs the same mechanics. Three rules worth keeping:
6
6
  #
7
- # 1. Two config sources, each with exactly one owner. The worktree home and the
8
- # on/off switch live under `worktrees:` in .sassywares/config.yaml; the stack
9
- # life cycle is the top-level `down:`/`up:`. Never duplicate either one into
10
- # the other block, and never grow a third source.
7
+ # 1. One config source. The worktree home and the on/off switch live under
8
+ # `worktrees:` in .sassywares/config.yaml; a stack's own start and stop steps
9
+ # belong to the project's scripts, not to a key here. Never grow a second
10
+ # source.
11
11
  # 2. Identity is derived here once — never built by hand downstream.
12
12
  # 3. Everything resolves against the MAIN checkout, so running any of these
13
13
  # from inside a worktree behaves identically.
14
14
  #
15
- # worktree-version: 12
15
+ # worktree-version: 13
16
16
 
17
17
  set -euo pipefail
18
18
 
19
- WT_VERSION="12"
20
- WT_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
+ # shellcheck disable=SC2034 # read by every script that sources this file
20
+ WT_VERSION="13"
21
21
 
22
22
  log() { printf '%s\n' "$*"; }
23
23
  ok() { printf ' %-9s %s\n' "$1" "$2"; }
24
24
  warn() { printf ' %-9s %s\n' "!" "$*" >&2; }
25
25
  die() { printf ' ✗ %s\n' "$*" >&2; exit 1; }
26
26
  hint() { printf ' %-9s %s\n' "→" "$*"; }
27
- # The exit-3 handshake: something the script cannot dispatch is still owed, and
28
- # the caller has to run it before re-invoking with --hook-ok.
29
- require_dispatch() {
30
- hint "$1" >&2
31
- exit 3
32
- }
33
27
 
34
28
  # The nearest config, walking up from the cwd — used only to explain a refusal
35
29
  # when there is no repo to work in at all.
@@ -111,47 +105,7 @@ wt_cfg() {
111
105
 
112
106
  wt_enabled() { [ "$(wt_cfg enabled false)" = "true" ]; }
113
107
 
114
- # wt_down — the top-level `down:` entry, exactly as written, or empty when the
115
- # project declares no lifecycle. Top-level by design (never under `worktrees:`).
116
- wt_down() { wt_get down; }
117
-
118
- # wt_resolve VALUE CHECKOUT — how to run one top-level life-cycle value, as
119
- # `<run|skill|missing|none><TAB><command><TAB><args…>`. `run` means the command
120
- # exists — a path in the checkout, an absolute path, or a word on PATH — so a
121
- # shell script can execute it; `skill` means nothing on disk claims the word, so
122
- # only an agent can dispatch it; `missing` means the value is path-shaped but no
123
- # such executable exists; `none` means the value is empty. Args are command
124
- # words, not patterns: callers disable globbing before expanding them.
125
- wt_resolve() {
126
- local value="${1:-}" checkout="${2:-}" cmd="" args="" how=skill
127
- [ -n "$value" ] || { printf 'none\t\t'; return 0; }
128
- cmd="${value%% *}"
129
- case "$value" in *" "*) args="${value#* }" ;; esac
130
- case "$cmd" in
131
- /*) if [ -f "$cmd" ] && [ -x "$cmd" ]; then how=run; else how=missing; fi ;;
132
- */*) if [ -f "$checkout/$cmd" ] && [ -x "$checkout/$cmd" ]; then how=run; else how=missing; fi ;;
133
- *) command -v "$cmd" >/dev/null 2>&1 && how=run ;;
134
- esac
135
- printf '%s\t%s\t%s' "$how" "$cmd" "$args"
136
- }
137
-
138
- # A list value (`[a b]`) split one per line.
139
- wt_list_items() {
140
- printf '%s' "$1" | sed -e 's/^\[//' -e 's/\]$//' | tr ',' '\n' \
141
- | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//; s/^"//; s/"$//' | grep -v '^$' || true
142
- }
143
-
144
108
  # --- identity -------------------------------------------------------------
145
- # The first match wins, so `hooks.worktree."*"` applies when no branch matches.
146
- wt_hook() { # $1 point (after_create|before_remove), $2 branch — one entry per line
147
- local point="$1" branch="$2" v=""
148
- v="$(wt_get "hooks${WLIB_US}worktree${WLIB_US}${branch}${WLIB_US}${point}")"
149
- if [ -z "$v" ]; then
150
- v="$(wt_get "hooks${WLIB_US}worktree${WLIB_US}*${WLIB_US}${point}")"
151
- fi
152
- wt_list_items "$v"
153
- }
154
-
155
109
  wt_slug() { printf '%s' "$1" | sed -E 's#[/ ]+#-#g; s#[^A-Za-z0-9._-]#-#g'; }
156
110
 
157
111
  # A name safe for a database, a compose project, or a simulator: lowercase,
@@ -162,12 +116,25 @@ wt_namespace() {
162
116
  | sed -E 's#[^a-z0-9]+#-#g; s#^-+##; s#-+$##'
163
117
  }
164
118
 
119
+ # wt_print_env PATH BRANCH SLUG — the four `WT_*` lines a caller evaluates. One
120
+ # formatter: `create` mints an identity and `list --env` hands one back, so the
121
+ # two cannot drift apart. Nothing else goes on stdout when this runs.
122
+ wt_print_env() {
123
+ # %q keeps a space in the path or a backtick in the branch from being read as
124
+ # shell syntax when a caller evaluates the block. Simple values are unchanged.
125
+ printf 'WT_PATH=%q\nWT_BRANCH=%q\nWT_SLUG=%q\nWT_NAMESPACE=%q\n' \
126
+ "$1" "$2" "$3" "$(wt_namespace "$3")"
127
+ }
128
+
165
129
  # The directory holding every worktree of this repo: one folder per checkout,
166
130
  # under a home that survives a reboot. A second clone of the same project gets a
167
131
  # suffixed folder instead of sharing this one.
168
132
  wt_home() {
169
133
  local dir base cand parent owner
170
134
  dir="$(wt_cfg dir "$HOME/.sassywares/worktrees")"
135
+ # The patterns are literal (case does not expand a tilde), so the strip below
136
+ # removes the two characters the user wrote, not a home directory.
137
+ # shellcheck disable=SC2088
171
138
  case "$dir" in
172
139
  "~") dir="$HOME" ;;
173
140
  "~/"*) dir="$HOME/${dir#\~/}" ;;
@@ -224,7 +191,7 @@ wt_find() { # $1 slug or branch -> path<TAB>branch, or nothing
224
191
 
225
192
  # A checkout is ours when it lives under this repo's worktree home AND carries
226
193
  # the wiring. Anything else — another tool's worktree, or one cut before setup
227
- # was committed — is not managed here: we do not list it, prune it, or delete it.
194
+ # was committed — is not managed here: we do not list it or delete it.
228
195
  wt_managed() { # $1 path
229
196
  case "$1" in
230
197
  "$(wt_home)"/*) [ -f "$1/.sassywares/config.yaml" ] ;;