@blogic-cz/agent-tools 0.14.32 → 0.14.33
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/gh-tool/pr/commands.ts +22 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command, Flag } from "effect/unstable/cli";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
|
|
4
|
-
import type { PRStatusResult } from "#gh/types";
|
|
4
|
+
import type { CheckResult, PRStatusResult } from "#gh/types";
|
|
5
5
|
|
|
6
6
|
import { formatOption, logFormatted } from "#shared";
|
|
7
7
|
import { GitHubService } from "#gh/service";
|
|
@@ -56,6 +56,25 @@ const withRepo = <A, E, R>(repo: Option.Option<string>, effect: Effect.Effect<A,
|
|
|
56
56
|
return yield* gh.withRepoTarget(Option.getOrNull(repo), effect);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
type ReviewTriageSummary = {
|
|
60
|
+
readonly visibleOpenReviewThreadsCount: number;
|
|
61
|
+
readonly unrepliedReviewThreadsCount: number;
|
|
62
|
+
readonly unresolvedReviewThreadsCount: number;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const classifyReviewTriage = (
|
|
66
|
+
summary: ReviewTriageSummary,
|
|
67
|
+
checks: readonly CheckResult[],
|
|
68
|
+
) => {
|
|
69
|
+
const reasons = [
|
|
70
|
+
...(checks.some((check) => check.bucket === "fail") ? ["failed_checks"] : []),
|
|
71
|
+
...(summary.visibleOpenReviewThreadsCount > 0 ? ["visible_open_review_threads"] : []),
|
|
72
|
+
...(summary.unrepliedReviewThreadsCount > 0 ? ["unreplied_review_threads"] : []),
|
|
73
|
+
...(summary.unresolvedReviewThreadsCount > 0 ? ["unresolved_review_threads"] : []),
|
|
74
|
+
];
|
|
75
|
+
return { status: reasons.length > 0 ? "needs_investigation" : "clear", reasons };
|
|
76
|
+
};
|
|
77
|
+
|
|
59
78
|
export const prViewCommand = Command.make(
|
|
60
79
|
"view",
|
|
61
80
|
{
|
|
@@ -670,8 +689,9 @@ export const prReviewTriageCommand = Command.make(
|
|
|
670
689
|
fetchDiscussionSummary(prNumber),
|
|
671
690
|
fetchChecks(prNumber, false, false, 0),
|
|
672
691
|
]);
|
|
692
|
+
const classification = classifyReviewTriage(summary, checks);
|
|
673
693
|
yield* logFormatted(
|
|
674
|
-
{ info, unresolvedThreads, visibleOpenThreads, summary, checks },
|
|
694
|
+
{ classification, info, unresolvedThreads, visibleOpenThreads, summary, checks },
|
|
675
695
|
format,
|
|
676
696
|
);
|
|
677
697
|
}),
|