@@ -193,24 +193,41 @@ async def github_org(
193193 ):
194194 await interaction .response .defer (ephemeral = True )
195195 exts_list = _split_list (exts ) or settings .ingest_exts
196- await interaction .followup .send ("Building manifest (GitHub org)…" , ephemeral = True )
197- source : object = GitHubOrgSource (org = org , visibility = visibility , include_archived = include_archived , topics = _split_list (topics ), exts = exts_list , branch = branch )
198- if chunk_size :
199- source = ChunkingSource (source = source , chunk_size = chunk_size or 0 , overlap = chunk_overlap or 200 ) # type: ignore[arg-type]
200- manifest = await __import__ ("asyncio" ).to_thread (build_manifest , source ) # type: ignore[arg-type]
201- store = self ._artifact_store ()
202- key = store .put_manifest (manifest )
203- payload = {"artifact_key" : key }
204- if force :
205- payload ["force" ] = True
206- job_id = await self .bot .services .job_repo_factory .get ("ingest" ).enqueue ("ingest" , payload ) # type: ignore[attr-defined]
207- try :
208- jobs_enqueued_total .labels (type = "ingest" ).inc ()
209- except Exception :
210- pass
211- msg = await interaction .channel .send (f"Job #{ job_id } : queued (github org { org } , manifest={ key } )" ) # type: ignore[union-attr]
212- await interaction .followup .send (f"Queued job #{ job_id } for org { org } " , ephemeral = True )
213- self .bot .loop .create_task (self ._watch_job (msg , job_id ))
196+ await interaction .followup .send ("Listing organization repositories…" , ephemeral = True )
197+ src_org = GitHubOrgSource (org = org , visibility = visibility , include_archived = include_archived , topics = _split_list (topics ), exts = exts_list , branch = branch )
198+ urls = src_org ._list_repo_urls ()
199+ if not urls :
200+ await interaction .followup .send ("(no repositories found)" , ephemeral = True )
201+ return
202+ # Enqueue one job per repo, prefer local clone to avoid API limits
203+ enq = self .bot .services .job_repo_factory .get ("ingest" ).enqueue # type: ignore[attr-defined]
204+ job_ids : list [int ] = []
205+ for u in urls :
206+ cfg = {
207+ "sources" : [
208+ {
209+ "type" : "github_repo_local" ,
210+ "repo" : u ,
211+ ** ({"branch" : branch } if branch else {}),
212+ ** ({"exts" : exts_list } if exts_list else {}),
213+ "shallow" : True ,
214+ "fetch_depth" : 50 ,
215+ }
216+ ]
217+ }
218+ if chunk_size :
219+ cfg ["chunk_size" ] = int (chunk_size )
220+ cfg ["chunk_overlap" ] = int (chunk_overlap or 200 )
221+ if force :
222+ cfg ["force" ] = True
223+ jid = await enq ("ingest" , cfg )
224+ try :
225+ jobs_enqueued_total .labels (type = "ingest" ).inc ()
226+ except Exception :
227+ pass
228+ job_ids .append (int (jid ))
229+ msg = await interaction .channel .send (f"Queued { len (job_ids )} jobs for org { org } " ) # type: ignore[union-attr]
230+ await interaction .followup .send (f"Queued { len (job_ids )} repos from { org } " , ephemeral = True )
214231
215232 @local .command (name = "dir" , description = "Queue a local directory for indexing" )
216233 @require_admin ()
0 commit comments