async def generate_entities(self) -> AsyncGenerator[ChunkEntity, None]:
        """Generate entities from Bitbucket.

        Yields:
            Workspace, repository, directory, and file entities
        """
        if not hasattr(self, "workspace") or not self.workspace:
            raise ValueError("Workspace must be specified")

        async with httpx.AsyncClient() as client:
            # First, yield the workspace entity
            workspace_entity = await self._get_workspace_info(client, self.workspace)
            yield workspace_entity

            workspace_breadcrumb = Breadcrumb(
                entity_id=workspace_entity.entity_id,
                name=workspace_entity.name,
                type="workspace",
            )

            # If a specific repository is specified, only process that one
            if hasattr(self, "repo_slug") and self.repo_slug:
                repo_data = await self._get_repository_info(client, self.workspace, self.repo_slug)

                # Use specified branch or default branch
                branch = self.branch or repo_data.mainbranch or "master"
                logger.info(f"Using branch: {branch} for repo {self.repo_slug}")

                async for entity in self._traverse_repository(
                    client, self.workspace, self.repo_slug, branch
                ):
                    # Add workspace breadcrumb to repository entities
                    if isinstance(entity, BitbucketRepositoryEntity):
                        entity.breadcrumbs = [workspace_breadcrumb]
                    yield entity
            else:
                # Process all repositories in the workspace
                repositories = await self._get_repositories(client, self.workspace)

                for repo_data in repositories:
                    repo_slug = repo_data["slug"]

                    # Get detailed repo info to get default branch
                    repo_entity = await self._get_repository_info(client, self.workspace, repo_slug)

                    # Use specified branch or default branch
                    branch = self.branch or repo_entity.mainbranch or "master"
                    logger.info(f"Using branch: {branch} for repo {repo_slug}")

                    async for entity in self._traverse_repository(
                        client, self.workspace, repo_slug, branch
                    ):
                        # Add workspace breadcrumb to repository entities
                        if isinstance(entity, BitbucketRepositoryEntity):
                            entity.breadcrumbs = [workspace_breadcrumb]
                        yield entity
Generate entities from Bitbucket.

        Yields:
            Workspace, repository, directory, and file entities
        
backend/airweave/platform/sources/bitbucket.py