Commit 67486cd8 authored by Jan Reimes's avatar Jan Reimes
Browse files

🔧 chore(checkout): update checkout directory references to use manager.checkout_dir

parent 60cb02a5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ def ai_convert(
    output: Annotated[Path | None, typer.Option("--output", "-o", help="Output file path (optional, prints to stdout if not specified)")] = None,
    json_output: Annotated[bool, typer.Option("--json", help="Output as JSON")] = False,
) -> None:
    """Convert a single document to markdown format."""
    """Convert a single TDoc to markdown format."""
    try:
        output_path = Path(output) if output else None
        markdown_content = convert_document(document_id=document_id, output_path=output_path)
@@ -537,7 +537,7 @@ def workspace_add_members(

    # Build members with actual paths
    members = []
    checkout_base = manager.root / "checkout"
    checkout_base = manager.checkout_dir
    skipped_items = []
    for item in items:
        source_path = item
@@ -546,7 +546,7 @@ def workspace_add_members(
        if checkout:
            checkout_path = None
            if source_kind == SourceKind.TDOC:
                checkout_path = checkout_tdoc_to_workspace(item, checkout_base, workspace)
                checkout_path = checkout_tdoc_to_workspace(item, checkout_base, workspace, db_file=manager.db_file)
                if checkout_path is None:
                    skipped_items.append((item, "TDoc not found in database or meeting not crawled"))
                    continue
@@ -559,7 +559,9 @@ def workspace_add_members(
                source_path = str(checkout_path)
                # Ensure .ai subfolder exists
                ensure_ai_subfolder(checkout_path)

        # For specs, include release version in source_item_id to allow multiple versions
        # TODO: the variable release should always be fully resolved to an actual version with three digits, e.g., "17.0.0" instead of "latest", "17.0" or "17"
        source_item_id = f"{item}-REL{release}" if source_kind == SourceKind.SPEC and release else item
        members.append(make_workspace_member(workspace, source_item_id, source_path, source_kind))

+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ def open_tdoc(
            metadata = results[0]

        try:
            tdoc_file = prepare_tdoc_file(metadata, manager.root, session=session)
            tdoc_file = prepare_tdoc_file(metadata, manager.checkout_dir, session=session)
        except (FileNotFoundError, OSError, ValueError, zipfile.BadZipFile) as exc:
            console.print(f"[red]Failed to prepare TDoc {normalized_id}: {exc}")
            raise typer.Exit(code=1) from exc
+3 −3
Original line number Diff line number Diff line
@@ -114,12 +114,12 @@ def checkout_tdoc(
    return checkout_path


def prepare_tdoc_file(metadata: TDocMetadata, cache_dir: Path, return_dir: bool = False, session: requests.Session | None = None) -> Path:
def prepare_tdoc_file(metadata: TDocMetadata, checkout_dir: Path, return_dir: bool = False, session: requests.Session | None = None) -> Path:
    """Prepare TDoc file for opening (download and extract if needed).

    Args:
        metadata: TDoc metadata with download URL.
        cache_dir: Cache directory for downloads and extracted files.
        checkout_dir: Checkout directory for downloads and extracted files.
        return_dir: When True and TDoc is a zip, return the extract directory.
        session: Optional requests.Session to reuse for downloads.

@@ -138,7 +138,7 @@ def prepare_tdoc_file(metadata: TDocMetadata, cache_dir: Path, return_dir: bool
        logger.debug(f"Skipping download for withdrawn TDoc {metadata.tdoc_id}")
        raise FileNotFoundError("withdrawn")

    downloads_dir = cache_dir / "checkout"
    downloads_dir = Path(checkout_dir)
    downloads_dir.mkdir(parents=True, exist_ok=True)
    path = urlparse(metadata.url).path
    filename = str(posixpath.basename(path))