/** * Pure helpers for the issue/plan split (contribution Phase 1, FR-1/FR-3). * * When the issue/plan split is engaged, the posted GitHub issue is a short, * human-readable draft (what is wanted and why) — NOT the agent-oriented plan. * The draft carries no plan sections, no agent instructions, and no product * names or links. When the target repo ships an issue template under * `.github/ISSUE_TEMPLATE/*` (or the legacy `.github/ISSUE_TEMPLATE.md`), the * draft is rendered into it. * * SECURITY (decision 1): a repo's issue template is **untrusted data**. It is * used only as a rendering skeleton — its YAML front-matter and HTML comments * (which is where "instructions to the reporter" live) are stripped and never * interpreted as instructions, and nothing from it is ever fed to the agent. * * Deterministic, no I/O — the caller supplies file contents. */ export interface IssueDraft { /** A short, human issue title. */ title: string; /** 2–3 plain paragraphs: what is wanted and why. No plan sections. */ body: string; } /** * Build a short human issue draft from a title and what/why text. Produces at * most a few short paragraphs; blank inputs are dropped so the body never has * empty paragraphs. No product names, no links, no plan sections — the caller * is responsible for passing plain prose. */ export declare function buildIssueDraft(input: { title: string; what: string; why?: string; }): IssueDraft; /** * Derive a short human issue draft from a plan's title and body, so plan * sections (requirements, steps, acceptance criteria, agent instructions) never * leak into the posted issue: * * - A plan with intro prose (text before the first `##` heading) uses its first * two intro paragraphs as the what / why. * - A standard plan (`# Title` straight into `## Plan Summary`) uses the * summary's `What/why:` bullet as the what and the first prose paragraph of * `## Problem Statement` (or Motivation/Background/Context) as the why. * - Otherwise the title is the what. * * Links are stripped (their text is kept). */ export declare function deriveIssueDraftFromPlan(title: string, planBody: string): IssueDraft; /** * The issue title to post: the template's front-matter `title:` (a prefix such * as `"[Feature] "`) followed by the draft title. A blank prefix, or a draft * title that already starts with it, leaves the title unchanged. */ export declare function renderIssueTitle(title: string, template?: ParsedIssueTemplate | null): string; export interface ParsedIssueTemplate { /** The `title:` value from YAML front-matter, when present (a default title). */ frontMatterTitle?: string; /** * The template body with YAML front-matter and HTML comments removed — the * safe rendering skeleton (headings only; instructions stripped). */ skeleton: string; } /** * Parse a GitHub issue template into a safe skeleton. Strips the leading * `---`-delimited YAML front-matter (capturing only its `title:` as a default) * and all `` HTML comments (where template instructions live). * Everything that survives is treated as inert markdown structure. */ export declare function parseIssueTemplate(content: string): ParsedIssueTemplate; /** * Pick the issue template to render into from a list of candidate files. Prefers * a dedicated `.github/ISSUE_TEMPLATE/*` entry (first, most-general wins — the * contributor can choose a different one in the dashboard) over the legacy * single-file `.github/ISSUE_TEMPLATE.md`. Returns `null` when none are present. */ export declare function pickIssueTemplate(files: ReadonlyArray<{ path: string; content: string; }>): { path: string; content: string; } | null; /** * Render an issue draft into a parsed template skeleton. When the skeleton has * markdown section headings, the draft body is placed under the first heading * and the rest of the skeleton (further headings) is preserved so the posted * issue matches the repo's expected shape. With no skeleton (or no template), * returns the plain draft body. Never interprets template text as instructions. */ export declare function renderIssueDraft(draft: IssueDraft, template?: ParsedIssueTemplate | null): string; /** * The text a contributor edits in their editor before the issue is posted: * the title on the first line, a blank line, then the body (the same shape as * a git commit message). */ export declare function formatIssueDraftForEditing(draft: IssueDraft): string; /** * Parse the edited text back into a draft: the first non-blank line is the * title (a leading `# ` is dropped) and the rest is the body. Returns `null` * when the title or the body is empty, so an emptied file never posts a blank * issue. */ export declare function parseEditedIssueDraft(text: string): IssueDraft | null; //# sourceMappingURL=issue-draft.d.ts.map