@nodii/dev 0.6.219 → 0.6.220

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
@@ -1956,8 +1956,9 @@ basis until the MW clause it is drafting is uploaded. The hook's shape follows
1956
1956
  the planner's done-check decisions on that page.
1957
1957
 
1958
1958
  `harness install` and `harness update` (not `--dry-run`) also write a git
1959
- hook, `push-hook.sh` from this package, as both `post-commit` and
1960
- `post-rewrite` in the directory `git rev-parse --git-path hooks` names, so a
1959
+ hook, `push-hook.sh` from this package, as `post-commit`, `post-rewrite`
1960
+ and `post-merge` (git runs `post-merge`, not `post-commit`, after `git merge`
1961
+ makes a merge commit) in the directory `git rev-parse --git-path hooks` names, so a
1961
1962
  `core.hooksPath` is respected. They do this first, from the CLI's own copy,
1962
1963
  so a checkout that cannot reach Dev still gets them. That holds in a lane
1963
1964
  session too: when the lane's own checks refuse the command first (no sign-in,
@@ -1983,6 +1984,12 @@ worker pushes the tip. In the background, the worker:
1983
1984
  - pushes the current branch's tip to `origin`, never with force and never
1984
1985
  `main` or `master`. A commit on a detached HEAD is not pushed: an `INFO`
1985
1986
  line logs it.
1987
+ - pushes through `nodii-dev heavy run` (the `nodii-dev` on PATH), so the push
1988
+ and the repository's `pre-push` gates take a slot and read the machine
1989
+ floor like any push (MW2-51, DEV-PROCESS-2; hub-729). Under the
1990
+ floor (exit 75), or with no `nodii-dev` on PATH, nothing is pushed: it logs
1991
+ `not pushed SHA attempt=N: under the machine floor` (or `no nodii-dev on
1992
+ PATH`) and retries on the schedule below. It never pushes around the queue.
1986
1993
  - first scans the commits not yet on any origin ref with
1987
1994
  `gitleaks git --redact`. A finding means no push, `secret found: RULE FILE
1988
1995
  (commit SHORT)` in the log and the state `push blocked: secret`. gitleaks
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
4
4
  import { homedir, platform } from "node:os";
5
5
  import { basename, dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.219";
7
+ export const VERSION = "0.6.220";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/push-hook.sh CHANGED
@@ -8,9 +8,12 @@
8
8
  # decisions on that page: a git hook installed by harness install, rewrites, 24 h retry, hooks path and
9
9
  # chaining, PR whenever none, secret scan before push. One push worker per branch, a short debounce, and the
10
10
  # PR opened outside the push lock follow the reviews of #539 and #542.
11
- # Installed as both post-commit and post-rewrite where `git rev-parse --git-path hooks` points.
11
+ # Installed as post-commit, post-rewrite and post-merge where `git rev-parse --git-path hooks` points: git runs
12
+ # post-merge, not post-commit, after `git merge` makes a merge commit (hub-728).
12
13
  #
13
14
  # After every commit or rewrite it returns at once and, in the background:
15
+ # - pushes through `nodii-dev heavy run` (hub-729): the push and its pre-push gates take a slot and
16
+ # read the machine floor; under the floor (75) or with no nodii-dev on PATH it is retried, never sent around;
14
17
  # - pushes the CURRENT branch only (its tip, refs/heads/<br>), never main or master, never with force;
15
18
  # a detached HEAD is not pushed and an INFO line is logged;
16
19
  # - before any push, scans the commits not yet on any origin ref with `gitleaks git --redact`. A finding,
@@ -50,6 +53,8 @@ case $br in main|master) exit 0 ;; esac
50
53
  git remote get-url origin >/dev/null 2>&1 || exit 0
51
54
 
52
55
  RETRY_S=20 RETRY_MAX_S=300 WINDOW_S=86400
56
+ # The nodii-dev whose `heavy run` queues the push (hub-729); found once, from PATH.
57
+ HEAVY_CLI=$(command -v nodii-dev 2>/dev/null || true)
53
58
  API=${GITHUB_API_URL:-https://api.github.com}; API=${API%/}
54
59
  STATE_DIR=$GCD/nodii-push
55
60
  STATE_FILE=$STATE_DIR/$(printf '%s' "$br" | tr '/' '~').state
@@ -161,7 +166,7 @@ errline() { printf '%s' "$1" | tr '\n' ' ' | sed -E 's#(://)[^/@ ]+@#\1***@#g' |
161
166
  transport_error() { printf '%s' "$1" | grep -qiE 'unreachable|could not read from remote|unable to access|could not resolve|connection|timed out|early eof|remote end hung up|failed to lock|cannot lock ref|RPC failed|SSL|proxy'; }
162
167
 
163
168
  work() {
164
- local i=0 err wait=$RETRY_S start sha rt pp
169
+ local i=0 err wait=$RETRY_S start sha rt pp rc slot_wait
165
170
  start=$(now)
166
171
  mkdir -p "$STATE_DIR"
167
172
  while :; do
@@ -169,7 +174,14 @@ work() {
169
174
  # Push the branch's tip as it is now, so a burst of commits lands as one push.
170
175
  sha=$(git rev-parse --verify --quiet "refs/heads/$br") || { log "branch $br is gone; nothing pushed"; return 0; }
171
176
  scan "$sha" || return 0
172
- if err=$(git push --quiet origin "$sha:refs/heads/$br" 2>&1); then
177
+ # hub-729 (DEV-PROCESS-2, MW2-51): the push and the repository's pre-push gates run under a slot and
178
+ # the machine floor, like any push. Under the floor (75) or with no nodii-dev to queue in, nothing is pushed
179
+ # and the push is retried below; it is never sent around the queue.
180
+ rc=0
181
+ if [ -z "$HEAVY_CLI" ]; then rc=127; err="no nodii-dev on PATH, so no heavy slot to push in"
182
+ else err=$("$HEAVY_CLI" heavy run -- git push --quiet origin "$sha:refs/heads/$br" 2>&1) || rc=$?
183
+ fi
184
+ if [ "$rc" -eq 0 ]; then
173
185
  # Read the remote branch back in its own call (K03-16): it must hold this commit.
174
186
  rt=$(git ls-remote origin "refs/heads/$br" 2>/dev/null | cut -f1)
175
187
  if [ "$rt" = "$sha" ] || { [ -n "$rt" ] && git merge-base --is-ancestor "$sha" "$rt" 2>/dev/null; }; then
@@ -178,6 +190,14 @@ work() {
178
190
  fi
179
191
  err="push read-back: origin at ${rt:-nothing}, not $sha (connection)"
180
192
  fi
193
+ if [ "$rc" -eq 75 ] || [ "$rc" -eq 127 ]; then
194
+ [ "$rc" -eq 75 ] && slot_wait="under the machine floor" || slot_wait="no nodii-dev on PATH"
195
+ if [ $(( $(now) - start + wait )) -gt "$WINDOW_S" ]; then log "gave-up $sha after $i attempts ($slot_wait); ahead of remote"; state "ahead of remote: gave up after 24 h"; return 1; fi
196
+ log "not pushed $sha attempt=$i: $slot_wait, retry in ${wait}s: $(errline "$err")"
197
+ state "ahead of remote: $slot_wait, retrying"
198
+ beat; sleep "$wait"; wait=$((wait * 2)); [ "$wait" -gt "$RETRY_MAX_S" ] && wait=$RETRY_MAX_S
199
+ continue
200
+ fi
181
201
  if printf '%s' "$err" | grep -qE 'non-fast-forward|fetch first|\[rejected\]|stale info'; then
182
202
  rt=$(git ls-remote origin "refs/heads/$br" 2>/dev/null | cut -f1)
183
203
  if [ -n "$rt" ] && git merge-base --is-ancestor "$sha" "$rt" 2>/dev/null; then log "superseded $sha (origin at $rt)"; return 0; fi
@@ -1,7 +1,8 @@
1
1
  // The git hooks that push a lane's branch after every commit (O22, DEV-PROCESS-13).
2
2
  //
3
3
  // `nodii-dev harness install|update` writes push-hook.sh (beside this file) as
4
- // both post-commit and post-rewrite where `git rev-parse --git-path hooks`
4
+ // post-commit, post-rewrite and post-merge (git runs post-merge, not post-commit,
5
+ // after a merge commit: hub-728) where `git rev-parse --git-path hooks`
5
6
  // points, so a core.hooksPath override is respected. A hook that was already
6
7
  // there and is not nodii-dev's is kept as <hook>.nodii-chained and still runs
7
8
  // first. Hooks live in the git directory, not the working tree, so they are no
@@ -13,7 +14,7 @@ import { promisify } from "node:util";
13
14
 
14
15
  export const PUSH_HOOK_SCRIPT = new URL("./push-hook.sh", import.meta.url);
15
16
  export const PUSH_HOOK_MARKER = "nodii-dev:push-hook";
16
- export const PUSH_HOOK_NAMES = ["post-commit", "post-rewrite"];
17
+ export const PUSH_HOOK_NAMES = ["post-commit", "post-rewrite", "post-merge"];
17
18
  export const CHAINED_SUFFIX = ".nodii-chained";
18
19
 
19
20
  const execFileAsync = promisify(execFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.219",
3
+ "version": "0.6.220",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {