Parallelize repository cloning during dev environment setup#72
Open
Parallelize repository cloning during dev environment setup#72
Conversation
1 task
Agent-Logs-Url: https://github.com/wp-cli/wp-cli-dev/sessions/6509f703-3861-4c87-83a6-f0247ed1904b Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement parallel repository cloning during development setup
Parallelize repository cloning during dev environment setup
Apr 9, 2026
thelovekesh
reviewed
Apr 9, 2026
Agent-Logs-Url: https://github.com/wp-cli/wp-cli-dev/sessions/28119b52-0b7a-445b-b43e-f3189c004e28 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR speeds up initial wp-cli-dev environment setup by replacing the previous PHP-based cloning workflow with Bash scripts that clone and refresh repositories in parallel, and wires the new script into Composer’s pre-install/update hooks.
Changes:
- Replace
.maintenance/clone-all-repositories.php/.maintenance/clone-repository.phpwith Bash equivalents. - Parallelize cloning and refreshing using
xargs -Pwith detected CPU core count. - Update
composer.jsonhooks to run the new Bash entrypoint.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| composer.json | Switch Composer pre-install/update to call the new Bash orchestrator. |
| .maintenance/clone-all-repositories.sh | New orchestration script: fetch org repos, filter/map, then parallel clone + refresh. |
| .maintenance/clone-repository.sh | New helper script to clone a single repo given destination + URL. |
| .maintenance/clone-all-repositories.php | Removed old PHP orchestrator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@copilot apply changes based on the comments in this thread |
…n, cap cores to 8 with env override, drop redundant -n1, exact arg count in clone helper Agent-Logs-Url: https://github.com/wp-cli/wp-cli-dev/sessions/aab74529-eccb-4e94-949e-b1062afb30b2 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Author
Done in a7630d5. Applied all suggestions from the review thread:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sequential
git clonecalls duringcomposer install/composer updatemade initial dev environment setup unnecessarily slow. The refresh step already usedxargsfor parallelism; cloning did not.Changes
.maintenance/clone-all-repositories.sh: Bash script that orchestrates the full clone + refresh flow. Checks thatjqis available at startup with a clear error message. Detects CPU cores vianproc(Linux) orsysctl -n hw.logicalcpu(macOS), defaulting to 4 if neither is available, and caps parallelism at 8 to avoid saturating GitHub connections or IO. The cap can be overridden via theCLONE_JOBSorWPCLI_DEV_JOBSenvironment variables. Fetches the repository list from the GitHub API usingcurl -fsS(failing fast on HTTP errors), validates the response is a JSON array (with distinct messages for rate-limit errors vs. unexpected shapes), parses withjq, filters the skip list, applies the destination map, then clones missing repos and refreshes all repos in parallel usingxargs -P$CORES..maintenance/clone-repository.sh: Bash helper that clones a single repository, accepting exactly<destination>and<clone_url>as arguments (rejects anything other than exactly 2 args)..maintenance/clone-all-repositories.phpand.maintenance/clone-repository.php.composer.json:pre-install-cmdandpre-update-cmdnow callbash .maintenance/clone-all-repositories.sh.