plugin-git-manager 1.2.28 → 1.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/README.md +58 -40
- package/dist/client/941.1793e67472872992.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/941.b0d55429cd053f32.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/locale/en-US.json +90 -1
- package/dist/locale/vi-VN.json +90 -1
- package/dist/locale/zh-CN.json +90 -1
- package/dist/node_modules/simple-git/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/actions/review-cutover.js +137 -0
- package/dist/server/actions/review.js +132 -43
- package/dist/server/actions/role-permissions.js +1 -0
- package/dist/server/ai-tools.js +8 -9
- package/dist/server/collections/gitCodeReviews.js +10 -0
- package/dist/server/collections/gitReviewCutover.js +44 -0
- package/dist/server/collections/gitReviewFlows.js +3 -0
- package/dist/server/collections/gitReviewInbox.js +51 -0
- package/dist/server/collections/gitReviewProjects.js +43 -0
- package/dist/server/collections/gitReviewRequests.js +56 -0
- package/dist/server/index.js +8 -2
- package/dist/server/plugin.js +51 -16
- package/dist/server/poller.js +54 -34
- package/dist/server/repository-access.js +23 -5
- package/dist/server/request-method-policy.js +2 -1
- package/dist/server/review-control-access.js +79 -0
- package/dist/server/services/legacy-post-service.js +412 -0
- package/dist/server/services/review-service.js +1451 -0
- package/dist/server/services/review-source.js +325 -0
- package/package.json +2 -2
- package/src/client/__tests__/CommitHistory.test.tsx +79 -0
- package/src/client/__tests__/ReviewHistory.test.tsx +126 -0
- package/src/client/__tests__/RunReviewButton.test.tsx +46 -35
- package/src/client/__tests__/workflowRoutes.test.ts +65 -0
- package/src/client/components/CommitHistory.tsx +61 -6
- package/src/client/components/ReviewFlows.tsx +90 -41
- package/src/client/components/ReviewHistory.tsx +245 -15
- package/src/client/components/RunReviewButton.tsx +12 -136
- package/src/client/workflowRoutes.ts +42 -0
- package/src/locale/en-US.json +90 -1
- package/src/locale/vi-VN.json +90 -1
- package/src/locale/zh-CN.json +90 -1
- package/src/server/__tests__/repository-access.test.ts +11 -3
- package/src/server/__tests__/review-service.integration.test.ts +1263 -0
- package/src/server/__tests__/review.test.ts +37 -98
- package/src/server/actions/review-cutover.ts +121 -0
- package/src/server/actions/review.ts +148 -38
- package/src/server/actions/role-permissions.ts +10 -0
- package/src/server/ai-tools.ts +23 -8
- package/src/server/collections/gitCodeReviews.ts +19 -0
- package/src/server/collections/gitReviewCutover.ts +23 -0
- package/src/server/collections/gitReviewFlows.ts +12 -0
- package/src/server/collections/gitReviewInbox.ts +30 -0
- package/src/server/collections/gitReviewProjects.ts +22 -0
- package/src/server/collections/gitReviewRequests.ts +35 -0
- package/src/server/index.ts +12 -0
- package/src/server/plugin.ts +43 -6
- package/src/server/poller.ts +54 -40
- package/src/server/repository-access.ts +32 -2
- package/src/server/request-method-policy.ts +1 -0
- package/src/server/review-control-access.ts +71 -0
- package/src/server/services/__tests__/review-source.test.ts +226 -0
- package/src/server/services/legacy-post-service.ts +550 -0
- package/src/server/services/review-service.ts +1899 -0
- package/src/server/services/review-source.ts +359 -0
- package/dist/client/900.a48beac7e2ebee7d.js +0 -10
- package/dist/client-v2/900.e6155002a9c97e7f.js +0 -10
|
@@ -34,7 +34,11 @@ __export(review_exports, {
|
|
|
34
34
|
resolveBackgroundReviewRoles: () => resolveBackgroundReviewRoles,
|
|
35
35
|
resolveImmutableReviewActorId: () => resolveImmutableReviewActorId,
|
|
36
36
|
reviewApprovePost: () => reviewApprovePost,
|
|
37
|
+
reviewLegacyPostStatus: () => reviewLegacyPostStatus,
|
|
38
|
+
reviewLegacyReleaseHold: () => reviewLegacyReleaseHold,
|
|
39
|
+
reviewLegacyRetryPost: () => reviewLegacyRetryPost,
|
|
37
40
|
reviewReject: () => reviewReject,
|
|
41
|
+
reviewWorkflowRetryPost: () => reviewWorkflowRetryPost,
|
|
38
42
|
triggerReview: () => triggerReview,
|
|
39
43
|
triggerReviewInternal: () => triggerReviewInternal,
|
|
40
44
|
unregisterReviewQueue: () => unregisterReviewQueue
|
|
@@ -80,7 +84,7 @@ async function withTriggerLock(app, key, fn) {
|
|
|
80
84
|
return app.lockManager.runExclusive(lockKey, fn, TRIGGER_LOCK_TTL_MS);
|
|
81
85
|
}
|
|
82
86
|
async function triggerReview(ctx, next) {
|
|
83
|
-
var _a, _b;
|
|
87
|
+
var _a, _b, _c;
|
|
84
88
|
const params = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
85
89
|
const { flowId, repositoryId, targetType, mrIid, commitSha, branch, folderPath, extraInstructions } = params;
|
|
86
90
|
if (!repositoryId) ctx.throw(400, "repositoryId is required");
|
|
@@ -107,16 +111,24 @@ async function triggerReview(ctx, next) {
|
|
|
107
111
|
folderPath: targetType === "folder" && typeof folderPath === "string" ? folderPath : null,
|
|
108
112
|
extraInstructions: typeof extraInstructions === "string" ? extraInstructions : void 0,
|
|
109
113
|
triggeredBy: "manual",
|
|
110
|
-
userId
|
|
114
|
+
userId,
|
|
115
|
+
actorRoles: Array.isArray((_c = ctx.state) == null ? void 0 : _c.currentRoles) ? ctx.state.currentRoles.filter((role) => typeof role === "string") : []
|
|
111
116
|
});
|
|
112
117
|
ctx.body = { success: true, data: { reviewId } };
|
|
113
118
|
} catch (err) {
|
|
114
|
-
|
|
119
|
+
const errorMessage = err.message || "Failed to trigger review";
|
|
120
|
+
const providerError = /^Git provider request failed \((\d+)\)$/.exec(errorMessage);
|
|
121
|
+
ctx.throw(
|
|
122
|
+
err.status || 400,
|
|
123
|
+
providerError ? ctx.t("Git provider request failed ({{status}})", { ns: "plugin-git-manager", status: providerError[1] }) : ctx.t(errorMessage, { ns: "plugin-git-manager" })
|
|
124
|
+
);
|
|
115
125
|
}
|
|
116
126
|
await next();
|
|
117
127
|
}
|
|
118
128
|
async function triggerReviewInternal(app, args) {
|
|
119
|
-
|
|
129
|
+
const plugin = app.pm.get("plugin-git-manager") || app.pm.get("git-manager");
|
|
130
|
+
if (!(plugin == null ? void 0 : plugin.reviewService)) throw new Error("Git review workflow service is unavailable");
|
|
131
|
+
return plugin.reviewService.enqueue(args);
|
|
120
132
|
}
|
|
121
133
|
async function triggerReviewInternalLocked(app, args) {
|
|
122
134
|
const db = app.db;
|
|
@@ -532,7 +544,7 @@ async function failQueuedReview(app, reviewId, err) {
|
|
|
532
544
|
}
|
|
533
545
|
async function processQueuedReview(app, message) {
|
|
534
546
|
await withReviewProcessLock(app, message.reviewId, async () => {
|
|
535
|
-
var _a, _b, _c, _d, _e, _f;
|
|
547
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
536
548
|
const db = app.db;
|
|
537
549
|
const reviewsRepo = db.getRepository("gitCodeReviews");
|
|
538
550
|
const review = await reviewsRepo.findOne({ filterByTk: message.reviewId });
|
|
@@ -540,8 +552,8 @@ async function processQueuedReview(app, message) {
|
|
|
540
552
|
(_b = (_a = app.log) == null ? void 0 : _a.warn) == null ? void 0 : _b.call(_a, `git review queue: review ${message.reviewId} not found, skipping`);
|
|
541
553
|
return;
|
|
542
554
|
}
|
|
543
|
-
if (review.get("status") !== "pending") {
|
|
544
|
-
(
|
|
555
|
+
if (review.get("status") !== "pending" || ((_c = review.get("metadata")) == null ? void 0 : _c.workflowManaged)) {
|
|
556
|
+
(_e = (_d = app.log) == null ? void 0 : _d.info) == null ? void 0 : _e.call(_d, `git review queue: review ${message.reviewId} is ${review.get("status")}, skipping`);
|
|
545
557
|
return;
|
|
546
558
|
}
|
|
547
559
|
const metadata = getQueuedReviewMetadata(review);
|
|
@@ -582,47 +594,85 @@ async function processQueuedReview(app, message) {
|
|
|
582
594
|
userId: actorUserId
|
|
583
595
|
});
|
|
584
596
|
} catch (err) {
|
|
585
|
-
(
|
|
597
|
+
(_g = (_f = app.log) == null ? void 0 : _f.error) == null ? void 0 : _g.call(_f, "git review queue: failed before review execution", {
|
|
598
|
+
error: (0, import_redact.redactPat)(err instanceof Error ? err.message : String(err))
|
|
599
|
+
});
|
|
586
600
|
await failQueuedReview(app, message.reviewId, err);
|
|
587
601
|
}
|
|
588
602
|
});
|
|
589
603
|
}
|
|
604
|
+
function legacyPostContext(ctx) {
|
|
605
|
+
var _a, _b, _c;
|
|
606
|
+
const actor = (_b = (_a = ctx.state) == null ? void 0 : _a.currentUser) == null ? void 0 : _b.id;
|
|
607
|
+
const roles = (_c = ctx.state) == null ? void 0 : _c.currentRoles;
|
|
608
|
+
if (typeof actor !== "string" && typeof actor !== "number" || !Array.isArray(roles) || !roles.every((role) => typeof role === "string")) {
|
|
609
|
+
ctx.throw(403, "Permission denied");
|
|
610
|
+
}
|
|
611
|
+
const plugin = ctx.app.pm.get("plugin-git-manager") || ctx.app.pm.get("git-manager");
|
|
612
|
+
if (!(plugin == null ? void 0 : plugin.legacyPostService)) ctx.throw(503, "Git review workflow service is unavailable");
|
|
613
|
+
return { service: plugin.legacyPostService, actor, roles };
|
|
614
|
+
}
|
|
615
|
+
async function legacyPostAction(ctx, run) {
|
|
616
|
+
try {
|
|
617
|
+
ctx.body = { success: true, data: await run() };
|
|
618
|
+
} catch (error) {
|
|
619
|
+
const status = error && typeof error === "object" && "status" in error && typeof error.status === "number" ? error.status : 400;
|
|
620
|
+
ctx.throw(
|
|
621
|
+
status,
|
|
622
|
+
ctx.t(error instanceof Error ? error.message : "Failed to reconcile review publication", {
|
|
623
|
+
ns: "plugin-git-manager"
|
|
624
|
+
})
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
590
628
|
async function reviewApprovePost(ctx, next) {
|
|
591
|
-
|
|
629
|
+
const { reviewId, editedMarkdown, baseConfirmation } = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
630
|
+
if (typeof reviewId !== "string" && typeof reviewId !== "number") ctx.throw(400, "reviewId is required");
|
|
631
|
+
const { service, actor, roles } = legacyPostContext(ctx);
|
|
632
|
+
await legacyPostAction(ctx, () => service.approve(reviewId, actor, roles, editedMarkdown, baseConfirmation));
|
|
633
|
+
await next();
|
|
634
|
+
}
|
|
635
|
+
async function reviewLegacyPostStatus(ctx, next) {
|
|
636
|
+
const { reviewId } = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
637
|
+
if (typeof reviewId !== "string" && typeof reviewId !== "number") ctx.throw(400, "reviewId is required");
|
|
638
|
+
const { service, actor, roles } = legacyPostContext(ctx);
|
|
639
|
+
await legacyPostAction(ctx, () => service.status(reviewId, actor, roles));
|
|
640
|
+
await next();
|
|
641
|
+
}
|
|
642
|
+
async function reviewLegacyRetryPost(ctx, next) {
|
|
592
643
|
const params = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
593
|
-
const { reviewId,
|
|
594
|
-
if (
|
|
595
|
-
|
|
644
|
+
const { reviewId, confirmation, expectedAttempt, baseConfirmation } = params;
|
|
645
|
+
if (typeof reviewId !== "string" && typeof reviewId !== "number") ctx.throw(400, "reviewId is required");
|
|
646
|
+
if (Object.prototype.hasOwnProperty.call(params, "editedMarkdown")) {
|
|
647
|
+
ctx.throw(400, ctx.t("Review content cannot change while publication is unresolved", { ns: "plugin-git-manager" }));
|
|
596
648
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
if (!
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}
|
|
649
|
+
if (confirmation !== "OUTBOUND_POST_STOPPED")
|
|
650
|
+
ctx.throw(400, ctx.t("Outbound post stop confirmation is required", { ns: "plugin-git-manager" }));
|
|
651
|
+
if (!Object.prototype.hasOwnProperty.call(params, "expectedAttempt") || expectedAttempt !== null && typeof expectedAttempt !== "string") {
|
|
652
|
+
ctx.throw(400, ctx.t("Refresh publication status before recovery", { ns: "plugin-git-manager" }));
|
|
653
|
+
}
|
|
654
|
+
const { service, actor, roles } = legacyPostContext(ctx);
|
|
655
|
+
await legacyPostAction(ctx, () => service.retry(reviewId, actor, roles, expectedAttempt, baseConfirmation));
|
|
656
|
+
await next();
|
|
657
|
+
}
|
|
658
|
+
async function reviewLegacyReleaseHold(ctx, next) {
|
|
659
|
+
const params = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
660
|
+
const { reviewId, confirmation, expectedAttempt } = params;
|
|
661
|
+
if (typeof reviewId !== "string" && typeof reviewId !== "number") ctx.throw(400, "reviewId is required");
|
|
662
|
+
if (confirmation !== "OUTBOUND_POST_STOPPED")
|
|
663
|
+
ctx.throw(400, ctx.t("Outbound post stop confirmation is required", { ns: "plugin-git-manager" }));
|
|
664
|
+
if (!Object.prototype.hasOwnProperty.call(params, "expectedAttempt") || expectedAttempt !== null && typeof expectedAttempt !== "string") {
|
|
665
|
+
ctx.throw(400, ctx.t("Refresh publication status before recovery", { ns: "plugin-git-manager" }));
|
|
666
|
+
}
|
|
667
|
+
const { service, actor, roles } = legacyPostContext(ctx);
|
|
668
|
+
await legacyPostAction(ctx, async () => {
|
|
669
|
+
await service.releaseHold(reviewId, actor, roles, expectedAttempt);
|
|
670
|
+
return { reviewId };
|
|
620
671
|
});
|
|
621
|
-
ctx.body = { success: true, data: { reviewId, postedNoteId: noteId } };
|
|
622
672
|
await next();
|
|
623
673
|
}
|
|
624
674
|
async function reviewReject(ctx, next) {
|
|
625
|
-
var _a, _b;
|
|
675
|
+
var _a, _b, _c;
|
|
626
676
|
const params = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
627
677
|
const { reviewId, reason } = params;
|
|
628
678
|
if (!reviewId || typeof reviewId !== "string" && typeof reviewId !== "number") {
|
|
@@ -631,19 +681,54 @@ async function reviewReject(ctx, next) {
|
|
|
631
681
|
const reviewsRepo = ctx.db.getRepository("gitCodeReviews");
|
|
632
682
|
const review = await reviewsRepo.findOne({ filterByTk: reviewId });
|
|
633
683
|
if (!review) ctx.throw(404, "Review not found");
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
684
|
+
if (((_a = review.get("metadata")) == null ? void 0 : _a.workflowManaged) || await ctx.db.getRepository("gitReviewInbox").findOne({ filter: { reviewId } })) {
|
|
685
|
+
ctx.throw(409, ctx.t("Use the workflow approval task for this review", { ns: "plugin-git-manager" }));
|
|
686
|
+
}
|
|
687
|
+
const userId = (_c = (_b = ctx.state) == null ? void 0 : _b.currentUser) == null ? void 0 : _c.id;
|
|
688
|
+
const [changed] = await ctx.db.getCollection("gitCodeReviews").model.update(
|
|
689
|
+
{
|
|
638
690
|
postStatus: "rejected",
|
|
639
691
|
approvedBy: userId ? String(userId) : null,
|
|
640
692
|
approvedAt: /* @__PURE__ */ new Date(),
|
|
641
693
|
error: reason ? `Rejected: ${reason}` : "Rejected"
|
|
642
|
-
}
|
|
643
|
-
|
|
694
|
+
},
|
|
695
|
+
{ where: { id: reviewId, status: "completed", targetType: "mr", postStatus: "pending_approval" } }
|
|
696
|
+
);
|
|
697
|
+
if (changed !== 1) ctx.throw(409, "Review is not awaiting approval");
|
|
644
698
|
ctx.body = { success: true, data: { reviewId } };
|
|
645
699
|
await next();
|
|
646
700
|
}
|
|
701
|
+
async function reviewWorkflowRetryPost(ctx, next) {
|
|
702
|
+
var _a, _b, _c;
|
|
703
|
+
const { reviewId, confirmation } = (0, import_repository_access.getEffectiveActionParams)(ctx);
|
|
704
|
+
if (typeof reviewId !== "string" && typeof reviewId !== "number") ctx.throw(400, "reviewId is required");
|
|
705
|
+
if (confirmation != null && confirmation !== "OUTBOUND_POST_STOPPED")
|
|
706
|
+
ctx.throw(400, ctx.t("Invalid publication confirmation", { ns: "plugin-git-manager" }));
|
|
707
|
+
const actor = (_b = (_a = ctx.state) == null ? void 0 : _a.currentUser) == null ? void 0 : _b.id;
|
|
708
|
+
const roles = (_c = ctx.state) == null ? void 0 : _c.currentRoles;
|
|
709
|
+
if (!actor || !Array.isArray(roles) || !roles.every((role) => typeof role === "string"))
|
|
710
|
+
ctx.throw(403, "Permission denied");
|
|
711
|
+
const plugin = ctx.app.pm.get("plugin-git-manager") || ctx.app.pm.get("git-manager");
|
|
712
|
+
if (!(plugin == null ? void 0 : plugin.reviewService)) ctx.throw(503, "Git review workflow service is unavailable");
|
|
713
|
+
try {
|
|
714
|
+
const result = await plugin.reviewService.retryPost(
|
|
715
|
+
reviewId,
|
|
716
|
+
actor,
|
|
717
|
+
roles,
|
|
718
|
+
confirmation === "OUTBOUND_POST_STOPPED"
|
|
719
|
+
);
|
|
720
|
+
ctx.body = { success: true, data: result };
|
|
721
|
+
} catch (error) {
|
|
722
|
+
const status = error && typeof error === "object" && "status" in error && typeof error.status === "number" ? error.status : 400;
|
|
723
|
+
ctx.throw(
|
|
724
|
+
status,
|
|
725
|
+
ctx.t(error instanceof Error ? error.message : "Failed to reconcile review publication", {
|
|
726
|
+
ns: "plugin-git-manager"
|
|
727
|
+
})
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
await next();
|
|
731
|
+
}
|
|
647
732
|
async function runReview(app, args) {
|
|
648
733
|
var _a, _b, _c, _d, _e, _f;
|
|
649
734
|
const db = app.db;
|
|
@@ -1137,7 +1222,11 @@ async function recoverStuckReviews(app) {
|
|
|
1137
1222
|
resolveBackgroundReviewRoles,
|
|
1138
1223
|
resolveImmutableReviewActorId,
|
|
1139
1224
|
reviewApprovePost,
|
|
1225
|
+
reviewLegacyPostStatus,
|
|
1226
|
+
reviewLegacyReleaseHold,
|
|
1227
|
+
reviewLegacyRetryPost,
|
|
1140
1228
|
reviewReject,
|
|
1229
|
+
reviewWorkflowRetryPost,
|
|
1141
1230
|
triggerReview,
|
|
1142
1231
|
triggerReviewInternal,
|
|
1143
1232
|
unregisterReviewQueue
|
package/dist/server/ai-tools.js
CHANGED
|
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(ai_tools_exports);
|
|
|
42
42
|
var import_zod = require("zod");
|
|
43
43
|
var gitlabApi = __toESM(require("./actions/gitlab-api"));
|
|
44
44
|
var gitActions = __toESM(require("./actions/git-actions"));
|
|
45
|
+
var import_repository_access = require("./repository-access");
|
|
45
46
|
function registerGitReviewAiTools(app) {
|
|
46
47
|
var _a, _b, _c, _d, _e;
|
|
47
48
|
const aiManager = app.aiManager;
|
|
@@ -49,10 +50,10 @@ function registerGitReviewAiTools(app) {
|
|
|
49
50
|
(_c = (_b = app.log) == null ? void 0 : _b.warn) == null ? void 0 : _c.call(_b, "plugin-git-manager: AIManager.toolsManager not available; skipping AI tool registration");
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
const enforceAcl = (ctx, resource, action, params) => {
|
|
53
|
+
const enforceAcl = async (ctx, resource, action, params) => {
|
|
53
54
|
var _a2, _b2, _c2, _d2;
|
|
54
55
|
if (ctx.isBackgroundReview) {
|
|
55
|
-
if (params.repositoryId
|
|
56
|
+
if (String(params.repositoryId) !== String(ctx.reviewTargetRepositoryId)) {
|
|
56
57
|
const err = new Error("Permission denied: AI cannot access other repositories");
|
|
57
58
|
err.status = 403;
|
|
58
59
|
throw err;
|
|
@@ -66,14 +67,13 @@ function registerGitReviewAiTools(app) {
|
|
|
66
67
|
throw err;
|
|
67
68
|
}
|
|
68
69
|
const acl = (_b2 = ctx.app) == null ? void 0 : _b2.acl;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!role) {
|
|
70
|
+
const roles = Array.isArray((_c2 = ctx == null ? void 0 : ctx.state) == null ? void 0 : _c2.currentRoles) ? ctx.state.currentRoles.filter((role) => typeof role === "string") : typeof ((_d2 = ctx == null ? void 0 : ctx.state) == null ? void 0 : _d2.currentRole) === "string" ? [ctx.state.currentRole] : [];
|
|
71
|
+
if (!roles.length || !(acl == null ? void 0 : acl.can)) {
|
|
72
72
|
const err = new Error("AI tool requires a resolvable role on the current user");
|
|
73
73
|
err.status = 403;
|
|
74
74
|
throw err;
|
|
75
75
|
}
|
|
76
|
-
const allowed =
|
|
76
|
+
const allowed = resource === "gitManager" && await (0, import_repository_access.hasRepositoryAccess)({ acl, roles, repositoryId: params.repositoryId, action });
|
|
77
77
|
if (!allowed) {
|
|
78
78
|
const err = new Error(`Permission denied: ${resource}:${action}`);
|
|
79
79
|
err.status = 403;
|
|
@@ -97,14 +97,13 @@ function registerGitReviewAiTools(app) {
|
|
|
97
97
|
return obj;
|
|
98
98
|
};
|
|
99
99
|
const runResourceAction = async (ctx, handler, params, gate) => {
|
|
100
|
-
|
|
101
|
-
enforceAcl(ctx, gate.resource, gate.action, params);
|
|
100
|
+
await enforceAcl(ctx, gate.resource, gate.action, params);
|
|
102
101
|
const synthCtx = {
|
|
103
102
|
...ctx,
|
|
104
103
|
app: ctx.app,
|
|
105
104
|
db: ctx.db,
|
|
106
105
|
action: { params },
|
|
107
|
-
request: { ...ctx.request || {}, body:
|
|
106
|
+
request: { ...ctx.request || {}, body: {} },
|
|
108
107
|
throw: (status, message) => {
|
|
109
108
|
const err = new Error(message);
|
|
110
109
|
err.status = status;
|
|
@@ -133,6 +133,7 @@ var gitCodeReviews_default = (0, import_database.defineCollection)({
|
|
|
133
133
|
"x-component": "Select",
|
|
134
134
|
enum: [
|
|
135
135
|
{ value: "pending", label: "Pending" },
|
|
136
|
+
{ value: "queued", label: "Queued" },
|
|
136
137
|
{ value: "running", label: "Running" },
|
|
137
138
|
{ value: "completed", label: "Completed" },
|
|
138
139
|
{ value: "failed", label: "Failed" }
|
|
@@ -184,6 +185,15 @@ var gitCodeReviews_default = (0, import_database.defineCollection)({
|
|
|
184
185
|
name: "postedNoteId",
|
|
185
186
|
interface: "input"
|
|
186
187
|
},
|
|
188
|
+
{ type: "string", name: "legacyPostFingerprint" },
|
|
189
|
+
{ type: "string", name: "legacyPostClaim" },
|
|
190
|
+
{ type: "string", name: "legacyPostProjectKey" },
|
|
191
|
+
{ type: "json", name: "legacyPostSource" },
|
|
192
|
+
{ type: "string", name: "legacyBaseProvenance" },
|
|
193
|
+
{ type: "string", name: "legacyBaseAcknowledgedBy" },
|
|
194
|
+
{ type: "date", name: "legacyBaseAcknowledgedAt" },
|
|
195
|
+
{ type: "string", name: "legacyHoldReleasedBy" },
|
|
196
|
+
{ type: "date", name: "legacyHoldReleasedAt" },
|
|
187
197
|
{
|
|
188
198
|
type: "string",
|
|
189
199
|
name: "approvedBy",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var gitReviewCutover_exports = {};
|
|
28
|
+
__export(gitReviewCutover_exports, {
|
|
29
|
+
default: () => gitReviewCutover_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(gitReviewCutover_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var gitReviewCutover_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "gitReviewCutover",
|
|
35
|
+
autoGenId: true,
|
|
36
|
+
createdAt: true,
|
|
37
|
+
updatedAt: true,
|
|
38
|
+
fields: [
|
|
39
|
+
{ name: "key", type: "string", unique: true, allowNull: false },
|
|
40
|
+
{ name: "state", type: "string", allowNull: false },
|
|
41
|
+
{ name: "confirmedBy", type: "string" },
|
|
42
|
+
{ name: "confirmedAt", type: "date" }
|
|
43
|
+
]
|
|
44
|
+
});
|
|
@@ -39,6 +39,9 @@ var gitReviewFlows_default = (0, import_database.defineCollection)({
|
|
|
39
39
|
createdAt: true,
|
|
40
40
|
updatedAt: true,
|
|
41
41
|
fields: [
|
|
42
|
+
{ type: "bigInt", name: "workflowId" },
|
|
43
|
+
{ type: "string", name: "workflowKey" },
|
|
44
|
+
{ type: "boolean", name: "reviewOnNewCommits", defaultValue: false },
|
|
42
45
|
{
|
|
43
46
|
type: "string",
|
|
44
47
|
name: "name",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var gitReviewInbox_exports = {};
|
|
28
|
+
__export(gitReviewInbox_exports, {
|
|
29
|
+
default: () => gitReviewInbox_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(gitReviewInbox_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var gitReviewInbox_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "gitReviewInbox",
|
|
35
|
+
autoGenId: true,
|
|
36
|
+
createdAt: true,
|
|
37
|
+
updatedAt: true,
|
|
38
|
+
fields: [
|
|
39
|
+
{ name: "projectKey", type: "string", allowNull: false, index: true },
|
|
40
|
+
{ name: "repositoryId", type: "integer", allowNull: false },
|
|
41
|
+
{ name: "reviewId", type: "integer", allowNull: false, unique: true },
|
|
42
|
+
{ name: "legacyReviewId", type: "integer", unique: true },
|
|
43
|
+
{ name: "eventKey", type: "string", unique: true },
|
|
44
|
+
{ name: "queuedAt", type: "date", allowNull: false },
|
|
45
|
+
{ name: "recoveredBy", type: "string" },
|
|
46
|
+
{ name: "recoveredAt", type: "date" },
|
|
47
|
+
{ name: "state", type: "string", allowNull: false, defaultValue: "queued" },
|
|
48
|
+
{ name: "blockedReason", type: "string" },
|
|
49
|
+
{ name: "payload", type: "json", allowNull: false }
|
|
50
|
+
]
|
|
51
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var gitReviewProjects_exports = {};
|
|
28
|
+
__export(gitReviewProjects_exports, {
|
|
29
|
+
default: () => gitReviewProjects_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(gitReviewProjects_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var gitReviewProjects_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "gitReviewProjects",
|
|
35
|
+
autoGenId: true,
|
|
36
|
+
createdAt: true,
|
|
37
|
+
updatedAt: true,
|
|
38
|
+
fields: [
|
|
39
|
+
{ name: "projectKey", type: "string", unique: true, allowNull: false },
|
|
40
|
+
{ name: "activeInboxId", type: "integer" },
|
|
41
|
+
{ name: "legacyPostReviewId", type: "integer" }
|
|
42
|
+
]
|
|
43
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var gitReviewRequests_exports = {};
|
|
28
|
+
__export(gitReviewRequests_exports, {
|
|
29
|
+
default: () => gitReviewRequests_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(gitReviewRequests_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var gitReviewRequests_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "gitReviewRequests",
|
|
35
|
+
autoGenId: true,
|
|
36
|
+
createdAt: true,
|
|
37
|
+
updatedAt: true,
|
|
38
|
+
fields: [
|
|
39
|
+
{ name: "inboxId", type: "integer", allowNull: false, unique: true },
|
|
40
|
+
{ name: "reviewId", type: "integer", allowNull: false },
|
|
41
|
+
{ name: "repositoryId", type: "integer", allowNull: false },
|
|
42
|
+
{ name: "flowId", type: "integer", allowNull: false },
|
|
43
|
+
{ name: "workflowId", type: "bigInt", allowNull: false },
|
|
44
|
+
{ name: "workflowKey", type: "string" },
|
|
45
|
+
{ name: "eventType", type: "string", allowNull: false },
|
|
46
|
+
{ name: "executionId", type: "bigInt", unique: true },
|
|
47
|
+
{ name: "fenced", type: "boolean", allowNull: false, defaultValue: false },
|
|
48
|
+
{ name: "llmClaims", type: "json" },
|
|
49
|
+
{ name: "resultFingerprint", type: "string" },
|
|
50
|
+
{ name: "postClaim", type: "string" },
|
|
51
|
+
{ name: "postClaimedAt", type: "date" },
|
|
52
|
+
{ name: "postResetBy", type: "string" },
|
|
53
|
+
{ name: "postResetAt", type: "date" },
|
|
54
|
+
{ name: "aiSettled", type: "boolean", allowNull: false, defaultValue: false }
|
|
55
|
+
]
|
|
56
|
+
});
|
package/dist/server/index.js
CHANGED
|
@@ -36,13 +36,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
var server_exports = {};
|
|
38
38
|
__export(server_exports, {
|
|
39
|
+
GitReviewService: () => import_review_service.GitReviewService,
|
|
39
40
|
PluginGitManagerServer: () => import_plugin2.PluginGitManagerServer,
|
|
40
|
-
default: () => import_plugin.default
|
|
41
|
+
default: () => import_plugin.default,
|
|
42
|
+
hasRepositoryAccess: () => import_repository_access.hasRepositoryAccess
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(server_exports);
|
|
43
45
|
var import_plugin = __toESM(require("./plugin"));
|
|
44
46
|
var import_plugin2 = require("./plugin");
|
|
47
|
+
var import_review_service = require("./services/review-service");
|
|
48
|
+
var import_repository_access = require("./repository-access");
|
|
45
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
50
|
0 && (module.exports = {
|
|
47
|
-
|
|
51
|
+
GitReviewService,
|
|
52
|
+
PluginGitManagerServer,
|
|
53
|
+
hasRepositoryAccess
|
|
48
54
|
});
|