def get_file_type_from_main_dir(file_path):
    """
    Determine if a file is a metadata file or a wf file (cwl, wdl, nf, sm) from a subtool, script, or workflow directory.
    Raises an error if it doesn't look like either.
    """
    if file_path.suffix == '.cwl':
        file_type = 'cwl'
    elif file_path.suffix == '.wdl':
        file_type = 'wdl'
    elif file_path.suffix == '.snakefile':
        file_type = 'snakemake'
    elif file_path.suffix == 'nf':
        file_type = 'nextflow'
    elif file_path.suffix in ('.yaml', '.yml'):
        if '-metadata' in file_path.parts[-1]:  # have a metadata file
            file_type = 'metadata'
        else:
            raise ValueError(f"Cannot determine file type for {file_path}")
    else:
        raise ValueError(f"Cannot determine file type for {file_path}")
    return file_type