Skip to content

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

TypeScript
794 B
Raw Blame
import type { Settings } from 'claude-code'

/**
 * Whether the session checkpoints Claude's edits, read as the built-in
 * reads it: the setting on unless set false, the variable unset or falsy.
 *
 * The built-in panel opens on an edit only through a checkpoint, so with
 * checkpointing off its first-edit open never happens; `/diff` still opens.
 *
 * @param settings the merged settings (`$.settings.read()`)
 * @param disabling `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` as `$.env.get`
 *   answers it
 * @returns false when either turns checkpointing off
 */
export const isCheckpointing = (
  settings: Settings,
  disabling: string | undefined,
): boolean =>
  settings.fileCheckpointingEnabled !== false &&
  !['1', 'true', 'yes', 'on'].includes((disabling ?? '').trim().toLowerCase())