@joshuafolkken/kit 1.1383.0 → 1.1435.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/epic-commands/SKILL.md +1 -1
- package/.claude/skills/epic-commands/epic-bundle.md +5 -0
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +5 -3
- package/.claude/skills/workflow-commands/backlogrun-steps.md +4 -3
- package/.claude/skills/workflow-commands/backlogrun.md +1 -0
- package/.claude/skills/workflow-commands/chain-rule.md +4 -2
- package/.claude/skills/workflow-commands/issue-comments.md +6 -0
- package/.claude/skills/workflow-commands/observation-ledger.md +3 -2
- package/.claude/skills/workflow-commands/pre-gate-cut.md +5 -3
- package/README.md +25 -0
- package/dist/hooks/audit-provision.js +2 -2
- package/dist/hooks/batch-guard.js +7 -7
- package/dist/hooks/{chunk-LOJTBU5V.js → chunk-2G5F2YCD.js} +3 -3
- package/dist/hooks/{chunk-4MGHBTOM.js → chunk-3LE6VLSR.js} +25 -8
- package/dist/hooks/{chunk-Y5R47QHU.js → chunk-4BHUPFKF.js} +1 -1
- package/dist/hooks/{chunk-KC6LUZZ2.js → chunk-5SJSSCJG.js} +1 -1
- package/dist/hooks/{chunk-FZ6FUSBM.js → chunk-723HKZO5.js} +1 -1
- package/dist/hooks/{chunk-RYP3TSUJ.js → chunk-7KMN5QB5.js} +3 -3
- package/dist/hooks/{chunk-NEC4AT4Z.js → chunk-DGT54IH5.js} +4 -0
- package/dist/hooks/{chunk-YKUITFT7.js → chunk-EMB55BDF.js} +4 -4
- package/dist/hooks/{chunk-JBBMAPC4.js → chunk-IX6TTTI6.js} +4 -0
- package/dist/hooks/{chunk-6MAW7BCM.js → chunk-JXQBK323.js} +2677 -190
- package/dist/hooks/{chunk-KCF2YE7O.js → chunk-MSYSUSY6.js} +5 -5
- package/dist/hooks/{chunk-LC56R53A.js → chunk-MU4LJFIV.js} +4 -4
- package/dist/hooks/{chunk-7VSZ2N4B.js → chunk-QL6QTPWN.js} +3 -3
- package/dist/hooks/{chunk-TT742SIO.js → chunk-XER6SSIB.js} +92 -19
- package/dist/hooks/{chunk-2X2ART5G.js → chunk-YW452ZAX.js} +500 -29
- package/dist/hooks/{chunk-6AC4C2IO.js → chunk-YZXYOAZ3.js} +187 -443
- package/dist/hooks/codex-hook-adapter.js +15 -15
- package/dist/hooks/duplicate-read-guard.js +8 -8
- package/dist/hooks/format-edited.js +5 -5
- package/dist/hooks/inputs.json +262 -201
- package/dist/hooks/investigation-guard.js +8 -8
- package/dist/hooks/pretool-guard.js +14 -14
- package/dist/hooks/session-lang.js +124 -15
- package/dist/hooks/stop-guard.js +98 -55
- package/dist/josh.js +63 -10
- package/package.json +4 -3
- package/prompts/review.md +22 -0
- package/scripts/agent/claude-agent-argv.ts +13 -1
- package/scripts/auth/auth-setup-cli.ts +101 -0
- package/scripts/auth/claude-token-output.ts +78 -0
- package/scripts/auth/claude-token.ts +68 -0
- package/scripts/backlog/backlog-drive-cli.ts +2 -4
- package/scripts/backlog/backlog-drive-epic.ts +24 -8
- package/scripts/backlog/backlog-drive-launch.ts +5 -0
- package/scripts/backlog/backlog-drive-named-offer.ts +7 -2
- package/scripts/backlog/backlog-drive-named.ts +4 -2
- package/scripts/backlog/backlog-drive-owner.ts +72 -5
- package/scripts/backlog/backlog-drive-unread.ts +56 -0
- package/scripts/backlog/backlog-drive.ts +16 -8
- package/scripts/backlog/backlog-overlap.ts +22 -5
- package/scripts/backlog/backlog-ready.ts +1 -3
- package/scripts/backlog/backlogrun-args.ts +13 -2
- package/scripts/backlog/backlogrun-cli.ts +91 -19
- package/scripts/backlog/backlogrun-launch.ts +80 -5
- package/scripts/backlog/backlogrun-replace.ts +166 -0
- package/scripts/backlog/backlogrun-stop.ts +178 -0
- package/scripts/behavior/behavior-cli.ts +6 -1
- package/scripts/doctor/doctor-io.ts +60 -9
- package/scripts/doctor/doctor.ts +20 -1
- package/scripts/document/document-byte-budget.ts +3 -3
- package/scripts/epic/epic-bundle-cli.ts +8 -8
- package/scripts/epic/epic-bundle-referenced.ts +2 -5
- package/scripts/epic/epic-bundle.ts +39 -4
- package/scripts/exports/unused-members-cli.ts +2 -1
- package/scripts/followup/followup-checks-event.ts +82 -0
- package/scripts/followup/git-followup-finish.ts +16 -2
- package/scripts/followup/git-followup-workflow.ts +5 -2
- package/scripts/followup/git-pr-followup-checks.ts +18 -4
- package/scripts/followup/git-pr-followup-wrapup.ts +5 -0
- package/scripts/followup/git-pr-followup.ts +4 -1
- package/scripts/fresh-machine/fresh-machine-cli.ts +204 -0
- package/scripts/fresh-machine/fresh-machine-docker.ts +65 -0
- package/scripts/fresh-machine/fresh-machine-image.ts +62 -0
- package/scripts/fresh-machine/fresh-machine-log.ts +61 -0
- package/scripts/fresh-machine/fresh-machine-patterns.ts +130 -0
- package/scripts/fresh-machine/fresh-machine-run.ts +215 -0
- package/scripts/fresh-machine/fresh-machine-script.ts +45 -0
- package/scripts/fresh-machine/fresh-machine-spec.ts +57 -0
- package/scripts/fresh-machine/specs/kit-test-backlogrun-python.json +34 -0
- package/scripts/fresh-machine/specs/kit-test-backlogrun.json +31 -0
- package/scripts/gate/gate-report.ts +70 -15
- package/scripts/gate/project-checks.ts +13 -2
- package/scripts/gate/scoped-green.ts +2 -1
- package/scripts/gate/verification-gate.ts +4 -3
- package/scripts/gh/gh-author-association.ts +14 -0
- package/scripts/gh/git-gh-conditional.ts +66 -0
- package/scripts/gh/git-gh-exec.ts +1 -1
- package/scripts/gh/git-gh-issue-read.ts +6 -3
- package/scripts/gh/git-gh-issue-write.ts +5 -1
- package/scripts/gh/git-gh-issue.ts +4 -1
- package/scripts/gh/git-pr-checks-eval.ts +13 -0
- package/scripts/gh/git-pr-checks-parse.ts +8 -1
- package/scripts/gh/git-pr-checks-watch.ts +11 -4
- package/scripts/gh/git-pr-checks.ts +36 -2
- package/scripts/git/git-command.ts +16 -4
- package/scripts/git/git-schemas.ts +1 -0
- package/scripts/git/git-spawn-sync.ts +1 -1
- package/scripts/hooks/pretool-guard.ts +3 -1
- package/scripts/init/hook-command-rewrite.ts +31 -0
- package/scripts/init/init-actions.ts +4 -1
- package/scripts/init/init-ai-copy.ts +33 -10
- package/scripts/init/init-basic.ts +8 -3
- package/scripts/init/init-logic-toolchain.ts +76 -0
- package/scripts/init/init-logic.ts +2 -0
- package/scripts/init/init.ts +5 -23
- package/scripts/init/project-profile.ts +36 -7
- package/scripts/init/start-exec.ts +27 -1
- package/scripts/init/start-plan.ts +30 -4
- package/scripts/init/start-steps.ts +77 -3
- package/scripts/init/start.ts +21 -13
- package/scripts/init/workflow-mark.ts +35 -0
- package/scripts/issue/issue-ack-cli.ts +84 -0
- package/scripts/issue/issue-labels.ts +40 -8
- package/scripts/issue/issue-state-cli.ts +14 -4
- package/scripts/issue/issue-watch-diff.ts +152 -0
- package/scripts/issue/issue-watch-gate.ts +81 -0
- package/scripts/issue/issue-watch-hook.ts +54 -0
- package/scripts/issue/issue-watch.ts +240 -0
- package/scripts/issue/measure-rerun-cli.ts +3 -4
- package/scripts/josh/josh-command-map.ts +4 -0
- package/scripts/josh/josh-commands-backlog.ts +2 -2
- package/scripts/josh/josh-commands-development.ts +1 -1
- package/scripts/josh/josh-commands-issue.ts +7 -0
- package/scripts/josh/josh-commands-lane.ts +11 -2
- package/scripts/josh/josh-commands-project.ts +25 -1
- package/scripts/josh/josh-verdict.ts +33 -4
- package/scripts/lane/claude-lane-broker.ts +142 -0
- package/scripts/lane/lane-await.ts +6 -2
- package/scripts/lane/lane-cache.ts +37 -7
- package/scripts/lane/lane-capacity.ts +8 -6
- package/scripts/lane/lane-child-invocation.ts +1 -0
- package/scripts/lane/lane-cli.ts +15 -1
- package/scripts/lane/lane-close.ts +15 -6
- package/scripts/lane/lane-dispatch.ts +36 -10
- package/scripts/lane/lane-environment.ts +1 -1
- package/scripts/lane/lane-launch-cli.ts +13 -4
- package/scripts/lane/lane-ledger.ts +21 -3
- package/scripts/lane/lane-measure-cli.ts +10 -2
- package/scripts/lane/lane-open.ts +9 -1
- package/scripts/lane/lane-preserve.ts +49 -0
- package/scripts/lane/lane-reap.ts +20 -5
- package/scripts/lane/lane-registry.ts +6 -0
- package/scripts/lane/lane-restart-cli.ts +51 -0
- package/scripts/lane/lane-restart.ts +175 -0
- package/scripts/lane/{openai-review-broker.ts → lane-session-broker.ts} +106 -28
- package/scripts/lane/lane-spent.ts +195 -0
- package/scripts/lane/lane-stage-stats.ts +27 -3
- package/scripts/lane/lane-stop-stats.ts +96 -0
- package/scripts/lane/openai-lane-supervisor.ts +2 -2
- package/scripts/lane/process-tools.ts +31 -0
- package/scripts/lib/buffered-process.ts +36 -2
- package/scripts/lib/pnpm-reach.ts +27 -0
- package/scripts/lib/status-icons.ts +5 -1
- package/scripts/lint/lint-parallel.ts +19 -2
- package/scripts/observations/observation-ledger-home.ts +1 -0
- package/scripts/review/review-attest-cli.ts +21 -6
- package/scripts/review/review-brief-cli.ts +2 -2
- package/scripts/review/review-comment-round.ts +114 -0
- package/scripts/review/review-record-cli.ts +39 -17
- package/scripts/rules/implementation-cut.ts +3 -3
- package/scripts/rules/pre-gate-cut.ts +1 -1
- package/scripts/run/board/run-board-checks.ts +42 -0
- package/scripts/run/board/run-board-cli.ts +2 -0
- package/scripts/run/board/run-board-every.ts +3 -1
- package/scripts/run/board/run-board-fit.ts +16 -5
- package/scripts/run/board/run-board-fresh.ts +64 -0
- package/scripts/run/board/run-board-header.ts +139 -37
- package/scripts/run/board/run-board-labels.ts +47 -4
- package/scripts/run/board/run-board-lane-event.ts +66 -0
- package/scripts/run/board/run-board-layout.ts +57 -9
- package/scripts/run/board/run-board-now.ts +234 -0
- package/scripts/run/board/run-board-operation-read.ts +75 -0
- package/scripts/run/board/run-board-operation.ts +150 -0
- package/scripts/run/board/run-board-phase.ts +26 -1
- package/scripts/run/board/run-board-plan.ts +4 -6
- package/scripts/run/board/run-board-read.ts +58 -5
- package/scripts/run/board/run-board-reason.ts +124 -0
- package/scripts/run/board/run-board-render-checks.ts +55 -0
- package/scripts/run/board/run-board-render-legend.ts +12 -3
- package/scripts/run/board/run-board-render-slot.ts +2 -2
- package/scripts/run/board/run-board-render-tail.ts +128 -0
- package/scripts/run/board/run-board-render-thanks.ts +50 -0
- package/scripts/run/board/run-board-render-title.ts +58 -0
- package/scripts/run/board/run-board-render.ts +96 -80
- package/scripts/run/board/run-board-row-yield.ts +32 -0
- package/scripts/run/board/run-board-setup.ts +121 -0
- package/scripts/run/board/run-board-span.ts +49 -7
- package/scripts/run/board/run-board-state.ts +10 -0
- package/scripts/run/board/run-board-status.ts +76 -13
- package/scripts/run/board/run-board-thanks-csv.ts +71 -0
- package/scripts/run/board/run-board-thanks-read.ts +112 -0
- package/scripts/run/board/run-board-thanks.ts +53 -0
- package/scripts/run/board/run-board-tick.ts +53 -16
- package/scripts/run/board/run-board-usual.ts +44 -0
- package/scripts/run/carry/run-carry-added.ts +1 -1
- package/scripts/run/carry/run-carry-args.ts +9 -1
- package/scripts/run/carry/run-carry-change.ts +1 -1
- package/scripts/run/carry/run-carry-cli.ts +39 -52
- package/scripts/run/carry/run-carry-end.ts +73 -0
- package/scripts/run/carry/run-carry-ended.ts +9 -1
- package/scripts/run/carry/run-carry.ts +24 -1
- package/scripts/run/entry/run-entry-cli.ts +5 -0
- package/scripts/run/event/run-event-checks.ts +54 -0
- package/scripts/run/event/run-event-render.ts +3 -0
- package/scripts/run/event/run-event-scope.ts +1 -0
- package/scripts/run/event/run-event-setup.ts +91 -0
- package/scripts/run/event/run-event-stream.ts +46 -9
- package/scripts/run/merge/run-merge-cli.ts +7 -4
- package/scripts/run/merge/run-merge-ship.ts +61 -0
- package/scripts/run/merge/run-merge-steps.ts +7 -14
- package/scripts/run/merge/run-merge-token.ts +16 -2
- package/scripts/run/run-headless.ts +1 -0
- package/scripts/run/run-step.ts +2 -0
- package/scripts/run/run-stranded-detect.ts +58 -12
- package/scripts/run/ship/run-ship-cli.ts +22 -2
- package/scripts/run/ship/run-ship-return.ts +31 -13
- package/scripts/run/ship/run-ship-review-steps.ts +17 -4
- package/scripts/run/ship/run-ship-stage.ts +1 -0
- package/scripts/run/wake/run-wake-await.ts +130 -0
- package/scripts/run/wake/run-wake-cli.ts +108 -74
- package/scripts/run/wake/run-wake-describe.ts +36 -2
- package/scripts/run/wake/run-wake-driver.ts +21 -5
- package/scripts/run/wake/run-wake-handoff.ts +1 -1
- package/scripts/run/wake/run-wake-session.ts +20 -3
- package/scripts/run/wake/run-wake-stop.ts +37 -0
- package/scripts/run/wake/run-wake-supervise.ts +44 -0
- package/scripts/sync/claude-settings-merge.ts +144 -0
- package/scripts/sync/sync-ai-files.ts +28 -3
- package/scripts/sync/sync.ts +15 -0
- package/scripts/test/project-test-script.ts +73 -0
- package/scripts/test/skip-marker.ts +14 -1
- package/scripts/test/test-related.ts +3 -2
- package/scripts/test/test-unit-guard.ts +78 -14
- package/scripts/time-runtime/time-reported-failure.ts +11 -3
- package/scripts/uninstall/distributed-files.ts +92 -0
- package/scripts/uninstall/uninstall-plan.ts +119 -0
- package/scripts/uninstall/uninstall-report.ts +61 -0
- package/scripts/uninstall/uninstall.ts +206 -0
- package/templates/AGENTS.basic.md +4 -0
- package/templates/GEMINI.basic.md +6 -0
- package/dist/hooks/chunk-6V5OPIUU.js +0 -13
- package/scripts/run/board/run-board-track.ts +0 -22
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
lane_child_invocation,
|
|
7
7
|
repo_discovery,
|
|
8
8
|
repo_origin,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
run_event_stream,
|
|
10
|
+
run_event_stream_emit
|
|
11
|
+
} from "./chunk-YW452ZAX.js";
|
|
12
12
|
import {
|
|
13
13
|
error_text
|
|
14
14
|
} from "./chunk-CDY4NFQG.js";
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
time_density_hook,
|
|
31
31
|
time_shell,
|
|
32
32
|
time_transcript_line
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XER6SSIB.js";
|
|
34
34
|
import {
|
|
35
35
|
lane_child_marker
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-4BHUPFKF.js";
|
|
37
37
|
import {
|
|
38
38
|
agent_session_environment,
|
|
39
39
|
backlog_budget,
|
|
@@ -41,13 +41,13 @@ import {
|
|
|
41
41
|
git_command,
|
|
42
42
|
has_timed_out,
|
|
43
43
|
json_value,
|
|
44
|
-
process_identity
|
|
45
|
-
|
|
46
|
-
} from "./chunk-4MGHBTOM.js";
|
|
44
|
+
process_identity
|
|
45
|
+
} from "./chunk-3LE6VLSR.js";
|
|
47
46
|
import {
|
|
48
47
|
COMMAND_TIMEOUT_MS,
|
|
48
|
+
PROJECT_ROOT,
|
|
49
49
|
stamp_file
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-DGT54IH5.js";
|
|
51
51
|
|
|
52
52
|
// scripts/lib/bounded-pool.ts
|
|
53
53
|
function pool_width(limit, total) {
|
|
@@ -1061,406 +1061,7 @@ var lane_background = {
|
|
|
1061
1061
|
// scripts/run/ship/run-ship-detach.ts
|
|
1062
1062
|
import { randomUUID } from "node:crypto";
|
|
1063
1063
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
1064
|
-
|
|
1065
|
-
// scripts/run/event/run-event-stream.ts
|
|
1066
1064
|
import { z as z4 } from "zod";
|
|
1067
|
-
var EVENT_PREFIX = "josh-run-events-";
|
|
1068
|
-
var EVENT_SUFFIX = ".jsonl";
|
|
1069
|
-
var EVENT_CAP = 500;
|
|
1070
|
-
var FIRST_POSITION = 0;
|
|
1071
|
-
var POSITION_INCREMENT = 1;
|
|
1072
|
-
var LINE_SEPARATOR = "\n";
|
|
1073
|
-
var WORD_SEPARATOR = " ";
|
|
1074
|
-
var STAGE_PHASE_INDEX = 2;
|
|
1075
|
-
var LOCK_SUFFIX = ".lock";
|
|
1076
|
-
var LOCK_WAIT_MS = 5e3;
|
|
1077
|
-
var EVENT_KIND = {
|
|
1078
|
-
PLAN: "plan",
|
|
1079
|
-
CHILD_LAUNCH: "child-launch",
|
|
1080
|
-
MERGE: "merge",
|
|
1081
|
-
PARK: "park",
|
|
1082
|
-
SPLIT: "split",
|
|
1083
|
-
OUTAGE: "outage",
|
|
1084
|
-
CUT: "cut",
|
|
1085
|
-
// A fresh session adopted an implementation cut — `run:cut --resume` answered `resume-impl`. The
|
|
1086
|
-
// resume clears the cut record, so without this the `cut` would stay the newest position and
|
|
1087
|
-
// `run:step` would keep answering the resume command it had just run.
|
|
1088
|
-
RESUME: "resume",
|
|
1089
|
-
// The backlog emptied while nothing of the run's own was in flight — the drain. It marks the position
|
|
1090
|
-
// at which the end-of-run retrospective is owed, *before* the idle watch opens, so `run:step` fires
|
|
1091
|
-
// the retrospective at the drain rather than after the watch runs its course. It is not itself a
|
|
1092
|
-
// stop: the run watches on once the retrospective has run, and the real `STOP` follows when the watch
|
|
1093
|
-
// expires.
|
|
1094
|
-
DRAIN: "drain",
|
|
1095
|
-
STOP: "stop",
|
|
1096
|
-
PR_OPENED: "pr-opened",
|
|
1097
|
-
REVIEW_ROUND: "review-round",
|
|
1098
|
-
// The end-of-run retrospective's result, recorded when the run marks the retrospective done. A
|
|
1099
|
-
// retrospective that files zero improvements and one that never ran look
|
|
1100
|
-
// the same from outside — no new Issue either way — so the result is put on the stream the report is
|
|
1101
|
-
// generated from: the issues filed (or that none were), and the candidates dropped with why. It is
|
|
1102
|
-
// emitted from the `run:carry --retrospective` close, so marking the retrospective done and recording
|
|
1103
|
-
// what it found are one action rather than two the run could do only one of.
|
|
1104
|
-
RETROSPECTIVE: "retrospective",
|
|
1105
|
-
// Ready backlog work is sitting undispatched while a lane is free and nothing has dispatched for a
|
|
1106
|
-
// while. Emitted once per stall episode by the stop-time detector, it is both the dedup marker —
|
|
1107
|
-
// `emit_once_since` refuses a second until a `CHILD_LAUNCH` intervenes — and the line a terminal
|
|
1108
|
-
// reader following the stream sees. `run:step` reads it as `backlog:next`, so a run that
|
|
1109
|
-
// stalled is pointed straight at dispatching the work rather than left waiting.
|
|
1110
|
-
STALL: "stall",
|
|
1111
|
-
// The run's own driver is gone: the cut handed the budget off, the owner has died, and no supervisor
|
|
1112
|
-
// is watching. Emitted once per strand episode by the stop-time detector,
|
|
1113
|
-
// exactly as `STALL` is — the newest-event dedup keeps a run polled every stop from notifying more
|
|
1114
|
-
// than once, and a terminal reader following the stream sees the line. The strand is the step before
|
|
1115
|
-
// the stall: a stalled run still has a driver that could dispatch, a stranded one has none.
|
|
1116
|
-
STRANDED: "stranded",
|
|
1117
|
-
// One `josh ship` stage starting, succeeding or failing. It is a trace of the
|
|
1118
|
-
// composite's progress rather than a position the run is at — the positions a ship leaves behind are
|
|
1119
|
-
// the closed issue its `followup` merges, or a detached supervisor's `SHIP_LAUNCH` / `SHIP_STOP` below
|
|
1120
|
-
// — so it is one of the `TRACE_KINDS` the last-event read skips.
|
|
1121
|
-
SHIP_STAGE: "ship-stage",
|
|
1122
|
-
// One progress watcher line — the `at … / next …` heartbeat `run:progress` prints. Printed only to
|
|
1123
|
-
// the watcher's own output, a headless successor's heartbeat would be buried in its log after a cut;
|
|
1124
|
-
// on the stream it reaches the attached session's relay. It says
|
|
1125
|
-
// the run is alive rather than where it is, so it is a trace kind like `SHIP_STAGE`.
|
|
1126
|
-
HEARTBEAT: "heartbeat",
|
|
1127
|
-
// The post-implementation region handed to a detached `josh ship --detach` supervisor. Unlike a stage
|
|
1128
|
-
// trace it is a position: the agent has ended and the
|
|
1129
|
-
// supervisor carries the run, so `run:step` answers `wait` until it stops or the issue closes.
|
|
1130
|
-
SHIP_LAUNCH: "ship-launch",
|
|
1131
|
-
// The supervisor stopped at a failed stage — a red gate, a High/Medium review, a failed push, red CI
|
|
1132
|
-
// The position that hands control back: `run:step` prints the command that
|
|
1133
|
-
// shows the stopped report, so the agent fixes it and relaunches rather than rebuilding the context.
|
|
1134
|
-
SHIP_STOP: "ship-stop",
|
|
1135
|
-
// An Issue the run filed on its way, written by `issue:file`, so a run started from the command line
|
|
1136
|
-
// still surfaces what it found — `run:board`'s findings section reads it.
|
|
1137
|
-
FILED: "filed",
|
|
1138
|
-
// A one-line observation short of an Issue, written with `run:event --append note` and shown in the
|
|
1139
|
-
// same section.
|
|
1140
|
-
NOTE: "note",
|
|
1141
|
-
// A lane child reached a phase no other event marks — its first implementation edit, written by the
|
|
1142
|
-
// PreToolUse hook — so `run:board` draws how far the child has got. A trace,
|
|
1143
|
-
// like `SHIP_STAGE`: it says where the child's work is, not where the run is.
|
|
1144
|
-
LANE_PHASE: "lane-phase",
|
|
1145
|
-
// An issue `run:add` put into the live run. The parent's `--wait` watcher
|
|
1146
|
-
// ends on it, so the issue takes the next free lane without waiting out the arrival probe's minute. A
|
|
1147
|
-
// trace: it says what the run was handed, not where the run is.
|
|
1148
|
-
ADD: "add",
|
|
1149
|
-
// `josh lane:limit` raised a live run's lane limit. The `--wait` watcher's
|
|
1150
|
-
// arrival probe reads it as a wake: the lanes a raise frees are new room for a pool its baseline
|
|
1151
|
-
// already holds. A trace: it says the run gained room, not where the run is.
|
|
1152
|
-
LANE_LIMIT: "lane-limit"
|
|
1153
|
-
};
|
|
1154
|
-
var EVENT_KINDS = Object.values(EVENT_KIND);
|
|
1155
|
-
var TRACE_KINDS = /* @__PURE__ */ new Set([
|
|
1156
|
-
EVENT_KIND.SHIP_STAGE,
|
|
1157
|
-
EVENT_KIND.HEARTBEAT,
|
|
1158
|
-
EVENT_KIND.FILED,
|
|
1159
|
-
EVENT_KIND.NOTE,
|
|
1160
|
-
EVENT_KIND.LANE_PHASE,
|
|
1161
|
-
EVENT_KIND.ADD,
|
|
1162
|
-
EVENT_KIND.LANE_LIMIT
|
|
1163
|
-
]);
|
|
1164
|
-
var DISPOSABLE_KINDS = /* @__PURE__ */ new Set([EVENT_KIND.SHIP_STAGE, EVENT_KIND.HEARTBEAT]);
|
|
1165
|
-
var event_schema = z4.object({
|
|
1166
|
-
pos: z4.number(),
|
|
1167
|
-
at: z4.string(),
|
|
1168
|
-
kind: z4.string(),
|
|
1169
|
-
text: z4.string()
|
|
1170
|
-
});
|
|
1171
|
-
function is_event_kind(value) {
|
|
1172
|
-
return EVENT_KINDS.includes(value);
|
|
1173
|
-
}
|
|
1174
|
-
function target_of(repository) {
|
|
1175
|
-
return stamp_file.stamp_path(EVENT_PREFIX, repository, EVENT_SUFFIX);
|
|
1176
|
-
}
|
|
1177
|
-
function is_present(event) {
|
|
1178
|
-
return event !== void 0;
|
|
1179
|
-
}
|
|
1180
|
-
function parse_line(line) {
|
|
1181
|
-
return event_schema.safeParse(json_value.parse_or_undefined(line)).data;
|
|
1182
|
-
}
|
|
1183
|
-
function read_lines(target) {
|
|
1184
|
-
const raw = stamp_file.read_stamp_text(target);
|
|
1185
|
-
if (raw === void 0) return [];
|
|
1186
|
-
return raw.split(LINE_SEPARATOR).map((line) => line.trim()).filter((line) => line.length > 0).map((line) => parse_line(line)).filter(is_present);
|
|
1187
|
-
}
|
|
1188
|
-
function read_events(target) {
|
|
1189
|
-
return read_lines(target).filter((event) => is_event_kind(event.kind));
|
|
1190
|
-
}
|
|
1191
|
-
function last_position(events) {
|
|
1192
|
-
return events[events.length - POSITION_INCREMENT]?.pos ?? FIRST_POSITION;
|
|
1193
|
-
}
|
|
1194
|
-
function issue_of(event) {
|
|
1195
|
-
return event.text.split(WORD_SEPARATOR)[FIRST_POSITION] ?? "";
|
|
1196
|
-
}
|
|
1197
|
-
function newest_stages(events) {
|
|
1198
|
-
const newest = /* @__PURE__ */ new Map();
|
|
1199
|
-
for (const event of events) {
|
|
1200
|
-
if (event.kind === EVENT_KIND.SHIP_STAGE) newest.set(issue_of(event), event);
|
|
1201
|
-
}
|
|
1202
|
-
return new Set(newest.values());
|
|
1203
|
-
}
|
|
1204
|
-
function is_stage_start(event) {
|
|
1205
|
-
if (event.kind !== EVENT_KIND.SHIP_STAGE) return false;
|
|
1206
|
-
return event.text.split(WORD_SEPARATOR)[STAGE_PHASE_INDEX] === run_ship_stage.PHASE.START;
|
|
1207
|
-
}
|
|
1208
|
-
function droppable(events) {
|
|
1209
|
-
const kept = newest_stages(events);
|
|
1210
|
-
const disposable = events.filter((event) => DISPOSABLE_KINDS.has(event.kind) && !kept.has(event));
|
|
1211
|
-
return [
|
|
1212
|
-
...disposable.filter((event) => !is_stage_start(event)),
|
|
1213
|
-
...disposable.filter((event) => is_stage_start(event))
|
|
1214
|
-
];
|
|
1215
|
-
}
|
|
1216
|
-
function bounded(events) {
|
|
1217
|
-
const excess = events.length - EVENT_CAP;
|
|
1218
|
-
if (excess <= 0) return events;
|
|
1219
|
-
const dropped = new Set(droppable(events).slice(0, excess));
|
|
1220
|
-
return events.filter((event) => !dropped.has(event)).slice(-EVENT_CAP);
|
|
1221
|
-
}
|
|
1222
|
-
function serialize(events) {
|
|
1223
|
-
return `${events.map((event) => JSON.stringify(event)).join(LINE_SEPARATOR)}${LINE_SEPARATOR}`;
|
|
1224
|
-
}
|
|
1225
|
-
function append_held(target, event) {
|
|
1226
|
-
const position = last_position(read_lines(target)) + POSITION_INCREMENT;
|
|
1227
|
-
const events = bounded([...read_events(target), { pos: position, ...event }]);
|
|
1228
|
-
stamp_file.replace_text_stamp(target, serialize(events));
|
|
1229
|
-
return position;
|
|
1230
|
-
}
|
|
1231
|
-
function append(target, kind, text2, at) {
|
|
1232
|
-
if (!is_event_kind(kind)) return { appended: false, position: FIRST_POSITION };
|
|
1233
|
-
const lock = `${target}${LOCK_SUFFIX}`;
|
|
1234
|
-
const position = repository_lock.with_lock_sync(
|
|
1235
|
-
() => append_held(target, { at, kind, text: text2 }),
|
|
1236
|
-
lock,
|
|
1237
|
-
LOCK_WAIT_MS
|
|
1238
|
-
);
|
|
1239
|
-
if (position === void 0) {
|
|
1240
|
-
const message = `run event stream: gave up waiting for the lock at ${lock}`;
|
|
1241
|
-
process.stderr.write(`${message}
|
|
1242
|
-
`);
|
|
1243
|
-
throw new Error(message);
|
|
1244
|
-
}
|
|
1245
|
-
return { appended: true, position };
|
|
1246
|
-
}
|
|
1247
|
-
function read_from(target, position) {
|
|
1248
|
-
const events = read_events(target);
|
|
1249
|
-
return {
|
|
1250
|
-
events: events.filter((event) => event.pos > position),
|
|
1251
|
-
next_position: last_position(events)
|
|
1252
|
-
};
|
|
1253
|
-
}
|
|
1254
|
-
function read_last(target) {
|
|
1255
|
-
return read_events(target).findLast((event) => !TRACE_KINDS.has(event.kind));
|
|
1256
|
-
}
|
|
1257
|
-
function has_since(events, kind, reset_kind) {
|
|
1258
|
-
const reset_at = events.findLastIndex((event) => event.kind === reset_kind);
|
|
1259
|
-
return events.slice(reset_at + POSITION_INCREMENT).some((event) => event.kind === kind);
|
|
1260
|
-
}
|
|
1261
|
-
var FIELD_SEPARATOR = " \xB7 ";
|
|
1262
|
-
function format_event(event) {
|
|
1263
|
-
return [event.at, event.kind, event.text].join(FIELD_SEPARATOR);
|
|
1264
|
-
}
|
|
1265
|
-
var run_event_stream = {
|
|
1266
|
-
EVENT_CAP,
|
|
1267
|
-
EVENT_KIND,
|
|
1268
|
-
EVENT_KINDS,
|
|
1269
|
-
TRACE_KINDS,
|
|
1270
|
-
append,
|
|
1271
|
-
format_event,
|
|
1272
|
-
has_since,
|
|
1273
|
-
is_stage_start,
|
|
1274
|
-
read_events,
|
|
1275
|
-
read_from,
|
|
1276
|
-
read_last,
|
|
1277
|
-
target_of
|
|
1278
|
-
};
|
|
1279
|
-
|
|
1280
|
-
// scripts/run/event/run-event-scope.ts
|
|
1281
|
-
var SINCE_SCOPE = "since";
|
|
1282
|
-
var UNKNOWN_SCOPE = "unknown";
|
|
1283
|
-
var UNKNOWN_EVENT_SCOPE = { kind: UNKNOWN_SCOPE };
|
|
1284
|
-
function moment_of(at) {
|
|
1285
|
-
const parsed = Date.parse(at);
|
|
1286
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
1287
|
-
}
|
|
1288
|
-
function is_within(event, floor) {
|
|
1289
|
-
const at = moment_of(event.at);
|
|
1290
|
-
return at !== void 0 && at >= floor;
|
|
1291
|
-
}
|
|
1292
|
-
function scoped_events(events, scope) {
|
|
1293
|
-
if (scope.kind === UNKNOWN_SCOPE) return void 0;
|
|
1294
|
-
const floor = moment_of(scope.started_at);
|
|
1295
|
-
if (floor === void 0) return void 0;
|
|
1296
|
-
return events.filter((event) => is_within(event, floor));
|
|
1297
|
-
}
|
|
1298
|
-
function scope_of(read) {
|
|
1299
|
-
if (read.kind !== "carried") return UNKNOWN_EVENT_SCOPE;
|
|
1300
|
-
return { kind: SINCE_SCOPE, started_at: read.carry.started_at };
|
|
1301
|
-
}
|
|
1302
|
-
function last_scoped_event(events, scope) {
|
|
1303
|
-
return scoped_events(events, scope)?.findLast(
|
|
1304
|
-
(event) => !run_event_stream.TRACE_KINDS.has(event.kind)
|
|
1305
|
-
);
|
|
1306
|
-
}
|
|
1307
|
-
var SHIP_POSITION_KINDS = /* @__PURE__ */ new Set([
|
|
1308
|
-
run_event_stream.EVENT_KIND.SHIP_LAUNCH,
|
|
1309
|
-
run_event_stream.EVENT_KIND.SHIP_STOP
|
|
1310
|
-
]);
|
|
1311
|
-
var KIND = run_event_stream.EVENT_KIND;
|
|
1312
|
-
var BATCH_RECORD_KINDS = /* @__PURE__ */ new Set([
|
|
1313
|
-
KIND.CHILD_LAUNCH,
|
|
1314
|
-
KIND.PARK,
|
|
1315
|
-
KIND.SPLIT,
|
|
1316
|
-
KIND.RETROSPECTIVE,
|
|
1317
|
-
KIND.STRANDED
|
|
1318
|
-
]);
|
|
1319
|
-
var ISSUE_REFERENCE = /#(\d+)/u;
|
|
1320
|
-
function is_foreign_ship_event(event, issue2) {
|
|
1321
|
-
return SHIP_POSITION_KINDS.has(event.kind) && !event.text.startsWith(`${issue_cite.plain(issue2)} `);
|
|
1322
|
-
}
|
|
1323
|
-
function is_own_ship_event(event, issue2) {
|
|
1324
|
-
return SHIP_POSITION_KINDS.has(event.kind) && !is_foreign_ship_event(event, issue2);
|
|
1325
|
-
}
|
|
1326
|
-
function issue_named(event) {
|
|
1327
|
-
return ISSUE_REFERENCE.exec(event.text)?.[1];
|
|
1328
|
-
}
|
|
1329
|
-
function names_issue(event, issue2) {
|
|
1330
|
-
return issue_named(event) === issue2;
|
|
1331
|
-
}
|
|
1332
|
-
function is_lane_position(event, issue2) {
|
|
1333
|
-
return !BATCH_RECORD_KINDS.has(event.kind) && names_issue(event, issue2);
|
|
1334
|
-
}
|
|
1335
|
-
function since_own_launch(events, issue2) {
|
|
1336
|
-
const launch2 = events.findLastIndex(
|
|
1337
|
-
(event) => event.kind === KIND.CHILD_LAUNCH && names_issue(event, issue2)
|
|
1338
|
-
);
|
|
1339
|
-
return events.slice(launch2 + 1);
|
|
1340
|
-
}
|
|
1341
|
-
function is_foreign_event(event, issue2, is_lane_child) {
|
|
1342
|
-
if (is_lane_child) return !is_lane_position(event, issue2);
|
|
1343
|
-
return is_foreign_ship_event(event, issue2);
|
|
1344
|
-
}
|
|
1345
|
-
function last_issue_event(events, scope, issue2, is_lane_child) {
|
|
1346
|
-
const attempt = is_lane_child ? since_own_launch(events, issue2) : events;
|
|
1347
|
-
const own = attempt.filter((event) => !is_foreign_event(event, issue2, is_lane_child));
|
|
1348
|
-
if (scope.kind === SINCE_SCOPE) return last_scoped_event(own, scope);
|
|
1349
|
-
return own.findLast((event) => is_own_ship_event(event, issue2));
|
|
1350
|
-
}
|
|
1351
|
-
var LAUNCH_OR_SETTLE_KINDS = /* @__PURE__ */ new Set([
|
|
1352
|
-
KIND.CHILD_LAUNCH,
|
|
1353
|
-
KIND.MERGE,
|
|
1354
|
-
KIND.PARK,
|
|
1355
|
-
KIND.SPLIT
|
|
1356
|
-
]);
|
|
1357
|
-
function is_merge_owed(events, scope, issue2) {
|
|
1358
|
-
const newest = (scoped_events(events, scope) ?? []).findLast(
|
|
1359
|
-
(event) => LAUNCH_OR_SETTLE_KINDS.has(event.kind) && names_issue(event, issue2)
|
|
1360
|
-
);
|
|
1361
|
-
return newest?.kind === KIND.CHILD_LAUNCH;
|
|
1362
|
-
}
|
|
1363
|
-
var run_event_scope = {
|
|
1364
|
-
UNKNOWN_EVENT_SCOPE,
|
|
1365
|
-
is_merge_owed,
|
|
1366
|
-
issue_named,
|
|
1367
|
-
last_issue_event,
|
|
1368
|
-
last_scoped_event,
|
|
1369
|
-
moment_of,
|
|
1370
|
-
scope_of,
|
|
1371
|
-
scoped_events,
|
|
1372
|
-
since_own_launch
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
// scripts/run/event/run-event-stream-emit.ts
|
|
1376
|
-
function now_iso() {
|
|
1377
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1378
|
-
}
|
|
1379
|
-
async function stream_target() {
|
|
1380
|
-
const repository = await run_carry.repository_directory();
|
|
1381
|
-
return repository === void 0 ? void 0 : run_event_stream.target_of(repository);
|
|
1382
|
-
}
|
|
1383
|
-
async function emit(kind, text2) {
|
|
1384
|
-
try {
|
|
1385
|
-
const target = await stream_target();
|
|
1386
|
-
if (target === void 0) return;
|
|
1387
|
-
run_event_stream.append(target, kind, text2, now_iso());
|
|
1388
|
-
} catch {
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
async function emit_once(kind, text2) {
|
|
1392
|
-
try {
|
|
1393
|
-
const target = await stream_target();
|
|
1394
|
-
if (target === void 0 || run_event_stream.read_last(target)?.kind === kind) return false;
|
|
1395
|
-
return run_event_stream.append(target, kind, text2, now_iso()).appended;
|
|
1396
|
-
} catch (error) {
|
|
1397
|
-
error_text.trace_swallowed("run_event_stream_emit.emit_once", error);
|
|
1398
|
-
return false;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
function invocation_events(repository, target) {
|
|
1402
|
-
const events = run_event_stream.read_events(target);
|
|
1403
|
-
const scope = run_event_scope.scope_of(run_carry.read_carry(run_carry.carry_path(repository)));
|
|
1404
|
-
return run_event_scope.scoped_events(events, scope) ?? events;
|
|
1405
|
-
}
|
|
1406
|
-
async function emit_once_since(kind, text2, reset_kind) {
|
|
1407
|
-
try {
|
|
1408
|
-
const repository = await run_carry.repository_directory();
|
|
1409
|
-
if (repository === void 0) return false;
|
|
1410
|
-
const target = run_event_stream.target_of(repository);
|
|
1411
|
-
if (run_event_stream.has_since(invocation_events(repository, target), kind, reset_kind)) {
|
|
1412
|
-
return false;
|
|
1413
|
-
}
|
|
1414
|
-
return run_event_stream.append(target, kind, text2, now_iso()).appended;
|
|
1415
|
-
} catch (error) {
|
|
1416
|
-
error_text.trace_swallowed("run_event_stream_emit.emit_once_since", error);
|
|
1417
|
-
return false;
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
async function emit_heartbeat(line) {
|
|
1421
|
-
await emit(run_event_stream.EVENT_KIND.HEARTBEAT, line);
|
|
1422
|
-
}
|
|
1423
|
-
async function current_events() {
|
|
1424
|
-
try {
|
|
1425
|
-
const repository = await run_carry.repository_directory();
|
|
1426
|
-
if (repository === void 0) return [];
|
|
1427
|
-
const read = run_carry.read_carry(run_carry.carry_path(repository));
|
|
1428
|
-
const scope = run_event_scope.scope_of(read);
|
|
1429
|
-
const events = run_event_stream.read_events(run_event_stream.target_of(repository));
|
|
1430
|
-
return run_event_scope.scoped_events(events, scope) ?? [];
|
|
1431
|
-
} catch {
|
|
1432
|
-
return [];
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
async function invocation_or_all_events() {
|
|
1436
|
-
try {
|
|
1437
|
-
const repository = await run_carry.repository_directory();
|
|
1438
|
-
return repository === void 0 ? [] : invocation_events(repository, run_event_stream.target_of(repository));
|
|
1439
|
-
} catch {
|
|
1440
|
-
return [];
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
async function all_events() {
|
|
1444
|
-
try {
|
|
1445
|
-
const target = await stream_target();
|
|
1446
|
-
return target === void 0 ? [] : run_event_stream.read_events(target);
|
|
1447
|
-
} catch {
|
|
1448
|
-
return [];
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
var run_event_stream_emit = {
|
|
1452
|
-
all_events,
|
|
1453
|
-
current_events,
|
|
1454
|
-
emit,
|
|
1455
|
-
emit_heartbeat,
|
|
1456
|
-
emit_once,
|
|
1457
|
-
emit_once_since,
|
|
1458
|
-
invocation_or_all_events,
|
|
1459
|
-
stream_target
|
|
1460
|
-
};
|
|
1461
|
-
|
|
1462
|
-
// scripts/run/ship/run-ship-detach.ts
|
|
1463
|
-
import { z as z5 } from "zod";
|
|
1464
1065
|
var LOG_PREFIX = "josh-ship-log-";
|
|
1465
1066
|
var PID_PREFIX = "josh-ship-pid-";
|
|
1466
1067
|
var BODY_PREFIX = "josh-ship-notify-";
|
|
@@ -1481,14 +1082,14 @@ var RESULT_PREFIX = "josh-ship-result-";
|
|
|
1481
1082
|
var RECORD_POLL_MS = 25;
|
|
1482
1083
|
var RECORD_WAIT_ATTEMPTS = 200;
|
|
1483
1084
|
var CLAIM_WINDOW_MS = 12e4;
|
|
1484
|
-
var ship_record_schema =
|
|
1485
|
-
pid:
|
|
1486
|
-
process_start:
|
|
1487
|
-
launched_at:
|
|
1488
|
-
launcher_pid:
|
|
1489
|
-
launcher_start:
|
|
1490
|
-
launch_id:
|
|
1491
|
-
result:
|
|
1085
|
+
var ship_record_schema = z4.object({
|
|
1086
|
+
pid: z4.number().int().positive().optional(),
|
|
1087
|
+
process_start: z4.string().optional(),
|
|
1088
|
+
launched_at: z4.number().optional(),
|
|
1089
|
+
launcher_pid: z4.number().int().positive().optional(),
|
|
1090
|
+
launcher_start: z4.string().optional(),
|
|
1091
|
+
launch_id: z4.string(),
|
|
1092
|
+
result: z4.enum(["success", "failed"]).optional()
|
|
1492
1093
|
});
|
|
1493
1094
|
var LAUNCH_MARK = " \xB7 started by process ";
|
|
1494
1095
|
var HEADER_START = "\n";
|
|
@@ -1701,6 +1302,7 @@ var lane_handoff = { is_handed_off, is_ship_running };
|
|
|
1701
1302
|
|
|
1702
1303
|
// scripts/issue/issue-labels.ts
|
|
1703
1304
|
var EPIC_LABEL = "epic";
|
|
1305
|
+
var BUG_LABEL = "bug";
|
|
1704
1306
|
var ENHANCEMENT_LABEL = "enhancement";
|
|
1705
1307
|
var BREAKING_CHANGE_LABEL = "breaking-change";
|
|
1706
1308
|
var IN_PROGRESS_LABEL = "in-progress";
|
|
@@ -1709,9 +1311,11 @@ var NEEDS_DECISION_LABEL = "needs-decision";
|
|
|
1709
1311
|
var RUN_SOLO_LABEL = "run:solo";
|
|
1710
1312
|
var RUN_LANE_LABEL = "run:lane";
|
|
1711
1313
|
var PRIORITY_HIGH_LABEL = "priority:high";
|
|
1314
|
+
var AUTO_OK_LABEL = "auto-ok";
|
|
1712
1315
|
var NEEDS_HUMAN_REVIEW_LABEL = "needs-human-review";
|
|
1713
1316
|
var ALREADY_DONE_LABEL = "already-done";
|
|
1714
1317
|
var RELEASE_LABEL = "release";
|
|
1318
|
+
var REVIEW_ROUND2_SKIPPED_LABEL = "review-round2-skipped";
|
|
1715
1319
|
var INTERRUPT_ROUTE_LABEL = "route:interrupt";
|
|
1716
1320
|
var REVIEW_CAP_ROUTE_LABEL = "route:review-cap";
|
|
1717
1321
|
var SPLIT_ROUTE_LABEL = "route:split";
|
|
@@ -1790,6 +1394,32 @@ var WORKFLOW_LABELS = [
|
|
|
1790
1394
|
color: "fef2c0",
|
|
1791
1395
|
description: "Tracks the next release; its blockers are the merged work it publishes"
|
|
1792
1396
|
},
|
|
1397
|
+
{
|
|
1398
|
+
name: AUTO_OK_LABEL,
|
|
1399
|
+
color: "0e8a16",
|
|
1400
|
+
description: "Opted in to unattended execution outside an epic"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
name: NEEDS_DECISION_LABEL,
|
|
1404
|
+
color: "d93f0b",
|
|
1405
|
+
description: "Parked: needs a decision before it can run"
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
name: NEEDS_HUMAN_REVIEW_LABEL,
|
|
1409
|
+
color: "d93f0b",
|
|
1410
|
+
description: "Implement and verify, but stop before committing so a person can look"
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
name: ALREADY_DONE_LABEL,
|
|
1414
|
+
color: "6f42c1",
|
|
1415
|
+
description: "Verified already merged \u2014 a person closes it"
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
name: REVIEW_ROUND2_SKIPPED_LABEL,
|
|
1419
|
+
color: "c5def5",
|
|
1420
|
+
description: "Review round 2 was skipped under the condition in prompts/review.md"
|
|
1421
|
+
},
|
|
1422
|
+
{ name: BUG_LABEL, color: "d73a4a", description: "Something isn't working" },
|
|
1793
1423
|
...FILING_ROUTE_LABELS,
|
|
1794
1424
|
...DEPTH_LABELS
|
|
1795
1425
|
];
|
|
@@ -2021,8 +1651,8 @@ var parse_json = {
|
|
|
2021
1651
|
};
|
|
2022
1652
|
|
|
2023
1653
|
// scripts/gh/git-gh-failure.ts
|
|
2024
|
-
import { z as
|
|
2025
|
-
var error_document_schema =
|
|
1654
|
+
import { z as z5 } from "zod";
|
|
1655
|
+
var error_document_schema = z5.object({ status: z5.union([z5.string(), z5.number()]).optional() }).catch({});
|
|
2026
1656
|
var GH_FAILURE_FIELD = "gh_failure";
|
|
2027
1657
|
function has_gh_failure(error) {
|
|
2028
1658
|
return error instanceof Error && Object.hasOwn(error, GH_FAILURE_FIELD);
|
|
@@ -2225,7 +1855,7 @@ var git_gh_helpers = {
|
|
|
2225
1855
|
};
|
|
2226
1856
|
|
|
2227
1857
|
// scripts/gh/git-gh-issue-rest.ts
|
|
2228
|
-
import { z as
|
|
1858
|
+
import { z as z6 } from "zod";
|
|
2229
1859
|
|
|
2230
1860
|
// scripts/gh/git-gh-rest-state.ts
|
|
2231
1861
|
var MERGED_STATE = "MERGED";
|
|
@@ -2234,11 +1864,11 @@ function to_gh_state(state) {
|
|
|
2234
1864
|
}
|
|
2235
1865
|
|
|
2236
1866
|
// scripts/gh/git-gh-issue-rest.ts
|
|
2237
|
-
var rest_issue_schema =
|
|
2238
|
-
number:
|
|
2239
|
-
issue_dependencies_summary:
|
|
1867
|
+
var rest_issue_schema = z6.looseObject({
|
|
1868
|
+
number: z6.number(),
|
|
1869
|
+
issue_dependencies_summary: z6.looseObject({ total_blocked_by: z6.number().optional() }).nullish(),
|
|
2240
1870
|
// Present only on a pull request, which this endpoint serves as readily as an issue.
|
|
2241
|
-
pull_request:
|
|
1871
|
+
pull_request: z6.looseObject({ merged_at: z6.string().nullish() }).nullish()
|
|
2242
1872
|
});
|
|
2243
1873
|
var REPOSITORY_URL = /\/repos\/([\w.-]+\/[\w.-]+)$/u;
|
|
2244
1874
|
var REPOSITORY_URL_GROUP = 1;
|
|
@@ -2246,7 +1876,7 @@ var BLOCKED_BY_FIELD = "blockedBy";
|
|
|
2246
1876
|
var BLOCKED_BY_COUNT_FIELD = "blocked_by_count";
|
|
2247
1877
|
var STATE_FIELD = "state";
|
|
2248
1878
|
var BODY_FIELD = "body";
|
|
2249
|
-
var
|
|
1879
|
+
var FIELD_SEPARATOR = ",";
|
|
2250
1880
|
var EMPTY_BODY = "";
|
|
2251
1881
|
var REST_FIELD_NAMES = /* @__PURE__ */ new Map([
|
|
2252
1882
|
["url", "html_url"],
|
|
@@ -2260,7 +1890,7 @@ function rest_field_name(field) {
|
|
|
2260
1890
|
return REST_FIELD_NAMES.get(field) ?? field;
|
|
2261
1891
|
}
|
|
2262
1892
|
function split_fields(fields) {
|
|
2263
|
-
return fields.split(
|
|
1893
|
+
return fields.split(FIELD_SEPARATOR).map((field) => field.trim()).filter((field) => field.length > 0);
|
|
2264
1894
|
}
|
|
2265
1895
|
function to_issue_state(rest, value) {
|
|
2266
1896
|
if (typeof rest.pull_request?.merged_at === "string") return MERGED_STATE;
|
|
@@ -2451,10 +2081,10 @@ async function issue_get_plan_fields_classified(issue_number) {
|
|
|
2451
2081
|
async function issue_get_labels_and_body(issue_number) {
|
|
2452
2082
|
return await issue_view_json(issue_number, "number,state,labels,body");
|
|
2453
2083
|
}
|
|
2454
|
-
async function issue_list_comments(issue_number) {
|
|
2084
|
+
async function issue_list_comments(issue_number, timeout_ms) {
|
|
2455
2085
|
const path = `${git_gh_api_path.issue_comments_api_path(issue_number)}${git_gh_api_path.FULL_PAGE_QUERY}`;
|
|
2456
2086
|
try {
|
|
2457
|
-
return await git_gh_exec.exec_gh_api({ path, should_paginate: true });
|
|
2087
|
+
return await git_gh_exec.exec_gh_api({ path, should_paginate: true, timeout_ms });
|
|
2458
2088
|
} catch {
|
|
2459
2089
|
return void 0;
|
|
2460
2090
|
}
|
|
@@ -2581,6 +2211,89 @@ var git_gh_issue_list = {
|
|
|
2581
2211
|
issue_list
|
|
2582
2212
|
};
|
|
2583
2213
|
|
|
2214
|
+
// scripts/issue/issue-watch-diff.ts
|
|
2215
|
+
import { z as z7 } from "zod";
|
|
2216
|
+
var RUN_MARKER = "<!-- josh:run -->";
|
|
2217
|
+
var BOT_TYPE = "Bot";
|
|
2218
|
+
var BOT_SUFFIX = "[bot]";
|
|
2219
|
+
var NO_COMMENT_ID = 0;
|
|
2220
|
+
var UNKNOWN_AUTHOR = "(unknown)";
|
|
2221
|
+
var UNKNOWN_TIME = "(undated)";
|
|
2222
|
+
var BODY_HEADING = "Body edited:";
|
|
2223
|
+
var REMOVED_PREFIX = "- ";
|
|
2224
|
+
var ADDED_PREFIX = "+ ";
|
|
2225
|
+
var COMMENT_HEADING = "New comment by ";
|
|
2226
|
+
var AT = " at ";
|
|
2227
|
+
var SECTION_SEPARATOR = "\n\n";
|
|
2228
|
+
var LINE_SEPARATOR = "\n";
|
|
2229
|
+
var CRLF = "\r\n";
|
|
2230
|
+
var comment_schema = z7.looseObject({
|
|
2231
|
+
id: z7.number(),
|
|
2232
|
+
user: z7.looseObject({ login: z7.string(), type: z7.string().optional() }).nullish(),
|
|
2233
|
+
created_at: z7.string().optional(),
|
|
2234
|
+
body: z7.string().nullish()
|
|
2235
|
+
});
|
|
2236
|
+
function is_bot(user) {
|
|
2237
|
+
return user?.type === BOT_TYPE || (user?.login.endsWith(BOT_SUFFIX) ?? false);
|
|
2238
|
+
}
|
|
2239
|
+
function is_automated(user, body) {
|
|
2240
|
+
return is_bot(user) || body.includes(RUN_MARKER);
|
|
2241
|
+
}
|
|
2242
|
+
function to_comment(raw) {
|
|
2243
|
+
const body = raw.body ?? "";
|
|
2244
|
+
const author = raw.user?.login ?? UNKNOWN_AUTHOR;
|
|
2245
|
+
const created_at = raw.created_at ?? UNKNOWN_TIME;
|
|
2246
|
+
return { id: raw.id, author, is_automated: is_automated(raw.user, body), created_at, body };
|
|
2247
|
+
}
|
|
2248
|
+
function parse_comments(json) {
|
|
2249
|
+
if (json === void 0) return void 0;
|
|
2250
|
+
const listing = read_json_listing(json, comment_schema);
|
|
2251
|
+
return listing.kind === "read" ? listing.rows.map((row) => to_comment(row)) : void 0;
|
|
2252
|
+
}
|
|
2253
|
+
function last_comment_id(comments) {
|
|
2254
|
+
return Math.max(NO_COMMENT_ID, ...comments.map((comment) => comment.id));
|
|
2255
|
+
}
|
|
2256
|
+
function baseline_of(snapshot) {
|
|
2257
|
+
return { body: snapshot.body, last_comment_id: last_comment_id(snapshot.comments) };
|
|
2258
|
+
}
|
|
2259
|
+
function lines_missing_from(source, other) {
|
|
2260
|
+
const present = new Set(other.split(LINE_SEPARATOR));
|
|
2261
|
+
return source.split(LINE_SEPARATOR).filter((line) => line.trim() !== "" && !present.has(line));
|
|
2262
|
+
}
|
|
2263
|
+
function to_lf(body) {
|
|
2264
|
+
return body.split(CRLF).join(LINE_SEPARATOR);
|
|
2265
|
+
}
|
|
2266
|
+
function body_section(previous_raw, current_raw) {
|
|
2267
|
+
const previous = to_lf(previous_raw);
|
|
2268
|
+
const current = to_lf(current_raw);
|
|
2269
|
+
if (previous === current) return void 0;
|
|
2270
|
+
const removed = lines_missing_from(previous, current).map((line) => `${REMOVED_PREFIX}${line}`);
|
|
2271
|
+
const added = lines_missing_from(current, previous).map((line) => `${ADDED_PREFIX}${line}`);
|
|
2272
|
+
return [BODY_HEADING, ...removed, ...added].join(LINE_SEPARATOR);
|
|
2273
|
+
}
|
|
2274
|
+
function comment_section(comment) {
|
|
2275
|
+
return `${COMMENT_HEADING}${comment.author}${AT}${comment.created_at}${LINE_SEPARATOR}${comment.body}`;
|
|
2276
|
+
}
|
|
2277
|
+
function new_person_comments(baseline, snapshot) {
|
|
2278
|
+
return snapshot.comments.filter(
|
|
2279
|
+
(comment) => comment.id > baseline.last_comment_id && !comment.is_automated
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
function unread_diff(baseline, snapshot) {
|
|
2283
|
+
const body = body_section(baseline.body, snapshot.body);
|
|
2284
|
+
const comments = new_person_comments(baseline, snapshot).map(
|
|
2285
|
+
(comment) => comment_section(comment)
|
|
2286
|
+
);
|
|
2287
|
+
const sections = [...body === void 0 ? [] : [body], ...comments];
|
|
2288
|
+
return sections.length === 0 ? void 0 : sections.join(SECTION_SEPARATOR);
|
|
2289
|
+
}
|
|
2290
|
+
var issue_watch_diff = {
|
|
2291
|
+
RUN_MARKER,
|
|
2292
|
+
baseline_of,
|
|
2293
|
+
parse_comments,
|
|
2294
|
+
unread_diff
|
|
2295
|
+
};
|
|
2296
|
+
|
|
2584
2297
|
// scripts/gh/git-gh-issue-write.ts
|
|
2585
2298
|
var PATCH_METHOD = "PATCH";
|
|
2586
2299
|
var DELETE_METHOD = "DELETE";
|
|
@@ -2613,7 +2326,9 @@ async function issue_edit_body(issue_number, body) {
|
|
|
2613
2326
|
async function issue_comment(issue_number, body) {
|
|
2614
2327
|
return await git_gh_exec.exec_gh_api({
|
|
2615
2328
|
path: `${git_gh_api_path.issue_api_path(issue_number)}${COMMENTS_SEGMENT}`,
|
|
2616
|
-
body: JSON.stringify({ body }
|
|
2329
|
+
body: JSON.stringify({ body: `${body}
|
|
2330
|
+
|
|
2331
|
+
${issue_watch_diff.RUN_MARKER}` }),
|
|
2617
2332
|
jq_filter: HTML_URL_FILTER
|
|
2618
2333
|
});
|
|
2619
2334
|
}
|
|
@@ -2754,7 +2469,7 @@ var git_gh_issue_write = {
|
|
|
2754
2469
|
|
|
2755
2470
|
// scripts/gh/git-gh-issue.ts
|
|
2756
2471
|
var NUMBER_AND_BODY_FIELDS = "number,body";
|
|
2757
|
-
var BACKLOG_SCAN_FIELDS = `number,title,body,${BLOCKED_BY_COUNT_FIELD}`;
|
|
2472
|
+
var BACKLOG_SCAN_FIELDS = `number,title,body,labels,${BLOCKED_BY_COUNT_FIELD}`;
|
|
2758
2473
|
var NUMBER_TITLE_AND_LABELS_FIELDS = "number,title,labels";
|
|
2759
2474
|
var SUMMARY_FIELDS = "number,title,labels,createdAt";
|
|
2760
2475
|
var PICKUP_FIELDS = `${SUMMARY_FIELDS},blockedBy,body`;
|
|
@@ -3606,6 +3321,7 @@ async function wait_for_pr_success(options) {
|
|
|
3606
3321
|
let carried = { next_stable_count: 0, next_failure_count: 0 };
|
|
3607
3322
|
for (let attempt = 0; attempt < options.max_attempts; attempt += 1) {
|
|
3608
3323
|
console.info(`Checking PR status\u2026 (${String(attempt + 1)}/${String(options.max_attempts)})`);
|
|
3324
|
+
await options.before_poll?.();
|
|
3609
3325
|
carried = await attempt_pr_success_poll({
|
|
3610
3326
|
options,
|
|
3611
3327
|
stable_count: carried.next_stable_count,
|
|
@@ -3623,6 +3339,14 @@ async function default_fetch_pr_state(branch_name, should_read_review_decision =
|
|
|
3623
3339
|
const decision = await git_gh_pr_snapshot.pr_get_review_decision(checks.pr_number);
|
|
3624
3340
|
return { ...snapshot, review_decision: read_string(decision) };
|
|
3625
3341
|
}
|
|
3342
|
+
function observed_fetcher(observe) {
|
|
3343
|
+
if (observe === void 0) return default_fetch_pr_state;
|
|
3344
|
+
return async function fetch_observed(branch_name, should_read_review_decision) {
|
|
3345
|
+
const snapshot = await default_fetch_pr_state(branch_name, should_read_review_decision);
|
|
3346
|
+
await observe(snapshot);
|
|
3347
|
+
return snapshot;
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3626
3350
|
|
|
3627
3351
|
// scripts/gh/git-pr-checks-watch.ts
|
|
3628
3352
|
var PR_CHECKS_WATCH_TIMEOUT_MS = 12e4;
|
|
@@ -3652,10 +3376,10 @@ var CHECKS_SETTLED_EVALUATOR = {
|
|
|
3652
3376
|
describe: describe_checks_failure,
|
|
3653
3377
|
should_read_review_decision: should_never_read_review_decision
|
|
3654
3378
|
};
|
|
3655
|
-
async function watch_until_settled(branch_name) {
|
|
3379
|
+
async function watch_until_settled(branch_name, observe) {
|
|
3656
3380
|
await wait_for_pr_success({
|
|
3657
3381
|
branch_name,
|
|
3658
|
-
fetcher:
|
|
3382
|
+
fetcher: observed_fetcher(observe),
|
|
3659
3383
|
interval_ms: CHECK_WAIT_INTERVAL_MS,
|
|
3660
3384
|
max_attempts: compute_max_attempts(
|
|
3661
3385
|
PR_CHECKS_WATCH_TIMEOUT_MS / SECONDS_TO_MS,
|
|
@@ -3669,9 +3393,9 @@ async function fail_when_no_checks(branch_name) {
|
|
|
3669
3393
|
const snapshot = await default_fetch_pr_state(branch_name, should_never_read_review_decision);
|
|
3670
3394
|
if (snapshot.rollup.length === 0) throw new Error(NO_CHECKS_MESSAGE);
|
|
3671
3395
|
}
|
|
3672
|
-
async function pr_checks_watch(branch_name) {
|
|
3396
|
+
async function pr_checks_watch(branch_name, observe) {
|
|
3673
3397
|
try {
|
|
3674
|
-
await watch_until_settled(branch_name);
|
|
3398
|
+
await watch_until_settled(branch_name, observe);
|
|
3675
3399
|
return { timed_out: false };
|
|
3676
3400
|
} catch (error) {
|
|
3677
3401
|
if (!is_pr_checks_timeout(error)) throw error;
|
|
@@ -3691,18 +3415,42 @@ var git_gh_command = {
|
|
|
3691
3415
|
...git_gh_repo
|
|
3692
3416
|
};
|
|
3693
3417
|
|
|
3418
|
+
// scripts/gh/gh-spawn.ts
|
|
3419
|
+
var NO_BUDGET = 0;
|
|
3420
|
+
function fetch_repo_name(timeout_ms) {
|
|
3421
|
+
const stdout = git_gh_exec.read_gh_api_sync({
|
|
3422
|
+
path: git_gh_api_path.repo_api_path(),
|
|
3423
|
+
jq_filter: ".full_name",
|
|
3424
|
+
cwd: PROJECT_ROOT,
|
|
3425
|
+
timeout_ms: timeout_ms ?? NO_BUDGET
|
|
3426
|
+
});
|
|
3427
|
+
const name = stdout?.trim();
|
|
3428
|
+
return name === "" ? void 0 : name;
|
|
3429
|
+
}
|
|
3430
|
+
function get_repo_name_with_owner() {
|
|
3431
|
+
return fetch_repo_name(void 0);
|
|
3432
|
+
}
|
|
3433
|
+
function get_repo_name_with_owner_within(timeout_ms) {
|
|
3434
|
+
return fetch_repo_name(timeout_ms);
|
|
3435
|
+
}
|
|
3436
|
+
var gh_spawn = { get_repo_name_with_owner, get_repo_name_with_owner_within };
|
|
3437
|
+
|
|
3694
3438
|
export {
|
|
3695
3439
|
bounded_pool,
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3440
|
+
git_gh_api_path,
|
|
3441
|
+
read_json_listing,
|
|
3442
|
+
parse_json_object_or_undefined,
|
|
3443
|
+
has_stdout_field,
|
|
3444
|
+
git_gh_exec,
|
|
3445
|
+
git_gh_issue_read,
|
|
3446
|
+
issue_watch_diff,
|
|
3447
|
+
issue_citation,
|
|
3448
|
+
session_cite,
|
|
3699
3449
|
shell_segments,
|
|
3700
3450
|
bash_triggers,
|
|
3701
3451
|
tail_commands,
|
|
3702
3452
|
filing_cap,
|
|
3703
3453
|
CONTEXT_CUT_THRESHOLD,
|
|
3704
|
-
issue_citation,
|
|
3705
|
-
session_cite,
|
|
3706
3454
|
run_hold,
|
|
3707
3455
|
run_cut_handoff,
|
|
3708
3456
|
run_cut,
|
|
@@ -3718,12 +3466,8 @@ export {
|
|
|
3718
3466
|
has_label_name,
|
|
3719
3467
|
lane_handoff,
|
|
3720
3468
|
lane_park,
|
|
3469
|
+
gh_spawn,
|
|
3721
3470
|
repo_party,
|
|
3722
|
-
git_gh_api_path,
|
|
3723
|
-
read_json_listing,
|
|
3724
|
-
parse_json_object_or_undefined,
|
|
3725
|
-
git_gh_exec,
|
|
3726
|
-
git_gh_issue_read,
|
|
3727
3471
|
git_gh_pr_read,
|
|
3728
3472
|
git_gh_command
|
|
3729
3473
|
};
|