import type { Issue } from '../../types/index.js'; import type { PullRequest } from '../../types/index.js'; /** * GitHub-source plan generation for `hula launch --issue` / `--pr`. * * The CLI can start a launch from an existing GitHub issue or pull request * instead of a local plan file. This module owns everything GitHub-specific: * parsing the `--issue` / `--pr` reference, resolving and validating the issue * or PR through the existing services, turning its text into a generated plan * markdown, and writing that plan to the local plans directory (from where the * normal launch flow publishes it to the feature branch and deletes it after a * successful POST). */ /** A parsed `--issue` / `--pr` reference. owner/repo are present only for URLs. */ export interface GitHubRef { number: number; owner?: string; repo?: string; } /** * Parse an `--issue` / `--pr` value: a number (`42`), a `#`-prefixed number * (`#42`), or a full GitHub URL (`https://github.com///issues/` * for `issue`, `/pull/` for `pr`), with an optional trailing `/`, `#...`, or * `?...`. * * Throws a clear, flag-specific error on anything else (including an issue URL * passed to `--pr` or vice versa — the path segment must match `kind`). */ export declare function parseGitHubRef(input: string, kind: 'issue' | 'pr'): GitHubRef; /** * Find the first issue number linked from a PR body via a GitHub closing * keyword (`Closes #5`, `fixes: #5`, `Resolved #5`, …). Returns `null` when * there is no such reference. */ export declare function findLinkedIssueNumber(body: string | null): number | null; /** * Resolve an explicit `--issue ` into a validated open issue (not a PR). */ export declare function resolveIssueSource(n: number, repo: { owner?: string; name?: string; }): Promise; /** * Resolve `--pr ` into a validated open pull request. * * By default the PR's branch must live in this repository — a PR whose head is * a fork is rejected, because the owner flow can only continue branches it can * push to. When the contribution/fork flow is engaged (`opts.allowForkHead`), * a cross-repo head is **accepted**: the fork is ours (we created it), so * building on it is exactly the intended flow (FR-8). */ export declare function resolvePrSource(n: number, opts?: { allowForkHead?: boolean; }): Promise; /** * Build the generated plan markdown from a resolved issue and/or PR. Sections * are omitted when the source is absent; empty descriptions become a * placeholder so the plan never has a blank body. */ export declare function buildPlanMarkdown(input: { issue?: Issue; pr?: PullRequest; repoFullName: string; }): string; /** * Write a generated plan to `/-.md`, creating * the directory if needed, and return the path relative to the repo root * (`planDir`'s parent chain). A relaunch in the same minute overwrites the file. * * `planDir` is the repo-relative plans directory (`config.planPath`). The * returned path is repo-relative so the normal launch flow (publish + delete) * treats it exactly like a hand-written plan. * * The filename timestamp is Windows-safe (colon-free) by default. Pass * `windowsSafe: false` (from `resolveDefaults(config).windowsSafeNames`) to * restore the legacy `HH:MM` colon form. */ export declare function writeGeneratedPlan(planDir: string, slug: string, markdown: string, repoRoot?: string, windowsSafe?: boolean): string; //# sourceMappingURL=GitHubSourcePlanService.d.ts.map