@sassywares/skills 0.11.16 → 0.11.17

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/README.md CHANGED
@@ -217,6 +217,12 @@ ask for it, and a run carrying `worktree:on` has already been told yes.
217
217
  `WT_SLUG`, `WT_NAMESPACE` — so a project's hook derives `.env`, a database name,
218
218
  or a simulator from one source instead of inventing its own.
219
219
 
220
+ A checkout's branch is cut **untracked**, and `create` prints the upstream it
221
+ found — `none` on a fresh branch, and a plain-English warning when an existing
222
+ branch tracks something other than its own name. Cut from `origin/staging`, git's
223
+ DWIM would have made `staging` that branch's upstream, so the branch's own `git
224
+ push` would aim at the base: a run that looks healthy until it ships.
225
+
220
226
  A **port is a resource, not the model**. With `ports:` configured, a checkout
221
227
  also gets `WT_PORT` and `WT_BASE_URL`, hashed into the range and claimed
222
228
  atomically so a restarted app returns to the same port. Delete `ports:` and there
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassywares/skills",
3
- "version": "0.11.16",
3
+ "version": "0.11.17",
4
4
  "description": "Lean, explicit-invocation Agent Skills for shipping fast: plan, work, review, validate, ship.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,11 +10,11 @@
10
10
  # 3. Everything resolves against the MAIN checkout, so running any of these
11
11
  # from inside a worktree behaves identically.
12
12
  #
13
- # worktree-version: 7
13
+ # worktree-version: 8
14
14
 
15
15
  set -euo pipefail
16
16
 
17
- WT_VERSION="7"
17
+ WT_VERSION="8"
18
18
  WT_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
19
 
20
20
  log() { printf '%s\n' "$*"; }
@@ -310,11 +310,17 @@ wt_is_main() { [ "$(cd "$1" && pwd -P)" = "$MAIN" ]; }
310
310
 
311
311
  wt_dirty() { [ -n "$(git -C "$1" status --porcelain 2>/dev/null)" ]; }
312
312
 
313
+ # The ref a checkout's branch tracks, or empty. Read-only, and never a guess:
314
+ # `create` prints this instead of deciding what a branch should follow.
315
+ wt_upstream() {
316
+ git -C "$1" rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true
317
+ }
318
+
313
319
  # Commits that exist only here: ahead of the upstream, or — with none — reachable
314
320
  # from no remote at all.
315
321
  wt_unpushed() {
316
322
  local p="$1" up n
317
- up="$(git -C "$p" rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true)"
323
+ up="$(wt_upstream "$p")"
318
324
  if [ -n "$up" ]; then
319
325
  n="$(git -C "$p" rev-list --count "$up..HEAD" 2>/dev/null || echo unknown)"
320
326
  else
@@ -325,7 +331,7 @@ wt_unpushed() {
325
331
 
326
332
  wt_upstream_state() { # merged | gone | unmerged
327
333
  local p="$1" up
328
- up="$(git -C "$p" rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true)"
334
+ up="$(wt_upstream "$p")"
329
335
  if [ -z "$up" ]; then
330
336
  printf 'gone'
331
337
  elif git -C "$p" merge-base --is-ancestor HEAD "$up" 2>/dev/null; then
@@ -64,6 +64,15 @@ report() { # $1 path, $2 branch
64
64
  fi
65
65
  ok worktree "$1"
66
66
  ok branch "$2"
67
+ # Say the tracking out loud. A branch cut from a remote-tracking ref used to
68
+ # inherit it as its upstream, so a plain push aimed at the base; and a branch
69
+ # that tracks something other than its own name is the state that made that
70
+ # invisible. `create` never sets a base — it reports what it found.
71
+ local up
72
+ up="$(wt_upstream "$1")"
73
+ ok upstream "${up:-none}"
74
+ [ -z "$up" ] || [ "${up#*/}" = "$2" ] \
75
+ || warn upstream "this branch tracks '$up', not '$2' — a plain 'git push' lands there"
67
76
  ok namespace "$ns"
68
77
  if [ -n "$port" ]; then
69
78
  ok port "$port"
@@ -112,7 +121,10 @@ printf '%s\n' "$MAIN" > "$(wt_home)/.repo"
112
121
  if git show-ref --verify --quiet "refs/heads/$branch"; then
113
122
  git worktree add --quiet "$path" "$branch"
114
123
  else
115
- git worktree add --quiet -b "$branch" "$path" "$from"
124
+ # --no-track is the whole point: without it git's DWIM gives a branch cut from
125
+ # a remote-tracking ref that ref as its upstream, so the branch's own push
126
+ # targets the base. A checkout is a branch of its own, not a follower.
127
+ git worktree add --quiet --no-track -b "$branch" "$path" "$from"
116
128
  fi
117
129
 
118
130
  report "$path" "$branch"
@@ -72,6 +72,20 @@ and crawled by every scanner that does not read `.gitignore` (`tsc`, Docker).
72
72
  **Never `rm -rf` the worktree home.** It is full of checkouts with uncommitted
73
73
  work; `remove` and `prune` are the only safe exits.
74
74
 
75
+ ## The branch
76
+
77
+ `create` cuts a new branch **untracked** and prints the upstream it found:
78
+
79
+ - **A fresh checkout's branch follows nothing.** Cut from `origin/staging`, git's
80
+ DWIM would make `staging` that branch's upstream, so the branch's own
81
+ `git push` aims at the base — a run that reads as healthy right up until it
82
+ ships. A checkout is a branch of its own, never a follower.
83
+ - **An existing branch keeps whatever it tracks**, and `create` says so on its
84
+ `upstream` line; one that is not the branch's own name is called out with what
85
+ a plain push would hit. That is the state a branch cut by hand arrives in.
86
+ - **`create` never resolves a base.** The base is `references/branching.md`'s
87
+ decision, and a push names its remote.
88
+
75
89
  ## The namespace
76
90
 
77
91
  `create` derives and prints, for the caller and the hook:
@@ -5,7 +5,7 @@ Read the shared sections in `SKILL.md` first. This file is the create path only.
5
5
  1. **Resolve the branch and its start point first**, through the `sassy-setup` skill's `references/branching.md`, exactly as `sassy-work` does. A run that reaches here has already decided; the branch is not created twice. When a human asks for one by hand with no branch named, ask for the branch name — never derive one.
6
6
  2. **Run `.sassywares/worktree/create <branch> --from <start-point>`** with the resolved start point. It is idempotent: an existing worktree for that branch is reported, a branch held by the main checkout is refused, and a port is claimed either way. On `--env` it prints the `WT_*` block alone.
7
7
  3. **Dispatch the declared hooks.** The script prints one line per `hooks.worktree.after_create` entry; it cannot dispatch a skill, so you do. One `worker` each, in declared order: *load the project skill at `.agents/skills/<name>/SKILL.md` and follow it*, briefed with the `WT_*` block and the fact that the checkout now exists. A missing skill or a `blocked` result stops here — the checkout is real but unprepared, and saying so is the report.
8
- 4. **Report** the path, branch, namespace, port, address, the preview line, and the hooks that ran or that none are declared. If the caller is a run, tell it to work in `WT_PATH` from now on.
8
+ 4. **Report** the path, branch, namespace, port, address, the upstream it printed (`none` is normal), the preview line, and the hooks that ran or that none are declared. If the caller is a run, tell it to work in `WT_PATH` from now on.
9
9
 
10
10
  | Rule | Requirement |
11
11
  |------|-------------|