@sassywares/skills 0.11.22 → 0.12.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 +36 -22
- package/README.md +42 -33
- package/package.json +1 -1
- package/skills/sassy-goal/SKILL.md +5 -5
- package/skills/sassy-goal/references/close.md +4 -4
- package/skills/sassy-goal/references/goal-format.md +27 -4
- package/skills/sassy-goal/references/next.md +2 -1
- package/skills/sassy-goal/references/write.md +2 -2
- package/skills/sassy-lfg/SKILL.md +2 -2
- 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-plan/SKILL.md +5 -5
- package/skills/sassy-plan/references/plan-format.md +34 -6
- 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/branching.md +7 -3
- package/skills/sassy-setup/references/config.md +105 -24
- 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-ship/SKILL.md +1 -1
- package/skills/sassy-work/SKILL.md +2 -2
- 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,11 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Show every worktree of this repo: branch, path,
|
|
3
|
-
#
|
|
2
|
+
# Show every worktree of this repo: branch, path, whether its tree is dirty, and
|
|
3
|
+
# the upstream it tracks.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
# stale entry to believe.
|
|
7
|
-
#
|
|
8
|
-
# Usage: .sassywares/worktree/list [--address <slug>] [--path <slug>] [--version]
|
|
5
|
+
# Usage: .sassywares/worktree/list [--path <slug>] [--version]
|
|
9
6
|
set -euo pipefail
|
|
10
7
|
|
|
11
8
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -14,21 +11,20 @@ source "$SCRIPT_DIR/_lib.sh"
|
|
|
14
11
|
|
|
15
12
|
usage() {
|
|
16
13
|
cat <<'EOF'
|
|
17
|
-
Usage: .sassywares/worktree/list [--
|
|
14
|
+
Usage: .sassywares/worktree/list [--path <slug>]
|
|
18
15
|
|
|
19
|
-
Print every worktree with its
|
|
16
|
+
Print every worktree with its branch, path, dirty state, and upstream.
|
|
20
17
|
|
|
21
|
-
--
|
|
22
|
-
--path <slug> print only the path of one worktree (for cd "$(...)")
|
|
18
|
+
--path <slug> print only the path of one worktree (for cd "$(...)")
|
|
23
19
|
EOF
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
want=""
|
|
22
|
+
want=""
|
|
27
23
|
while [ $# -gt 0 ]; do
|
|
28
24
|
case "$1" in
|
|
29
25
|
-h|--help) usage; exit 0 ;;
|
|
30
26
|
--version) printf '%s\n' "$WT_VERSION"; exit 0 ;;
|
|
31
|
-
--
|
|
27
|
+
--path) shift; want="${1:-}"; [ -n "$want" ] || die "path needs a slug" ;;
|
|
32
28
|
-*) die "unknown flag: $1 (try --help)" ;;
|
|
33
29
|
*) die "unexpected argument: $1 (try --help)" ;;
|
|
34
30
|
esac
|
|
@@ -37,62 +33,32 @@ done
|
|
|
37
33
|
|
|
38
34
|
need_git
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
local p="$1" b="$2" slug port line
|
|
42
|
-
slug="$(wt_slug "$b")"
|
|
43
|
-
if wt_is_main "$p"; then
|
|
44
|
-
die "the main checkout is not a worktree — read the recipe's preview line for its address"
|
|
45
|
-
fi
|
|
46
|
-
case "$kind" in
|
|
47
|
-
path) printf '%s\n' "$p" ;;
|
|
48
|
-
address)
|
|
49
|
-
# A claimed port, or the one the recipe's preview line advertises.
|
|
50
|
-
port="$(wt_live_port "$slug")"
|
|
51
|
-
[ -n "$port" ] || die "no address here — worktrees.ports is unset and the preview line names no port; try --preview"
|
|
52
|
-
printf 'http://localhost:%s\n' "$port"
|
|
53
|
-
;;
|
|
54
|
-
preview)
|
|
55
|
-
line="$(wt_preview "$slug")"
|
|
56
|
-
[ -n "$line" ] || die "no preview line for '$slug' — add one to dogfood.recipe"
|
|
57
|
-
printf '%s\n' "$line"
|
|
58
|
-
;;
|
|
59
|
-
esac
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if [ -n "$kind" ]; then
|
|
36
|
+
if [ -n "$want" ]; then
|
|
63
37
|
rec="$(wt_require_managed "$want")"
|
|
64
|
-
|
|
38
|
+
path="${rec%%$'\t'*}"
|
|
39
|
+
wt_is_main "$path" && die "the main checkout is not a worktree"
|
|
40
|
+
printf '%s\n' "$path"
|
|
65
41
|
exit 0
|
|
66
42
|
fi
|
|
67
43
|
|
|
68
|
-
printf ' %-34s %-50s %-
|
|
44
|
+
printf ' %-34s %-50s %-6s %s\n' "BRANCH" "WORKTREE" "DIRTY" "UPSTREAM"
|
|
69
45
|
count=0
|
|
70
46
|
unmanaged=0
|
|
71
47
|
while IFS=$'\t' read -r p b; do
|
|
72
48
|
[ -n "$p" ] || continue
|
|
73
49
|
count=$(( count + 1 ))
|
|
74
|
-
slug="$(wt_slug "$b")"
|
|
75
50
|
shown="${p/#$HOME/~}"
|
|
51
|
+
label="$b"
|
|
76
52
|
if wt_is_main "$p"; then
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if ! wt_managed "$p"; then
|
|
53
|
+
label="$b (main checkout)"
|
|
54
|
+
elif ! wt_managed "$p"; then
|
|
55
|
+
# No git calls for a checkout that is not ours: it is counted, never listed.
|
|
81
56
|
unmanaged=$(( unmanaged + 1 ))
|
|
82
57
|
continue
|
|
83
58
|
fi
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[ -n "$line" ] || line=""
|
|
88
|
-
if [ -z "$line" ] && [ -n "$port" ]; then line="http://localhost:$port"; fi
|
|
89
|
-
if [ -n "$port" ]; then
|
|
90
|
-
if tcp_up "$port"; then live="up"; else live="down"; fi
|
|
91
|
-
else
|
|
92
|
-
live="—"
|
|
93
|
-
fi
|
|
94
|
-
last="$(wt_verdict "$p")"
|
|
95
|
-
printf ' %-34s %-50s %-40.40s %-5s %s\n' "$(short_path "$b" 34)" "$(short_path "$shown" 50)" "${line:-—}" "$live" "${last:-—}"
|
|
59
|
+
if wt_dirty "$p"; then dirty="yes"; else dirty="no"; fi
|
|
60
|
+
up="$(wt_upstream "$p")"
|
|
61
|
+
printf ' %-34s %-50s %-6s %s\n' "$(short_path "$label" 34)" "$(short_path "$shown" 50)" "$dirty" "${up:-—}"
|
|
96
62
|
done < <(wt_all)
|
|
97
63
|
|
|
98
64
|
[ "$count" -gt 0 ] || log " no checkouts found — is this a git repository?"
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# you approve. This is the mode that keeps the worktree home from becoming tens
|
|
4
4
|
# of gigabytes.
|
|
5
5
|
#
|
|
6
|
-
# Only merged-or-gone branches that are clean
|
|
7
|
-
#
|
|
6
|
+
# Only merged-or-gone branches that are clean and fully pushed are ever
|
|
7
|
+
# candidates. Nothing is removed without --yes.
|
|
8
8
|
#
|
|
9
9
|
# Usage: .sassywares/worktree/prune [--yes] [--version]
|
|
10
10
|
set -euo pipefail
|
|
@@ -18,7 +18,8 @@ usage() {
|
|
|
18
18
|
Usage: .sassywares/worktree/prune [--yes]
|
|
19
19
|
|
|
20
20
|
Show every worktree that is merged into its upstream (or whose upstream is gone)
|
|
21
|
-
and safe to remove, then — with --yes — remove those
|
|
21
|
+
and safe to remove, then — with --yes — remove those whose tree is clean and
|
|
22
|
+
fully pushed.
|
|
22
23
|
EOF
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -36,6 +37,11 @@ done
|
|
|
36
37
|
|
|
37
38
|
need_git
|
|
38
39
|
|
|
40
|
+
# A declared life cycle means the stack is the project's to stop. There is no
|
|
41
|
+
# liveness probe here: `remove` is what runs `down:`, so prune sends the user there
|
|
42
|
+
# rather than pulling a directory out from under a running process.
|
|
43
|
+
down="$(wt_down)"
|
|
44
|
+
|
|
39
45
|
printf ' %-32s %-9s %-6s %-9s %s\n' "BRANCH" "UPSTREAM" "DIRTY" "UNPUSHED" "ACTION"
|
|
40
46
|
n_candidates=0
|
|
41
47
|
n_removed=0
|
|
@@ -48,9 +54,6 @@ while IFS=$'\t' read -r p b; do
|
|
|
48
54
|
state="$(wt_upstream_state "$p")"
|
|
49
55
|
if wt_dirty "$p"; then dirty="yes"; else dirty="no"; fi
|
|
50
56
|
unpushed="$(wt_unpushed "$p")"
|
|
51
|
-
port="$(wt_live_port "$slug")"
|
|
52
|
-
live="no"
|
|
53
|
-
[ -n "$port" ] && tcp_up "$port" && live="yes"
|
|
54
57
|
|
|
55
58
|
action=""
|
|
56
59
|
if [ "$state" = "unmerged" ]; then
|
|
@@ -59,8 +62,6 @@ while IFS=$'\t' read -r p b; do
|
|
|
59
62
|
action="skipped — dirty"
|
|
60
63
|
elif [ "$unpushed" != "0" ]; then
|
|
61
64
|
action="skipped — $unpushed unpushed"
|
|
62
|
-
elif [ "$live" = "yes" ]; then
|
|
63
|
-
action="skipped — running${port:+ on :$port}"
|
|
64
65
|
else
|
|
65
66
|
action="removable"
|
|
66
67
|
n_candidates=$(( n_candidates + 1 ))
|
|
@@ -74,8 +75,11 @@ while IFS=$'\t' read -r p b; do
|
|
|
74
75
|
warn skipped "$b has a before_remove hook — run remove <$slug> so it runs"
|
|
75
76
|
continue
|
|
76
77
|
fi
|
|
78
|
+
if [ -n "$down" ]; then
|
|
79
|
+
warn skipped "$b has a down: life cycle — real, or the generated stub (exit 78); run remove <$slug> so it is handled"
|
|
80
|
+
continue
|
|
81
|
+
fi
|
|
77
82
|
git worktree remove "$p" || continue
|
|
78
|
-
[ -n "$port" ] && wt_release "$port" "$slug"
|
|
79
83
|
n_removed=$(( n_removed + 1 ))
|
|
80
84
|
fi
|
|
81
85
|
done < <(wt_all)
|
|
@@ -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"
|
|
@@ -69,9 +69,13 @@ ask at step 6, never a token of its own. There is no `worktree:ask`.
|
|
|
69
69
|
exactly that. Name the count, the branch, and the choice.
|
|
70
70
|
3. Name it `<type>/<slug>` from the plan path or the topic, deterministically,
|
|
71
71
|
so a retried run converges on the same name instead of forking `-2`. The slug
|
|
72
|
-
is the plan's path relative to `artifacts.plans`, without `.md
|
|
73
|
-
plan
|
|
74
|
-
|
|
72
|
+
is the plan's path relative to `artifacts.plans`, without `.md`, and without a
|
|
73
|
+
standalone plan's `<type>-` filename prefix: `feat-worktree-cut.md` names
|
|
74
|
+
`feat/worktree-cut`. A goal slice nests as `<type>/<goal>/<NN-slice>`, where
|
|
75
|
+
`<goal>` is the goal's folder minus its `<type>-` prefix (`feat-powersync/`
|
|
76
|
+
names `feat/powersync/02-offline-reads`), and `<type>` comes from the slice
|
|
77
|
+
plan's frontmatter because its `NN-<slice-slug>.md` filename carries none. A
|
|
78
|
+
`feat/*`-style `base_map` or
|
|
75
79
|
`hooks.pr` family still matches the nested name by prefix.
|
|
76
80
|
4. Re-run with `--name <name>` and take `pr-base` from that answer: a name like
|
|
77
81
|
`release/1.2` or `hotfix/x` matches a `base_map` family and retargets the PR,
|
|
@@ -92,17 +92,19 @@ 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 |
|
|
104
106
|
|-----|---------|---------|
|
|
105
|
-
| `artifacts.plans` | `docs/plans` | Where `sassy-plan` writes plans, and where `sassy-goal` keeps goal folders (`<slug>/goal.md` plus slice plans) |
|
|
107
|
+
| `artifacts.plans` | `docs/plans` | Where `sassy-plan` writes plans, and where `sassy-goal` keeps goal folders (`<type>-<slug>/goal.md` plus slice plans) |
|
|
106
108
|
| `artifacts.solutions` | `docs/solutions` | Where `sassy-compound` writes learnings |
|
|
107
109
|
| `artifacts.handbooks` | `docs/handbooks` | Where `sassy-handbook` writes handbooks |
|
|
108
110
|
| `artifacts.concepts` | `CONCEPTS.md` | The glossary file compound maintains |
|
|
@@ -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
|
|
@@ -391,10 +394,9 @@ in review, and commented when it is deliberate.
|
|
|
391
394
|
|
|
392
395
|
### Goal hooks
|
|
393
396
|
|
|
394
|
-
`hooks.goal` keys on the **goal slug
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
`sassy-goal` owns both.
|
|
397
|
+
`hooks.goal` keys on the **goal folder's name**, the `<type>-<slug>` folder under `artifacts.plans`, prefix included (`hooks.goal.feat-powersync`; the slug alone is the part after the `<type>-`), and resolves exactly like `hooks.pr`: exact slug, the longest matching family, then `"*"`. Its two points are in the table above; `sassy-goal` owns both.
|
|
398
|
+
|
|
399
|
+
A goal folder renamed to the `<type>-<slug>/` shape takes its `hooks.goal` keys with it: existing folders keep working under their old key until renamed.
|
|
398
400
|
|
|
399
401
|
- **Early stop**: neither fires when that mode stops early — an unmerged PR,
|
|
400
402
|
nothing eligible, or a failed persist. A stale base does not stop
|
|
@@ -409,8 +411,8 @@ longest matching family, then `"*"`. Its two points are in the table above;
|
|
|
409
411
|
unpushed on a base is a stop, not a slice's starting point. Entries must be
|
|
410
412
|
idempotent: a resumed `mode:next` re-fires `before_slice`, and a close-out
|
|
411
413
|
can be re-run.
|
|
412
|
-
- **Both outcomes**: `after_close` fires for
|
|
413
|
-
left `
|
|
414
|
+
- **Both outcomes**: `after_close` fires for `status: done` and for a goal
|
|
415
|
+
left `active` because a gap went to a new slice. The brief carries
|
|
414
416
|
`goal_status` so the hook can tell them apart.
|
|
415
417
|
- **Not PR-keyed**: `commit.branch: current` does not suppress these, so the
|
|
416
418
|
`pr.*`, babysit, and merge rules that ignore `hooks.pr` under `current` do not
|
|
@@ -450,19 +452,94 @@ partial failures explicitly. Never collapse it into one status.
|
|
|
450
452
|
fan-out means one `sassy-babysit` run per PR; merging a fan-out needs an explicit
|
|
451
453
|
per-PR say-so, because one switch would merge N PRs nobody re-read.
|
|
452
454
|
|
|
455
|
+
## Lifecycle — `up` and `down`
|
|
456
|
+
|
|
457
|
+
How this project's stack starts and stops. Two **top-level** keys, each naming
|
|
458
|
+
exactly one thing:
|
|
459
|
+
|
|
460
|
+
```yaml
|
|
461
|
+
up: just dev
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
That is the whole declaration: `up` is the command word `just` and the argument
|
|
465
|
+
`dev`. A value is split on whitespace, one argument per word, with no quote
|
|
466
|
+
processing — `down: ./bin/down "two words"` arrives as three arguments, quotes
|
|
467
|
+
included. The first word is the script or the skill; the rest are that thing's
|
|
468
|
+
own arguments. A script is a relative path, an absolute path, or a word on
|
|
469
|
+
`PATH`.
|
|
470
|
+
|
|
471
|
+
**Absent means no lifecycle.** Nothing is inferred and nothing is invented:
|
|
472
|
+
with no `up`, no run starts anything; with no `down`, `remove` deletes the
|
|
473
|
+
checkout and says nothing was stopped. There is no default command, and no
|
|
474
|
+
falling back to a `Makefile` target or a `package.json` script — a project that
|
|
475
|
+
has one and wants it used says so in the key.
|
|
476
|
+
|
|
477
|
+
**`up` runs in the foreground.** It owns the terminal until it is stopped with
|
|
478
|
+
SIGTERM, and it must reap its children before it exits. A detached or daemonizing
|
|
479
|
+
`up` is wrong here: the app outlives the call, nobody can ask it to stop, and the
|
|
480
|
+
process holds the checkout — which is exactly what `down` then cannot kill.
|
|
481
|
+
`down` must terminate whatever `up` started and exit once it has.
|
|
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
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
`WT_SLUG` is the branch made filesystem-safe and `WT_NAMESPACE` is the derived
|
|
513
|
+
name for a database, a compose project, or a device — derive from them, never
|
|
514
|
+
build a name by hand.
|
|
515
|
+
|
|
516
|
+
**Ports are the project's business.** The suite carries no port range and never
|
|
517
|
+
derives one, so two checkouts running the same app will collide on the same
|
|
518
|
+
fixed port unless the project's own `up` keeps them apart. Derive it there from
|
|
519
|
+
the slug — a hash, because nothing here tracks claims, so a collision is possible
|
|
520
|
+
and the script is where it surfaces:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
PORT=$(( 3000 + $(printf '%s' "$WT_SLUG" | cksum | cut -d' ' -f1) % 100 ))
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Setup initializes the pair once and never touches it again: it points the keys at
|
|
527
|
+
the command the project already declares, or writes the two stubs that exit `78`
|
|
528
|
+
(see [`init.md`](init.md)). After that the keys and the scripts behind them are
|
|
529
|
+
the project's.
|
|
530
|
+
|
|
453
531
|
## Worktrees
|
|
454
532
|
|
|
455
533
|
Parallel work in one repo: a checkout per branch, each with its own derived
|
|
456
|
-
namespace
|
|
534
|
+
namespace, so two runs never fight over a working tree.
|
|
457
535
|
|
|
458
536
|
```yaml
|
|
459
537
|
worktrees:
|
|
460
538
|
enabled: true
|
|
461
539
|
dir: ~/.sassywares/worktrees
|
|
462
|
-
ports: 3000-3099
|
|
463
540
|
```
|
|
464
541
|
|
|
465
|
-
|
|
542
|
+
Two keys, no commands. The scripts in `.sassywares/worktree/` own the
|
|
466
543
|
mechanics and `sassy-worktree` orchestrates them.
|
|
467
544
|
|
|
468
545
|
**`enabled: true` is permission, not a default.** It makes a checkout available;
|
|
@@ -472,11 +549,11 @@ Two runs only collide when they are actually parallel, and an unasked checkout
|
|
|
472
549
|
relocates the work, leaves the uncommitted tree behind, and pays the setup hooks
|
|
473
550
|
for a checkout nobody needed.
|
|
474
551
|
|
|
475
|
-
**
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
file that may be absolute or start with `~/` — it names machine-local
|
|
479
|
-
something a teammate clones.
|
|
552
|
+
**Putting a stack in a checkout is the project's business.** The suite carries no
|
|
553
|
+
address and no port range, so the `up:`/`down:` pair is where a project
|
|
554
|
+
decides how its stack comes up and, if it needs one, which port. `dir` is the one
|
|
555
|
+
path in this file that may be absolute or start with `~/` — it names machine-local
|
|
556
|
+
state, not something a teammate clones.
|
|
480
557
|
|
|
481
558
|
**Two conditions.**
|
|
482
559
|
|
|
@@ -486,7 +563,7 @@ something a teammate clones.
|
|
|
486
563
|
- It needs the `repo` topology. A `workspace` root and a `none` folder have no
|
|
487
564
|
git to cut a checkout from.
|
|
488
565
|
|
|
489
|
-
The namespace, the
|
|
566
|
+
The namespace, the two hooks, and every refusal are in
|
|
490
567
|
[`worktree.md`](worktree.md).
|
|
491
568
|
|
|
492
569
|
## Dogfood
|
|
@@ -539,10 +616,14 @@ report layout, the verdict classes, and the lint are in
|
|
|
539
616
|
under `hooks.push`, `after_create`/`before_remove` under `hooks.worktree`, and
|
|
540
617
|
`before_slice`/`after_close` under `hooks.goal`, each a list of skill names
|
|
541
618
|
that resolve to `.agents/skills/<name>/SKILL.md`.
|
|
542
|
-
- `
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
619
|
+
- `up` and `down` are top-level single-line strings, each `<script> <args…>` or
|
|
620
|
+
`<skill> <args…>`, naming exactly one thing. Never a block, a list, or a
|
|
621
|
+
command chain (`&&`, `;`): the shell word after `down:` is resolved as one
|
|
622
|
+
command, so a chain would be run as arguments to the first word. The value is
|
|
623
|
+
split on whitespace, one argument per word, with no quote processing; quotes
|
|
624
|
+
are passed through as ordinary characters.
|
|
625
|
+
- `worktrees.enabled` is `true` or `false`. A checkout must resolve outside the
|
|
626
|
+
working tree and must not hold a branch `base_map` names as a base. An
|
|
546
627
|
`enabled: true` with no tooling installed, or with the wrong tooling version,
|
|
547
628
|
is drift.
|
|
548
629
|
- `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
|