@felixgeelhaar/cclint
Version:
Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.
57 lines • 2.51 kB
TypeScript
import { type Connection, type InitializeResult, type CodeAction, type Diagnostic, type Range } from 'vscode-languageserver/node';
import { TextDocument } from 'vscode-languageserver-textdocument';
/**
* Resolve a text-document URI to a filesystem path.
*
* @remarks
* `file://` URIs are decoded to real paths so file-kind gating (a rule's
* {@link ContextFile}-based `appliesTo`) sees, e.g., `.claude/skills/…` and
* `settings.json`. Non-`file:` URIs (such as `untitled:`) are passed through
* unchanged — they never resolve to a real config file, so config lookup simply
* falls back to defaults and structure rules are gated off by extension.
*/
export declare function uriToFsPath(uri: string): string;
/**
* Lint an open document's live text and return LSP diagnostics.
*
* Pure with respect to the LSP connection: it can be exercised in unit tests by
* passing a {@link TextDocument} built with `TextDocument.create`.
*/
export declare function lintTextDocument(document: TextDocument): Diagnostic[];
/**
* Compute quick-fix code actions for the violations that fall within the
* requested range and carry a structured fix.
*
* Pure with respect to the LSP connection, so it is unit-testable directly.
*/
export declare function computeCodeActions(document: TextDocument, range: Range): CodeAction[];
/**
* The server's advertised capabilities.
*
* @remarks
* Incremental text sync keeps large documents cheap to update, and a quick-fix
* code action provider exposes the fixes rules attach to their violations.
*/
export declare function buildInitializeResult(): InitializeResult;
/**
* Wire cclint's linting pipeline onto an LSP {@link Connection}: publish
* diagnostics on open/change/save, clear them on close, and serve quick-fix
* code actions.
*
* @remarks
* Split out from {@link startServer} so a test can drive it with a fake
* connection if desired. `documents.onDidChangeContent` fires on both open and
* change, so it covers `textDocument/didOpen` and `textDocument/didChange`;
* `onDidSave` re-lints on `textDocument/didSave`.
*/
export declare function registerHandlers(connection: Connection): void;
/**
* Start the cclint language server over stdio.
*
* @remarks
* Called by the `cclint-lsp` bin. Creates the connection, registers handlers,
* and begins listening. No work happens at module import time, so importing
* this module in tests is side-effect free.
*/
export declare function startServer(): void;
//# sourceMappingURL=server.d.ts.map