/** * Ticket-aware capture (TICKETS_DESIGN.md, phases T1–T2). * * Architecture principle: contract + adapters, not a mandatory service. * aidimag core only ever knows `TicketProvider.getTicket(id)`. All API * parsing, auth, and rate-limit handling lives behind that boundary: * * JiraProvider direct API, local creds * GitHubProvider direct API (issues), local creds * HttpProvider any URL implementing the contract (BYO middleware) * (RemoteProvider via the sync server lands with T3) * * Hard rule: ticket FETCH is lazy and non-blocking — the post-commit hook * only extracts the ticket id (regex, offline); getTicket runs at review * time or on demand (`dim ticket show`). */ export interface Ticket { id: string; url: string; title: string; /** description, truncated (~2KB) */ body: string; type: "bug" | "story" | "task" | "epic" | "other"; status: "open" | "in_progress" | "done" | "other"; labels: string[]; parent?: { id: string; title: string; }; } export interface TicketProvider { readonly name: string; getTicket(id: string): Promise; } export interface BranchRules { pattern?: string; exempt?: string[]; enforce?: "push" | "warn" | "off"; } export interface TicketsConfig { provider?: "jira" | "github" | "linear" | "http" | "remote" | "gitlab" | "azuredevops" | "clickup" | "shortcut" | "youtrack" | "asana" | "trello" | "notion" | "pivotal"; /** ticket-id regex for branch/commit-message extraction */ pattern?: string; /** Jira site / GitHub repo URL / HttpProvider endpoint (unused for remote) */ baseUrl?: string; branch?: BranchRules; } /** Where each provider's API token lives — used by the interactive connect flow. */ export declare const TOKEN_PAGES: Record; export declare const DEFAULT_TICKET_PATTERN = "[A-Z][A-Z0-9]+-\\d+"; export declare function readTicketsConfig(repoRoot: string): TicketsConfig; export declare function writeTicketsConfig(repoRoot: string, tickets: TicketsConfig): void; /** Ticket credential stored per-repo in config.json (same pattern as cloud sync token). */ export declare function getTicketCredential(baseUrl: string, repoRoot?: string): string | null; export declare function saveTicketCredential(baseUrl: string, credential: string, repoRoot?: string): void; /** Extract the first ticket id from text (branch name, commit subject/body). */ export declare function extractTicketId(text: string, pattern?: string): string | null; /** * Ticket id implied by the CURRENT branch (offline, instant). The best prompt * is the one the branch name already answered — used by the MCP session-end * flow and the VSCode extension. */ export declare function detectBranchTicket(repoRoot: string): string | null; /** * Build a direct (non-remote) provider from raw parts — used locally AND by * the sync server's /v1/ticket proxy (T3), so adapter logic lives in one place. */ export declare function buildDirectProvider(provider: string, baseUrl: string, credential: string | null): TicketProvider | null; /** Build the configured provider, or null when tickets aren't set up / no credential. */ export declare function ticketProviderFor(repoRoot: string): TicketProvider | null; export interface BranchCheckResult { branch: string; ok: boolean; exempt: boolean; enforce: "push" | "warn" | "off"; pattern: string | null; } export declare function checkBranchName(repoRoot: string, branch: string): BranchCheckResult; /** Build a conforming branch name: feature/XXX-2100 or XXX-2100 (no prefix) */ export declare function buildBranchName(ticketId: string, _title?: string, prefix?: string): string;