import type { JenkinsConfig } from './config.js'; export interface JenkinsCredentialSummary { id: string; displayName: string; typeName: string; } /** 이미 있는 credential 의 메타데이터 — 교체 dry-run 이 "무엇을 덮어쓰게 되는지" 보여줄 때 쓴다. 비밀값은 없다. */ export interface ExistingCredential { id: string; /** Jenkins 가 준 `_class`. */ className: string; /** 표시용 종류 이름 (예: "Secret file"). `Accept-Language: en` 으로 요청하지만 번역돼 올 수도 있다. */ typeName: string; displayName: string; description: string; } /** * credential 의 종류. 알려진 구현은 짧은 키로, 모르는 구현 클래스는 클래스명 그대로 쓴다 * (어느 쪽이든 요청 종류와 다르면 "다른 종류" 다). */ export type CredentialKind = string; export declare const KIND_STRING = "string"; export declare const KIND_FILE = "file"; /** 사람이 읽는 종류 이름. */ export declare function kindLabel(kind: CredentialKind): string; /** * 기존 credential 의 메타데이터. 없으면 null. 본문을 못 읽으면 빈 필드로 채운다 (존재 자체는 확정). * 존재 확인과 교체 dry-run 표시가 같은 엔드포인트(`/credential//api/json`)를 쓴다. */ export declare function describeCredential(cfg: JenkinsConfig, id: string): Promise; /** 기존 credential 의 메타데이터 + 종류(판정 불가면 null). 없으면 null. */ export declare function inspectCredential(cfg: JenkinsConfig, id: string): Promise<{ info: ExistingCredential; kind: CredentialKind | null; } | null>; /** * allowReplace=false 면 같은 id 가 이미 있을 때 **아무것도 쓰지 않고** 'exists' 를 돌려준다. * 같은 종류의 기존 값(예: 서명 keystore)을 조용히 갈아끼우면 되돌릴 수 없으므로, MCP 도구는 * 사용자 confirm 전에는 이 모드로 부른다. 새 id 생성은 확인 없이 진행된다. */ export interface UpsertOptions { allowReplace?: boolean; } export type UpsertResult = 'created' | 'updated' | 'exists'; export declare function listCredentials(cfg: JenkinsConfig): Promise; export declare function upsertSecretText(cfg: JenkinsConfig, id: string, secret: string, description?: string, options?: UpsertOptions): Promise; /** * Secret File credential 생성/교체. Jenkins는 파일을 multipart 로 받고 * json 본문이 "file": "<필드명>" 으로 참조한다 (secretBytes JSON 직접 입력은 불가). */ export declare function upsertSecretFile(cfg: JenkinsConfig, id: string, fileBase64: string, fileName: string, description?: string, options?: UpsertOptions): Promise; export declare function deleteCredential(cfg: JenkinsConfig, id: string): Promise;