@olegkoval/agent-skills 1.42.3 → 1.43.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.
@@ -2,6 +2,12 @@
2
2
  # setup-worktree.sh -- lekker-review helper
3
3
  # Usage: setup-worktree.sh REPO_SLUG PR_BRANCH OUT_JSON [PREV_SHA]
4
4
  # Emits a JSON result file at OUT_JSON and prints "OK <OUT_JSON>" on success.
5
+ #
6
+ # Local branch mode (pre-push review): set LEKKER_LOCAL_REPO=<path to a repo
7
+ # working copy>. Repo discovery, the network fetch, and the origin/<branch>
8
+ # checkout are all skipped; the worktree is created detached at the LOCAL ref
9
+ # passed as PR_BRANCH (a branch name, HEAD, or a sha). Nothing is required to
10
+ # exist on the remote. REPO_SLUG is still used for reporting only.
5
11
 
6
12
  set -euo pipefail
7
13
 
@@ -10,6 +16,8 @@ PR_BRANCH="${2:?PR_BRANCH required}"
10
16
  OUT_JSON="${3:?OUT_JSON required}"
11
17
  PREV_SHA="${4:-}"
12
18
 
19
+ LOCAL_REPO="${LEKKER_LOCAL_REPO:-}"
20
+
13
21
  CACHE_DIR="$HOME/.cache/lekker-review"
14
22
  CACHE_FILE="$CACHE_DIR/repo-map.tsv"
15
23
  NOTES=""
@@ -37,10 +45,22 @@ SLUG_NORM="$(normalize_url "https://github.com/${REPO_SLUG}.git")"
37
45
 
38
46
  REPO_ROOT=""
39
47
 
48
+ # ---------------------------------------------------------------------------
49
+ # 1z. Local branch mode short-circuit -- the caller already knows the repo.
50
+ # ---------------------------------------------------------------------------
51
+ if [[ -n "$LOCAL_REPO" ]]; then
52
+ if ! git -C "$LOCAL_REPO" rev-parse --show-toplevel >/dev/null 2>&1; then
53
+ printf 'ERROR: LEKKER_LOCAL_REPO=%s is not a git repository\n' "$LOCAL_REPO" >&2
54
+ exit 1
55
+ fi
56
+ REPO_ROOT="$(git -C "$LOCAL_REPO" rev-parse --show-toplevel)"
57
+ NOTES="${NOTES}local-branch-mode;"
58
+ fi
59
+
40
60
  # ---------------------------------------------------------------------------
41
61
  # 1a. Try the cache
42
62
  # ---------------------------------------------------------------------------
43
- if [[ -f "$CACHE_FILE" ]]; then
63
+ if [[ -z "$REPO_ROOT" ]] && [[ -f "$CACHE_FILE" ]]; then
44
64
  while IFS=$'\t' read -r cached_slug cached_path; do
45
65
  [[ "$cached_slug" == "$REPO_SLUG" ]] || continue
46
66
  if [[ -d "$cached_path" ]]; then
@@ -85,7 +105,9 @@ fi
85
105
  # ---------------------------------------------------------------------------
86
106
  # 1d. Shallow clone as last resort (not cached)
87
107
  # ---------------------------------------------------------------------------
88
- if [[ -z "$REPO_ROOT" ]]; then
108
+ if [[ -n "$LOCAL_REPO" ]]; then
109
+ : # local mode: repo already resolved, never clone and never cache
110
+ elif [[ -z "$REPO_ROOT" ]]; then
89
111
  CLONE_DIR="/tmp/lekker-clone-$$"
90
112
  git clone --depth=100 "https://github.com/${REPO_SLUG}.git" "$CLONE_DIR"
91
113
  REPO_ROOT="$CLONE_DIR"
@@ -102,14 +124,25 @@ fi
102
124
  # ---------------------------------------------------------------------------
103
125
  # 2. Fetch + worktree
104
126
  # ---------------------------------------------------------------------------
105
- git -C "$REPO_ROOT" fetch origin "$PR_BRANCH" 2>/dev/null || true
106
-
107
- if ! git -C "$REPO_ROOT" worktree add "$WORKTREE_PATH" "origin/$PR_BRANCH" 2>/dev/null; then
108
- if ! git -C "$REPO_ROOT" worktree add "$WORKTREE_PATH" FETCH_HEAD 2>/dev/null; then
109
- printf 'ERROR: could not create worktree at %s\n' "$WORKTREE_PATH" >&2
127
+ if [[ -n "$LOCAL_REPO" ]]; then
128
+ # Detached, so a branch that is currently checked out in the user's own
129
+ # working copy can still be reviewed. No fetch: the point of this mode is
130
+ # that the commits are not on the remote yet.
131
+ if ! git -C "$REPO_ROOT" worktree add --detach "$WORKTREE_PATH" "$PR_BRANCH" 2>/dev/null; then
132
+ printf 'ERROR: could not create local worktree at %s from ref %s\n' \
133
+ "$WORKTREE_PATH" "$PR_BRANCH" >&2
110
134
  exit 1
111
135
  fi
112
- NOTES="${NOTES}worktree-used-FETCH_HEAD;"
136
+ else
137
+ git -C "$REPO_ROOT" fetch origin "$PR_BRANCH" 2>/dev/null || true
138
+
139
+ if ! git -C "$REPO_ROOT" worktree add "$WORKTREE_PATH" "origin/$PR_BRANCH" 2>/dev/null; then
140
+ if ! git -C "$REPO_ROOT" worktree add "$WORKTREE_PATH" FETCH_HEAD 2>/dev/null; then
141
+ printf 'ERROR: could not create worktree at %s\n' "$WORKTREE_PATH" >&2
142
+ exit 1
143
+ fi
144
+ NOTES="${NOTES}worktree-used-FETCH_HEAD;"
145
+ fi
113
146
  fi
114
147
 
115
148
  # ---------------------------------------------------------------------------
@@ -128,7 +161,17 @@ fi
128
161
  # of the whole repo -- see scripts/changed-files.sh).
129
162
  # ---------------------------------------------------------------------------
130
163
  CHANGED_FILES_FILE="/tmp/lekker-changed-$$.txt"
131
- BASE_REF_NOTE="$("$(dirname "$0")/changed-files.sh" "$WORKTREE_PATH" 2>&1 >"$CHANGED_FILES_FILE" | sed -n 's/^base-ref: //p')" || true
164
+ CF_ERR_FILE="$(mktemp "${TMPDIR:-/tmp}/lekker-changed-err.XXXXXX")"
165
+ chmod 600 "$CF_ERR_FILE"
166
+ trap 'rm -f "$CF_ERR_FILE"' EXIT
167
+ if ! "$(dirname "$0")/changed-files.sh" "$WORKTREE_PATH" \
168
+ >"$CHANGED_FILES_FILE" 2>"$CF_ERR_FILE"; then
169
+ cat "$CF_ERR_FILE" >&2
170
+ exit 1
171
+ fi
172
+ BASE_REF_NOTE="$(sed -n 's/^base-ref: //p' "$CF_ERR_FILE")"
173
+ MERGE_BASE_NOTE="$(sed -n 's/^merge-base: //p' "$CF_ERR_FILE")"
174
+ rm -f "$CF_ERR_FILE"
132
175
 
133
176
  # A blank line here would make `grep -F -f` match EVERY tsc error line, turning
134
177
  # the repo's standing type debt into "errors this PR introduced". Strip them.
@@ -137,6 +180,7 @@ if [[ -f "$CHANGED_FILES_FILE" ]]; then
137
180
  mv "${CHANGED_FILES_FILE}.clean" "$CHANGED_FILES_FILE" 2>/dev/null || true
138
181
  fi
139
182
 
183
+ MERGE_BASE_VAL="${MERGE_BASE_NOTE:-null}"
140
184
  BASE_REF_VAL="null"
141
185
  if [[ -n "$BASE_REF_NOTE" ]] && [[ "$BASE_REF_NOTE" != "unknown" ]]; then
142
186
  BASE_REF_VAL="$BASE_REF_NOTE"
@@ -282,14 +326,15 @@ python3 - \
282
326
  "$ESLINT_SCOPE_FILE" \
283
327
  "$TSC_CHANGED_FILE" \
284
328
  "$TSC_COUNT_FILE" \
329
+ "$MERGE_BASE_VAL" \
285
330
  "$OUT_JSON" <<'PYEOF'
286
331
  import json, sys, os
287
332
 
288
333
  (worktree_path, repo_root, head_sha, head_sha_short,
289
334
  tsc_file, eslint_file, rules_file, delta_file, notes,
290
335
  changed_files_file, base_ref_val, eslint_scope_file,
291
- tsc_changed_file, tsc_count_file,
292
- out_json) = sys.argv[1:16]
336
+ tsc_changed_file, tsc_count_file, merge_base_val,
337
+ out_json) = sys.argv[1:17]
293
338
 
294
339
  def read_file(path):
295
340
  if not os.path.exists(path):
@@ -318,6 +363,7 @@ data = {
318
363
  "notes": notes,
319
364
  "changedFiles": changed_files,
320
365
  "baseRef": None if base_ref_val == "null" else base_ref_val,
366
+ "mergeBase": None if merge_base_val == "null" else merge_base_val,
321
367
  "eslintScope": eslint_scope,
322
368
  "tscChangedTail": read_file(tsc_changed_file),
323
369
  "tscErrorCount": tsc_error_count,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olegkoval/agent-skills",
3
- "version": "1.42.3",
3
+ "version": "1.43.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-apple-kit",
3
3
  "description": "Build and ship Apple platform apps: macOS menubar apps, App Store submissions.",
4
- "version": "1.42.3",
4
+ "version": "1.43.1",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-creative",
3
3
  "description": "Creative and personal projects: photo galleries, music players, listings, wiki editing.",
4
- "version": "1.42.3",
4
+ "version": "1.43.1",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-garmin-kit",
3
3
  "description": "Build, test and publish Garmin Connect IQ watch faces.",
4
- "version": "1.42.3",
4
+ "version": "1.43.1",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-git-tools",
3
3
  "description": "Everyday git and GitHub CLI operations: conventional commits, branch hygiene.",
4
- "version": "1.42.3",
4
+ "version": "1.43.1",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-github-pr",
3
3
  "description": "Drive GitHub pull requests to merge-ready: review-bot loops, CI fixes, descriptions, dependency triage.",
4
- "version": "1.42.3",
4
+ "version": "1.43.1",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },