from typing import Iterable
from pathlib import Path
from typing import List


def find_pipeline_manifests(cwl_files: Iterable[Path]) -> List[Path]:
    """
    Constructs manifest paths from CWL files (strip '.cwl', append
    '-manifest.json'), and check whether each manifest exists. Return
    a list of `Path`s that exist on disk.
    """
    manifests = []
    for cwl_file in cwl_files:
        manifest_file = cwl_file.with_name(f'{cwl_file.stem}-manifest.json')
        if manifest_file.is_file():
            manifests.append(manifest_file)
    return manifests