/** * Pre-dispatch inference for `cleo add` — file detection, acceptance criteria * parsing, and parent-from-session lookup. * * Extracted from `packages/cleo/src/cli/commands/add.ts` (T1490) so that the * CLI layer remains a thin parse-and-delegate shell and all domain inference * lives in Core. * * Callers are responsible for any `process.stderr` output — this module never * writes to stdout/stderr directly. * * @task T1490 */ export { parseAcceptanceCriteria } from './acceptance-input.js'; /** * Input parameters for `inferTaskAddParams`. */ export interface InferAddParamsInput { /** Task title — forwarded to GitNexus query. */ title: string; /** Optional task description — forwarded to GitNexus query for better ranking. */ description?: string; /** When true and `filesRaw` is absent, invoke GitNexus to suggest files. */ filesInfer?: boolean; /** Raw comma-separated file list from the `--files` CLI flag. */ filesRaw?: string; /** Raw acceptance criteria string from the `--acceptance` CLI flag. */ acceptanceRaw?: string; /** Already-resolved parent ID (from `--parent` or `--parent-id` flags). */ parentRaw?: string; /** Task type string — inference is skipped when type is `'epic'`. */ type?: string; } /** * Resolved inference results for `cleo add`. * * Only fields that were resolved or inferred are present; absent fields mean * "no change from what the CLI already determined". */ export interface InferAddParamsResult { /** Resolved file list (from inference or explicit `--files`). */ files?: string[]; /** * True when `--files-infer` was requested but GitNexus returned no results. * The caller should emit a warning to stderr. */ filesInferWarning?: boolean; /** Parsed acceptance criteria array. */ acceptance?: string[]; /** Parent task ID inferred from the active session's current task. */ inferredParent?: string; /** * Why parent inference produced (or declined to produce) a parent. * * Always populated when inference was ATTEMPTED — i.e. no explicit * `--parent` and a non-epic type. Absent when the caller named a parent, so * a present value means "this parent did not come from your command". * * @remarks * T12136 (GH #1232/#1238): the inference itself was announced only through * `humanInfo`, which is silent under `--json`/`--quiet` — so the population * that gets hurt by it (agents) never saw it. The caller then hit * `E_CLEO_DEPTH_EXCEEDED` naming a task it had never mentioned, with advice * pointing at an epic it had never intended to file under. Carrying the * decision in the RESULT, rather than only on a human-only stderr channel, * is what lets the machine-readable surfaces name it too. */ parentInference?: ParentInference; } /** Outcome of the session-based parent inference step. */ export interface ParentInference { /** `'applied'` when a parent was inferred; otherwise why it was not. */ outcome: 'applied' | 'no-current-task' | 'stale-terminal' | 'lookup-failed'; /** The session's `current` pointer, when there was one. */ candidateId?: string; /** Status of the candidate when it was rejected as stale. */ candidateStatus?: string; /** Human-readable statement of what happened, safe to surface verbatim. */ note: string; } /** * Infer files touched by a task from its title and description using GitNexus. * * Constructs a query from title + description, invokes `gitnexus query --json`, * and extracts file paths from the result. * * Fallback: if GitNexus is unavailable or returns empty results, returns an * empty array. * * @param title - Task title * @param description - Optional task description * @returns Array of inferred file paths (may be empty) * * @task T1330 * @task T1490 */ export declare function inferFilesViaGitNexus(title: string, description?: string): string[]; /** * Resolve pre-dispatch inference parameters for `cleo add`. * * Performs three inference steps (each independently non-fatal): * 1. **File inference** — resolves explicit `--files` CSV or invokes GitNexus * when `--files-infer` is set. * 2. **Acceptance criteria parsing** — coerces pipe-separated or JSON-array * `--acceptance` strings to a string array. * 3. **Parent inference** — when no explicit parent is set and the task type * is not `'epic'`, looks up the active session's current task and returns * it as `inferredParent`. * * The function never writes to `process.stderr`; callers are responsible for * surfacing `filesInferWarning` and `inferredParent` notices. * * @param projectRoot - Absolute path to the project root (passed to session lookup) * @param input - Resolved CLI flag values * @returns Partial inference result; absent fields = no inference available * * @task T1490 */ export declare function inferTaskAddParams(projectRoot: string, input: InferAddParamsInput): Promise; //# sourceMappingURL=infer-add-params.d.ts.map