next-issue 6.5.0 → 6.5.1

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/README.md CHANGED
@@ -290,7 +290,7 @@ jq -r 'select(.kind=="usage") | [.issue,.role,.turns,.total] | @tsv' \
290
290
  then prints new events as the run adds them, until `Ctrl-C`. In a terminal it
291
291
  starts with the last events that fit the screen; in a pipe it starts with all
292
292
  of them. It stops when the reader of the pipe closes it; on Linux it notices
293
- this only at the next event. With `--json` it prints the raw JSON lines. This also shows a run of
293
+ this only at the next event. When the worker restarts and starts a new run log, `logs` prints the rest of the old one, then a line `— new run: <file name> —`, then every event of the new one. With `--json` it prints the raw JSON lines and no such line. This also shows a run of
294
294
  the worker, whose progress goes to no terminal.
295
295
 
296
296
  Three levels of console output:
package/dist/cli.mjs CHANGED
@@ -63,7 +63,7 @@ async function logs(root, json) {
63
63
  return 1;
64
64
  }
65
65
  const tail = process.stdout.isTTY ? Math.max(1, (process.stdout.rows || 24) - 1) : undefined;
66
- return followLog(file, { json, tail }, (text) => write(process.stdout, text));
66
+ return followLog(root, file, { json, tail }, (text) => write(process.stdout, text));
67
67
  }
68
68
  async function init(root, force) {
69
69
  const exclude = await excludeFile(root);
package/dist/logs.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { writeSync } from 'node:fs';
2
2
  import { open } from 'node:fs/promises';
3
- import { join } from 'node:path';
3
+ import { basename, join } from 'node:path';
4
4
  import { StringDecoder } from 'node:string_decoder';
5
5
  import { wakeableSleep } from './durations.mjs';
6
6
  import { hasCode } from './errors.mjs';
@@ -79,16 +79,18 @@ function listenForStop(stop) {
79
79
  process.stdout.off('error', stop);
80
80
  };
81
81
  }
82
- export async function followLog(file, options, print) {
83
- const handle = await open(file, 'r');
82
+ export async function followLog(root, start, options, print) {
83
+ let file = start;
84
+ let handle = await open(file, 'r');
84
85
  const control = stopper();
85
86
  const unlisten = listenForStop(control.stop);
86
- const decoder = new StringDecoder('utf8');
87
+ let decoder = new StringDecoder('utf8');
87
88
  let position = 0;
88
89
  let rest = '';
89
90
  let first = true;
90
91
  try {
91
92
  while (!control.stopped) {
93
+ const newest = await newestRunLog(root);
92
94
  const chunk = await readChunk(handle, position, decoder);
93
95
  position += chunk.bytesRead;
94
96
  rest += chunk.text;
@@ -105,6 +107,19 @@ export async function followLog(file, options, print) {
105
107
  if (control.stopped) {
106
108
  break;
107
109
  }
110
+ if (newest !== undefined && newest > file) {
111
+ const next = await open(newest, 'r');
112
+ await handle.close();
113
+ handle = next;
114
+ file = newest;
115
+ decoder = new StringDecoder('utf8');
116
+ position = 0;
117
+ rest = '';
118
+ if (!options.json) {
119
+ await print(`— new run: ${basename(file)} —\n`);
120
+ }
121
+ continue;
122
+ }
108
123
  await control.pause();
109
124
  }
110
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.5.0",
3
+ "version": "6.5.1",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",