@caddis/cli 0.4.105 → 0.4.107

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "caddis",
3
- "version": "1.3.189",
3
+ "version": "1.3.191",
4
4
  "description": "caddis — agent-agnostic dev harness as an Antigravity (agy) plugin: TDD skills + commands, single-sourced with the Claude Code plugin."
5
5
  }
@@ -17,6 +17,7 @@ through a `subprocess.run`-shaped seam and orca through a `Popen`-shaped one; ne
17
17
  """
18
18
  from __future__ import annotations
19
19
 
20
+ import contextlib
20
21
  import json
21
22
  import os
22
23
  import shutil
@@ -582,37 +583,39 @@ def _start_sweep(argv: list[str], log: Path) -> None:
582
583
  start_new_session=os.name != "nt", close_fds=True)
583
584
 
584
585
 
585
- def _claim_stamp(stamp: Path, now: float) -> bool:
586
- """True when this process won the sweep for this window. Two sessions that start at once: exactly one wins.
586
+ def _claim_stamp(folder: Path, now: float) -> Path | None:
587
+ """The claim file when this process won the sweep for this window, else None. Two sessions at once: one wins.
587
588
 
588
- The stamp is created with O_EXCL. An existing stamp inside the window means no. An expired one is moved aside
589
- with one rename (only one racer's rename succeeds), then created again with O_EXCL.
589
+ Each claim is a numbered file in `folder` that holds the claim time. The newest claim inside the window means
590
+ no. When it has expired, the next number is created with O_EXCL: only one racer can create it. No step moves or
591
+ deletes a claim that another racer may still be reading, so a racer that read an expired claim cannot remove a
592
+ fresh one. An empty claim (a racer has not written the time yet, or was killed before it did) dates from its
593
+ modified time, so it expires too. Claims older than the previous one are deleted; the previous one stays, so a
594
+ slow racer that read it fails its O_EXCL on ours.
590
595
  """
591
- for _ in range(2):
596
+ numbers = sorted((int(p.name) for p in folder.iterdir() if p.name.isascii() and p.name.isdigit()), reverse=True)
597
+ newest = numbers[0] if numbers else 0
598
+ if numbers:
592
599
  try:
593
- fd = os.open(stamp, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
594
- except FileExistsError:
595
- try:
596
- text = stamp.read_text(encoding="utf-8").strip()
597
- if not text: # a racer created it and has not written the time yet
598
- return False
599
- last = float(text)
600
- except ValueError:
601
- last = 0.0 # unreadable: treat as expired
602
- except OSError:
603
- return False
604
- if 0 <= now - last < ORCA_SWEEP_EVERY_S:
605
- return False
606
- try:
607
- stamp.rename(stamp.with_name(f"{stamp.name}.{os.getpid()}.old"))
608
- except OSError:
609
- return False # another racer moved it first
610
- stamp.with_name(f"{stamp.name}.{os.getpid()}.old").unlink(missing_ok=True)
611
- continue
612
- with os.fdopen(fd, "w", encoding="utf-8") as fh:
613
- fh.write(str(int(now)))
614
- return True
615
- return False
600
+ text = (folder / str(newest)).read_text(encoding="utf-8").strip()
601
+ last = float(text) if text else (folder / str(newest)).stat().st_mtime
602
+ except ValueError:
603
+ last = 0.0 # unreadable: treat as expired
604
+ except OSError:
605
+ return None
606
+ if 0 <= now - last < ORCA_SWEEP_EVERY_S:
607
+ return None
608
+ claim = folder / str(newest + 1)
609
+ try:
610
+ fd = os.open(claim, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
611
+ except OSError:
612
+ return None # another racer created this claim first
613
+ with os.fdopen(fd, "w", encoding="utf-8") as fh:
614
+ fh.write(str(int(now)))
615
+ for old in numbers[1:]:
616
+ with contextlib.suppress(OSError):
617
+ (folder / str(old)).unlink(missing_ok=True)
618
+ return claim
616
619
 
617
620
 
618
621
  def orca_sweep(main: Path, orca_linked: int, env: Mapping[str, str], home: Path, now: float,
@@ -628,10 +631,13 @@ def orca_sweep(main: Path, orca_linked: int, env: Mapping[str, str], home: Path,
628
631
  if not tidy.is_file():
629
632
  return None
630
633
  stamps = home / ".caddis" / "orca-sweep"
631
- stamp = stamps / (_key(main).replace(":", "").replace("\\", "-").replace("/", "-").strip("-") + ".stamp")
634
+ folder = stamps / _key(main).replace(":", "").replace("\\", "-").replace("/", "-").strip("-")
635
+ with contextlib.suppress(OSError):
636
+ folder.with_name(folder.name + ".stamp").unlink(missing_ok=True) # the one-file stamp of caddis <= 1.3.190
632
637
  try:
633
- stamps.mkdir(parents=True, exist_ok=True)
634
- if not _claim_stamp(stamp, now):
638
+ folder.mkdir(parents=True, exist_ok=True)
639
+ stamp = _claim_stamp(folder, now)
640
+ if stamp is None:
635
641
  return None
636
642
  log = home / ".caddis" / "logs" / "orca-sweep.log"
637
643
  log.parent.mkdir(parents=True, exist_ok=True)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "1.3.188",
4
- "generated": "2026-11-11 21:19 UTC",
3
+ "version": "1.3.190",
4
+ "generated": "2026-11-12 00:50 UTC",
5
5
  "commands": [
6
6
  {
7
7
  "name": "add-rules",
@@ -1,7 +1,7 @@
1
1
  {
2
- "poolVersion": "1.3.189",
2
+ "poolVersion": "1.3.191",
3
3
  "bundles": {
4
- "antigravity-plugin": "1.3.189",
4
+ "antigravity-plugin": "1.3.191",
5
5
  "antigravity-plugin-extras": "1.3.52",
6
6
  "codex": "unknown"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caddis/cli",
3
- "version": "0.4.105",
3
+ "version": "0.4.107",
4
4
  "description": "Install, update and diagnose the caddis dev harness across every coding agent you use (Claude Code, agy/Antigravity, and more).",
5
5
  "keywords": [
6
6
  "caddis",