@catladder/cli 0.0.0-main-b67a4ad4 → 0.0.0-main-db6ec1ef
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 +134 -196
- package/dist/bundles/cli/index.js +134 -196
- package/dist/pipeline/src/pipeline/agent/prompts.js +130 -192
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -9291,15 +9291,18 @@ exports.createJobsForAgentContext = createJobsForAgentContext;
|
|
|
9291
9291
|
|
|
9292
9292
|
"use strict";
|
|
9293
9293
|
|
|
9294
|
-
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries),
|
|
9295
|
-
// conversations-aware
|
|
9296
|
-
//
|
|
9294
|
+
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries),
|
|
9295
|
+
// self-mention guard, conversations-aware (issues & MRs), inline replies, de-duplication.
|
|
9296
|
+
// Review-on-demand: resolves MR pipeline and triggers manual "agent-review" when present.
|
|
9297
|
+
// Single-runner guard: cancels running "agent-review" on the MR pipeline before acting.
|
|
9298
|
+
// Stdout summaries included for both event and MR flows.
|
|
9297
9299
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9298
9300
|
exports.getMergeRequestPrompt = exports.getEventPrompt = void 0;
|
|
9299
9301
|
/* ---------- Shared blocks ---------- */
|
|
9300
9302
|
const header = () => `
|
|
9301
9303
|
Project ID: $CI_PROJECT_ID
|
|
9302
9304
|
GitLab Host: $CI_SERVER_URL
|
|
9305
|
+
Default Branch: $CI_DEFAULT_BRANCH
|
|
9303
9306
|
`;
|
|
9304
9307
|
const identity = ({ agentUserName }) => `
|
|
9305
9308
|
## Identity
|
|
@@ -9316,87 +9319,64 @@ const goldenRules = ({ agentUserName }) => `
|
|
|
9316
9319
|
- Keep actions minimal and idempotent. Avoid duplicate comments or duplicate MRs.
|
|
9317
9320
|
- Use ONE stable \`source_branch\` per run; do not regenerate its name later.
|
|
9318
9321
|
`;
|
|
9319
|
-
/* ----------
|
|
9322
|
+
/* ---------- Conversations + threading ---------- */
|
|
9320
9323
|
const conversationsIntake = ({ agentUserName }) => `
|
|
9321
9324
|
## Conversations Intake & Threading (MANDATORY before acting)
|
|
9322
9325
|
Always load and reason about the current conversation to avoid duplicates and to respond in the right place.
|
|
9323
9326
|
|
|
9324
|
-
|
|
9325
|
-
- **
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
2) **De-duplication**:
|
|
9333
|
-
- If your most recent message is the **last message overall** and **no one else replied** since, prefer **updating your last note** instead of posting a new one:
|
|
9334
|
-
- Use \`update_merge_request_note\` or \`update_issue_note\` accordingly.
|
|
9335
|
-
3) **Reply placement**:
|
|
9336
|
-
- For MR code discussions: reply **inline in the same discussion** (preserve thread context).
|
|
9337
|
-
- For general/MR overview threads: add a single consolidated reply (avoid multiple scattered notes).
|
|
9338
|
-
4) **Sanitize before write**:
|
|
9339
|
-
- Apply the Self-mention Guard, then post.
|
|
9340
|
-
5) **If conversations list is unavailable**:
|
|
9341
|
-
- Post one short note: that you cannot fetch the full conversation due to missing MCP capability, then proceed minimally (no spam).
|
|
9327
|
+
- **MRs**: Use \`mr_discussions({ projectId: $CI_PROJECT_ID, mergeRequestIid })\`.
|
|
9328
|
+
- **Issues**: Use issue discussions if available; if not, rely on event payload and note IDs.
|
|
9329
|
+
|
|
9330
|
+
Rules:
|
|
9331
|
+
1) Detect latest human note (exclude "${agentUserName}"). If it replies to you or is in a discussion you started, reply **in the same thread**.
|
|
9332
|
+
2) If your last message is still the latest and no one else replied, prefer **update_note** instead of creating a new one.
|
|
9333
|
+
3) For MR code discussions: reply inline in the same discussion.
|
|
9334
|
+
4) Always sanitize (see Self-mention Guard) before writing.
|
|
9342
9335
|
`;
|
|
9343
9336
|
const selfMentionGuard = ({ agentUserName }) => `
|
|
9344
|
-
## Self-mention Guard
|
|
9345
|
-
Before ANY
|
|
9346
|
-
|
|
9347
|
-
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
- Do NOT replace with another token; simply remove the self @-mention.
|
|
9351
|
-
- If after sanitization the body becomes empty/meaningless, skip the write.
|
|
9352
|
-
|
|
9353
|
-
Additionally:
|
|
9354
|
-
- If the last actor/author of the target item is you ("${agentUserName}"), **do not** post an acknowledgement comment (avoid loops on your own events).
|
|
9355
|
-
- To assign yourself, use the MCP assignee field(s). Do **not** mention yourself in the body to indicate assignment.
|
|
9337
|
+
## Self-mention Guard
|
|
9338
|
+
Before ANY write (comment/MR/issue/commit message):
|
|
9339
|
+
- Remove all occurrences of "@${agentUserName}" (case-insensitive).
|
|
9340
|
+
- If the text becomes empty, skip the write.
|
|
9341
|
+
- If the last actor is you, skip acknowledgement comments.
|
|
9342
|
+
- To assign yourself, use assignee fields, not mentions.
|
|
9356
9343
|
`;
|
|
9357
9344
|
const commentGuidelines = () => `
|
|
9358
|
-
## Comment Guidelines
|
|
9345
|
+
## Comment Guidelines
|
|
9359
9346
|
- Professional, friendly, concise.
|
|
9360
9347
|
- Always @-mention the human author when replying; never mention yourself.
|
|
9361
|
-
-
|
|
9362
|
-
-
|
|
9363
|
-
- Q&A: answer directly first; add context/links only if useful.
|
|
9364
|
-
- Avoid repeating identical boilerplate across comments.
|
|
9348
|
+
- Acknowledge requests, answer questions directly, confirm fixes or updates.
|
|
9349
|
+
- Avoid repeating boilerplate.
|
|
9365
9350
|
`;
|
|
9366
|
-
/*
|
|
9351
|
+
/* ---------- gitlab-mcp tool usage ---------- */
|
|
9367
9352
|
const mcpOnly = () => `
|
|
9368
|
-
## gitlab-mcp Operations
|
|
9353
|
+
## gitlab-mcp Operations
|
|
9369
9354
|
|
|
9370
9355
|
- **Comments / Notes**
|
|
9371
|
-
- create_note({ projectId, targetType: "issue"|"merge_request", iid, body })
|
|
9372
9356
|
- create_issue_note({ projectId, issueIid, body })
|
|
9373
|
-
- create_merge_request_note({ projectId, mergeRequestIid, body })
|
|
9374
9357
|
- update_issue_note({ projectId, issueIid, noteId, body })
|
|
9358
|
+
- create_merge_request_note({ projectId, mergeRequestIid, body })
|
|
9375
9359
|
- update_merge_request_note({ projectId, mergeRequestIid, noteId, body })
|
|
9376
9360
|
- mr_discussions({ projectId, mergeRequestIid })
|
|
9377
9361
|
|
|
9378
9362
|
- **Issues**
|
|
9379
9363
|
- create_issue({ projectId, title, description, assigneeUsernames?: string[] })
|
|
9380
|
-
- list_issues({ projectId, state?: "opened"|"closed", scope?: "all"|... })
|
|
9381
9364
|
|
|
9382
9365
|
- **Branch & Files**
|
|
9383
9366
|
- create_branch({ projectId, branchName, ref })
|
|
9384
9367
|
- push_files({ projectId, branch, commitMessage, files: [{ filePath, content }] })
|
|
9385
9368
|
- create_or_update_file({ projectId, branch, filePath, content, commitMessage })
|
|
9386
|
-
- get_file_contents({ projectId, ref, path })
|
|
9387
9369
|
- get_branch_diffs({ projectId, from, to })
|
|
9388
9370
|
|
|
9389
9371
|
- **Merge Requests**
|
|
9390
9372
|
- create_merge_request({ projectId, sourceBranch, targetBranch, title, description, assigneeUsernames?: string[] })
|
|
9391
|
-
- get_merge_request({ projectId, mergeRequestIid
|
|
9392
|
-
- get_merge_request_diffs({ projectId, mergeRequestIid
|
|
9393
|
-
- list_merge_request_diffs({ projectId, mergeRequestIid
|
|
9394
|
-
- update_merge_request({ projectId, mergeRequestIid
|
|
9395
|
-
- merge_merge_request(...) // **Do NOT use** (never merge)
|
|
9373
|
+
- get_merge_request({ projectId, mergeRequestIid })
|
|
9374
|
+
- get_merge_request_diffs({ projectId, mergeRequestIid })
|
|
9375
|
+
- list_merge_request_diffs({ projectId, mergeRequestIid, page?, perPage? })
|
|
9376
|
+
- update_merge_request({ projectId, mergeRequestIid, title?, description?, draft?, assigneeUsernames? })
|
|
9396
9377
|
|
|
9397
|
-
- **Pipelines / Jobs**
|
|
9378
|
+
- **Pipelines / Jobs**
|
|
9398
9379
|
- list_pipelines({ projectId, ref?, sha?, status?, orderBy?, sort? })
|
|
9399
|
-
- get_pipeline({ projectId, pipelineId })
|
|
9400
9380
|
- list_pipeline_jobs({ projectId, pipelineId })
|
|
9401
9381
|
- get_pipeline_job_output({ projectId, pipelineId, jobId })
|
|
9402
9382
|
- play_pipeline_job({ projectId, jobId })
|
|
@@ -9408,166 +9388,124 @@ const outputDiscipline = ({ agentUserName }) => `
|
|
|
9408
9388
|
- Keep comments concise and professional.
|
|
9409
9389
|
- Never include "@${agentUserName}" in any body.
|
|
9410
9390
|
`;
|
|
9411
|
-
/* ---------- Event
|
|
9391
|
+
/* ---------- Event-specific helpers ---------- */
|
|
9412
9392
|
const eventSelfParse = () => `
|
|
9413
|
-
## Self-Parse
|
|
9393
|
+
## Self-Parse Raw Payload
|
|
9414
9394
|
From \`event_json\`, extract:
|
|
9415
9395
|
- kind: "issue" | "merge_request" | "note"
|
|
9416
|
-
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
-
|
|
9420
|
-
-
|
|
9421
|
-
- project id/path; detect default branch via \`get_merge_request\`/context as needed
|
|
9422
|
-
- If available: the discussion id / thread context of the note to enable inline replies.
|
|
9396
|
+
- iid from URL (/issues/<n>, /merge_requests/<n>)
|
|
9397
|
+
- note_id if present (#note_<id>)
|
|
9398
|
+
- description/body, state, author, timestamps
|
|
9399
|
+
- project id/path
|
|
9400
|
+
- discussion id if available for inline replies
|
|
9423
9401
|
`;
|
|
9424
|
-
/*
|
|
9402
|
+
/* Resolve MR pipeline from MR IID */
|
|
9425
9403
|
const resolveMrPipeline = () => `
|
|
9426
|
-
## Resolve MR Pipeline
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
2) Prefer **SHA-based** lookup:
|
|
9432
|
-
- \`list_pipelines({ projectId: $CI_PROJECT_ID, sha })\` ordered by most recent; pick the newest.
|
|
9433
|
-
3) Fallback to **ref-based** lookup if SHA not available:
|
|
9434
|
-
- \`list_pipelines({ projectId: $CI_PROJECT_ID, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })\`; pick the newest.
|
|
9435
|
-
4) The chosen pipeline becomes \`mr_pipeline_id\`. Use it for all job queries/plays/cancels related to this MR.
|
|
9436
|
-
- 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.
|
|
9404
|
+
## Resolve MR Pipeline
|
|
9405
|
+
1) get_merge_request({ projectId, mergeRequestIid }) → sourceBranch, sha
|
|
9406
|
+
2) Prefer: list_pipelines({ projectId, sha })
|
|
9407
|
+
3) Else: list_pipelines({ projectId, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })
|
|
9408
|
+
4) Pick newest → mr_pipeline_id
|
|
9437
9409
|
`;
|
|
9410
|
+
/* Guard against double agent-review jobs */
|
|
9438
9411
|
const singleRunnerGuard = () => `
|
|
9439
|
-
## Single-Runner Guard
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
-
|
|
9443
|
-
|
|
9444
|
-
**Procedure (MCP-only):**
|
|
9445
|
-
1) Resolve the MR IID from the event (target URL or text) and run **Resolve MR Pipeline** to get \`mr_pipeline_id\`.
|
|
9446
|
-
2) If \`mr_pipeline_id\` is available:
|
|
9447
|
-
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
9448
|
-
- For any job with \`status\` in \`["running","pending"]\` and \`name\` ending with \`"agent-review"\`, call:
|
|
9449
|
-
- \`cancel_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
9450
|
-
- Proceed immediately after issuing cancellations (do not wait).
|
|
9451
|
-
3) If the pipeline cannot be resolved:
|
|
9452
|
-
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing pipeline context.
|
|
9453
|
-
- Proceed with review.
|
|
9454
|
-
|
|
9455
|
-
**Notes:**
|
|
9456
|
-
- Keep this guard **idempotent** (safe to run multiple times).
|
|
9457
|
-
- Only applies to **event-triggered** flows that act on an **existing MR**.
|
|
9412
|
+
## Single-Runner Guard
|
|
9413
|
+
- If mr_pipeline_id available:
|
|
9414
|
+
- list_pipeline_jobs({ projectId, pipelineId: mr_pipeline_id })
|
|
9415
|
+
- cancel_pipeline_job on any running/pending job ending with "agent-review"
|
|
9416
|
+
- If not available, note limitation and proceed
|
|
9458
9417
|
`;
|
|
9418
|
+
/* If user asks for review from an event, try manual agent-review job first on the MR's pipeline */
|
|
9459
9419
|
const reviewOnDemandFromEvents = () => `
|
|
9460
|
-
## Review-on-Demand
|
|
9461
|
-
If the
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
- \`!<iid>\` (e.g., \`!123\`)
|
|
9467
|
-
- \`/-/merge_requests/<iid>\` in a path or URL
|
|
9468
|
-
- full GitLab MR URL
|
|
9469
|
-
- If no MR can be resolved, reply with a brief comment asking the user to reference an MR (sanitize) and **stop**.
|
|
9470
|
-
|
|
9471
|
-
2) **Find the MR's pipeline** (do **not** use \`$CI_PIPELINE_ID\` from the event):
|
|
9472
|
-
- Execute **Resolve MR Pipeline** to obtain \`mr_pipeline_id\`.
|
|
9473
|
-
|
|
9474
|
-
3) **If a manual "agent-review" job exists on the MR pipeline, trigger it**
|
|
9475
|
-
- If \`mr_pipeline_id\` is available:
|
|
9476
|
-
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
9477
|
-
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
9478
|
-
- Trigger via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
9479
|
-
- **Conversations Intake**: run the section above to determine **where** to post the confirmation (prefer replying in the same thread that requested review).
|
|
9480
|
-
- Post a short comment confirming you triggered the review job (sanitize).
|
|
9481
|
-
- **Stop** further review actions.
|
|
9482
|
-
|
|
9483
|
-
4) **Single-Runner Guard**
|
|
9484
|
-
- 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.
|
|
9485
|
-
|
|
9486
|
-
5) **Enter MR Review Mode**: execute the **MR Review Bundle** below with the resolved \`mr_iid\`.
|
|
9420
|
+
## Review-on-Demand
|
|
9421
|
+
If the text asks for a review ("review", "please review", "PTAL", "needs review", "can you look at", "LGTM?"):
|
|
9422
|
+
1) Resolve MR IID (from target or text).
|
|
9423
|
+
2) Resolve MR pipeline (do NOT use the event pipeline).
|
|
9424
|
+
3) If a manual "agent-review" job exists, play it → confirm in-thread → STOP.
|
|
9425
|
+
4) Else run Single-Runner Guard, then enter MR Review Mode.
|
|
9487
9426
|
`;
|
|
9488
|
-
|
|
9427
|
+
/* ---------- Event workflow ---------- */
|
|
9489
9428
|
const eventWorkflow = ({ agentUserName }) => `
|
|
9490
|
-
##
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9429
|
+
## Event Workflow
|
|
9430
|
+
0) Conversations Intake first
|
|
9431
|
+
1) Acknowledge with note (unless last actor is you)
|
|
9432
|
+
2) Default branch: use \`$CI_DEFAULT_BRANCH\`
|
|
9433
|
+
3) Create branch from \`$CI_DEFAULT_BRANCH\`:
|
|
9434
|
+
create_branch({ projectId: $CI_PROJECT_ID, branchName: "<source_branch>", ref: $CI_DEFAULT_BRANCH })
|
|
9435
|
+
4) Write changes → commit → push:
|
|
9436
|
+
push_files({ projectId: $CI_PROJECT_ID, branch: "<source_branch>", commitMessage, files })
|
|
9437
|
+
5) Verify:
|
|
9438
|
+
get_branch_diffs({ projectId: $CI_PROJECT_ID, from: $CI_DEFAULT_BRANCH, to: "<source_branch>" })
|
|
9439
|
+
- Require non-empty diffs
|
|
9440
|
+
6) Create MR (if diffs exist):
|
|
9441
|
+
create_merge_request({
|
|
9442
|
+
projectId: $CI_PROJECT_ID,
|
|
9443
|
+
sourceBranch: "<source_branch>",
|
|
9444
|
+
targetBranch: $CI_DEFAULT_BRANCH,
|
|
9445
|
+
title,
|
|
9446
|
+
description, // include "Closes #<issue_iid>" when applicable
|
|
9447
|
+
assigneeUsernames: ["${agentUserName}"]
|
|
9448
|
+
})
|
|
9449
|
+
7) Follow-up note (in correct thread) with branch, short SHA if available, files-changed count, and MR link (unless last actor is you)
|
|
9450
|
+
8) If verification fails: comment error and STOP
|
|
9451
|
+
|
|
9452
|
+
## Stdout Summary (Event)
|
|
9453
|
+
Print a plain-text summary with:
|
|
9454
|
+
- action: "event"
|
|
9455
|
+
- source_branch
|
|
9456
|
+
- target_branch: $CI_DEFAULT_BRANCH
|
|
9457
|
+
- diff_count (from get_branch_diffs)
|
|
9458
|
+
- mr_iid and/or mr_url if created
|
|
9459
|
+
- any note ids created/updated
|
|
9460
|
+
- any limitations encountered (e.g., missing discussions tool)
|
|
9512
9461
|
`;
|
|
9513
|
-
/* ---------- MR-
|
|
9462
|
+
/* ---------- MR-specific ---------- */
|
|
9514
9463
|
const mrScope = ({ agentUserName }) => `
|
|
9515
|
-
##
|
|
9516
|
-
-
|
|
9517
|
-
-
|
|
9518
|
-
-
|
|
9519
|
-
- You must **never merge** the MR yourself.
|
|
9464
|
+
## MR Scope
|
|
9465
|
+
- You are reviewing a single MR
|
|
9466
|
+
- Never merge the MR yourself
|
|
9467
|
+
- Work only on the MR's source branch
|
|
9520
9468
|
`;
|
|
9521
9469
|
const mrWorkflow = () => `
|
|
9522
|
-
##
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
-
|
|
9528
|
-
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
- **Verify push landed** using \`get_branch_diffs({ from: "<target_branch>", to: "<source_branch>" })\` and ensure there are diffs.
|
|
9542
|
-
- Post a follow-up MR note summarizing what changed and why, **in the appropriate thread** (sanitize).
|
|
9470
|
+
## MR Workflow
|
|
9471
|
+
1) get_merge_request + get_merge_request_diffs + mr_discussions
|
|
9472
|
+
2) Conversations Intake
|
|
9473
|
+
3) Post review comments first via create_merge_request_note (sanitize)
|
|
9474
|
+
4) If will_push_changes = true:
|
|
9475
|
+
- push_files to source branch
|
|
9476
|
+
- verify with get_branch_diffs({ from: targetBranch || $CI_DEFAULT_BRANCH, to: sourceBranch })
|
|
9477
|
+
- follow-up note summarizing changes in the right thread (sanitize)
|
|
9478
|
+
|
|
9479
|
+
## Stdout Summary (MR)
|
|
9480
|
+
Print a plain-text summary with:
|
|
9481
|
+
- action: "mr"
|
|
9482
|
+
- mr_iid
|
|
9483
|
+
- source_branch and target_branch (fallback to $CI_DEFAULT_BRANCH)
|
|
9484
|
+
- will_push_changes: true|false
|
|
9485
|
+
- diff_count (post-push, if applicable)
|
|
9486
|
+
- discussions: number of notes added/updated
|
|
9487
|
+
- ci: whether mr_pipeline_id was resolved
|
|
9488
|
+
- blocking_failed_jobs (names+stages) if inspected
|
|
9543
9489
|
`;
|
|
9490
|
+
/* ---------- CI Inspection (shared) ---------- */
|
|
9544
9491
|
const ciInspection = () => `
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
2. Fetch job output via \`get_pipeline_job_output({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id, jobId })\`.
|
|
9553
|
-
3. **Classify the failure**:
|
|
9554
|
-
- **Code-related:** compiler/type/lint/test/build script errors. Provide minimal fix in your review/changes. Do **not** retry.
|
|
9555
|
-
- **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.
|
|
9556
|
-
4. **Decision**:
|
|
9557
|
-
- If \`will_push_changes = true\`: do **not** retry; note that the new pipeline from your push will validate fixes.
|
|
9558
|
-
- If \`will_push_changes = false\`: do **not** retry; post diagnosis and next steps (or request human input for infra issues).
|
|
9559
|
-
- If \`mr_pipeline_id\` is not available, you may skip CI analysis or post a short note explaining the missing pipeline context.
|
|
9492
|
+
## CI Inspection (diagnose only)
|
|
9493
|
+
- Use mr_pipeline_id if available
|
|
9494
|
+
- list_pipeline_jobs → for each failed + allow_failure=false:
|
|
9495
|
+
- get_pipeline_job_output
|
|
9496
|
+
- classify: code vs infra
|
|
9497
|
+
- Do not retry; only report diagnosis in a note
|
|
9498
|
+
- If no mr_pipeline_id, note limitation
|
|
9560
9499
|
`;
|
|
9561
9500
|
const outputDisciplineMR = ({ agentUserName }) => `
|
|
9562
9501
|
## Output Discipline (MR)
|
|
9563
|
-
-
|
|
9564
|
-
-
|
|
9565
|
-
- Never
|
|
9502
|
+
- Only gitlab-mcp calls + final summary
|
|
9503
|
+
- Never merge MR
|
|
9504
|
+
- Never mention "@${agentUserName}"
|
|
9566
9505
|
`;
|
|
9567
|
-
/* ----------
|
|
9506
|
+
/* ---------- MR Review Bundle ---------- */
|
|
9568
9507
|
const mrReviewBundle = (ctx) => `
|
|
9569
|
-
## MR Review Mode
|
|
9570
|
-
Resolved MR IID: <set this to the resolved \`mr_iid\` before executing>
|
|
9508
|
+
## MR Review Mode
|
|
9571
9509
|
${mrScope(ctx)}
|
|
9572
9510
|
${mrWorkflow()}
|
|
9573
9511
|
${ciInspection()}
|
|
@@ -9585,12 +9523,12 @@ $(cat $TRIGGER_PAYLOAD)
|
|
|
9585
9523
|
${identity(ctx)}
|
|
9586
9524
|
${goldenRules(ctx)}
|
|
9587
9525
|
${selfMentionGuard(ctx)}
|
|
9588
|
-
${conversationsIntake(ctx)}
|
|
9526
|
+
${conversationsIntake(ctx)}
|
|
9589
9527
|
${eventSelfParse()}
|
|
9590
|
-
${resolveMrPipeline()}
|
|
9591
|
-
${singleRunnerGuard()}
|
|
9528
|
+
${resolveMrPipeline()}
|
|
9529
|
+
${singleRunnerGuard()}
|
|
9592
9530
|
${reviewOnDemandFromEvents()}
|
|
9593
|
-
${mrReviewBundle(ctx)}
|
|
9531
|
+
${mrReviewBundle(ctx)}
|
|
9594
9532
|
${eventWorkflow(ctx)}
|
|
9595
9533
|
${commentGuidelines()}
|
|
9596
9534
|
${mcpOnly()}
|
|
@@ -9610,7 +9548,7 @@ description: $CI_MERGE_REQUEST_DESCRIPTION
|
|
|
9610
9548
|
${mrScope(ctx)}
|
|
9611
9549
|
${goldenRules(ctx)}
|
|
9612
9550
|
${selfMentionGuard(ctx)}
|
|
9613
|
-
${conversationsIntake(ctx)}
|
|
9551
|
+
${conversationsIntake(ctx)}
|
|
9614
9552
|
${mrWorkflow()}
|
|
9615
9553
|
${ciInspection()}
|
|
9616
9554
|
${commentGuidelines()}
|
|
@@ -9654,7 +9592,7 @@ const callClaude = ({ prompt }) => {
|
|
|
9654
9592
|
return [
|
|
9655
9593
|
`export PROMPT="${(0, bashEscape_1.escapeNewlines)((0, bashEscape_1.escapeDoubleQuotes)((0, bashEscape_1.escapeBackTicks)(prompt)))}"`,
|
|
9656
9594
|
//'echo "$PROMPT"',
|
|
9657
|
-
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash
|
|
9595
|
+
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash Read(*) Edit(*) Write(*) mcp__gitlab" --verbose --debug`,
|
|
9658
9596
|
];
|
|
9659
9597
|
};
|
|
9660
9598
|
exports.callClaude = callClaude;
|