Ë
    ëÿæi›@  ã                   óî  — U d Z ddlZddlZddlmZ ddlmZ ddlZddlm	Z	m
Z
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ dZdZde› d�ZdZ ed«      Z ed«      Z ed«      Z ed«      Zh d£ZdhZdddœZee e f   e!d<    ed¬«      Z"de	de fd„Z#ded e
d!e$e    de$e%e$e    e	f      fd"„Z&de	fd#„Z'dd$œde	d%e(e    dz  de$e    fd&„Z)d'e$e%e$e    e	f      dee e%e e f   f   fd(„Z*d!e$e    de	de fd)„Z+de fd*„Z,d+ed,e-ddfd-„Z.d.ed/e d,e-defd0„Z/d1ed/e d2ed,e-def
d3„Z0d4e-d5e-d6edz  de$e   fd7„Z1e"je                  d8«      dQd9„«       Z3e"je                  d:g d;¢¬<«      ed=d=dd=fd>ee  ejh                  d?d=¬@«      f   d4ee- ejj                  dAdB¬«      f   d5ee- ejj                  dCdDdE¬«      f   d6eedz   ejj                  dF¬«      f   d,ee- ejj                  dGdH¬«      f   ddfdI„«       Z6e"je                  dJg dK¢¬<«      	 	 	 	 dRd>ee dz   ejh                  dLd=¬@«      f   d4ee- ejj                  dAdM¬«      f   d5ee- ejj                  dCdDdN¬«      f   d6eedz   ejj                  dO¬«      f   ddf
dP„«       Z7y)Sa  Contains commands to manage skills for AI assistants.

Usage:
    # install the hf-cli skill in common .agents/skills directory (either in current directory or user-level)
    hf skills add
    hf skills add --global

    # install the hf-cli skill for Claude (project-level, in current directory)
    hf skills add --claude

    # install globally (user-level)
    hf skills add --claude --global

    # install to a custom directory
    hf skills add --dest=~/my-skills

    # overwrite an existing skill
    hf skills add --claude --force
é    N)ÚPath)Ú	Annotated)ÚCommandÚContextÚGroup)Úget_command)ÚCLIErroré   )Ú_skills)Útyper_factoryzhf-cliað  Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub. Use when: handling authentication; managing local cache; managing Hugging Face Buckets; running or scheduling jobs on Hugging Face infrastructure; managing Hugging Face repos; discussions and pull requests; browsing models, datasets and spaces; reading, searching, or browsing academic papers; managing collections; querying datasets; configuring spaces; setting up webhooks; or deploying and managing HF Inference Endpoints. Make sure to use this skill whenever the user mentions 'hf', 'huggingface', 'Hugging Face', 'huggingface-cli', or 'hugging face cli', or wants to do anything related to the Hugging Face ecosystem and to AI and ML in general. Also use for cloud storage needs like training checkpoints, data pipelines, or agent traces. Use even if the user doesn't explicitly ask for a CLI command. Replaces the deprecated `huggingface-cli`.z---
name: hf-cli
description: "a?  "
---

Install: `curl -LsSf https://hf.co/cli/install.sh | bash -s`.

The Hugging Face Hub CLI tool `hf` is available. IMPORTANT: The `hf` command replaces the deprecated `huggingface-cli` command.

Use `hf --help` to view available functions. Note that auth commands are now all under `hf auth` e.g. `hf auth whoami`.
u  
## Mounting repos as local filesystems

To mount Hub repositories or buckets as local filesystems â€” no download, no copy, no waiting â€” use `hf-mount`. Files are fetched on demand. GitHub: https://github.com/huggingface/hf-mount

Install: `curl -fsSL https://raw.githubusercontent.com/huggingface/hf-mount/main/install.sh | sh`

Some command examples:
- `hf-mount start repo openai-community/gpt2 /tmp/gpt2` â€” mount a repo (read-only)
- `hf-mount start --hf-token $HF_TOKEN bucket myuser/my-bucket /tmp/data` â€” mount a bucket (read-write)
- `hf-mount status` / `hf-mount stop /tmp/data` â€” list or unmount

## Tips

- Use `hf <command> --help` for full options, descriptions, usage, and real-world examples
- Authenticate with `HF_TOKEN` env var (recommended) or with `--token`
z.agents/skillsz~/.agents/skillsz.claude/skillsz~/.claude/skills>   ú--typeú--quietú
--revisionú--tokenú--formatr   zKOutput format: `--format json` (or `--json`) or `--format table` (default).zXUse a User Access Token. Prefer setting `HF_TOKEN` env var instead of passing `--token`.)r   r   Ú_COMMON_FLAG_HELP_OVERRIDESz Manage skills for AI assistants.)ÚhelpÚcmdÚreturnc           	      óâ  — g }| j                   D ]Î  }|j                  r|j                  dk(  rŒ|j                  r|j                  j	                  d«      rŒGt        d„ t        |dg «      D «       d«      }|�@t        |j                  dd«      j                  «       xs d}|j                  |› d	|› �«       Œ§|j                  sŒ´|j                  |j                  «       ŒÐ d	j                  |«      S )
zMFormat required params: positional as UPPER_CASE, options as ``--name TYPE``.ú--helpÚ_c              3   óD   K  — | ]  }|j                  d «      sŒ|–— Œ y­w)ú--N)Ú
startswith)Ú.0Úos     úo/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/huggingface_hub/cli/skills.pyÚ	<genexpr>z!_format_params.<locals>.<genexpr>„   s   è ø€ ÐRÑ%; ¸q¿|¹|ÈDÕ?Qœ!Ñ%;ùs   ‚ ™ ÚoptsNÚnameÚ ÚVALUEÚ )ÚparamsÚrequiredÚhuman_readable_namer!   r   ÚnextÚgetattrÚtypeÚupperÚappendÚjoin)r   ÚpartsÚpÚ	long_nameÚ	type_names        r   Ú_format_paramsr2   |   sÉ   € à€EØ�ZŒZˆØ�zŠz˜Q×2Ñ2°hÒ>ØØ�6Š6�a—f‘f×'Ñ'¨Ô,ØÜÑR¤W¨Q°¸Ô%;ÓRÐTXÓYˆ	ØÐ Ü §¡¨°Ó3×9Ñ9Ó;ÒF¸wˆIØ�L‰L˜I˜; a¨	 {Ð3Õ4Ø�V‹VØ�L‰L˜×.Ñ.Õ/ð ð �8‰8�E‹?Ðó    ÚgroupÚctxÚ
path_partsc                 ó&  — g }t        | ||d   ¬«      }| j                  |«      D ]i  }| j                  ||«      }|�|j                  rŒ$g |¢|‘}t	        |t
        «      r|j                  t        |||«      «       ŒW|j                  ||f«       Œk |S )zXRecursively walk a Click Group, returning (full_path_parts, cmd) for every leaf command.éÿÿÿÿ)ÚparentÚ	info_name)	r   Úlist_commandsr   ÚhiddenÚ
isinstancer   ÚextendÚ_collect_leaf_commandsr,   )r4   r5   r6   ÚleavesÚsub_ctxr!   r   Ú
child_paths           r   r?   r?   �   s•   € à.0€FÜ�e C°:¸b±>ÔB€GØ×#Ñ# GÖ,ˆØ×Ñ ¨Ó.ˆØˆ;˜#Ÿ*š*ØØ(�zÐ( 4Ð(ˆ
Ü�cœ5Ô!Ø�M‰MÔ0°°g¸zÓJÕKà�M‰M˜: sÐ+Õ,ð -ð €Mr3   c              #   óN  K  — | j                   D ]’  }|j                  s|j                  dk(  rŒ|j                  r|j                  j	                  d«      rŒGd}d}t        |dg «      D ].  }|j	                  d«      r|xs |}Œ|j	                  d«      sŒ-|}Œ0 |sŒŒ|||f–— Œ” y­w)zKYield (param, long_name, short_name) for each optional, non-internal param.r   r   Nr    r   Ú-)r%   r&   r'   r!   r   r)   )r   r/   r0   Ú
short_nameÚopts        r   Ú_iter_optional_paramsrG   �   sœ   è ø€ à�ZŒZˆØ�:Š:˜×.Ñ.°(Ò:ØØ�6Š6�a—f‘f×'Ñ'¨Ô,ØØˆ	Øˆ
Ü˜1˜f bÖ)ˆCØ�~‰~˜dÔ#Ø%Ò,¨‘	Ø—‘ Õ$Ø ‘
ð	 *ò
 Ø�Y 
Ð*Ó*ñ ùs   ‚BB%ÂB%Â
B%©ÚexcluderI   c                óü   — g }t        | «      D ]k  \  }}}|r||v rŒt        |dd«      r|j                  |«       Œ-t        |j                  dd«      j	                  «       xs d}|j                  |› d|› �«       Œm |S )z×Return long-form flag names (--foo) for optional, non-internal params.

    Boolean flags are bare (``--dry-run``).  Value-taking options include a
    type hint (``--include TEXT``, ``--max-workers INTEGER``).
    Úis_flagFr!   r"   r#   r$   )rG   r)   r,   r*   r+   )r   rI   Úflagsr/   r0   Ú_shortr1   s          r   Ú_get_flag_namesrN   ¯   s‚   € ð €EÜ 5°cÖ :Ñˆˆ9�fÙ�y GÑ+ØÜ�1�i Ô'Ø�L‰L˜Õ#ä §¡¨°Ó3×9Ñ9Ó;ÒF¸wˆIØ�L‰L˜I˜; a¨	 {Ð3Õ4ð !;ð €Lr3   Úleaf_commandsc                 ó  — i }| D ]w  \  }}t        |«      D ]d  \  }}}|t        vrŒ||vs|sŒd||   d   vsŒ"|r|› d|› �n|}t        |dd«      xs dj                  d«      d   j	                  «       }||f||<   Œf Œy |S )z0Collect display info for flags in the allowlist.z / r   r   Nr"   Ú
)rG   Ú_COMMON_FLAG_ALLOWLISTr)   ÚsplitÚstrip)	rO   Ú	flag_infoÚ_pathr   r/   r0   rE   ÚdisplayÚ	help_texts	            r   Ú_compute_common_flagsrY   Á   s®   € ð -/€Iã#‰
ˆˆsÜ(=¸cÖ(BÑ$ˆAˆy˜*ØÔ 6Ñ6Øà 	Ñ)ªj¸UÈ)ÐT]ÑJ^Ð_`ÑJaÒ=aÙ;E˜Z˜L¨¨I¨;Ñ7È9�Ü$ Q¨°Ó5Ò;¸×BÑBÀ4ÓHÈÑK×QÑQÓS�	Ø(/°Ð';�	˜)Ò$ñ )Cð $ð Ðr3   c                 ó  — |j                   xs dj                  d«      d   j                  «       }t        |«      }dg| ¢|r|gng z   }ddj	                  |«      › d|› �}t        |t        ¬«      }|r|d	dj	                  |«      › d
�z  }|S )z6Render a single leaf command as a markdown list entry.r"   rQ   r   Úhfú- `r$   õ   ` â€” rH   z `[z]`)r   rS   rT   r2   r-   rN   Ú_INLINE_FLAG_EXCLUDE)r6   r   rX   r%   r.   ÚentryrL   s          r   Ú_render_leafr`   Ô   s–   € à—‘’˜R×&Ñ& tÓ,¨QÑ/×5Ñ5Ó7€IÜ˜CÓ €FØÐ�JÐ©v F¡8¸2Ñ>€EØ�#—(‘(˜5“/Ð" &¨¨Ð4€EÜ˜CÔ)=Ô>€EÙØ�3�s—x‘x “Ð' rÐ*Ñ*ˆØ€Lr3   c                  ó  — ddl m}  ddlm} t	        |«      }t        |d¬«      }g }g }t        |j                  |«      «      D ][  }|j	                  ||«      }|�|j                  rŒ$t        |t        «      r|j                  ||f«       ŒH|j                  |g|f«       Œ] g }t        |«      }	|D ]7  \  }}
t        |
||g«      }|j                  ||f«       |	j                  |«       Œ9 t        |	«      }t        t         j#                  «       «      }|j                  d«       |j                  d| › d�«       |j                  d«       |j                  d	«       |j                  d«       |D ]   \  }}|j                  t%        ||«      «       Œ" t'        |«      }|D ]˜  \  }}||   }|j(                  xs dj+                  d
«      d   j-                  «       }|j                  d«       |j                  d|› d|› �«       |j                  d«       |D ]   \  }}|j                  t%        ||«      «       Œ" Œš |rœ|j                  d«       |j                  d«       |j                  d«       t        |j/                  «       «      D ]M  \  }\  }}t0        j3                  ||«      }|r|j                  d|› d|› �«       Œ9|j                  d|› d�«       ŒO |j                  t4        j#                  «       «       d
j7                  |«      S )Nr   )Ú__version__)Úappr[   )r:   r"   z!Generated with `huggingface_hub vz-`. Run `hf skills add --force` to regenerate.z## CommandsrQ   z### `hf r]   z## Common optionsr\   Ú`)Úhuggingface_hubrb   Úhuggingface_hub.cli.hfrc   r   r   Úsortedr;   r<   r=   r   r,   Úlistr?   r>   rY   Ú_SKILL_YAML_PREFIXÚ
splitlinesr`   Údictr   rS   rT   Úitemsr   ÚgetÚ_SKILL_TIPSr-   )rb   rc   Ú	click_appr5   Ú	top_levelÚgroupsr!   r   Úgroup_leavesÚall_leaf_commandsr4   r@   Úcommon_flagsÚlinesr6   Úgroups_dictÚ	group_cmdrX   r0   rW   s                       r   Úbuild_skill_mdrx   à   s¾  € å+Ý*ä˜CÓ €IÜ
�) tÔ
,€Cà13€IØ&(€FÜ�y×.Ñ.¨sÓ3Ö4ˆØ×#Ñ# C¨Ó.ˆØˆ;˜#Ÿ*š*ØÜ�cœ5Ô!Ø�M‰M˜4 ˜+Õ&à×Ñ˜t˜f c˜]Õ+ð 5ð GI€LÜ9=¸i»ÐÛ‰ˆˆeÜ'¨¨s°T°FÓ;ˆØ×Ñ˜T 6˜NÔ+Ø× Ñ  Õ(ð ô
 )Ð):Ó;€Lô Ô.×9Ñ9Ó;Ó<€EØ	‡L�L�ÔØ	‡L�LÐ4°[°MÐAnÐoÔpØ	‡L�L�ÔØ	‡L�L�ÔØ	‡L�L�Ôã$‰ˆ
�CØ�‰”\ *¨cÓ2Õ3ð %ô �v“,€KÛ$‰ˆˆfØ Ñ%ˆ	Ø—^‘^Ò) r×0Ñ0°Ó6°qÑ9×?Ñ?ÓAˆ	Ø�‰�RÔØ�‰�x ˜v V¨I¨;Ð7Ô8Ø�‰�RÔÛ%‰OˆJ˜Ø�L‰Lœ j°#Ó6Õ7ñ  &ð %ñ Ø�‰�RÔØ�‰Ð(Ô)Ø�‰�RÔÜ/5°l×6HÑ6HÓ6JÖ/KÑ+ˆIÑ+˜ Ü3×7Ñ7¸	À9ÓMˆIÙØ—‘˜s 7 )¨6°)°Ð=Õ>à—‘˜s 7 )¨1Ð-Õ.ð 0Lð 
‡L�L”×'Ñ'Ó)Ô*à�9‰9�UÓÐr3   ÚpathÚforcec                 óô   — | j                  «       s| j                  «       sy|st        d| › d�«      ‚| j                  «       r&| j                  «       st	        j
                  | «       y| j                  «        y)zRRemove existing file/directory/symlink if force is True, otherwise raise an error.NzSkill already exists at z#.
Re-run with --force to overwrite.)ÚexistsÚ
is_symlinkr	   Úis_dirÚshutilÚrmtreeÚunlink)ry   rz   s     r   Ú_remove_existingr‚   !  sW   € à�K‰KŒM˜TŸ_™_Ô.ØÙÜÐ1°$°Ð7[Ð\Ó]Ð]Ø‡{�{„}˜TŸ_™_Ô.Ü�‰�dÕà�‰�r3   Ú
skills_dirÚ
skill_namec                 óž   — t        j                  |«      }	 t        j                  || |¬«      S # t        $ r}t	        |› d�«      |‚d}~ww xY w)zPInstall a marketplace skill into a skills directory. Returns the installed path.)rz   z"
Re-run with --force to overwrite.N)r   Úget_marketplace_skillÚinstall_marketplace_skillÚFileExistsErrorr	   )rƒ   r„   rz   ÚskillÚexcs        r   Ú_install_tor‹   -  sT   € ä×)Ñ)¨*Ó5€EðMÜ×0Ñ0°¸
È%ÔPÐPøÜò MÜ˜#˜ÐAÐBÓCÈÐLûðMús   —/ ¯	A¸AÁAÚagent_skills_dirÚcentral_skill_pathc                 óè   — | j                  «       j                  «       } | j                  dd¬«       | |z  }t        ||«       |j	                  t
        j                  j                  || «      «       |S )zMCreate a relative symlink from agent directory to the central skill location.T)ÚparentsÚexist_ok)Ú
expanduserÚresolveÚmkdirr‚   Ú
symlink_toÚosry   Úrelpath)rŒ   r„   r�   rz   Ú	link_paths        r   Ú_create_symlinkr˜   6  sf   € à'×2Ñ2Ó4×<Ñ<Ó>ÐØ×Ñ 4°$ÐÔ7Ø  :Ñ-€Iä�Y Ô&Ø×ÑœŸ™Ÿ™Ð);Ð=MÓNÔOàÐr3   ÚclaudeÚglobal_Údestc                 ó   — |�.| s|rt        d«      ‚|j                  «       j                  «       gS |rt        nt        g}| r|j                  |rt        nt        «       |D �cg c]   }|j                  «       j                  «       ‘Œ" c}S c c}w )Nú4--dest cannot be combined with --claude or --global.)r	   r‘   r’   ÚCENTRAL_GLOBALÚCENTRAL_LOCALr,   ÚCLAUDE_GLOBALÚCLAUDE_LOCAL)r™   rš   r›   ÚrootsÚroots        r   Ú_resolve_update_rootsr¤   B  s{   € ð ÐÙ‘WÜÐQÓRÐRØ—‘Ó!×)Ñ)Ó+Ð,Ð,á+2�¼ÐF€EÙØ�‰¡g•]´<Ô@Ù49Ó:±E¨DˆD�O‰OÓ×%Ñ%Õ'°EÑ:Ð:ùÒ:s   Á#%BÚpreviewc                  ó*   — t        t        «       «       y)z0Print the generated `hf-cli` SKILL.md to stdout.N)Úprintrx   © r3   r   Úskills_previewr©   S  s   € ô 
Œ.Ó
Õr3   Úadd)zhf skills addz3hf skills add huggingface-gradio --dest=~/my-skillszhf skills add --globalzhf skills add --claudez2hf skills add huggingface-gradio --claude --global)ÚexamplesFr!   zMarketplace skill name.)r   Úshow_defaultz--claudezInstall for Claude.z--globalz-gzJInstall globally (user-level) instead of in the current project directory.z=Install into a custom destination (path to skills directory).z--forcez-Overwrite existing skills in the destination.c                 ó  — |�.|s|rt        d«      ‚t        || |«      }t        d| › d|› �«       y|rt        nt        }t        || |«      }t        d| › d|› �«       |r+|rt
        nt        }t        || ||«      }	t        d|	› �«       yy)a  Download a Hugging Face skill and install it for an AI assistant.

    Default location is in the current directory (.agents/skills) or user-level (~/.agents/skills).
    If `--claude` is specified, the skill is also symlinked into Claude's legacy skills directory.
    Nr�   zInstalled 'z' to z' to central location: zCreated symlink: )r	   r‹   r§   rž   rŸ   r    r¡   r˜   )
r!   r™   rš   r›   rz   Ú
skill_destÚcentral_pathr�   Úagent_targetr—   s
             r   Ú
skills_addr±   Y  s¦   € ðV ÐÙ‘WÜÐQÓRÐRÜ   t¨UÓ3ˆ
Ü�˜D˜6  z lÐ3Ô4Øñ &-•>´-€LÜ$ \°4¸Ó?ÐÜ	ˆK˜�vÐ4Ð5GÐ4HÐ
IÔJáÙ(/•}´\ˆÜ# L°$Ð8JÈEÓRˆ	ÜÐ! ) Ð-Õ.ð r3   Úupgrade)zhf skills upgradezhf skills upgrade hf-cliz7hf skills upgrade huggingface-gradio --dest=~/my-skillszhf skills upgrade --claudez)Optional installed skill name to upgrade.z$Upgrade skills installed for Claude.z=Use global skills directories instead of the current project.z,Upgrade skills in a custom skills directory.c                 ó   — t        |||¬«      }t        j                  || ¬«      }|st        d«       y|D ]F  }|j                  rd|j                  › d�nd}t        |j
                  › d|j                  › |› �«       ŒH y)	z2Upgrade installed Hugging Face marketplace skills.)r™   rš   r›   )ÚselectorzNo installed skills found.Nz (Ú)r"   z: )r¤   r   Úapply_updatesr§   Údetailr!   Ústatus)r!   r™   rš   r›   r¢   ÚresultsÚresultr·   s           r   Úskills_upgrader»   –  sv   € ô> "¨¸ÀtÔL€Eä×#Ñ# E°DÔ9€GÙÜÐ*Ô+ØãˆØ*0¯-ª-�2�f—m‘m�_ AÑ&¸RˆÜ�—‘�˜R §¡˜¨v¨hÐ7Õ8ñ r3   )r   N)NFFN)8Ú__doc__r•   r   Úpathlibr   Útypingr   ÚtyperÚclickr   r   r   Ú
typer.mainr   Úhuggingface_hub.errorsr	   r"   r   Ú
_cli_utilsr   ÚDEFAULT_SKILL_IDÚ_SKILL_DESCRIPTIONri   rn   rŸ   rž   r¡   r    rR   r^   r   rk   ÚstrÚ__annotations__Ú
skills_clir2   rh   Útupler?   rG   ÚsetrN   rY   r`   rx   Úboolr‚   r‹   r˜   r¤   Úcommandr©   ÚArgumentÚOptionr±   r»   r¨   r3   r   Ú<module>rÏ      s„  ðòó( 
Û Ý Ý ã ß )Ñ )Ý "å +å Ý %ð Ð ð2ð ð0ð "Ð"ð #ðÐ ð€ñ$ Ð%Ó&€ÙÐ(Ó)€ÙÐ$Ó%€ÙÐ'Ó(€ò TÐ à!�{Ð ð ^Øiñ/Ð ˜T # s (™^ó ñ
 Ð BÔC€
ð˜ð  Có ð" %ð ¨gð À4ÈÁ9ð ÐQUÐV[Ð\`ÐadÑ\eÐgnÐ\nÑVoÑQpó ð +˜wó +ð$ AEò ˜ð ¨c°#©h¸©oð ÈÈcÉó ð$Ø˜˜d 3™i¨Ð0Ñ1Ñ2ðà	ˆ#ˆu�S˜#�X‰Ð
Ñóð&	˜T #™Yð 	¨Wð 	¸ó 	ð>˜ó >ðB	˜4ð 	¨ð 	°ó 	ðM˜Dð M¨cð M¸$ð MÀ4ó Mð	 dð 	¸ð 	ÐQUð 	Ð^bð 	Ðgkó 	ð;àð;ð ð;ð �‰+ð	;ð
 
ˆ$�Zó;ð" ×Ñ�IÓòó ðð
 ×ÑØ	òð ó 	ð 	ØTYð 	ð 	ð 	ñ50/Ø
ØØˆ�‰Ð5ÀEÔJð	Lñð0/ð
 �d˜L˜EŸL™L¨Ð:OÔPÐPÑQð0/ð ØØˆ�‰ØØØ]ô	
ð	ñð0/ð Øˆt‰Øˆ�‰ØPô	
ð	ñð0/ð( ØØˆ�‰ØØ@ô	
ð	ñð)0/ð6 
ò70/ó	ð0/ðf ×ÑØòð ó ð 	Øejð 	ð 	ñ'9Ø
Øˆd‰
Øˆ�‰ÐGÐV[Ô\ð	^ñð9ð
 �d˜L˜EŸL™L¨Ð:`ÔaÐaÑbð9ð ØØˆ�‰ØØØPô	
ð	ñð9ð Øˆt‰Øˆ�‰Ø?ô	
ð	ñð9ð( 
ò)9óñ9r3   