@ton-ai-core/vibecode-linter
Version:
Advanced TypeScript linter with Git integration, dependency analysis, and comprehensive error reporting
68 lines • 2.13 kB
TypeScript
import { Effect } from "effect";
import type { DecisionState, ExitCode } from "./models.js";
/**
* Computes process exit code from diagnostic state (pure function).
*
* @param state - Immutable flags computed from diagnostics
* @returns 1 if there are lint errors or duplicates; otherwise 0
*
* @pure true
* @invariant exitCode ∈ {0,1}
* @precondition state is derived deterministically from analysis
* @postcondition (state.hasLintErrors ∨ state.hasDuplicates) → result = 1
* @complexity O(1)
*
* @example
* ```ts
* // Pure function usage
* const exitCode = computeExitCode({ hasLintErrors: true, hasDuplicates: false });
* // exitCode === 1
*
* // Pipe composition
* const result = pipe(
* { hasLintErrors: false, hasDuplicates: true },
* computeExitCode
* ); // => 1
* ```
*/
export declare const computeExitCode: (state: DecisionState) => ExitCode;
/**
* Curried version using flow for partial application.
*
* @pure true
* @invariant Always returns a function that produces ExitCode ∈ {0,1}
* @complexity O(1)
*
* @example
* ```ts
* const checkErrors = flow(
* (state: DecisionState) => state.hasLintErrors || state.hasDuplicates,
* (hasErrors: boolean) => (hasErrors ? 1 : 0) as ExitCode
* );
* ```
*/
export declare const computeExitCodeFlow: (state: DecisionState) => ExitCode;
/**
* Computes exit code as an Effect for composition with other Effects.
*
* @param state - Immutable flags computed from diagnostics
* @returns Effect that succeeds with exit code (never fails)
*
* @pure false - wraps in Effect for composition
* @effect Effect<ExitCode, never, never>
* @invariant Result is Effect.succeed(exitCode) where exitCode ∈ {0,1}
* @complexity O(1)
*
* @example
* ```ts
* import { Effect, pipe } from "effect";
*
* const program = pipe(
* analyzeCode(),
* Effect.map(results => ({ hasLintErrors: results.errors > 0, hasDuplicates: false })),
* Effect.flatMap(computeExitCodeEffect)
* );
* ```
*/
export declare const computeExitCodeEffect: (state: DecisionState) => Effect.Effect<ExitCode>;
//# sourceMappingURL=decision.d.ts.map