@ravshansbox/pi-next-issue 2.13.0 → 2.14.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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/index.ts +31 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,6 +14,7 @@ Run this in pi, inside a git repository:
14
14
 
15
15
  - `/next-issue` starts a run of this repository when none is going, and stops the run when one is going. A stop takes effect after the current round, and the issue keeps its saved state, so the next run resumes it.
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
+ - 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.
17
18
 
18
19
  The footer shows the issue, the stage, the number of tool calls and the time spent on the issue, for example `next-issue #12 · review 1 · 37 tools · 4m12s`. 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.
19
20
 
package/index.ts CHANGED
@@ -332,6 +332,37 @@ export function createExtension(options: Options) {
332
332
  },
333
333
  });
334
334
 
335
+ const report = (text: string, root: string) => ({
336
+ content: [{ type: 'text' as const, text }],
337
+ details: { root },
338
+ });
339
+
340
+ pi.registerTool({
341
+ name: 'next_issue_status',
342
+ label: 'next-issue status',
343
+ description:
344
+ 'Report the next-issue run of this repository: its status line, then each handled issue with its outcome. Never starts a worker.',
345
+ promptSnippet: 'Report the next-issue run of this repository',
346
+ parameters: Type.Object({}),
347
+ async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
348
+ const root = await options.root(ctx.cwd);
349
+ const client = shared(options.client);
350
+ await client.attach();
351
+ if (!client.connected) {
352
+ return report('next-issue · no worker is running', root);
353
+ }
354
+ const progress = client.runs[root];
355
+ if (progress === undefined) {
356
+ return report(`next-issue · no run of ${root}`, root);
357
+ }
358
+ const lines = [
359
+ formatStatus(progress, Date.now()),
360
+ ...progress.handled.map((item) => `#${item.issue} ${OUTCOME_NOTES[item.outcome]}`),
361
+ ];
362
+ return report(lines.join('\n'), root);
363
+ },
364
+ });
365
+
335
366
  const fresh = (client: WorkerClient, root: string) =>
336
367
  new Promise<Question[]>((resolve, reject) => {
337
368
  const id = randomUUID();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-next-issue",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Pi extension that works through GitHub issues with the next-issue worker",
5
5
  "license": "MIT",
6
6
  "type": "module",