@sassywares/skills 0.12.0 → 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 +32 -19
- package/README.md +50 -43
- 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 +1 -1
- package/skills/sassy-overview/SKILL.md +2 -2
- package/skills/sassy-overview/references/identify.md +1 -1
- package/skills/sassy-plan/SKILL.md +5 -5
- package/skills/sassy-plan/references/plan-format.md +34 -6
- 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 +9 -5
- package/skills/sassy-setup/references/check.md +23 -0
- package/skills/sassy-setup/references/config.md +68 -107
- 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-ship/SKILL.md +1 -1
- package/skills/sassy-work/SKILL.md +1 -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,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# List worktrees whose work is already safely on a remote, and remove the ones
|
|
3
|
-
# you approve. This is the mode that keeps the worktree home from becoming tens
|
|
4
|
-
# of gigabytes.
|
|
5
|
-
#
|
|
6
|
-
# Only merged-or-gone branches that are clean and fully pushed are ever
|
|
7
|
-
# candidates. Nothing is removed without --yes.
|
|
8
|
-
#
|
|
9
|
-
# Usage: .sassywares/worktree/prune [--yes] [--version]
|
|
10
|
-
set -euo pipefail
|
|
11
|
-
|
|
12
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
-
# shellcheck source=./_lib.sh
|
|
14
|
-
source "$SCRIPT_DIR/_lib.sh"
|
|
15
|
-
|
|
16
|
-
usage() {
|
|
17
|
-
cat <<'EOF'
|
|
18
|
-
Usage: .sassywares/worktree/prune [--yes]
|
|
19
|
-
|
|
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 whose tree is clean and
|
|
22
|
-
fully pushed.
|
|
23
|
-
EOF
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
yes=0
|
|
27
|
-
while [ $# -gt 0 ]; do
|
|
28
|
-
case "$1" in
|
|
29
|
-
-h|--help) usage; exit 0 ;;
|
|
30
|
-
--version) printf '%s\n' "$WT_VERSION"; exit 0 ;;
|
|
31
|
-
--yes) yes=1 ;;
|
|
32
|
-
-*) die "unknown flag: $1 (try --help)" ;;
|
|
33
|
-
*) die "unexpected argument: $1 (try --help)" ;;
|
|
34
|
-
esac
|
|
35
|
-
shift
|
|
36
|
-
done
|
|
37
|
-
|
|
38
|
-
need_git
|
|
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
|
-
|
|
45
|
-
printf ' %-32s %-9s %-6s %-9s %s\n' "BRANCH" "UPSTREAM" "DIRTY" "UNPUSHED" "ACTION"
|
|
46
|
-
n_candidates=0
|
|
47
|
-
n_removed=0
|
|
48
|
-
unmanaged=0
|
|
49
|
-
while IFS=$'\t' read -r p b; do
|
|
50
|
-
[ -n "$p" ] || continue
|
|
51
|
-
wt_is_main "$p" && continue
|
|
52
|
-
wt_managed "$p" || { unmanaged=$(( unmanaged + 1 )); continue; }
|
|
53
|
-
slug="$(wt_slug "$b")"
|
|
54
|
-
state="$(wt_upstream_state "$p")"
|
|
55
|
-
if wt_dirty "$p"; then dirty="yes"; else dirty="no"; fi
|
|
56
|
-
unpushed="$(wt_unpushed "$p")"
|
|
57
|
-
|
|
58
|
-
action=""
|
|
59
|
-
if [ "$state" = "unmerged" ]; then
|
|
60
|
-
action="skipped — unmerged"
|
|
61
|
-
elif [ "$dirty" = "yes" ]; then
|
|
62
|
-
action="skipped — dirty"
|
|
63
|
-
elif [ "$unpushed" != "0" ]; then
|
|
64
|
-
action="skipped — $unpushed unpushed"
|
|
65
|
-
else
|
|
66
|
-
action="removable"
|
|
67
|
-
n_candidates=$(( n_candidates + 1 ))
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
printf ' %-32s %-9s %-6s %-9s %s\n' "$b" "$state" "$dirty" "$unpushed" "$action"
|
|
71
|
-
|
|
72
|
-
if [ "$yes" -eq 1 ] && [ "$action" = "removable" ]; then
|
|
73
|
-
hooks="$(wt_hook before_remove "$b")"
|
|
74
|
-
if [ -n "$hooks" ]; then
|
|
75
|
-
warn skipped "$b has a before_remove hook — run remove <$slug> so it runs"
|
|
76
|
-
continue
|
|
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
|
|
82
|
-
git worktree remove "$p" || continue
|
|
83
|
-
n_removed=$(( n_removed + 1 ))
|
|
84
|
-
fi
|
|
85
|
-
done < <(wt_all)
|
|
86
|
-
|
|
87
|
-
if [ "$yes" -eq 1 ]; then
|
|
88
|
-
ok pruned "$n_removed removed, $(( n_candidates - n_removed )) left"
|
|
89
|
-
elif [ "$n_candidates" -gt 0 ]; then
|
|
90
|
-
hint "re-run with --yes to remove the $n_candidates removable worktree(s)"
|
|
91
|
-
[ "$unmanaged" -gt 0 ] && hint "$unmanaged worktree(s) not managed here — left alone"
|
|
92
|
-
[ "$n_candidates" -eq 0 ] && [ "$unmanaged" -eq 0 ] && ok pruned "nothing to remove"
|
|
93
|
-
fi
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Mode: prune — sweep the checkouts that are safe to delete
|
|
2
|
-
|
|
3
|
-
Read the shared sections in `SKILL.md` first. This file is the prune path only.
|
|
4
|
-
|
|
5
|
-
1. Run `.sassywares/worktree/prune` with no flag and show the table.
|
|
6
|
-
2. Ask before removing. `--yes` removes only rows marked `removable`: merged into their upstream or whose upstream is gone, clean, fully pushed, and no `before_remove` hook or `down:` life cycle it would skip.
|
|
7
|
-
3. Rows with a declared hook or a `down:` are shown so the user can run `remove <slug>` instead and get the cleanup. Prune never skips either silently.
|
|
8
|
-
4. Give the counts — removed, left, and why each skipped row was skipped.
|
|
9
|
-
|
|
10
|
-
| Rule | Requirement |
|
|
11
|
-
|------|-------------|
|
|
12
|
-
| Only `removable` rows | The script's marking is the safety proof. Never extend `--yes` to a row it left out, and never prune by hand. |
|
|
13
|
-
| A skipped row says why | `unmerged`, `dirty`, `unpushed`, `hook`, or `down`: name it. A bare count leaves the user unable to tell a safe sweep from a stuck one. |
|