/** * Lint rule and finding primitives. * * Library-style discriminated unions for the lint engine. Rules are plain * values generic over a caller-built `RuleContext` — no Layer wiring and no * ambient service bag. Findings are produced by `rule.check`; rules do not * carry mutation or workflow guidance. * * Rule ids follow `/-` with lowercase letters, * digits, and hyphens; ids leak into settings files, CI logs, and agent * transcripts, so they are public API stable under a deprecation-alias policy * per the `lint-engine` design doc. * * @experimental This API is unstable and may change without notice. * @packageDocumentation */ import type * as Effect from "effect/Effect"; /** * Platform-canonical finding severity. * * WorkspaceMutations `lint.rules` overrides can raise or lower the severity at * evaluation time; the catalog pins the platform default. * * @experimental This API is unstable and may change without notice. */ export type Severity = "error" | "warning" | "info"; /** * Accessor-relative location of a finding. * * `file` is posix and relative to the rule context's accessor root (skill or * pack manifest directory for per-extension rules, workspace root for workspace * rules). Rules MUST NOT embed absolute paths, `displayRoot`-qualified paths, * or source coordinates in `message`; the display path is composed from * `context.displayRoot` and `location.file` at format time via `composePath`. * * `file: ""` targets the context root itself (e.g., a missing `SKILL.md` on a * skill context). * * @experimental This API is unstable and may change without notice. */ export interface FindingLocation { readonly file: string; readonly line?: number; readonly column?: number; readonly byteOffset?: number; readonly byteLength?: number; } /** * Fields common to all lint findings. * * @experimental This API is unstable and may change without notice. */ export interface FindingBase { readonly ruleId: string; readonly severity: Severity; readonly message: string; readonly location?: FindingLocation; } /** * Intrinsic fact produced by a lint rule. * * @experimental This API is unstable and may change without notice. */ export interface AdvisoryFinding extends FindingBase { readonly kind: "advisory"; } /** * Discriminated union of lint findings on `kind`. * * @experimental This API is unstable and may change without notice. */ export type LintFinding = AdvisoryFinding; /** * Fields common to all lint rules. * * @experimental This API is unstable and may change without notice. */ export interface RuleBase { readonly id: string; readonly description: string; readonly severity: Severity; } /** * Rule that only surfaces findings; never autofixes. * * @experimental This API is unstable and may change without notice. */ export interface AdvisoryRule extends RuleBase { readonly kind: "advisory"; readonly check: (context: C) => Effect.Effect>; } /** * Discriminated union of lint rules over a caller-built rule-context type `C`. * * @experimental This API is unstable and may change without notice. */ export type LintRule = AdvisoryRule; //# sourceMappingURL=rule.d.ts.map