/** * Helpers for parsing serialized GitLab CI YAML in post-synth checks. * * Since GitLab CI output is YAML (not JSON like CloudFormation), we parse * the YAML sections structurally using simple regex/string parsing. The * serializer emits a predictable format so we can extract what we need * without a full YAML parser dependency. */ export { getPrimaryOutput } from "@intentius/chant/lint/post-synth"; /** * Parse a serialized GitLab CI YAML into a structured object. * Returns null if the output can't be parsed. */ export interface ParsedGitLabCI { stages: string[]; jobs: Map; } export interface ParsedJob { name: string; stage?: string; rules?: ParsedRule[]; needs?: string[]; extends?: string[]; } export interface ParsedRule { when?: string; if?: string; } /** * Extract stages list from serialized YAML. */ export declare function extractStages(yaml: string): string[]; /** * Extract job names and their stage values from serialized YAML. */ export declare function extractJobs(yaml: string): Map; /** * Check whether the YAML contains an `include:` directive. * When includes are present, `needs:` and `extends:` may reference * jobs/templates from included files, so checks should be lenient. */ export declare function hasInclude(yaml: string): boolean; /** * Extract global variables from serialized YAML. */ export declare function extractGlobalVariables(yaml: string): Map; /** * Extract the full section text for a given job name. */ export declare function extractJobSection(yaml: string, jobName: string): string | null; /** * Extract rules from a job section. */ export declare function extractJobRules(section: string): ParsedRule[]; /** A container image reference (job/default `image:` or a `services:` entry). */ export interface ImageRef { /** Owning job name, or "default" for the global image. */ job: string; /** The image reference (e.g. `node:20`). */ image: string; /** Where the image was declared. */ source: "image" | "service"; } /** * Extract container image references from `image:` and `services:` across the * pipeline. Handles both the object form (`image:\n name: ...`) and the inline * string form (`image: ...`). */ export declare function extractImageRefs(yaml: string): ImageRef[]; /** An `include:` entry from the top-level include block. */ export interface IncludeEntry { kind: "project" | "remote" | "component" | "local" | "template" | "string"; /** The primary value (project path, URL, component address, …). */ value: string; /** `ref:` for project includes, if present. */ ref?: string; } /** * Parse the top-level `include:` block into structured entries. */ export declare function extractIncludes(yaml: string): IncludeEntry[]; /** True if a git ref is an immutable pin (40-hex SHA or a vN.N.N-style tag). */ export declare function isPinnedRef(ref: string): boolean; /** An `id_tokens:` OIDC token declaration within a job. */ export interface IdTokenDecl { job: string; /** Token variable name (e.g. `GCP_ID_TOKEN`). */ name: string; /** Declared audiences (`aud:`), empty if none. */ aud: string[]; } /** * Extract `id_tokens:` declarations (OIDC) per job, with their audiences. */ export declare function extractIdTokens(yaml: string): IdTokenDecl[]; /** True if a job section's rules make it reachable from merge-request pipelines. */ export declare function isMergeRequestReachable(section: string): boolean; /** A shell command line from a `script:` / `before_script:` / `after_script:`. */ export interface ScriptCommand { job: string; command: string; } /** * Extract shell command lines from all `script:` family blocks, per job. */ export declare function extractScriptCommands(yaml: string): ScriptCommand[]; //# sourceMappingURL=yaml-helpers.d.ts.map