@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.
- package/CONCEPTS.md +32 -15
- package/README.md +43 -36
- package/package.json +1 -1
- package/skills/sassy-overview/SKILL.md +2 -2
- package/skills/sassy-overview/references/identify.md +1 -1
- package/skills/sassy-setup/SKILL.md +12 -7
- package/skills/sassy-setup/assets/templates/worktrees-create +52 -0
- package/skills/sassy-setup/assets/templates/worktrees-remove +51 -0
- package/skills/sassy-setup/assets/worktree/_lib.sh +22 -55
- package/skills/sassy-setup/assets/worktree/create +21 -28
- package/skills/sassy-setup/assets/worktree/list +52 -11
- package/skills/sassy-setup/assets/worktree/remove +10 -83
- package/skills/sassy-setup/references/branching.md +2 -2
- package/skills/sassy-setup/references/check.md +46 -2
- package/skills/sassy-setup/references/config.md +70 -100
- package/skills/sassy-setup/references/dogfood.md +3 -3
- package/skills/sassy-setup/references/init.md +18 -16
- package/skills/sassy-setup/references/scaffold-header.md +63 -0
- package/skills/sassy-setup/references/worktree.md +135 -86
- package/skills/sassy-setup/scripts/detect.sh +708 -250
- package/skills/sassy-setup/scripts/worktree-check.mjs +32 -1
- package/skills/sassy-worktree/SKILL.md +9 -12
- package/skills/sassy-worktree/references/create.md +10 -3
- package/skills/sassy-worktree/references/list.md +4 -2
- package/skills/sassy-worktree/references/remove.md +30 -6
- package/skills/sassy-setup/assets/lifecycle/down +0 -29
- package/skills/sassy-setup/assets/lifecycle/up +0 -34
- package/skills/sassy-setup/assets/worktree/prune +0 -93
- package/skills/sassy-worktree/references/prune.md +0 -13
|
@@ -16,16 +16,35 @@ cut a branch, or when the user asks to run two agents in one project.
|
|
|
16
16
|
checkout — or takes one on a `worktree:on` token — and stays in the main one
|
|
17
17
|
otherwise: two runs only collide when they are actually parallel, and one taken
|
|
18
18
|
unasked moves the work to another directory, leaves the uncommitted tree behind,
|
|
19
|
-
and spends the
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
and spends the setup step on a checkout nobody needed. `branching.md` owns that
|
|
20
|
+
ask. `sassy-worktree` runs after the answer is yes, or when a human asks for a
|
|
21
|
+
checkout outright; an existing managed checkout for the branch is reused rather
|
|
22
|
+
than a second one cut.
|
|
23
|
+
|
|
24
|
+
## The project's scripts are the entry point; the toolbox is git only
|
|
25
|
+
|
|
26
|
+
The suite ships four small scripts that create, list, and remove a checkout — the
|
|
27
|
+
git mechanics, project-agnostic and suite-owned. Everything a *particular*
|
|
28
|
+
project needs around that (installing dependencies, deriving an `.env`, seeding a
|
|
29
|
+
database, stopping a stack) belongs to that project's own pair:
|
|
30
|
+
`<home>/worktrees/create` and `<home>/worktrees/remove`, scaffolded by setup from
|
|
31
|
+
`assets/templates/`. `sassy-worktree` runs the project's scripts; those call the
|
|
32
|
+
toolbox when they need git. Neither the toolbox nor the suite knows how a project
|
|
33
|
+
starts or stops its stack.
|
|
34
|
+
|
|
35
|
+
The pair carries the scaffold header — write-time provenance and the statement
|
|
36
|
+
that the file belongs to the project — described once in
|
|
37
|
+
[`scaffold-header.md`](scaffold-header.md). Setup installs them new-files-only and
|
|
38
|
+
never rewrites them; an untouched pair behaves exactly like calling the toolbox
|
|
39
|
+
directly.
|
|
23
40
|
|
|
24
41
|
## Install
|
|
25
42
|
|
|
26
43
|
Setup copies `assets/worktree/*` flat into `.sassywares/worktree/`, makes the
|
|
27
|
-
|
|
28
|
-
the repo, so every worktree carries the tooling.
|
|
44
|
+
three scripts executable, and stops. They are tracked: a worktree is a checkout of
|
|
45
|
+
the repo, so every worktree carries the tooling. Setup also scaffolds the
|
|
46
|
+
project's pair under `<home>/worktrees/`, probes `<home>`, and records both paths
|
|
47
|
+
as `worktrees.create` and `worktrees.remove` — [`init.md`](init.md) step 6.
|
|
29
48
|
|
|
30
49
|
**No command runner is required and no manifest is created.** Every caller — the
|
|
31
50
|
suite included — runs them by path, `.sassywares/worktree/create <branch>`. Setup
|
|
@@ -35,21 +54,25 @@ nothing else.
|
|
|
35
54
|
|
|
36
55
|
| Script | Does | Ends with |
|
|
37
56
|
|---|---|---|
|
|
38
|
-
| `create <branch> [--from <ref>]
|
|
39
|
-
| `list [--path <slug>]` | the table: branch, path, dirty, upstream | what it prints; a flag prints one value for scripting |
|
|
40
|
-
| `remove <slug\|branch> [--
|
|
41
|
-
| `
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
| `create <branch> [--from <ref>]` | cuts the branch untracked (or shows an existing checkout) | the four `WT_*` lines on stdout |
|
|
58
|
+
| `list [--path <slug>] [--env <slug\|branch>]` | the table: branch, path, dirty, upstream, state | what it prints; a flag prints one value for scripting |
|
|
59
|
+
| `remove <slug\|branch> [--force]` | the refusals below, then deletes the checkout | a surviving branch |
|
|
60
|
+
| `_lib.sh` | shared helpers: config, slug, namespace, identity, upstream state | sourced, never run |
|
|
61
|
+
|
|
62
|
+
**Streams are a contract.** `create` puts only the four `WT_*` identity lines on
|
|
63
|
+
stdout, once, at the end of a successful run; every human line (progress, the
|
|
64
|
+
upstream it found, a warning) goes to stderr. `list --env` prints the same four
|
|
65
|
+
lines and nothing else. `remove` writes every human line to stderr and nothing to
|
|
66
|
+
stdout — nothing consumes its stdout. A caller can `eval` stdout while a person
|
|
67
|
+
still reads the narration, and `create` and `list --env` are interchangeable for
|
|
68
|
+
that.
|
|
69
|
+
|
|
70
|
+
**Exit codes.** `0` success, `1` a refusal with the reason, `2` bad usage with the
|
|
71
|
+
usage on stderr — a usage error touches nothing. A removal either happened or was
|
|
72
|
+
refused before touching anything.
|
|
73
|
+
|
|
74
|
+
Nothing else lives there. No state, no registry, no pid file. Every script takes
|
|
75
|
+
`--version` (prints `WT_VERSION`) and `--help` (its own usage).
|
|
53
76
|
|
|
54
77
|
**Aliases are a convenience, never a requirement.** When the project already has a
|
|
55
78
|
file at the root that carries named commands — `package.json` `scripts`,
|
|
@@ -59,11 +82,28 @@ setup offers to add one `worktree:<script>` entry per script, append-only, by
|
|
|
59
82
|
such a file to hold them: a path works in every shell, hook, and delegation brief
|
|
60
83
|
with no runner in between.
|
|
61
84
|
|
|
62
|
-
The installed
|
|
63
|
-
|
|
85
|
+
The installed toolbox is suite-owned and read-only: nothing under
|
|
86
|
+
`.sassywares/worktree/` is the project's to edit. `--check` hashes the installed
|
|
64
87
|
files the way `skills-lock.json` hashes a skill folder, so a differing byte is
|
|
65
88
|
drift and the file is named. Setup overwrites the set without asking, because
|
|
66
|
-
there is no legitimate project edit to preserve.
|
|
89
|
+
there is no legitimate project edit to preserve. The project's scripts under
|
|
90
|
+
`<home>/worktrees/` are the opposite: wholly the project's, never rewritten.
|
|
91
|
+
|
|
92
|
+
**The missing-script degrade.** `scripts/detect.sh --worktree-script create|remove`
|
|
93
|
+
answers which path a run executes. A declared path is relative to the project
|
|
94
|
+
root. An absent key falls back to the built-in silently — a project that deleted
|
|
95
|
+
the pair means it. A declared value that is unusable — a missing or non-executable
|
|
96
|
+
file, whitespace or arguments, an absolute or `~/` path, `..`, a list, or a block —
|
|
97
|
+
warns on stderr naming the key and the file, then falls back to the built-in. The
|
|
98
|
+
rule and its warning live in [`config.md`](config.md)'s Lifecycle.
|
|
99
|
+
|
|
100
|
+
**Upgrading the toolbox: version 12 → 13.** `# worktree-version:` in `_lib.sh` and
|
|
101
|
+
`WT_VERSION` move together. 13 deletes `prune`: what it classified is now a state
|
|
102
|
+
column on `list`, and `remove` keeps the branch, so "merged" was never a data-safety
|
|
103
|
+
gate. `--check` treats a 12 header as an upgrade rather than tampering; the fix is
|
|
104
|
+
a setup re-run, which overwrites the set. Then delete a stale
|
|
105
|
+
`.sassywares/worktree/prune` if one is still there — nothing reads it. An install
|
|
106
|
+
at version 8 or lower may also carry `<worktree home>/ports/`; inert, delete it.
|
|
67
107
|
|
|
68
108
|
## Where things live
|
|
69
109
|
|
|
@@ -78,10 +118,6 @@ there is no legitimate project edit to preserve.
|
|
|
78
118
|
one path in the config that may be absolute or start with `~/` — it names
|
|
79
119
|
machine-local state, not something a teammate clones.
|
|
80
120
|
|
|
81
|
-
**An install at `worktree-version` 8 or lower also has `<worktree home>/ports/`**
|
|
82
|
-
— a folder of claim directories. Nothing reads it any more: it is inert and can be
|
|
83
|
-
deleted.
|
|
84
|
-
|
|
85
121
|
The folder is named after the repo. When another **live** clone of the same name
|
|
86
122
|
already owns it, this one takes `<repo>-<hash>` instead; a home whose recorded
|
|
87
123
|
owner no longer exists is reclaimed, so a finished project does not squat the name
|
|
@@ -93,7 +129,7 @@ is undocumented and breaks where `.git` is a file (linked worktrees, submodules,
|
|
|
93
129
|
and crawled by every scanner that does not read `.gitignore` (`tsc`, Docker).
|
|
94
130
|
|
|
95
131
|
**Never `rm -rf` the worktree home.** It is full of checkouts with uncommitted
|
|
96
|
-
work; `remove`
|
|
132
|
+
work; `remove` is the only safe exit.
|
|
97
133
|
|
|
98
134
|
## The branch
|
|
99
135
|
|
|
@@ -107,11 +143,12 @@ work; `remove` and `prune` are the only safe exits.
|
|
|
107
143
|
`upstream` line; one that is not the branch's own name is called out with what
|
|
108
144
|
a plain push would hit. That is the state a branch cut by hand arrives in.
|
|
109
145
|
- **`create` never resolves a base.** The base is `references/branching.md`'s
|
|
110
|
-
decision, and a push names its remote.
|
|
146
|
+
decision, and a push names its remote. A caller that has already resolved the
|
|
147
|
+
base passes `--from`; the script never guesses.
|
|
111
148
|
|
|
112
149
|
## The namespace
|
|
113
150
|
|
|
114
|
-
`create` derives and prints
|
|
151
|
+
`create` derives and prints the identity a caller inherits:
|
|
115
152
|
|
|
116
153
|
| Variable | Example | Use |
|
|
117
154
|
|---|---|---|
|
|
@@ -120,7 +157,10 @@ work; `remove` and `prune` are the only safe exits.
|
|
|
120
157
|
| `WT_SLUG` | `feat-catalog` | the directory name; the handle `list` and `remove` take |
|
|
121
158
|
| `WT_NAMESPACE` | `shop-feat-catalog` | database schema, compose project, simulator name |
|
|
122
159
|
|
|
123
|
-
The same names
|
|
160
|
+
The same names are what a project's `create` and `remove` slots expand. Derived,
|
|
161
|
+
never invented downstream: a script that needs a database name uses
|
|
162
|
+
`$WT_NAMESPACE` rather than building its own, so two worktrees cannot collide by
|
|
163
|
+
accident. `create` mints an identity; `remove` receives one.
|
|
124
164
|
|
|
125
165
|
**Finding a checkout.** `list` prints paths with `$HOME` shortened to `~`, which
|
|
126
166
|
reads well and does **not** paste into anything:
|
|
@@ -129,77 +169,86 @@ reads well and does **not** paste into anything:
|
|
|
129
169
|
cd "$(.sassywares/worktree/list --path feat-catalog)" # the real absolute path
|
|
130
170
|
```
|
|
131
171
|
|
|
132
|
-
`
|
|
133
|
-
|
|
172
|
+
`list --env <slug|branch>` prints the four assignments. A slug that matches two
|
|
173
|
+
branches (`feat/x` and `feat-x`) is an error naming every match, never a first
|
|
174
|
+
pick.
|
|
134
175
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
176
|
+
```bash
|
|
177
|
+
eval "$(.sassywares/worktree/list --env feat/catalog)"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## The state column, and removing several checkouts
|
|
181
|
+
|
|
182
|
+
`list` adds a state per managed checkout, from the branch's upstream:
|
|
138
183
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
184
|
+
| State | Means |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `merged` | HEAD is an ancestor of the tracked upstream — the work is on a remote |
|
|
187
|
+
| `gone` | the branch tracks nothing, so "merged" is unknowable |
|
|
188
|
+
| `unmerged` | there are commits the upstream does not have |
|
|
189
|
+
|
|
190
|
+
`remove <slug>` refuses a dirty tree, unpushed commits, or the main checkout, and
|
|
191
|
+
removes one checkout. There is no bulk `prune`: a user who says "remove the merged
|
|
192
|
+
ones" gets the list, a confirmation, and a sequential walk over each `merged` row —
|
|
193
|
+
one `remove <slug>` at a time, reporting each refusal and continuing, so one
|
|
194
|
+
blocked checkout does not hide the rest. Slower by design, and every row is
|
|
195
|
+
visible before it goes.
|
|
143
196
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
197
|
+
`remove` deletes the checkout and nothing else. **The branch survives** — git keeps
|
|
198
|
+
it, so the work is still reachable after the worktree is gone. Deleting it is the
|
|
199
|
+
user's call, or `pr.delete_branch`'s after a merge. `--force` skips the dirty and
|
|
200
|
+
unpushed checks and nothing else; it is never implied. When git removes the
|
|
201
|
+
registration but not the folder, the script says so and exits `1` rather than
|
|
202
|
+
claiming success.
|
|
148
203
|
|
|
149
|
-
##
|
|
204
|
+
## A project's `remove` runs four steps in order
|
|
150
205
|
|
|
151
|
-
|
|
206
|
+
The scaffold's slots exist because the order is the point:
|
|
152
207
|
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
before_remove: [shop-worktree]
|
|
208
|
+
```text
|
|
209
|
+
identity -> stop -> delete -> dispose
|
|
210
|
+
list --env project toolbox project
|
|
211
|
+
(files (git) ($WT_NAMESPACE
|
|
212
|
+
exist) still set)
|
|
159
213
|
```
|
|
160
214
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
215
|
+
1. **Identity** — `list --env` gives `WT_PATH`, `WT_BRANCH`, `WT_SLUG`,
|
|
216
|
+
`WT_NAMESPACE`. Asking the toolbox means the names are the ones `create`
|
|
217
|
+
minted; `remove` never rebuilds a slug.
|
|
218
|
+
2. **Stop, while the checkout still exists** — the project stops whatever it
|
|
219
|
+
started for this checkout. A process holding the tree is what makes a removal
|
|
220
|
+
half-fail.
|
|
221
|
+
3. **Delete** — the toolbox's `remove` runs its guards and deletes the tree.
|
|
222
|
+
4. **Dispose, after the tree is gone** — `$WT_NAMESPACE` is still set, so the
|
|
223
|
+
project drops what it derived: a database, a preview deployment, a simulator.
|
|
165
224
|
|
|
166
|
-
|
|
167
|
-
|
|
225
|
+
There is no hook handshake, no `--hook-ok`, and no exit `3`: a shell script cannot
|
|
226
|
+
dispatch a skill, so anything needing one is the agent's job before it calls the
|
|
227
|
+
script. The scaffold's slots are labelled comments — a comment is where a project
|
|
228
|
+
writes a step, and setup writes none of them as code.
|
|
168
229
|
|
|
169
|
-
|
|
170
|
-
records the name; the project writes the body.
|
|
230
|
+
## The suite carries no stack, no port, and no registry
|
|
171
231
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
injected per origin. That difference is worth writing down once rather than
|
|
178
|
-
rediscovering it.
|
|
232
|
+
Two checkouts running the same app collide only if the project's own scripts let
|
|
233
|
+
them. The suite carries no address and no port range and never derives one; a
|
|
234
|
+
port belongs in the project's `create`, derived from `$WT_SLUG` (a hash, because
|
|
235
|
+
nothing here tracks claims, so a collision is possible and the script is where it
|
|
236
|
+
surfaces).
|
|
179
237
|
|
|
180
|
-
|
|
238
|
+
`list` reports branches, paths, dirty state, upstreams, and the state column, and
|
|
239
|
+
nothing else: the suite keeps no registry, no pid file, and nothing to go stale.
|
|
181
240
|
|
|
182
|
-
|
|
241
|
+
## Refusals
|
|
183
242
|
|
|
184
243
|
| Condition | Why |
|
|
185
244
|
|---|---|
|
|
186
245
|
| It is the main checkout | the repo itself |
|
|
187
|
-
|
|
|
246
|
+
| A dirty tree | uncommitted work |
|
|
188
247
|
| Commits on no remote | nothing to recover from |
|
|
189
|
-
| A `
|
|
190
|
-
| A
|
|
191
|
-
|
|
192
|
-
`prune --yes` removes nothing on a project with a `down:` configured — real or the
|
|
193
|
-
generated stub — or a `before_remove` hook: it can run neither, so every
|
|
194
|
-
otherwise-removable checkout is listed for `remove <slug>` to handle instead. That
|
|
195
|
-
is by design, not a bug.
|
|
196
|
-
|
|
197
|
-
`remove` deletes the checkout and nothing else. **The branch
|
|
198
|
-
survives** — git keeps it, so the work is still reachable after the worktree is
|
|
199
|
-
gone. Deleting it is the user's call, or `pr.delete_branch`'s after a merge.
|
|
248
|
+
| A checkout outside the worktree home, or without `.sassywares/config.yaml` | it is not managed here — another tool's, or cut before the wiring |
|
|
249
|
+
| A branch already checked out elsewhere | git's own refusal; `create` reports it as such |
|
|
200
250
|
|
|
201
|
-
`--force` skips the dirty and unpushed checks
|
|
202
|
-
implied.
|
|
251
|
+
`--force` skips the dirty and unpushed checks only.
|
|
203
252
|
|
|
204
253
|
## Concurrency rules
|
|
205
254
|
|
|
@@ -218,8 +267,8 @@ implied.
|
|
|
218
267
|
- **Never `git checkout` a branch in two places.** Git refuses it — that refusal
|
|
219
268
|
is a feature, and `create` reports it as such.
|
|
220
269
|
- **Do not copy `node_modules`.** Hardlink copies share inodes, so a rewrite
|
|
221
|
-
through one checkout corrupts the other. Let the package manager's store do
|
|
222
|
-
|
|
270
|
+
through one checkout corrupts the other. Let the package manager's store do the
|
|
271
|
+
deduplicating.
|
|
223
272
|
- **`worktrees.enabled` needs `commit.branch: new`.** Under `current` a run
|
|
224
273
|
commits where it stands and never cuts a branch, so no run would ever offer a
|
|
225
274
|
worktree; `--check` notes the combination.
|