@sassywares/skills 0.12.1 → 0.13.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 +32 -15
- package/README.md +43 -36
- 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 +12 -7
- 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 +46 -2
- package/skills/sassy-setup/references/config.md +70 -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 +708 -250
- 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
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
# Idempotent: a branch already in a worktree of ours is shown, not recreated,
|
|
5
5
|
# and nobody else's checkout holding it is a stop rather than a clobber.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
7
|
+
# Streams: stdout carries only the four WT_* identity lines, once, at the end of
|
|
8
|
+
# a successful run; every human line goes to stderr. A caller can eval stdout
|
|
9
|
+
# while a person still reads the narration.
|
|
10
|
+
#
|
|
11
|
+
# Usage: .sassywares/worktree/create <branch> [--from <start-point>]
|
|
8
12
|
# .sassywares/worktree/create --version
|
|
9
13
|
set -euo pipefail
|
|
10
14
|
|
|
@@ -12,31 +16,33 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
12
16
|
# shellcheck source=./_lib.sh
|
|
13
17
|
source "$SCRIPT_DIR/_lib.sh"
|
|
14
18
|
|
|
19
|
+
# stdout belongs to the identity, so every human line here goes to stderr. The
|
|
20
|
+
# shared `ok` is stdout-oriented; shadow it rather than fork the format.
|
|
21
|
+
ok() { printf ' %-9s %s\n' "$1" "$2" >&2; }
|
|
22
|
+
|
|
15
23
|
usage() {
|
|
16
24
|
cat <<'EOF'
|
|
17
|
-
Usage: .sassywares/worktree/create <branch> [--from <start-point>]
|
|
25
|
+
Usage: .sassywares/worktree/create <branch> [--from <start-point>]
|
|
18
26
|
|
|
19
|
-
Create (or find) the worktree for <branch
|
|
20
|
-
inherits
|
|
27
|
+
Create (or find) the worktree for <branch>. stdout carries the identity a run
|
|
28
|
+
inherits — WT_PATH, WT_BRANCH, WT_SLUG, WT_NAMESPACE, one per line — and nothing
|
|
29
|
+
else; the narration goes to stderr.
|
|
21
30
|
|
|
22
31
|
--from <ref> where a new branch is cut from (default HEAD). A caller that has
|
|
23
32
|
already resolved the base passes it; this script never guesses.
|
|
24
|
-
--env print only `WT_*=<value>` lines, for eval.
|
|
25
33
|
EOF
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
branch=""
|
|
29
37
|
from="HEAD"
|
|
30
|
-
env_only=0
|
|
31
38
|
while [ $# -gt 0 ]; do
|
|
32
39
|
case "$1" in
|
|
33
40
|
-h|--help) usage; exit 0 ;;
|
|
34
41
|
--version) printf '%s\n' "$WT_VERSION"; exit 0 ;;
|
|
35
|
-
--
|
|
36
|
-
--from)
|
|
37
|
-
--
|
|
38
|
-
|
|
39
|
-
*) [ -z "$branch" ] || die "one branch at a time"; branch="$1" ;;
|
|
42
|
+
--from) shift; from="${1:-}"; [ -n "$from" ] || { usage >&2; exit 2; } ;;
|
|
43
|
+
--from=*) from="${1#*=}"; [ -n "$from" ] || { usage >&2; exit 2; } ;;
|
|
44
|
+
-*) printf ' ✗ unknown flag: %s (try --help)\n' "$1" >&2; usage >&2; exit 2 ;;
|
|
45
|
+
*) [ -z "$branch" ] || { usage >&2; exit 2; }; branch="$1" ;;
|
|
40
46
|
esac
|
|
41
47
|
shift
|
|
42
48
|
done
|
|
@@ -51,10 +57,6 @@ path="$(wt_path "$slug")"
|
|
|
51
57
|
show() { # $1 path
|
|
52
58
|
local ns
|
|
53
59
|
ns="$(wt_namespace "$slug")"
|
|
54
|
-
if [ "$env_only" -eq 1 ]; then
|
|
55
|
-
printf 'WT_PATH=%s\nWT_BRANCH=%s\nWT_SLUG=%s\nWT_NAMESPACE=%s\n' "$1" "$branch" "$slug" "$ns"
|
|
56
|
-
return 0
|
|
57
|
-
fi
|
|
58
60
|
ok worktree "$1"
|
|
59
61
|
ok branch "$branch"
|
|
60
62
|
# Say the tracking out loud. A branch cut from a remote-tracking ref used to
|
|
@@ -68,19 +70,10 @@ show() { # $1 path
|
|
|
68
70
|
|| warn upstream "this branch tracks '$up', not '$branch' — a plain 'git push' lands there"
|
|
69
71
|
ok namespace "$ns"
|
|
70
72
|
# A branch cut from a ref that predates setup has no config and no tooling, so
|
|
71
|
-
# this checkout is not managed here: `list` skips it
|
|
73
|
+
# this checkout is not managed here: `list` skips it and never offers it.
|
|
72
74
|
[ -f "$1/.sassywares/config.yaml" ] \
|
|
73
|
-
|| ok unmanaged "this branch has no .sassywares/config.yaml — cut from a ref that predates setup; list
|
|
74
|
-
|
|
75
|
-
hooks="$(wt_hook after_create "$branch")"
|
|
76
|
-
if [ -z "$hooks" ]; then
|
|
77
|
-
ok hook "hooks.worktree.after_create — none declared"
|
|
78
|
-
else
|
|
79
|
-
while IFS= read -r n; do
|
|
80
|
-
[ -n "$n" ] || continue
|
|
81
|
-
ok hook "after_create → $n (dispatch it, with WT_* above)"
|
|
82
|
-
done <<<"$hooks"
|
|
83
|
-
fi
|
|
75
|
+
|| ok unmanaged "this branch has no .sassywares/config.yaml — cut from a ref that predates setup; list will skip it"
|
|
76
|
+
wt_print_env "$1" "$branch" "$slug"
|
|
84
77
|
}
|
|
85
78
|
|
|
86
79
|
# Already in a worktree of ours: show it and stop. This is the second call in a
|
|
@@ -96,7 +89,7 @@ if [ -n "$existing" ]; then
|
|
|
96
89
|
fi
|
|
97
90
|
|
|
98
91
|
if [ -e "$path" ]; then
|
|
99
|
-
die "'$path' exists but no worktree is registered for '$branch' — inspect it, then
|
|
92
|
+
die "'$path' exists but no worktree is registered for '$branch' — inspect it, then delete it"
|
|
100
93
|
fi
|
|
101
94
|
|
|
102
95
|
home="$(wt_home)"
|
|
@@ -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
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Read the shared sections in `SKILL.md` first, including steps 7–9. This file is only what a check run does differently: it enters at step 7 and never runs steps 1–6.
|
|
4
4
|
|
|
5
|
-
1. **Enter at step 7.** No detection, no questions, no config write: a folder that is already wired is verified, never rebuilt from detection. Run `scripts/detect.sh --root <path> --check` exactly as step 7 says, and report every `drift:` line verbatim, or that the config matches the tree.
|
|
5
|
+
1. **Enter at step 7.** No detection, no questions, no config write: a folder that is already wired is verified, never rebuilt from detection. Run `scripts/detect.sh --root <path> --check` exactly as step 7 says, and report every `drift:` line verbatim, or that the config matches the tree — plus any `template:` note, which is not drift (see below).
|
|
6
6
|
2. **Report the scope you found.** Check the skills and the agents exactly as step 5's **Installed** rules say, and report the scope each was found in or what is missing. **Check installs nothing** — a missing suite or roster is reported with the fix, and it does not block step 8.
|
|
7
7
|
3. **Commit only dirty setup-owned files.** Step 8 applies only when something setup already owns is uncommitted — an edited config, a scaffold nobody committed, a pin that drifted — and only when step 7 is clean. Nothing dirty, nothing to commit.
|
|
8
8
|
4. **Report as step 9 says,** then name what closes each finding: the drift line, the missing scope, and the mode that fixes it.
|
|
@@ -11,5 +11,49 @@ A check run never edits the config, never installs a skill or an agent, never re
|
|
|
11
11
|
|
|
12
12
|
| Rule | Requirement |
|
|
13
13
|
|------|-------------|
|
|
14
|
-
| Check reports, init repairs | Every finding is reported with `mode:init` as its fix. Nothing is corrected in place, approved or not. |
|
|
14
|
+
| Check reports, init repairs | Every finding is reported with `mode:init` as its fix, except the template note, whose fix is the explicit `--sync --write` merge. 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 the template note means
|
|
18
|
+
|
|
19
|
+
A config can match the tree and still be behind the shipped template: a block, a
|
|
20
|
+
key, a comment layer, or a commented example that a later version added is
|
|
21
|
+
missing, so the next reader gets a thinner file than [`config.md`](config.md)
|
|
22
|
+
documents. `--check` prints it as a note — `template: --sync --write would add
|
|
23
|
+
worktrees, dogfood and refresh the comments (values the check accepts stay)` —
|
|
24
|
+
and still exits 0. It is never drift: every value the file declares is valid.
|
|
25
|
+
|
|
26
|
+
The fix is `bash scripts/detect.sh --root <path> --sync --write`, which merges
|
|
27
|
+
the template onto the file. It keeps the line of every leaf the check accepts —
|
|
28
|
+
value and same-line trailing comment, byte for byte — so a project's
|
|
29
|
+
`"*": main # confirmed: …` stays exactly as written, and takes every block,
|
|
30
|
+
key, comment, and example the file lacks from the proposal. A malformed value is
|
|
31
|
+
not accepted, so it is replaced, the same judgement the check makes. Without
|
|
32
|
+
`--write` it is a dry run that prints the merged file and writes nothing; a
|
|
33
|
+
second run reports `already current` and touches nothing.
|
|
34
|
+
|
|
35
|
+
Report the note and the command; run the sync only when the user asks, the same
|
|
36
|
+
as every other repair.
|
|
37
|
+
|
|
38
|
+
## What a worktree finding means
|
|
39
|
+
|
|
40
|
+
`worktrees.create` and `worktrees.remove` are the project's own files, so a check
|
|
41
|
+
never hashes them and never treats them as suite-owned. Five outcomes:
|
|
42
|
+
|
|
43
|
+
- **Declared and executable** — a note naming the path. Nothing to do.
|
|
44
|
+
- **Declared but missing or not executable** — a note, never drift:
|
|
45
|
+
`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.
|
|
46
|
+
- **A wrong shape** — whitespace, an absolute or `~/` path, `..`, a list, or a
|
|
47
|
+
block — is drift: `--check` names the key and the value, and the fix is one
|
|
48
|
+
relative path with no arguments.
|
|
49
|
+
- **No `sassywares:scaffold` header** — a note naming the file: it carries no
|
|
50
|
+
header, so the run cannot tell whether it prints the `WT_*` block. Provenance,
|
|
51
|
+
never drift.
|
|
52
|
+
- **A legacy key** — `up:`, `down:`, or `hooks.worktree` — a `drift:` line that
|
|
53
|
+
names the key, says the lifecycle moved into the project's create/remove
|
|
54
|
+
scripts, and gives the exact edit (delete the `up:`/`down:` line, or the
|
|
55
|
+
`worktree:` block under `hooks`). The fix is `mode:init` and only when the user
|
|
56
|
+
asks for it; a check never deletes the key itself.
|
|
57
|
+
|
|
58
|
+
A scaffold header's `version=` is provenance, not a pin, so an old scaffold
|
|
59
|
+
version is never drift — [`scaffold-header.md`](scaffold-header.md).
|