@chernabog/sdk 0.3.0 → 0.3.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/package.json +1 -1
- package/src/implement.ts +20 -13
package/package.json
CHANGED
package/src/implement.ts
CHANGED
|
@@ -483,20 +483,27 @@ export const workflow = (item: WorkItem) =>
|
|
|
483
483
|
Effect.gen(function* () {
|
|
484
484
|
const issue = yield* issueOf(item);
|
|
485
485
|
const { branch } = yield* claim(issue);
|
|
486
|
-
const worktree = yield* prepareWorktree(branch);
|
|
487
|
-
const outcome = yield* implementWithAgent(issue, worktree);
|
|
488
|
-
|
|
489
|
-
if (outcome.status === 'needs-clarification') return yield* askForClarification(issue, outcome).pipe(Effect.flatMap(endForPerson));
|
|
490
|
-
|
|
491
486
|
let pullRequest = Option.none<number>();
|
|
487
|
+
const toPerson = (reason: string) => handToHuman(issue, reason, pullRequest).pipe(Effect.flatMap(endForPerson));
|
|
492
488
|
|
|
493
489
|
return yield* Effect.gen(function* () {
|
|
494
|
-
yield*
|
|
495
|
-
yield*
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
490
|
+
const worktree = yield* prepareWorktree(branch);
|
|
491
|
+
const outcome = yield* implementWithAgent(issue, worktree);
|
|
492
|
+
|
|
493
|
+
if (outcome.status === 'needs-clarification') return yield* askForClarification(issue, outcome).pipe(Effect.flatMap(endForPerson));
|
|
494
|
+
|
|
495
|
+
return yield* Effect.gen(function* () {
|
|
496
|
+
yield* localGate(worktree);
|
|
497
|
+
yield* push('push', worktree, branch);
|
|
498
|
+
const opened = yield* openPullRequest(issue, outcome);
|
|
499
|
+
pullRequest = Option.some(opened.number);
|
|
500
|
+
yield* waitForCi(opened.number, worktree, { ...thisRunsSession, branch });
|
|
501
|
+
|
|
502
|
+
return yield* handOff(issue, opened, outcome);
|
|
503
|
+
}).pipe(Effect.catchTag('NeedsHuman', (needsHuman) => toPerson(needsHuman.reason)));
|
|
504
|
+
}).pipe(
|
|
505
|
+
// Any other failure once the issue is claimed hands it to a person, rather
|
|
506
|
+
// than leaving it claimed with nobody working on it.
|
|
507
|
+
Effect.catchTag('StepFailed', (failed) => toPerson(`${failed.step}: ${failed.message}`)),
|
|
508
|
+
);
|
|
502
509
|
});
|