next-issue 16.5.3 → 16.6.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/dist/cli/switch-run.mjs +15 -1
- package/dist/worker/progress.mjs +11 -1
- package/dist/worker/run.mjs +4 -2
- package/package.json +1 -1
package/dist/cli/switch-run.mjs
CHANGED
|
@@ -110,11 +110,25 @@ export function statusText(version, progress) {
|
|
|
110
110
|
lines.push(`stopping for an upgrade to ${progress.upgrade.to}`);
|
|
111
111
|
}
|
|
112
112
|
if (progress.issues.length === 0) {
|
|
113
|
-
lines.push(
|
|
113
|
+
lines.push(idleLine(progress));
|
|
114
114
|
}
|
|
115
115
|
lines.push(...progress.issues.map(issueLine));
|
|
116
116
|
return `${lines.join('\n')}\n`;
|
|
117
117
|
}
|
|
118
|
+
function idleLine(progress) {
|
|
119
|
+
if (progress.status !== 'running') {
|
|
120
|
+
return 'no issue is running';
|
|
121
|
+
}
|
|
122
|
+
const minutes = progress.nextLook === undefined
|
|
123
|
+
? 0
|
|
124
|
+
: Math.ceil((Date.parse(progress.nextLook) - Date.now()) / 60_000);
|
|
125
|
+
if (minutes > 0) {
|
|
126
|
+
return `looking again in ${minutes} ${minutes === 1 ? 'minute' : 'minutes'}`;
|
|
127
|
+
}
|
|
128
|
+
return progress.looking === true || progress.nextLook !== undefined
|
|
129
|
+
? 'looking for an issue'
|
|
130
|
+
: 'no issue is running';
|
|
131
|
+
}
|
|
118
132
|
function issueLine({ issue, step, round }) {
|
|
119
133
|
const roundText = round === undefined ? '' : ` (round ${round})`;
|
|
120
134
|
return `#${issue} ${step?.replaceAll('-', ' ') ?? 'starting'}${roundText}`;
|
package/dist/worker/progress.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { minutesToMs } from '../shared/durations.mjs';
|
|
1
2
|
const STEPS = {
|
|
2
3
|
'implement.start': 'implementing',
|
|
3
4
|
'review.start': 'reviewing',
|
|
@@ -7,13 +8,22 @@ const STEPS = {
|
|
|
7
8
|
'ci-checks.start': 'waiting-for-checks',
|
|
8
9
|
};
|
|
9
10
|
export function startProgress(hunting = false) {
|
|
10
|
-
return { status: 'running', hunting, issues: [] };
|
|
11
|
+
return { status: 'running', hunting, issues: [], looking: true };
|
|
11
12
|
}
|
|
12
13
|
export function applyEvent(progress, record) {
|
|
13
14
|
const kind = record['kind'];
|
|
14
15
|
if (kind === 'issues.fail') {
|
|
15
16
|
return { ...progress, error: String(record['error']) };
|
|
16
17
|
}
|
|
18
|
+
if (kind === 'watch.wait' && typeof record['minutes'] === 'number') {
|
|
19
|
+
const ts = typeof record['ts'] === 'string' ? Date.parse(record['ts']) : Date.now();
|
|
20
|
+
const nextLook = new Date(ts + minutesToMs(record['minutes'])).toISOString();
|
|
21
|
+
return { ...progress, looking: false, nextLook };
|
|
22
|
+
}
|
|
23
|
+
if (kind === 'watch.wake') {
|
|
24
|
+
const { nextLook: _nextLook, ...rest } = progress;
|
|
25
|
+
return { ...rest, looking: true };
|
|
26
|
+
}
|
|
17
27
|
const issue = record['issue'];
|
|
18
28
|
if (typeof kind !== 'string' || typeof issue !== 'number') {
|
|
19
29
|
return progress;
|
package/dist/worker/run.mjs
CHANGED
|
@@ -75,10 +75,12 @@ export function watchRun(args, loop, context, controls, print) {
|
|
|
75
75
|
controls.onHunter?.(() => hunt.busy());
|
|
76
76
|
return watchIssues({
|
|
77
77
|
...loop,
|
|
78
|
-
wait: (minutes, woken) => {
|
|
78
|
+
wait: async (minutes, woken) => {
|
|
79
79
|
recorder.event('watch.wait', { minutes });
|
|
80
80
|
passStart = recorder.summary();
|
|
81
|
-
|
|
81
|
+
const slept = await interrupts.sleep(minutesToMs(minutes), woken);
|
|
82
|
+
recorder.record('watch.wake');
|
|
83
|
+
return slept;
|
|
82
84
|
},
|
|
83
85
|
passEnd: (issues) => print({ ...recorder.summary(passStart), issues }),
|
|
84
86
|
hunter: hunt,
|