@osfactory/har 0.54.1 → 0.55.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.
@@ -326,6 +326,49 @@ har_regenerate_agent_env_file() {
326
326
  fi
327
327
  }
328
328
 
329
+ # Untracked (not ignored) paths stay in the main checkout when a session
330
+ # worktree is created from HEAD. Advisory — never fails the launch.
331
+ har_warn_untracked_worktree() {
332
+ case "${USE_WORKTREE:-${HARNESS_USE_WORKTREE:-true}}" in
333
+ true|TRUE|yes|YES|1) ;;
334
+ *) return 0 ;;
335
+ esac
336
+ local root="${REPO_ROOT:-}"
337
+ if [ -z "$root" ] && [ -n "${SCRIPT_DIR:-}" ]; then
338
+ root="$(cd "$SCRIPT_DIR/.." && pwd)"
339
+ fi
340
+ [ -n "$root" ] || return 0
341
+ git -C "$root" rev-parse --is-inside-work-tree >/dev/null 2>&1 || return 0
342
+
343
+ local paths=()
344
+ local entry
345
+ while IFS= read -r -d '' entry; do
346
+ paths+=("$entry")
347
+ done < <(git -C "$root" --literal-pathspecs ls-files --others --exclude-standard --directory -z 2>/dev/null || true)
348
+
349
+ local count="${#paths[@]}"
350
+ [ "$count" -gt 0 ] || return 0
351
+
352
+ local max=8
353
+ local listed=""
354
+ local i
355
+ for ((i = 0; i < count && i < max; i++)); do
356
+ [ -n "$listed" ] && listed+=", "
357
+ listed+="${paths[$i]}"
358
+ done
359
+ if [ "$count" -gt "$max" ]; then
360
+ listed+=" (+$((count - max)) more)"
361
+ fi
362
+
363
+ local noun="paths"
364
+ local them="They are"
365
+ if [ "$count" -eq 1 ]; then
366
+ noun="path"
367
+ them="It is"
368
+ fi
369
+ echo "WARN: ${count} untracked ${noun} will not appear in the session worktree: ${listed}. ${them} only in the main checkout — track them, or launch with --no-worktree." >&2
370
+ }
371
+
329
372
  # har_launch_preflight <agent_id> [resume]
330
373
  # Exit 0 when ready; 2 when occupied (free the slot first) or not resumable; 1 on machine blockers.
331
374
  # Sets FE_PORT/API_PORT/DEBUG_PORT when this harness uses PM2.
@@ -364,6 +407,7 @@ har_launch_preflight() {
364
407
  fi
365
408
  done
366
409
  fi
410
+ har_warn_untracked_worktree
367
411
  return 0
368
412
  }
369
413
 
@@ -310,6 +310,49 @@ EOF
310
310
  fi
311
311
  }
312
312
 
313
+ # Untracked (not ignored) paths stay in the main checkout when a session
314
+ # worktree is created from HEAD. Advisory — never fails the launch.
315
+ har_warn_untracked_worktree() {
316
+ case "${USE_WORKTREE:-${HARNESS_USE_WORKTREE:-true}}" in
317
+ true|TRUE|yes|YES|1) ;;
318
+ *) return 0 ;;
319
+ esac
320
+ local root="${REPO_ROOT:-}"
321
+ if [ -z "$root" ] && [ -n "${SCRIPT_DIR:-}" ]; then
322
+ root="$(cd "$SCRIPT_DIR/.." && pwd)"
323
+ fi
324
+ [ -n "$root" ] || return 0
325
+ git -C "$root" rev-parse --is-inside-work-tree >/dev/null 2>&1 || return 0
326
+
327
+ local paths=()
328
+ local entry
329
+ while IFS= read -r -d '' entry; do
330
+ paths+=("$entry")
331
+ done < <(git -C "$root" --literal-pathspecs ls-files --others --exclude-standard --directory -z 2>/dev/null || true)
332
+
333
+ local count="${#paths[@]}"
334
+ [ "$count" -gt 0 ] || return 0
335
+
336
+ local max=8
337
+ local listed=""
338
+ local i
339
+ for ((i = 0; i < count && i < max; i++)); do
340
+ [ -n "$listed" ] && listed+=", "
341
+ listed+="${paths[$i]}"
342
+ done
343
+ if [ "$count" -gt "$max" ]; then
344
+ listed+=" (+$((count - max)) more)"
345
+ fi
346
+
347
+ local noun="paths"
348
+ local them="They are"
349
+ if [ "$count" -eq 1 ]; then
350
+ noun="path"
351
+ them="It is"
352
+ fi
353
+ echo "WARN: ${count} untracked ${noun} will not appear in the session worktree: ${listed}. ${them} only in the main checkout — track them, or launch with --no-worktree." >&2
354
+ }
355
+
313
356
  # har_launch_preflight <agent_id> [resume]
314
357
  # Exit 0 when ready; 2 when occupied (free the slot first) or not resumable; 1 on machine blockers.
315
358
  har_launch_preflight() {
@@ -346,6 +389,7 @@ har_launch_preflight() {
346
389
  fi
347
390
  done
348
391
  fi
392
+ har_warn_untracked_worktree
349
393
  return 0
350
394
  }
351
395
 
@@ -239,6 +239,49 @@ print_slot_occupied_warning() {
239
239
  echo "" >&2
240
240
  }
241
241
 
242
+ # Untracked (not ignored) paths stay in the main checkout when a session
243
+ # worktree is created from HEAD. Advisory — never fails the launch.
244
+ har_warn_untracked_worktree() {
245
+ case "${USE_WORKTREE:-${HARNESS_USE_WORKTREE:-true}}" in
246
+ true|TRUE|yes|YES|1) ;;
247
+ *) return 0 ;;
248
+ esac
249
+ local root="${REPO_ROOT:-}"
250
+ if [ -z "$root" ] && [ -n "${SCRIPT_DIR:-}" ]; then
251
+ root="$(cd "$SCRIPT_DIR/.." && pwd)"
252
+ fi
253
+ [ -n "$root" ] || return 0
254
+ git -C "$root" rev-parse --is-inside-work-tree >/dev/null 2>&1 || return 0
255
+
256
+ local paths=()
257
+ local entry
258
+ while IFS= read -r -d '' entry; do
259
+ paths+=("$entry")
260
+ done < <(git -C "$root" --literal-pathspecs ls-files --others --exclude-standard --directory -z 2>/dev/null || true)
261
+
262
+ local count="${#paths[@]}"
263
+ [ "$count" -gt 0 ] || return 0
264
+
265
+ local max=8
266
+ local listed=""
267
+ local i
268
+ for ((i = 0; i < count && i < max; i++)); do
269
+ [ -n "$listed" ] && listed+=", "
270
+ listed+="${paths[$i]}"
271
+ done
272
+ if [ "$count" -gt "$max" ]; then
273
+ listed+=" (+$((count - max)) more)"
274
+ fi
275
+
276
+ local noun="paths"
277
+ local them="They are"
278
+ if [ "$count" -eq 1 ]; then
279
+ noun="path"
280
+ them="It is"
281
+ fi
282
+ echo "WARN: ${count} untracked ${noun} will not appear in the session worktree: ${listed}. ${them} only in the main checkout — track them, or launch with --no-worktree." >&2
283
+ }
284
+
242
285
  git_common_dir() {
243
286
  local cwd="$1"
244
287
  local out
@@ -56,6 +56,8 @@ if slot_is_occupied "$AGENT_ID"; then
56
56
  exit 2
57
57
  fi
58
58
 
59
+ har_warn_untracked_worktree
60
+
59
61
  "$SCRIPT_DIR/setup-infra.sh"
60
62
 
61
63
  # Session worktree (default — use --no-worktree to work in repo root).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osfactory/har",
3
- "version": "0.54.1",
3
+ "version": "0.55.0",
4
4
  "description": "Open harness for reproducible multi-agent coding workflows",
5
5
  "keywords": [
6
6
  "har",