@caddis/cli 0.4.83 → 0.4.85
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/bundles/antigravity-plugin/plugin.json +1 -1
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_exit.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_file_lock.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_frontmatter.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_redact.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_roadmap.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_rows.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_tidy.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_todo.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_workstreams.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_worktree_safety.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/caddis_roadmap.py +112 -194
- package/bundles/antigravity-plugin/scripts/caddis_roadmap_run.py +5 -25
- package/bundles/antigravity-plugin/scripts/claudster_doctor.py +24 -0
- package/bundles/antigravity-plugin/skills/catchup/SKILL.md +2 -4
- package/bundles/antigravity-plugin/skills/coordinate/SKILL.md +1 -1
- package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +1 -1
- package/bundles/antigravity-plugin/skills/handoff/SKILL.md +1 -7
- package/bundles/antigravity-plugin/skills/implement/SKILL.md +1 -1
- package/bundles/antigravity-plugin/skills/pr-merge/SKILL.md +2 -3
- package/bundles/antigravity-plugin/skills/roadmap/SKILL.md +0 -1
- package/bundles/codex/.codex/skills/workflow/roadmap/SKILL.md +0 -1
- package/bundles/manifest.json +2 -2
- package/dist/cli.js +7 -1
- package/package.json +1 -1
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_roadmap_page.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/caddis_roadmap_page.py +0 -1441
- package/bundles/antigravity-plugin/scripts/roadmap_assets/fonts.css +0 -5
- package/bundles/antigravity-plugin/scripts/roadmap_assets/icons.svg +0 -2
- package/dist/ui/fonts/LICENSE-Lucide.txt +0 -43
- package/dist/ui/fonts/OFL-Atkinson.txt +0 -93
- package/dist/ui/fonts/OFL-MapleMono.txt +0 -93
- /package/{bundles/antigravity-plugin/scripts/roadmap_assets → dist/export/licenses}/LICENSE-Lucide.txt +0 -0
- /package/{bundles/antigravity-plugin/scripts/roadmap_assets → dist/export/licenses}/OFL-Atkinson.txt +0 -0
- /package/{bundles/antigravity-plugin/scripts/roadmap_assets → dist/export/licenses}/OFL-MapleMono.txt +0 -0
- /package/dist/{export/fonts → ui/licenses}/LICENSE-Lucide.txt +0 -0
- /package/dist/{export/fonts → ui/licenses}/OFL-Atkinson.txt +0 -0
- /package/dist/{export/fonts → ui/licenses}/OFL-MapleMono.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bundles/antigravity-plugin/scripts/__pycache__/caddis_worktree_safety.cpython-311.pyc
CHANGED
|
Binary file
|
|
@@ -104,7 +104,7 @@ except ModuleNotFoundError as exc:
|
|
|
104
104
|
_NO_WINDOW = 0x08000000 if os.name == "nt" else 0
|
|
105
105
|
|
|
106
106
|
SCRIPTS_DIR = Path(__file__).resolve().parent
|
|
107
|
-
# This module object, taken while it loads.
|
|
107
|
+
# This module object, taken while it loads. build() uses it unless a test passes a stand-in. A lookup by name at call time
|
|
108
108
|
# (`sys.modules[__name__]`) can return a different copy when the file was loaded twice in one process.
|
|
109
109
|
_THIS_MODULE = sys.modules[__name__]
|
|
110
110
|
STATUSES = ("todo", "in-progress", "code-done/data-pending", "done", "not-needed")
|
|
@@ -248,7 +248,7 @@ def default_branch(root: Path) -> str:
|
|
|
248
248
|
if proc.returncode == 0 and ref.startswith("refs/remotes/origin/"):
|
|
249
249
|
return ref[len("refs/remotes/origin/"):]
|
|
250
250
|
if not FETCH:
|
|
251
|
-
# No network when fetch is off (the collector
|
|
251
|
+
# No network when fetch is off (the hub collector): use the one local origin branch.
|
|
252
252
|
found = [name for name in ("main", "master")
|
|
253
253
|
if _git(root, "rev-parse", "--verify", "--quiet", f"refs/remotes/origin/{name}^{{commit}}",
|
|
254
254
|
check=False).returncode == 0]
|
|
@@ -265,7 +265,7 @@ def default_branch(root: Path) -> str:
|
|
|
265
265
|
caddis_exit.NOT_RUN)
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
FETCH = True #
|
|
268
|
+
FETCH = True # the hub collector turns it off for one call: read the origin refs the repo has
|
|
269
269
|
|
|
270
270
|
|
|
271
271
|
def fetch(root: Path) -> str:
|
|
@@ -2204,20 +2204,120 @@ def list_roadmaps_checked(root: Path) -> tuple[list[str], set[str] | None]:
|
|
|
2204
2204
|
return sorted(slugs), folders
|
|
2205
2205
|
|
|
2206
2206
|
|
|
2207
|
+
# ---- roadmap detail (R68): status() plus the plan headers, the Tracker cells and the runner -------------------
|
|
2208
|
+
|
|
2209
|
+
PHASE_HEADER = re.compile(r"^###\s+Phase\s+(\d+)[a-z]?\s*[-–—:]\s*(.+?)\s*(?:[✅⏳\U0001F532].*)?$",
|
|
2210
|
+
re.MULTILINE)
|
|
2211
|
+
_FACT = re.compile(r"\*\*(Model|Lane|Risk):\*\*\s*([^\n]+?)\s*(?=\*\*(?:Model|Lane|Risk):\*\*|$)",
|
|
2212
|
+
re.MULTILINE)
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
def _read_json(path: Path | None):
|
|
2216
|
+
"""(data, error): data is a dict or None; error names a file that exists but cannot be read."""
|
|
2217
|
+
if path is None:
|
|
2218
|
+
return None, ""
|
|
2219
|
+
try:
|
|
2220
|
+
raw = Path(path).read_text(encoding="utf-8")
|
|
2221
|
+
except FileNotFoundError:
|
|
2222
|
+
return None, ""
|
|
2223
|
+
except (OSError, UnicodeDecodeError) as exc:
|
|
2224
|
+
return None, f"{Path(path).name}: {getattr(exc, 'strerror', None) or exc}"
|
|
2225
|
+
try:
|
|
2226
|
+
data = json.loads(raw)
|
|
2227
|
+
except ValueError:
|
|
2228
|
+
return None, f"{Path(path).name}: not JSON"
|
|
2229
|
+
return (data, "") if isinstance(data, dict) else (None, f"{Path(path).name}: not a JSON object")
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
def phase_facts(plan_text: str | None) -> dict[int, dict]:
|
|
2233
|
+
"""Phase number -> {name, model, lane, risk} from the plan's `### Phase <n> - <name>` sections."""
|
|
2234
|
+
if not plan_text:
|
|
2235
|
+
return {}
|
|
2236
|
+
heads = list(PHASE_HEADER.finditer(plan_text))
|
|
2237
|
+
out: dict[int, dict] = {}
|
|
2238
|
+
for i, m in enumerate(heads):
|
|
2239
|
+
body = plan_text[m.end():heads[i + 1].start() if i + 1 < len(heads) else len(plan_text)]
|
|
2240
|
+
body = body.split("\n## ", 1)[0] # stop at the next level-2 section (Tracker, Risks, ...)
|
|
2241
|
+
facts = {k.lower(): v.strip() for k, v in _FACT.findall(body)}
|
|
2242
|
+
out.setdefault(int(m.group(1)), {"name": m.group(2).strip(), "model": facts.get("model", ""),
|
|
2243
|
+
"lane": facts.get("lane", ""), "risk": facts.get("risk", "")})
|
|
2244
|
+
return out
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
def tile_state(tracker_cell: str, state: str) -> str:
|
|
2248
|
+
"""todo | in-progress | done | moved | blocked, from the Tracker cell (origin), falling back to status()."""
|
|
2249
|
+
cell = (tracker_cell or "").strip().lstrip("*").strip().lower()
|
|
2250
|
+
if cell.startswith("moved") or "moved" in cell.split(" - ", 1)[0]:
|
|
2251
|
+
return "moved"
|
|
2252
|
+
if cell.startswith(("done", "✅", "merged")):
|
|
2253
|
+
return "done"
|
|
2254
|
+
if cell.startswith(("blocked", "halt", "waiting")):
|
|
2255
|
+
return "blocked"
|
|
2256
|
+
if cell.startswith(("in progress", "in-progress", "active", "building", "built", "⏳")):
|
|
2257
|
+
return "in-progress"
|
|
2258
|
+
return "done" if state == "done" else "todo"
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
def build(root: Path, slug: str, roadmap_mod=None) -> dict:
|
|
2262
|
+
"""status() plus per-phase Tracker cell, name, model, lane, risk and tile state; open owner gates; the runner;
|
|
2263
|
+
the origin commit. `roadmap_mod` is this module unless a test passes a stand-in. No session marks are read: the
|
|
2264
|
+
hub has live sessions of its own."""
|
|
2265
|
+
mod = roadmap_mod or _THIS_MODULE
|
|
2266
|
+
root = Path(root)
|
|
2267
|
+
model = mod.status(root, slug)
|
|
2268
|
+
plans: dict[str, tuple[dict[int, str], dict[int, dict]]] = {}
|
|
2269
|
+
lanes: list[str] = []
|
|
2270
|
+
for ms in model["milestones"]:
|
|
2271
|
+
for ph in ms["phases"]:
|
|
2272
|
+
m = mod.REF_RE.match(ph["ref"])
|
|
2273
|
+
ph.update(plan="", num=0, tracker="", name="", model="", lane="", risk="")
|
|
2274
|
+
if not m:
|
|
2275
|
+
ph["tile"] = "todo"
|
|
2276
|
+
continue
|
|
2277
|
+
plan, num = m.group(1), int(m.group(2))
|
|
2278
|
+
if plan not in plans:
|
|
2279
|
+
text = mod.show(root, model["branch"], f".caddis/plans/{plan}.md")
|
|
2280
|
+
if text is None:
|
|
2281
|
+
text = mod.show(root, model["branch"], f".caddis/plans/done/{plan}.md")
|
|
2282
|
+
plans[plan] = (mod.parse_tracker(text) if text else {}, phase_facts(text))
|
|
2283
|
+
lanes.append(plan)
|
|
2284
|
+
rows, facts = plans[plan]
|
|
2285
|
+
ph.update(plan=plan, num=num, tracker=rows.get(num, ""), **{k: v for k, v in facts.get(num, {}).items()})
|
|
2286
|
+
ph["tile"] = tile_state(ph["tracker"], ph["state"])
|
|
2287
|
+
model["lanes"] = lanes
|
|
2288
|
+
model["waiting"] = [{"milestone": ms["id"], "reason": b["reason"], "check": b["check"]}
|
|
2289
|
+
for ms in model["milestones"] for b in ms["blockers"]
|
|
2290
|
+
if b["type"] == "owner-gate" and ms["status"] not in mod.FINISHED]
|
|
2291
|
+
|
|
2292
|
+
lock_path = mod.runner_lock_path(root, "roadmap", slug)
|
|
2293
|
+
lock, lock_err = _read_json(lock_path)
|
|
2294
|
+
if lock is not None and not all(lock.get(k) not in (None, "") for k in ("batch", "pid", "started_utc")):
|
|
2295
|
+
lock_err = lock_err or f"{Path(lock_path).name}: missing batch, pid or started_utc"
|
|
2296
|
+
lock = None
|
|
2297
|
+
live = False
|
|
2298
|
+
if lock is not None and lock_path is not None:
|
|
2299
|
+
try:
|
|
2300
|
+
live = mod.runner_lock_stale(lock_path) is False
|
|
2301
|
+
except Exception: # a judgement that cannot be made is not "running"
|
|
2302
|
+
live = False
|
|
2303
|
+
stop, stop_err = _read_json(mod.last_stop_path(root, "roadmap", slug))
|
|
2304
|
+
model["runner"] = {"lock": lock if live else None, "stale_lock": lock if (lock and not live) else None,
|
|
2305
|
+
"last_stop": stop, "errors": [e for e in (lock_err, stop_err) if e]}
|
|
2306
|
+
try:
|
|
2307
|
+
model["origin_commit"] = mod._git(root, "rev-parse", "--short", f"origin/{model['branch']}",
|
|
2308
|
+
check=False).stdout.strip()
|
|
2309
|
+
except Exception:
|
|
2310
|
+
model["origin_commit"] = ""
|
|
2311
|
+
return model
|
|
2312
|
+
|
|
2313
|
+
|
|
2207
2314
|
_PR_REF_RE = re.compile(r"#(\d+)")
|
|
2208
2315
|
|
|
2209
2316
|
|
|
2210
2317
|
def _roadmap_detail(root: Path, slug: str) -> dict:
|
|
2211
2318
|
"""status() plus the hub's detail (R45): per phase name, model, lane, risk, Tracker cell, tile and the PR numbers
|
|
2212
|
-
the cell names; per roadmap lanes, open owner gates, the runner and the origin commit.
|
|
2213
|
-
|
|
2214
|
-
scripts_dir = str(Path(__file__).resolve().parent)
|
|
2215
|
-
if scripts_dir not in sys.path:
|
|
2216
|
-
sys.path.insert(0, scripts_dir)
|
|
2217
|
-
import caddis_roadmap_page
|
|
2218
|
-
model = caddis_roadmap_page.build(Path(root), slug, _THIS_MODULE, sessions=False)
|
|
2219
|
-
model.pop("sessions", None)
|
|
2220
|
-
model.pop("generated", None)
|
|
2319
|
+
the cell names; per roadmap lanes, open owner gates, the runner and the origin commit."""
|
|
2320
|
+
model = build(Path(root), slug)
|
|
2221
2321
|
for ms in model["milestones"]:
|
|
2222
2322
|
for ph in ms["phases"]:
|
|
2223
2323
|
ph["prs"] = sorted({int(n) for n in _PR_REF_RE.findall(str(ph.get("tracker", "")))})
|
|
@@ -2283,146 +2383,9 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
2283
2383
|
p = add("rollup", write=True)
|
|
2284
2384
|
p.add_argument("--id", required=True)
|
|
2285
2385
|
add("recheck", write=True)
|
|
2286
|
-
p = sub.add_parser("render")
|
|
2287
|
-
which = p.add_mutually_exclusive_group(required=True)
|
|
2288
|
-
which.add_argument("--roadmap")
|
|
2289
|
-
which.add_argument("--all", action="store_true", help="every roadmap on origin (used by hooks and commands)")
|
|
2290
|
-
p.add_argument("--root", default=".")
|
|
2291
|
-
p.add_argument("--out", default=None, help="the HTML file (default ~/.caddis/roadmap-pages/<repo>/<slug>.html)")
|
|
2292
|
-
p.add_argument("--site", default=None, metavar="DIR",
|
|
2293
|
-
help="with --all: build the shared copy (no live sessions or runners, a banner) in DIR/build and "
|
|
2294
|
-
"publish only the safe files to DIR/public (for GitHub Pages)")
|
|
2295
|
-
p.add_argument("--no-fetch", action="store_true",
|
|
2296
|
-
help="use the origin refs this checkout has; no git fetch (the waiting hook's background render)")
|
|
2297
|
-
p.add_argument("--delay", type=int, default=0,
|
|
2298
|
-
help="wait this many seconds (at most 60) first: the waiting hook's follow-up render")
|
|
2299
2386
|
return parser
|
|
2300
2387
|
|
|
2301
2388
|
|
|
2302
|
-
RENDER_LOCK_STALE_S = 600 # a render lock older than this is left by a killed render
|
|
2303
|
-
PENDING_NAME = ".roadmap-render.pending" # session_waiting.py writes it beside its debounce stamp
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
def _clear(path: Path | None) -> bool:
|
|
2307
|
-
"""Delete `path`; True when it was there."""
|
|
2308
|
-
if path is None:
|
|
2309
|
-
return False
|
|
2310
|
-
try:
|
|
2311
|
-
path.unlink()
|
|
2312
|
-
return True
|
|
2313
|
-
except FileNotFoundError:
|
|
2314
|
-
return False
|
|
2315
|
-
except OSError:
|
|
2316
|
-
return path.exists()
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
def _take_render_lock(lock: Path) -> bool:
|
|
2320
|
-
"""One render per repo at a time (robustness #8): create `lock` with O_EXCL, never wait. A lock older than
|
|
2321
|
-
RENDER_LOCK_STALE_S is taken over once. False: another render holds it."""
|
|
2322
|
-
lock.parent.mkdir(parents=True, exist_ok=True)
|
|
2323
|
-
for attempt in range(2):
|
|
2324
|
-
try:
|
|
2325
|
-
fd = os.open(str(lock), os.O_CREAT | os.O_EXCL | os.O_WRONLY)
|
|
2326
|
-
except FileExistsError:
|
|
2327
|
-
pass
|
|
2328
|
-
except PermissionError: # Windows: a deleted lock whose delete is still pending
|
|
2329
|
-
return False
|
|
2330
|
-
else:
|
|
2331
|
-
with os.fdopen(fd, "w", encoding="utf-8") as fh:
|
|
2332
|
-
fh.write(str(os.getpid()))
|
|
2333
|
-
return True
|
|
2334
|
-
try:
|
|
2335
|
-
stale = time.time() - lock.stat().st_mtime > RENDER_LOCK_STALE_S
|
|
2336
|
-
except FileNotFoundError:
|
|
2337
|
-
stale = True # released between the create and the stat: try again
|
|
2338
|
-
except OSError: # Windows: a lock being deleted cannot be read either
|
|
2339
|
-
return False
|
|
2340
|
-
if attempt or not stale:
|
|
2341
|
-
return False
|
|
2342
|
-
try:
|
|
2343
|
-
lock.unlink()
|
|
2344
|
-
except FileNotFoundError:
|
|
2345
|
-
pass
|
|
2346
|
-
except OSError:
|
|
2347
|
-
return False
|
|
2348
|
-
return False
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
def _render(root: Path, args: argparse.Namespace, site_dir: Path | None = None) -> int:
|
|
2352
|
-
"""`render`: the pages, the prune and the hub. The caller holds the repo's render lock. `site_dir` (the shared
|
|
2353
|
-
copy's build folder, `render --site`) replaces the pages root and takes no lock."""
|
|
2354
|
-
import caddis_roadmap_page
|
|
2355
|
-
slugs, on_origin = list_roadmaps_checked(root) if args.all else ([args.roadmap], None)
|
|
2356
|
-
failed = written = pruned = 0
|
|
2357
|
-
site_kw = {} if site_dir is None else {"site_dir": site_dir} # the normal calls stay exactly as they were
|
|
2358
|
-
for slug in slugs: # --all: one bad roadmap must not stop the others
|
|
2359
|
-
try:
|
|
2360
|
-
path = caddis_roadmap_page.write_page(root, slug, Path(args.out) if args.out else None,
|
|
2361
|
-
_THIS_MODULE, **site_kw)
|
|
2362
|
-
if path is None: # a newer caddis owns this page: kept, and neither written nor failed
|
|
2363
|
-
continue
|
|
2364
|
-
written += 1
|
|
2365
|
-
print(f"[ROADMAP] page written: {path.resolve()}")
|
|
2366
|
-
except Exception as exc: # --all: one roadmap must never stop the others
|
|
2367
|
-
if not args.all:
|
|
2368
|
-
raise
|
|
2369
|
-
failed += 1
|
|
2370
|
-
print(f"[ROADMAP] {slug}: page not written: {exc}", file=sys.stderr)
|
|
2371
|
-
try: # the hub is a convenience: nothing below ever fails a render or changes its exit code
|
|
2372
|
-
if args.all and on_origin is not None: # a roadmap removed from origin leaves the hub too; a listing
|
|
2373
|
-
# that failed removes nothing, and a folder still on origin keeps its page even if its render failed
|
|
2374
|
-
pruned = caddis_roadmap_page.prune_folder(
|
|
2375
|
-
caddis_roadmap_page.default_page_path(root, "_", base=site_dir).parent, on_origin | set(slugs))
|
|
2376
|
-
if site_dir is not None:
|
|
2377
|
-
site_kw["banner"] = caddis_roadmap_page.site_banner(root)
|
|
2378
|
-
hub = caddis_roadmap_page.write_hub(**site_kw) if not args.out and (written or pruned) else None
|
|
2379
|
-
if hub is not None: # None: a newer caddis owns the hub (write_hub said so)
|
|
2380
|
-
print(f"[ROADMAP] hub written: {hub.resolve()}")
|
|
2381
|
-
except Exception as exc:
|
|
2382
|
-
print(f"[ROADMAP] hub not written: {exc}", file=sys.stderr)
|
|
2383
|
-
if site_dir is not None: # the shared copy is published, so a hub that failed is a failed render
|
|
2384
|
-
failed += 1
|
|
2385
|
-
if site_dir is not None and not failed and not written:
|
|
2386
|
-
print("[ROADMAP] site not rendered: no roadmap was rendered (none on origin, or the listing failed)",
|
|
2387
|
-
file=sys.stderr)
|
|
2388
|
-
return caddis_exit.BLOCKED
|
|
2389
|
-
return caddis_exit.BLOCKED if failed else caddis_exit.CLEAN
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
def _render_site(root: Path, args: argparse.Namespace) -> int:
|
|
2393
|
-
"""`render --all --site DIR`: build the shared copy in DIR/build (no render lock, no version gate, no stamp: CI is
|
|
2394
|
-
the only writer), then publish its allow-list to DIR/public. A render that failed publishes nothing."""
|
|
2395
|
-
import caddis_roadmap_page
|
|
2396
|
-
site = Path(args.site)
|
|
2397
|
-
build, public = site / "build", site / "public"
|
|
2398
|
-
global FETCH
|
|
2399
|
-
FETCH = not args.no_fetch
|
|
2400
|
-
try: # a reused DIR keeps the last run's index.html: only one written by THIS run may be published
|
|
2401
|
-
(build / "index.html").unlink(missing_ok=True)
|
|
2402
|
-
except OSError as exc:
|
|
2403
|
-
raise RoadmapError(f"site not published: the old {build / 'index.html'} cannot be removed: {exc}",
|
|
2404
|
-
caddis_exit.ERROR) from exc
|
|
2405
|
-
try:
|
|
2406
|
-
code = _render(root, args, site_dir=build)
|
|
2407
|
-
finally:
|
|
2408
|
-
FETCH = True
|
|
2409
|
-
if code != caddis_exit.CLEAN:
|
|
2410
|
-
print("[ROADMAP] site not published: the render did not finish clean (see above); the last public/ is kept",
|
|
2411
|
-
file=sys.stderr)
|
|
2412
|
-
return code
|
|
2413
|
-
if not (build / "index.html").is_file():
|
|
2414
|
-
print("[ROADMAP] site not published: the hub (index.html) was not written", file=sys.stderr)
|
|
2415
|
-
return caddis_exit.BLOCKED
|
|
2416
|
-
try:
|
|
2417
|
-
paths = caddis_roadmap_page.export_site(build, public)
|
|
2418
|
-
except ValueError as exc:
|
|
2419
|
-
raise RoadmapError(f"site not published: {exc}", caddis_exit.ERROR) from exc
|
|
2420
|
-
for rel in paths:
|
|
2421
|
-
print(f"[ROADMAP] site file: {rel}")
|
|
2422
|
-
print(f"[ROADMAP] site published: {len(paths)} file(s) in {public.resolve()}")
|
|
2423
|
-
return caddis_exit.CLEAN
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
2389
|
def _dispatch(args: argparse.Namespace) -> int:
|
|
2427
2390
|
root = _repo_root(args.root)
|
|
2428
2391
|
if args.cmd == "list" and args.json:
|
|
@@ -2469,51 +2432,6 @@ def _dispatch(args: argparse.Namespace) -> int:
|
|
|
2469
2432
|
return rollup(root, args.roadmap, args.id, args.dry_run)
|
|
2470
2433
|
if args.cmd == "recheck":
|
|
2471
2434
|
return recheck(root, args.roadmap, args.dry_run)
|
|
2472
|
-
if args.cmd == "render":
|
|
2473
|
-
import caddis_roadmap_page # the page is separate; only `render` needs it
|
|
2474
|
-
if args.site is not None:
|
|
2475
|
-
if args.out:
|
|
2476
|
-
raise RoadmapError("--site and --out cannot be used together: --out is one self-contained page, "
|
|
2477
|
-
"--site is the shared copy of every roadmap", caddis_exit.ERROR)
|
|
2478
|
-
if not args.all:
|
|
2479
|
-
raise RoadmapError("--site works with --all, not with --roadmap", caddis_exit.ERROR)
|
|
2480
|
-
if args.delay > 0:
|
|
2481
|
-
raise RoadmapError("--site and --delay cannot be used together: a CI render does not wait",
|
|
2482
|
-
caddis_exit.ERROR)
|
|
2483
|
-
return _render_site(root, args)
|
|
2484
|
-
if args.all and args.out:
|
|
2485
|
-
raise RoadmapError("--out works with one --roadmap, not with --all", caddis_exit.ERROR)
|
|
2486
|
-
if args.delay > 0:
|
|
2487
|
-
time.sleep(min(args.delay, 60))
|
|
2488
|
-
folder = caddis_roadmap_page.default_page_path(root, "_").parent.name
|
|
2489
|
-
lock = caddis_roadmap_page.pages_root() / ".locks" / f"{folder}.lock"
|
|
2490
|
-
# The waiting hook's debounce (and a render that finds the lock held) leaves PENDING_NAME: the render that
|
|
2491
|
-
# holds the lock renders once more at its end, so the last mark change always reaches the page.
|
|
2492
|
-
state = caddis_roadmap_page.main_checkout(root) / ".caddis" / "session-state"
|
|
2493
|
-
pending = state / PENDING_NAME if args.all and not args.out else None
|
|
2494
|
-
if not _take_render_lock(lock):
|
|
2495
|
-
if pending is not None and state.is_dir():
|
|
2496
|
-
try:
|
|
2497
|
-
pending.write_text(str(os.getpid()), encoding="utf-8")
|
|
2498
|
-
except OSError:
|
|
2499
|
-
pass
|
|
2500
|
-
print("[ROADMAP] another render of this repo is running; skipped")
|
|
2501
|
-
return caddis_exit.CLEAN
|
|
2502
|
-
global FETCH
|
|
2503
|
-
FETCH = not args.no_fetch
|
|
2504
|
-
try:
|
|
2505
|
-
_clear(pending) # this render reads the marks as they are now
|
|
2506
|
-
code = _render(root, args)
|
|
2507
|
-
if _clear(pending): # a mark changed while it ran: once more, under the same lock
|
|
2508
|
-
code = _render(root, args)
|
|
2509
|
-
return code
|
|
2510
|
-
finally:
|
|
2511
|
-
FETCH = True
|
|
2512
|
-
try: # only our own lock: a render that ran past the stale age may have been taken over
|
|
2513
|
-
if lock.read_text(encoding="utf-8").strip() == str(os.getpid()):
|
|
2514
|
-
lock.unlink()
|
|
2515
|
-
except (OSError, UnicodeDecodeError):
|
|
2516
|
-
pass
|
|
2517
2435
|
return caddis_exit.ERROR
|
|
2518
2436
|
|
|
2519
2437
|
|
|
@@ -219,7 +219,7 @@ def session_env(base: dict | None = None) -> dict:
|
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
def runner_env() -> dict:
|
|
222
|
-
"""The environment of the runner's own caddis_roadmap.py children (writes, merge chain
|
|
222
|
+
"""The environment of the runner's own caddis_roadmap.py children (writes, merge chain): headless_env
|
|
223
223
|
plus the runner's gh login. Never given to a session."""
|
|
224
224
|
env = headless_env()
|
|
225
225
|
env.update(caddis_roadmap.AUTH_ENV)
|
|
@@ -1257,32 +1257,13 @@ def run(*, repo: Path, plan: str | None = None, roadmap: str | None = None, caps
|
|
|
1257
1257
|
caddis_roadmap.AUTH_ENV["GH_TOKEN"] = value # the runner's own calls only; never a session's env
|
|
1258
1258
|
if roadmap is not None:
|
|
1259
1259
|
rm_cmd = list(roadmap_cmd or default_roadmap_cmd())
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
delete_remote_branch or default_delete_remote_branch, pr_closed or default_pr_closed)
|
|
1265
|
-
finally:
|
|
1266
|
-
if not dry_run:
|
|
1267
|
-
_render_page(ctx, rm_cmd) # the page shows where the run stopped and what waits for the owner
|
|
1260
|
+
return _run_roadmap(ctx, template, dry_run, after_session, rm_cmd,
|
|
1261
|
+
hostname or socket.gethostname(), publish or default_publish,
|
|
1262
|
+
pr_merged or default_pr_merged, worktree_root,
|
|
1263
|
+
delete_remote_branch or default_delete_remote_branch, pr_closed or default_pr_closed)
|
|
1268
1264
|
return _run_plan(ctx, template, dry_run, after_session)
|
|
1269
1265
|
|
|
1270
1266
|
|
|
1271
|
-
PAGE_RENDER_TIMEOUT_S = 120
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
def _render_page(ctx: "_Ctx", roadmap_cmd: Sequence[str]) -> None:
|
|
1275
|
-
"""Re-render the local roadmap page (roadmap-page Phase 3). Best effort: a failure is one stderr line, never a stop."""
|
|
1276
|
-
argv = [*roadmap_cmd, "render", "--roadmap", ctx.target.slug, "--root", str(ctx.repo)]
|
|
1277
|
-
try:
|
|
1278
|
-
proc = subprocess.run(argv, cwd=ctx.repo, env=runner_env(), stdin=subprocess.DEVNULL, capture_output=True,
|
|
1279
|
-
text=True, encoding="utf-8", errors="replace", timeout=PAGE_RENDER_TIMEOUT_S)
|
|
1280
|
-
if proc.returncode != 0:
|
|
1281
|
-
print(f"caddis_roadmap_run: page not rendered (exit {proc.returncode})", file=sys.stderr)
|
|
1282
|
-
except Exception as exc: # a page must never change how a run ends
|
|
1283
|
-
print(f"caddis_roadmap_run: page not rendered: {type(exc).__name__}", file=sys.stderr)
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
1267
|
def _dry_run_tail(ctx: _Ctx, template: Path, prompt: str, cwd: Path | None = None) -> None:
|
|
1287
1268
|
caps = ctx.caps
|
|
1288
1269
|
cmd = build_command(ctx.engine, ctx.model, "<resume prompt>", usd=min(caps.max_usd_per_session, caps.max_usd_total),
|
|
@@ -2159,7 +2140,6 @@ def _run_roadmap(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callab
|
|
|
2159
2140
|
finally:
|
|
2160
2141
|
s.record.setdefault("status", "FAILED")
|
|
2161
2142
|
ctx.log(s.record)
|
|
2162
|
-
_render_page(ctx, roadmap_cmd)
|
|
2163
2143
|
if after_session is not None:
|
|
2164
2144
|
after_session(sessions)
|
|
2165
2145
|
except _Stop as stop:
|
|
@@ -437,6 +437,28 @@ def machine_findings(which: Callable[[str], str | None] | None = None,
|
|
|
437
437
|
return out
|
|
438
438
|
|
|
439
439
|
|
|
440
|
+
AUTOCOMPACT_KEY = "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
def autocompact_backstop_line(settings: dict, environ: Mapping[str, str]) -> str | None:
|
|
444
|
+
"""A warning when no auto-compact backstop is set (session-size plan); None when it is set."""
|
|
445
|
+
env = settings.get("env") if isinstance(settings, dict) else None
|
|
446
|
+
if environ.get(AUTOCOMPACT_KEY) or (isinstance(env, dict) and env.get(AUTOCOMPACT_KEY)):
|
|
447
|
+
return None
|
|
448
|
+
return (
|
|
449
|
+
f"[caddis] Set {AUTOCOMPACT_KEY}=40 in ~/.claude/settings.json env, "
|
|
450
|
+
"so a session compacts at 400k, not about 967k."
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def _user_claude_settings() -> dict:
|
|
455
|
+
try:
|
|
456
|
+
data = json.loads((_home() / ".claude" / "settings.json").read_text(encoding="utf-8"))
|
|
457
|
+
return data if isinstance(data, dict) else {}
|
|
458
|
+
except (OSError, ValueError):
|
|
459
|
+
return {}
|
|
460
|
+
|
|
461
|
+
|
|
440
462
|
def keys_line(env: Mapping[str, str]) -> tuple[str, str]:
|
|
441
463
|
scripts = Path(__file__).resolve().parent
|
|
442
464
|
try:
|
|
@@ -629,6 +651,8 @@ def run(dest: Path, quiet: bool) -> int:
|
|
|
629
651
|
if k_level == "FAIL":
|
|
630
652
|
hard = 1
|
|
631
653
|
print(f" {k_level:4} {k_text}")
|
|
654
|
+
backstop = autocompact_backstop_line(_user_claude_settings(), os.environ)
|
|
655
|
+
print(f" WARN {backstop}" if backstop else f" OK auto-compact backstop: {AUTOCOMPACT_KEY} set")
|
|
632
656
|
|
|
633
657
|
host = host_guard_findings()
|
|
634
658
|
if host:
|
|
@@ -46,10 +46,8 @@ Keep it short enough to read at a glance. Roughly:
|
|
|
46
46
|
- **The next step**, if one is recorded. Say which file it came from.
|
|
47
47
|
- **Uncommitted work**, if `git status` is dirty — this is the thing most likely to be lost, and
|
|
48
48
|
the state file does not track it. Check it; do not assume clean.
|
|
49
|
-
- **The roadmap
|
|
50
|
-
|
|
51
|
-
(`~/.caddis/roadmap-pages/<repo>/<slug>.html`); it shows every session waiting for the owner. The hub of every
|
|
52
|
-
repo on this machine is `~/.caddis/roadmap-pages/index.html`.
|
|
49
|
+
- **The roadmap**, when the repo has one (`.caddis/roadmaps/`): open the hub: `caddis hub open`, repo, Roadmap
|
|
50
|
+
tab. The hub also lists every live session that waits for the owner.
|
|
53
51
|
|
|
54
52
|
Leave out anything already done unless the user asks. "What is finished" is a different question
|
|
55
53
|
from "where are we", and the completed list is usually the longest part of both files.
|
|
@@ -33,7 +33,7 @@ Measured 24-25 Oct 2026: each background wake-up re-reads the whole conversation
|
|
|
33
33
|
then `/caddis:coordinate start`.
|
|
34
34
|
- Post a peer message only when the queue or a PR state changes. Send no acknowledgement of an
|
|
35
35
|
acknowledgement. The watcher already prints a line only on a change, so a quiet cycle wakes nobody.
|
|
36
|
-
- Restart (handoff, `/clear`, `/caddis:coordinate`) when this conversation passes about 200k tokens, or once a day.
|
|
36
|
+
- Restart (handoff, `/clear`, `/caddis:coordinate`) when this conversation passes about 200k tokens, or once a day. The context_size hook prints a [caddis] warning at 200k and a restart notice at 350k.
|
|
37
37
|
|
|
38
38
|
## How to call the script
|
|
39
39
|
|
|
@@ -282,7 +282,7 @@ to the phase or task that owns the code. Write "none found" only after you check
|
|
|
282
282
|
**Session rules for the orchestrator** (measured 24-25 Oct 2026: long Opus sessions re-read 400-600k tokens
|
|
283
283
|
on every turn). Keep the context small: subagent replies under about 200 words, full reports in files,
|
|
284
284
|
never paste or tail large outputs. At each phase end, write the handoff; continue in the same session only
|
|
285
|
-
while the conversation is under about 200k tokens. Run the phase review as
|
|
285
|
+
while the conversation is under about 200k tokens. The context_size hook prints a [caddis] warning at 200k and a restart notice at 350k. Run the phase review as
|
|
286
286
|
`/caddis:cross-review --range <base>..HEAD`. Send a task marked mechanical (literal tests, moves, deletes,
|
|
287
287
|
renames) to agy through `caddis_spend.py run`. Run one `ci-watch` per PR head; on a queued-run timeout watch
|
|
288
288
|
that run once with `--run <id>`; write no "still waiting" turns.
|
|
@@ -336,12 +336,6 @@ un-indexed note, or `caddis_tidy.py --apply` for a finished artifact in the wron
|
|
|
336
336
|
not a failure of the handoff: the row is `done` when all three ran. If a script is missing, the row is
|
|
337
337
|
`skipped: <script> not installed`.
|
|
338
338
|
|
|
339
|
-
Then, when the repo has a roadmap (`.caddis/roadmaps/`), re-render its page so phases built by hand show too
|
|
340
|
-
(best effort, not a checklist row; it writes only under `~/.caddis/roadmap-pages/`, never in this checkout):
|
|
341
|
-
```
|
|
342
|
-
python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_roadmap.py" render --all
|
|
343
|
-
```
|
|
344
|
-
|
|
345
339
|
## Step 6d — remove this session's own worktrees and scratch folders
|
|
346
340
|
Checklist row 12, `own-cleanup`. It runs in every checkout, a shared one too, after the Step 0 `finish`
|
|
347
341
|
(falls back to `scripts/caddis_created.py` in a source checkout; if the script is missing, or exits 2 because
|
|
@@ -466,7 +460,7 @@ claude --name <role>-<MMDD>-<HH> '<the resume prompt on one line> <the announce
|
|
|
466
460
|
## Rules
|
|
467
461
|
- **Clear above 200k tokens.** A session whose conversation passes about 200k tokens writes this handoff at
|
|
468
462
|
the next safe point and asks the owner for `/clear`. Each turn re-reads the whole conversation, so a long
|
|
469
|
-
session costs more with every turn.
|
|
463
|
+
session costs more with every turn. The context_size hook prints a [caddis] warning at 200k and a restart notice at 350k.
|
|
470
464
|
- **Model for the next session.** Print one line `Model for next session: ...` just before the RESUME block (the block stays the last output): Sonnet (effort medium) to run an approved
|
|
471
465
|
plan; Opus to write a plan or design. Start line: `claude --model sonnet --effort medium --name <role>-<MMDD>-<HH>`.
|
|
472
466
|
- **One next action, by priority ladder.** `## Next step` names exactly ONE action — not a menu. Pick it in
|
|
@@ -62,7 +62,7 @@ and 95-154 turns per session were started by background events. Each turn re-rea
|
|
|
62
62
|
- **Small context.** Ask each subagent for a reply under about 200 words. Full reports go to files; read a
|
|
63
63
|
file only for the part you need. Never paste or tail a large output.
|
|
64
64
|
- **Handoff at phase end.** At each phase end, write the handoff yourself (see "At every halt" below). Continue
|
|
65
|
-
in the same session only while the conversation is under about 200k tokens. Above that, ask for `/clear`.
|
|
65
|
+
in the same session only while the conversation is under about 200k tokens. Above that, ask for `/clear`. The context_size hook prints a [caddis] warning at 200k and a restart notice at 350k.
|
|
66
66
|
- **Model.** The orchestrator runs on Sonnet. Opus stays for plans, designs and critical-code subagents.
|
|
67
67
|
- **One phase review.** Run `/caddis:cross-review --range <base>..HEAD` (one other vendor; agy Argon by default).
|
|
68
68
|
Never use a Claude reviewer subagent. Exception: every other-vendor provider failed. Then say so in the review file.
|
|
@@ -190,9 +190,8 @@ If the default branch triggers an automated deployment pipeline:
|
|
|
190
190
|
- Delete the **local** feature branch: `git branch -d <branch>` (use `-D` only if squashed after verifying tree contents match).
|
|
191
191
|
- Delete the **remote** feature branch: `git push origin --delete <branch>` (if not deleted by forge).
|
|
192
192
|
- Drop the temporary `backup/<branch>-preship` ref if one was created in Step 4.
|
|
193
|
-
- If the repo has a roadmap (`.caddis/roadmaps/`),
|
|
194
|
-
`
|
|
195
|
-
stop). The page is `~/.caddis/roadmap-pages/<repo>/<slug>.html`.
|
|
193
|
+
- If the repo has a roadmap (`.caddis/roadmaps/`), the merge changed a Tracker on origin. To see it: open the hub:
|
|
194
|
+
`caddis hub open`, repo, Roadmap tab.
|
|
196
195
|
|
|
197
196
|
If deploy validation failed: **skip cleanup** entirely and report why — never delete a branch whose
|
|
198
197
|
work may need re-work.
|
|
@@ -70,7 +70,6 @@ process tree on timeout.
|
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
python scripts/caddis_roadmap.py status --roadmap <slug> [--json] # "<done> of <total> done; next <id>; ..."
|
|
73
|
-
python scripts/caddis_roadmap.py render --roadmap <slug> | --all [--out <html>] # page: ~/.caddis/roadmap-pages/<repo>/<slug>.html; hub of every repo: ~/.caddis/roadmap-pages/index.html
|
|
74
73
|
python scripts/caddis_roadmap.py next --roadmap <slug> [--json] # exit 0 found, 1 nothing ready (reasons)
|
|
75
74
|
python scripts/caddis_roadmap.py check --roadmap <slug> # parse errors, unknown refs or types
|
|
76
75
|
python scripts/caddis_roadmap.py set --roadmap <slug> --id S1 --col Status|Owner|Target --value <v> [--by-owner] [--reason "<r>"]
|
|
@@ -70,7 +70,6 @@ process tree on timeout.
|
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
python scripts/caddis_roadmap.py status --roadmap <slug> [--json] # "<done> of <total> done; next <id>; ..."
|
|
73
|
-
python scripts/caddis_roadmap.py render --roadmap <slug> | --all [--out <html>] # page: ~/.caddis/roadmap-pages/<repo>/<slug>.html; hub of every repo: ~/.caddis/roadmap-pages/index.html
|
|
74
73
|
python scripts/caddis_roadmap.py next --roadmap <slug> [--json] # exit 0 found, 1 nothing ready (reasons)
|
|
75
74
|
python scripts/caddis_roadmap.py check --roadmap <slug> # parse errors, unknown refs or types
|
|
76
75
|
python scripts/caddis_roadmap.py set --roadmap <slug> --id S1 --col Status|Owner|Target --value <v> [--by-owner] [--reason "<r>"]
|
package/bundles/manifest.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -9218,7 +9218,13 @@ function copyFixedSet(dist, dest) {
|
|
|
9218
9218
|
const from = path23.join(fonts, name);
|
|
9219
9219
|
if (!lstatSync2(from).isFile()) continue;
|
|
9220
9220
|
if (name.endsWith(".woff2")) copyFileSync(from, path23.join(dest, "fonts", name));
|
|
9221
|
-
|
|
9221
|
+
}
|
|
9222
|
+
}
|
|
9223
|
+
const licenses = path23.join(dist, "licenses");
|
|
9224
|
+
if (isDir2(licenses)) {
|
|
9225
|
+
for (const name of readdirSync5(licenses)) {
|
|
9226
|
+
const from = path23.join(licenses, name);
|
|
9227
|
+
if (lstatSync2(from).isFile() && /^(OFL-[A-Za-z]+|LICENSE-Lucide)\.txt$/.test(name)) copyFileSync(from, path23.join(dest, "licenses", name));
|
|
9222
9228
|
}
|
|
9223
9229
|
}
|
|
9224
9230
|
}
|
package/package.json
CHANGED