/** * Settings auditor — entry point for vat audit settings command. */ import { type IssueSeverity, type SeverityCounts } from '@vibe-agent-toolkit/agent-schema'; import type { SettingsLevel } from '../types.js'; import type { EffectiveSettings, SettingsLayer } from './settings-merger.js'; import type { ReadSettingsOptions } from './settings-reader.js'; export interface SettingsAuditResult { effective: EffectiveSettings; /** All loaded layers in precedence order */ layers: SettingsLayer[]; } /** * A settings path we know how to look for, before anyone has looked. * * It carries NO `exists`/`readable`: a synchronous enumeration cannot know, and * a placeholder `false` is indistinguishable from "we checked and it is absent". * Only {@link resolveSettingsPaths} may answer that question. */ export interface SettingsPathCandidate { label: string; path: string; level: SettingsLevel; status?: 'error' | undefined; message?: string | undefined; } /** A candidate plus the answer to "is it there, and can we read it?". */ export interface SettingsPathEntry extends SettingsPathCandidate { /** `'undetermined'` when the probe itself failed — not the same as absent. */ exists: boolean | 'undetermined'; /** `'undetermined'` when the probe itself failed — not the same as unreadable. */ readable: boolean | 'undetermined'; /** The probe failure that made the answer undetermined (errno / error code). */ accessError?: string | undefined; } export interface SettingsPathCandidatesResult { paths: SettingsPathCandidate[]; } export interface SettingsPathsResult { paths: SettingsPathEntry[]; } export type SettingsDetectedType = 'managed' | 'user' | 'project' | 'unknown'; /** * How the settings type was arrived at. * * `user` and `project` settings share one schema, so a file carrying no * managed-only field could be either. Returning `user` for that case answered a * question we had not settled; `ambiguous` says so out loud. */ export type SettingsTypeConfidence = /** The caller passed an explicit `--type`. */ 'declared' /** A managed-only field settled it. */ | 'inferred' /** Could be user or project — the shared schema cannot tell them apart. */ | 'ambiguous' /** The file could not be read or parsed, so there was nothing to detect. */ | 'undetermined'; /** One thing wrong with (or worth noting about) a settings file. */ export interface SettingsFinding { /** Dotted path inside the settings document; `''` means the document itself. */ path: string; message: string; severity: IssueSeverity; } export interface SettingsValidateResult { /** Worst ACTIONABLE severity across `findings`. */ status: 'success' | 'warning' | 'error'; /** The severity distribution, published beside the status rather than folded into it. */ issueCounts: SeverityCounts; findings: SettingsFinding[]; detectedType: SettingsDetectedType; typeConfidence: SettingsTypeConfidence; } /** * Status + counts for a set of settings findings, via the ONE shared collapse. * * Settings findings are not registry-coded `ValidationIssue`s — the code * registry has no `SETTINGS_*` entry — but `calculateValidationStatus` and * `countBySeverity` read nothing except `severity`. The structural cast is here * so that this lane does NOT become yet another hand-rolled issues→status * collapse with its own answer for an info-only set. */ export declare function summarizeSettingsFindings(findings: readonly SettingsFinding[]): { status: 'success' | 'warning' | 'error'; issueCounts: SeverityCounts; }; /** * Probe a path for existence and readability. * * Returns `'undetermined'` for both when the probe failed for a reason that is * not "absent" (e.g. a permission error on a parent directory): claiming * `exists: false` there would report a determination we never made. */ export declare function probePathAccess(filePath: string): Promise<{ exists: boolean | 'undetermined'; readable: boolean | 'undetermined'; accessError?: string; }>; /** * Perform a settings audit — load all layers and merge. */ export declare function auditSettings(options?: ReadSettingsOptions): Promise; /** * Enumerate every settings path Claude could load, without looking at the disk. * * Deliberately returns {@link SettingsPathCandidate}s: this function cannot know * whether a path exists, so it says nothing about it. Use * {@link resolveSettingsPaths} for answers. */ export declare function getSettingsPaths(projectDir?: string): SettingsPathCandidatesResult; /** * Answer, for every candidate path, whether it exists and is readable. * * A probe that fails for any reason other than "absent" yields * `'undetermined'` plus an `accessError`, never a confident `false`. */ export declare function resolveSettingsPaths(projectDir?: string): Promise; /** * Validate a specific settings file against the appropriate schema. */ export declare function validateSettingsFile(filePath: string, typeHint?: Exclude): Promise; /** One field present in a settings file. */ export interface SettingsFileField { key: string; value?: string; count?: number; } /** * Get summary of fields present in a settings file (for --file output). * * Returns `null` when the file could not be read, parsed, or is not an object. * `[]` means the file parsed and genuinely declares no fields — the two were the * same empty array before, so "I could not look" was reported as "there is * nothing there". */ export declare function getSettingsFileFields(filePath: string): Promise; export { type EffectiveSettings, type SettingsLayer } from './settings-merger.js'; export { type ReadSettingsOptions } from './settings-reader.js'; //# sourceMappingURL=settings-auditor.d.ts.map