@sassywares/skills 0.12.1 → 0.13.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 +28 -15
- package/README.md +41 -34
- 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 +6 -6
- 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 +23 -0
- package/skills/sassy-setup/references/config.md +62 -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 +127 -51
- 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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Show every worktree of this repo: branch, path, whether its tree is dirty,
|
|
3
|
-
#
|
|
2
|
+
# Show every worktree of this repo: branch, path, whether its tree is dirty, the
|
|
3
|
+
# upstream it tracks, and whether its work is merged there.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
5
|
+
# Read-only: nothing here creates, edits, or deletes a checkout.
|
|
6
|
+
#
|
|
7
|
+
# Usage: .sassywares/worktree/list [--path <slug>] [--env <slug|branch>] [--version]
|
|
6
8
|
set -euo pipefail
|
|
7
9
|
|
|
8
10
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -11,26 +13,33 @@ source "$SCRIPT_DIR/_lib.sh"
|
|
|
11
13
|
|
|
12
14
|
usage() {
|
|
13
15
|
cat <<'EOF'
|
|
14
|
-
Usage: .sassywares/worktree/list [--path <slug>]
|
|
16
|
+
Usage: .sassywares/worktree/list [--path <slug>] [--env <slug|branch>]
|
|
15
17
|
|
|
16
|
-
Print every worktree with its branch, path, dirty state, and
|
|
18
|
+
Print every worktree with its branch, path, dirty state, upstream, and state
|
|
19
|
+
(merged / gone / unmerged).
|
|
17
20
|
|
|
18
|
-
--path <slug>
|
|
21
|
+
--path <slug> print only the path of one worktree (for cd "$(...)")
|
|
22
|
+
--env <slug|branch> print only the four WT_* identity lines of one worktree
|
|
19
23
|
EOF
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
want=""
|
|
27
|
+
env_target=""
|
|
23
28
|
while [ $# -gt 0 ]; do
|
|
24
29
|
case "$1" in
|
|
25
30
|
-h|--help) usage; exit 0 ;;
|
|
26
31
|
--version) printf '%s\n' "$WT_VERSION"; exit 0 ;;
|
|
27
|
-
--path) shift; want="${1:-}"; [ -n "$want" ] ||
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
--path) shift; want="${1:-}"; [ -n "$want" ] || { usage >&2; exit 2; } ;;
|
|
33
|
+
--env) shift; env_target="${1:-}"; [ -n "$env_target" ] || { usage >&2; exit 2; } ;;
|
|
34
|
+
--env=*) env_target="${1#*=}"; [ -n "$env_target" ] || { usage >&2; exit 2; } ;;
|
|
35
|
+
-*) usage >&2; exit 2 ;;
|
|
36
|
+
*) usage >&2; exit 2 ;;
|
|
30
37
|
esac
|
|
31
38
|
shift
|
|
32
39
|
done
|
|
33
40
|
|
|
41
|
+
[ -z "$env_target" ] || [ -z "$want" ] || { usage >&2; exit 2; }
|
|
42
|
+
|
|
34
43
|
need_git
|
|
35
44
|
|
|
36
45
|
if [ -n "$want" ]; then
|
|
@@ -41,7 +50,35 @@ if [ -n "$want" ]; then
|
|
|
41
50
|
exit 0
|
|
42
51
|
fi
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
if [ -n "$env_target" ]; then
|
|
54
|
+
# An identity handed back, so it goes to exactly one checkout. Collect every
|
|
55
|
+
# match instead of taking the first: two branches can slug to the same name
|
|
56
|
+
# (`feat/x` and `feat-x`), and a silent first pick would hand a caller another
|
|
57
|
+
# branch's checkout.
|
|
58
|
+
count=0
|
|
59
|
+
found=""
|
|
60
|
+
names=""
|
|
61
|
+
while IFS=$'\t' read -r p b; do
|
|
62
|
+
[ -n "$p" ] || continue
|
|
63
|
+
if [ "$b" != "$env_target" ] && [ "$(wt_slug "$b")" != "$env_target" ]; then
|
|
64
|
+
continue
|
|
65
|
+
fi
|
|
66
|
+
count=$(( count + 1 ))
|
|
67
|
+
found="$p"$'\t'"$b"
|
|
68
|
+
names="${names:+$names, }$b"
|
|
69
|
+
done < <(wt_all)
|
|
70
|
+
[ "$count" -gt 0 ] || die "no worktree for '$env_target' (try: list)"
|
|
71
|
+
[ "$count" -eq 1 ] || die "'$env_target' matches $count worktrees ($names) — pass the branch name of exactly one"
|
|
72
|
+
p="${found%%$'\t'*}"
|
|
73
|
+
b="${found##*$'\t'}"
|
|
74
|
+
wt_is_main "$p" && die "the main checkout is not a worktree"
|
|
75
|
+
wt_managed "$p" \
|
|
76
|
+
|| die "'$env_target' is not managed here — it is outside the worktree home, or it was cut before the wiring"
|
|
77
|
+
wt_print_env "$p" "$b" "$(wt_slug "$b")"
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
printf ' %-34s %-50s %-6s %-24s %s\n' "BRANCH" "WORKTREE" "DIRTY" "UPSTREAM" "STATE"
|
|
45
82
|
count=0
|
|
46
83
|
unmanaged=0
|
|
47
84
|
while IFS=$'\t' read -r p b; do
|
|
@@ -49,16 +86,20 @@ while IFS=$'\t' read -r p b; do
|
|
|
49
86
|
count=$(( count + 1 ))
|
|
50
87
|
shown="${p/#$HOME/~}"
|
|
51
88
|
label="$b"
|
|
89
|
+
state="—"
|
|
52
90
|
if wt_is_main "$p"; then
|
|
53
91
|
label="$b (main checkout)"
|
|
54
92
|
elif ! wt_managed "$p"; then
|
|
55
93
|
# No git calls for a checkout that is not ours: it is counted, never listed.
|
|
56
94
|
unmanaged=$(( unmanaged + 1 ))
|
|
57
95
|
continue
|
|
96
|
+
else
|
|
97
|
+
# Only a managed checkout is ever removable, so only one gets a state.
|
|
98
|
+
state="$(wt_upstream_state "$p")"
|
|
58
99
|
fi
|
|
59
100
|
if wt_dirty "$p"; then dirty="yes"; else dirty="no"; fi
|
|
60
101
|
up="$(wt_upstream "$p")"
|
|
61
|
-
printf ' %-34s %-50s %-6s %s\n' "$(short_path "$label" 34)" "$(short_path "$shown" 50)" "$dirty" "${up:-—}"
|
|
102
|
+
printf ' %-34s %-50s %-6s %-24s %s\n' "$(short_path "$label" 34)" "$(short_path "$shown" 50)" "$dirty" "${up:-—}" "$state"
|
|
62
103
|
done < <(wt_all)
|
|
63
104
|
|
|
64
105
|
[ "$count" -gt 0 ] || log " no checkouts found — is this a git repository?"
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
# Remove a worktree, after proving nothing would be lost.
|
|
3
3
|
#
|
|
4
4
|
# Refuses: the main checkout, a dirty tree, and commits that are on no remote.
|
|
5
|
-
#
|
|
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
|
|
8
|
-
# says the hook has been dispatched.
|
|
5
|
+
# Only the checkout goes — the branch survives, so the work stays reachable.
|
|
9
6
|
#
|
|
10
|
-
# Usage: .sassywares/worktree/remove <slug|branch> [--
|
|
7
|
+
# Usage: .sassywares/worktree/remove <slug|branch> [--force]
|
|
11
8
|
# .sassywares/worktree/remove --version
|
|
12
9
|
set -euo pipefail
|
|
13
10
|
|
|
@@ -17,27 +14,22 @@ source "$SCRIPT_DIR/_lib.sh"
|
|
|
17
14
|
|
|
18
15
|
usage() {
|
|
19
16
|
cat <<'EOF'
|
|
20
|
-
Usage: .sassywares/worktree/remove <slug|branch> [--
|
|
17
|
+
Usage: .sassywares/worktree/remove <slug|branch> [--force]
|
|
21
18
|
|
|
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)
|
|
25
19
|
--force skip the dirty-tree and unpushed-commit refusals. Never skips the
|
|
26
|
-
main checkout
|
|
20
|
+
main checkout.
|
|
27
21
|
EOF
|
|
28
22
|
}
|
|
29
23
|
|
|
30
24
|
target=""
|
|
31
|
-
hook_ok=0
|
|
32
25
|
force=0
|
|
33
26
|
while [ $# -gt 0 ]; do
|
|
34
27
|
case "$1" in
|
|
35
28
|
-h|--help) usage; exit 0 ;;
|
|
36
29
|
--version) printf '%s\n' "$WT_VERSION"; exit 0 ;;
|
|
37
|
-
--hook-ok) hook_ok=1 ;;
|
|
38
30
|
--force) force=1 ;;
|
|
39
|
-
-*)
|
|
40
|
-
*) [ -z "$target" ] ||
|
|
31
|
+
-*) usage >&2; exit 2 ;;
|
|
32
|
+
*) [ -z "$target" ] || { usage >&2; exit 2; }; target="$1" ;;
|
|
41
33
|
esac
|
|
42
34
|
shift
|
|
43
35
|
done
|
|
@@ -47,13 +39,12 @@ need_git
|
|
|
47
39
|
rec="$(wt_require "$target")" || exit 1
|
|
48
40
|
path="${rec%%$'\t'*}"
|
|
49
41
|
branch="${rec##*$'\t'}"
|
|
50
|
-
slug="$(wt_slug "$branch")"
|
|
51
42
|
|
|
52
43
|
wt_is_main "$path" && die "that is the main checkout — it cannot be removed"
|
|
53
44
|
wt_managed "$path" || die "'$target' is not managed here — it is outside the worktree home, or it was cut before the wiring"
|
|
54
45
|
|
|
55
|
-
# Refuse before
|
|
56
|
-
#
|
|
46
|
+
# Refuse before touching anything: a checkout we would not delete should not be
|
|
47
|
+
# half-removed on the way to that refusal.
|
|
57
48
|
if [ "$force" -eq 0 ]; then
|
|
58
49
|
wt_dirty "$path" && die "not clean — $(git -C "$path" status --porcelain | wc -l | tr -d ' ') path(s) modified. Commit, discard, or --force."
|
|
59
50
|
n="$(wt_unpushed "$path")"
|
|
@@ -64,70 +55,6 @@ if [ "$force" -eq 0 ]; then
|
|
|
64
55
|
esac
|
|
65
56
|
fi
|
|
66
57
|
|
|
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
58
|
if [ "$force" -eq 1 ]; then
|
|
132
59
|
removed_ok=0
|
|
133
60
|
git worktree remove --force "$path" && removed_ok=1
|
|
@@ -141,5 +68,5 @@ if [ "$removed_ok" -eq 0 ]; then
|
|
|
141
68
|
printf ' %s\n' "(\`git worktree prune\` only matters if \`git worktree list\` still names it)" >&2
|
|
142
69
|
exit 1
|
|
143
70
|
fi
|
|
144
|
-
ok removed "$path"
|
|
145
|
-
ok branch "$branch — the branch stays, so the work is still reachable"
|
|
71
|
+
ok removed "$path" >&2
|
|
72
|
+
ok branch "$branch — the branch stays, so the work is still reachable" >&2
|
|
@@ -87,8 +87,8 @@ ask at step 6, never a token of its own. There is no `worktree:ask`.
|
|
|
87
87
|
`worktrees.enabled: true` (per `worktree.md`) means this project *allows* a
|
|
88
88
|
checkout. It is permission, not a default: two runs only collide when they are
|
|
89
89
|
actually parallel, so guessing wrong moves the work to another directory,
|
|
90
|
-
leaves the uncommitted tree behind, and spends the
|
|
91
|
-
checkout nobody needed. Ask once, here, with the branch named — *this
|
|
90
|
+
leaves the uncommitted tree behind, and spends the project's create-script setup
|
|
91
|
+
on a checkout nobody needed. Ask once, here, with the branch named — *this
|
|
92
92
|
checkout, or a worktree of its own?* — and take the answer, **unless the
|
|
93
93
|
caller forwarded a `worktree:` token**, which is the user answering before
|
|
94
94
|
being asked. Silence is not a yes, and never ask when the answer cannot
|
|
@@ -13,3 +13,26 @@ A check run never edits the config, never installs a skill or an agent, never re
|
|
|
13
13
|
|------|-------------|
|
|
14
14
|
| Check reports, init repairs | Every finding is reported with `mode:init` as its fix. Nothing is corrected in place, approved or not. |
|
|
15
15
|
| No detection | A check compares the file to the tree; it never re-derives the config from the tree and calls the difference drift. |
|
|
16
|
+
|
|
17
|
+
## What a worktree finding means
|
|
18
|
+
|
|
19
|
+
`worktrees.create` and `worktrees.remove` are the project's own files, so a check
|
|
20
|
+
never hashes them and never treats them as suite-owned. Five outcomes:
|
|
21
|
+
|
|
22
|
+
- **Declared and executable** — a note naming the path. Nothing to do.
|
|
23
|
+
- **Declared but missing or not executable** — a note, never drift:
|
|
24
|
+
`worktrees.create 'scripts/worktrees/create' is missing or not executable — the built-in .sassywares/worktree/create is used instead`. Report it so the user can restore the file or drop the key.
|
|
25
|
+
- **A wrong shape** — whitespace, an absolute or `~/` path, `..`, a list, or a
|
|
26
|
+
block — is drift: `--check` names the key and the value, and the fix is one
|
|
27
|
+
relative path with no arguments.
|
|
28
|
+
- **No `sassywares:scaffold` header** — a note naming the file: it carries no
|
|
29
|
+
header, so the run cannot tell whether it prints the `WT_*` block. Provenance,
|
|
30
|
+
never drift.
|
|
31
|
+
- **A legacy key** — `up:`, `down:`, or `hooks.worktree` — a `drift:` line that
|
|
32
|
+
names the key, says the lifecycle moved into the project's create/remove
|
|
33
|
+
scripts, and gives the exact edit (delete the `up:`/`down:` line, or the
|
|
34
|
+
`worktree:` block under `hooks`). The fix is `mode:init` and only when the user
|
|
35
|
+
asks for it; a check never deletes the key itself.
|
|
36
|
+
|
|
37
|
+
A scaffold header's `version=` is provenance, not a pin, so an old scaffold
|
|
38
|
+
version is never drift — [`scaffold-header.md`](scaffold-header.md).
|
|
@@ -85,21 +85,16 @@ hooks:
|
|
|
85
85
|
push:
|
|
86
86
|
"*":
|
|
87
87
|
after_push: [] # commit.branch: current only
|
|
88
|
-
# worktree: # worktrees only; keyed by the checkout's branch
|
|
89
|
-
# "*":
|
|
90
|
-
# after_create: [] # derive .env, seed, copy the session
|
|
91
|
-
# before_remove: [] # drop the database, shut the device
|
|
92
88
|
worktrees:
|
|
93
89
|
enabled: false # true = a run may offer its own checkout
|
|
94
90
|
dir: ~/.sassywares/worktrees # parent of the per-repo folder; ~ is allowed here
|
|
91
|
+
create: scripts/worktrees/create # this project's prepare step; absent = built-in
|
|
92
|
+
remove: scripts/worktrees/remove # this project's teardown; absent = built-in
|
|
95
93
|
dogfood:
|
|
96
94
|
enabled: false # true = sassy-plan writes Mode: Auto QA rows
|
|
97
95
|
recipe: .sassywares/dogfood/recipe.md # the procedure
|
|
98
96
|
reports: .sassywares/dogfood/reports # run output, never committed
|
|
99
97
|
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
|
|
103
98
|
```
|
|
104
99
|
|
|
105
100
|
| Key | Default | Meaning |
|
|
@@ -123,17 +118,16 @@ down: just down
|
|
|
123
118
|
| `hooks.goal.<slug>.before_slice` | `[]` | Project steps as `sassy-goal mode:next` picks a slice, keyed by goal slug (see Goal hooks) |
|
|
124
119
|
| `hooks.goal.<slug>.after_close` | `[]` | Project steps as `sassy-goal mode:close` persists the status, keyed by goal slug |
|
|
125
120
|
| `hooks.push.<pattern>.after_push` | `[]` | Project steps after a push, keyed by the pushed branch (see Hooks) |
|
|
126
|
-
| `hooks.worktree.<pattern>.<point>` | `[]` | Project steps across a checkout's life, keyed by the head branch it holds |
|
|
127
121
|
| `dogfood.enabled` | `false` | `true` lets a plan write automated QA rows. Absent means `false` — manual QA, today's behavior |
|
|
128
122
|
| `dogfood.recipe` | `.sassywares/dogfood/recipe.md` | The stored procedure `sassy-dogfood` executes. Its `Prove it:` step is the verdict |
|
|
129
123
|
| `dogfood.reports` | `.sassywares/dogfood/reports` | Where a run writes its summary, step logs, and artifacts. Must be gitignored |
|
|
130
124
|
| `dogfood.timeout` | `900` | Wall-clock for one run. A timeout is a failure, never a hang |
|
|
131
125
|
| `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` |
|
|
132
126
|
| `worktrees.dir` | `~/.sassywares/worktrees` | Parent of the per-repo worktree folder. The one path here that may be absolute or `~/` |
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
127
|
+
| `worktrees.create` | absent | The project's own prepare step: one executable path, no arguments. Absent uses the built-in `.sassywares/worktree/create` silently; a declared file that is missing or not executable falls back to it with a warning naming the key and the file |
|
|
128
|
+
| `worktrees.remove` | absent | The project's own teardown step: one executable path, no arguments. Same silent built-in for an absent key, same warning for a declared file that is missing or not executable |
|
|
135
129
|
|
|
136
|
-
Paths are relative to the
|
|
130
|
+
Paths are relative to the project root — the folder holding `.sassywares/` — never to the cwd. `worktrees.dir` is the one exception: it may be absolute or start with `~/`, because it names machine-local state, not something a teammate clones. `worktrees.create` and `worktrees.remove` are relative paths and must name executable files.
|
|
137
131
|
|
|
138
132
|
## `git.repo` — the three topologies
|
|
139
133
|
|
|
@@ -332,15 +326,10 @@ targets. `hooks.pr.staging` means *PRs whose source is staging*. The exception i
|
|
|
332
326
|
| `before_merge` | `sassy-babysit` | the PR looks ready **and** this run will merge it |
|
|
333
327
|
| `after_merge` | `sassy-babysit` | this run observed the PR merged |
|
|
334
328
|
| `hooks.push.after_push` | `sassy-ship` | right after a successful push under `commit.branch: current` |
|
|
335
|
-
| `hooks.worktree.after_create` | `sassy-worktree` | just after a checkout exists, before anyone works in it |
|
|
336
|
-
| `hooks.worktree.before_remove` | `sassy-worktree` | before the checkout is deleted — drop its database, shut its device |
|
|
337
329
|
| `hooks.goal.before_slice` | `sassy-goal` | mode:next, once the slice is picked and the previous one's merge is confirmed, before the base check |
|
|
338
330
|
| `hooks.goal.after_close` | `sassy-goal` | mode:close, once the goal status is persisted |
|
|
339
331
|
|
|
340
|
-
`hooks.worktree`
|
|
341
|
-
by the head branch the checkout holds. It needs `worktrees.enabled`; a shell
|
|
342
|
-
script cannot dispatch a skill, so `.sassywares/worktree/remove` fails closed (exit `3`,
|
|
343
|
-
`require-hook <name>`) until the caller has run it.
|
|
332
|
+
**The worktree points are gone.** `hooks.worktree` is a named error in `--check`: what a checkout prepares and disposes now lives in `worktrees.create`/`worktrees.remove` (see Lifecycle), so a shell script no longer dispatches a skill and there is no handshake to solve. Move an `after_create` step into the create script's after-the-checkout slot and a `before_remove` step into the remove script's stop slot.
|
|
344
333
|
|
|
345
334
|
`hooks.push` has the same shape and resolution as `hooks.pr`, but its key is the
|
|
346
335
|
pushed head branch and its only point is `after_push`. It runs only under
|
|
@@ -452,81 +441,51 @@ partial failures explicitly. Never collapse it into one status.
|
|
|
452
441
|
fan-out means one `sassy-babysit` run per PR; merging a fan-out needs an explicit
|
|
453
442
|
per-PR say-so, because one switch would merge N PRs nobody re-read.
|
|
454
443
|
|
|
455
|
-
## Lifecycle — `
|
|
444
|
+
## Lifecycle — `worktrees.create` and `worktrees.remove`
|
|
456
445
|
|
|
457
|
-
|
|
458
|
-
|
|
446
|
+
The project owns what a checkout needs beyond git. Two keys point at two scripts
|
|
447
|
+
the project writes once:
|
|
459
448
|
|
|
460
449
|
```yaml
|
|
461
|
-
|
|
450
|
+
worktrees:
|
|
451
|
+
create: scripts/worktrees/create
|
|
452
|
+
remove: scripts/worktrees/remove
|
|
462
453
|
```
|
|
463
454
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
**`down` runs before the checkout goes.** `remove` resolves the key after its
|
|
484
|
-
guards pass and before deleting anything, so a failing `down` aborts the removal
|
|
485
|
-
and a dirty checkout is never stopped on the way to a refusal. The `--hook-ok`
|
|
486
|
-
re-run does not run `down` again: it continues the same removal, and a successful
|
|
487
|
-
first run already stopped the stack.
|
|
488
|
-
|
|
489
|
-
**A generated stub exits `78`.** That status means unimplemented, not a failure:
|
|
490
|
-
`remove` warns loudly, names the `down:` key, and removes the checkout anyway,
|
|
491
|
-
because a stub cannot be holding anything. Any other non-zero status still aborts
|
|
492
|
-
the removal. A bare word that is not path-shaped may name a skill; a path-shaped
|
|
493
|
-
value with no executable behind it is a mistake, and `remove` refuses with the
|
|
494
|
-
value and the checkout in the message.
|
|
495
|
-
|
|
496
|
-
**A skill is a value too, and a shell script cannot dispatch it.** When `down:`
|
|
497
|
-
names a skill rather than a script, `remove` prints `require-hook <name>` and
|
|
498
|
-
exits `3`; the agent runs that skill and re-runs with `--hook-ok`. That is the
|
|
499
|
-
same handshake `hooks.worktree` uses — one mechanism, not two. Args after a skill
|
|
500
|
-
name are the skill's own vocabulary, exactly like a hook entry.
|
|
501
|
-
|
|
502
|
-
**The `WT_*` block is the checkout's identity.** Whoever runs the pair exports
|
|
503
|
-
`WT_PATH`, `WT_BRANCH`, `WT_SLUG`, and `WT_NAMESPACE`; `remove` does it for
|
|
504
|
-
`down`, and a caller that starts a stack does it for `up`. `create --env` prints
|
|
505
|
-
the four assignments, which need exporting to reach a child process:
|
|
506
|
-
|
|
507
|
-
```bash
|
|
508
|
-
set -a; eval "$(.sassywares/worktree/create <branch> --env)"; set +a
|
|
509
|
-
bin/up
|
|
455
|
+
**One path, no arguments.** A value is relative to the project root — the folder
|
|
456
|
+
holding `.sassywares/` — must name an executable file, and is run bare: anything
|
|
457
|
+
it needs comes from its own arguments (`<branch> [--from <ref>]` for create,
|
|
458
|
+
`<slug|branch> [--force]` for remove) or from the checkout itself. A command line in the key would define a
|
|
459
|
+
second place the lifecycle lives, so `--check` fails a value with whitespace, an
|
|
460
|
+
absolute path, a path that walks outside the project, a list, or a block — one
|
|
461
|
+
path is the whole shape.
|
|
462
|
+
|
|
463
|
+
**Absent falls back silently; a declared value that is unusable warns.** With no
|
|
464
|
+
`create:`/`remove:` key, a run executes the built-in
|
|
465
|
+
`.sassywares/worktree/create|remove` and says nothing — a project that deleted the
|
|
466
|
+
pair means it. A key that declares a file that is missing or not executable, or a
|
|
467
|
+
value with whitespace or arguments, an absolute or `~/` path, `..`, a list, or a
|
|
468
|
+
block, falls back to the same built-in and warns on stderr naming the key and the
|
|
469
|
+
file:
|
|
470
|
+
|
|
471
|
+
```text
|
|
472
|
+
warning: worktrees.create names 'scripts/worktrees/create' but /…/scripts/worktrees/create is missing or not executable — using the built-in .sassywares/worktree/create
|
|
510
473
|
```
|
|
511
474
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
475
|
+
That is the git-only baseline: the checkout is cut or deleted and nothing is
|
|
476
|
+
prepared or disposed. A declared-but-unusable key is never a silent success — the
|
|
477
|
+
warning is the point — and a create that exits 0 without the `WT_*` lines is
|
|
478
|
+
reported as "checkout is real but unprepared".
|
|
515
479
|
|
|
516
|
-
**
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
the slug — a hash, because nothing here tracks claims, so a collision is possible
|
|
520
|
-
and the script is where it surfaces:
|
|
480
|
+
**The scripts are the entry point.** `sassy-worktree` runs the project's pair; the
|
|
481
|
+
contract, the slots, and the scaffold are [`worktree.md`](worktree.md)'s and
|
|
482
|
+
[`scaffold-header.md`](scaffold-header.md)'s.
|
|
521
483
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
```
|
|
484
|
+
**Order is the script's.** Identity → stop → delete → dispose, and the slot that
|
|
485
|
+
holds each step, are in [`worktree.md`](worktree.md).
|
|
525
486
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
(see [`init.md`](init.md)). After that the keys and the scripts behind them are
|
|
529
|
-
the project's.
|
|
487
|
+
**Legacy keys.** [`check.md`](check.md) reports them, and [`init.md`](init.md)
|
|
488
|
+
migrates them only when the user asks.
|
|
530
489
|
|
|
531
490
|
## Worktrees
|
|
532
491
|
|
|
@@ -537,23 +496,26 @@ namespace, so two runs never fight over a working tree.
|
|
|
537
496
|
worktrees:
|
|
538
497
|
enabled: true
|
|
539
498
|
dir: ~/.sassywares/worktrees
|
|
499
|
+
create: scripts/worktrees/create
|
|
500
|
+
remove: scripts/worktrees/remove
|
|
540
501
|
```
|
|
541
502
|
|
|
542
|
-
|
|
543
|
-
|
|
503
|
+
The scripts in `.sassywares/worktree/` own the git mechanics, the project's pair
|
|
504
|
+
owns everything else, and `sassy-worktree` runs the pair (see Lifecycle).
|
|
544
505
|
|
|
545
506
|
**`enabled: true` is permission, not a default.** It makes a checkout available;
|
|
546
507
|
`branching.md` still asks before a run takes one, unless the caller forwarded
|
|
547
508
|
`worktree:`, and the run works in the main checkout until the answer is yes.
|
|
548
509
|
Two runs only collide when they are actually parallel, and an unasked checkout
|
|
549
|
-
relocates the work, leaves the uncommitted tree behind, and pays the setup
|
|
510
|
+
relocates the work, leaves the uncommitted tree behind, and pays the setup step
|
|
550
511
|
for a checkout nobody needed.
|
|
551
512
|
|
|
552
513
|
**Putting a stack in a checkout is the project's business.** The suite carries no
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
state, not something a
|
|
514
|
+
addresses, no ports, and no stack commands: how a checkout comes up, what it
|
|
515
|
+
installs, and what it disposes live in `create`/`remove`, and the scaffolding
|
|
516
|
+
slots are where a project writes them. `dir` is the one path in this file that may
|
|
517
|
+
be absolute or start with `~/` — it names machine-local state, not something a
|
|
518
|
+
teammate clones.
|
|
557
519
|
|
|
558
520
|
**Two conditions.**
|
|
559
521
|
|
|
@@ -563,8 +525,9 @@ state, not something a teammate clones.
|
|
|
563
525
|
- It needs the `repo` topology. A `workspace` root and a `none` folder have no
|
|
564
526
|
git to cut a checkout from.
|
|
565
527
|
|
|
566
|
-
The namespace, the
|
|
567
|
-
[`worktree.md`](worktree.md).
|
|
528
|
+
The namespace, the four toolbox scripts, and every refusal are in
|
|
529
|
+
[`worktree.md`](worktree.md). The scaffold header both scripts carry is
|
|
530
|
+
[`scaffold-header.md`](scaffold-header.md).
|
|
568
531
|
|
|
569
532
|
## Dogfood
|
|
570
533
|
|
|
@@ -613,15 +576,14 @@ report layout, the verdict classes, and the lint are in
|
|
|
613
576
|
- `git.remote` is required when `git.repo: workspace`; forbidden otherwise.
|
|
614
577
|
`git.mirror_branch` and `repos` are workspace-only too.
|
|
615
578
|
- `hooks` is allowed only with the four points under `hooks.pr`, `after_push`
|
|
616
|
-
under `hooks.push`, `
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
- `
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
are passed through as ordinary characters.
|
|
579
|
+
under `hooks.push`, and `before_slice`/`after_close` under `hooks.goal`, each
|
|
580
|
+
a list of skill names that resolve to `.agents/skills/<name>/SKILL.md`.
|
|
581
|
+
`hooks.worktree` is gone and is reported as an error, never ignored.
|
|
582
|
+
- `worktrees.create` and `worktrees.remove` are one path each, relative to the
|
|
583
|
+
project root and naming an executable file. The drift and note outcomes are in
|
|
584
|
+
[`check.md`](check.md).
|
|
585
|
+
- `up`, `down`, and `hooks.worktree` are gone. `--check` reports each with the
|
|
586
|
+
exact line to delete, and the lifecycle now lives in the two script keys.
|
|
625
587
|
- `worktrees.enabled` is `true` or `false`. A checkout must resolve outside the
|
|
626
588
|
working tree and must not hold a branch `base_map` names as a base. An
|
|
627
589
|
`enabled: true` with no tooling installed, or with the wrong tooling version,
|
|
@@ -152,7 +152,7 @@ value it needs has to resolve in both places.
|
|
|
152
152
|
| Project | Preview line |
|
|
153
153
|
|---|---|
|
|
154
154
|
| Web | `the page the app serves — open it in a browser` |
|
|
155
|
-
| Mobile | `simulator "$WT_NAMESPACE"` — booted by the `
|
|
155
|
+
| Mobile | `simulator "$WT_NAMESPACE"` — booted by the project's `create` script |
|
|
156
156
|
| Desktop | `the app window is already open` |
|
|
157
157
|
| CLI | *(none — there is nothing to look at)* |
|
|
158
158
|
|
|
@@ -216,8 +216,8 @@ configured. Two things follow, and they are all this file says about it:
|
|
|
216
216
|
|
|
217
217
|
A worktree gets a fresh, empty `session/`. When a project's provider registers a
|
|
218
218
|
single callback URL, a second checkout usually cannot log in on its own, so the
|
|
219
|
-
usual answer is to copy or link the main checkout's session in the
|
|
220
|
-
|
|
219
|
+
usual answer is to copy or link the main checkout's session in the create script's
|
|
220
|
+
after-the-checkout slot. Worth writing down, because a **cookie** is host-scoped and
|
|
221
221
|
crosses ports freely while a **`localStorage`** session is origin-scoped, port
|
|
222
222
|
included, and has to be injected per origin — the difference looks like a broken
|
|
223
223
|
transplant when it is only the wrong mechanism.
|