import { type Occupancy } from '../phases/collision.js'; import { type DoctorCheck, type DoctorEnv, type DoctorReport } from './model.js'; /** * Splits raw `state.json` content into its "local"/"incoming" halves when it * has git conflict-marker shape: a line starting with `<<<<<<<` (7 `<`s), * later a line that is exactly `=======` (7 `=`s), later a line starting * with `>>>>>>>` (7 `>`s) — in that order. Matches on the 7-character marker * prefix, not the full line, since git appends an arbitrary ref/branch name * after `<<<<<<<`/`>>>>>>>` (e.g. `<<<<<<< HEAD`). Returns `null` when the * shape isn't present. Exported (T5, phase 196, issue #177) so the * `--resolve-state-conflict` repair (`./fix.ts`) can re-split the raw file * and pick a side without duplicating the marker-detection regex/logic — the * character-level parsing lives here and only here. */ export declare function parseConflictMarkers(content: string): { local: string; incoming: string; } | null; /** * List of the CADENCE-owned ephemeral paths (`../init/gitignore.js`) * currently tracked by git in `root`, via `git ls-files -- ` — a * read-only shell-out with a fixed arg array (never a shell string), mirroring * `handoff/git-facts.ts`. Staged-but-uncommitted paths count as tracked * (`git ls-files` reports the index, not just HEAD). Shared by * `checkStateTracked` and the `untrack-state` repair (`./fix.ts`) so the * git-shell-out logic lives in one place. Returns `null` — never throws — * when the lookup itself fails (not a git repository, git unavailable, or any * other error), so callers can tell "definitely none tracked" apart from * "could not determine" (best-effort introspection convention). */ export declare function listTrackedCadenceOwnedPaths(root: string): Promise; /** * Read-only cross-worktree phase-usage line (v1.19, phase 85). Reuses the v1.18 * `gatherOccupancy` collector + pure `detectPhaseCollision` to surface phase * numbers claimed by sibling worktrees + the upstream integration ref, and warns * when one collides with a local phase number — the silent-dual-merge * precondition the v1.18 guard refuses at scaffold time. Best-effort: any * failure degrades to `ok` (never throws), matching the guard's contract. * The collector is injectable for deterministic, offline tests. */ export declare function checkWorktreePhases(root: string, gather?: (repoRoot: string, opts: { integrationRef: string; }) => Promise): Promise; /** Warn when this many SESSION docs accumulate with retention disabled. */ export declare const HANDOFF_WARN_THRESHOLD = 10; /** * Make SESSION-doc accumulation visible (Phase 89, v1.20). Read-only and * best-effort: counts `SESSION-*.md` under `.cadence/handoff/` against * `config.handoff.retain`. With retention configured the docs self-heal on the * next handoff write, so the check only *warns* when retention is unset and the * archive has grown past the threshold. Never throws — a diagnostic must not * break `doctor` (mirrors `worktree-phases`). */ export declare function checkHandoffRetention(root: string): Promise; /** * Surface whether real verification is actually wired (v1.22). Reuses the pure * `assessReadiness` (shared with `cadence activate`). `warning` when deep-verify * is mock (remedy: `cadence activate`), when deep-verify's provider lacks its * credentials, or — phase 239 / issue #331 — when ANY other verifier seam is * configured to a real provider whose credentials are absent and will therefore * downgrade to mock. Before phase 239 only the deep-verify seam was * credential-checked, so this check reported `ok` while a sibling seam was * guaranteed to fall back to mock (a false green that `cadence config explain` * caught and this did not). `ok` otherwise. Read-only, best-effort, never throws * (doctor convention). `env` is injectable for deterministic tests. */ export declare function checkVerificationReadiness(root: string, env?: NodeJS.ProcessEnv): Promise; /** * Surface recommendations stuck in `settle-pending` (Phase 145) — their linked * phase settled locally but nobody has confirmed the work actually shipped * (merged/deployed) via `recommendation promote --status=shipped`. Read-only, * best-effort, never throws (doctor convention, mirrors `handoff-retention` / * `verification-readiness`). */ export declare function checkRecommendationShippedDrift(root: string): Promise; /** * Surface `evidence.json` rows whose `recommendationId` matches neither the * active `recommendations` array nor `archived` — a dangling FK that, left * unnoticed, can silently collide with a freshly minted recommendation id * (phase 219, T3). Read-only, best-effort, never throws (doctor convention, * mirrors `recommendation-shipped-drift`): any read/parse error on either * ledger degrades to "no finding" rather than blocking the rest of `doctor`. */ export declare function checkOrphanedEvidence(root: string): Promise; /** * The four ledger-id subjects this check compares, as parallel id arrays. * `recommendations` includes both live and archived ids (Phase 224) since * either could collide with a freshly minted id. */ export interface LedgerIdSnapshot { recommendations: string[]; evidence: string[]; decisions: string[]; assumptions: string[]; } /** * Pure id-collision diff (Phase 224, T1). For each subject, ids present in * `local` but not in `mergeBase` are "local-new"; ids present in `origin` but * not in `mergeBase` are "origin-new". A collision is any id that is * local-new AND origin-new — both sides independently minted the same id * after diverging from their common ancestor, which `mintId`'s purely-local * view cannot see coming. Deliberately id-overlap-only, no content-diffing * (see this phase's DRAFT boundaries) — id overlap after divergence is * already a sufficient, unambiguous signal. */ export declare function findLedgerRemoteCollisions(local: LedgerIdSnapshot, mergeBase: LedgerIdSnapshot, origin: LedgerIdSnapshot): Array<{ subject: keyof LedgerIdSnapshot; id: string; }>; /** Outcome of {@link gatherLedgerRemoteCollisionSnapshot}. `checked: false` * mirrors `RemoteFreshness`'s soft-degrade shape: no repo, detached HEAD, a * failed fetch, no upstream, or (new for this check) no discoverable * merge-base with the upstream ref. */ export interface LedgerRemoteCollisionResult { checked: boolean; reason?: string; branch?: string; local?: LedgerIdSnapshot; mergeBase?: LedgerIdSnapshot; origin?: LedgerIdSnapshot; } /** * Impure gatherer for {@link checkLedgerRemoteCollision} (Phase 224, T1). * Reuses `checkRemoteFreshness` for the fetch + branch + upstream-existence * probe; only when that reports `checked: true` does this resolve `git * merge-base HEAD @{u}` and read the three ledger-id snapshots (local * filesystem at HEAD, and `@{u}`/the merge-base sha via `git show`). */ export declare function gatherLedgerRemoteCollisionSnapshot(root: string): Promise; /** * Detects cross-session ledger id collisions before push (Phase 224, * rec-20260726-003 — see this phase's DRAFT): `mintId` computes the next * ledger id purely from the local ledger on disk, so two unpushed * branches/worktrees/sessions can independently mint the same id for * different content. This check fetches the tracked upstream (via the * injectable `gather`, defaulting to {@link gatherLedgerRemoteCollisionSnapshot}) * and warns on any id both sides minted new-since-merge-base. Never * auto-fixable (`fixId` stays `null`) — a human must pick which side * re-mints, matching `worktree-phases`. Best-effort and never throws * (doctor convention): any degrade-safely path from `gather`, or an * unexpected error, reports `ok` with a `detail` naming why the comparison * could not be made. */ export declare function checkLedgerRemoteCollision(root: string, gather?: (root: string) => Promise): Promise; /** * Flags `verification.coverageMode: 'assertion'` paired with a detected * project language that has no assertion-mode span-parsing support. * `mention` mode is always fine regardless of language, so this only fires * on the one unsafe pairing. Support is checked against the LIVE * coverage-profile registry (`../verify/coverage-profiles/registry.js`), * not a hardcoded language list — phase 166 (AC-4) shipped only a js/ts * profile, so this check originally hardcoded `lang === 'js'`; phase 167 * built real profiles for python/go/rust/php too, and a doc-content review * during that phase caught that this check still hardcoded the pre-167 * language list, which would have kept producing a false "no support yet" * warning for exactly the four languages the phase was built to support — * checking the registry directly means this check never goes stale again * when a future language profile ships. Read-only, best-effort, never * throws (doctor convention): a config-load failure just skips the check, * since `checkInitialized`/`checkState` already own reporting a broken * config. */ export declare function checkCoverageModeLanguageSupport(root: string): Promise; /** * Warn threshold for {@link checkPhaseFreshness} (Phase 208, rec-20260722-001): * a task `updatedAt` within this many ms of `now` is treated as possible * live concurrent-session activity. 10 minutes. Hardcoded and documented, * not config — matches `HANDOFF_WARN_THRESHOLD`'s pattern; a config knob was * explicitly rejected for this phase (see the phase's DRAFT boundaries). */ export declare const PHASE_FRESHNESS_WARN_THRESHOLD_MS = 600000; /** * Warns when the active phase/draft's `PROGRESS.json` shows a task touched * very recently — a possible live concurrent session working the same phase * (Phase 208, rec-20260722-001). Read-only and best-effort: no active * phase/draft, or no `PROGRESS.json` written yet, both degrade to `ok` * rather than treating "nothing to check" as a problem. Delegates the actual * freshness math to the pure `assessProgressFreshness` (`../phases/liveness.js`) * so this function only does I/O + wiring. `now` is injectable for * deterministic tests; never throws (doctor convention, mirrors * `worktree-phases` / `handoff-retention`). */ export declare function checkPhaseFreshness(root: string, now?: Date): Promise; export declare function runDoctor(root: string, env: DoctorEnv): Promise; //# sourceMappingURL=run.d.ts.map