@ravshansbox/pi-next-issue 2.14.1 → 2.16.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 +2 -2
- package/index.ts +16 -9
- package/package.json +1 -1
- package/src/worker.ts +8 -4
package/README.md
CHANGED
|
@@ -16,13 +16,13 @@ Run this in pi, inside a git repository:
|
|
|
16
16
|
- The `next_issue_start` tool lets the model start a run. When no run is going, it starts a run like `/next-issue`. When a run is going, it starts nothing and reports the current run, which picks up new issues by itself. It never stops a run, and it does not ask for confirmation. Its result says whether it started a run.
|
|
17
17
|
- The `next_issue_status` tool lets the model see the run of this repository. It returns the footer line, then one line per handled issue with its outcome, for example `#190 done`. When the worker has no run of this repository, it returns `next-issue · no run of <root>`. When no worker is going, it returns `next-issue · no worker is running` and does not start one. It reports no other repository.
|
|
18
18
|
|
|
19
|
-
The footer shows
|
|
19
|
+
The footer shows each running issue with its stage, the number of tool calls and the time spent on it, for example `next-issue #12 · review 1 · 37 tools · 4m12s | #13 · implement · 5 tools · 40s`. After a run ends, it keeps the last summary. In the terminal, it uses the dim colour of the theme, like the rest of the footer. A note appears when an issue is done, needs a human or fails while pi is open. Pi does not repeat the notes of a run that ended before it opened.
|
|
20
20
|
|
|
21
21
|
## Answer questions
|
|
22
22
|
|
|
23
23
|
When an issue waits for a person, with the `needsHuman` label of the [config](../next-issue/README.md), the footer shows the count, for example `2 questions waiting`, and a note appears once for each new question. Neither interrupts what you do. Pi asks the worker for the list when it connects and every minute, and the worker also sends it after each issue of a run. A question answered on GitHub or in another pi leaves the count with the next list.
|
|
24
24
|
|
|
25
|
-
Run `/next-issue answer` to go through the waiting questions one at a time. Each shows the issue, the title and the reason of the hand-over. Choose:
|
|
25
|
+
Run `/next-issue answer` to go through the waiting questions one at a time. Pi suggests `answer` as you type after `/next-issue `. Each shows the issue, the title and the reason of the hand-over. Choose:
|
|
26
26
|
|
|
27
27
|
- **Retry**: takes the `needsHuman` label off the issue and its pull request, so the next run resumes it.
|
|
28
28
|
- **Retry with guidance**: asks for text, posts it as a comment where the worker reads it, on the pull request of the issue or on the issue when it has none, then takes the `needsHuman` label off.
|
package/index.ts
CHANGED
|
@@ -68,20 +68,25 @@ function outcomes(progress: Progress): string {
|
|
|
68
68
|
const OUTCOME_NOTES = { done: 'done', 'needs-human': 'needs a human', error: 'failed' } as const;
|
|
69
69
|
|
|
70
70
|
export function formatStatus(progress: Progress, now: number): string {
|
|
71
|
+
const running = progress.issues ?? [];
|
|
71
72
|
switch (progress.status) {
|
|
72
73
|
case 'running': {
|
|
73
|
-
if (
|
|
74
|
+
if (running.length === 0) {
|
|
74
75
|
return 'next-issue · looking for issues';
|
|
75
76
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const lines = running.map((item) => {
|
|
78
|
+
const parts = [`#${item.issue}`, item.stage ?? 'prepare', `${item.tools} tools`];
|
|
79
|
+
if (item.startedAt !== undefined) {
|
|
80
|
+
parts.push(duration(now - item.startedAt));
|
|
81
|
+
}
|
|
82
|
+
return parts.join(' · ');
|
|
83
|
+
});
|
|
84
|
+
return `next-issue ${lines.join(' | ')}`;
|
|
85
|
+
}
|
|
86
|
+
case 'stopping': {
|
|
87
|
+
const issues = running.map((item) => `#${item.issue}`);
|
|
88
|
+
return `next-issue ${issues.length === 0 ? '#?' : issues.join(' ')} · stopping`;
|
|
82
89
|
}
|
|
83
|
-
case 'stopping':
|
|
84
|
-
return `next-issue #${progress.issue ?? '?'} · stopping`;
|
|
85
90
|
case 'stopped':
|
|
86
91
|
return `next-issue · stopped: ${outcomes(progress)}`;
|
|
87
92
|
case 'finished':
|
|
@@ -440,6 +445,8 @@ export function createExtension(options: Options) {
|
|
|
440
445
|
pi.registerCommand('next-issue', {
|
|
441
446
|
description:
|
|
442
447
|
'Start or stop working through the GitHub issues of this repository, or answer the waiting questions with "answer"',
|
|
448
|
+
getArgumentCompletions: (prefix) =>
|
|
449
|
+
'answer'.startsWith(prefix) ? [{ value: 'answer', label: 'answer' }] : null,
|
|
443
450
|
handler: async (args, ctx) => {
|
|
444
451
|
if (args.trim() === 'answer') {
|
|
445
452
|
try {
|
package/package.json
CHANGED
package/src/worker.ts
CHANGED
|
@@ -7,14 +7,18 @@ export type RunStatus = 'running' | 'stopping' | 'finished' | 'stopped' | 'faile
|
|
|
7
7
|
|
|
8
8
|
export type Handled = { issue: number; outcome: 'done' | 'needs-human' | 'error' };
|
|
9
9
|
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
issue?: number;
|
|
10
|
+
export type IssueProgress = {
|
|
11
|
+
issue: number;
|
|
13
12
|
title?: string;
|
|
14
13
|
stage?: string;
|
|
15
14
|
tools: number;
|
|
16
15
|
lastTool?: string;
|
|
17
|
-
|
|
16
|
+
startedAt?: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type Progress = {
|
|
20
|
+
status: RunStatus;
|
|
21
|
+
issues: IssueProgress[];
|
|
18
22
|
handled: Handled[];
|
|
19
23
|
error?: string;
|
|
20
24
|
};
|