#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File: src/scitex_writer/_compile/revision.py
"""
Revision response compilation function.
Provides revision-specific compilation with options for:
- Change tracking (diff highlighting)
"""
from __future__ import annotations
from pathlib import Path
from typing import Callable, Optional
from .._dataclasses import CompilationResult
from ._runner import run_compile
def compile_revision(
project_dir: Path,
track_changes: bool = False,
timeout: int = 300,
log_callback: Optional[Callable[[str], None]] = None,
progress_callback: Optional[Callable[[int, str], None]] = None,
) -> CompilationResult:
"""
Compile revision responses with optional callbacks.
Parameters
----------
project_dir : Path
Path to writer project directory
track_changes : bool
Whether to enable change tracking (diff highlighting)
timeout : int
Timeout in seconds
log_callback : Optional[Callable[[str], None]]
Called with each log line
progress_callback : Optional[Callable[[int, str], None]]
Called with progress updates (percent, step)
Returns
-------
CompilationResult
Compilation status and outputs
Examples
--------
>>> from pathlib import Path
>>> from scitex_writer._compile import compile_revision
>>>
>>> # Standard revision compilation
>>> result = compile_revision(
... project_dir=Path("~/my-paper")
... )
>>>
>>> # Compilation with change tracking
>>> result = compile_revision(
... project_dir=Path("~/my-paper"),
... track_changes=True
... )
"""
return run_compile(
"revision",
project_dir,
timeout=timeout,
track_changes=track_changes,
log_callback=log_callback,
progress_callback=progress_callback,
)
__all__ = ["compile_revision"]
# EOF