@sassywares/skills 0.11.22 → 0.12.0
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 -18
- package/README.md +33 -24
- package/package.json +1 -1
- package/skills/sassy-lfg/SKILL.md +1 -1
- package/skills/sassy-overview/SKILL.md +52 -0
- package/skills/sassy-overview/references/identify.md +82 -0
- package/skills/sassy-overview/scripts/identify.sh +83 -0
- package/skills/sassy-overview/scripts/lib.sh +334 -0
- package/skills/sassy-setup/SKILL.md +8 -8
- package/skills/sassy-setup/assets/dogfood-recipe.md +1 -1
- package/skills/sassy-setup/assets/lifecycle/down +29 -0
- package/skills/sassy-setup/assets/lifecycle/up +34 -0
- package/skills/sassy-setup/assets/roster +1 -0
- package/skills/sassy-setup/assets/sassywares-readme.md +5 -4
- package/skills/sassy-setup/assets/worktree/_lib.sh +52 -213
- package/skills/sassy-setup/assets/worktree/create +18 -33
- package/skills/sassy-setup/assets/worktree/list +20 -54
- package/skills/sassy-setup/assets/worktree/prune +13 -9
- package/skills/sassy-setup/assets/worktree/remove +83 -26
- package/skills/sassy-setup/references/config.md +99 -17
- package/skills/sassy-setup/references/dogfood.md +11 -17
- package/skills/sassy-setup/references/init.md +18 -4
- package/skills/sassy-setup/references/workspace.md +27 -34
- package/skills/sassy-setup/references/worktree.md +66 -75
- package/skills/sassy-setup/scripts/detect.sh +112 -103
- package/skills/sassy-setup/scripts/hash-skill.mjs +31 -18
- package/skills/sassy-setup/scripts/worktree-check.mjs +89 -0
- package/skills/sassy-work/SKILL.md +1 -1
- package/skills/sassy-worktree/SKILL.md +17 -21
- package/skills/sassy-worktree/references/create.md +3 -3
- package/skills/sassy-worktree/references/list.md +2 -2
- package/skills/sassy-worktree/references/prune.md +4 -4
- package/skills/sassy-worktree/references/remove.md +8 -6
- package/skills/sassy-setup/assets/worktree/stop +0 -65
- package/skills/sassy-worktree/references/preview.md +0 -17
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Remove a worktree, after proving nothing would be lost.
|
|
3
3
|
#
|
|
4
|
-
# Refuses: the main checkout, a dirty tree, commits that are on no remote
|
|
5
|
-
#
|
|
6
|
-
#
|
|
4
|
+
# Refuses: the main checkout, a dirty tree, and commits that are on no remote.
|
|
5
|
+
# A configured top-level `down:` runs before the folder goes and before any hook is
|
|
6
|
+
# dispatched; a declared `hooks.worktree.before_remove` needs the caller to dispatch
|
|
7
|
+
# it first — the script cannot dispatch a skill, so it fails closed until the caller
|
|
7
8
|
# says the hook has been dispatched.
|
|
8
9
|
#
|
|
9
10
|
# Usage: .sassywares/worktree/remove <slug|branch> [--hook-ok] [--force]
|
|
@@ -18,10 +19,11 @@ usage() {
|
|
|
18
19
|
cat <<'EOF'
|
|
19
20
|
Usage: .sassywares/worktree/remove <slug|branch> [--hook-ok] [--force]
|
|
20
21
|
|
|
21
|
-
--hook-ok the project's hooks.worktree.before_remove
|
|
22
|
-
|
|
22
|
+
--hook-ok the project's hooks.worktree.before_remove — or a `down:` that names
|
|
23
|
+
a skill — has already been dispatched; required when one is declared
|
|
24
|
+
(exit 3 otherwise)
|
|
23
25
|
--force skip the dirty-tree and unpushed-commit refusals. Never skips the
|
|
24
|
-
main checkout
|
|
26
|
+
main checkout or the hook handshake.
|
|
25
27
|
EOF
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -50,21 +52,8 @@ slug="$(wt_slug "$branch")"
|
|
|
50
52
|
wt_is_main "$path" && die "that is the main checkout — it cannot be removed"
|
|
51
53
|
wt_managed "$path" || die "'$target' is not managed here — it is outside the worktree home, or it was cut before the wiring"
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
while IFS= read -r n; do
|
|
56
|
-
[ -n "$n" ] || continue
|
|
57
|
-
log "require-hook $n"
|
|
58
|
-
done <<<"$hooks"
|
|
59
|
-
printf ' %-9s %s\n' "→" "dispatch it, then re-run with --hook-ok" >&2
|
|
60
|
-
exit 3
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
port="$(wt_live_port "$slug")"
|
|
64
|
-
if [ -n "$port" ] && tcp_up "$port"; then
|
|
65
|
-
die "something is still listening on :$port — stop <$slug> first"
|
|
66
|
-
fi
|
|
67
|
-
|
|
55
|
+
# Refuse before tearing anything down: a checkout we would not delete should not
|
|
56
|
+
# have had its stack stopped on the way to that refusal.
|
|
68
57
|
if [ "$force" -eq 0 ]; then
|
|
69
58
|
wt_dirty "$path" && die "not clean — $(git -C "$path" status --porcelain | wc -l | tr -d ' ') path(s) modified. Commit, discard, or --force."
|
|
70
59
|
n="$(wt_unpushed "$path")"
|
|
@@ -75,14 +64,82 @@ if [ "$force" -eq 0 ]; then
|
|
|
75
64
|
esac
|
|
76
65
|
fi
|
|
77
66
|
|
|
78
|
-
|
|
67
|
+
# The project's own stop step, resolved first and run before anything is
|
|
68
|
+
# dispatched: a `before_remove` drops the environment, so the app has to be
|
|
69
|
+
# stopped while that environment still exists, and a failing `down` aborts before
|
|
70
|
+
# the teardown starts. A value naming a script or a command runs here; anything
|
|
71
|
+
# else is a skill, which a shell script cannot dispatch, so it joins the exit-3
|
|
72
|
+
# handshake below. `wt_resolve` is the one reader for both halves of the pair.
|
|
73
|
+
down="$(wt_down)"
|
|
74
|
+
IFS=$'\t' read -r how dcmd dargs <<<"$(wt_resolve "$down" "$path")"
|
|
75
|
+
|
|
76
|
+
case "$how" in
|
|
77
|
+
none) ;;
|
|
78
|
+
missing)
|
|
79
|
+
die "down: '$down' is path-shaped but not executable in $path — fix the down: key, or make that file executable" ;;
|
|
80
|
+
run)
|
|
81
|
+
# On the --hook-ok re-run this is the continuation of the same removal, and a
|
|
82
|
+
# successful first run already stopped the stack: do not run it twice.
|
|
83
|
+
if [ "$hook_ok" -eq 0 ]; then
|
|
84
|
+
ok down "$down"
|
|
85
|
+
# Its arguments are command words, not patterns: disable globbing so
|
|
86
|
+
# `down: ./bin/stop tmp/*.pid` stops the pid file the project meant instead of
|
|
87
|
+
# every match in the checkout.
|
|
88
|
+
set -f
|
|
89
|
+
if ( cd "$path" && WT_PATH="$path" WT_BRANCH="$branch" WT_SLUG="$slug" WT_NAMESPACE="$(wt_namespace "$slug")" $dcmd $dargs ); then
|
|
90
|
+
:
|
|
91
|
+
else
|
|
92
|
+
status=$?
|
|
93
|
+
if [ "$status" -eq 78 ]; then
|
|
94
|
+
warn unimplemented "down: $down is the generated stub (exit 78) — implement it, or delete the down: key if nothing needs stopping; removing anyway"
|
|
95
|
+
else
|
|
96
|
+
set +f
|
|
97
|
+
die "down failed: $down"
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
set +f
|
|
101
|
+
fi
|
|
102
|
+
down="" # it ran (or is skipped as already run): no obligation remains
|
|
103
|
+
;;
|
|
104
|
+
skill) ;;
|
|
105
|
+
esac
|
|
106
|
+
|
|
107
|
+
# One handshake lists everything still owed — a `down:` naming a skill, and/or
|
|
108
|
+
# every declared `before_remove` hook — so the caller dispatches once and re-runs
|
|
109
|
+
# once instead of discovering a second obligation after the first.
|
|
110
|
+
hooks="$(wt_hook before_remove "$branch")"
|
|
111
|
+
if [ "$hook_ok" -eq 0 ]; then
|
|
112
|
+
action=""
|
|
113
|
+
if [ -n "$down" ]; then
|
|
114
|
+
log "require-hook $down"
|
|
115
|
+
action="run down ($down)"
|
|
116
|
+
fi
|
|
117
|
+
if [ -n "$hooks" ]; then
|
|
118
|
+
while IFS= read -r n; do
|
|
119
|
+
[ -n "$n" ] || continue
|
|
120
|
+
log "require-hook $n"
|
|
121
|
+
done <<<"$hooks"
|
|
122
|
+
action="${action:+$action and }dispatch it"
|
|
123
|
+
fi
|
|
124
|
+
[ -z "$action" ] || require_dispatch "$action, then re-run with --hook-ok"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
if [ -n "$down" ]; then
|
|
128
|
+
ok down "$down (dispatched)"
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
if [ "$force" -eq 1 ]; then
|
|
132
|
+
removed_ok=0
|
|
133
|
+
git worktree remove --force "$path" && removed_ok=1
|
|
134
|
+
else
|
|
135
|
+
removed_ok=0
|
|
136
|
+
git worktree remove "$path" && removed_ok=1
|
|
137
|
+
fi
|
|
138
|
+
if [ "$removed_ok" -eq 0 ]; then
|
|
79
139
|
printf ' → %s\n' "git removed the registration but not the folder, so nothing here can reach it now:" >&2
|
|
80
140
|
printf ' %s\n' "stop whatever is still running there, then delete that folder yourself" >&2
|
|
81
141
|
printf ' %s\n' "(\`git worktree prune\` only matters if \`git worktree list\` still names it)" >&2
|
|
82
142
|
exit 1
|
|
83
143
|
fi
|
|
84
|
-
if [ -n "$port" ] && [ "$(wt_owner "$port")" = "$slug" ]; then
|
|
85
|
-
wt_release "$port" "$slug"
|
|
86
|
-
ok released ":$port"
|
|
87
|
-
fi
|
|
88
144
|
ok removed "$path"
|
|
145
|
+
ok branch "$branch — the branch stays, so the work is still reachable"
|
|
@@ -92,12 +92,14 @@ hooks:
|
|
|
92
92
|
worktrees:
|
|
93
93
|
enabled: false # true = a run may offer its own checkout
|
|
94
94
|
dir: ~/.sassywares/worktrees # parent of the per-repo folder; ~ is allowed here
|
|
95
|
-
ports: 3000-3099 # optional; delete for a non-port preview
|
|
96
95
|
dogfood:
|
|
97
96
|
enabled: false # true = sassy-plan writes Mode: Auto QA rows
|
|
98
97
|
recipe: .sassywares/dogfood/recipe.md # the procedure
|
|
99
98
|
reports: .sassywares/dogfood/reports # run output, never committed
|
|
100
99
|
timeout: 900 # whole procedure, seconds
|
|
100
|
+
# top level, not under worktrees: how this project's stack starts and stops
|
|
101
|
+
up: just dev # <script> <args…> | <skill> <args…>; absent = no lifecycle
|
|
102
|
+
down: just down
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
| Key | Default | Meaning |
|
|
@@ -128,9 +130,10 @@ dogfood:
|
|
|
128
130
|
| `dogfood.timeout` | `900` | Wall-clock for one run. A timeout is a failure, never a hang |
|
|
129
131
|
| `worktrees.enabled` | `false` | `true` lets a run *offer* its own checkout; it asks, or takes one on a `worktree:on` token, and works in this checkout on `worktree:off`. Needs `commit.branch: new` |
|
|
130
132
|
| `worktrees.dir` | `~/.sassywares/worktrees` | Parent of the per-repo worktree folder. The one path here that may be absolute or `~/` |
|
|
131
|
-
| `
|
|
133
|
+
| `up` | absent | How this project's stack starts: one `<script> <args…>` or `<skill> <args…>`, run in the foreground from inside a checkout. Absent means no lifecycle |
|
|
134
|
+
| `down` | absent | How it stops: the same form. `remove` runs it before deleting a checkout. Absent means nothing to stop |
|
|
132
135
|
|
|
133
|
-
Paths are relative to the config's own directory, never to the cwd.
|
|
136
|
+
Paths are relative to the config's own directory, never to the cwd. Two exceptions: `worktrees.dir` may be absolute or start with `~/`, and a relative `up`/`down` path resolves against the checkout being started or stopped, not this file's directory.
|
|
134
137
|
|
|
135
138
|
## `git.repo` — the three topologies
|
|
136
139
|
|
|
@@ -336,7 +339,7 @@ targets. `hooks.pr.staging` means *PRs whose source is staging*. The exception i
|
|
|
336
339
|
|
|
337
340
|
`hooks.worktree` has the same shape and resolution as the other two kinds, keyed
|
|
338
341
|
by the head branch the checkout holds. It needs `worktrees.enabled`; a shell
|
|
339
|
-
script cannot dispatch a skill, so
|
|
342
|
+
script cannot dispatch a skill, so `.sassywares/worktree/remove` fails closed (exit `3`,
|
|
340
343
|
`require-hook <name>`) until the caller has run it.
|
|
341
344
|
|
|
342
345
|
`hooks.push` has the same shape and resolution as `hooks.pr`, but its key is the
|
|
@@ -450,19 +453,94 @@ partial failures explicitly. Never collapse it into one status.
|
|
|
450
453
|
fan-out means one `sassy-babysit` run per PR; merging a fan-out needs an explicit
|
|
451
454
|
per-PR say-so, because one switch would merge N PRs nobody re-read.
|
|
452
455
|
|
|
456
|
+
## Lifecycle — `up` and `down`
|
|
457
|
+
|
|
458
|
+
How this project's stack starts and stops. Two **top-level** keys, each naming
|
|
459
|
+
exactly one thing:
|
|
460
|
+
|
|
461
|
+
```yaml
|
|
462
|
+
up: just dev
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
That is the whole declaration: `up` is the command word `just` and the argument
|
|
466
|
+
`dev`. A value is split on whitespace, one argument per word, with no quote
|
|
467
|
+
processing — `down: ./bin/down "two words"` arrives as three arguments, quotes
|
|
468
|
+
included. The first word is the script or the skill; the rest are that thing's
|
|
469
|
+
own arguments. A script is a relative path, an absolute path, or a word on
|
|
470
|
+
`PATH`.
|
|
471
|
+
|
|
472
|
+
**Absent means no lifecycle.** Nothing is inferred and nothing is invented:
|
|
473
|
+
with no `up`, no run starts anything; with no `down`, `remove` deletes the
|
|
474
|
+
checkout and says nothing was stopped. There is no default command, and no
|
|
475
|
+
falling back to a `Makefile` target or a `package.json` script — a project that
|
|
476
|
+
has one and wants it used says so in the key.
|
|
477
|
+
|
|
478
|
+
**`up` runs in the foreground.** It owns the terminal until it is stopped with
|
|
479
|
+
SIGTERM, and it must reap its children before it exits. A detached or daemonizing
|
|
480
|
+
`up` is wrong here: the app outlives the call, nobody can ask it to stop, and the
|
|
481
|
+
process holds the checkout — which is exactly what `down` then cannot kill.
|
|
482
|
+
`down` must terminate whatever `up` started and exit once it has.
|
|
483
|
+
|
|
484
|
+
**`down` runs before the checkout goes.** `remove` resolves the key after its
|
|
485
|
+
guards pass and before deleting anything, so a failing `down` aborts the removal
|
|
486
|
+
and a dirty checkout is never stopped on the way to a refusal. The `--hook-ok`
|
|
487
|
+
re-run does not run `down` again: it continues the same removal, and a successful
|
|
488
|
+
first run already stopped the stack.
|
|
489
|
+
|
|
490
|
+
**A generated stub exits `78`.** That status means unimplemented, not a failure:
|
|
491
|
+
`remove` warns loudly, names the `down:` key, and removes the checkout anyway,
|
|
492
|
+
because a stub cannot be holding anything. Any other non-zero status still aborts
|
|
493
|
+
the removal. A bare word that is not path-shaped may name a skill; a path-shaped
|
|
494
|
+
value with no executable behind it is a mistake, and `remove` refuses with the
|
|
495
|
+
value and the checkout in the message.
|
|
496
|
+
|
|
497
|
+
**A skill is a value too, and a shell script cannot dispatch it.** When `down:`
|
|
498
|
+
names a skill rather than a script, `remove` prints `require-hook <name>` and
|
|
499
|
+
exits `3`; the agent runs that skill and re-runs with `--hook-ok`. That is the
|
|
500
|
+
same handshake `hooks.worktree` uses — one mechanism, not two. Args after a skill
|
|
501
|
+
name are the skill's own vocabulary, exactly like a hook entry.
|
|
502
|
+
|
|
503
|
+
**The `WT_*` block is the checkout's identity.** Whoever runs the pair exports
|
|
504
|
+
`WT_PATH`, `WT_BRANCH`, `WT_SLUG`, and `WT_NAMESPACE`; `remove` does it for
|
|
505
|
+
`down`, and a caller that starts a stack does it for `up`. `create --env` prints
|
|
506
|
+
the four assignments, which need exporting to reach a child process:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
set -a; eval "$(.sassywares/worktree/create <branch> --env)"; set +a
|
|
510
|
+
bin/up
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
`WT_SLUG` is the branch made filesystem-safe and `WT_NAMESPACE` is the derived
|
|
514
|
+
name for a database, a compose project, or a device — derive from them, never
|
|
515
|
+
build a name by hand.
|
|
516
|
+
|
|
517
|
+
**Ports are the project's business.** The suite carries no port range and never
|
|
518
|
+
derives one, so two checkouts running the same app will collide on the same
|
|
519
|
+
fixed port unless the project's own `up` keeps them apart. Derive it there from
|
|
520
|
+
the slug — a hash, because nothing here tracks claims, so a collision is possible
|
|
521
|
+
and the script is where it surfaces:
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
PORT=$(( 3000 + $(printf '%s' "$WT_SLUG" | cksum | cut -d' ' -f1) % 100 ))
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Setup initializes the pair once and never touches it again: it points the keys at
|
|
528
|
+
the command the project already declares, or writes the two stubs that exit `78`
|
|
529
|
+
(see [`init.md`](init.md)). After that the keys and the scripts behind them are
|
|
530
|
+
the project's.
|
|
531
|
+
|
|
453
532
|
## Worktrees
|
|
454
533
|
|
|
455
534
|
Parallel work in one repo: a checkout per branch, each with its own derived
|
|
456
|
-
namespace
|
|
535
|
+
namespace, so two runs never fight over a working tree.
|
|
457
536
|
|
|
458
537
|
```yaml
|
|
459
538
|
worktrees:
|
|
460
539
|
enabled: true
|
|
461
540
|
dir: ~/.sassywares/worktrees
|
|
462
|
-
ports: 3000-3099
|
|
463
541
|
```
|
|
464
542
|
|
|
465
|
-
|
|
543
|
+
Two keys, no commands. The scripts in `.sassywares/worktree/` own the
|
|
466
544
|
mechanics and `sassy-worktree` orchestrates them.
|
|
467
545
|
|
|
468
546
|
**`enabled: true` is permission, not a default.** It makes a checkout available;
|
|
@@ -472,11 +550,11 @@ Two runs only collide when they are actually parallel, and an unasked checkout
|
|
|
472
550
|
relocates the work, leaves the uncommitted tree behind, and pays the setup hooks
|
|
473
551
|
for a checkout nobody needed.
|
|
474
552
|
|
|
475
|
-
**
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
file that may be absolute or start with `~/` — it names machine-local
|
|
479
|
-
something a teammate clones.
|
|
553
|
+
**Putting a stack in a checkout is the project's business.** The suite carries no
|
|
554
|
+
address and no port range, so the `up:`/`down:` pair is where a project
|
|
555
|
+
decides how its stack comes up and, if it needs one, which port. `dir` is the one
|
|
556
|
+
path in this file that may be absolute or start with `~/` — it names machine-local
|
|
557
|
+
state, not something a teammate clones.
|
|
480
558
|
|
|
481
559
|
**Two conditions.**
|
|
482
560
|
|
|
@@ -486,7 +564,7 @@ something a teammate clones.
|
|
|
486
564
|
- It needs the `repo` topology. A `workspace` root and a `none` folder have no
|
|
487
565
|
git to cut a checkout from.
|
|
488
566
|
|
|
489
|
-
The namespace, the
|
|
567
|
+
The namespace, the two hooks, and every refusal are in
|
|
490
568
|
[`worktree.md`](worktree.md).
|
|
491
569
|
|
|
492
570
|
## Dogfood
|
|
@@ -539,10 +617,14 @@ report layout, the verdict classes, and the lint are in
|
|
|
539
617
|
under `hooks.push`, `after_create`/`before_remove` under `hooks.worktree`, and
|
|
540
618
|
`before_slice`/`after_close` under `hooks.goal`, each a list of skill names
|
|
541
619
|
that resolve to `.agents/skills/<name>/SKILL.md`.
|
|
542
|
-
- `
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
620
|
+
- `up` and `down` are top-level single-line strings, each `<script> <args…>` or
|
|
621
|
+
`<skill> <args…>`, naming exactly one thing. Never a block, a list, or a
|
|
622
|
+
command chain (`&&`, `;`): the shell word after `down:` is resolved as one
|
|
623
|
+
command, so a chain would be run as arguments to the first word. The value is
|
|
624
|
+
split on whitespace, one argument per word, with no quote processing; quotes
|
|
625
|
+
are passed through as ordinary characters.
|
|
626
|
+
- `worktrees.enabled` is `true` or `false`. A checkout must resolve outside the
|
|
627
|
+
working tree and must not hold a branch `base_map` names as a base. An
|
|
546
628
|
`enabled: true` with no tooling installed, or with the wrong tooling version,
|
|
547
629
|
is drift.
|
|
548
630
|
- `commit.branch` is `current` or `new`; `pr.*` are `true` or `false`. Write
|
|
@@ -75,7 +75,7 @@ because a project that "helpfully" removes it commits screenshots by accident.
|
|
|
75
75
|
|
|
76
76
|
## catalog — a search returns matching products
|
|
77
77
|
|
|
78
|
-
**Preview:**
|
|
78
|
+
**Preview:** the catalog page, in a browser
|
|
79
79
|
|
|
80
80
|
**Upstream:** `api.example.com` — a service this run does not control. Down is
|
|
81
81
|
`env`, never a retry.
|
|
@@ -115,8 +115,9 @@ has no machine verdict" — the section still records what a person should check
|
|
|
115
115
|
and every QA row for it stays `Manual`.
|
|
116
116
|
|
|
117
117
|
**Steps after the `Prove it:` step are cleanup.** They always run, they never
|
|
118
|
-
change the exit code, and that is where a
|
|
119
|
-
Putting teardown before the verdict means a failed run leaves the
|
|
118
|
+
change the exit code, and that is where a process is stopped and its state
|
|
119
|
+
released. Putting teardown before the verdict means a failed run leaves the stack
|
|
120
|
+
running. Steps before
|
|
120
121
|
it set up state and assert along the way; the prove step is the machine-readable
|
|
121
122
|
answer. A section without one has no verdict.
|
|
122
123
|
|
|
@@ -133,11 +134,6 @@ the file-level value is the default every section inherits.
|
|
|
133
134
|
them, which is how a recipe ends up talking about the web app while claiming to
|
|
134
135
|
describe the project.
|
|
135
136
|
|
|
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
137
|
`**Uncovered:**` and `**Out of scope:**` stay **file level** — they are the inventory of
|
|
142
138
|
surfaces, not a description of one. Each name in that inventory still needs its own
|
|
143
139
|
section (see `**Uncovered:**` below).
|
|
@@ -148,16 +144,14 @@ checked — and no step has to consume this line: a suite that starts its own se
|
|
|
148
144
|
never visits the address a human would. The result — a URL, a simulator, a window — is the project's own answer
|
|
149
145
|
to "what is the address", and it is why the suite never has to assume a browser.
|
|
150
146
|
|
|
151
|
-
`$
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
default: `${WT_PORT:-5180}`. One expansion that works in both places is what
|
|
156
|
-
keeps a recipe runnable outside a worktree.
|
|
147
|
+
`$WT_PATH`, `$WT_BRANCH`, `$WT_SLUG`, and `$WT_NAMESPACE` reach a recipe only as
|
|
148
|
+
the environment the caller exports — nothing substitutes them into a step. A
|
|
149
|
+
recipe must also run in the **main checkout**, where no worktree exists, so every
|
|
150
|
+
value it needs has to resolve in both places.
|
|
157
151
|
|
|
158
152
|
| Project | Preview line |
|
|
159
153
|
|---|---|
|
|
160
|
-
| Web | `
|
|
154
|
+
| Web | `the page the app serves — open it in a browser` |
|
|
161
155
|
| Mobile | `simulator "$WT_NAMESPACE"` — booted by the `after_create` hook |
|
|
162
156
|
| Desktop | `the app window is already open` |
|
|
163
157
|
| CLI | *(none — there is nothing to look at)* |
|
|
@@ -216,8 +210,8 @@ configured. Two things follow, and they are all this file says about it:
|
|
|
216
210
|
never carries a value.
|
|
217
211
|
- **The procedure says how it is obtained and used** — in *Set up once*, in
|
|
218
212
|
`**Preview:**`, or in a plain section of its own. `mode:discover` writes it
|
|
219
|
-
once, after finding out what actually works, and `mode:run`
|
|
220
|
-
|
|
213
|
+
once, after finding out what actually works, and `mode:run` stops with an
|
|
214
|
+
env-class report when the session is missing
|
|
221
215
|
rather than retrying against a login page.
|
|
222
216
|
|
|
223
217
|
A worktree gets a fresh, empty `session/`. When a project's provider registers a
|
|
@@ -10,7 +10,7 @@ The path argument, else the working directory. `init` is the default mode; the m
|
|
|
10
10
|
|
|
11
11
|
Run `scripts/detect.sh --root <path>`. It prints a proposed config: topology (`repo`, `workspace`, `none`), the remote name, a probed base branch, and nested repos with their bases.
|
|
12
12
|
|
|
13
|
-
**A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, `artifacts
|
|
13
|
+
**A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, `artifacts.*`, and the top-level `up`/`down` pair. A default is not an answer: writing the blank slate here would retarget `"*"` away from the integration branch the project actually uses and delete its hooks. Present the result as a **diff against the file, key by key**, and ask before writing.
|
|
14
14
|
|
|
15
15
|
## 3. Ask only what detection cannot answer
|
|
16
16
|
|
|
@@ -24,8 +24,13 @@ Never re-ask what the tree already said.
|
|
|
24
24
|
- **`commit.branch`** — default `new`: the run cuts a branch before the first change and never commits on a base branch. Offer `current` for a repo that genuinely wants work committed where it stands, and say plainly that `current` lets a run commit onto its base branch and push it, with no PR (`pr.*` and `hooks.pr` are ignored; `hooks.push` runs), and that a later `sassy-ship` run in `mode:auto` will then push to that base with no gate.
|
|
25
25
|
- **`pr.*`** — default `babysit: true`, `merge: false`, `delete_branch: false`. Say plainly that `merge: true` authorizes merging every babysat PR in this project without asking.
|
|
26
26
|
- **Hooks** — offer, do not impose. Ask whether the project wants steps injected at `before_create`, `after_create`, `before_merge`, or `after_merge` (or `hooks.push` `after_push`, for `commit.branch: current` only), and under which head branch (`"*"` for all). Also offer goal hooks — `before_slice` and `after_close` under `hooks.goal`, keyed by the goal slug — as base refresh, environment preparation, and boundary announcements that never touch the goal itself and leave every base level with its remote. Entries may carry args (`<skill> <args…>`); a hook skill's args are its own vocabulary. Leave them `[]` when there is nothing to add. **Never write a hook skill yourself** — hooks are project skills, and copying one of ours into that role is the fork this mechanism exists to prevent.
|
|
27
|
-
- **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace
|
|
27
|
+
- **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace, so two runs never fight over one working tree. Say plainly what it costs and what it needs. `false` — the run works here, which is today's behaviour. `true` — a run may *offer* a checkout and takes one only on your yes, or outright when the run carries a `worktree:on` token, and `sassy-worktree` gains `create`, `list`, `remove`, and `prune`. It needs `commit.branch: new`: under `current` nothing ever cuts a branch, so the switch would do nothing — say so and leave it `false` rather than writing a setting that cannot fire. In `workspace` or `none` topology, say it is not available and write `false`. Read `references/worktree.md`. **Say what a checkout will need for this project** — install, `.env` derivation, a per-namespace database, a simulator, the session — and offer to create the hook with `sassy-skill`; **never write its body yourself**. With no hook, say plainly that every new checkout starts empty.
|
|
28
28
|
- **Dogfood** — ask whether the project wants agent QA: a stored procedure that proves a change works in the running product, which then lets `sassy-plan` write `Mode: Auto` QA rows instead of manual ones. Say plainly what each answer means. `false` — every QA row stays a human's, which is today's behavior. `true` — a plan may write Auto rows, but only for a recipe section that carries a `Prove it:` step, so the switch alone never makes a gate prove something. Write the answer explicitly either way; never leave it to inference. On yes, scaffold per step 4 and offer to run the first `sassy-dogfood mode:discover` before this run ends: yes means do it now (it is the only step that knows how to bring this app up), no means hand over the command and say the recipe stays a skeleton until it runs. Read `references/dogfood.md` and **never** write a command into the block or author the procedure: the recipe is the project's, and its first real content comes from a `sassy-dogfood mode:discover` run.
|
|
29
|
+
- **Lifecycle** — how this project's stack starts and stops: the top-level `up:` and `down:` keys. Probe before asking — run `bash <sassy-overview skill>/scripts/identify.sh --root <path> up down` and read its `key<TAB>value<TAB>source` lines; exit `0` means the project already declares both, exit `3` means at least one is `unknown`. Two outcomes, each an offer, never an imposition:
|
|
30
|
+
- **It answers** — a `dev`/`start`/`up`/`serve` target in a `Makefile` or `justfile`, or a compose file. When identify reports both `unknown` but an executable `dev` exists at the probed path (`bin/`, then `tool/`, then `scripts/`), that is an answer too: `up: bin/dev`. Offer each key on its own, pointing at **exactly** what was found — `up: just dev`, `down: just down`, `up: bin/dev` — naming the source identify reported or the script you found. On yes, write the keys and **write no file**: the command exists, and a copy in a downloaded script would drift from it. A key with no answer stays absent rather than becoming a guess.
|
|
31
|
+
- **It does not** — identify left the key `unknown` and nothing else declares it, so there is nothing to point at. Offer the stubs for whichever keys are still unanswered: the two files from `assets/lifecycle/`, copied to the first of `bin/`, `tool/`, `scripts/` that exists (or a new `bin/` when none does), and set `up: <dir>/up`, `down: <dir>/down`.
|
|
32
|
+
|
|
33
|
+
Declining both leaves the keys absent, which is **no lifecycle** — say it plainly and never invent a command. A file already sitting at either stub path is shown and asked about, never overwritten.
|
|
29
34
|
|
|
30
35
|
## 4. Write the config
|
|
31
36
|
|
|
@@ -33,6 +38,12 @@ Build the file from the proposal plus the answers. It is written **fully comment
|
|
|
33
38
|
|
|
34
39
|
**The dogfood scaffold, only when the answer was yes.** Create `.sassywares/dogfood/` holding `recipe.md` copied verbatim from `assets/dogfood-recipe.md`, and `.sassywares/.gitignore` with two lines — `/session/` and `/dogfood/reports/` — adding them to a `.gitignore` that already exists rather than replacing it. Never overwrite an existing recipe — show it and ask. The skeleton is deliberately incomplete: it carries the shape and the rules and fills in nothing, because `sassy-dogfood mode:discover` writes the procedure from what actually worked. Say so in the report — `enabled: true` is a permission, not a promise that a check exists.
|
|
35
40
|
|
|
41
|
+
**The lifecycle pair, when step 3 accepted one.** Write `up:` and `down:` as two top-level keys, each naming one thing: the project's own declared command (`up: just dev`), or the two stub paths. They sit at the top level, never under `worktrees:`. The shape and the contract are `references/config.md`'s Lifecycle section.
|
|
42
|
+
|
|
43
|
+
When there was no answer and the user accepted the stubs, copy `assets/lifecycle/up` and `assets/lifecycle/down` to `<dir>/up` and `<dir>/down` and make them executable; do not write a longer body. Their headers carry the contract, and both exit `78` while unimplemented — `remove` treats that as a warning and removes anyway, while any other non-zero status aborts.
|
|
44
|
+
|
|
45
|
+
**From then on they are the project's.** Setup writes the pair once; no later run edits the keys or the stub bodies, and `check` reports an absent pair as **no lifecycle** instead of proposing one. Say in the report which two values the keys name, or that the project declares no lifecycle.
|
|
46
|
+
|
|
36
47
|
## 5. Wire the skills and the agents
|
|
37
48
|
|
|
38
49
|
Both install the same way: report the scope if the pieces are present, otherwise ask once where to install, recommending user scope.
|
|
@@ -69,8 +80,10 @@ Both install the same way: report the scope if the pieces are present, otherwise
|
|
|
69
80
|
|
|
70
81
|
Two independent sets, each only when its answer was yes.
|
|
71
82
|
|
|
72
|
-
- **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the
|
|
73
|
-
|
|
83
|
+
- **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the four scripts executable. **That is the install.** They are run by path, so do not require a command runner and do not create or extend one to hold aliases: a `package.json` written into a Go, Python, or Dart project so four aliases have a home is a file the project did not ask for. When a file that already carries named commands exists (`package.json` `scripts`, `deno.json` `tasks`, `composer.json` `scripts`, a make/just target), **offer** the `worktree:<script>` aliases per `references/workspace.md`'s merge rules — append-only, proven to parse with that file's own tool, `git diff` added-lines only, restored from `HEAD` if not. Declining is a complete install. Name the scripts' path in the report either way — no version header: `--check` hashes the installed files against the copy this skill ships, not a version line. **Overwrite them without asking** when they already exist — the set is suite-owned and read-only, so a differing byte is drift for a re-run to replace, not a project edit to preserve. Read `references/worktree.md`. Do not create a worktree, and do not run a script: installing is the whole job, and the first `create` belongs to the user — a run asks, or takes one on `worktree:on`.
|
|
84
|
+
|
|
85
|
+
What a life cycle does and does not do here: `create` runs a checkout's `hooks.worktree.after_create` and **never** `up`, because provisioning has to terminate and a running stack does not; `remove` runs the configured `down:` before it deletes, after its guards pass. Nothing in the suite starts a stack — that is the project's or the user's, run from the checkout with the `WT_*` block.
|
|
86
|
+
- **Workspace, `workspace` topology only.** The snapshot plus the `branches` / `pull` / `checkout-bases` git helpers, run by path. Aliases are an offer into a command file the root already has — never a `package.json` created for them. Read `references/workspace.md` and follow it.
|
|
74
87
|
|
|
75
88
|
Then return to `SKILL.md` for steps 7–9.
|
|
76
89
|
|
|
@@ -86,3 +99,4 @@ Then return to `SKILL.md` for steps 7–9.
|
|
|
86
99
|
| Dogfood is a pointer | The block names a recipe, a reports path, a timeout, and whether Auto rows are allowed — four keys. Never a command and never a tool: a copied command duplicates the manifest and cannot express step order. |
|
|
87
100
|
| The recipe is the project's | Setup scaffolds the skeleton and stops. Authoring or "fixing" a procedure is `sassy-dogfood mode:discover`'s job, and a run may never edit the recipe to make its own failure pass. |
|
|
88
101
|
| Worktrees need `new` | `worktrees.enabled: true` with `commit.branch: current` is refused, not written: nothing cuts a branch there, so the switch could never fire. |
|
|
102
|
+
| The lifecycle is written once | `up`/`down` are initialized and then left alone: no re-run edits the keys or the stub bodies, and an absent pair is reported as **no lifecycle** rather than invented. |
|
|
@@ -27,8 +27,8 @@ lives under one directory:
|
|
|
27
27
|
`_lib.sh`'s `workspace-git-version` (or `branches --version`) the same way.
|
|
28
28
|
**Ask before overwriting any of them when they already exist** — from the first
|
|
29
29
|
install on they are the project's files, and extending them is expected.
|
|
30
|
-
- **Aliases.**
|
|
31
|
-
|
|
30
|
+
- **Aliases.** Optional, and only into a command file the project already has.
|
|
31
|
+
The scripts work by path without them. See below.
|
|
32
32
|
- **Excludes.** Write `.sassywares/workspace/.gitignore` for excluded paths
|
|
33
33
|
(vendored trees, generated dirs, `.run/`). One pattern per line, `.gitignore`
|
|
34
34
|
style. Skip it when there is nothing to exclude; the sync works without it. The
|
|
@@ -38,34 +38,38 @@ lives under one directory:
|
|
|
38
38
|
- Do **not** run the snapshot during setup. It clones and pushes; that is the
|
|
39
39
|
user's call. Offer `--dry-run` and run it only if they ask.
|
|
40
40
|
|
|
41
|
-
## Script aliases
|
|
41
|
+
## Script aliases (optional)
|
|
42
42
|
|
|
43
|
-
The scripts
|
|
44
|
-
alias per installed script:
|
|
43
|
+
The scripts are executable and tracked, so the whole contract is the path itself:
|
|
45
44
|
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"workspace:snapshot": ".sassywares/workspace/snapshot"
|
|
52
|
-
}
|
|
45
|
+
```bash
|
|
46
|
+
.sassywares/workspace/branches # branch + dirty marker per repo
|
|
47
|
+
.sassywares/workspace/pull # fetch, then ff-only per repo
|
|
48
|
+
.sassywares/workspace/checkout-bases # put each repo on its base
|
|
49
|
+
.sassywares/workspace/snapshot # commit + push the glue
|
|
53
50
|
```
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
That works in every shell, hook, and delegation brief, and it is what the setup
|
|
53
|
+
README tells the user. Aliases are an offer, not a step: if the project **already**
|
|
54
|
+
has a file at the **workspace root only** — never inside a repo — that carries
|
|
55
|
+
named commands, setup may add one entry per installed script so they are also
|
|
56
|
+
reachable from the project's own runner.
|
|
57
57
|
|
|
58
|
-
|
|
|
58
|
+
| Already at the root | Add the aliases to |
|
|
59
59
|
| --- | --- |
|
|
60
60
|
| `package.json` | its `scripts` |
|
|
61
61
|
| `deno.json` / `deno.jsonc` | its `tasks` |
|
|
62
62
|
| `composer.json` | its `scripts` |
|
|
63
|
-
| `
|
|
63
|
+
| `Makefile` / `justfile` | a `workspace:<script>` target, if the user wants one at all |
|
|
64
|
+
| `go.mod`, `pyproject.toml`, `Cargo.toml`, `Gemfile`, `pubspec.yaml`, `pom.xml`, … | **nowhere** — these name dependencies, not commands. Run the scripts by path |
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
**Never create a file to hold an alias.** Not a `package.json` in a Go, Python, or
|
|
67
|
+
Dart project, not a `Makefile` to dodge one. A manifest that exists only so five
|
|
68
|
+
aliases have a home is a file the project has to maintain and the next reader has
|
|
69
|
+
to explain, and the scripts already work without it. Skipping the aliases is a
|
|
70
|
+
complete install: say in the report that the scripts are run by path, and why.
|
|
71
|
+
|
|
72
|
+
When there is a file to wire, and the user says yes:
|
|
69
73
|
|
|
70
74
|
- **Name and value are fixed**: `workspace:<script>` → `.sassywares/workspace/<script>`.
|
|
71
75
|
No `./`, no absolute paths, no `bin/`.
|
|
@@ -74,20 +78,9 @@ one file fewer.
|
|
|
74
78
|
Never touch dependencies, `postinstall`, or `skills:*`.
|
|
75
79
|
- **Idempotent**: a matching alias is left alone, a stale value is corrected, and
|
|
76
80
|
an alias the project added itself is never removed.
|
|
77
|
-
- **
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"private": true,
|
|
83
|
-
"scripts": { … }
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
`private: true` keeps it unpublishable; no `name`, no `version`, no
|
|
88
|
-
dependencies. It exists so the aliases have a home. **Say that in the report** —
|
|
89
|
-
created versus already there — and skip the aliases entirely when the project
|
|
90
|
-
has removed the scripts they point at.
|
|
81
|
+
- **Prove the file still parses** with that file's own tool, and keep `git diff`
|
|
82
|
+
to added lines. An alias pointing at a script that is not installed is not
|
|
83
|
+
added at all.
|
|
91
84
|
|
|
92
85
|
## What the git helpers are for
|
|
93
86
|
|