@catladder/cli 3.16.1 → 3.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +2 -2
- package/dist/bundles/cli/index.js +1 -1
- package/dist/pipeline/src/pipeline/agent/prompts.js +132 -193
- 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
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries),
|
|
3
|
-
// conversations-aware
|
|
4
|
-
//
|
|
2
|
+
// prompts.ts — MCP-only, DRY, review-first-then-push, CI diagnosis (no retries),
|
|
3
|
+
// self-mention guard, conversations-aware (issues & MRs), inline replies, de-duplication.
|
|
4
|
+
// Review-on-demand: resolves MR pipeline and triggers manual "agent-review" when present.
|
|
5
|
+
// Single-runner guard: cancels running "agent-review" on the MR pipeline before acting.
|
|
6
|
+
// Stdout summaries included for both event and MR flows.
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.getMergeRequestPrompt = exports.getEventPrompt = void 0;
|
|
7
9
|
/* ---------- Shared blocks ---------- */
|
|
8
10
|
const header = () => `
|
|
9
11
|
Project ID: $CI_PROJECT_ID
|
|
10
12
|
GitLab Host: $CI_SERVER_URL
|
|
13
|
+
Default Branch: $CI_DEFAULT_BRANCH
|
|
11
14
|
`;
|
|
12
15
|
const identity = ({ agentUserName }) => `
|
|
13
16
|
## Identity
|
|
@@ -18,93 +21,70 @@ const goldenRules = ({ agentUserName }) => `
|
|
|
18
21
|
- Use the \`gitlab-mcp\` tool for ALL GitLab actions. Do not call any other APIs.
|
|
19
22
|
- If a needed \`gitlab-mcp\` capability is unavailable, post a short comment explaining the limitation and stop.
|
|
20
23
|
- NEVER mention yourself ("@${agentUserName}") anywhere (comments, descriptions, titles, commit messages).
|
|
21
|
-
- NEVER push to
|
|
24
|
+
- NEVER push to $CI_DEFAULT_BRANCH or any protected branch. Always create a new branch and open a Merge Request (MR).
|
|
22
25
|
- Always assign yourself as the assignee of any MR you create.
|
|
23
26
|
- Do not create an MR for a **closed** issue.
|
|
24
27
|
- Keep actions minimal and idempotent. Avoid duplicate comments or duplicate MRs.
|
|
25
28
|
- Use ONE stable \`source_branch\` per run; do not regenerate its name later.
|
|
26
29
|
`;
|
|
27
|
-
/* ----------
|
|
30
|
+
/* ---------- Conversations + threading ---------- */
|
|
28
31
|
const conversationsIntake = ({ agentUserName }) => `
|
|
29
32
|
## Conversations Intake & Threading (MANDATORY before acting)
|
|
30
33
|
Always load and reason about the current conversation to avoid duplicates and to respond in the right place.
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
- **
|
|
34
|
-
- **Issues**: If an issue-discussions/listing tool exists, use it. If not available in \`gitlab-mcp\`, rely on the **event payload** and **your last note ids** if present; otherwise post a single concise note acknowledging the limitation and proceed.
|
|
35
|
+
- **MRs**: Use \`mr_discussions({ projectId: $CI_PROJECT_ID, mergeRequestIid })\`.
|
|
36
|
+
- **Issues**: Use issue discussions if available; if not, rely on event payload and note IDs.
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
1)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- 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:
|
|
42
|
-
- Use \`update_merge_request_note\` or \`update_issue_note\` accordingly.
|
|
43
|
-
3) **Reply placement**:
|
|
44
|
-
- For MR code discussions: reply **inline in the same discussion** (preserve thread context).
|
|
45
|
-
- For general/MR overview threads: add a single consolidated reply (avoid multiple scattered notes).
|
|
46
|
-
4) **Sanitize before write**:
|
|
47
|
-
- Apply the Self-mention Guard, then post.
|
|
48
|
-
5) **If conversations list is unavailable**:
|
|
49
|
-
- Post one short note: that you cannot fetch the full conversation due to missing MCP capability, then proceed minimally (no spam).
|
|
38
|
+
Rules:
|
|
39
|
+
1) Detect latest human note (exclude "${agentUserName}"). If it replies to you or is in a discussion you started, reply **in the same thread**.
|
|
40
|
+
2) If your last message is still the latest and no one else replied, prefer **update_note** instead of creating a new one.
|
|
41
|
+
3) For MR code discussions: reply inline in the same discussion.
|
|
42
|
+
4) Always sanitize (see Self-mention Guard) before writing.
|
|
50
43
|
`;
|
|
51
44
|
const selfMentionGuard = ({ agentUserName }) => `
|
|
52
|
-
## Self-mention Guard
|
|
53
|
-
Before ANY
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- Do NOT replace with another token; simply remove the self @-mention.
|
|
59
|
-
- If after sanitization the body becomes empty/meaningless, skip the write.
|
|
60
|
-
|
|
61
|
-
Additionally:
|
|
62
|
-
- If the last actor/author of the target item is you ("${agentUserName}"), **do not** post an acknowledgement comment (avoid loops on your own events).
|
|
63
|
-
- To assign yourself, use the MCP assignee field(s). Do **not** mention yourself in the body to indicate assignment.
|
|
45
|
+
## Self-mention Guard
|
|
46
|
+
Before ANY write (comment/MR/issue/commit message):
|
|
47
|
+
- Remove all occurrences of "@${agentUserName}" (case-insensitive).
|
|
48
|
+
- If the text becomes empty, skip the write.
|
|
49
|
+
- If the last actor is you, skip acknowledgement comments.
|
|
50
|
+
- To assign yourself, use assignee fields, not mentions.
|
|
64
51
|
`;
|
|
65
52
|
const commentGuidelines = () => `
|
|
66
|
-
## Comment Guidelines
|
|
53
|
+
## Comment Guidelines
|
|
67
54
|
- Professional, friendly, concise.
|
|
68
55
|
- Always @-mention the human author when replying; never mention yourself.
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- Q&A: answer directly first; add context/links only if useful.
|
|
72
|
-
- Avoid repeating identical boilerplate across comments.
|
|
56
|
+
- Acknowledge requests, answer questions directly, confirm fixes or updates.
|
|
57
|
+
- Avoid repeating boilerplate.
|
|
73
58
|
`;
|
|
74
|
-
/*
|
|
59
|
+
/* ---------- gitlab-mcp tool usage ---------- */
|
|
75
60
|
const mcpOnly = () => `
|
|
76
|
-
## gitlab-mcp Operations
|
|
61
|
+
## gitlab-mcp Operations
|
|
77
62
|
|
|
78
63
|
- **Comments / Notes**
|
|
79
|
-
- create_note({ projectId, targetType: "issue"|"merge_request", iid, body })
|
|
80
64
|
- create_issue_note({ projectId, issueIid, body })
|
|
81
|
-
- create_merge_request_note({ projectId, mergeRequestIid, body })
|
|
82
65
|
- update_issue_note({ projectId, issueIid, noteId, body })
|
|
66
|
+
- create_merge_request_note({ projectId, mergeRequestIid, body })
|
|
83
67
|
- update_merge_request_note({ projectId, mergeRequestIid, noteId, body })
|
|
84
68
|
- mr_discussions({ projectId, mergeRequestIid })
|
|
85
69
|
|
|
86
70
|
- **Issues**
|
|
87
71
|
- create_issue({ projectId, title, description, assigneeUsernames?: string[] })
|
|
88
|
-
- list_issues({ projectId, state?: "opened"|"closed", scope?: "all"|... })
|
|
89
72
|
|
|
90
73
|
- **Branch & Files**
|
|
91
74
|
- create_branch({ projectId, branchName, ref })
|
|
92
75
|
- push_files({ projectId, branch, commitMessage, files: [{ filePath, content }] })
|
|
93
76
|
- create_or_update_file({ projectId, branch, filePath, content, commitMessage })
|
|
94
|
-
- get_file_contents({ projectId, ref, path })
|
|
95
77
|
- get_branch_diffs({ projectId, from, to })
|
|
96
78
|
|
|
97
79
|
- **Merge Requests**
|
|
98
80
|
- create_merge_request({ projectId, sourceBranch, targetBranch, title, description, assigneeUsernames?: string[] })
|
|
99
|
-
- get_merge_request({ projectId, mergeRequestIid
|
|
100
|
-
- get_merge_request_diffs({ projectId, mergeRequestIid
|
|
101
|
-
- list_merge_request_diffs({ projectId, mergeRequestIid
|
|
102
|
-
- update_merge_request({ projectId, mergeRequestIid
|
|
103
|
-
- merge_merge_request(...) // **Do NOT use** (never merge)
|
|
81
|
+
- get_merge_request({ projectId, mergeRequestIid })
|
|
82
|
+
- get_merge_request_diffs({ projectId, mergeRequestIid })
|
|
83
|
+
- list_merge_request_diffs({ projectId, mergeRequestIid, page?, perPage? })
|
|
84
|
+
- update_merge_request({ projectId, mergeRequestIid, title?, description?, draft?, assigneeUsernames? })
|
|
104
85
|
|
|
105
|
-
- **Pipelines / Jobs**
|
|
86
|
+
- **Pipelines / Jobs**
|
|
106
87
|
- list_pipelines({ projectId, ref?, sha?, status?, orderBy?, sort? })
|
|
107
|
-
- get_pipeline({ projectId, pipelineId })
|
|
108
88
|
- list_pipeline_jobs({ projectId, pipelineId })
|
|
109
89
|
- get_pipeline_job_output({ projectId, pipelineId, jobId })
|
|
110
90
|
- play_pipeline_job({ projectId, jobId })
|
|
@@ -116,166 +96,125 @@ const outputDiscipline = ({ agentUserName }) => `
|
|
|
116
96
|
- Keep comments concise and professional.
|
|
117
97
|
- Never include "@${agentUserName}" in any body.
|
|
118
98
|
`;
|
|
119
|
-
/* ---------- Event
|
|
99
|
+
/* ---------- Event-specific helpers ---------- */
|
|
120
100
|
const eventSelfParse = () => `
|
|
121
|
-
## Self-Parse
|
|
101
|
+
## Self-Parse Raw Payload
|
|
122
102
|
From \`event_json\`, extract:
|
|
123
103
|
- kind: "issue" | "merge_request" | "note"
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
- project id/path; detect default branch via \`get_merge_request\`/context as needed
|
|
130
|
-
- If available: the discussion id / thread context of the note to enable inline replies.
|
|
104
|
+
- iid from URL (/issues/<n>, /merge_requests/<n>)
|
|
105
|
+
- note_id if present (#note_<id>)
|
|
106
|
+
- description/body, state, author, timestamps
|
|
107
|
+
- project id/path
|
|
108
|
+
- discussion id if available for inline replies
|
|
131
109
|
`;
|
|
132
|
-
/*
|
|
110
|
+
/* Resolve MR pipeline from MR IID */
|
|
133
111
|
const resolveMrPipeline = () => `
|
|
134
|
-
## Resolve MR Pipeline
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
2) Prefer **SHA-based** lookup:
|
|
140
|
-
- \`list_pipelines({ projectId: $CI_PROJECT_ID, sha })\` ordered by most recent; pick the newest.
|
|
141
|
-
3) Fallback to **ref-based** lookup if SHA not available:
|
|
142
|
-
- \`list_pipelines({ projectId: $CI_PROJECT_ID, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })\`; pick the newest.
|
|
143
|
-
4) The chosen pipeline becomes \`mr_pipeline_id\`. Use it for all job queries/plays/cancels related to this MR.
|
|
144
|
-
- 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.
|
|
112
|
+
## Resolve MR Pipeline
|
|
113
|
+
1) get_merge_request({ projectId, mergeRequestIid }) → sourceBranch, sha
|
|
114
|
+
2) Prefer: list_pipelines({ projectId, sha })
|
|
115
|
+
3) Else: list_pipelines({ projectId, ref: sourceBranch, orderBy: "updated_at", sort: "desc" })
|
|
116
|
+
4) Pick newest → mr_pipeline_id
|
|
145
117
|
`;
|
|
118
|
+
/* Guard against double agent-review jobs */
|
|
146
119
|
const singleRunnerGuard = () => `
|
|
147
|
-
## Single-Runner Guard
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
**Procedure (MCP-only):**
|
|
153
|
-
1) Resolve the MR IID from the event (target URL or text) and run **Resolve MR Pipeline** to get \`mr_pipeline_id\`.
|
|
154
|
-
2) If \`mr_pipeline_id\` is available:
|
|
155
|
-
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
156
|
-
- For any job with \`status\` in \`["running","pending"]\` and \`name\` ending with \`"agent-review"\`, call:
|
|
157
|
-
- \`cancel_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
158
|
-
- Proceed immediately after issuing cancellations (do not wait).
|
|
159
|
-
3) If the pipeline cannot be resolved:
|
|
160
|
-
- Post a short MR note stating you are proceeding but **cannot verify/cancel** a running \`agent-review\` job due to missing pipeline context.
|
|
161
|
-
- Proceed with review.
|
|
162
|
-
|
|
163
|
-
**Notes:**
|
|
164
|
-
- Keep this guard **idempotent** (safe to run multiple times).
|
|
165
|
-
- Only applies to **event-triggered** flows that act on an **existing MR**.
|
|
120
|
+
## Single-Runner Guard
|
|
121
|
+
- If mr_pipeline_id available:
|
|
122
|
+
- list_pipeline_jobs({ projectId, pipelineId: mr_pipeline_id })
|
|
123
|
+
- cancel_pipeline_job on any running/pending job ending with "agent-review"
|
|
124
|
+
- If not available, note limitation and proceed
|
|
166
125
|
`;
|
|
126
|
+
/* If user asks for review from an event, try manual agent-review job first on the MR's pipeline */
|
|
167
127
|
const reviewOnDemandFromEvents = () => `
|
|
168
|
-
## Review-on-Demand
|
|
169
|
-
If the
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
- \`!<iid>\` (e.g., \`!123\`)
|
|
175
|
-
- \`/-/merge_requests/<iid>\` in a path or URL
|
|
176
|
-
- full GitLab MR URL
|
|
177
|
-
- If no MR can be resolved, reply with a brief comment asking the user to reference an MR (sanitize) and **stop**.
|
|
178
|
-
|
|
179
|
-
2) **Find the MR's pipeline** (do **not** use \`$CI_PIPELINE_ID\` from the event):
|
|
180
|
-
- Execute **Resolve MR Pipeline** to obtain \`mr_pipeline_id\`.
|
|
181
|
-
|
|
182
|
-
3) **If a manual "agent-review" job exists on the MR pipeline, trigger it**
|
|
183
|
-
- If \`mr_pipeline_id\` is available:
|
|
184
|
-
- \`list_pipeline_jobs({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id })\`.
|
|
185
|
-
- If any job has \`status = "manual"\` **and** its \`name\` ends with "agent-review":
|
|
186
|
-
- Trigger via \`play_pipeline_job({ projectId: $CI_PROJECT_ID, jobId })\`.
|
|
187
|
-
- **Conversations Intake**: run the section above to determine **where** to post the confirmation (prefer replying in the same thread that requested review).
|
|
188
|
-
- Post a short comment confirming you triggered the review job (sanitize).
|
|
189
|
-
- **Stop** further review actions.
|
|
190
|
-
|
|
191
|
-
4) **Single-Runner Guard**
|
|
192
|
-
- 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.
|
|
193
|
-
|
|
194
|
-
5) **Enter MR Review Mode**: execute the **MR Review Bundle** below with the resolved \`mr_iid\`.
|
|
128
|
+
## Review-on-Demand
|
|
129
|
+
If the text asks for a review ("review", "please review", "PTAL", "needs review", "can you look at", "LGTM?"):
|
|
130
|
+
1) Resolve MR IID (from target or text).
|
|
131
|
+
2) Resolve MR pipeline (do NOT use the event pipeline).
|
|
132
|
+
3) If a manual "agent-review" job exists, play it → confirm in-thread → STOP.
|
|
133
|
+
4) Else run Single-Runner Guard, then enter MR Review Mode.
|
|
195
134
|
`;
|
|
196
|
-
|
|
135
|
+
/* ---------- Event workflow ---------- */
|
|
197
136
|
const eventWorkflow = ({ agentUserName }) => `
|
|
198
|
-
##
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
137
|
+
## Event Workflow
|
|
138
|
+
0) Conversations Intake first
|
|
139
|
+
1) Acknowledge with note (unless last actor is you)
|
|
140
|
+
2) Default branch: use \`$CI_DEFAULT_BRANCH\`
|
|
141
|
+
3) Create branch from \`$CI_DEFAULT_BRANCH\`:
|
|
142
|
+
create_branch({ projectId: $CI_PROJECT_ID, branchName: "<source_branch>", ref: $CI_DEFAULT_BRANCH })
|
|
143
|
+
4) Write changes → commit → push:
|
|
144
|
+
push_files({ projectId: $CI_PROJECT_ID, branch: "<source_branch>", commitMessage, files })
|
|
145
|
+
- Ensure files list is not empty before calling push_files; if empty, skip pushing.
|
|
146
|
+
5) Verify:
|
|
147
|
+
get_branch_diffs({ projectId: $CI_PROJECT_ID, from: $CI_DEFAULT_BRANCH, to: "<source_branch>" })
|
|
148
|
+
- Require non-empty diffs
|
|
149
|
+
6) Create MR (if diffs exist):
|
|
150
|
+
create_merge_request({
|
|
151
|
+
projectId: $CI_PROJECT_ID,
|
|
152
|
+
sourceBranch: "<source_branch>",
|
|
153
|
+
targetBranch: $CI_DEFAULT_BRANCH,
|
|
154
|
+
title,
|
|
155
|
+
description, // include "Closes #<issue_iid>" when applicable
|
|
156
|
+
assigneeUsernames: ["${agentUserName}"]
|
|
157
|
+
})
|
|
158
|
+
7) Follow-up note (in correct thread) with branch, short SHA if available, files-changed count, and MR link (unless last actor is you)
|
|
159
|
+
8) If verification fails: comment error and STOP
|
|
218
160
|
|
|
219
|
-
|
|
161
|
+
## Stdout Summary (Event)
|
|
162
|
+
Print a plain-text summary with:
|
|
163
|
+
- action: "event"
|
|
164
|
+
- source_branch
|
|
165
|
+
- target_branch: $CI_DEFAULT_BRANCH
|
|
166
|
+
- diff_count (from get_branch_diffs)
|
|
167
|
+
- mr_iid and/or mr_url if created
|
|
168
|
+
- any note ids created/updated
|
|
169
|
+
- any limitations encountered (e.g., missing discussions tool)
|
|
220
170
|
`;
|
|
221
|
-
/* ---------- MR-
|
|
171
|
+
/* ---------- MR-specific ---------- */
|
|
222
172
|
const mrScope = ({ agentUserName }) => `
|
|
223
|
-
##
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
- You must **never merge** the MR yourself.
|
|
173
|
+
## MR Scope
|
|
174
|
+
- You are reviewing a single MR
|
|
175
|
+
- Never merge the MR yourself
|
|
176
|
+
- Work only on the MR's source branch
|
|
228
177
|
`;
|
|
229
178
|
const mrWorkflow = () => `
|
|
230
|
-
##
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
179
|
+
## MR Workflow
|
|
180
|
+
1) get_merge_request + get_merge_request_diffs + mr_discussions
|
|
181
|
+
2) Conversations Intake
|
|
182
|
+
3) Post review comments first via create_merge_request_note (sanitize)
|
|
183
|
+
4) If will_push_changes = true:
|
|
184
|
+
- push_files to source branch
|
|
185
|
+
- verify with get_branch_diffs({ from: targetBranch || $CI_DEFAULT_BRANCH, to: sourceBranch })
|
|
186
|
+
- follow-up note summarizing changes in the right thread (sanitize)
|
|
237
187
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
- **Push** to the MR's **source branch** via \`push_files\` (or \`create_or_update_file\`).
|
|
249
|
-
- **Verify push landed** using \`get_branch_diffs({ from: "<target_branch>", to: "<source_branch>" })\` and ensure there are diffs.
|
|
250
|
-
- Post a follow-up MR note summarizing what changed and why, **in the appropriate thread** (sanitize).
|
|
188
|
+
## Stdout Summary (MR)
|
|
189
|
+
Print a plain-text summary with:
|
|
190
|
+
- action: "mr"
|
|
191
|
+
- mr_iid
|
|
192
|
+
- source_branch and target_branch (fallback to $CI_DEFAULT_BRANCH)
|
|
193
|
+
- will_push_changes: true|false
|
|
194
|
+
- diff_count (post-push, if applicable)
|
|
195
|
+
- discussions: number of notes added/updated
|
|
196
|
+
- ci: whether mr_pipeline_id was resolved
|
|
197
|
+
- blocking_failed_jobs (names+stages) if inspected
|
|
251
198
|
`;
|
|
199
|
+
/* ---------- CI Inspection (shared) ---------- */
|
|
252
200
|
const ciInspection = () => `
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
2. Fetch job output via \`get_pipeline_job_output({ projectId: $CI_PROJECT_ID, pipelineId: mr_pipeline_id, jobId })\`.
|
|
261
|
-
3. **Classify the failure**:
|
|
262
|
-
- **Code-related:** compiler/type/lint/test/build script errors. Provide minimal fix in your review/changes. Do **not** retry.
|
|
263
|
-
- **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.
|
|
264
|
-
4. **Decision**:
|
|
265
|
-
- If \`will_push_changes = true\`: do **not** retry; note that the new pipeline from your push will validate fixes.
|
|
266
|
-
- If \`will_push_changes = false\`: do **not** retry; post diagnosis and next steps (or request human input for infra issues).
|
|
267
|
-
- If \`mr_pipeline_id\` is not available, you may skip CI analysis or post a short note explaining the missing pipeline context.
|
|
201
|
+
## CI Inspection (diagnose only)
|
|
202
|
+
- Use mr_pipeline_id if available
|
|
203
|
+
- list_pipeline_jobs → for each failed + allow_failure=false:
|
|
204
|
+
- get_pipeline_job_output
|
|
205
|
+
- classify: code vs infra
|
|
206
|
+
- Do not retry; only report diagnosis in a note
|
|
207
|
+
- If no mr_pipeline_id, note limitation
|
|
268
208
|
`;
|
|
269
209
|
const outputDisciplineMR = ({ agentUserName }) => `
|
|
270
210
|
## Output Discipline (MR)
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
- Never
|
|
211
|
+
- Only gitlab-mcp calls + final summary
|
|
212
|
+
- Never merge MR
|
|
213
|
+
- Never mention "@${agentUserName}"
|
|
274
214
|
`;
|
|
275
|
-
/* ----------
|
|
215
|
+
/* ---------- MR Review Bundle ---------- */
|
|
276
216
|
const mrReviewBundle = (ctx) => `
|
|
277
|
-
## MR Review Mode
|
|
278
|
-
Resolved MR IID: <set this to the resolved \`mr_iid\` before executing>
|
|
217
|
+
## MR Review Mode
|
|
279
218
|
${mrScope(ctx)}
|
|
280
219
|
${mrWorkflow()}
|
|
281
220
|
${ciInspection()}
|
|
@@ -293,12 +232,12 @@ $(cat $TRIGGER_PAYLOAD)
|
|
|
293
232
|
${identity(ctx)}
|
|
294
233
|
${goldenRules(ctx)}
|
|
295
234
|
${selfMentionGuard(ctx)}
|
|
296
|
-
${conversationsIntake(ctx)}
|
|
235
|
+
${conversationsIntake(ctx)}
|
|
297
236
|
${eventSelfParse()}
|
|
298
|
-
${resolveMrPipeline()}
|
|
299
|
-
${singleRunnerGuard()}
|
|
237
|
+
${resolveMrPipeline()}
|
|
238
|
+
${singleRunnerGuard()}
|
|
300
239
|
${reviewOnDemandFromEvents()}
|
|
301
|
-
${mrReviewBundle(ctx)}
|
|
240
|
+
${mrReviewBundle(ctx)}
|
|
302
241
|
${eventWorkflow(ctx)}
|
|
303
242
|
${commentGuidelines()}
|
|
304
243
|
${mcpOnly()}
|
|
@@ -318,7 +257,7 @@ description: $CI_MERGE_REQUEST_DESCRIPTION
|
|
|
318
257
|
${mrScope(ctx)}
|
|
319
258
|
${goldenRules(ctx)}
|
|
320
259
|
${selfMentionGuard(ctx)}
|
|
321
|
-
${conversationsIntake(ctx)}
|
|
260
|
+
${conversationsIntake(ctx)}
|
|
322
261
|
${mrWorkflow()}
|
|
323
262
|
${ciInspection()}
|
|
324
263
|
${commentGuidelines()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/prompts.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/prompts.ts"],"names":[],"mappings":"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"}
|
|
@@ -26,7 +26,7 @@ const callClaude = ({ prompt }) => {
|
|
|
26
26
|
return [
|
|
27
27
|
`export PROMPT="${(0, bashEscape_1.escapeNewlines)((0, bashEscape_1.escapeDoubleQuotes)((0, bashEscape_1.escapeBackTicks)(prompt)))}"`,
|
|
28
28
|
//'echo "$PROMPT"',
|
|
29
|
-
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash
|
|
29
|
+
`claude -p "$PROMPT" --permission-mode acceptEdits --allowedTools "Bash Read(*) Edit(*) Write(*) mcp__gitlab" --verbose --debug`,
|
|
30
30
|
];
|
|
31
31
|
};
|
|
32
32
|
exports.callClaude = callClaude;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../pipeline/src/pipeline/agent/shared.ts"],"names":[],"mappings":";;;AAAA,sDAI+B;AAC/B,yCAA8C;AAGvC,MAAM,kBAAkB,GAAG,CAChC,OAAqB,EAC4B,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,MAAM;IACf,+BAA+B;IAC/B,KAAK,EAAE,IAAA,uBAAc,EAAC,cAAc,CAAC;IACrC,SAAS,EAAE;QACT,qBAAqB,EAAE,OAAO;QAC9B,4BAA4B,EAAE,qCAAqC,EAAE,0DAA0D;QAC/H,cAAc,EAAE,gBAAgB;KACjC;CACF,CAAC,CAAC;AAZU,QAAA,kBAAkB,sBAY5B;AAEU,QAAA,eAAe,GAAG;IAC7B,sCAAsC;IACtC,gBAAgB;IAChB,sCAAsC;IACtC,6CAA6C;IAC7C,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;AAC/B,yCAA8C;AAGvC,MAAM,kBAAkB,GAAG,CAChC,OAAqB,EAC4B,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,MAAM;IACf,+BAA+B;IAC/B,KAAK,EAAE,IAAA,uBAAc,EAAC,cAAc,CAAC;IACrC,SAAS,EAAE;QACT,qBAAqB,EAAE,OAAO;QAC9B,4BAA4B,EAAE,qCAAqC,EAAE,0DAA0D;QAC/H,cAAc,EAAE,gBAAgB;KACjC;CACF,CAAC,CAAC;AAZU,QAAA,kBAAkB,sBAY5B;AAEU,QAAA,eAAe,GAAG;IAC7B,sCAAsC;IACtC,gBAAgB;IAChB,sCAAsC;IACtC,6CAA6C;IAC7C,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,gIAAgI;KACjI,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB"}
|