plugin-git-manager 1.2.2 → 1.2.3
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/dist/client/228.7588a0707cb3694a.js +9 -0
- package/dist/client/597.1698c0124e2f95ce.js +10 -0
- package/dist/client/906.bea20db91f34f5e6.js +10 -0
- package/dist/client/index.js +10 -1
- package/dist/externalVersion.js +15 -5
- package/dist/index.js +9 -0
- package/dist/locale/en-US.json +8 -1
- package/dist/locale/vi-VN.json +8 -1
- package/dist/server/actions/git-actions.js +43 -6
- package/dist/server/actions/gitlab-api.js +9 -0
- package/dist/server/actions/poller.js +9 -0
- package/dist/server/actions/review.js +9 -0
- package/dist/server/actions/role-permissions.js +145 -0
- package/dist/server/ai-tools.js +9 -0
- package/dist/server/collections/gitCodeReviews.js +9 -0
- package/dist/server/collections/gitRepositories.js +9 -0
- package/dist/server/collections/gitReviewFlows.js +9 -0
- package/dist/server/index.js +9 -0
- package/dist/server/migrations/20260508000000-add-auto-review-flow-id.js +9 -0
- package/dist/server/plugin.js +27 -1
- package/dist/server/poller.js +9 -0
- package/dist/server/utils/gitlab-url.js +9 -0
- package/dist/server/utils/redact.js +9 -0
- package/package.json +36 -36
- package/src/client/components/GitManagerSettings.tsx +1 -11
- package/src/client/components/RepositoryPermissions.tsx +130 -0
- package/src/client/index.tsx +36 -2
- package/src/locale/en-US.json +8 -1
- package/src/locale/vi-VN.json +8 -1
- package/src/server/__tests__/smoke.test.ts +17 -0
- package/src/server/actions/git-actions.ts +430 -430
- package/src/server/actions/role-permissions.ts +128 -0
- package/src/server/plugin.ts +46 -25
- package/dist/client/187.d5545b7cc8b90bfc.js +0 -1
- package/dist/client/ai-context.d.ts +0 -8
- package/dist/client/components/AIEmployeeSelect.d.ts +0 -13
- package/dist/client/components/CommitHistory.d.ts +0 -2
- package/dist/client/components/FileExplorer.d.ts +0 -2
- package/dist/client/components/GitManagerSettings.d.ts +0 -2
- package/dist/client/components/GitOperations.d.ts +0 -2
- package/dist/client/components/LLMModelSelect.d.ts +0 -10
- package/dist/client/components/LLMServiceSelect.d.ts +0 -9
- package/dist/client/components/MarkdownView.d.ts +0 -10
- package/dist/client/components/MergeRequests.d.ts +0 -2
- package/dist/client/components/PollingStatus.d.ts +0 -2
- package/dist/client/components/RepositoryConfig.d.ts +0 -2
- package/dist/client/components/ReviewFlows.d.ts +0 -2
- package/dist/client/components/ReviewHistory.d.ts +0 -4
- package/dist/client/components/RunReviewButton.d.ts +0 -31
- package/dist/client/context/GitManagerContext.d.ts +0 -26
- package/dist/client/index.d.ts +0 -5
- package/dist/client/locale.d.ts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/server/actions/git-actions.d.ts +0 -13
- package/dist/server/actions/gitlab-api.d.ts +0 -4
- package/dist/server/actions/poller.d.ts +0 -8
- package/dist/server/actions/review.d.ts +0 -40
- package/dist/server/ai-tools.d.ts +0 -10
- package/dist/server/collections/gitCodeReviews.d.ts +0 -2
- package/dist/server/collections/gitRepositories.d.ts +0 -2
- package/dist/server/collections/gitReviewFlows.d.ts +0 -2
- package/dist/server/index.d.ts +0 -2
- package/dist/server/migrations/20260508000000-add-auto-review-flow-id.d.ts +0 -6
- package/dist/server/plugin.d.ts +0 -12
- package/dist/server/poller.d.ts +0 -30
- package/dist/server/utils/gitlab-url.d.ts +0 -21
- package/dist/server/utils/redact.d.ts +0 -13
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type Target = {
|
|
3
|
-
type: 'mr';
|
|
4
|
-
repositoryId: number;
|
|
5
|
-
mrIid: number;
|
|
6
|
-
title?: string;
|
|
7
|
-
} | {
|
|
8
|
-
type: 'commit';
|
|
9
|
-
repositoryId: number;
|
|
10
|
-
commitSha: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
} | {
|
|
13
|
-
type: 'branch';
|
|
14
|
-
repositoryId: number;
|
|
15
|
-
branch: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Button that lets the user kick off a code review for a given target.
|
|
20
|
-
* Two paths:
|
|
21
|
-
* - "Run review" → POST gitManager:triggerReview (server-side, async)
|
|
22
|
-
* - "Open chat" → call (aiClient as any).useChatBoxActions?.() || {}.triggerTask if plugin-ai is loaded,
|
|
23
|
-
* so the user can chat with the AI employee using the same context.
|
|
24
|
-
*/
|
|
25
|
-
export declare const RunReviewButton: React.FC<{
|
|
26
|
-
target: Target;
|
|
27
|
-
size?: 'small' | 'middle' | 'large';
|
|
28
|
-
type?: 'default' | 'primary' | 'link';
|
|
29
|
-
onTriggered?: (reviewId: number) => void;
|
|
30
|
-
}>;
|
|
31
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface Repository {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
repoUrl: string;
|
|
6
|
-
localPath: string;
|
|
7
|
-
defaultBranch: string;
|
|
8
|
-
status: string;
|
|
9
|
-
autoReview?: boolean;
|
|
10
|
-
autoReviewFlowId?: number | null;
|
|
11
|
-
}
|
|
12
|
-
interface GitManagerContextType {
|
|
13
|
-
repos: Repository[];
|
|
14
|
-
selectedRepo: Repository | null;
|
|
15
|
-
loading: boolean;
|
|
16
|
-
branches: string[];
|
|
17
|
-
currentBranch: string;
|
|
18
|
-
setSelectedRepo: (repo: Repository | null) => void;
|
|
19
|
-
refreshRepos: () => Promise<void>;
|
|
20
|
-
refreshBranches: () => Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
export declare function useGitManager(): GitManagerContextType;
|
|
23
|
-
export declare const GitManagerProvider: React.FC<{
|
|
24
|
-
children: React.ReactNode;
|
|
25
|
-
}>;
|
|
26
|
-
export {};
|
package/dist/client/index.d.ts
DELETED
package/dist/client/locale.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
export declare function clone(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
3
|
-
export declare function pull(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
4
|
-
export declare function push(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
5
|
-
export declare function fetch(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
6
|
-
export declare function diff(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
7
|
-
export declare function status(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
8
|
-
export declare function log(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
9
|
-
export declare function branches(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
10
|
-
export declare function checkout(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
11
|
-
export declare function fileTree(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
12
|
-
export declare function fileContent(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
13
|
-
export declare function commitDetail(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
export declare function mergeRequests(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
3
|
-
export declare function mergeRequestDetail(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
4
|
-
export declare function mergeRequestNotes(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
/**
|
|
3
|
-
* Manually trigger a poll cycle. If repositoryId is provided, only that repo
|
|
4
|
-
* is polled (regardless of its autoReview flag). Otherwise polls all repos
|
|
5
|
-
* with autoReview=true.
|
|
6
|
-
*/
|
|
7
|
-
export declare function pollNow(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
8
|
-
export declare function pollerStatus(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
import type { Application } from '@nocobase/server';
|
|
3
|
-
export declare const WORKER_JOB_GIT_REVIEW_PROCESS = "git-review:process";
|
|
4
|
-
interface TriggerArgs {
|
|
5
|
-
flowId?: number | null;
|
|
6
|
-
repositoryId: number;
|
|
7
|
-
targetType: 'mr' | 'commit' | 'branch';
|
|
8
|
-
mrIid?: number | null;
|
|
9
|
-
commitSha?: string | null;
|
|
10
|
-
branch?: string | null;
|
|
11
|
-
headSha?: string | null;
|
|
12
|
-
extraInstructions?: string;
|
|
13
|
-
triggeredBy?: 'manual' | 'poll';
|
|
14
|
-
userId?: number | string | null;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Trigger an AI-driven code review for an MR / commit / branch.
|
|
18
|
-
* The review record is upserted synchronously, then queued for an available
|
|
19
|
-
* git-review worker. The action returns immediately with the reviewId.
|
|
20
|
-
*/
|
|
21
|
-
export declare function triggerReview(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Programmatic entry point — used by manual action and by the poller.
|
|
24
|
-
* Returns the reviewId of the upserted record.
|
|
25
|
-
*/
|
|
26
|
-
export declare function triggerReviewInternal(app: Application, args: TriggerArgs): Promise<number>;
|
|
27
|
-
export declare function registerReviewQueue(app: Application): void;
|
|
28
|
-
export declare function unregisterReviewQueue(app: Application): void;
|
|
29
|
-
/**
|
|
30
|
-
* Mark a review as approved and post its content to GitLab as an MR note.
|
|
31
|
-
*/
|
|
32
|
-
export declare function reviewApprovePost(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Reject a pending review (do not post to GitLab).
|
|
35
|
-
*/
|
|
36
|
-
export declare function reviewReject(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
37
|
-
export declare function branchMatches(flow: any, branch: string): boolean;
|
|
38
|
-
export declare function pickFlowMatchingBranch(flows: any[], branch?: string): any | null;
|
|
39
|
-
export declare function recoverStuckReviews(app: Application): Promise<number>;
|
|
40
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Application } from '@nocobase/server';
|
|
2
|
-
/**
|
|
3
|
-
* Register AI tools that allow an AI employee to inspect git repositories,
|
|
4
|
-
* merge requests, commits, and file content during a review session.
|
|
5
|
-
*
|
|
6
|
-
* Each tool is invoked by the AI runtime; the `invoke` callback constructs a
|
|
7
|
-
* synthetic `ctx.action.params` payload then delegates to the existing
|
|
8
|
-
* resource action implementation.
|
|
9
|
-
*/
|
|
10
|
-
export declare function registerGitReviewAiTools(app: Application): void;
|
package/dist/server/index.d.ts
DELETED
package/dist/server/plugin.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@nocobase/server';
|
|
2
|
-
export declare class PluginGitManagerServer extends Plugin {
|
|
3
|
-
app: any;
|
|
4
|
-
db: any;
|
|
5
|
-
beforeLoad(): Promise<void>;
|
|
6
|
-
load(): Promise<void>;
|
|
7
|
-
install(): Promise<void>;
|
|
8
|
-
beforeDisable(): Promise<void>;
|
|
9
|
-
beforeUnload(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export declare function ensureAutoReviewFlowSchema(app: any): Promise<void>;
|
|
12
|
-
export default PluginGitManagerServer;
|
package/dist/server/poller.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Application } from '@nocobase/server';
|
|
2
|
-
/**
|
|
3
|
-
* Start the background poller. Idempotent — calling twice is a no-op.
|
|
4
|
-
* The poller scans repos with autoReview=true, lists their open MRs from GitLab,
|
|
5
|
-
* and triggers a review if no record exists for the MR's current head SHA.
|
|
6
|
-
*/
|
|
7
|
-
export declare function startPoller(app: Application): void;
|
|
8
|
-
export declare function stopPoller(): void;
|
|
9
|
-
export declare function getPollerStatus(): {
|
|
10
|
-
running: boolean;
|
|
11
|
-
polling: boolean;
|
|
12
|
-
lastTickAt: string;
|
|
13
|
-
lastError: string;
|
|
14
|
-
intervalSec: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Run one poll cycle for all auto-enabled repos. Public so that the
|
|
18
|
-
* gitManager:pollNow action can force a tick on demand.
|
|
19
|
-
*/
|
|
20
|
-
export declare function pollAllRepos(app: Application): Promise<{
|
|
21
|
-
scanned: number;
|
|
22
|
-
triggered: number;
|
|
23
|
-
}>;
|
|
24
|
-
/**
|
|
25
|
-
* Poll a single repo for MR changes. Returns counts.
|
|
26
|
-
*/
|
|
27
|
-
export declare function pollOneRepo(app: Application, repo: any): Promise<{
|
|
28
|
-
scanned: number;
|
|
29
|
-
triggered: number;
|
|
30
|
-
}>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utility for parsing GitLab repository URLs.
|
|
3
|
-
* Extracted to avoid duplicating URL-parsing logic across
|
|
4
|
-
* gitlab-api.ts, poller.ts, and review.ts.
|
|
5
|
-
*/
|
|
6
|
-
export interface GitLabProject {
|
|
7
|
-
/** Full API base URL, e.g. https://gitlab.com/api/v4 */
|
|
8
|
-
apiBase: string;
|
|
9
|
-
/** Raw project path, e.g. group/sub/project */
|
|
10
|
-
projectPath: string;
|
|
11
|
-
/** URL-encoded project path for use in API endpoints */
|
|
12
|
-
encodedProject: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Extract GitLab API base URL and project path from a repository URL.
|
|
16
|
-
* Supports: https://gitlab.com/group/project.git
|
|
17
|
-
* https://self-hosted.gitlab.com/group/sub/project.git
|
|
18
|
-
*
|
|
19
|
-
* @throws Error if the URL cannot be parsed or has no project path
|
|
20
|
-
*/
|
|
21
|
-
export declare function parseGitLabProject(repoUrl: string): GitLabProject;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redact embedded credentials from URLs in arbitrary strings.
|
|
3
|
-
* Matches `scheme://user:password@host` and replaces with `scheme://***:***@host`.
|
|
4
|
-
* Used to scrub error messages before persisting them to the DB or
|
|
5
|
-
* returning them to the client, since simple-git often echoes the
|
|
6
|
-
* authenticated remote URL in stderr.
|
|
7
|
-
*/
|
|
8
|
-
export declare function redactPat(s: unknown): string;
|
|
9
|
-
/**
|
|
10
|
-
* Mutate `err.message` (and common fields where simple-git stashes stderr)
|
|
11
|
-
* to remove any embedded PAT before the error propagates further.
|
|
12
|
-
*/
|
|
13
|
-
export declare function redactError<T>(err: T): T;
|