def METHOD_NAME(actions, deps, output):
    """Calculates the direct dependencies of the deps.
    Args:
      actions: the actions (typically ctx.actions) used to run commands
      deps: the deps to get the direct dependencies of
      output: the output file the data will be written to
    Returns:
      The same output file passed as the input arg, for convenience.
    """
    descriptor_set = depset(
        [dep[ProtoInfo].direct_descriptor_set for dep in deps if ProtoInfo in dep],
        transitive = [dep[DirectDescriptorInfo].descriptors for dep in deps if ProtoInfo not in dep],
    )
    actions.run_shell(
        outputs = [output],
        inputs = descriptor_set,
        progress_message = "Joining direct descriptors.",
        command = ("cat %s > %s") % (
            " ".join([d.path for d in descriptor_set.to_list()]),
            output.path,
        ),
    )
    return output