Skip to content

Implement support for Azure DevOps Server and GitHub Server (onpremise)#71

Draft
Copilot wants to merge 16 commits into
masterfrom
copilot/fix-70
Draft

Implement support for Azure DevOps Server and GitHub Server (onpremise)#71
Copilot wants to merge 16 commits into
masterfrom
copilot/fix-70

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 15, 2025

Adds support for self-hosted Azure DevOps Server and GitHub Server (onpremise) by detecting the organization/project and owner/repo from custom remote hostnames.

Changes Made

  • azd.ts: getAzureDevOpsHostname() returns the raw hostname; escaping is applied with escapeStringRegexp only at the regex construction sites (fixing the previous double-escaping and the always-false SSH hostname comparison).
  • azd.ts: The SSH remote URL pattern is now matched before the HTTPS pattern. Because the SSH host (ssh.{hostname}) contains the HTTPS hostname as a substring, matching HTTPS first incorrectly captured the v3 segment as the organization for git@ssh.{hostname}:v3/org/project URLs.
  • gitHub.ts: Uses escapeStringRegexp for consistent, complete escaping of all regex special characters in hostnames (replacing manual .replace(...) escaping).
  • docs/regex-test.js: Demo script updated to use a single correct regex-escape helper and SSH-first matching.
  • Dependencies: escape-string-regexp is pinned to ^4.0.0 (CommonJS) so the tsc build succeeds — the previously used v5 is ESM-only and broke compilation (TS1479); esbuild was moved to devDependencies.

Merge conflict resolution

  • Merged origin/master into the branch, keeping master's newer dependency versions in package.json/package-lock.json.
  • Repaired azDevOpsPullrequestFunctions.ts, which the merge had mangled by injecting a stray local getAzureDevOpsConnection definition into the middle of StateMultipleAzDPrsInStream.

Testing

  • npm run compile (tsc) passes
  • npm run lint passes
  • docs/regex-test.js demo confirms HTTPS and SSH remote URLs resolve the correct org/project and owner/repo for both default and custom hostnames

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits July 15, 2025 20:54
…Server

Co-authored-by: norschel <12895005+norschel@users.noreply.github.com>
Co-authored-by: norschel <12895005+norschel@users.noreply.github.com>
Co-authored-by: norschel <12895005+norschel@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement support for Azure DevOps Server or GitHub Server (both onpremise) Implement support for Azure DevOps Server and GitHub Server (onpremise) Jul 15, 2025
Copilot AI requested a review from norschel July 15, 2025 21:00
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/github/gitHub.ts Fixed
norschel and others added 4 commits July 16, 2025 09:32
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ession for hostnames

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
norschel and others added 3 commits July 16, 2025 09:46
…ssion for hostnames

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ession for hostnames

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread src/azd/azd.ts Fixed
Comment thread src/azd/azd.ts Fixed
norschel and others added 2 commits July 16, 2025 23:54
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ssion for hostnames

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
Comment thread docs/regex-test.js Fixed
@norschel
Copy link
Copy Markdown
Contributor

norschel commented Mar 7, 2026

@copilot verify the implementation again with a newer and better modal

Co-authored-by: norschel <12895005+norschel@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 7, 2026

@copilot verify the implementation again with a newer and better modal

Re-verified the implementation and found two bugs that have been fixed in commit 183694c:

  1. Double-escaping / wrong comparison in azd.ts: getAzureDevOpsHostname() was returning the regex-escaped hostname (e.g. "dev\.azure\.com"), but the SSH pattern fallback compared it against the plain string "dev.azure.com" — always false. The escaped value was also passed to escapeStringRegexp() again, causing double-escaping. Fixed by returning the raw hostname from getAzureDevOpsHostname() and escaping only at the regex construction sites.

  2. Incomplete regex escaping in gitHub.ts: Was using a manual .replace(/[\\.]/g, '\\$&') which only escapes dots and backslashes. Replaced with escapeStringRegexp (already used in azd.ts) for complete and correct escaping of all regex special characters in hostnames.

@norschel
Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request. check again the code and make improvements if needed

# Conflicts:
#	package-lock.json
#	package.json

Co-authored-by: norschel <12895005+norschel@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot resolve the merge conflicts in this pull request. check again the code and make improvements if needed

Merge conflicts resolved in e25c28b (merged origin/master). While doing so I found and fixed several issues:

  • package.json / package-lock.json: kept master's newer dependency versions and added the regex-escaping dependency. escape-string-regexp is pinned to ^4.0.0 because v5 is ESM-only and broke tsc (TS1479); esbuild moved to devDependencies.
  • azDevOpsPullrequestFunctions.ts: the merge had silently mangled StateMultipleAzDPrsInStream by injecting a stray local getAzureDevOpsConnection definition into its body; repaired it.
  • SSH parsing in azd.ts: the HTTPS pattern was matched before the SSH one, so git@ssh.{host}:v3/org/project URLs incorrectly captured v3 as the organization. SSH is now tried first.
  • Updated the docs/regex-test.js demo to use correct single-pass escaping and SSH-first matching.

npm run compile and npm run lint both pass. The remaining CodeQL alert is in src-tests/authenticationTest.ts, which is a pre-existing test file from master unrelated to these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants