import { type Operation } from "effection"; import type { PolicyArgs, PolicyHandlerResult, PolicyShape } from "../policy.js"; /** * A parsed gleam.toml represented as a record of sections and values. * * @alpha */ export type GleamToml = Record; /** * A policy handler for gleam.toml policies. * * @remarks * Receives the parsed TOML content and the standard policy arguments. * * @alpha */ export type GleamTomlHandler = (toml: GleamToml, args: PolicyArgs) => Operation | Promise; /** * Input arguments for defining a gleam.toml policy. * * @alpha */ export interface DefineGleamPolicyArgs { /** * The name of the policy. */ name: string; /** * A description of the policy's purpose. */ description: string; /** * The handler function that receives the parsed gleam.toml and policy arguments. */ handler: GleamTomlHandler; /** * Optional default configuration for the policy. */ defaultConfig?: C; } /** * Define a repo policy for gleam.toml files. * * @remarks * This is a helper function that creates a policy pre-configured to match * gleam.toml files. The handler receives the parsed TOML content. * * @example * ```typescript * const MyGleamPolicy = defineGleamPolicy({ * name: "MyGleamPolicy", * description: "Ensures gleam.toml has required fields", * handler: async (toml, { file }) => { * if (!toml.name) { * return { error: "Missing name field", fixable: false }; * } * return true; * }, * }); * ``` * * @alpha */ export declare function defineGleamPolicy(args: DefineGleamPolicyArgs): PolicyShape; //# sourceMappingURL=defineGleamPolicy.d.ts.map