def update_docs_yml(valid_connectors):
    """Update the docs.yml file with the connector list."""
    try:
        with open(DOCS_YML_PATH, "r") as f:
            docs_config = yaml.safe_load(f)

        # Find the connectors section
        for section in docs_config["navigation"]:
            if isinstance(section, dict) and "section" in section and section["section"] == "Docs":
                for item in section["contents"]:
                    if (
                        isinstance(item, dict)
                        and "section" in item
                        and item["section"] == "Connectors"
                    ):
                        # Clear existing connector list
                        item["contents"] = []

                        # Add all connectors
                        for connector in sorted(valid_connectors):
                            display_name = connector.replace("_", " ").title()
                            item["contents"].append(
                                {
                                    "page": display_name,
                                    "path": f"docs/pages/connectors/{connector}/main.mdx",
                                }
                            )

        # Write back the updated config
        with open(DOCS_YML_PATH, "w") as f:
            yaml.dump(docs_config, f, default_flow_style=False, sort_keys=False)

        print(f"Updated docs.yml with {len(valid_connectors)} connectors")
    except Exception as e:
        print(f"Error updating docs.yml: {str(e)}")
Update the docs.yml file with the connector list.
fern/scripts/update_connector_docs/utils/file_utils.py