@ravshansbox/pi-github 1.1.0 → 1.2.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 +1 -1
- package/dist/watch.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Watches open issues in a GitHub repo and answers new issues and comments with [p
|
|
|
7
7
|
- Polls the repo of the current directory for new issues and comments every 30 seconds. Pull requests are ignored.
|
|
8
8
|
- Only handles issues and comments created after the first start. After a restart it picks up where it stopped, including runs a crash cut off. A crash right after posting a reply can lead to that reply being posted twice.
|
|
9
9
|
- Each issue gets its own git worktree in `.worktrees/issue-<number>` on branch `issue-<number>`, and its own pi session that continues across comments.
|
|
10
|
-
- New issues and comments get an 👀 reaction as soon as they are picked up.
|
|
10
|
+
- New issues and comments get an 👀 reaction as soon as they are picked up, then 🚀 once answered or 😕 if the run failed.
|
|
11
11
|
- Issues are handled in parallel, up to 3 at once. Comments on the same issue are handled one after another.
|
|
12
12
|
- The agent's final message is posted as a comment that starts with `agent:`. Comments that start with `agent:` are ignored, so it does not answer itself.
|
|
13
13
|
- If the agent made commits, the branch is pushed and a pull request is opened once. Later commits update the same pull request.
|
package/dist/watch.js
CHANGED
|
@@ -30,12 +30,20 @@ export async function watch({ github, agent, repoRoot, stateFile, intervalMs, co
|
|
|
30
30
|
let { pending = [], ...pollState } = await loadState(stateFile);
|
|
31
31
|
let saving = Promise.resolve();
|
|
32
32
|
const save = () => (saving = saving.then(() => saveState(stateFile, { ...pollState, pending })));
|
|
33
|
+
const react = (trigger, content) => github
|
|
34
|
+
.addReaction(trigger, content)
|
|
35
|
+
.catch((error) => log(`#${trigger.issueNumber}: reaction failed: ${error instanceof Error ? error.message : error}`));
|
|
33
36
|
const dispatcher = createDispatcher({
|
|
34
37
|
concurrency,
|
|
35
38
|
handle: async (trigger) => {
|
|
36
39
|
try {
|
|
37
40
|
await handleTrigger(trigger, { github, agent, repoRoot });
|
|
38
41
|
log(`#${trigger.issueNumber}: answered @${trigger.author}`);
|
|
42
|
+
await react(trigger, "rocket");
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
await react(trigger, "confused");
|
|
46
|
+
throw error;
|
|
39
47
|
}
|
|
40
48
|
finally {
|
|
41
49
|
pending = pending.filter((candidate) => candidate.key !== trigger.key);
|
|
@@ -57,7 +65,7 @@ export async function watch({ github, agent, repoRoot, stateFile, intervalMs, co
|
|
|
57
65
|
for (const trigger of result.triggers) {
|
|
58
66
|
log(`#${trigger.issueNumber}: new ${trigger.kind} from @${trigger.author}`);
|
|
59
67
|
dispatcher.dispatch(trigger);
|
|
60
|
-
await
|
|
68
|
+
await react(trigger, "eyes");
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
catch (error) {
|