2020import pathlib
2121from typing import Union
2222
23+ from google .auth import credentials as auth
2324from google .cloud import storage
2425from pydantic import ValidationError
2526import yaml
@@ -301,6 +302,8 @@ def _list_skills_in_dir(
301302def _list_skills_in_gcs_dir (
302303 bucket_name : str ,
303304 skills_base_path : str = "" ,
305+ project_id : str | None = None ,
306+ credentials : auth .Credentials | None = None ,
304307) -> Dict [str , models .Frontmatter ]:
305308 """List skills in a GCS directory.
306309
@@ -311,7 +314,7 @@ def _list_skills_in_gcs_dir(
311314 Returns:
312315 Dictionary mapping skill IDs to their frontmatter.
313316 """
314- client = storage .Client ()
317+ client = storage .Client (project = project_id , credentials = credentials )
315318 bucket = client .bucket (bucket_name )
316319
317320 base_prefix = skills_base_path .strip ("/" )
@@ -350,13 +353,17 @@ def _load_skill_from_gcs_dir(
350353 bucket_name : str ,
351354 skill_id : str ,
352355 skills_base_path : str = "" ,
356+ project_id : str | None = None ,
357+ credentials : auth .Credentials | None = None ,
353358) -> models .Skill :
354359 """Load a complete skill from a GCS directory.
355360
356361 Args:
357362 bucket_name: Name of the GCS bucket.
358363 skill_id: The ID of the skill (directory name).
359364 skills_base_path: Base directory within the bucket (e.g., 'path/to/skills').
365+ project_id: Project ID to use for GCS client.
366+ credentials: Credentials to use for GCS client.
360367
361368 Returns:
362369 Skill object with all components loaded.
@@ -366,7 +373,8 @@ def _load_skill_from_gcs_dir(
366373 ValueError: If SKILL.md is invalid or the skill name does not match
367374 the directory name.
368375 """
369- client = storage .Client ()
376+
377+ client = storage .Client (project = project_id , credentials = credentials )
370378 bucket = client .bucket (bucket_name )
371379
372380 base_prefix = skills_base_path .strip ("/" )
0 commit comments