Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x | import { z } from "zod"; import { PaginationOptionsSchema } from "../shared"; import { flexibleBoolean } from "../utils"; // Pipeline related schemas export const GitLabPipelineSchema = z.object({ id: z.coerce.string(), project_id: z.coerce.string(), sha: z.string(), ref: z.string(), status: z.string(), source: z.string().optional(), created_at: z.string(), updated_at: z.string(), web_url: z.string(), duration: z.number().nullable().optional(), started_at: z.string().nullable().optional(), finished_at: z.string().nullable().optional(), coverage: z.coerce.number().nullable().optional(), user: z .object({ id: z.coerce.string(), name: z.string(), username: z.string(), avatar_url: z.string().nullable().optional(), }) .optional(), detailed_status: z .object({ icon: z.string().optional(), text: z.string().optional(), label: z.string().optional(), group: z.string().optional(), tooltip: z.string().optional(), has_details: flexibleBoolean.optional(), details_path: z.string().optional(), illustration: z .object({ image: z.string().optional(), size: z.string().optional(), title: z.string().optional(), }) .nullable() .optional(), favicon: z.string().optional(), }) .optional(), }); // Pipeline job related schemas export const GitLabPipelineJobSchema = z.object({ id: z.coerce.string(), status: z.string(), stage: z.string(), name: z.string(), ref: z.string(), tag: flexibleBoolean, coverage: z.coerce.number().nullable().optional(), allow_failure: flexibleBoolean.optional(), created_at: z.string(), started_at: z.string().optional(), finished_at: z.string().optional(), duration: z.number().optional(), queued_duration: z.number().optional(), user: z .object({ id: z.coerce.string(), name: z.string(), username: z.string(), state: z.string(), avatar_url: z.string().nullable().optional(), web_url: z.string(), }) .optional(), commit: z .object({ id: z.string(), short_id: z.string(), title: z.string(), author_name: z.string(), author_email: z.string(), created_at: z.string(), message: z.string(), }) .optional(), pipeline: z .object({ id: z.coerce.string(), project_id: z.coerce.string(), ref: z.string(), sha: z.string(), status: z.string(), }) .optional(), web_url: z.string(), }); // Pipeline trigger job (bridge) schema export const GitLabPipelineTriggerJobSchema = z.object({ id: z.coerce.string(), status: z.string(), stage: z.string(), name: z.string(), ref: z.string(), tag: flexibleBoolean, coverage: z.coerce.number().nullable().optional(), allow_failure: flexibleBoolean.optional(), created_at: z.string(), started_at: z.string().optional(), finished_at: z.string().optional(), duration: z.number().optional(), queued_duration: z.number().optional(), user: z .object({ id: z.coerce.string(), name: z.string(), username: z.string(), state: z.string(), avatar_url: z.string().nullable().optional(), web_url: z.string(), }) .optional(), commit: z .object({ id: z.string(), short_id: z.string(), title: z.string(), author_name: z.string(), author_email: z.string(), created_at: z.string(), message: z.string(), }) .optional(), pipeline: z .object({ id: z.coerce.string(), project_id: z.coerce.string(), ref: z.string(), sha: z.string(), status: z.string(), }) .optional(), web_url: z.string(), downstream_pipeline: z .object({ id: z.coerce.string(), sha: z.string(), ref: z.string(), status: z.string(), created_at: z.string(), updated_at: z.string(), web_url: z.string(), }) .optional(), }); // Read-only pipeline operation schemas export const ListPipelinesSchema = z .object({ project_id: z.coerce.string().describe("Project ID or URL-encoded path"), scope: z .enum(["running", "pending", "finished", "branches", "tags"]) .optional() .describe("The scope of pipelines to return"), status: z .enum([ "created", "waiting_for_resource", "preparing", "pending", "running", "success", "failed", "canceled", "skipped", "manual", "scheduled", ]) .optional() .describe("The status of pipelines to return"), source: z .enum([ "push", "web", "trigger", "schedule", "api", "external", "chat", "webide", "merge_request_event", "external_pull_request_event", "parent_pipeline", "ondemand_dast_scan", "ondemand_dast_validation", ]) .optional() .describe("The source of pipelines"), ref: z.string().optional().describe("The ref to filter by"), sha: z.string().optional().describe("The SHA to filter by"), yaml_errors: z.boolean().optional().describe("Filter by YAML errors"), name: z.string().optional().describe("The name of the user who triggered the pipeline"), username: z.string().optional().describe("The username who triggered the pipeline"), updated_after: z.string().optional().describe("ISO 8601 datetime to filter by updated_after"), updated_before: z.string().optional().describe("ISO 8601 datetime to filter by updated_before"), order_by: z .enum(["id", "status", "ref", "updated_at", "user_id"]) .optional() .describe("Order pipelines by"), sort: z.enum(["asc", "desc"]).optional().describe("Sort order"), }) .merge(PaginationOptionsSchema); export const GetPipelineSchema = z.object({ project_id: z.coerce.string().describe("Project ID or URL-encoded path"), pipeline_id: z.coerce.string().describe("The ID of the pipeline"), }); // Schema for listing jobs in a pipeline export const ListPipelineJobsSchema = z .object({ project_id: z.coerce.string().describe("Project ID or URL-encoded path"), pipeline_id: z.coerce.string().describe("The ID of the pipeline"), scope: z .enum(["created", "pending", "running", "failed", "success", "canceled", "skipped", "manual"]) .array() .optional() .describe("Scope of jobs to show"), include_retried: z.boolean().optional().describe("Include retried jobs in the response"), }) .merge(PaginationOptionsSchema); export const ListPipelineTriggerJobsSchema = z .object({ project_id: z.coerce.string().describe("Project ID or URL-encoded path"), pipeline_id: z.coerce.string().describe("The ID of the pipeline"), scope: z // https://docs.gitlab.com/api/jobs/#job-status-values .enum([ "created", "pending", "running", "failed", "success", "canceled", "skipped", "manual", "waiting_for_resource", "preparing", ]) .array() .optional() .describe("Scope of jobs to show"), include_retried: z.boolean().optional().describe("Include retried jobs in the response"), }) .merge(PaginationOptionsSchema); // Schema for the input parameters for pipeline job operations export const GetPipelineJobOutputSchema = z.object({ project_id: z.coerce.string().describe("Project ID or URL-encoded path"), job_id: z.coerce.string().describe("The ID of the job"), limit: z .number() .optional() .describe( "Maximum number of lines to return. When combined with start, acts as line count from that position" ), max_lines: z .number() .optional() .describe("Maximum number of lines to return (alternative to limit)"), start: z .number() .optional() .describe( "Start from specific line number (0-based). Positive values start from beginning, negative values start from end (e.g., -100 = last 100 lines)" ), }); // Export types export type GitLabPipeline = z.infer<typeof GitLabPipelineSchema>; export type GitLabPipelineJob = z.infer<typeof GitLabPipelineJobSchema>; export type GitLabPipelineTriggerJob = z.infer<typeof GitLabPipelineTriggerJobSchema>; export type ListPipelinesOptions = z.infer<typeof ListPipelinesSchema>; export type GetPipelineOptions = z.infer<typeof GetPipelineSchema>; export type ListPipelineJobsOptions = z.infer<typeof ListPipelineJobsSchema>; export type ListPipelineTriggerJobsOptions = z.infer<typeof ListPipelineTriggerJobsSchema>; |