@caddis/cli 0.4.113 → 0.4.115

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.
Files changed (33) hide show
  1. package/bundles/antigravity-plugin/plugin.json +1 -1
  2. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_exit.cpython-311.pyc +0 -0
  3. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_file_lock.cpython-311.pyc +0 -0
  4. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_frontmatter.cpython-311.pyc +0 -0
  5. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_redact.cpython-311.pyc +0 -0
  6. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_roadmap.cpython-311.pyc +0 -0
  7. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_rows.cpython-311.pyc +0 -0
  8. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_status.cpython-311.pyc +0 -0
  9. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_tidy.cpython-311.pyc +0 -0
  10. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_todo.cpython-311.pyc +0 -0
  11. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_workstreams.cpython-311.pyc +0 -0
  12. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_worktree_safety.cpython-311.pyc +0 -0
  13. package/bundles/antigravity-plugin/scripts/caddis_coordinate.py +107 -1
  14. package/bundles/antigravity-plugin/scripts/caddis_guide.json +34 -7
  15. package/bundles/antigravity-plugin/scripts/caddis_stories.py +760 -0
  16. package/bundles/antigravity-plugin/skills/_registry.md +1 -0
  17. package/bundles/antigravity-plugin/skills/coordinate/SKILL.md +6 -2
  18. package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +15 -0
  19. package/bundles/antigravity-plugin/skills/implement/SKILL.md +5 -0
  20. package/bundles/antigravity-plugin/skills/stories/SKILL.md +50 -0
  21. package/bundles/manifest.json +2 -2
  22. package/dist/cli.js +207 -113
  23. package/dist/ui/assets/{Activity-B816JVqx.js → Activity-CITEjSUJ.js} +1 -1
  24. package/dist/ui/assets/Benchmarks-B2_1oerW.css +1 -0
  25. package/dist/ui/assets/Benchmarks-ChQoYa0P.js +1 -0
  26. package/dist/ui/assets/{Guide-CnL1DiTr.js → Guide-9Ob-m7gx.js} +1 -1
  27. package/dist/ui/assets/{Palette-BKM_A64G.js → Palette-CinCoveU.js} +1 -1
  28. package/dist/ui/assets/{RoadmapTab-DhC4-kqv.js → RoadmapTab-BeD4-8IU.js} +2 -2
  29. package/dist/ui/assets/{external-link-DagTFCsV.js → external-link-D_rks7KV.js} +1 -1
  30. package/dist/ui/assets/index-CFKn_GzG.js +231 -0
  31. package/dist/ui/index.html +1 -1
  32. package/package.json +1 -1
  33. package/dist/ui/assets/index-Bj5qA-fq.js +0 -226
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "caddis",
3
- "version": "1.3.197",
3
+ "version": "1.3.199",
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
  }
@@ -986,6 +986,7 @@ def ask_remove(rid: str, ask_id: str) -> bool:
986
986
  # --- command line (C1.5) ------------------------------------------------------------------------------------------
987
987
 
988
988
  EXIT_OK, EXIT_ERROR, EXIT_USAGE, EXIT_LOCK_REFUSED = 0, 1, 2, 3
989
+ EXIT_UNKNOWN = 4 # `stake` could not tell: the caller warns every live peer (fail closed)
989
990
 
990
991
 
991
992
  def _gh_head_of(rid: str) -> Callable[[int], str | None]:
@@ -1650,6 +1651,105 @@ def _claude_agents() -> list[dict]:
1650
1651
  return value
1651
1652
 
1652
1653
 
1654
+ # --- stake test (design 7.3a) --------------------------------------------------------------------------------------
1655
+
1656
+ _SESSION_ENV_VARS = ("CADDIS_SESSION_ID", "CLAUDE_SESSION_ID", "CLAUDE_CODE_SESSION_ID") # as caddis_adhoc
1657
+ _WIN_ABS = re.compile(r"^(?:[A-Za-z]:[\\/]|[\\/]{2})") # E:\ or E:/ or a UNC path
1658
+
1659
+
1660
+ def _path_key(path: str) -> str | None:
1661
+ """Return a comparable key for an absolute path, else None (unknown).
1662
+
1663
+ Separators become `/`, `.` and `..` collapse, and case folds on every platform: a false match only adds a
1664
+ warning, a missed match drops one (fail closed). A path real on this machine is resolved first (junctions)."""
1665
+ text = path.strip()
1666
+ if not text or not (os.path.isabs(text) or _WIN_ABS.match(text)):
1667
+ return None
1668
+ if os.path.isabs(text):
1669
+ text = os.path.realpath(text)
1670
+ text = text.replace("\\", "/")
1671
+ unc = text.startswith("//")
1672
+ text = re.sub(r"/{2,}", "/", text)
1673
+ parts: list[str] = []
1674
+ for part in text.split("/"):
1675
+ if part == "..":
1676
+ if len(parts) > 1:
1677
+ parts.pop()
1678
+ elif part not in (".", "") or not parts:
1679
+ parts.append(part)
1680
+ return ("/" if unc else "") + "/".join(parts).casefold()
1681
+
1682
+
1683
+ def _inside(key: str, root: str) -> bool:
1684
+ return key == root or key.startswith(root.rstrip("/") + "/")
1685
+
1686
+
1687
+ def stake_report(agents: list[dict], roots: list[str]) -> list[tuple[str, str, str]]:
1688
+ """Return `(verdict, name, detail)` per agent: `STAKE` with a reason, or `NO-STAKE` with its cwd.
1689
+
1690
+ `roots` are the checkout and its worktrees. The caller's own session (sessionId equal to a session env
1691
+ variable) is left out. A cwd that is missing, empty or not absolute is a stake."""
1692
+ own = {os.environ[v] for v in _SESSION_ENV_VARS if os.environ.get(v)}
1693
+ root_keys = [(root, key) for root in roots if (key := _path_key(root)) is not None]
1694
+ report = []
1695
+ for agent in agents:
1696
+ if own and agent.get("sessionId") in own:
1697
+ continue
1698
+ name = str(agent.get("name") or agent.get("sessionId") or "<unnamed>")
1699
+ cwd = agent.get("cwd")
1700
+ key = _path_key(cwd) if isinstance(cwd, str) else None
1701
+ if key is None:
1702
+ report.append(("STAKE", name, f"cwd unknown ({cwd!r})"))
1703
+ continue
1704
+ hit = next((root for root, root_key in root_keys if _inside(key, root_key)), None)
1705
+ if hit is not None:
1706
+ report.append(("STAKE", name, f"cwd {cwd} is in {hit}"))
1707
+ else:
1708
+ report.append(("NO-STAKE", name, cwd))
1709
+ return report
1710
+
1711
+
1712
+ def _repo_roots(repo: Path) -> list[str]:
1713
+ """Return the checkout and every worktree of the repo at `repo`. Raise OSError when git cannot tell."""
1714
+ try:
1715
+ result = _run(["git", "-C", str(repo), "worktree", "list", "--porcelain"])
1716
+ except subprocess.TimeoutExpired as exc:
1717
+ raise OSError(f"git worktree list timed out after {_TIMEOUT} s") from exc
1718
+ if result.returncode != 0:
1719
+ detail = " ".join((result.stderr or result.stdout or "").split()) or f"exit {result.returncode}"
1720
+ raise OSError(f"git worktree list failed in {repo}: {detail}")
1721
+ roots = [line[len("worktree "):].strip() for line in result.stdout.splitlines() if line.startswith("worktree ")]
1722
+ if not roots:
1723
+ raise OSError(f"git worktree list printed no worktree for {repo}")
1724
+ return [str(repo.resolve())] + roots
1725
+
1726
+
1727
+ def _stake(args: argparse.Namespace) -> int:
1728
+ """Print `STAKE`/`NO-STAKE` per peer and a summary; `STAKE-UNKNOWN: <reason>` and exit 4 when it cannot tell."""
1729
+ try:
1730
+ if args.agents_json:
1731
+ try:
1732
+ agents = json.loads(Path(args.agents_json).read_text(encoding="utf-8"))
1733
+ except ValueError as exc:
1734
+ raise ValueError("the agents file is not JSON") from exc
1735
+ else:
1736
+ agents = _claude_agents()
1737
+ if not isinstance(agents, list) or not all(isinstance(a, dict) for a in agents):
1738
+ raise ValueError("the agents list is not a JSON list of objects")
1739
+ report = stake_report(agents, _repo_roots(Path(args.repo)))
1740
+ except (OSError, ValueError, subprocess.SubprocessError) as exc:
1741
+ reason = " ".join(str(exc).split()) or type(exc).__name__
1742
+ _emit(args, {"result": "unknown", "reason": reason}, f"STAKE-UNKNOWN: {reason}")
1743
+ return EXIT_UNKNOWN
1744
+ stakes = sum(1 for verdict, _, _ in report if verdict == "STAKE")
1745
+ skipped = len(agents) - len(report)
1746
+ summary = f"SUMMARY: {stakes} stake, {len(report) - stakes} no stake, {skipped} self skipped"
1747
+ lines = [f"{verdict} {name} {detail}" for verdict, name, detail in report] + [summary]
1748
+ _emit(args, {"result": "ok", "peers": [{"verdict": v, "name": n, "detail": d} for v, n, d in report],
1749
+ "self_skipped": skipped}, "\n".join(lines))
1750
+ return EXIT_OK
1751
+
1752
+
1653
1753
  def _waits_on(text: str) -> list[dict]:
1654
1754
  try:
1655
1755
  value = json.loads(text)
@@ -1691,6 +1791,10 @@ def _parser() -> argparse.ArgumentParser:
1691
1791
  p.add_argument("--pr", type=int, required=True, help="the PR whose diff to check (`gh pr diff`)")
1692
1792
  p.add_argument("--gh-repo", help="owner/name for `gh pr diff -R` (default: the current folder's repo)")
1693
1793
 
1794
+ p = command("stake", repo=False)
1795
+ p.add_argument("--repo", required=True, help="a path to the checkout or one of its worktrees (not a repo id)")
1796
+ p.add_argument("--agents-json", help="read the agents list from this file, not `claude agents --json` (tests)")
1797
+
1694
1798
  p = command("session", repo=False)
1695
1799
  which = p.add_mutually_exclusive_group(required=True)
1696
1800
  which.add_argument("--session-id", help="the Claude Code sessionId to find")
@@ -1778,6 +1882,8 @@ def _dispatch(args: argparse.Namespace) -> int:
1778
1882
  rid = repo_id_for(Path(args.path))
1779
1883
  _emit(args, {"repo": rid}, rid)
1780
1884
  return EXIT_OK
1885
+ if args.command == "stake":
1886
+ return _stake(args)
1781
1887
  if args.command == "session":
1782
1888
  found = session_lookup(_claude_agents(), session_id=args.session_id, name=args.name)
1783
1889
  _emit(args, found, f"pid {found['pid']} ({found['name']})")
@@ -1891,7 +1997,7 @@ def _dispatch(args: argparse.Namespace) -> int:
1891
1997
 
1892
1998
  def main(argv: list[str] | None = None) -> int:
1893
1999
  """Run one subcommand. Exit 0 on success, 1 on an error (one line on stderr), 2 on a usage error, 3 when the
1894
- lock is refused."""
2000
+ lock is refused, 4 when `stake` cannot tell (`STAKE-UNKNOWN`)."""
1895
2001
  try:
1896
2002
  parser = _parser()
1897
2003
  args = parser.parse_args(argv)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "1.3.196",
4
- "generated": "2026-11-13 12:58 UTC",
3
+ "version": "1.3.198",
4
+ "generated": "2026-11-14 01:11 UTC",
5
5
  "commands": [
6
6
  {
7
7
  "name": "add-rules",
@@ -308,6 +308,10 @@
308
308
  "1",
309
309
  "Scope check"
310
310
  ],
311
+ [
312
+ "1b",
313
+ "Jira Epic and Confluence page (interactive only)"
314
+ ],
311
315
  [
312
316
  "2",
313
317
  "Design phases"
@@ -331,10 +335,6 @@
331
335
  [
332
336
  "",
333
337
  "Global Constraints"
334
- ],
335
- [
336
- "",
337
- "Review Focus"
338
338
  ]
339
339
  ],
340
340
  "scripts": [
@@ -633,6 +633,7 @@
633
633
  "caddis_silence_watch.py",
634
634
  "caddis_spend.py",
635
635
  "caddis_status.py",
636
+ "caddis_stories.py",
636
637
  "caddis_tidy.py",
637
638
  "caddis_todo.py"
638
639
  ],
@@ -1270,6 +1271,32 @@
1270
1271
  "stage": "continuity",
1271
1272
  "daily": false
1272
1273
  },
1274
+ {
1275
+ "name": "stories",
1276
+ "description": "Publish a plan's phases as development stories to the Jira Epic's Confluence page — one marked section per plan",
1277
+ "hint": "<plan path>",
1278
+ "steps": [
1279
+ [
1280
+ "",
1281
+ "Input"
1282
+ ],
1283
+ [
1284
+ "",
1285
+ "Steps"
1286
+ ],
1287
+ [
1288
+ "",
1289
+ "Exit codes"
1290
+ ]
1291
+ ],
1292
+ "scripts": [
1293
+ "caddis_stories.py",
1294
+ "caddis_todo.py"
1295
+ ],
1296
+ "noArgs": false,
1297
+ "stage": "knowledge",
1298
+ "daily": false
1299
+ },
1273
1300
  {
1274
1301
  "name": "tdd",
1275
1302
  "description": "Run a strict red-green-refactor TDD cycle for a unit of behavior",
@@ -2464,7 +2491,7 @@
2464
2491
  ]
2465
2492
  },
2466
2493
  "counts": {
2467
- "commands": 41,
2494
+ "commands": 42,
2468
2495
  "agents": 12,
2469
2496
  "skills": 134,
2470
2497
  "core": 51,