@ton-ai-core/vibecode-linter
Version:
Advanced TypeScript linter with Git integration, dependency analysis, and comprehensive error reporting
65 lines • 2.57 kB
TypeScript
/**
* Preflight issue codes enumerating all invariant violations we can detect prior to run.
*
* Invariants:
* - TypeScript must be resolvable from the project (peer dependency).
* - Biome must be resolvable from the project (peer dependency).
* - The command should be executed from a project root (must contain package.json).
* - Running from an isolated npx cache should be warned about (advisory).
*/
export type PreflightIssueCode = "missingTypescript" | "missingBiome" | "noPackageJson" | "npxIsolated";
/**
* Result of preflight checks.
*
* @property ok True if no blocking issues found (advisories may still exist)
* @property issues List of detected issues (blocking and advisory)
*/
export interface PreflightResult {
readonly ok: boolean;
readonly issues: readonly PreflightIssueCode[];
}
/**
* Check if the current working directory looks like a project root (has package.json).
*
* Invariant: users should run CLI from the project root to ensure peer dependency resolution.
*/
export declare function hasPackageJson(cwd: string): boolean;
/**
* Resolve a module from a specific cwd without mutating global module paths.
*
* Postcondition: returns true if resolution succeeds, false otherwise.
*/
export declare function canResolveFromCwd(moduleName: string, cwd: string): boolean;
/**
* Detect if running from an isolated npx cache directory (advisory).
*
* Invariant: Running from ~/.npm/_npx/** may hide project devDependencies from Node's resolver.
*/
export declare function isNpxIsolatedProcess(currentDir: string, argv0: string, execPath: string): boolean;
/**
* Run preflight checks and return a structured result.
*
* Preconditions:
* - None
*
* Postconditions:
* - ok === true iff no blocking issues are found (missing TypeScript, missing Biome, or no package.json)
* - issues contains "npxIsolated" as advisory when detected
*
* Complexity:
* - O(1) fs checks and sync require.resolve attempts; no file traversal
*/
export declare function runPreflight(cwd?: string): PreflightResult;
/**
* Print actionable, English guidance based on preflight issues.
*
* No side-effects other than stdout/stderr. Does not exit the process.
*/
export declare function printPreflightReport(issues: readonly PreflightIssueCode[]): void;
/**
* Convenience helper to both run and print preflight diagnostics.
*
* @returns PreflightResult for the caller to decide whether to proceed or exit.
*/
export declare function checkAndReportPreflight(cwd?: string): PreflightResult;
//# sourceMappingURL=preflight.d.ts.map