ó
    ŸUAjÕ  ã                  óœ   • S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  \" S5      rS	rS
rSS jrSS jrSS jr\4SS jjrSS jrg)zöRead-only Git repository discovery.

For every repository found we collect only non-sensitive metadata. Remote URLs
are sanitized to strip any embedded credentials/tokens. We never read git
config secrets, stored credentials, or commit contents.
é    )ÚannotationsN)ÚPath)ÚAny)Úrun_readonly)Ú
get_loggerzdiscovery.git)z/var/wwwz/srvz/homez/opté   c                ó^   • U (       d  g[         R                  " SSU R                  5       5      $ )z·Strip credentials from a remote URL.

https://user:token@github.com/x/y.git -> https://github.com/x/y.git
Leaves SSH-style remotes (git@host:repo) untouched, as they carry no secret.
Nz(https?://)[^/@]*@z\1)ÚreÚsubÚstrip)Úurls    Ú7D:\Programs\laragon\www\wolf\agent\src\discovery\git.pyÚsanitize_remoter      s$   € ö Øä�6Š6Ð'¨°·	±	³Ó<Ð<ó    c                óf   • [        SS[        U 5      /UQ5      nU(       a  UR                  5       $ S $ )NÚgitz-C)r   Ústrr   )ÚrepoÚargsÚoutputs      r   Ú_gitr   $   s/   € Ü˜5 $¬¨D«	Ð9°DÐ9Ó:€FÞ#ˆ6�<‰<‹>Ð-¨Ð-r   c           	     óâ   • U R                   n[        U/ SQ5      n[        USS/5      n[        U5      [        U5      [        U/ SQ5      [        U/ SQ5      [        U/ SQ5      [	        U5      S.$ )z:Collect the allow-listed metadata for a single repository.)Úconfigz--getzremote.origin.urlÚstatusz--porcelain)z	rev-parsez--abbrev-refÚHEAD)Úlogú-1z--format=%H)r   r   z--format=%cI)ÚpathÚ
remote_urlÚcurrent_branchÚlast_commit_hashÚlast_commit_dateÚdirty_state)Úparentr   r   r   Úbool)Úrepo_dirr   Úremoter   s       r   Úinspect_repor(   )   sj   € à�?‰?€DÜ�$Ò@ÓA€FÜ�$˜ =Ð1Ó2€Fä�D“	Ü% fÓ-Ü˜tÒ%JÓKÜ  Ò'CÓDÜ  Ò'DÓEÜ˜F“|ñð r   c                ó�  • / n[        5       nU  H…  n[        U5      nUR                  5       (       d  M%  [        US[        5       HK  n[        UR                  5      nXb;   a  M  UR                  U5         UR                  [        U5      5        MM     M‡     U$ ! [         a!  n[        R                  SXW5         SnAM{  SnAff = f)z;Find .git directories under the scan roots (bounded depth).z.gitzfailed to inspect %s: %sN)Úsetr   Úis_dirÚ_bounded_globÚ
_MAX_DEPTHr   r$   ÚaddÚappendr(   ÚOSErrorr   Údebug)ÚrootsÚreposÚseenÚrootÚbaseÚgit_dirÚkeyÚexcs           r   Úfind_repositoriesr:   8   s§   € à"$€EÜ“U€DÛˆÜ�D‹zˆØ�{‰{�}‰}ÙÜ$ T¨6´:Ö>ˆGÜ�g—n‘nÓ%ˆCØ‹{ÙØ�H‰H�SŒMðDØ—‘œ\¨'Ó2Ö3ó ?ñ	 ð €Løô ó DÜ—	‘	Ð4°g×CÒCûðDús   Á6BÂ
CÂ$C Ã Cc              #  óÔ   #   • [        US-   5       H?  nU(       a  SR                  S/U-  U/-   5      OUn U R                  U5       Sh  v•N   MA     g N	! [         a     MS  f = f7f)z;Yield paths named `name` up to max_depth levels below base.é   Ú/Ú*N)ÚrangeÚjoinÚglobr0   )r6   ÚnameÚ	max_depthÚdepthÚpatterns        r   r,   r,   L   sd   é € ä�y 1‘}Ö%ˆÞ6;�#—(‘(˜C˜5 5™=¨D¨6Ñ1Ô2Àˆð	Ø—y‘y Ó)×)Ò)ò &ñ *øÜó 	Úð	üs:   ‚4A(·AÁAÁAÁA(ÁAÁ
A%Á!A(Á$A%Á%A()r   ú
str | NoneÚreturnrF   )r   r   r   z	list[str]rG   rF   )r&   r   rG   zdict[str, Any])r2   ztuple[str, ...]rG   zlist[dict[str, Any]])r6   r   rB   r   rC   Úint)Ú__doc__Ú
__future__r   r
   Úpathlibr   Útypingr   Údiscovery.systemr   Úloggerr   r   Ú_SCAN_ROOTSr-   r   r   r(   r:   r,   © r   r   Ú<module>rQ      sR   ðñõ #ã 	Ý Ý å )Ý á�Ó!€ð 4€Ø€
ô	=ô.ô
ð 0;ö õ(r   