autonomous-sdlc-harness 0.4.1 → 0.5.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.
@@ -9,6 +9,21 @@
9
9
  # bootstrap it, then PUSH the branch so the remote has it from
10
10
  # the first moment. This is what the watcher calls when a prompt
11
11
  # arrives for a branch that does not exist yet.
12
+ # --no-bootstrap Skip the bootstrap. Alone, a variant of default mode: cut
13
+ # and push the new branch the same way. With `--existing`, check
14
+ # out the existing branch and never push. Its callers are
15
+ # `remote-run.sh start` (a new branch) and `remote-run.sh review`
16
+ # (an existing one), each of which only places and commits one
17
+ # file: such a copy runs nothing, so a dependency install would
18
+ # cost minutes and could fail the placement for a reason
19
+ # unrelated to the task. It installs no worktree-scoped pre-push
20
+ # backstop — the push a caller makes is of a branch it has
21
+ # already judged not protected, and every later commit goes
22
+ # through `commit-on-branch.sh` and `push-branch.sh`, which refuse
23
+ # a protected branch themselves. An existing branch's copy that a
24
+ # person or a local run works in still wants the bootstrap, so
25
+ # `--existing` alone keeps it; `--no-bootstrap` is for a copy that
26
+ # only places and commits one file.
12
27
  # --existing Check out an EXISTING branch — local, or DWIM-created from
13
28
  # `origin/<branch>` when only the remote ref exists — bootstrap
14
29
  # it, and NEVER push. This is what the watcher calls to recreate
@@ -33,7 +48,8 @@
33
48
  # probe stops doing its job. This one is a short, strictly ordered sequence in
34
49
  # which every step is a precondition of the next: bootstrapping a half-created
35
50
  # worktree, or pushing a branch whose dependency install failed, is worse than
36
- # stopping. So a failing step aborts the script with that step's own status —
51
+ # stopping (a `--no-bootstrap` cut simply has no bootstrap step in its
52
+ # sequence). So a failing step aborts the script with that step's own status —
37
53
  # and the worktree it had already created is LEFT IN PLACE for inspection,
38
54
  # because removing a working copy is a decision this script does not get to
39
55
  # make silently.
@@ -62,20 +78,25 @@
62
78
  # is neither a descriptor duplication (`2>&1`, `>&2`, `2>&-`) nor a redirection
63
79
  # to the literal `/dev/null`.
64
80
  #
65
- # Usage: create-worktree.sh [--existing] <branch-name> [worktree-dir]
81
+ # Usage: create-worktree.sh [--existing] [--no-bootstrap] <branch-name> [worktree-dir]
66
82
  # --existing check out an existing branch instead of creating a new one
83
+ # --no-bootstrap skip the bootstrap: alone, create and push a new branch; with
84
+ # --existing, check out the existing branch and never push
67
85
  # <branch-name> the branch to run on
68
86
  # [worktree-dir] optional override; relative paths resolve against $PWD
69
87
  #
70
88
  # Exit map a caller can switch on:
71
89
  #
72
- # 0 the worktree is ready (and, in default mode, the branch was pushed)
90
+ # 0 the worktree is ready (and, in default mode or under `--no-bootstrap`
91
+ # without `--existing`, the branch was pushed)
73
92
  # 1 usage error / the library or the configuration could not be read
74
93
  # 2 refusal — nothing was created: `--existing` and the branch is nowhere;
75
94
  # the branch is already checked out in another working copy (which is
76
95
  # named); or default mode with no `origin` remote, or no
77
96
  # `origin/<default branch>` to branch from
78
- # 4 the working copy was created but could not be bootstrapped — it has no
97
+ # 4 the working copy was created but could not be bootstrapped (never under
98
+ # `--no-bootstrap`, with or without `--existing`, which resolves no
99
+ # bootstrap) — it has no
79
100
  # dependency install and no pre-push backstop, is LEFT IN PLACE for
80
101
  # inspection, and in default mode the branch was NOT pushed, because this
81
102
  # exit precedes the push step. In default mode the local
@@ -104,6 +125,13 @@
104
125
  # new branch bash "$d/scripts/create-worktree.sh" feat/x
105
126
  # -> "$w/demo-feat-x" on feat/x, bootstrapped, and `git -C "$b"
106
127
  # branch` now lists feat/x
128
+ # no-bootstrap bash "$d/scripts/create-worktree.sh" --no-bootstrap feat/q
129
+ # -> "$w/demo-feat-q" on feat/q, no deps.marker, and
130
+ # `git -C "$b" branch` lists feat/q
131
+ # existing, no bootstrap git -C "$d" worktree remove "$w/demo-feat-q"
132
+ # git -C "$d" branch -D feat/q
133
+ # bash "$d/scripts/create-worktree.sh" --existing --no-bootstrap feat/q
134
+ # -> "$w/demo-feat-q" on feat/q, no deps.marker, "$b" UNCHANGED
107
135
  # already there bash "$d/scripts/create-worktree.sh" --existing feat/x
108
136
  # -> exit 2 naming "$w/demo-feat-x"; nothing created
109
137
  # recreate git -C "$d" worktree remove "$w/demo-feat-x"
@@ -150,15 +178,18 @@ fi
150
178
  . "$hr_lib"
151
179
 
152
180
  usage() {
153
- echo " usage: create-worktree.sh [--existing] <branch-name> [worktree-dir]" >&2
181
+ echo " usage: create-worktree.sh [--existing] [--no-bootstrap] <branch-name> [worktree-dir]" >&2
154
182
  }
155
183
 
156
184
  existing=0
157
- if [ "${1:-}" = "--existing" ]; then
158
- existing=1
159
- shift
160
- fi
161
-
185
+ no_bootstrap=0
186
+ while [ "$#" -gt 0 ]; do
187
+ case "$1" in
188
+ --existing) existing=1; shift ;;
189
+ --no-bootstrap) no_bootstrap=1; shift ;;
190
+ *) break ;;
191
+ esac
192
+ done
162
193
  if [ "$#" -lt 1 ] || [ -z "${1:-}" ]; then
163
194
  echo "create-worktree.sh: no branch name given" >&2
164
195
  usage
@@ -325,6 +356,17 @@ fi
325
356
  # checkout's own copy is not run instead — setup-worktree.sh anchors on its own
326
357
  # location and takes no arguments, so running it would bootstrap THIS checkout
327
358
  # rather than the new one.
359
+ if [ "$no_bootstrap" -eq 1 ]; then
360
+ if [ "$existing" -eq 1 ]; then
361
+ echo "create-worktree.sh: worktree ready at $worktree_dir (not bootstrapped)"
362
+ echo "create-worktree.sh: branch $branch (existing branch; not pushed)"
363
+ else
364
+ git -C "$worktree_dir" push -u origin "$branch"
365
+ echo "create-worktree.sh: worktree ready at $worktree_dir (not bootstrapped)"
366
+ echo "create-worktree.sh: branch $branch (pushed to origin)"
367
+ fi
368
+ exit 0
369
+ fi
328
370
  scripts_rel="$(hr_scripts_dir "$worktree_dir")" || scripts_rel=""
329
371
  if [ -z "$scripts_rel" ]; then
330
372
  scripts_rel="$script_dir_rel"