@catladder/cli 3.14.1 → 3.15.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/dist/bundles/catenv/index.js +3 -3
- package/dist/bundles/cli/index.js +18 -18
- package/dist/pipeline/src/pipeline/agent/createAgentContext.d.ts +18 -1
- package/dist/pipeline/src/pipeline/agent/createAgentContext.js +39 -13
- package/dist/pipeline/src/pipeline/agent/createAgentContext.js.map +1 -1
- package/dist/pipeline/src/pipeline/agent/createAgentReviewJob.js +16 -1
- package/dist/pipeline/src/pipeline/agent/createAgentReviewJob.js.map +1 -1
- package/dist/pipeline/src/pipeline/agent/prompts.d.ts +2 -2
- package/dist/pipeline/src/pipeline/agent/prompts.js +187 -117
- package/dist/pipeline/src/pipeline/agent/prompts.js.map +1 -1
- package/dist/pipeline/src/pipeline/agent/shared.js +1 -1
- package/dist/pipeline/src/pipeline/agent/shared.js.map +1 -1
- package/dist/pipeline/src/types/agent.d.ts +9 -0
- package/dist/pipeline/src/types/context.d.ts +1 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { Config } from "../../types";
|
|
2
|
-
|
|
2
|
+
export declare class AgentContext {
|
|
3
|
+
private readonly agentName;
|
|
4
|
+
private readonly config;
|
|
5
|
+
constructor(agentName: string, config: Config);
|
|
6
|
+
readonly type = "agent";
|
|
7
|
+
get name(): string;
|
|
8
|
+
get agentConfig(): import("../../types").AgentConfig;
|
|
9
|
+
get agentUser(): {
|
|
10
|
+
username: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
};
|
|
13
|
+
get reviews(): {
|
|
14
|
+
byUser: Record<string, {
|
|
15
|
+
automatic: boolean;
|
|
16
|
+
}> | "all-automatic";
|
|
17
|
+
};
|
|
18
|
+
get fullConfig(): Config;
|
|
19
|
+
}
|
|
3
20
|
export declare const createAgentContext: (ctx: {
|
|
4
21
|
agentName: string;
|
|
5
22
|
config: Config;
|
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAgentContext = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.createAgentContext = exports.AgentContext = void 0;
|
|
4
|
+
class AgentContext {
|
|
5
|
+
constructor(agentName, config) {
|
|
6
|
+
this.agentName = agentName;
|
|
7
|
+
this.config = config;
|
|
8
|
+
this.type = "agent";
|
|
9
|
+
}
|
|
10
|
+
get name() {
|
|
11
|
+
return this.agentName;
|
|
12
|
+
}
|
|
13
|
+
get agentConfig() {
|
|
14
|
+
var _a;
|
|
15
|
+
const agentConfig = (_a = this.config.agents) === null || _a === void 0 ? void 0 : _a[this.agentName];
|
|
16
|
+
if (!agentConfig) {
|
|
17
|
+
throw new Error(`Agent ${this.agentName} not found in config`);
|
|
18
|
+
}
|
|
19
|
+
return agentConfig;
|
|
20
|
+
}
|
|
21
|
+
get agentUser() {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
return {
|
|
24
|
+
username: (_b = (_a = this.agentConfig.agentUser) === null || _a === void 0 ? void 0 : _a.username) !== null && _b !== void 0 ? _b : "agent.claude",
|
|
25
|
+
userId: (_d = (_c = this.agentConfig.agentUser) === null || _c === void 0 ? void 0 : _c.userId) !== null && _d !== void 0 ? _d : "$DEFAULT_AGENT_USER_ID",
|
|
26
|
+
};
|
|
9
27
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
get reviews() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return {
|
|
31
|
+
byUser: (_b = (_a = this.agentConfig.reviews) === null || _a === void 0 ? void 0 : _a.byUser) !== null && _b !== void 0 ? _b : {
|
|
32
|
+
[this.agentUser.username]: { automatic: true },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get fullConfig() {
|
|
37
|
+
return this.config;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.AgentContext = AgentContext;
|
|
41
|
+
const createAgentContext = async (ctx) => {
|
|
42
|
+
return new AgentContext(ctx.agentName, ctx.config);
|
|
17
43
|
};
|
|
18
44
|
exports.createAgentContext = createAgentContext;
|
|
19
45
|
//# sourceMappingURL=createAgentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAgentContext.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/createAgentContext.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"createAgentContext.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/createAgentContext.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IACvB,YACmB,SAAiB,EACjB,MAAc;QADd,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAQ;QAGjB,SAAI,GAAG,OAAO,CAAC;IAF5B,CAAC;IAIJ,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,WAAW;;QACb,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,MAAM,0CAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,SAAS,sBAAsB,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,SAAS;;QACX,OAAO;YACL,QAAQ,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,CAAC,SAAS,0CAAE,QAAQ,mCAAI,cAAc;YAChE,MAAM,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,CAAC,SAAS,0CAAE,MAAM,mCAAI,wBAAwB;SACvE,CAAC;IACJ,CAAC;IAED,IAAI,OAAO;;QACT,OAAO;YACL,MAAM,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,CAAC,OAAO,0CAAE,MAAM,mCAAI;gBAC1C,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;aAC/C;SACF,CAAC;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAtCD,oCAsCC;AAEM,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAGxC,EAAE,EAAE;IACH,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AALW,QAAA,kBAAkB,sBAK7B"}
|
|
@@ -8,13 +8,28 @@ const utils_1 = require("./utils");
|
|
|
8
8
|
const createAgentReviewJob = (context) => {
|
|
9
9
|
const baseJob = (0, shared_1.createBaseAgentJob)(context);
|
|
10
10
|
const agentUserName = (0, utils_1.getAgentUserName)(context);
|
|
11
|
+
const rules = context.reviews.byUser === "all-automatic"
|
|
12
|
+
? [
|
|
13
|
+
{
|
|
14
|
+
...rules_1.RULE_IS_MERGE_REQUEST,
|
|
15
|
+
when: "always",
|
|
16
|
+
},
|
|
17
|
+
]
|
|
18
|
+
: Object.entries(context.reviews.byUser)
|
|
19
|
+
.filter(([_, { automatic }]) => automatic)
|
|
20
|
+
.map(([username]) => ({
|
|
21
|
+
// GITLAB_USER_LOGIN is the username of the user who created the pipeline
|
|
22
|
+
if: `${rules_1.RULE_IS_MERGE_REQUEST.if} && $GITLAB_USER_LOGIN == "${username}"`,
|
|
23
|
+
when: "always",
|
|
24
|
+
}));
|
|
11
25
|
return {
|
|
12
26
|
...baseJob,
|
|
13
27
|
name: context.name + "-agent-review",
|
|
14
28
|
rules: [
|
|
29
|
+
...rules,
|
|
15
30
|
{
|
|
16
31
|
...rules_1.RULE_IS_MERGE_REQUEST,
|
|
17
|
-
when: "
|
|
32
|
+
when: "manual",
|
|
18
33
|
},
|
|
19
34
|
{
|
|
20
35
|
when: "never",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAgentReviewJob.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/createAgentReviewJob.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AAEpD,uCAAkD;AAClD,qCAA2E;AAC3E,mCAA2C;AAEpC,MAAM,oBAAoB,GAAG,CAAC,OAAqB,EAAgB,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAC;IAE5C,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"createAgentReviewJob.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/createAgentReviewJob.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AAEpD,uCAAkD;AAClD,qCAA2E;AAC3E,mCAA2C;AAEpC,MAAM,oBAAoB,GAAG,CAAC,OAAqB,EAAgB,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAC;IAE5C,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAC;IAEhD,MAAM,KAAK,GACT,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,eAAe;QACxC,CAAC,CAAC;YACE;gBACE,GAAG,6BAAqB;gBACxB,IAAI,EAAE,QAAQ;aACf;SACF;QACH,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;aACnC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC;aACzC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,yEAAyE;YACzE,EAAE,EAAE,GAAG,6BAAqB,CAAC,EAAE,8BAA8B,QAAQ,GAAG;YACxE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CAAC;IAEZ,OAAO;QACL,GAAG,OAAO;QACV,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG,eAAe;QAEpC,KAAK,EAAE;YACL,GAAG,KAAK;YACR;gBACE,GAAG,6BAAqB;gBACxB,IAAI,EAAE,QAAQ;aACf;YACD;gBACE,IAAI,EAAE,OAAO;aACd;SACF;QACD,MAAM,EAAE;YACN,GAAG,wBAAe;YAClB,GAAG,IAAA,mBAAU,EAAC;gBACZ,MAAM,EAAE,IAAA,+BAAqB,EAAC;oBAC5B,aAAa,EAAE,aAAa;iBAC7B,CAAC;aACH,CAAC;SACH;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,oBAAoB,wBA4C/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type Ctx = {
|
|
2
2
|
agentUserName: string;
|
|
3
3
|
};
|
|
4
|
-
export declare const getEventPrompt: (
|
|
5
|
-
export declare const getMergeRequestPrompt: (
|
|
4
|
+
export declare const getEventPrompt: (ctx: Ctx) => string;
|
|
5
|
+
export declare const getMergeRequestPrompt: (ctx: Ctx) => string;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// prompts.ts — MCP-only, DRY, review-first-then-push, CI logic, self-mention guard,
|
|
3
|
+
// event prompt supports review-on-demand via manual "agent-review" job or fallback MR review.
|
|
4
|
+
// Prevents double-runs: event-triggered work cancels any running "agent-review" job on the same MR.
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getMergeRequestPrompt = exports.getEventPrompt = void 0;
|
|
7
|
+
/* ---------- Shared blocks ---------- */
|
|
4
8
|
const header = () => `
|
|
5
9
|
Project ID: $CI_PROJECT_ID
|
|
6
10
|
GitLab Host: $CI_SERVER_URL
|
|
@@ -11,84 +15,84 @@ const identity = ({ agentUserName }) => `
|
|
|
11
15
|
`;
|
|
12
16
|
const goldenRules = ({ agentUserName }) => `
|
|
13
17
|
## Golden Rules
|
|
14
|
-
- Use the \`gitlab-mcp\` tool for ALL GitLab actions.
|
|
15
|
-
-
|
|
18
|
+
- Use the \`gitlab-mcp\` tool for ALL GitLab actions. Do not call any other APIs.
|
|
19
|
+
- If a needed \`gitlab-mcp\` capability is unavailable, post a short comment explaining the limitation and stop.
|
|
20
|
+
- NEVER mention yourself ("@${agentUserName}") anywhere (comments, descriptions, titles, commit messages).
|
|
16
21
|
- NEVER push to main/default or any protected branch. Always create a new branch and open a Merge Request (MR).
|
|
22
|
+
- Always assign yourself as the assignee of any MR you create.
|
|
17
23
|
- Do not create an MR for a **closed** issue.
|
|
18
24
|
- Keep actions minimal and idempotent. Avoid duplicate comments or duplicate MRs.
|
|
19
25
|
- Use ONE stable \`source_branch\` per run; do not regenerate its name later.
|
|
20
26
|
`;
|
|
27
|
+
const selfMentionGuard = ({ agentUserName }) => `
|
|
28
|
+
## Self-mention Guard (mandatory preflight for ALL writes)
|
|
29
|
+
Before ANY call that writes text (comment/create/update MR/issue/commit message), sanitize the text:
|
|
30
|
+
|
|
31
|
+
- Remove all occurrences of your own handle:
|
|
32
|
+
- Match case-insensitively: \`/@?${agentUserName}\\b/gi\`
|
|
33
|
+
- Also strip variants inside parentheses or brackets if present.
|
|
34
|
+
- Do NOT replace with another token; simply remove the self @-mention.
|
|
35
|
+
- If after sanitization the body becomes empty/meaningless, skip the write.
|
|
36
|
+
|
|
37
|
+
Additionally:
|
|
38
|
+
- If the last actor/author of the target item is you ("${agentUserName}"), **do not** post an acknowledgement comment (avoid loops on your own events).
|
|
39
|
+
- To assign yourself, use the MCP assignee field(s). Do **not** mention yourself in the body to indicate assignment.
|
|
40
|
+
`;
|
|
21
41
|
const commentGuidelines = () => `
|
|
22
42
|
## Comment Guidelines (flexible, not verbatim)
|
|
23
|
-
-
|
|
43
|
+
- Professional, friendly, concise.
|
|
24
44
|
- Always @-mention the human author when replying; never mention yourself.
|
|
25
45
|
- Acknowledgements: confirm you saw the request and you’ll handle it.
|
|
26
46
|
- MR updates: acknowledge feedback and say you’ll apply/have applied the change.
|
|
27
47
|
- Q&A: answer directly first; add context/links only if useful.
|
|
28
48
|
- Avoid repeating identical boilerplate across comments.
|
|
29
49
|
`;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
/* Exact tool names from @zereight/mcp-gitlab (lean, indicative signatures) */
|
|
51
|
+
const mcpOnly = () => `
|
|
52
|
+
## gitlab-mcp Operations (exact tool names; indicative params)
|
|
33
53
|
|
|
34
|
-
- **Comments**
|
|
35
|
-
-
|
|
54
|
+
- **Comments / Notes**
|
|
55
|
+
- create_note({ projectId, targetType: "issue"|"merge_request", iid, body })
|
|
56
|
+
- create_issue_note({ projectId, issueIid, body })
|
|
57
|
+
- create_merge_request_note({ projectId, mergeRequestIid, body })
|
|
58
|
+
- update_issue_note({ projectId, issueIid, noteId, body })
|
|
59
|
+
- update_merge_request_note({ projectId, mergeRequestIid, noteId, body })
|
|
60
|
+
- mr_discussions({ projectId, mergeRequestIid })
|
|
36
61
|
|
|
37
|
-
- **
|
|
38
|
-
-
|
|
62
|
+
- **Issues**
|
|
63
|
+
- create_issue({ projectId, title, description, assigneeUsernames?: string[] })
|
|
64
|
+
- list_issues({ projectId, state?: "opened"|"closed", scope?: "all"|... })
|
|
39
65
|
|
|
40
|
-
- **
|
|
41
|
-
-
|
|
66
|
+
- **Branch & Files**
|
|
67
|
+
- create_branch({ projectId, branchName, ref }) // ref = default branch or SHA
|
|
68
|
+
- push_files({ projectId, branch, commitMessage, files: [{ filePath, content }] })
|
|
69
|
+
- create_or_update_file({ projectId, branch, filePath, content, commitMessage })
|
|
70
|
+
- get_file_contents({ projectId, ref, path })
|
|
71
|
+
- get_branch_diffs({ projectId, from, to }) // compare refs
|
|
42
72
|
|
|
43
73
|
- **Merge Requests**
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
Use the environment variable \`GITLAB_PERSONAL_ACCESS_TOKEN\`.
|
|
59
|
-
Send it in the HTTP header:
|
|
60
|
-
\`\`\`
|
|
61
|
-
Private-Token: $GITLAB_PERSONAL_ACCESS_TOKEN
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
- **Host & project variables**
|
|
65
|
-
- API base URL: \`$CI_SERVER_URL/api/v4\`
|
|
66
|
-
- Project ID: \`$CI_PROJECT_ID\`
|
|
67
|
-
|
|
68
|
-
- **Examples**
|
|
69
|
-
- Get project (default branch):
|
|
70
|
-
\`GET $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID\`
|
|
71
|
-
- Get/create branch:
|
|
72
|
-
\`GET|POST $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/repository/branches\`
|
|
73
|
-
- Compare refs:
|
|
74
|
-
\`GET $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/repository/compare?from=<default>&to=<source>\`
|
|
75
|
-
- List commits:
|
|
76
|
-
\`GET $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/repository/commits?ref_name=<branch>&per_page=1\`
|
|
77
|
-
- Create comment on issue/MR:
|
|
78
|
-
\`POST $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/issues/:iid/notes\`
|
|
79
|
-
\`POST $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/merge_requests/:iid/notes\`
|
|
80
|
-
- Create MR:
|
|
81
|
-
\`POST $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/merge_requests\`
|
|
82
|
-
- Get MR changes:
|
|
83
|
-
\`GET $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/merge_requests/:iid/changes\`
|
|
74
|
+
- create_merge_request({ projectId, sourceBranch, targetBranch, title, description, assigneeUsernames?: string[] })
|
|
75
|
+
- get_merge_request({ projectId, mergeRequestIid? , branchName? })
|
|
76
|
+
- get_merge_request_diffs({ projectId, mergeRequestIid? , branchName? })
|
|
77
|
+
- list_merge_request_diffs({ projectId, mergeRequestIid? , branchName?, page?, perPage? })
|
|
78
|
+
- update_merge_request({ projectId, mergeRequestIid? , branchName?, title?, description?, draft?, assigneeUsernames? })
|
|
79
|
+
- merge_merge_request(...) // **Do NOT use** (never merge)
|
|
80
|
+
|
|
81
|
+
- **Pipelines / Jobs** (requires env USE_PIPELINE=true)
|
|
82
|
+
- list_pipeline_jobs({ projectId, pipelineId })
|
|
83
|
+
- get_pipeline_job_output({ projectId, pipelineId, jobId })
|
|
84
|
+
- retry_pipeline({ projectId, pipelineId })
|
|
85
|
+
- retry_pipeline_job({ projectId, jobId })
|
|
86
|
+
- play_pipeline_job({ projectId, jobId })
|
|
87
|
+
- cancel_pipeline_job({ projectId, jobId })
|
|
84
88
|
`;
|
|
85
89
|
const outputDiscipline = ({ agentUserName }) => `
|
|
86
90
|
## Output Discipline
|
|
87
|
-
-
|
|
91
|
+
- Output only \`gitlab-mcp\` tool calls and plain-text summaries where requested.
|
|
88
92
|
- Keep comments concise and professional.
|
|
89
93
|
- Never include "@${agentUserName}" in any body.
|
|
90
94
|
`;
|
|
91
|
-
|
|
95
|
+
/* ---------- Event (webhook) specific ---------- */
|
|
92
96
|
const eventSelfParse = () => `
|
|
93
97
|
## Self-Parse the Raw Payload (no preprocessing available)
|
|
94
98
|
From \`event_json\`, extract:
|
|
@@ -98,37 +102,84 @@ From \`event_json\`, extract:
|
|
|
98
102
|
- \`/-/merge_requests/<n>\` → target="mr", iid=<n>
|
|
99
103
|
- note_id if present (\`#note_<id>\`)
|
|
100
104
|
- description/body text, state, author \`user_username\`, timestamps
|
|
101
|
-
- project id/path; detect default branch via
|
|
105
|
+
- project id/path; detect default branch via \`get_merge_request\`/context as needed
|
|
102
106
|
|
|
103
107
|
If any key is missing, choose the safest minimal action or briefly explain via a comment.
|
|
104
108
|
`;
|
|
105
|
-
|
|
109
|
+
// NEW: Single-runner guard (event-triggered → existing MR)
|
|
110
|
+
const singleRunnerGuard = () => `
|
|
111
|
+
## Single-Runner Guard (event-triggered work on an existing MR)
|
|
112
|
+
Before entering MR Review Mode from an event:
|
|
113
|
+
|
|
114
|
+
- **Goal:** Avoid two agents working the same MR. If a **running or pending** CI job whose name **ends with "agent-review"** is active for this MR, **cancel** it first.
|
|
115
|
+
|
|
116
|
+
**Best-effort procedure (MCP-only):**
|
|
117
|
+
1) If \`$CI_PIPELINE_ID\` is available (this event is executing inside a CI context for the same MR):
|
|
118
|
+
- Call \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: $CI_PIPELINE_ID })\`.
|
|
119
|
+
- Identify any job where \`status\` is \`"running"\` or \`"pending"\` **and** \`name\` **endsWith** \`"agent-review"\`.
|
|
120
|
+
- For each match, call \`cancel_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
121
|
+
- Proceed with review immediately after issuing cancellations (do not wait).
|
|
122
|
+
|
|
123
|
+
2) If \`$CI_PIPELINE_ID\` is **not** available, or jobs for this MR cannot be listed with available MCP calls:
|
|
124
|
+
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing capabilities.
|
|
125
|
+
- Proceed with review.
|
|
126
|
+
|
|
127
|
+
**Notes:**
|
|
128
|
+
- Keep this guard **idempotent** (safe to run multiple times).
|
|
129
|
+
- This guard only applies to **event-triggered** flows that decide to act on an **existing MR**.
|
|
130
|
+
`;
|
|
131
|
+
const reviewOnDemandFromEvents = () => `
|
|
132
|
+
## Review-on-Demand (from events)
|
|
133
|
+
If the issue/note text **asks for a review** (case-insensitive tokens like: "review", "please review", "PTAL", "needs review", "can you look at", "LGTM?"), then:
|
|
134
|
+
|
|
135
|
+
1) **Check for pipeline review job**
|
|
136
|
+
- List jobs for the current pipeline \`$CI_PIPELINE_ID\` via \`list_pipeline_jobs\`.
|
|
137
|
+
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
138
|
+
- Trigger it via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
139
|
+
- Post a short comment confirming you triggered the review job (sanitize).
|
|
140
|
+
- **Stop** further review actions.
|
|
141
|
+
|
|
142
|
+
2) **If no such job exists, resolve which MR to review**:
|
|
143
|
+
- If the event target is an MR → use its \`iid\`.
|
|
144
|
+
- Else, parse the text for MR references in order:
|
|
145
|
+
- \`!<iid>\` (e.g., \`!123\`)
|
|
146
|
+
- \`/-/merge_requests/<iid>\` in a path or URL
|
|
147
|
+
- full GitLab MR URL
|
|
148
|
+
- If no MR can be resolved, reply with a brief comment asking the user to reference an MR (sanitize) and **stop**.
|
|
149
|
+
|
|
150
|
+
3) **Single-Runner Guard (cancel any running "agent-review" job)** // NEW: Single-runner guard
|
|
151
|
+
- Execute the **Single-Runner Guard** steps above **before** MR Review Mode.
|
|
152
|
+
|
|
153
|
+
4) **Enter MR Review Mode**: execute the **MR Review Bundle** below with the resolved \`mr_iid\`.
|
|
154
|
+
`;
|
|
155
|
+
/** Regular event workflow for non-review work */
|
|
156
|
+
const eventWorkflow = ({ agentUserName }) => `
|
|
106
157
|
## High-Reliability Workflow (sequence + postconditions)
|
|
107
158
|
Follow this order for any change work:
|
|
108
159
|
|
|
109
|
-
1) **Acknowledge** with a short comment on the issue/MR thread
|
|
110
|
-
2) **Discover default branch** (e.g., "main")
|
|
111
|
-
3) **Create a working branch** from default (stable name, e.g., \`fix/issue-<iid>-<slug>\` or \`feat/issue-<iid>-<slug>\`)
|
|
112
|
-
4) **Write changes → commit → push to remote branch
|
|
160
|
+
1) **Acknowledge** with a short comment on the issue/MR thread (\`create_note\`), **unless the last actor is you**.
|
|
161
|
+
2) **Discover default branch** (e.g., "main") — infer from repo/MR context if needed.
|
|
162
|
+
3) **Create a working branch** from default (stable name, e.g., \`fix/issue-<iid>-<slug>\` or \`feat/issue-<iid>-<slug>\`) via \`create_branch\`.
|
|
163
|
+
4) **Write changes → commit → push to remote branch** via \`push_files\` (or \`create_or_update_file\`).
|
|
113
164
|
5) **Verify push landed**:
|
|
114
|
-
- Fetch latest
|
|
115
|
-
- Compare default vs \`source_branch\` and ensure
|
|
116
|
-
6) **Create or update MR** ONLY if there is a non-empty diff
|
|
165
|
+
- Fetch latest state (optional: \`get_file_contents\`/log) and capture a short SHA from the branch head if exposed by the host.
|
|
166
|
+
- Compare default vs \`source_branch\` via \`get_branch_diffs({ from: "<default>", to: "<source>" })\` and ensure there are diffs.
|
|
167
|
+
6) **Create or update MR** ONLY if there is a non-empty diff via \`create_merge_request\`.
|
|
117
168
|
- Include \`Closes #<issue_iid>\` in MR description when applicable.
|
|
118
|
-
- Assign
|
|
119
|
-
7) **Follow-up comment** with branch name, commit short SHA, files changed count, and MR link
|
|
169
|
+
- **Assign the MR to yourself**: \`assigneeUsernames: ["${agentUserName}"]\`.
|
|
170
|
+
7) **Follow-up comment** with branch name, any commit short SHA you can obtain, files changed count (approx by diffs), and MR link via \`create_note\`, **unless the last actor is you**.
|
|
120
171
|
8) **If verification fails**:
|
|
121
172
|
- Do NOT create the MR.
|
|
122
173
|
- Comment the exact failure and retry once with a fresh branch name. If still failing, comment and stop.
|
|
123
174
|
|
|
124
|
-
For Q&A-only (no code changes), just post a concise, helpful answer on the same issue/MR.
|
|
175
|
+
For Q&A-only (no code changes), just post a concise, helpful answer on the same issue/MR (sanitize first).
|
|
125
176
|
`;
|
|
126
|
-
|
|
177
|
+
/* ---------- MR-review specific (shared with both prompts) ---------- */
|
|
127
178
|
const mrScope = ({ agentUserName }) => `
|
|
128
179
|
## Identity & Scope
|
|
129
180
|
- Your GitLab username is "${agentUserName}".
|
|
130
|
-
- This prompt runs in the context of ONE MR
|
|
131
|
-
- You may review, comment,
|
|
181
|
+
- This prompt runs in the context of ONE MR.
|
|
182
|
+
- You may review, comment, and push updates **to the MR's source branch**.
|
|
132
183
|
- You must **never merge** the MR yourself.
|
|
133
184
|
`;
|
|
134
185
|
const mrWorkflow = () => `
|
|
@@ -136,44 +187,66 @@ const mrWorkflow = () => `
|
|
|
136
187
|
Follow this sequence with verification at each step:
|
|
137
188
|
|
|
138
189
|
1) **Collect context**
|
|
139
|
-
- Get MR metadata (
|
|
140
|
-
- Fetch the full changeset/diffs and open discussions
|
|
141
|
-
- Read existing
|
|
142
|
-
- (Optional) Fetch recent CI pipeline(s) for this MR SHA/branch).
|
|
190
|
+
- Get MR metadata via \`get_merge_request({ projectId: $CI_PROJECT_ID, mergeRequestIid })\`.
|
|
191
|
+
- Fetch the full changeset/diffs via \`get_merge_request_diffs\` (or \`list_merge_request_diffs\`) and open discussions via \`mr_discussions\`.
|
|
192
|
+
- Read existing notes to avoid duplication.
|
|
143
193
|
|
|
144
194
|
2) **Code review**
|
|
145
195
|
- Identify required changes (bugs, tests, style, security, perf, docs).
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
- **Push** to the MR's **
|
|
155
|
-
- **Verify push landed** (
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
196
|
+
- Always **post your review comments first** using \`create_merge_request_note\` (ack + concrete notes). Sanitize before sending.
|
|
197
|
+
- Set an internal intent flag:
|
|
198
|
+
- \`will_push_changes = true\` if you will modify code/config.
|
|
199
|
+
- \`will_push_changes = false\` if it’s commentary-only.
|
|
200
|
+
|
|
201
|
+
3) **Implement changes after review is posted (only if \`will_push_changes = true\`)**
|
|
202
|
+
- If needed, create the working branch from the target/default (or use existing MR source branch).
|
|
203
|
+
- Apply minimal, safe changes; keep commits small and clear.
|
|
204
|
+
- **Push** to the MR's **source branch** via \`push_files\` (or \`create_or_update_file\`).
|
|
205
|
+
- **Verify push landed** using \`get_branch_diffs({ from: "<target_branch>", to: "<source_branch>" })\` and ensure there are diffs.
|
|
206
|
+
- Post a follow-up MR note summarizing what changed and why (sanitize).
|
|
207
|
+
`;
|
|
208
|
+
const ciInspection = () => `
|
|
209
|
+
4) **CI jobs (current pipeline focus: diagnose first, retry only when useful)**
|
|
210
|
+
- Inspect jobs for the **current pipeline**: \`$CI_PIPELINE_ID\` via \`list_pipeline_jobs\`.
|
|
211
|
+
- Consider **only** jobs with \`status = "failed"\` and \`allow_failure = false\`.
|
|
212
|
+
- For each such job:
|
|
213
|
+
1. Retrieve details (id, name, stage, status, allow_failure, web_url).
|
|
214
|
+
2. Fetch job output via \`get_pipeline_job_output({ projectId: $CI_PROJECT_ID, pipelineId: $CI_PIPELINE_ID, jobId })\`.
|
|
215
|
+
3. **Classify the failure**:
|
|
216
|
+
- **Code-related (do not retry):** compiler/type/lint/test/build script errors.
|
|
217
|
+
- **Likely transient (may retry):** network/timeouts/infra/cache/artifacts/5xx/429/etc.
|
|
218
|
+
4. **Decision**:
|
|
219
|
+
- If \`will_push_changes = true\`:
|
|
220
|
+
- **Do not retry** current pipeline (upcoming push will trigger a new one).
|
|
221
|
+
- Post an MR note: brief diagnosis per failed job; note a new pipeline will validate the fix (sanitize).
|
|
222
|
+
- If \`will_push_changes = false\`:
|
|
223
|
+
- If transient ⇒ \`retry_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\` (or \`retry_pipeline\` if job-level retry not available).
|
|
224
|
+
Post a note stating you retried and why (sanitize).
|
|
225
|
+
- If code-related ⇒ do not retry; post a note with diagnosis and suggested fix (sanitize).
|
|
226
|
+
- Retry-once policy: at most **one** retry per job in this run.
|
|
162
227
|
|
|
163
228
|
5) **Assign human reviewer if ready**
|
|
164
|
-
- If discussions are resolved and CI
|
|
229
|
+
- If discussions are resolved and blocking CI issues are addressed or clearly triaged, request review from a recent active human contributor (not you), if supported by your environment.
|
|
165
230
|
|
|
166
231
|
6) **Stdout summary**
|
|
167
|
-
- Print concise summary:
|
|
232
|
+
- Print concise summary: branch used, files changed count (approx by diffs), discussions resolved/left, **blocking failed jobs (names + stages)** with classification (code vs transient), which jobs were retried (if any), and requested reviewers.
|
|
168
233
|
`;
|
|
169
|
-
const
|
|
170
|
-
##
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
234
|
+
const outputDisciplineMR = ({ agentUserName }) => `
|
|
235
|
+
## Output Discipline (MR)
|
|
236
|
+
- Output only \`gitlab-mcp\` tool calls and the final plain-text summary.
|
|
237
|
+
- Do **not** merge the MR yourself under any circumstance.
|
|
238
|
+
- Never include "@${agentUserName}" in any body.
|
|
239
|
+
`;
|
|
240
|
+
/* ---------- Shared bundle for MR review ---------- */
|
|
241
|
+
const mrReviewBundle = (ctx) => `
|
|
242
|
+
## MR Review Mode (execute ONLY when review intent is detected and an MR IID is resolved)
|
|
243
|
+
Resolved MR IID: <set this to the resolved \`mr_iid\` before executing>
|
|
244
|
+
${mrScope(ctx)}
|
|
245
|
+
${mrWorkflow()}
|
|
246
|
+
${ciInspection()}
|
|
174
247
|
`;
|
|
175
|
-
|
|
176
|
-
const getEventPrompt = (
|
|
248
|
+
/* ---------- Public builders ---------- */
|
|
249
|
+
const getEventPrompt = (ctx) => `
|
|
177
250
|
You are a GitLab assistant bot. You receive ONE raw GitLab webhook JSON payload.
|
|
178
251
|
|
|
179
252
|
${header()}
|
|
@@ -182,16 +255,20 @@ event_json:
|
|
|
182
255
|
$(cat $TRIGGER_PAYLOAD)
|
|
183
256
|
---
|
|
184
257
|
|
|
185
|
-
${identity(
|
|
186
|
-
${goldenRules(
|
|
258
|
+
${identity(ctx)}
|
|
259
|
+
${goldenRules(ctx)}
|
|
260
|
+
${selfMentionGuard(ctx)}
|
|
187
261
|
${eventSelfParse()}
|
|
188
|
-
${
|
|
262
|
+
${singleRunnerGuard()} <!-- NEW: included so the agent can run it when acting on an existing MR -->
|
|
263
|
+
${reviewOnDemandFromEvents()}
|
|
264
|
+
${mrReviewBundle(ctx)} <!-- Included so the agent can execute it when review intent is true -->
|
|
265
|
+
${eventWorkflow(ctx)}
|
|
189
266
|
${commentGuidelines()}
|
|
190
|
-
${
|
|
191
|
-
${outputDiscipline(
|
|
267
|
+
${mcpOnly()}
|
|
268
|
+
${outputDiscipline(ctx)}
|
|
192
269
|
`;
|
|
193
270
|
exports.getEventPrompt = getEventPrompt;
|
|
194
|
-
const getMergeRequestPrompt = (
|
|
271
|
+
const getMergeRequestPrompt = (ctx) => `
|
|
195
272
|
You are a GitLab assistant bot reviewing and updating a single Merge Request (MR).
|
|
196
273
|
|
|
197
274
|
${header()}
|
|
@@ -201,21 +278,14 @@ title: $CI_MERGE_REQUEST_TITLE
|
|
|
201
278
|
description: $CI_MERGE_REQUEST_DESCRIPTION
|
|
202
279
|
---
|
|
203
280
|
|
|
204
|
-
${mrScope(
|
|
205
|
-
${goldenRules(
|
|
281
|
+
${mrScope(ctx)}
|
|
282
|
+
${goldenRules(ctx)}
|
|
283
|
+
${selfMentionGuard(ctx)}
|
|
206
284
|
${mrWorkflow()}
|
|
285
|
+
${ciInspection()}
|
|
207
286
|
${commentGuidelines()}
|
|
208
|
-
${
|
|
209
|
-
${
|
|
210
|
-
## Output Discipline (MR)
|
|
211
|
-
- Prefer \`gitlab-mcp\` tool calls; if unavailable, provide explicit REST calls (method, url, headers, body).
|
|
212
|
-
- At the end, print a **plain-text** summary to STDOUT including:
|
|
213
|
-
- \`source_branch\` and \`target_branch\`
|
|
214
|
-
- commits pushed (short SHAs)
|
|
215
|
-
- number of files changed
|
|
216
|
-
- CI status/result
|
|
217
|
-
- reviewers requested (if any)
|
|
218
|
-
- Do **not** merge the MR yourself under any circumstance.
|
|
287
|
+
${mcpOnly()}
|
|
288
|
+
${outputDisciplineMR(ctx)}
|
|
219
289
|
`;
|
|
220
290
|
exports.getMergeRequestPrompt = getMergeRequestPrompt;
|
|
221
291
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/prompts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/prompts.ts"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,8FAA8F;AAC9F,oGAAoG;;;AAIpG,yCAAyC;AAEzC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC;;;CAGpB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;6BAEhB,aAAa;CACzC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;;;8BAIlB,aAAa;;;;;;CAM1C,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;;;;qCAKhB,aAAa;;;;;;yDAMO,aAAa;;CAErE,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC;;;;;;;;CAQ/B,CAAC;AAEF,8EAA8E;AAC9E,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;;;oBAIjC,aAAa;CAChC,CAAC;AAEF,oDAAoD;AAEpD,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;CAY5B,CAAC;AAEF,2DAA2D;AAC3D,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;CAoB/B,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,CAAC;AAEF,iDAAiD;AACjD,MAAM,aAAa,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;;;;;;;;;;;;6DAaW,aAAa;;;;;;;CAOzE,CAAC;AAEF,yEAAyE;AAEzE,MAAM,OAAO,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;6BAEf,aAAa;;;;CAIzC,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;CAsBxB,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyB1B,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC;;;;oBAInC,aAAa;CAChC,CAAC;AAEF,uDAAuD;AAEvD,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC;;;EAGnC,OAAO,CAAC,GAAG,CAAC;EACZ,UAAU,EAAE;EACZ,YAAY,EAAE;CACf,CAAC;AAEF,2CAA2C;AAEpC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC;;;EAG1C,MAAM,EAAE;;;;;;EAMR,QAAQ,CAAC,GAAG,CAAC;EACb,WAAW,CAAC,GAAG,CAAC;EAChB,gBAAgB,CAAC,GAAG,CAAC;EACrB,cAAc,EAAE;EAChB,iBAAiB,EAAE;EACnB,wBAAwB,EAAE;EAC1B,cAAc,CAAC,GAAG,CAAC;EACnB,aAAa,CAAC,GAAG,CAAC;EAClB,iBAAiB,EAAE;EACnB,OAAO,EAAE;EACT,gBAAgB,CAAC,GAAG,CAAC;CACtB,CAAC;AApBW,QAAA,cAAc,kBAoBzB;AAEK,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC;;;EAGjD,MAAM,EAAE;;;;;;;EAOR,OAAO,CAAC,GAAG,CAAC;EACZ,WAAW,CAAC,GAAG,CAAC;EAChB,gBAAgB,CAAC,GAAG,CAAC;EACrB,UAAU,EAAE;EACZ,YAAY,EAAE;EACd,iBAAiB,EAAE;EACnB,OAAO,EAAE;EACT,kBAAkB,CAAC,GAAG,CAAC;CACxB,CAAC;AAlBW,QAAA,qBAAqB,yBAkBhC"}
|
|
@@ -23,7 +23,7 @@ const callClaude = ({ prompt }) => {
|
|
|
23
23
|
return [
|
|
24
24
|
`export PROMPT="${(0, bashEscape_1.escapeNewlines)((0, bashEscape_1.escapeDoubleQuotes)((0, bashEscape_1.escapeBackTicks)(prompt)))}"`,
|
|
25
25
|
//'echo "$PROMPT"',
|
|
26
|
-
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab" --verbose --debug`,
|
|
26
|
+
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash(*) Bash(git checkout:*) Read(*) Edit(*) Write(*) mcp__gitlab" --verbose --debug`,
|
|
27
27
|
];
|
|
28
28
|
};
|
|
29
29
|
exports.callClaude = callClaude;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/shared.ts"],"names":[],"mappings":";;;AAAA,sDAI+B;AAGxB,MAAM,kBAAkB,GAAG,CAChC,OAAqB,EAC4B,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE;QACT,qBAAqB,EAAE,OAAO;QAC9B,4BAA4B,EAAE,qCAAqC,EAAE,0DAA0D;QAC/H,cAAc,EAAE,gBAAgB;KACjC;CACF,CAAC,CAAC;AAXU,QAAA,kBAAkB,sBAW5B;AAEU,QAAA,eAAe,GAAG;IAC7B,YAAY;IACZ,kCAAkC;IAClC,0CAA0C;IAC1C,sLAAsL;CACvL,CAAC;AAEK,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE;IAC3D,OAAO;QACL,kBAAkB,IAAA,2BAAc,EAC9B,IAAA,+BAAkB,EAAC,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC,CAC5C,GAAG;QACJ,mBAAmB;QACnB,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/shared.ts"],"names":[],"mappings":";;;AAAA,sDAI+B;AAGxB,MAAM,kBAAkB,GAAG,CAChC,OAAqB,EAC4B,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE;QACT,qBAAqB,EAAE,OAAO;QAC9B,4BAA4B,EAAE,qCAAqC,EAAE,0DAA0D;QAC/H,cAAc,EAAE,gBAAgB;KACjC;CACF,CAAC,CAAC;AAXU,QAAA,kBAAkB,sBAW5B;AAEU,QAAA,eAAe,GAAG;IAC7B,YAAY;IACZ,kCAAkC;IAClC,0CAA0C;IAC1C,sLAAsL;CACvL,CAAC;AAEK,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE;IAC3D,OAAO;QACL,kBAAkB,IAAA,2BAAc,EAC9B,IAAA,+BAAkB,EAAC,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC,CAC5C,GAAG;QACJ,mBAAmB;QACnB,wJAAwJ;KACzJ,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB"}
|
|
@@ -4,4 +4,13 @@ export type AgentConfig = {
|
|
|
4
4
|
username: string;
|
|
5
5
|
userId: string;
|
|
6
6
|
};
|
|
7
|
+
reviews?: {
|
|
8
|
+
/**
|
|
9
|
+
* usernames that the agent should review merge requests for.
|
|
10
|
+
* Defaults to agentUser
|
|
11
|
+
*/
|
|
12
|
+
byUser?: Record<string, {
|
|
13
|
+
automatic: boolean;
|
|
14
|
+
}> | "all-automatic";
|
|
15
|
+
};
|
|
7
16
|
};
|
|
@@ -3,7 +3,6 @@ import type { BuildConfigFromWorkspace, BuildConfigStandalone, WorkspaceBuildCon
|
|
|
3
3
|
import type { PredefinedVariables, SecretEnvVar } from "../context";
|
|
4
4
|
import type { DeployConfig } from "../deploy";
|
|
5
5
|
import type { VariableValue } from "../variables/VariableValue";
|
|
6
|
-
import type { AgentConfig } from "./agent";
|
|
7
6
|
import type { ComponentConfig, Config, EnvType, PipelineTrigger } from "./config";
|
|
8
7
|
import type { BaseStage, CatladderJob } from "./jobs";
|
|
9
8
|
import type { PipelineType } from "./pipeline";
|
|
@@ -156,9 +155,4 @@ export type WorkspaceContext = {
|
|
|
156
155
|
pipelineType: PipelineType;
|
|
157
156
|
env: string;
|
|
158
157
|
};
|
|
159
|
-
export type AgentContext
|
|
160
|
-
type: "agent";
|
|
161
|
-
name: string;
|
|
162
|
-
fullConfig: Config;
|
|
163
|
-
agentConfig: AgentConfig;
|
|
164
|
-
};
|
|
158
|
+
export type { AgentContext } from "../pipeline/agent/createAgentContext";
|