/** * Keep `/.crewly/tickets/` visible to git * (specs/2026-09-28-project-tickets.md §2 "Git tracking"). * * Most projects ignore `.crewly/` as a whole. A bare `!.crewly/tickets/` * cannot undo that — git never descends into an excluded directory, so * nothing inside it can be re-included. When (and only when) git reports the * tickets folder as ignored, this appends a small block to the project's * `.gitignore` that re-includes `.crewly/`, re-ignores everything in it, then * re-includes `tickets/`. Existing lines are never touched, and any existing * `!.crewly/...` negations (e.g. `!.crewly/wiki/`) are re-emitted after the * block's `.crewly/*` so the block cannot re-ignore what the project already * tracks. * * @module services/project-tickets/ticket-tracking */ import { type GitResult } from '../worktree/worktree-git.js'; /** What {@link ensureTicketsTracked} found / did. */ export type TicketTrackingOutcome = /** Project is not inside a git work tree */ 'not-a-repo' /** The tickets folder lives outside the project (package-tree fallback) */ | 'outside-project' /** Git already sees the folder */ | 'tracked' /** The block was appended and git now sees the folder */ | 'unignored' /** Still ignored (global excludes, or a rule the block cannot override) */ | 'still-ignored'; /** Git runner (injectable for tests). */ export type GitRunner = (cwd: string, args: string[]) => Promise; /** * Build the block to append: the header, `!.crewly/` and `.crewly/*`, then the * project's existing `.crewly` negations, then the tickets re-includes. The * block's own `.crewly/*` comes after the project's rules, so without the * re-emitted negations it would hide everything they had re-included. * * @param current - Current `.gitignore` text * @returns Block lines, in order */ export declare function buildTicketsBlock(current: string): string[]; /** * Make sure git tracks the project's tickets folder, appending the * re-include block to `/.gitignore` when it is ignored. * * Idempotent: the block is appended at most once (its re-include line is the * marker). * * @param projectPath - Absolute project root * @param git - Git runner (defaults to the worktree helper's `runGit`) * @returns What was found / done * * @example * ```typescript * const outcome = await ensureTicketsTracked('/repo'); * if (outcome === 'still-ignored') logger.warn('tickets are not tracked'); * ``` */ export declare function ensureTicketsTracked(projectPath: string, git?: GitRunner): Promise; //# sourceMappingURL=ticket-tracking.d.ts.map