/** * Deterministic, tested detectors for a repository's contribution policy, read * from its `CONTRIBUTING.md` and any PR template. The worker's *obedience* to * these is prompt-level (the agent acts on them); the *detection* here is pure * so it can be unit-tested and reused. All string detectors operate on file * contents the caller has already read, so they do no I/O and never throw. */ /** Which changelog editing policy a CONTRIBUTING file describes, if any. */ export type ChangelogPolicy = 'contributor' | 'maintainer' | 'unknown'; /** A PR template discovered on disk. */ export interface PrTemplate { /** Repo-relative path of the template file. */ path: string; /** The template body. */ body: string; } /** The structured contribution policy the worker prompt/renderer consumes. */ export interface ContributingPolicy { /** A DCO sign-off (`git commit -s`) is required. */ dcoRequired: boolean; /** A CLA (Contributor License Agreement) must be signed. */ claRequired: boolean; /** Contributors are asked to open/discuss an issue before a PR. */ discussFirst: boolean; /** Who edits the changelog. */ changelogPolicy: ChangelogPolicy; /** The discovered PR template, or null when none exists. */ prTemplate: PrTemplate | null; } /** * True when the CONTRIBUTING text requires a DCO sign-off. Matches the common * phrasings: a `Signed-off-by` trailer, the acronym `DCO` / "Developer * Certificate of Origin", or an explicit `git commit -s` / `--signoff`. */ export declare function detectDcoRequirement(contributingText: string): boolean; /** * True when the CONTRIBUTING text requires a CLA. Matches "Contributor License * Agreement", a bare `CLA`, or a CLA-bot reference (`cla-assistant`, `CLA bot`). */ export declare function detectClaRequirement(contributingText: string): boolean; /** * True when the CONTRIBUTING text asks contributors to discuss in an issue * before opening a PR ("open an issue first", "discuss before", etc.). */ export declare function detectDiscussFirst(contributingText: string): boolean; /** * Determine the changelog editing policy from the CONTRIBUTING text: * - `maintainer` — contributors are told NOT to edit the changelog (maintainers * own it / it is generated). * - `contributor` — contributors are asked to add a changelog entry. * - `unknown` — the text says nothing specific. * * The maintainer signal is checked first: a "don't edit the changelog" sentence * also contains the word "changelog", so an "add a changelog entry" match must * not win over an explicit prohibition. */ export declare function detectChangelogPolicy(contributingText: string): ChangelogPolicy; /** * Find a PR template under `repoRoot`, checking the standard single-file * locations then the `PULL_REQUEST_TEMPLATE/` directory forms. Returns the * repo-relative path and body, or null when none exists. Reads only files * already present in the checkout; swallows read errors as "not found". */ export declare function findPrTemplate(repoRoot: string): PrTemplate | null; /** * Build the full `ContributingPolicy` for a repo. `contributingText` is the * contents of `CONTRIBUTING.md` (empty string when absent — all detectors then * return false/unknown). `repoRoot` is used to discover the PR template. */ export declare function buildContributingPolicy(contributingText: string, repoRoot: string): ContributingPolicy; /** * The bounded, explicit list of agent-instruction files read as contribution * rules (not an open-ended crawl). Kept in sync with `AGENT_INSTRUCTION_FILES` * in `packages/shared/src/guidelines.ts` and the worker's bash mirror. */ export declare const AGENT_INSTRUCTION_FILES: readonly ["CLAUDE.md", "AGENTS.md", ".cursorrules", ".github/copilot-instructions.md"]; /** * Read any of the bounded {@link AGENT_INSTRUCTION_FILES} present under * `repoRoot`, returning a map of repo-relative path → contents for the files * that exist and are readable. Pure wrapper around fs; swallows read errors. */ export declare function readAgentInstructionFiles(repoRoot: string): Record; /** A target repo's stance on AI-assisted contributions. */ export type AiStance = 'permits' | 'requires_disclosure' | 'bans'; /** * Deterministic AI-stance detector. Mirror of `detectAiStance` in * `packages/shared/src/guidelines.ts` — keep in sync. Strictest signal wins: * `bans` > `requires_disclosure` > `permits`; `null` when the text is silent. */ export declare function detectAiStance(texts: string | string[]): AiStance | null; /** * Read the repo's `CONTRIBUTING.md` from the standard locations, returning its * text or empty string when absent/unreadable. Convenience for callers that * only have a `repoRoot`. */ export declare function readContributingText(repoRoot: string): string; //# sourceMappingURL=contributing-policy.d.ts.map