@caddis/cli 0.4.89 → 0.4.90
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_status.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_fleet.py +10 -5
- package/bundles/antigravity-plugin/scripts/caddis_guide.json +2 -2
- package/bundles/antigravity-plugin/scripts/caddis_roadmap_run.py +130 -63
- package/bundles/antigravity-plugin/scripts/caddis_workstreams.py +35 -12
- package/bundles/antigravity-plugin/skills/code-review/SKILL.md +2 -0
- package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +1 -0
- package/bundles/antigravity-plugin/skills/handoff/SKILL.md +6 -2
- package/bundles/antigravity-plugin/skills/implement/SKILL.md +19 -1
- package/bundles/antigravity-plugin/skills/park/SKILL.md +1 -0
- package/bundles/antigravity-plugin/skills/preflight/SKILL.md +1 -0
- package/bundles/antigravity-plugin/skills/roadmap/assets/plan-resume-prompt.md +8 -1
- package/bundles/antigravity-plugin-extras/plugin.json +1 -1
- package/bundles/antigravity-plugin-extras/skills/cross-review/SKILL.md +1 -0
- package/bundles/codex/.codex/skills/coding/code-review/SKILL.md +2 -0
- package/bundles/codex/.codex/skills/workflow/preflight/SKILL.md +1 -0
- package/bundles/codex/.codex/skills/workflow/roadmap/assets/plan-resume-prompt.md +8 -1
- package/bundles/manifest.json +3 -3
- package/dist/cli.js +12 -4
- package/package.json +1 -1
|
Binary file
|
|
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
|
|
@@ -485,21 +485,26 @@ def announce_text(script: Path, name: str, folder: str) -> str:
|
|
|
485
485
|
|
|
486
486
|
|
|
487
487
|
def render_resume(session: str, session_id: str, workstream: str, prompt: str, role: str, stamp: datetime,
|
|
488
|
-
fleet_mode: bool = False, announce_script: Path | None = None, folder: str = ""
|
|
488
|
+
fleet_mode: bool = False, announce_script: Path | None = None, folder: str = "",
|
|
489
|
+
root: Path | None = None) -> str:
|
|
489
490
|
"""The last output of `/caddis:handoff`. In a fleet close the restart sheet holds the only start line.
|
|
490
491
|
|
|
491
492
|
With `announce_script`, the start line (not the fenced block, which stays the relay's text) ends with the
|
|
492
|
-
whoami + announce sentence: the start line is what the new session receives with its name.
|
|
493
|
+
whoami + announce sentence: the start line is what the new session receives with its name.
|
|
494
|
+
With `root`, the block names the repo and the start line first changes to it, because the relay's paths are
|
|
495
|
+
repo-relative. `;`, as in the restart sheet: Windows PowerShell 5.1 has no `&&`."""
|
|
493
496
|
shown = prompt # the fenced block stays the relay text
|
|
497
|
+
repo = f"Repo: {root.as_posix()}\n" if root is not None else ""
|
|
498
|
+
cd = f'cd "{root.as_posix()}"; ' if root is not None else ""
|
|
494
499
|
if fleet_mode:
|
|
495
500
|
start = "Start line: from the restart sheet"
|
|
496
501
|
else:
|
|
497
502
|
name = new_name(role, stamp)
|
|
498
503
|
if announce_script is not None:
|
|
499
504
|
prompt = f"{prompt}\n{announce_text(announce_script, name, folder)}"
|
|
500
|
-
start = f"Start line:\
|
|
505
|
+
start = f"Start line:\n{cd}claude {_model_flags(role)} --name {name} {shell_arg(prompt)}"
|
|
501
506
|
return (f"{model_line(role)}=== RESUME ===\nSession: {session} ({session_id})\nWorkstream: {workstream}\n"
|
|
502
|
-
f"{_fenced(shown)}\n{start}\n")
|
|
507
|
+
f"{repo}{_fenced(shown)}\n{start}\n")
|
|
503
508
|
|
|
504
509
|
|
|
505
510
|
def render_coordinator_resume(session: str, session_id: str, workstream: str) -> str:
|
|
@@ -575,7 +580,7 @@ def _resume_block_cli(args: argparse.Namespace) -> int:
|
|
|
575
580
|
sys.stderr.write(f"resume-block failed: bad role {role!r}\n")
|
|
576
581
|
return caddis_exit.BLOCKED
|
|
577
582
|
print(render_resume(session, args.session_id, args.name, prompt, role, datetime.now(), args.fleet,
|
|
578
|
-
Path(__file__).resolve(), root.name), end="")
|
|
583
|
+
Path(__file__).resolve(), root.name, root), end="")
|
|
579
584
|
return caddis_exit.CLEAN
|
|
580
585
|
|
|
581
586
|
|
|
@@ -38,6 +38,16 @@ folder, never the `--repo` checkout); when the roadmap is finished the runner re
|
|
|
38
38
|
origin: `rollup` when every phase of the milestone is merged, then the next batch. A relay `STATUS: OWNER-GATE <r>`
|
|
39
39
|
becomes an `owner-gate` blocker, `STATUS: BLOCKED <r>` an `external` one, and the loop goes on.
|
|
40
40
|
|
|
41
|
+
Context restarts (context-handoff Phase 15): a headless session at the 280k stop line ends `STATUS: BLOCKED context
|
|
42
|
+
<n>` (the context_size hook tells it to). The runner then starts a fresh session for the SAME batch when HEAD moved
|
|
43
|
+
in the session's cwd (`git rev-parse HEAD` before and after; no git or no change: no restart), the batch has restarts
|
|
44
|
+
left (`CONTEXT_RESTARTS`, 2 per batch) and, in roadmap mode, the worktree has no uncommitted work and is still on the
|
|
45
|
+
runner's branch. Plan mode reuses the same prompt; the count resets when a Tracker row closes. Roadmap mode runs the
|
|
46
|
+
same `<plan>#<phase>` on the same branch in the same worktree: no `next`, no branch reset. The session record gets
|
|
47
|
+
`status` `BLOCKED context (restart <k>)` and `context_restart` <k>; no toast, no push, no blocker row; every cap and
|
|
48
|
+
the stuck rule still apply. With no restart, the record gets `context_restart` `no commits`, `limit 2`, `dirty tree`
|
|
49
|
+
or `off branch`, and the stop goes on as for any other `BLOCKED` line.
|
|
50
|
+
|
|
41
51
|
Review gate (caddis-next Phase 11): a phase is pending review when its Tracker row is done in the working copy of
|
|
42
52
|
the plan (its path, or `.caddis/plans/done/` after tidy moved it), not done on origin/<default>, marked
|
|
43
53
|
`**Risk:** high` in any copy (working, origin, the copy from before the session; `caddis_review.phase_risk`), and not
|
|
@@ -147,6 +157,8 @@ ENGINES: dict[str, dict] = {
|
|
|
147
157
|
}
|
|
148
158
|
PROMPT_ON_STDIN = {"claude"}
|
|
149
159
|
STUCK_SESSIONS = 3
|
|
160
|
+
CONTEXT_RESTARTS = 2 # fresh sessions per batch after `STATUS: BLOCKED context <n>` (context-handoff Phase 15)
|
|
161
|
+
_CONTEXT_RE = re.compile(r"context\b")
|
|
150
162
|
PLAN_PROMPT_NAME = "plan-resume-prompt.md"
|
|
151
163
|
# CLAUDE_CODE_FORK_SUBAGENT=0: since 2.1.302 fork subagents are on by default in `claude -p`. A fork can run in the
|
|
152
164
|
# background, and a print-mode session can end before it finishes, so its work is lost; the session prompt already
|
|
@@ -1332,6 +1344,7 @@ def _run_plan(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callable[
|
|
|
1332
1344
|
print(f"caddis_roadmap_run: engine {ctx.engine} is an adapter, not live-tested", file=sys.stderr)
|
|
1333
1345
|
|
|
1334
1346
|
sessions, spent, stuck, pushed = 0, 0.0, 0, False
|
|
1347
|
+
restarts = 0 # context restarts of the current batch; reset when a Tracker row closes
|
|
1335
1348
|
plan_before = ""
|
|
1336
1349
|
start = ctx.clock()
|
|
1337
1350
|
try:
|
|
@@ -1356,6 +1369,7 @@ def _run_plan(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callable[
|
|
|
1356
1369
|
working = _working_plan(repo, slug)
|
|
1357
1370
|
plan_before = working[1] if working else ""
|
|
1358
1371
|
state_before = state_snapshot(repo, "plan", slug)
|
|
1372
|
+
head_before = _git_out(repo, "rev-parse", "HEAD") # a context block restarts only when HEAD moved
|
|
1359
1373
|
s = _one_session(ctx, prompt, slug, sessions + 1, spent, elapsed, slug)
|
|
1360
1374
|
_check_state(repo, "plan", slug, state_before)
|
|
1361
1375
|
sessions += 1
|
|
@@ -1366,12 +1380,24 @@ def _run_plan(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callable[
|
|
|
1366
1380
|
if stop is None:
|
|
1367
1381
|
closed = _closed(target)
|
|
1368
1382
|
stuck = 0 if closed > closed_before else stuck + 1
|
|
1383
|
+
restarts = 0 if closed > closed_before else restarts
|
|
1369
1384
|
s.record["status"] = "CONTINUE"
|
|
1370
1385
|
if stuck >= STUCK_SESSIONS:
|
|
1371
1386
|
raise _Stop("BLOCKED stuck", caddis_exit.BLOCKED)
|
|
1372
1387
|
else:
|
|
1373
|
-
|
|
1374
|
-
|
|
1388
|
+
restart = None
|
|
1389
|
+
if _context_block(stop):
|
|
1390
|
+
restarts = 0 if _closed(target) > closed_before else restarts
|
|
1391
|
+
restart = _context_restart(stop, repo, head_before, restarts)
|
|
1392
|
+
if isinstance(restart, int): # a fresh session for the same plan, with the same prompt
|
|
1393
|
+
restarts = restart
|
|
1394
|
+
s.record.update({"status": f"BLOCKED context (restart {restart})",
|
|
1395
|
+
"context_restart": restart})
|
|
1396
|
+
else:
|
|
1397
|
+
if restart is not None:
|
|
1398
|
+
s.record["context_restart"] = restart
|
|
1399
|
+
s.record["status"] = stop.reason
|
|
1400
|
+
raise stop
|
|
1375
1401
|
finally:
|
|
1376
1402
|
s.record.setdefault("status", "FAILED")
|
|
1377
1403
|
ctx.log(s.record)
|
|
@@ -1964,6 +1990,7 @@ def _run_roadmap(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callab
|
|
|
1964
1990
|
relay_slug: str | None = None
|
|
1965
1991
|
last_write: tuple[str, str] | None = None
|
|
1966
1992
|
wt: Path | None = None
|
|
1993
|
+
rerun = restarts = 0 # rerun > 0: the next session runs the same batch again (context restart number)
|
|
1967
1994
|
start = ctx.clock()
|
|
1968
1995
|
|
|
1969
1996
|
try:
|
|
@@ -2022,68 +2049,74 @@ def _run_roadmap(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callab
|
|
|
2022
2049
|
if rollup(mid) == 0: # nothing written: a recorded stop, and recheck must not retry it
|
|
2023
2050
|
_write_record(failed_file, {**_read_record(failed_file), mid: _roadmap_sha(snap.text)})
|
|
2024
2051
|
raise _Stop(f"BLOCKED rollup of {mid} wrote nothing; the owner decides", caddis_exit.BLOCKED)
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
last_write = None
|
|
2061
|
-
if snap.roadmap.get(mid).status == "todo":
|
|
2062
|
-
write(["set", "--id", mid, "--col", "Status", "--value", "in-progress"],
|
|
2063
|
-
("status", mid, "in-progress"))
|
|
2064
|
-
snap = _load_observed(repo, slug, baseline) # the write window is guarded too
|
|
2065
|
-
# Every session runs in the roadmap's own worktree, on a fresh branch made from origin/<default>.
|
|
2066
|
-
wt = wt or ensure_worktree(repo, slug, snap.branch, worktree_root)
|
|
2067
|
-
branch = session_branch(slug, plan, phase)
|
|
2068
|
-
if branch not in made_branches and _branch_on_origin(repo, branch):
|
|
2069
|
-
raise _Stop(f"BLOCKED branch {branch} is on origin and this runner did not make it",
|
|
2070
|
-
caddis_exit.BLOCKED)
|
|
2071
|
-
for ref_name in (f"refs/heads/{branch}", f"refs/remotes/origin/{branch}"):
|
|
2072
|
-
if _git_out(wt, "rev-parse", "--verify", "--quiet", ref_name) is None:
|
|
2052
|
+
if not rerun: # a new batch: choose it, then a fresh branch (a context restart keeps both)
|
|
2053
|
+
with _claim(repo): # choose and claim atomically: no other runner can choose the same batch
|
|
2054
|
+
try:
|
|
2055
|
+
batch, snap = caddis_roadmap.next_with_snapshot(repo, slug)
|
|
2056
|
+
except caddis_roadmap.RoadmapError as exc:
|
|
2057
|
+
raise _Stop(f"FAILED roadmap changed: the origin copy no longer loads: "
|
|
2058
|
+
f"{str(exc).splitlines()[0]}", caddis_exit.BLOCKED) from None
|
|
2059
|
+
baseline.observe(snap)
|
|
2060
|
+
if batch is not None:
|
|
2061
|
+
lock.set_batch(f"{batch['plan']}#{batch['phase']}")
|
|
2062
|
+
if batch is None:
|
|
2063
|
+
detail = _status_line(repo, slug)
|
|
2064
|
+
if snap.roadmap.milestones and all(ms.status in caddis_roadmap.FINISHED
|
|
2065
|
+
for ms in snap.roadmap.milestones):
|
|
2066
|
+
gone = remove_worktree_if_clean(repo, slug, worktree_root)
|
|
2067
|
+
detail += "; roadmap finished; " + gone
|
|
2068
|
+
if gone.startswith(("worktree removed", "no worktree")):
|
|
2069
|
+
detail += "; " + _cleanup_finished_branches(repo, slug, snap.branch, pr_merged,
|
|
2070
|
+
delete_remote_branch)
|
|
2071
|
+
raise _Stop(RESTARTABLE_STOP, caddis_exit.BLOCKED, detail=detail,
|
|
2072
|
+
record={"held": _held_batches(repo, slug, snap)})
|
|
2073
|
+
mid, plan, phase = batch["milestone"], batch["plan"], batch["phase"]
|
|
2074
|
+
ref = f"{plan}#{phase}"
|
|
2075
|
+
print(f"next: {mid} {ref}")
|
|
2076
|
+
if last_write == (mid, ref): # the runner's own block did not take the batch off `next`
|
|
2077
|
+
raise _Stop(f"FAILED roadmap unchanged after the runner's write for {mid} {ref}",
|
|
2078
|
+
caddis_exit.BLOCKED)
|
|
2079
|
+
relay_slug = plan
|
|
2080
|
+
plan_text = _plan_text(snap, plan)
|
|
2081
|
+
lane = phase_lane(plan_text, phase) or "none" # no Lane line: not the runner's (fail closed)
|
|
2082
|
+
if not lane_runs_here(lane, ctx.engine):
|
|
2083
|
+
reason = f"phase {phase} lane: {' '.join(lane.split())[:160]}".strip()
|
|
2084
|
+
write(["block", "--id", mid, "--type", "owner-gate", "--reason", reason],
|
|
2085
|
+
("blocker", mid, "owner-gate", reason))
|
|
2086
|
+
last_write = (mid, ref)
|
|
2073
2087
|
continue
|
|
2074
|
-
|
|
2075
|
-
if
|
|
2076
|
-
|
|
2088
|
+
last_write = None
|
|
2089
|
+
if snap.roadmap.get(mid).status == "todo":
|
|
2090
|
+
write(["set", "--id", mid, "--col", "Status", "--value", "in-progress"],
|
|
2091
|
+
("status", mid, "in-progress"))
|
|
2092
|
+
snap = _load_observed(repo, slug, baseline) # the write window is guarded too
|
|
2093
|
+
# Every session runs in the roadmap's own worktree, on a fresh branch made from origin/<default>.
|
|
2094
|
+
wt = wt or ensure_worktree(repo, slug, snap.branch, worktree_root)
|
|
2095
|
+
branch = session_branch(slug, plan, phase)
|
|
2096
|
+
if branch not in made_branches and _branch_on_origin(repo, branch):
|
|
2097
|
+
raise _Stop(f"BLOCKED branch {branch} is on origin and this runner did not make it",
|
|
2077
2098
|
caddis_exit.BLOCKED)
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2099
|
+
for ref_name in (f"refs/heads/{branch}", f"refs/remotes/origin/{branch}"):
|
|
2100
|
+
if _git_out(wt, "rev-parse", "--verify", "--quiet", ref_name) is None:
|
|
2101
|
+
continue
|
|
2102
|
+
ahead = _git_out(wt, "rev-list", "--count", f"origin/{snap.branch}..{ref_name}")
|
|
2103
|
+
if ahead is None or ahead != "0": # an earlier session's work: never reset it
|
|
2104
|
+
raise _Stop(f"BLOCKED {branch} has unpublished commits from an earlier session",
|
|
2105
|
+
caddis_exit.BLOCKED)
|
|
2106
|
+
left = _worktree_work(wt) # a blocked session's uncommitted work must never ride into another branch
|
|
2107
|
+
if left is None or left:
|
|
2108
|
+
was = _git_out(wt, "rev-parse", "--abbrev-ref", "HEAD") or "?"
|
|
2109
|
+
raise _Stop(f"BLOCKED roadmap worktree has uncommitted work from {was} ({wt})", caddis_exit.BLOCKED)
|
|
2110
|
+
made = _git_out(wt, "checkout", "-q", "-B", branch, f"origin/{snap.branch}")
|
|
2111
|
+
if made is None:
|
|
2112
|
+
raise _Stop(f"FAILED cannot make the session branch {branch} in {wt} (is it clean?)",
|
|
2113
|
+
caddis_exit.BLOCKED)
|
|
2114
|
+
head_before = _git_out(wt, "rev-parse", "HEAD")
|
|
2115
|
+
restarts = 0 # context restarts of this batch
|
|
2116
|
+
else:
|
|
2117
|
+
print(f"again: {mid} {ref} (context restart {rerun})")
|
|
2118
|
+
rerun = 0
|
|
2119
|
+
session_head = _git_out(wt, "rev-parse", "HEAD") # a context block restarts only when HEAD moved
|
|
2087
2120
|
done_before = _done_phases(snap, plan)
|
|
2088
2121
|
state_before = state_snapshot(repo, "roadmap", slug)
|
|
2089
2122
|
s = _one_session(ctx, render_prompt(template, plan, phase), plan, sessions + 1, spent,
|
|
@@ -2098,7 +2131,14 @@ def _run_roadmap(ctx: _Ctx, template: Path, dry_run: bool, after_session: Callab
|
|
|
2098
2131
|
s.record["status"] = "CONTINUE" if stop is None else stop.reason
|
|
2099
2132
|
after = _load_observed(repo, slug, baseline) # one read after the session (no merge wait)
|
|
2100
2133
|
stuck = 0 if _done_phases(after, plan) > done_before else stuck + 1
|
|
2101
|
-
|
|
2134
|
+
restart = _context_restart(stop, wt, session_head, restarts, branch)
|
|
2135
|
+
if isinstance(restart, int): # the same batch again: same branch, same worktree, no blocker row
|
|
2136
|
+
restarts = rerun = restart
|
|
2137
|
+
snap = after
|
|
2138
|
+
s.record.update({"status": f"BLOCKED context (restart {restart})", "context_restart": restart})
|
|
2139
|
+
elif stop is not None:
|
|
2140
|
+
if restart is not None:
|
|
2141
|
+
s.record["context_restart"] = restart
|
|
2102
2142
|
if stop.status is None or stop.status[0] not in ("OWNER-GATE", "BLOCKED"):
|
|
2103
2143
|
raise stop
|
|
2104
2144
|
btype = "owner-gate" if stop.status[0] == "OWNER-GATE" else "external"
|
|
@@ -2385,6 +2425,33 @@ def _decide(engine: str, outcome: _Outcome, result: dict | None, relay_text: str
|
|
|
2385
2425
|
return _Stop(f"{kind} {arg}", caddis_exit.CLEAN, from_relay=True, status=(kind, arg))
|
|
2386
2426
|
|
|
2387
2427
|
|
|
2428
|
+
def _context_block(stop: _Stop | None) -> bool:
|
|
2429
|
+
"""True for a relay `STATUS: BLOCKED context <n>` (the context_size hook's 280k stop line, headless)."""
|
|
2430
|
+
return (stop is not None and stop.status is not None and stop.status[0] == "BLOCKED"
|
|
2431
|
+
and _CONTEXT_RE.match(stop.status[1]) is not None)
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
def _context_restart(stop: _Stop | None, cwd: Path, head_before: str | None, used: int,
|
|
2435
|
+
branch: str | None = None) -> int | str | None:
|
|
2436
|
+
"""For a `STATUS: BLOCKED context <n>` stop: the restart number (1, 2) when the runner starts a fresh session for
|
|
2437
|
+
the same batch, else why not (`no commits`, `limit 2`, `dirty tree`, `off branch`). None for any other stop.
|
|
2438
|
+
`used` is the restarts this batch had; `branch` (roadmap mode) is the runner's branch in the worktree `cwd`."""
|
|
2439
|
+
if not _context_block(stop):
|
|
2440
|
+
return None
|
|
2441
|
+
head_after = _git_out(cwd, "rev-parse", "HEAD")
|
|
2442
|
+
if head_before is None or head_after is None or head_after == head_before: # no git, or nothing committed
|
|
2443
|
+
return "no commits"
|
|
2444
|
+
if used >= CONTEXT_RESTARTS:
|
|
2445
|
+
return f"limit {CONTEXT_RESTARTS}"
|
|
2446
|
+
if branch is not None:
|
|
2447
|
+
work = _worktree_work(cwd)
|
|
2448
|
+
if work is None or work:
|
|
2449
|
+
return "dirty tree"
|
|
2450
|
+
if _git_out(cwd, "rev-parse", "--abbrev-ref", "HEAD") != branch:
|
|
2451
|
+
return "off branch"
|
|
2452
|
+
return used + 1
|
|
2453
|
+
|
|
2454
|
+
|
|
2388
2455
|
def _session_failed(engine: str, outcome: _Outcome, result: dict | None) -> _Stop | None:
|
|
2389
2456
|
"""The stop for a session that did not finish cleanly (usage limit, timeout, exit code, output, error); None when
|
|
2390
2457
|
it did. The relay is not read here: a review fix session writes no status line."""
|
|
@@ -30,6 +30,10 @@ _BAD_REF = re.compile(r"[\x00-\x20\x7f~^:?*\[\\]")
|
|
|
30
30
|
_NEXT = re.compile(r"^## Next step[^\n]*\n(.*?)(?=^## |\Z)", re.MULTILINE | re.DOTALL)
|
|
31
31
|
_MAX_INDEX = 800
|
|
32
32
|
_INDEX_MARKER = "<!-- caddis-workstream-index-v1 -->\n"
|
|
33
|
+
# `generated.by` of a relay that migrate-legacy writes.
|
|
34
|
+
_MIGRATED_BY = "caddis_workstreams.py migrate-legacy"
|
|
35
|
+
# The relay size budget in scripts/caddis_budget.py (`.caddis/relay/*.md`, chars).
|
|
36
|
+
_RELAY_BUDGET_CHARS = 4000
|
|
33
37
|
|
|
34
38
|
|
|
35
39
|
@dataclass(frozen=True)
|
|
@@ -468,6 +472,20 @@ class MigrationReport(dict):
|
|
|
468
472
|
return self["backups"]
|
|
469
473
|
|
|
470
474
|
|
|
475
|
+
def _utc_z(value: object = None) -> str:
|
|
476
|
+
"""`value` (an ISO time; naive means UTC) or now, as relay headers write it: UTC, seconds, `Z`.
|
|
477
|
+
An unreadable value gives now, as the migration did before."""
|
|
478
|
+
when = datetime.now(timezone.utc)
|
|
479
|
+
if value:
|
|
480
|
+
try:
|
|
481
|
+
when = datetime.fromisoformat(str(value).replace("Z", "+00:00"))
|
|
482
|
+
except ValueError:
|
|
483
|
+
pass
|
|
484
|
+
if when.tzinfo is None:
|
|
485
|
+
when = when.replace(tzinfo=timezone.utc)
|
|
486
|
+
return when.astimezone(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
487
|
+
|
|
488
|
+
|
|
471
489
|
def migrate_legacy(root: Path) -> MigrationReport:
|
|
472
490
|
"""Run the locked migration, then make sure an index exists when there was nothing to do.
|
|
473
491
|
|
|
@@ -550,10 +568,10 @@ def _migrate_legacy_locked(root: Path) -> MigrationReport:
|
|
|
550
568
|
# No header, or an opening --- with no closing one: keep the whole file as the body.
|
|
551
569
|
header_closed = split_document(candidate_text)[1] != candidate_text
|
|
552
570
|
if not candidate_text.startswith("---\n") or not header_closed:
|
|
553
|
-
now_iso = datetime.now(timezone.utc).isoformat()
|
|
554
571
|
candidate_text = (
|
|
555
572
|
f"---\ntype: relay\nworkstream: {relay_name}\nbranch: main\n"
|
|
556
|
-
f"session_id: legacy-migrated\nplan:\ngenerated:\n
|
|
573
|
+
f"session_id: legacy-migrated\nplan:\ngenerated:\n by: {_MIGRATED_BY}\n"
|
|
574
|
+
f" at: {_utc_z()}\n---\n\n"
|
|
557
575
|
f"# Relay — {relay_name}\n\n## Next step (exact)\n{raw_relay}\n"
|
|
558
576
|
)
|
|
559
577
|
else:
|
|
@@ -575,9 +593,13 @@ def _migrate_legacy_locked(root: Path) -> MigrationReport:
|
|
|
575
593
|
meta["plan"] = ""
|
|
576
594
|
modified = True
|
|
577
595
|
if not isinstance(meta.get("generated"), dict) or not meta["generated"].get("at"):
|
|
578
|
-
# Keep the original time from an inline "{ by: x, at: y }" map; else
|
|
579
|
-
|
|
580
|
-
meta
|
|
596
|
+
# Keep the original author and time from an inline "{ by: x, at: y }" map; else
|
|
597
|
+
# this script, now.
|
|
598
|
+
inline = str(meta.get("generated", ""))
|
|
599
|
+
by = re.search(r"\bby:\s*([^,}\n]+)", inline)
|
|
600
|
+
at = re.search(r"\bat:\s*([0-9][0-9T:.+\-Z]+)", inline)
|
|
601
|
+
meta["generated"] = {"by": by.group(1).strip() if by else _MIGRATED_BY,
|
|
602
|
+
"at": _utc_z(at.group(1) if at else None)}
|
|
581
603
|
modified = True
|
|
582
604
|
if modified:
|
|
583
605
|
# Plain writer: the plugin ships no YAML library, and this runs in user installs.
|
|
@@ -629,17 +651,11 @@ def _migrate_legacy_locked(root: Path) -> MigrationReport:
|
|
|
629
651
|
branch = frame.get("branch") or "main"
|
|
630
652
|
session_id = frame.get("session_id") or "legacy-migrated"
|
|
631
653
|
resume = frame.get("resumePointer") or "next step unrecorded"
|
|
632
|
-
pushed = frame.get("pushedAt") or datetime.now(timezone.utc).isoformat()
|
|
633
|
-
try:
|
|
634
|
-
datetime.fromisoformat(str(pushed).replace("Z", "+00:00"))
|
|
635
|
-
except ValueError:
|
|
636
|
-
pushed = datetime.now(timezone.utc).isoformat()
|
|
637
|
-
|
|
638
654
|
# _header_text folds every value to one line: a newline in workstreams.json
|
|
639
655
|
# must not add or break header fields.
|
|
640
656
|
header = _header_text({"type": "relay", "workstream": frame_name, "branch": str(branch),
|
|
641
657
|
"session_id": str(session_id), "plan": str(plan or ""),
|
|
642
|
-
"generated": {"at":
|
|
658
|
+
"generated": {"by": _MIGRATED_BY, "at": _utc_z(frame.get("pushedAt"))}})
|
|
643
659
|
candidate_text = (f"---\n{header}---\n\n# Relay — {frame_name}\n\n"
|
|
644
660
|
f"## Next step (exact)\n{' '.join(str(resume).split())}\n")
|
|
645
661
|
try:
|
|
@@ -850,6 +866,13 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
850
866
|
print(f"Migration status: {report.status}")
|
|
851
867
|
for conflict in report.conflicts:
|
|
852
868
|
print(f" conflict: {conflict}")
|
|
869
|
+
# The old relay is kept verbatim, so it can be over the relay budget. Say so once, here;
|
|
870
|
+
# caddis_budget.py keeps reporting it until someone trims it.
|
|
871
|
+
for name in report.migrated:
|
|
872
|
+
size = len(read_relay(args.root, name)[0])
|
|
873
|
+
if size > _RELAY_BUDGET_CHARS:
|
|
874
|
+
print(f" note: .caddis/relay/{name}.md is {size} chars, over the {_RELAY_BUDGET_CHARS}-char "
|
|
875
|
+
"relay budget (the old relay is kept verbatim); trim it to the current state or delete it")
|
|
853
876
|
return 0 if report.status in ("clean", "migrated") else 1
|
|
854
877
|
elif args.command == "list":
|
|
855
878
|
try:
|
|
@@ -61,6 +61,8 @@ Check for:
|
|
|
61
61
|
|
|
62
62
|
## Review Output Format
|
|
63
63
|
|
|
64
|
+
In a caddis repo, save a review note in `.caddis/reviews/`, never in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot`.
|
|
65
|
+
|
|
64
66
|
```markdown
|
|
65
67
|
## Code Review Summary
|
|
66
68
|
|
|
@@ -124,6 +124,7 @@ change, so a batch does not report the others as missing.
|
|
|
124
124
|
emitted by this tool** — across caddis 2 always means an advisory note, and a review
|
|
125
125
|
has no advisory verdict.
|
|
126
126
|
- A different vendor means a different style; weigh its findings on merit, don't cargo-cult them.
|
|
127
|
+
- Save review notes in `.caddis/reviews/`, never in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot` (`/caddis:park`).
|
|
127
128
|
- **Never use `find`, `Get-ChildItem -Recurse`, or any other filesystem-wide search to locate
|
|
128
129
|
`oss_review.py`.** Check only the two paths above. On Git Bash under Windows, `find /` (or any
|
|
129
130
|
search rooted at `/`) walks every mounted drive, not just the repo — it can hang or take minutes.
|
|
@@ -311,7 +311,9 @@ python "${CLAUDE_PLUGIN_ROOT}/scripts/session_state.py" tasks-file --session-id
|
|
|
311
311
|
```
|
|
312
312
|
It reads the `## Tasks` table of `.caddis/session-state/<session-id>.md`, keeps the rows that are
|
|
313
313
|
not `done` or `deleted`, and prints `[TASKS] <n> open task(s) -> <path>` or `[TASKS] none open`
|
|
314
|
-
(with no open task it deletes an old `.caddis/relay/<name>.tasks.md`).
|
|
314
|
+
(with no open task it deletes an old `.caddis/relay/<name>.tasks.md`). The state file is in the
|
|
315
|
+
folder the session started in; if that is not the work repo, add `--state-root <start folder>`
|
|
316
|
+
(the tasks file still goes under `--root`). A missing state file prints the path it tried. When it wrote a file, the
|
|
315
317
|
relay's resume prompt must hold the sentence
|
|
316
318
|
`Load every row of .caddis/relay/<name>.tasks.md with TaskCreate.`: Step 5 blocks a relay whose
|
|
317
319
|
tasks file exists and is not named. If you wrote the relay before running this, rewrite it with
|
|
@@ -503,11 +505,13 @@ Model for next session: <model>, effort <effort>
|
|
|
503
505
|
=== RESUME ===
|
|
504
506
|
Session: <session name> (<session id>)
|
|
505
507
|
Workstream: <name>
|
|
508
|
+
Repo: <absolute repo root>
|
|
506
509
|
<the resume prompt, in a fenced block>
|
|
507
510
|
Start line:
|
|
508
|
-
claude --model <model> --effort <effort> --name <role>-<MMDD>-<HH> '<the resume prompt on one line> <the announce sentence>'
|
|
511
|
+
cd "<absolute repo root>"; claude --model <model> --effort <effort> --name <role>-<MMDD>-<HH> '<the resume prompt on one line> <the announce sentence>'
|
|
509
512
|
```
|
|
510
513
|
`<model>` and `<effort>` come from `caddis_routing.py session` (Rules, "Model for the next session").
|
|
514
|
+
The `cd` makes the relay's repo-relative paths work from any terminal folder (`;`, not `&&`: Windows PowerShell 5.1 has no `&&`).
|
|
511
515
|
- **The announce sentence.** In a normal handoff the one-line start line also ends with a sentence that tells
|
|
512
516
|
the new session to run `caddis_fleet.py whoami` with its new name, then `caddis_fleet.py peers`, and to send
|
|
513
517
|
each named live peer in the same repo (the checkout and its worktrees) one `SendMessage`:
|
|
@@ -68,6 +68,18 @@ and 95-154 turns per session were started by background events. Each turn re-rea
|
|
|
68
68
|
below). **Headless (`CADDIS_HEADLESS` set): never checkpoint** (the script refuses). At 280k, start no new
|
|
69
69
|
card, commit only finished cards, write `BLOCKED context <n>` and your state (cards done, commits, next
|
|
70
70
|
card) in the review file, and end with the JSON block.
|
|
71
|
+
- **Unattended runs.** The mode is on when the marker file `~/.caddis/UNATTENDED` exists and is under 16 hours
|
|
72
|
+
old, or when the env variable `CADDIS_UNATTENDED` is set. Do not stop and do not ask for /clear. At the WARN
|
|
73
|
+
card end and at FORCE, run the checkpoint, then go on with the next card. Auto-compact brings the relay back
|
|
74
|
+
into the session. The limit is `CADDIS_UNATTENDED_MAX_FORCE` (default 6 FORCE cycles). After that, write the
|
|
75
|
+
relay and stop. For overnight work, prefer `caddis_roadmap_run.py --plan <slug>`: the runner starts a fresh
|
|
76
|
+
session for the same batch.
|
|
77
|
+
**Owner rule (28 Oct):** when the owner says "unattended", "overnight" or "I will be gone", ask ALL open
|
|
78
|
+
questions BEFORE the run starts. Use one `AskUserQuestion` round with every open choice (merge policy, PR
|
|
79
|
+
handling, spend limit, pending owner gates, any other decision the plan leaves to the owner). Make each
|
|
80
|
+
question self-contained. Start the run only after the answers. If a question comes up DURING the run, park
|
|
81
|
+
the work it blocks in the relay, go on with work that does not need the answer, and never stop the whole run
|
|
82
|
+
for it.
|
|
71
83
|
- **Model.** Take the model and effort from the session table:
|
|
72
84
|
`python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_routing.py" session --role orchestrator` prints `<model> <effort>`
|
|
73
85
|
(source checkout: `claude-harness/scripts/caddis_routing.py`). Opus stays for plans, designs and
|
|
@@ -350,6 +362,12 @@ reasons — a **milestone boundary**, a phase marked `Session: fresh`, **after**
|
|
|
350
362
|
a **failed/blocked** phase, or (interactive only) **the checkpoint after the 200k warning** at a card end
|
|
351
363
|
(the context rule above). A lane change is not one of them: you spawn the lane yourself (Step 1).
|
|
352
364
|
|
|
365
|
+
**Unattended mode** (see "Unattended runs"): the 200k-checkpoint halt and the `Session: fresh` halt do not apply
|
|
366
|
+
in unattended mode. Run the checkpoint, then go on. After a `risk: high` phase, run `/caddis:cross-review` by
|
|
367
|
+
tier (owner decision OG3 (c), `.caddis/decisions/2026-10-28-unattended-runs.md`) and go on when it has no
|
|
368
|
+
blocking finding. If it has one, write one fix card, then halt. A milestone boundary and a failed/blocked phase
|
|
369
|
+
still halt.
|
|
370
|
+
|
|
353
371
|
The `risk: high` halt is deliberately *after*, not before. Execute and commit the phase normally; the
|
|
354
372
|
halt exists to stop the **next** phase building on it before a human has looked, so the blast radius
|
|
355
373
|
stays one reviewable, revertable commit. One exception: when your session prompt itself says the runner
|
|
@@ -417,7 +435,7 @@ runs `caddis_tidy.py --check` on the PR's files and stops on a plan whose Tracke
|
|
|
417
435
|
status is not, so a skipped tidy is caught before the PR opens.
|
|
418
436
|
|
|
419
437
|
**5. Write a concise review file** to `.caddis/reviews/<slug>.md`, where `<slug>` is the plan file's
|
|
420
|
-
name without `.md`. Create `.caddis/reviews/` if needed.
|
|
438
|
+
name without `.md`. Create `.caddis/reviews/` if needed. Never put a review in `.caddis/parking-lot/`: park only follow-up items, one item per file, `type: parking-lot`.
|
|
421
439
|
Keep it short and scannable — this is what the human reviewer reads before merging the branch:
|
|
422
440
|
|
|
423
441
|
```markdown
|
|
@@ -67,6 +67,7 @@ Park it only if it is work **we** will do later. Redirect these instead, and say
|
|
|
67
67
|
| An interrupted task you will come back to this session | `/caddis:digress` |
|
|
68
68
|
| Blocked on a person outside this repo | `.caddis/comms/` + its `register.md` |
|
|
69
69
|
| A fact about the environment, not a task | the KB (`/caddis:kb`) |
|
|
70
|
+
| A review (findings, a verdict) | `.caddis/reviews/`, `type: review`; park only each item to do later, one per file |
|
|
70
71
|
|
|
71
72
|
### Step 2 — do not duplicate
|
|
72
73
|
|
|
@@ -302,6 +302,7 @@ Produce a structured report (see Output Format below).
|
|
|
302
302
|
## Output Format
|
|
303
303
|
|
|
304
304
|
The report is written to the path specified by the invoking agent. Default: `.github/agent-docs/preflight-report.md`
|
|
305
|
+
Never write it in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot`.
|
|
305
306
|
|
|
306
307
|
Apply `.github/instructions/document-frontmatter.instructions.md` when creating or updating the report. The YAML frontmatter block must be the first content in the file. New reports require `Original Author`, `Creation Date`, and `Creating Model`; revised reports must preserve those fields and add or update `Last Author`, `Last Updated`, and `Last Model Used`.
|
|
307
308
|
|
|
@@ -23,6 +23,9 @@ The relay can be old. Before you act, compare it with the real state: the plan t
|
|
|
23
23
|
pull requests and remote branches. If they disagree, trust the real state. Fix the relay and the tracker. Do not build on a
|
|
24
24
|
guess.
|
|
25
25
|
|
|
26
|
+
If the relay ends `STATUS: BLOCKED context`, an earlier session of this batch ran out of context: go on from its Next
|
|
27
|
+
step; its commits are on your branch.
|
|
28
|
+
|
|
26
29
|
## 3. Pick the batch
|
|
27
30
|
|
|
28
31
|
A batch is ONE tracker phase (the first row that is not done and not blocked), or ONE named batch that the plan or the relay
|
|
@@ -64,13 +67,17 @@ STATUS: BLOCKED <owner>
|
|
|
64
67
|
STATUS: FAILED <reason>
|
|
65
68
|
```
|
|
66
69
|
|
|
70
|
+
`STATUS: BLOCKED context <n>` is a `BLOCKED` line: use it only when the context_size hook tells you to. The runner then
|
|
71
|
+
starts a fresh session for the same batch. Your relay must name the cards done, their commits and the next card. Do not
|
|
72
|
+
call PushNotification for it.
|
|
73
|
+
|
|
67
74
|
Use `STATUS: CONTINUE` only when the next batch can start with no owner input. A missing or bad line counts as FAILED.
|
|
68
75
|
An owner gate id has the form `<P>-OG<n>`: the plan's 2 to 4 capital-letter prefix (for example `PM-OG1`). Name the gate
|
|
69
76
|
in the plan's decisions with that id. Any other form is a bad line.
|
|
70
77
|
|
|
71
78
|
## 6. Notify and end
|
|
72
79
|
|
|
73
|
-
When the status is not CONTINUE
|
|
80
|
+
When the status is not CONTINUE and not `BLOCKED context`, call the `PushNotification` tool as your last action. Put the plan, the status line and the
|
|
74
81
|
next step in the message. After the call succeeds, print the line `PUSH-SENT`. The runner looks for that marker. Without it,
|
|
75
82
|
the runner sends the notification itself.
|
|
76
83
|
|
|
@@ -110,6 +110,7 @@ change, so a batch does not report the others as missing.
|
|
|
110
110
|
the main thread after reading the findings.
|
|
111
111
|
- Treat exit 3/4 as blocking-unknown, never as approval (the tool is fail-closed by design).
|
|
112
112
|
- Different vendor ⇒ different style; weigh its findings on merit, don't cargo-cult them.
|
|
113
|
+
- Save review notes in `.caddis/reviews/`, never in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot` (`/caddis:park`).
|
|
113
114
|
- **Never use `find`, `Get-ChildItem -Recurse`, or any other filesystem-wide search to locate
|
|
114
115
|
`oss_review.py`.** Check only the two paths above. On Git Bash under Windows, `find /` (or any
|
|
115
116
|
search rooted at `/`) walks every mounted drive, not just the repo — it can hang or take minutes.
|
|
@@ -61,6 +61,8 @@ Check for:
|
|
|
61
61
|
|
|
62
62
|
## Review Output Format
|
|
63
63
|
|
|
64
|
+
In a caddis repo, save a review note in `.caddis/reviews/`, never in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot`.
|
|
65
|
+
|
|
64
66
|
```markdown
|
|
65
67
|
## Code Review Summary
|
|
66
68
|
|
|
@@ -302,6 +302,7 @@ Produce a structured report (see Output Format below).
|
|
|
302
302
|
## Output Format
|
|
303
303
|
|
|
304
304
|
The report is written to the path specified by the invoking agent. Default: `.github/agent-docs/preflight-report.md`
|
|
305
|
+
Never write it in `.caddis/parking-lot/`: that folder holds only items to do later, one item per file, `type: parking-lot`.
|
|
305
306
|
|
|
306
307
|
Apply `.github/instructions/document-frontmatter.instructions.md` when creating or updating the report. The YAML frontmatter block must be the first content in the file. New reports require `Original Author`, `Creation Date`, and `Creating Model`; revised reports must preserve those fields and add or update `Last Author`, `Last Updated`, and `Last Model Used`.
|
|
307
308
|
|
|
@@ -23,6 +23,9 @@ The relay can be old. Before you act, compare it with the real state: the plan t
|
|
|
23
23
|
pull requests and remote branches. If they disagree, trust the real state. Fix the relay and the tracker. Do not build on a
|
|
24
24
|
guess.
|
|
25
25
|
|
|
26
|
+
If the relay ends `STATUS: BLOCKED context`, an earlier session of this batch ran out of context: go on from its Next
|
|
27
|
+
step; its commits are on your branch.
|
|
28
|
+
|
|
26
29
|
## 3. Pick the batch
|
|
27
30
|
|
|
28
31
|
A batch is ONE tracker phase (the first row that is not done and not blocked), or ONE named batch that the plan or the relay
|
|
@@ -64,13 +67,17 @@ STATUS: BLOCKED <owner>
|
|
|
64
67
|
STATUS: FAILED <reason>
|
|
65
68
|
```
|
|
66
69
|
|
|
70
|
+
`STATUS: BLOCKED context <n>` is a `BLOCKED` line: use it only when the context_size hook tells you to. The runner then
|
|
71
|
+
starts a fresh session for the same batch. Your relay must name the cards done, their commits and the next card. Do not
|
|
72
|
+
call PushNotification for it.
|
|
73
|
+
|
|
67
74
|
Use `STATUS: CONTINUE` only when the next batch can start with no owner input. A missing or bad line counts as FAILED.
|
|
68
75
|
An owner gate id has the form `<P>-OG<n>`: the plan's 2 to 4 capital-letter prefix (for example `PM-OG1`). Name the gate
|
|
69
76
|
in the plan's decisions with that id. Any other form is a bad line.
|
|
70
77
|
|
|
71
78
|
## 6. Notify and end
|
|
72
79
|
|
|
73
|
-
When the status is not CONTINUE
|
|
80
|
+
When the status is not CONTINUE and not `BLOCKED context`, call the `PushNotification` tool as your last action. Put the plan, the status line and the
|
|
74
81
|
next step in the message. After the call succeeds, print the line `PUSH-SENT`. The runner looks for that marker. Without it,
|
|
75
82
|
the runner sends the notification itself.
|
|
76
83
|
|
package/bundles/manifest.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -7043,6 +7043,7 @@ async function resolvePython() {
|
|
|
7043
7043
|
function createCollectorSource(opts) {
|
|
7044
7044
|
const now = opts.now ?? Date.now;
|
|
7045
7045
|
const spawn2 = opts.spawn ?? spawnBounded;
|
|
7046
|
+
const log = opts.log ?? errorLine;
|
|
7046
7047
|
const cache2 = /* @__PURE__ */ new Map();
|
|
7047
7048
|
let spend = null;
|
|
7048
7049
|
let guide = null;
|
|
@@ -7053,6 +7054,7 @@ function createCollectorSource(opts) {
|
|
|
7053
7054
|
let updateNeeded = false;
|
|
7054
7055
|
let lastRunOk = false;
|
|
7055
7056
|
let running = null;
|
|
7057
|
+
let knownUnsupported = false;
|
|
7056
7058
|
const fail2 = (message3) => {
|
|
7057
7059
|
lastError = message3;
|
|
7058
7060
|
lastRunOk = false;
|
|
@@ -7107,9 +7109,14 @@ function createCollectorSource(opts) {
|
|
|
7107
7109
|
pre = found.pre;
|
|
7108
7110
|
}
|
|
7109
7111
|
const script = opts.scriptPath ?? defaultScriptPath();
|
|
7110
|
-
const known = [...cache2.values()].filter((r2) => r2.error === void 0 && typeof r2.fingerprint === "string" && repos.includes(r2.path)).map((r2) => `${r2.path}=${r2.fingerprint}`);
|
|
7112
|
+
const known = [...cache2.values()].filter((r2) => !knownUnsupported && r2.error === void 0 && typeof r2.fingerprint === "string" && repos.includes(r2.path)).map((r2) => `${r2.path}=${r2.fingerprint}`);
|
|
7111
7113
|
const args = repos.length ? known.length ? [...pre, script, "--repos", ...repos, "--known", ...known, "--json"] : [...pre, script, "--repos", ...repos, "--json"] : [...pre, script, "--repos", path17.join(os5.tmpdir(), "caddis-hub-no-repos"), "--only", "spend,guide", "--json"];
|
|
7112
|
-
|
|
7114
|
+
let result = await spawn2(cmd, args, { timeoutMs: RUN_TIMEOUT_MS2 });
|
|
7115
|
+
if (!result.ok && result.code === 2 && known.length && repos.length && /unrecognized arguments:.*--known/.test(result.stderr)) {
|
|
7116
|
+
knownUnsupported = true;
|
|
7117
|
+
log("caddis hub: the collector script does not know --known (old plugin); sending full runs. Update the plugin.");
|
|
7118
|
+
result = await spawn2(cmd, [...pre, script, "--repos", ...repos, "--json"], { timeoutMs: RUN_TIMEOUT_MS2 });
|
|
7119
|
+
}
|
|
7113
7120
|
if (result.timedOut) return fail2(`collector timed out after ${RUN_TIMEOUT_MS2 / 1e3} s`);
|
|
7114
7121
|
if (!result.ok) {
|
|
7115
7122
|
const detail2 = (result.stderr || result.stdout).trim().slice(0, 500);
|
|
@@ -7151,6 +7158,7 @@ var init_collector = __esm({
|
|
|
7151
7158
|
"use strict";
|
|
7152
7159
|
init_pkg();
|
|
7153
7160
|
init_which();
|
|
7161
|
+
init_log();
|
|
7154
7162
|
init_bounded();
|
|
7155
7163
|
init_spawn();
|
|
7156
7164
|
COLLECTOR_SCHEMA = 1;
|
|
@@ -9421,7 +9429,6 @@ import {
|
|
|
9421
9429
|
mkdirSync as mkdirSync9,
|
|
9422
9430
|
readdirSync as readdirSync6,
|
|
9423
9431
|
readFileSync as readFileSync18,
|
|
9424
|
-
renameSync as renameSync4,
|
|
9425
9432
|
rmSync as rmSync4,
|
|
9426
9433
|
statSync as statSync3,
|
|
9427
9434
|
writeFileSync as writeFileSync6
|
|
@@ -9619,7 +9626,7 @@ async function hubExport(args, deps = {}) {
|
|
|
9619
9626
|
}
|
|
9620
9627
|
mkdirSync9(path25.dirname(outDir), { recursive: true });
|
|
9621
9628
|
if (existsSync10(outDir)) rmSync4(outDir, { recursive: true, force: true });
|
|
9622
|
-
|
|
9629
|
+
renameWithRetry(staging, outDir);
|
|
9623
9630
|
writeFileSync6(path25.join(outDir, MARKER), "written by caddis hub export\n");
|
|
9624
9631
|
out(`[EXPORT] ${countFiles(outDir)} file(s) in ${outDir}`);
|
|
9625
9632
|
return 0;
|
|
@@ -9634,6 +9641,7 @@ var init_export = __esm({
|
|
|
9634
9641
|
"src/hub/export/export.ts"() {
|
|
9635
9642
|
"use strict";
|
|
9636
9643
|
init_pkg();
|
|
9644
|
+
init_config();
|
|
9637
9645
|
init_spawn();
|
|
9638
9646
|
init_collector();
|
|
9639
9647
|
init_data();
|
package/package.json
CHANGED