@sassywares/skills 0.11.10 → 0.11.13
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/package.json
CHANGED
|
@@ -69,7 +69,7 @@ recipe, and the next `run` is what proves it.
|
|
|
69
69
|
4. **Ask, one surface at a time — and stop until answered.** With what you found: *"`web`, `api`, and `admin` have no runtime path — `web` has Playwright, the other two only unit tests. Set up a runtime check for `api` and `admin`?"* The options are wrap an existing suite, add a small runtime check, or leave it uncovered and say so. **This step blocks steps 5–8**: the answer decides what gets written, so with no user to ask, stop and report the question verbatim — never write a recipe on a guessed answer. Never leave a surface uncovered silently, and never fill the gap with what happens to exist.
|
|
70
70
|
|
|
71
71
|
A **small runtime check is in scope**: a boot plus one assertion, a `curl`, a screenshot diff — written into the recipe as steps. That is not a test framework, and it is the only check this skill authors. Installing a driver or a runner to make one possible is out of bounds; without one already present, the surface is uncovered.
|
|
72
|
-
5. **Write the draft, gaps included.**
|
|
72
|
+
5. **Write the draft, one section per surface, gaps included.** With more than one surface, that surface's `**Preview:**` and `**Upstream:**` go **inside its own section** — a file-level address on a multi-app project can only describe one app. With exactly one surface, keep the file flat. Every surface in the inventory gets a section: an uncovered one ends with `**Prove it:** none`, explicitly, so a plan keeps its rows `Manual`; an out-of-scope one gets no section at all. Name both lists in the header (`**Uncovered:** api (unit tests only)` / `**Out of scope:** admin`) so the gaps are visible without reading every section.
|
|
73
73
|
6. **Run it, and log every deviation.** Bring the product up and run the draft. Anything you do that is **not a step in the recipe** — an install, an export, a patch, a workaround, a second terminal — is a *deviation*, written down as you go. This is the only step where improvising is allowed, and it is never silent.
|
|
74
74
|
7. **Reconcile.** Every deviation becomes exactly one of two things: a step in the recipe, or the reason this surface is unprovable (`**Prove it:** none`). A recipe whose check passed only with help the recipe does not contain is wrong. If you cannot capture a deviation as a step, the surface is uncovered — say so rather than shipping a procedure nobody else can follow.
|
|
75
75
|
8. **Prove the procedure, not the day — with a fresh agent.** Hand the recipe to a run that has **nothing but the recipe and the config**: a new session, or a dispatched agent, but never this one. It is run once from a clean checkout, allowing no deviation. If you cannot get one, say the recipe is **unverified** rather than claiming it. That second run is the artifact. If it needs improvising, the recipe is wrong: fix it and repeat once; still failing means uncovered and visible.
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
# 3. Everything resolves against the MAIN checkout, so running any of these
|
|
11
11
|
# from inside a worktree behaves identically.
|
|
12
12
|
#
|
|
13
|
-
# worktree-version:
|
|
13
|
+
# worktree-version: 7
|
|
14
14
|
|
|
15
15
|
set -euo pipefail
|
|
16
16
|
|
|
17
|
-
WT_VERSION="
|
|
17
|
+
WT_VERSION="7"
|
|
18
18
|
WT_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
19
19
|
|
|
20
20
|
log() { printf '%s\n' "$*"; }
|
|
@@ -348,23 +348,51 @@ wt_subst() {
|
|
|
348
348
|
fi
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
#
|
|
352
|
-
#
|
|
351
|
+
# _wt_preview_block RECIPE [SECTION] — the `**Preview:**` block, joined to one line.
|
|
352
|
+
# With no section it reads only what sits *before* the first `## ` heading, so a
|
|
353
|
+
# nested recipe's first app cannot masquerade as the file-level address.
|
|
354
|
+
_wt_preview_block() {
|
|
355
|
+
awk -v want="${2:-}" '
|
|
356
|
+
/^## / {
|
|
357
|
+
if (want == "") exit
|
|
358
|
+
s = $0; sub(/^## +/, "", s); split(s, pr, /[ \t]+/); cur = pr[1]; inb = 0; next
|
|
359
|
+
}
|
|
360
|
+
want != "" && cur != want { next }
|
|
361
|
+
/^\*\*Preview:\*\*/ { sub(/^\*\*Preview:\*\*[[:space:]]*/, ""); buf = $0; inb = 1; next }
|
|
362
|
+
inb && /^[[:space:]]*$/ { inb = 0; next }
|
|
363
|
+
inb && /^\*\*/ { inb = 0; next }
|
|
364
|
+
inb { buf = buf " " $0 }
|
|
365
|
+
END { printf "%s", buf }
|
|
366
|
+
' "$1" | sed -E 's/[[:space:]]+/ /g; s/[[:space:]]+$//'
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
# wt_preview SLUG [SECTION] — how to see this checkout, substituted.
|
|
370
|
+
# A section's own line wins when one is asked for; otherwise the file-level line is
|
|
371
|
+
# the checkout's address. With no file-level line and exactly one section, that
|
|
372
|
+
# section is the answer; with several, nothing is returned rather than guessing which
|
|
373
|
+
# app a checkout is serving.
|
|
353
374
|
wt_preview() {
|
|
354
|
-
local slug="$1" recipe line port base
|
|
375
|
+
local slug="$1" sect="${2:-}" recipe line="" cand count sl port base
|
|
355
376
|
recipe="$(wt_flat | awk -F'\t' -v p="dogfood${WLIB_US}recipe" '$1 == p { print $2; exit }')"
|
|
356
377
|
recipe="${recipe:-.sassywares/dogfood/recipe.md}"
|
|
357
378
|
case "$recipe" in /*) ;; *) recipe="$MAIN/$recipe" ;; esac
|
|
358
379
|
[ -f "$recipe" ] || return 0
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
line
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
380
|
+
if [ -n "$sect" ]; then line="$(_wt_preview_block "$recipe" "$sect")"; fi
|
|
381
|
+
if [ -z "$line" ]; then line="$(_wt_preview_block "$recipe" "")"; fi
|
|
382
|
+
if [ -z "$line" ]; then
|
|
383
|
+
# Fall back to the single section that *declares* an address. Counting sections
|
|
384
|
+
# would fail on a recipe with one app and one uncovered surface, which is a
|
|
385
|
+
# perfectly ordinary shape: only the app has somewhere to look.
|
|
386
|
+
count=0; cand=""
|
|
387
|
+
while IFS= read -r sl; do
|
|
388
|
+
[ -n "$sl" ] || continue
|
|
389
|
+
cand="$(_wt_preview_block "$recipe" "$sl")"
|
|
390
|
+
[ -n "$cand" ] || continue
|
|
391
|
+
count=$((count + 1))
|
|
392
|
+
line="$cand"
|
|
393
|
+
done < <(sed -n 's/^## \([^ ]*\).*/\1/p' "$recipe")
|
|
394
|
+
[ "$count" -eq 1 ] || line=""
|
|
395
|
+
fi
|
|
368
396
|
[ -n "$line" ] || return 0
|
|
369
397
|
port=""
|
|
370
398
|
if wt_has_ports; then
|
|
@@ -65,20 +65,21 @@ because a project that "helpfully" removes it commits screenshots by accident.
|
|
|
65
65
|
|
|
66
66
|
**Never** production. Local or staging only.
|
|
67
67
|
|
|
68
|
-
**Set up once:** `bun install
|
|
69
|
-
copy `.env.example` → `.env` and fill `DOGFOOD_USER`, `DOGFOOD_PASS`.
|
|
68
|
+
**Set up once:** `bun install` — shared by every section below.
|
|
70
69
|
|
|
71
70
|
**Reset:** `bun run db:reset`
|
|
72
71
|
|
|
72
|
+
**Uncovered:** mobile (unit tests only)
|
|
73
|
+
|
|
74
|
+
**Out of scope:** admin — decided against
|
|
75
|
+
|
|
76
|
+
## catalog — a search returns matching products
|
|
77
|
+
|
|
73
78
|
**Preview:** open `http://localhost:${WT_PORT:-3000}`
|
|
74
79
|
|
|
75
80
|
**Upstream:** `api.example.com` — a service this run does not control. Down is
|
|
76
81
|
`env`, never a retry.
|
|
77
82
|
|
|
78
|
-
**Uncovered:** mobile (nothing), admin (unit tests only)
|
|
79
|
-
|
|
80
|
-
## catalog — a search returns matching products
|
|
81
|
-
|
|
82
83
|
1. **Do** `bun run db:seed -- --fixtures catalog-small`
|
|
83
84
|
**Expect** `seeded 12 products`
|
|
84
85
|
2. **Do** `bun dev &`, then poll `curl -fsS localhost:3000/healthz`
|
|
@@ -92,10 +93,12 @@ copy `.env.example` → `.env` and fill `DOGFOOD_USER`, `DOGFOOD_PASS`.
|
|
|
92
93
|
|
|
93
94
|
**Prove it:** step 5 — its exit code is the verdict.
|
|
94
95
|
|
|
95
|
-
##
|
|
96
|
+
## mobile — no runtime path yet
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
**Uncovered:** 100+ unit tests that never start the app; a later discovery builds its
|
|
99
|
+
runtime check.
|
|
100
|
+
|
|
101
|
+
**Prove it:** none
|
|
99
102
|
```
|
|
100
103
|
|
|
101
104
|
**A section is one testable area** — `catalog`, `auth`, `mobile`, `api`. A QA row
|
|
@@ -117,6 +120,28 @@ Putting teardown before the verdict means a failed run leaves the port held. Ste
|
|
|
117
120
|
it set up state and assert along the way; the prove step is the machine-readable
|
|
118
121
|
answer. A section without one has no verdict.
|
|
119
122
|
|
|
123
|
+
### File level and section level
|
|
124
|
+
|
|
125
|
+
`**Preview:**`, `**Upstream:**`, `**Set up once:**`, and `**Reset:**` can be written at
|
|
126
|
+
file level **or inside a `## ` section**. A section's own value wins for that section;
|
|
127
|
+
the file-level value is the default every section inherits.
|
|
128
|
+
|
|
129
|
+
- **One surface: keep it flat.** File-level lines, one section — the shape most
|
|
130
|
+
projects want, and nothing below changes it.
|
|
131
|
+
- **Several surfaces: nest.** Each app's address and backend belong in that app's
|
|
132
|
+
section. A file-level `**Preview:**` on a five-app project can only describe one of
|
|
133
|
+
them, which is how a recipe ends up talking about the web app while claiming to
|
|
134
|
+
describe the project.
|
|
135
|
+
|
|
136
|
+
For a **checkout's address**, `sassy-worktree` reads the file-level line; with no
|
|
137
|
+
file-level line and exactly one section it uses that section's; with several sections
|
|
138
|
+
and none at file level it shows nothing, because guessing which app a checkout serves
|
|
139
|
+
is worse than saying nothing.
|
|
140
|
+
|
|
141
|
+
`**Uncovered:**` and `**Out of scope:**` stay **file level** — they are the inventory of
|
|
142
|
+
surfaces, not a description of one. Each name in that inventory still needs its own
|
|
143
|
+
section (see `**Uncovered:**` below).
|
|
144
|
+
|
|
120
145
|
**One `**Preview:**` line**, optional: **what you look at**, not the command that
|
|
121
146
|
starts it. The command belongs in the section's steps, where its `Expect` can be
|
|
122
147
|
checked — and no step has to consume this line: a suite that starts its own server
|
|
@@ -188,16 +188,40 @@ list_items() {
|
|
|
188
188
|
# check run validates the shape of a procedure, it never runs the product.
|
|
189
189
|
recipe_lint() {
|
|
190
190
|
awk '
|
|
191
|
-
|
|
191
|
+
function inventory(rest, kind, n, parts, i, name) {
|
|
192
|
+
n = split(rest, parts, ",")
|
|
193
|
+
for (i = 1; i <= n; i++) {
|
|
194
|
+
name = parts[i]
|
|
195
|
+
sub(/^[[:space:]]+/, "", name)
|
|
196
|
+
sub(/[[:space:]\(].*$/, "", name)
|
|
197
|
+
if (name == "") continue
|
|
198
|
+
if (kind == "unc") unc[++nunc] = name
|
|
199
|
+
else oos[++noos] = name
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
BEGIN { pending = 0; sec = ""; sname = ""; prove = 0; step = ""; incomment = 0; nunc = 0; noos = 0 }
|
|
192
203
|
index($0, "<!--") { incomment = 1 }
|
|
193
204
|
incomment {
|
|
194
205
|
if (index($0, "-->")) incomment = 0
|
|
195
206
|
next
|
|
196
207
|
}
|
|
208
|
+
# The two inventories are file level: names of surfaces, not a surface. Inside a
|
|
209
|
+
# section they are a mistake — a section states its own answer with **Prove it:**.
|
|
210
|
+
index($0, "**Uncovered:**") || index($0, "**Out of scope:**") {
|
|
211
|
+
if (sec != "") {
|
|
212
|
+
printf "\"**Uncovered:**\" and \"**Out of scope:**\" are file level only — section \"%s\" states its own answer with **Prove it:** none\n", sname
|
|
213
|
+
next
|
|
214
|
+
}
|
|
215
|
+
line = $0
|
|
216
|
+
if (index($0, "**Uncovered:**")) { sub(/^\*\*Uncovered:\*\*[[:space:]]*/, "", line); inventory(line, "unc") }
|
|
217
|
+
else { sub(/^\*\*Out of scope:\*\*[[:space:]]*/, "", line); inventory(line, "oos") }
|
|
218
|
+
next
|
|
219
|
+
}
|
|
197
220
|
index($0, "**Prove it:**") {
|
|
198
221
|
prove = 1
|
|
199
222
|
val = $0; sub(/^.*\*\*Prove it:\*\*[[:space:]]*/, "", val)
|
|
200
223
|
low = tolower(val)
|
|
224
|
+
if (sname != "") pval[sname] = low
|
|
201
225
|
if (low !~ /^none/ && low !~ /^step[[:space:]]+[0-9]/)
|
|
202
226
|
printf "a **Prove it:** line must name a step (`step 3`) or say `none` — got \"%s\"\n", val
|
|
203
227
|
next
|
|
@@ -210,6 +234,7 @@ recipe_lint() {
|
|
|
210
234
|
pending = 0; prove = 0
|
|
211
235
|
sec = $0; sub(/^## +/, "", sec)
|
|
212
236
|
split(sec, parts, /[ \t]+/); sname = parts[1]
|
|
237
|
+
insection[sname] = 1
|
|
213
238
|
next
|
|
214
239
|
}
|
|
215
240
|
/^[0-9]+\. / && index($0, "**Do**") {
|
|
@@ -226,6 +251,19 @@ recipe_lint() {
|
|
|
226
251
|
printf "section \"%s\" has no **Prove it:** line — it has no verdict\n", sname
|
|
227
252
|
if (sec == "")
|
|
228
253
|
printf "has no \"## <section>\" heading — there is nothing to prove\n"
|
|
254
|
+
# The inventory and the sections must agree, or the gap list lies.
|
|
255
|
+
for (i = 1; i <= nunc; i++) {
|
|
256
|
+
n = unc[i]
|
|
257
|
+
if (!(n in insection))
|
|
258
|
+
printf "**Uncovered:** names \"%s\" but there is no \"## %s\" section — an uncovered surface gets a section saying **Prove it:** none\n", n, n
|
|
259
|
+
else if (pval[n] !~ /^none/)
|
|
260
|
+
printf "**Uncovered:** names \"%s\" but its section has a verdict — uncovered means **Prove it:** none\n", n
|
|
261
|
+
}
|
|
262
|
+
for (i = 1; i <= noos; i++) {
|
|
263
|
+
n = oos[i]
|
|
264
|
+
if (n in insection)
|
|
265
|
+
printf "\"%s\" is listed **Out of scope:** but gets a \"## %s\" section — out of scope means no section\n", n, n
|
|
266
|
+
}
|
|
229
267
|
}
|
|
230
268
|
' "$1"
|
|
231
269
|
}
|