next-issue 10.3.0 → 10.4.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/README.md +43 -41
- package/dist/config.mjs +17 -3
- package/dist/files.mjs +17 -3
- package/dist/run.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -178,72 +178,74 @@ npx -y next-issue@latest init
|
|
|
178
178
|
|
|
179
179
|
The command writes `.next-issue/config.json` in the main worktree and adds `.next-issue/` and `.worktrees/` to `info/exclude` in the git directory, which linked worktrees share. It removes those two lines from `.gitignore`, and deletes `.gitignore` when nothing else is left in it. It moves a `next-issue.config.json` in the root to `.next-issue/config.json`; every other command stops while that old file is there. It stops when the config file is there already; `--force` replaces it. The file holds no `setupCommand`, because the harness deduces one from the lock file of the project.
|
|
180
180
|
|
|
181
|
-
`start` and `serve` also add the two lines to `info/exclude` and remove them from `.gitignore`, so a repository needs no `init` to run. They do not
|
|
181
|
+
`start` and `serve` also add the two lines to `info/exclude` and remove them from `.gitignore`, so a repository needs no `init` to run. They do not create the config file.
|
|
182
|
+
|
|
183
|
+
The harness writes its JSON files (the config file, the state files and the run summary) with the keys sorted alphabetically at every level. Each run that `start` or `serve` begins sorts the keys of an existing config file the same way, and sorts `ignoredChecks`; it keeps the fields and values you wrote, adds no default and keeps the order of `checks`. It leaves a file that is already sorted, or that stops the run, untouched.
|
|
182
184
|
|
|
183
185
|
With no file, every field keeps its default. A field that is not in the file keeps its default. A file that cannot be read, a file that is not valid JSON, a field with a value of the wrong type and a field name that the harness does not know all stop the run, so a typo cannot pass without a word. An old `draftPullRequest` field stops the run with an error that says to remove it, because no pull request is opened.
|
|
184
186
|
|
|
185
187
|
```json
|
|
186
188
|
{
|
|
187
|
-
"
|
|
188
|
-
"issueLimit": 100,
|
|
189
|
-
"concurrency": 1,
|
|
190
|
-
"huntCap": 1,
|
|
191
|
-
"maxCiFixes": 5,
|
|
192
|
-
"maxCommitFixes": 10,
|
|
193
|
-
"maxReviewRounds": 5,
|
|
194
|
-
"checkIntervalSeconds": 15,
|
|
189
|
+
"agentTimeoutMinutes": 30,
|
|
195
190
|
"checkGraceSeconds": 60,
|
|
191
|
+
"checkIntervalSeconds": 15,
|
|
196
192
|
"checkTimeoutMinutes": 60,
|
|
197
|
-
"agentTimeoutMinutes": 30,
|
|
198
|
-
"setupTimeoutMinutes": 15,
|
|
199
|
-
"commandTimeoutMinutes": 10,
|
|
200
|
-
"logMaxChars": 20000,
|
|
201
|
-
"diffMaxChars": 60000,
|
|
202
|
-
"keepRunDays": 7,
|
|
203
193
|
"checks": [],
|
|
204
194
|
"checksTimeoutMinutes": 30,
|
|
195
|
+
"commandTimeoutMinutes": 10,
|
|
196
|
+
"concurrency": 1,
|
|
197
|
+
"diffMaxChars": 60000,
|
|
198
|
+
"huntCap": 1,
|
|
205
199
|
"ignoredChecks": [],
|
|
206
|
-
"
|
|
207
|
-
|
|
208
|
-
"reviewer": null,
|
|
209
|
-
"fixer": null
|
|
210
|
-
},
|
|
200
|
+
"issueLimit": 100,
|
|
201
|
+
"keepRunDays": 7,
|
|
211
202
|
"labels": {
|
|
212
|
-
"
|
|
203
|
+
"done": "status:done",
|
|
204
|
+
"hunt": "source:hunt",
|
|
213
205
|
"inProgress": "status:in-progress",
|
|
214
206
|
"inReview": "status:in-review",
|
|
215
|
-
"done": "status:done",
|
|
216
207
|
"needsHuman": "status:needs-human",
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
}
|
|
208
|
+
"ready": "status:todo",
|
|
209
|
+
"skip": "status:blocked"
|
|
210
|
+
},
|
|
211
|
+
"logMaxChars": 20000,
|
|
212
|
+
"maxCiFixes": 5,
|
|
213
|
+
"maxCommitFixes": 10,
|
|
214
|
+
"maxReviewRounds": 5,
|
|
215
|
+
"models": {
|
|
216
|
+
"fixer": null,
|
|
217
|
+
"implementer": null,
|
|
218
|
+
"reviewer": null
|
|
219
|
+
},
|
|
220
|
+
"remote": "origin",
|
|
221
|
+
"setupTimeoutMinutes": 15
|
|
220
222
|
}
|
|
221
223
|
```
|
|
222
224
|
|
|
223
225
|
| Field | Default | Effect |
|
|
224
226
|
| ----------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
225
|
-
| `
|
|
226
|
-
| `issueLimit` | `100` | The maximum number of open issues to read. With `labels.ready` set, only issues with the ready, in-progress or in-review label count |
|
|
227
|
-
| `concurrency` | `1` | The most issues that an agent works on at the same time; an issue waiting to land or for checks holds no slot |
|
|
228
|
-
| `huntCap` | `1` | With `--hunt`, the hunter hunts only while fewer ready issues than this wait besides the running ones |
|
|
229
|
-
| `maxCiFixes` | `5` | The budget for check fixes per issue |
|
|
230
|
-
| `maxCommitFixes` | `10` | The budget for fixes of a commit that a git hook stopped, per issue |
|
|
231
|
-
| `maxReviewRounds` | `5` | The budget for review rounds per issue |
|
|
232
|
-
| `checkIntervalSeconds` | `15` | The time between two check states, at most `2147483` |
|
|
227
|
+
| `agentTimeoutMinutes` | `30` | The limit for one agent call, opening its session included, at most `35791` |
|
|
233
228
|
| `checkGraceSeconds` | `60` | The time to wait for the first check to show, and for more checks after they all pass; the grace ends at the `checkTimeoutMinutes` limit, where checks that all pass, or no checks, still count as a pass |
|
|
229
|
+
| `checkIntervalSeconds` | `15` | The time between two check states, at most `2147483` |
|
|
234
230
|
| `checkTimeoutMinutes` | `60` | The limit for one check wait, at most `35791` |
|
|
235
|
-
| `agentTimeoutMinutes` | `30` | The limit for one agent call, opening its session included, at most `35791` |
|
|
236
|
-
| `setupTimeoutMinutes` | `15` | The limit for the setup command, at most `35791` |
|
|
237
|
-
| `commandTimeoutMinutes` | `10` | The limit for one `git` or `gh` command, at most `35791` |
|
|
238
|
-
| `logMaxChars` | `20000` | The maximum length of the failed job logs, shared between the failed GitHub Actions runs (failed external checks are listed by name and link only) |
|
|
239
|
-
| `diffMaxChars` | `60000` | The maximum length of the diff that the reviewer reads |
|
|
240
|
-
| `keepRunDays` | `7` | The number of days to keep the run files; `0` keeps them all |
|
|
241
231
|
| `checks` | `[]` | Shell commands that must pass in the worktree, in order, before an approved change is pushed; a failure goes to the fixer |
|
|
242
232
|
| `checksTimeoutMinutes` | `30` | The limit for one command in `checks`, at most `35791` |
|
|
233
|
+
| `commandTimeoutMinutes` | `10` | The limit for one `git` or `gh` command, at most `35791` |
|
|
234
|
+
| `concurrency` | `1` | The most issues that an agent works on at the same time; an issue waiting to land or for checks holds no slot |
|
|
235
|
+
| `diffMaxChars` | `60000` | The maximum length of the diff that the reviewer reads |
|
|
236
|
+
| `huntCap` | `1` | With `--hunt`, the hunter hunts only while fewer ready issues than this wait besides the running ones |
|
|
243
237
|
| `ignoredChecks` | `[]` | Names of GitHub Actions jobs, check runs and commit statuses, such as `release`, that the checks on the base branch do not wait for and whose failure does not count, unless GitHub cancels or skips another job of its run |
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
238
|
+
| `issueLimit` | `100` | The maximum number of open issues to read. With `labels.ready` set, only issues with the ready, in-progress or in-review label count |
|
|
239
|
+
| `keepRunDays` | `7` | The number of days to keep the run files; `0` keeps them all |
|
|
246
240
|
| `labels` | see above | The names of the labels that the harness reads and sets |
|
|
241
|
+
| `logMaxChars` | `20000` | The maximum length of the failed job logs, shared between the failed GitHub Actions runs (failed external checks are listed by name and link only) |
|
|
242
|
+
| `maxCiFixes` | `5` | The budget for check fixes per issue |
|
|
243
|
+
| `maxCommitFixes` | `10` | The budget for fixes of a commit that a git hook stopped, per issue |
|
|
244
|
+
| `maxReviewRounds` | `5` | The budget for review rounds per issue |
|
|
245
|
+
| `models` | `null` per role | The pi model per agent role, as `provider/model`: `implementer`, `reviewer`, `fixer` |
|
|
246
|
+
| `remote` | `origin` | The git remote for the repository and the branches |
|
|
247
|
+
| `setupCommand` | from the lock file | A shell command to run in a new worktree, before the implementer, and after each merge of the base before the `checks` |
|
|
248
|
+
| `setupTimeoutMinutes` | `15` | The limit for the setup command, at most `35791` |
|
|
247
249
|
|
|
248
250
|
The hunter adds `labels.hunt` to each issue it files, so you can tell those issues apart from your own and filter them.
|
|
249
251
|
|
package/dist/config.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { dirname, join } from 'node:path';
|
|
|
3
3
|
import { CONFIG_FILE, checkNames, commands, OLD_CONFIG_FILE, record, rejectUnknown, text, whole, } from './config-fields.mjs';
|
|
4
4
|
import { MAX_TIMER_MS } from './durations.mjs';
|
|
5
5
|
import { hasCode, message, parseJson } from './errors.mjs';
|
|
6
|
-
import { readTextIfPresent, unlessMissing, writeJson } from './files.mjs';
|
|
6
|
+
import { readTextIfPresent, replaceJson, sortKeys, unlessMissing, writeJson } from './files.mjs';
|
|
7
7
|
const DEFAULTS = {
|
|
8
8
|
remote: 'origin',
|
|
9
9
|
issueLimit: 100,
|
|
@@ -117,7 +117,7 @@ export async function rejectOldConfig(root) {
|
|
|
117
117
|
throw new Error(`${OLD_CONFIG_FILE} moved to ${CONFIG_FILE}. Run next-issue init to move it.`);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
export async function loadConfig(root) {
|
|
120
|
+
export async function loadConfig(root, options = {}) {
|
|
121
121
|
let raw;
|
|
122
122
|
try {
|
|
123
123
|
raw = await readTextIfPresent(configFile(root));
|
|
@@ -128,7 +128,21 @@ export async function loadConfig(root) {
|
|
|
128
128
|
if (raw === undefined) {
|
|
129
129
|
return defaults();
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
const file = parseJson(raw, (error) => `${CONFIG_FILE} is not valid JSON: ${message(error)}`);
|
|
132
|
+
const config = parseConfig(file);
|
|
133
|
+
if (options.sortFile === true) {
|
|
134
|
+
await sortConfigFile(root, file);
|
|
135
|
+
}
|
|
136
|
+
return config;
|
|
137
|
+
}
|
|
138
|
+
async function sortConfigFile(root, file) {
|
|
139
|
+
const sorted = sortKeys({
|
|
140
|
+
...file,
|
|
141
|
+
...(Array.isArray(file.ignoredChecks) && { ignoredChecks: [...file.ignoredChecks].sort() }),
|
|
142
|
+
});
|
|
143
|
+
if (JSON.stringify(sorted) !== JSON.stringify(file)) {
|
|
144
|
+
await replaceJson(configFile(root), sorted);
|
|
145
|
+
}
|
|
132
146
|
}
|
|
133
147
|
function parseConfig(value) {
|
|
134
148
|
const file = record(value, 'the file');
|
package/dist/files.mjs
CHANGED
|
@@ -12,13 +12,27 @@ export function listOrEmpty(dir) {
|
|
|
12
12
|
export function prettyJson(value) {
|
|
13
13
|
return `${JSON.stringify(value, null, 2)}\n`;
|
|
14
14
|
}
|
|
15
|
+
export function sortKeys(value) {
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
return value.map(sortKeys);
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === 'object' && value !== null) {
|
|
20
|
+
return Object.fromEntries(Object.entries(value)
|
|
21
|
+
.sort(([left], [right]) => (left < right ? -1 : 1))
|
|
22
|
+
.map(([key, entry]) => [key, sortKeys(entry)]));
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
function sortedJson(value) {
|
|
27
|
+
return prettyJson(sortKeys(value));
|
|
28
|
+
}
|
|
15
29
|
export function writeJson(path, value, options) {
|
|
16
|
-
return writeFile(path,
|
|
30
|
+
return writeFile(path, sortedJson(value), options);
|
|
17
31
|
}
|
|
18
32
|
export async function replaceJson(path, value) {
|
|
19
33
|
const draft = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
20
34
|
try {
|
|
21
|
-
await writeFile(draft,
|
|
35
|
+
await writeFile(draft, sortedJson(value));
|
|
22
36
|
await rename(draft, path);
|
|
23
37
|
}
|
|
24
38
|
catch (error) {
|
|
@@ -31,7 +45,7 @@ export function replaceJsonNow(path, value) {
|
|
|
31
45
|
const draft = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
32
46
|
try {
|
|
33
47
|
mkdirSync(dirname(path), { recursive: true });
|
|
34
|
-
writeFileSync(draft,
|
|
48
|
+
writeFileSync(draft, sortedJson(value));
|
|
35
49
|
renameSync(draft, path);
|
|
36
50
|
}
|
|
37
51
|
catch (error) {
|
package/dist/run.mjs
CHANGED
|
@@ -41,7 +41,7 @@ export async function runLocked(root, args, controls) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
export async function runRepo(root, args, controls) {
|
|
44
|
-
const config = await loadConfig(root);
|
|
44
|
+
const config = await loadConfig(root, { sortFile: true });
|
|
45
45
|
return withDefaultTimeout(minutesToMs(config.commandTimeoutMinutes), () => runWithConfig(root, args, controls, config));
|
|
46
46
|
}
|
|
47
47
|
async function runWithConfig(root, args, controls, config) {
|