Skip to content

[Blueprints] Share Git repository URL detection logic - #3858

Merged
adamziel merged 1 commit into
trunkfrom
add/shared-git-repo-url-helper
Jul 1, 2026
Merged

[Blueprints] Share Git repository URL detection logic#3858
adamziel merged 1 commit into
trunkfrom
add/shared-git-repo-url-helper

Conversation

@adamziel

@adamziel adamziel commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What it does

Moves the Blueprint v1 plugin URL heuristic into a shared internal helper: seemsLikeGitRepoUrl().

The v1 compiler still treats these as Git repositories:

https://example.com/project.git
https://github.com/owner/repo
https://gitlab.com/group/subgroup/project

Rationale

Blueprint v2 compilation also needs to distinguish Git repository URLs from direct download URLs and WordPress.org slugs.

Keeping the heuristic inside v1/compile.ts would force the v2 compiler to duplicate it or reach into v1 internals. This PR makes the logic reusable without changing v1 behavior.

Implementation

Adds src/lib/is-git-repo-url.ts and updates v1/compile.ts to call seemsLikeGitRepoUrl().

The helper intentionally keeps the existing allowlist-style behavior. It is not a general Git remote parser.

Testing instructions

npm run format:uncommitted
npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/is-git-repo-url.spec.ts
npm exec nx run playground-blueprints:lint
npm exec nx run playground-blueprints:typecheck
git diff --check

Part of #2592.

@adamziel
adamziel marked this pull request as ready for review July 1, 2026 22:11
@adamziel
adamziel requested review from a team, brandonpayton and Copilot July 1, 2026 22:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Extracts the Blueprint v1 Git repository URL heuristic into a shared helper (seemsLikeGitRepoUrl) so it can be reused by Blueprint v2 without changing v1 behavior.

Changes:

  • Added a shared seemsLikeGitRepoUrl() helper under src/lib/
  • Updated the v1 compiler to use the shared helper (and removed the inline implementation)
  • Added unit tests covering accepted/rejected URL shapes and normalization

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/playground/blueprints/src/lib/is-git-repo-url.ts Introduces shared allowlist-style Git repo URL heuristic used by compilers
packages/playground/blueprints/src/lib/v1/compile.ts Switches v1 compilation logic to call the shared helper and removes the local function
packages/playground/blueprints/src/tests/is-git-repo-url.spec.ts Adds test coverage for the new shared helper and its normalization behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/blueprints/src/lib/is-git-repo-url.ts
Comment thread packages/playground/blueprints/src/tests/is-git-repo-url.spec.ts
@adamziel
adamziel force-pushed the add/shared-git-repo-url-helper branch from e7d860c to dd24323 Compare July 1, 2026 22:13
@adamziel adamziel changed the title [Blueprints] Share Git repository URL detection Jul 1, 2026
@adamziel
adamziel merged commit b9aaea5 into trunk Jul 1, 2026
52 of 53 checks passed
@adamziel
adamziel deleted the add/shared-git-repo-url-helper branch July 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment