/** * Normalize `IssueRefInput` (object | string) into a resolved * `{ ref, gh }` bundle for the tool handlers. * * Object form is validated via `IssueRefObjectSchema`; string form is passed * through `resolveIssueContext` — inherits bare-number cwd-inference (#850), * qualified `owner/repo#N`, and URL forms. * * PR-kind gate (subsumes generacy#906): when `expects === 'issue'`, the * resolved number must NOT resolve to a PR. Inspected via `gh.getIssue()`'s * URL — a `/pull/` path is a pull request. Symmetric enforcement in * `cockpit_merge`, which expects a PR and rejects issues. */ import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit'; import { type IssueRef } from '../resolver.js'; import type { ToolErrorResult } from './errors.js'; import { type IssueRefInput } from './schemas.js'; export interface AssertQualifiedOk { ok: true; form: 'short' | 'url'; } export interface AssertQualifiedError { ok: false; error: string; } /** * Verify that a string ref is in one of the MCP-accepted qualified forms * (owner/repo#N or a github.com issue/pull URL). Bare digits are rejected * with a typed message. Shared across the seven MCP tools. */ export declare function assertQualifiedString(value: string): AssertQualifiedOk | AssertQualifiedError; export interface NormalizedRef { ref: IssueRef; gh: GhWrapper; } export type NormalizeResult = { ok: true; value: NormalizedRef; } | { ok: false; error: ToolErrorResult; }; export type RefKind = 'issue' | 'pr'; export interface NormalizeOptions { /** What the tool expects. Used to gate the PR-vs-issue kind check. */ expects: RefKind; /** Optional injected wrapper — used by tests to short-circuit the kind check. */ gh?: GhWrapper; runner?: CommandRunner; } export declare function normalizeIssueRef(input: IssueRefInput, options: NormalizeOptions): Promise; //# sourceMappingURL=ref-input.d.ts.map