@catladder/cli 0.0.0-main-bbb9c8e8 → 0.0.0-main-4fc3c2ec
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 +64 -54
- package/dist/bundles/cli/index.js +111 -55
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.js +3 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.js.map +1 -1
- package/dist/cli/src/git/getGetMainBranch.d.ts +1 -0
- package/dist/cli/src/git/getGetMainBranch.js +10 -0
- package/dist/cli/src/git/getGetMainBranch.js.map +1 -0
- package/dist/cli/src/git/index.d.ts +1 -0
- package/dist/cli/src/git/index.js +1 -0
- package/dist/cli/src/git/index.js.map +1 -1
- package/dist/pipeline/src/pipeline/agent/prompts.js +63 -53
- package/dist/pipeline/src/pipeline/agent/prompts.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/setup/setupAgents.ts +3 -1
- package/src/git/getGetMainBranch.ts +5 -0
- package/src/git/index.ts +1 -0
|
@@ -6060,9 +6060,9 @@ exports.createJobsForAgentContext = createJobsForAgentContext;
|
|
|
6060
6060
|
|
|
6061
6061
|
"use strict";
|
|
6062
6062
|
|
|
6063
|
-
// prompts.ts — MCP-only, DRY, review-first-then-push, CI
|
|
6063
|
+
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries), self-mention guard,
|
|
6064
6064
|
// event prompt supports review-on-demand via manual "agent-review" job or fallback MR review.
|
|
6065
|
-
// Prevents double-runs: event-triggered work cancels any running "agent-review" job on the
|
|
6065
|
+
// Prevents double-runs: event-triggered work cancels any running "agent-review" job on the MR's own pipeline.
|
|
6066
6066
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6067
6067
|
exports.getMergeRequestPrompt = exports.getEventPrompt = void 0;
|
|
6068
6068
|
/* ---------- Shared blocks ---------- */
|
|
@@ -6140,10 +6140,10 @@ const mcpOnly = () => `
|
|
|
6140
6140
|
- merge_merge_request(...) // **Do NOT use** (never merge)
|
|
6141
6141
|
|
|
6142
6142
|
- **Pipelines / Jobs** (requires env USE_PIPELINE=true)
|
|
6143
|
+
- list_pipelines({ projectId, ref?, sha?, status?, orderBy?, sort? })
|
|
6144
|
+
- get_pipeline({ projectId, pipelineId })
|
|
6143
6145
|
- list_pipeline_jobs({ projectId, pipelineId })
|
|
6144
6146
|
- get_pipeline_job_output({ projectId, pipelineId, jobId })
|
|
6145
|
-
- retry_pipeline({ projectId, pipelineId })
|
|
6146
|
-
- retry_pipeline_job({ projectId, jobId })
|
|
6147
6147
|
- play_pipeline_job({ projectId, jobId })
|
|
6148
6148
|
- cancel_pipeline_job({ projectId, jobId })
|
|
6149
6149
|
`;
|
|
@@ -6167,40 +6167,47 @@ From \`event_json\`, extract:
|
|
|
6167
6167
|
|
|
6168
6168
|
If any key is missing, choose the safest minimal action or briefly explain via a comment.
|
|
6169
6169
|
`;
|
|
6170
|
-
|
|
6170
|
+
/* Helper used by Single-Runner Guard and Review-on-Demand to find the MR’s own pipeline */
|
|
6171
|
+
const resolveMrPipeline = () => `
|
|
6172
|
+
## Resolve MR Pipeline (for MR IID resolved from the event)
|
|
6173
|
+
Given \`mr_iid\`:
|
|
6174
|
+
1) Call \`get_merge_request({ projectId: $CI_PROJECT_ID, mergeRequestIid: mr_iid })\` to obtain:
|
|
6175
|
+
- \`sourceBranch\` (required)
|
|
6176
|
+
- \`sha\` or head SHA (if available)
|
|
6177
|
+
2) Prefer **SHA-based** lookup:
|
|
6178
|
+
- \`list_pipelines({ projectId: $CI_PROJECT_ID, sha })\` ordered by most recent; pick the newest.
|
|
6179
|
+
3) Fallback to **ref-based** lookup if SHA not available:
|
|
6180
|
+
- \`list_pipelines({ projectId: $CI_PROJECT_ID, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })\`; pick the newest.
|
|
6181
|
+
4) The chosen pipeline becomes \`mr_pipeline_id\`. Use it for all job queries/plays/cancels related to this MR.
|
|
6182
|
+
- If no pipeline is found, post a short MR note explaining that no pipeline was located for the current MR head and proceed with review actions without CI job control.
|
|
6183
|
+
`;
|
|
6184
|
+
// Updated: operate on the MR’s pipeline, not the event pipeline
|
|
6171
6185
|
const singleRunnerGuard = () => `
|
|
6172
6186
|
## Single-Runner Guard (event-triggered work on an existing MR)
|
|
6173
6187
|
Before entering MR Review Mode from an event:
|
|
6174
6188
|
|
|
6175
|
-
- **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.
|
|
6176
|
-
|
|
6177
|
-
**
|
|
6178
|
-
1)
|
|
6179
|
-
|
|
6180
|
-
-
|
|
6181
|
-
- For
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing
|
|
6189
|
+
- **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's pipeline, **cancel** it first.
|
|
6190
|
+
|
|
6191
|
+
**Procedure (MCP-only):**
|
|
6192
|
+
1) Resolve the MR IID from the event (target URL or text) and run **Resolve MR Pipeline** to get \`mr_pipeline_id\`.
|
|
6193
|
+
2) If \`mr_pipeline_id\` is available:
|
|
6194
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
6195
|
+
- For any job with \`status\` in \`["running","pending"]\` and \`name\` ending with \`"agent-review"\`, call:
|
|
6196
|
+
- \`cancel_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
6197
|
+
- Proceed immediately after issuing cancellations (do not wait).
|
|
6198
|
+
3) If the pipeline cannot be resolved:
|
|
6199
|
+
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing pipeline context.
|
|
6186
6200
|
- Proceed with review.
|
|
6187
6201
|
|
|
6188
6202
|
**Notes:**
|
|
6189
6203
|
- Keep this guard **idempotent** (safe to run multiple times).
|
|
6190
|
-
-
|
|
6204
|
+
- Only applies to **event-triggered** flows that act on an **existing MR**.
|
|
6191
6205
|
`;
|
|
6192
6206
|
const reviewOnDemandFromEvents = () => `
|
|
6193
6207
|
## Review-on-Demand (from events)
|
|
6194
6208
|
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:
|
|
6195
6209
|
|
|
6196
|
-
1) **
|
|
6197
|
-
- List jobs for the current pipeline \`$CI_PIPELINE_ID\` via \`list_pipeline_jobs\`.
|
|
6198
|
-
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
6199
|
-
- Trigger it via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
6200
|
-
- Post a short comment confirming you triggered the review job (sanitize).
|
|
6201
|
-
- **Stop** further review actions.
|
|
6202
|
-
|
|
6203
|
-
2) **If no such job exists, resolve which MR to review**:
|
|
6210
|
+
1) **Resolve which MR to review**:
|
|
6204
6211
|
- If the event target is an MR → use its \`iid\`.
|
|
6205
6212
|
- Else, parse the text for MR references in order:
|
|
6206
6213
|
- \`!<iid>\` (e.g., \`!123\`)
|
|
@@ -6208,10 +6215,21 @@ If the issue/note text **asks for a review** (case-insensitive tokens like: "rev
|
|
|
6208
6215
|
- full GitLab MR URL
|
|
6209
6216
|
- If no MR can be resolved, reply with a brief comment asking the user to reference an MR (sanitize) and **stop**.
|
|
6210
6217
|
|
|
6211
|
-
|
|
6212
|
-
- Execute
|
|
6218
|
+
2) **Find the MR's pipeline** (do **not** use \`$CI_PIPELINE_ID\` from the event):
|
|
6219
|
+
- Execute **Resolve MR Pipeline** to obtain \`mr_pipeline_id\`.
|
|
6220
|
+
|
|
6221
|
+
3) **If a manual "agent-review" job exists on the MR pipeline, trigger it**
|
|
6222
|
+
- If \`mr_pipeline_id\` is available:
|
|
6223
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
6224
|
+
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
6225
|
+
- Trigger via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
6226
|
+
- Post a short comment confirming you triggered the review job (sanitize).
|
|
6227
|
+
- **Stop** further review actions.
|
|
6228
|
+
|
|
6229
|
+
4) **Single-Runner Guard**
|
|
6230
|
+
- If no manual job was triggered, execute the **Single-Runner Guard** (it will cancel any running/pending \`agent-review\` jobs on the MR pipeline) before MR Review Mode.
|
|
6213
6231
|
|
|
6214
|
-
|
|
6232
|
+
5) **Enter MR Review Mode**: execute the **MR Review Bundle** below with the resolved \`mr_iid\`.
|
|
6215
6233
|
`;
|
|
6216
6234
|
/** Regular event workflow for non-review work */
|
|
6217
6235
|
const eventWorkflow = ({ agentUserName }) => `
|
|
@@ -6267,30 +6285,21 @@ Follow this sequence with verification at each step:
|
|
|
6267
6285
|
- Post a follow-up MR note summarizing what changed and why (sanitize).
|
|
6268
6286
|
`;
|
|
6269
6287
|
const ciInspection = () => `
|
|
6270
|
-
4) **CI jobs (
|
|
6271
|
-
-
|
|
6272
|
-
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
Post a note stating you retried and why (sanitize).
|
|
6286
|
-
- If code-related ⇒ do not retry; post a note with diagnosis and suggested fix (sanitize).
|
|
6287
|
-
- Retry-once policy: at most **one** retry per job in this run.
|
|
6288
|
-
|
|
6289
|
-
5) **Assign human reviewer if ready**
|
|
6290
|
-
- 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.
|
|
6291
|
-
|
|
6292
|
-
6) **Stdout summary**
|
|
6293
|
-
- 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.
|
|
6288
|
+
4) **CI jobs (diagnose only; no job retries)**
|
|
6289
|
+
- To analyze CI context during review triggered from events, prefer the **MR pipeline** (not the event pipeline).
|
|
6290
|
+
- If you are in MR Review Mode and have \`mr_pipeline_id\` (from **Resolve MR Pipeline**):
|
|
6291
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
6292
|
+
- Consider **only** jobs with \`status = "failed"\` and \`allow_failure = false\`.
|
|
6293
|
+
- For each such job:
|
|
6294
|
+
1. Retrieve details (id, name, stage, status, allow_failure, web_url).
|
|
6295
|
+
2. Fetch job output via \`get_pipeline_job_output({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id, jobId })\`.
|
|
6296
|
+
3. **Classify the failure**:
|
|
6297
|
+
- **Code-related:** compiler/type/lint/test/build script errors. Provide minimal fix in your review/changes. Do **not** retry.
|
|
6298
|
+
- **Likely transient / infra:** network/timeouts/cache/artifacts/5xx/429/runner issues. Do **not** retry here; note likely cause and suggest CI-level retry/backoff if appropriate.
|
|
6299
|
+
4. **Decision**:
|
|
6300
|
+
- If \`will_push_changes = true\`: do **not** retry; note that the new pipeline from your push will validate fixes.
|
|
6301
|
+
- If \`will_push_changes = false\`: do **not** retry; post diagnosis and next steps (or request human input for infra issues).
|
|
6302
|
+
- If \`mr_pipeline_id\` is not available, you may skip CI analysis or post a short note explaining the missing pipeline context.
|
|
6294
6303
|
`;
|
|
6295
6304
|
const outputDisciplineMR = ({ agentUserName }) => `
|
|
6296
6305
|
## Output Discipline (MR)
|
|
@@ -6320,9 +6329,10 @@ ${identity(ctx)}
|
|
|
6320
6329
|
${goldenRules(ctx)}
|
|
6321
6330
|
${selfMentionGuard(ctx)}
|
|
6322
6331
|
${eventSelfParse()}
|
|
6323
|
-
${
|
|
6332
|
+
${resolveMrPipeline()} <!-- new helper used by review/cancel paths -->
|
|
6333
|
+
${singleRunnerGuard()} <!-- operates on MR pipeline, not event pipeline -->
|
|
6324
6334
|
${reviewOnDemandFromEvents()}
|
|
6325
|
-
${mrReviewBundle(ctx)}
|
|
6335
|
+
${mrReviewBundle(ctx)} <!-- included so the agent can execute it when review intent is true -->
|
|
6326
6336
|
${eventWorkflow(ctx)}
|
|
6327
6337
|
${commentGuidelines()}
|
|
6328
6338
|
${mcpOnly()}
|
|
@@ -2071,6 +2071,7 @@ exports.setupAgents = void 0;
|
|
|
2071
2071
|
const gitlab_1 = __nccwpck_require__(12927);
|
|
2072
2072
|
const getProjectConfig_1 = __nccwpck_require__(12145);
|
|
2073
2073
|
const gitProjectInformation_1 = __nccwpck_require__(78329);
|
|
2074
|
+
const git_1 = __nccwpck_require__(85096);
|
|
2074
2075
|
const listTriggerTokens = async (instance, projectId) => {
|
|
2075
2076
|
return await (0, gitlab_1.doGitlabRequest)(instance, `projects/${projectId}/triggers`);
|
|
2076
2077
|
};
|
|
@@ -2092,7 +2093,8 @@ const updateWebhook = async (instance, projectId, hookId, webhookData) => {
|
|
|
2092
2093
|
const setupAgentWebhook = async (instance, projectId, agentName, triggerToken) => {
|
|
2093
2094
|
const webhookName = `cl_agent_${agentName}_webhook`;
|
|
2094
2095
|
const { gitRemoteHost } = await (0, gitProjectInformation_1.getGitRemoteHostAndPath)();
|
|
2095
|
-
const
|
|
2096
|
+
const mainBranch = await (0, git_1.getMainBranch)();
|
|
2097
|
+
const webhookUrl = `https://${gitRemoteHost}/api/v4/projects/${projectId}/ref/${mainBranch}/trigger/pipeline?token=${triggerToken}`;
|
|
2096
2098
|
instance.log(`Setting up webhook for agent: ${agentName}`);
|
|
2097
2099
|
// List existing webhooks
|
|
2098
2100
|
const existingWebhooks = await listWebhooks(instance, projectId);
|
|
@@ -3157,6 +3159,23 @@ const hash = (str, length) => {
|
|
|
3157
3159
|
|
|
3158
3160
|
/***/ }),
|
|
3159
3161
|
|
|
3162
|
+
/***/ 60906:
|
|
3163
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3164
|
+
|
|
3165
|
+
"use strict";
|
|
3166
|
+
|
|
3167
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3168
|
+
exports.getMainBranch = void 0;
|
|
3169
|
+
const child_process_promise_1 = __nccwpck_require__(75763);
|
|
3170
|
+
const getMainBranch = async () => {
|
|
3171
|
+
const { stdout } = await (0, child_process_promise_1.exec)("git rev-parse --abbrev-ref HEAD");
|
|
3172
|
+
return stdout.trim();
|
|
3173
|
+
};
|
|
3174
|
+
exports.getMainBranch = getMainBranch;
|
|
3175
|
+
//# sourceMappingURL=getGetMainBranch.js.map
|
|
3176
|
+
|
|
3177
|
+
/***/ }),
|
|
3178
|
+
|
|
3160
3179
|
/***/ 72745:
|
|
3161
3180
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3162
3181
|
|
|
@@ -3225,6 +3244,33 @@ exports.gitProjectInformation = gitProjectInformation;
|
|
|
3225
3244
|
|
|
3226
3245
|
/***/ }),
|
|
3227
3246
|
|
|
3247
|
+
/***/ 85096:
|
|
3248
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
3249
|
+
|
|
3250
|
+
"use strict";
|
|
3251
|
+
|
|
3252
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3253
|
+
if (k2 === undefined) k2 = k;
|
|
3254
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3255
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3256
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3257
|
+
}
|
|
3258
|
+
Object.defineProperty(o, k2, desc);
|
|
3259
|
+
}) : (function(o, m, k, k2) {
|
|
3260
|
+
if (k2 === undefined) k2 = k;
|
|
3261
|
+
o[k2] = m[k];
|
|
3262
|
+
}));
|
|
3263
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
3264
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3265
|
+
};
|
|
3266
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3267
|
+
__exportStar(__nccwpck_require__(72745), exports);
|
|
3268
|
+
__exportStar(__nccwpck_require__(78329), exports);
|
|
3269
|
+
__exportStar(__nccwpck_require__(60906), exports);
|
|
3270
|
+
//# sourceMappingURL=index.js.map
|
|
3271
|
+
|
|
3272
|
+
/***/ }),
|
|
3273
|
+
|
|
3228
3274
|
/***/ 79672:
|
|
3229
3275
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3230
3276
|
|
|
@@ -9242,9 +9288,9 @@ exports.createJobsForAgentContext = createJobsForAgentContext;
|
|
|
9242
9288
|
|
|
9243
9289
|
"use strict";
|
|
9244
9290
|
|
|
9245
|
-
// prompts.ts — MCP-only, DRY, review-first-then-push, CI
|
|
9291
|
+
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries), self-mention guard,
|
|
9246
9292
|
// event prompt supports review-on-demand via manual "agent-review" job or fallback MR review.
|
|
9247
|
-
// Prevents double-runs: event-triggered work cancels any running "agent-review" job on the
|
|
9293
|
+
// Prevents double-runs: event-triggered work cancels any running "agent-review" job on the MR's own pipeline.
|
|
9248
9294
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9249
9295
|
exports.getMergeRequestPrompt = exports.getEventPrompt = void 0;
|
|
9250
9296
|
/* ---------- Shared blocks ---------- */
|
|
@@ -9322,10 +9368,10 @@ const mcpOnly = () => `
|
|
|
9322
9368
|
- merge_merge_request(...) // **Do NOT use** (never merge)
|
|
9323
9369
|
|
|
9324
9370
|
- **Pipelines / Jobs** (requires env USE_PIPELINE=true)
|
|
9371
|
+
- list_pipelines({ projectId, ref?, sha?, status?, orderBy?, sort? })
|
|
9372
|
+
- get_pipeline({ projectId, pipelineId })
|
|
9325
9373
|
- list_pipeline_jobs({ projectId, pipelineId })
|
|
9326
9374
|
- get_pipeline_job_output({ projectId, pipelineId, jobId })
|
|
9327
|
-
- retry_pipeline({ projectId, pipelineId })
|
|
9328
|
-
- retry_pipeline_job({ projectId, jobId })
|
|
9329
9375
|
- play_pipeline_job({ projectId, jobId })
|
|
9330
9376
|
- cancel_pipeline_job({ projectId, jobId })
|
|
9331
9377
|
`;
|
|
@@ -9349,40 +9395,47 @@ From \`event_json\`, extract:
|
|
|
9349
9395
|
|
|
9350
9396
|
If any key is missing, choose the safest minimal action or briefly explain via a comment.
|
|
9351
9397
|
`;
|
|
9352
|
-
|
|
9398
|
+
/* Helper used by Single-Runner Guard and Review-on-Demand to find the MR’s own pipeline */
|
|
9399
|
+
const resolveMrPipeline = () => `
|
|
9400
|
+
## Resolve MR Pipeline (for MR IID resolved from the event)
|
|
9401
|
+
Given \`mr_iid\`:
|
|
9402
|
+
1) Call \`get_merge_request({ projectId: $CI_PROJECT_ID, mergeRequestIid: mr_iid })\` to obtain:
|
|
9403
|
+
- \`sourceBranch\` (required)
|
|
9404
|
+
- \`sha\` or head SHA (if available)
|
|
9405
|
+
2) Prefer **SHA-based** lookup:
|
|
9406
|
+
- \`list_pipelines({ projectId: $CI_PROJECT_ID, sha })\` ordered by most recent; pick the newest.
|
|
9407
|
+
3) Fallback to **ref-based** lookup if SHA not available:
|
|
9408
|
+
- \`list_pipelines({ projectId: $CI_PROJECT_ID, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })\`; pick the newest.
|
|
9409
|
+
4) The chosen pipeline becomes \`mr_pipeline_id\`. Use it for all job queries/plays/cancels related to this MR.
|
|
9410
|
+
- If no pipeline is found, post a short MR note explaining that no pipeline was located for the current MR head and proceed with review actions without CI job control.
|
|
9411
|
+
`;
|
|
9412
|
+
// Updated: operate on the MR’s pipeline, not the event pipeline
|
|
9353
9413
|
const singleRunnerGuard = () => `
|
|
9354
9414
|
## Single-Runner Guard (event-triggered work on an existing MR)
|
|
9355
9415
|
Before entering MR Review Mode from an event:
|
|
9356
9416
|
|
|
9357
|
-
- **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.
|
|
9358
|
-
|
|
9359
|
-
**
|
|
9360
|
-
1)
|
|
9361
|
-
|
|
9362
|
-
-
|
|
9363
|
-
- For
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing
|
|
9417
|
+
- **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's pipeline, **cancel** it first.
|
|
9418
|
+
|
|
9419
|
+
**Procedure (MCP-only):**
|
|
9420
|
+
1) Resolve the MR IID from the event (target URL or text) and run **Resolve MR Pipeline** to get \`mr_pipeline_id\`.
|
|
9421
|
+
2) If \`mr_pipeline_id\` is available:
|
|
9422
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
9423
|
+
- For any job with \`status\` in \`["running","pending"]\` and \`name\` ending with \`"agent-review"\`, call:
|
|
9424
|
+
- \`cancel_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
9425
|
+
- Proceed immediately after issuing cancellations (do not wait).
|
|
9426
|
+
3) If the pipeline cannot be resolved:
|
|
9427
|
+
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing pipeline context.
|
|
9368
9428
|
- Proceed with review.
|
|
9369
9429
|
|
|
9370
9430
|
**Notes:**
|
|
9371
9431
|
- Keep this guard **idempotent** (safe to run multiple times).
|
|
9372
|
-
-
|
|
9432
|
+
- Only applies to **event-triggered** flows that act on an **existing MR**.
|
|
9373
9433
|
`;
|
|
9374
9434
|
const reviewOnDemandFromEvents = () => `
|
|
9375
9435
|
## Review-on-Demand (from events)
|
|
9376
9436
|
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:
|
|
9377
9437
|
|
|
9378
|
-
1) **
|
|
9379
|
-
- List jobs for the current pipeline \`$CI_PIPELINE_ID\` via \`list_pipeline_jobs\`.
|
|
9380
|
-
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
9381
|
-
- Trigger it via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
9382
|
-
- Post a short comment confirming you triggered the review job (sanitize).
|
|
9383
|
-
- **Stop** further review actions.
|
|
9384
|
-
|
|
9385
|
-
2) **If no such job exists, resolve which MR to review**:
|
|
9438
|
+
1) **Resolve which MR to review**:
|
|
9386
9439
|
- If the event target is an MR → use its \`iid\`.
|
|
9387
9440
|
- Else, parse the text for MR references in order:
|
|
9388
9441
|
- \`!<iid>\` (e.g., \`!123\`)
|
|
@@ -9390,10 +9443,21 @@ If the issue/note text **asks for a review** (case-insensitive tokens like: "rev
|
|
|
9390
9443
|
- full GitLab MR URL
|
|
9391
9444
|
- If no MR can be resolved, reply with a brief comment asking the user to reference an MR (sanitize) and **stop**.
|
|
9392
9445
|
|
|
9393
|
-
|
|
9394
|
-
- Execute
|
|
9446
|
+
2) **Find the MR's pipeline** (do **not** use \`$CI_PIPELINE_ID\` from the event):
|
|
9447
|
+
- Execute **Resolve MR Pipeline** to obtain \`mr_pipeline_id\`.
|
|
9448
|
+
|
|
9449
|
+
3) **If a manual "agent-review" job exists on the MR pipeline, trigger it**
|
|
9450
|
+
- If \`mr_pipeline_id\` is available:
|
|
9451
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
9452
|
+
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
9453
|
+
- Trigger via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
9454
|
+
- Post a short comment confirming you triggered the review job (sanitize).
|
|
9455
|
+
- **Stop** further review actions.
|
|
9456
|
+
|
|
9457
|
+
4) **Single-Runner Guard**
|
|
9458
|
+
- If no manual job was triggered, execute the **Single-Runner Guard** (it will cancel any running/pending \`agent-review\` jobs on the MR pipeline) before MR Review Mode.
|
|
9395
9459
|
|
|
9396
|
-
|
|
9460
|
+
5) **Enter MR Review Mode**: execute the **MR Review Bundle** below with the resolved \`mr_iid\`.
|
|
9397
9461
|
`;
|
|
9398
9462
|
/** Regular event workflow for non-review work */
|
|
9399
9463
|
const eventWorkflow = ({ agentUserName }) => `
|
|
@@ -9449,30 +9513,21 @@ Follow this sequence with verification at each step:
|
|
|
9449
9513
|
- Post a follow-up MR note summarizing what changed and why (sanitize).
|
|
9450
9514
|
`;
|
|
9451
9515
|
const ciInspection = () => `
|
|
9452
|
-
4) **CI jobs (
|
|
9453
|
-
-
|
|
9454
|
-
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
Post a note stating you retried and why (sanitize).
|
|
9468
|
-
- If code-related ⇒ do not retry; post a note with diagnosis and suggested fix (sanitize).
|
|
9469
|
-
- Retry-once policy: at most **one** retry per job in this run.
|
|
9470
|
-
|
|
9471
|
-
5) **Assign human reviewer if ready**
|
|
9472
|
-
- 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.
|
|
9473
|
-
|
|
9474
|
-
6) **Stdout summary**
|
|
9475
|
-
- 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.
|
|
9516
|
+
4) **CI jobs (diagnose only; no job retries)**
|
|
9517
|
+
- To analyze CI context during review triggered from events, prefer the **MR pipeline** (not the event pipeline).
|
|
9518
|
+
- If you are in MR Review Mode and have \`mr_pipeline_id\` (from **Resolve MR Pipeline**):
|
|
9519
|
+
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
9520
|
+
- Consider **only** jobs with \`status = "failed"\` and \`allow_failure = false\`.
|
|
9521
|
+
- For each such job:
|
|
9522
|
+
1. Retrieve details (id, name, stage, status, allow_failure, web_url).
|
|
9523
|
+
2. Fetch job output via \`get_pipeline_job_output({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id, jobId })\`.
|
|
9524
|
+
3. **Classify the failure**:
|
|
9525
|
+
- **Code-related:** compiler/type/lint/test/build script errors. Provide minimal fix in your review/changes. Do **not** retry.
|
|
9526
|
+
- **Likely transient / infra:** network/timeouts/cache/artifacts/5xx/429/runner issues. Do **not** retry here; note likely cause and suggest CI-level retry/backoff if appropriate.
|
|
9527
|
+
4. **Decision**:
|
|
9528
|
+
- If \`will_push_changes = true\`: do **not** retry; note that the new pipeline from your push will validate fixes.
|
|
9529
|
+
- If \`will_push_changes = false\`: do **not** retry; post diagnosis and next steps (or request human input for infra issues).
|
|
9530
|
+
- If \`mr_pipeline_id\` is not available, you may skip CI analysis or post a short note explaining the missing pipeline context.
|
|
9476
9531
|
`;
|
|
9477
9532
|
const outputDisciplineMR = ({ agentUserName }) => `
|
|
9478
9533
|
## Output Discipline (MR)
|
|
@@ -9502,9 +9557,10 @@ ${identity(ctx)}
|
|
|
9502
9557
|
${goldenRules(ctx)}
|
|
9503
9558
|
${selfMentionGuard(ctx)}
|
|
9504
9559
|
${eventSelfParse()}
|
|
9505
|
-
${
|
|
9560
|
+
${resolveMrPipeline()} <!-- new helper used by review/cancel paths -->
|
|
9561
|
+
${singleRunnerGuard()} <!-- operates on MR pipeline, not event pipeline -->
|
|
9506
9562
|
${reviewOnDemandFromEvents()}
|
|
9507
|
-
${mrReviewBundle(ctx)}
|
|
9563
|
+
${mrReviewBundle(ctx)} <!-- included so the agent can execute it when review intent is true -->
|
|
9508
9564
|
${eventWorkflow(ctx)}
|
|
9509
9565
|
${commentGuidelines()}
|
|
9510
9566
|
${mcpOnly()}
|
|
@@ -4,6 +4,7 @@ exports.setupAgents = void 0;
|
|
|
4
4
|
const gitlab_1 = require("../../../../../utils/gitlab");
|
|
5
5
|
const getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
6
6
|
const gitProjectInformation_1 = require("../../../../../git/gitProjectInformation");
|
|
7
|
+
const git_1 = require("../../../../../git");
|
|
7
8
|
const listTriggerTokens = async (instance, projectId) => {
|
|
8
9
|
return await (0, gitlab_1.doGitlabRequest)(instance, `projects/${projectId}/triggers`);
|
|
9
10
|
};
|
|
@@ -25,7 +26,8 @@ const updateWebhook = async (instance, projectId, hookId, webhookData) => {
|
|
|
25
26
|
const setupAgentWebhook = async (instance, projectId, agentName, triggerToken) => {
|
|
26
27
|
const webhookName = `cl_agent_${agentName}_webhook`;
|
|
27
28
|
const { gitRemoteHost } = await (0, gitProjectInformation_1.getGitRemoteHostAndPath)();
|
|
28
|
-
const
|
|
29
|
+
const mainBranch = await (0, git_1.getMainBranch)();
|
|
30
|
+
const webhookUrl = `https://${gitRemoteHost}/api/v4/projects/${projectId}/ref/${mainBranch}/trigger/pipeline?token=${triggerToken}`;
|
|
29
31
|
instance.log(`Setting up webhook for agent: ${agentName}`);
|
|
30
32
|
// List existing webhooks
|
|
31
33
|
const existingWebhooks = await listWebhooks(instance, projectId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupAgents.js","sourceRoot":"","sources":["../../../../../../../../src/apps/cli/commands/project/setup/setupAgents.ts"],"names":[],"mappings":";;;AACA,wDAA8E;AAC9E,6EAA0E;AAC1E,oFAAmF;
|
|
1
|
+
{"version":3,"file":"setupAgents.js","sourceRoot":"","sources":["../../../../../../../../src/apps/cli/commands/project/setup/setupAgents.ts"],"names":[],"mappings":";;;AACA,wDAA8E;AAC9E,6EAA0E;AAC1E,oFAAmF;AACnF,4CAAmD;AAyDnD,MAAM,iBAAiB,GAAG,KAA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AM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,YAAY,EAAE,CAAC;QACpD,IAAI,WAAW,CAAC,IAAI,KAAK,QAAQ,IAAI,WAAW,EAAE,CAAC;YACjD,MAAM,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC1C,QAAQ,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAC9E,QAAQ,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC/D,QAAQ,CAAC,GAAG,CACV,6EAA6E,CAC9E,CAAC;IACF,QAAQ,CAAC,GAAG,CACV,oGAAoG,CACrG,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,WAAW,eA+BtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getMainBranch: () => Promise<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMainBranch = void 0;
|
|
4
|
+
const child_process_promise_1 = require("child-process-promise");
|
|
5
|
+
const getMainBranch = async () => {
|
|
6
|
+
const { stdout } = await (0, child_process_promise_1.exec)("git rev-parse --abbrev-ref HEAD");
|
|
7
|
+
return stdout.trim();
|
|
8
|
+
};
|
|
9
|
+
exports.getMainBranch = getMainBranch;
|
|
10
|
+
//# sourceMappingURL=getGetMainBranch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGetMainBranch.js","sourceRoot":"","sources":["../../../../src/git/getGetMainBranch.ts"],"names":[],"mappings":";;;AAAA,iEAA6C;AACtC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,4BAAI,EAAC,iCAAiC,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./gitConfig"), exports);
|
|
18
18
|
__exportStar(require("./gitProjectInformation"), exports);
|
|
19
|
+
__exportStar(require("./getGetMainBranch"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/git/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/git/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0DAAwC;AACxC,qDAAmC"}
|