deepdebug-local-agent 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepdebug-local-agent",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "DeepDebug Local Agent - AI-powered code debugging assistant",
5
5
  "private": false,
6
6
  "type": "module",
@@ -780,7 +780,6 @@ export class GitHubProvider extends BaseGitProvider {
780
780
  // - git@github.com:owner/repo.git
781
781
 
782
782
  let match = url.match(/github\.com[/:]([\w-]+)\/([\w-]+?)(?:\.git)?$/);
783
-
784
783
  if (match) {
785
784
  return {
786
785
  owner: match[1],
@@ -792,4 +791,4 @@ export class GitHubProvider extends BaseGitProvider {
792
791
  }
793
792
  }
794
793
 
795
- export default GitHubProvider;
794
+ export default GitHubProvider
package/src/server.js CHANGED
@@ -741,9 +741,24 @@ app.post("/workspace/open", async (req, res) => {
741
741
  await fsPromises.mkdir(cacheDir, { recursive: true });
742
742
 
743
743
  // Build authenticated URL
744
- const authUrl = token
745
- ? repoUrl.replace('https://', `https://x-access-token:${token}@`)
746
- : repoUrl;
744
+ // Token formats:
745
+ // GitHub: TOKEN (uses x-access-token:TOKEN@)
746
+ // Bitbucket: x-token-auth:TOKEN or username:appPassword
747
+ // GitLab: oauth2:TOKEN
748
+ let authUrl;
749
+ if (token) {
750
+ // Strip any existing username@ from URL first
751
+ let cleanUrl = repoUrl.replace(/https:\/\/[^@]+@/, 'https://');
752
+ if (token.includes(':')) {
753
+ // Already in user:pass format (Bitbucket/GitLab)
754
+ authUrl = cleanUrl.replace('https://', `https://${token}@`);
755
+ } else {
756
+ // Plain token — GitHub style
757
+ authUrl = cleanUrl.replace('https://', `https://x-access-token:${token}@`);
758
+ }
759
+ } else {
760
+ authUrl = repoUrl;
761
+ }
747
762
 
748
763
  const gitDir = path.join(clonePath, '.git');
749
764
  const alreadyCloned = await exists(gitDir);
@@ -4612,14 +4627,32 @@ app.post("/workspace/git/create-fix-branch", async (req, res) => {
4612
4627
  .replace(/\.git$/, '');
4613
4628
  const [workspace, repoSlug] = repoPath.split('/');
4614
4629
 
4615
- // gitToken é "username:appPassword" — codificar para Basic Auth
4616
- const credentials = Buffer.from(gitToken).toString('base64');
4630
+ // gitToken may be:
4631
+ // - "x-token-auth:TOKEN" (Repository Access Token from Gateway)
4632
+ // - "username:appPassword" (App Password)
4633
+ // - plain TOKEN (Repository Access Token)
4634
+ let authHeader;
4635
+ if (gitToken.includes(':')) {
4636
+ // Contains colon — could be user:pass (App Password) or x-token-auth:token
4637
+ const [user, pass] = gitToken.split(':', 2);
4638
+ if (user === 'x-token-auth') {
4639
+ // Repository Access Token — use Bearer with the token part
4640
+ authHeader = `Bearer ${pass}`;
4641
+ } else {
4642
+ // App Password — use Basic auth
4643
+ const credentials = Buffer.from(gitToken).toString('base64');
4644
+ authHeader = `Basic ${credentials}`;
4645
+ }
4646
+ } else {
4647
+ // Plain token — use Bearer (Repository Access Token)
4648
+ authHeader = `Bearer ${gitToken}`;
4649
+ }
4617
4650
 
4618
4651
  const response = await fetch(
4619
4652
  `https://api.bitbucket.org/2.0/repositories/${workspace}/${repoSlug}/pullrequests`, {
4620
4653
  method: 'POST',
4621
4654
  headers: {
4622
- 'Authorization': `Basic ${credentials}`,
4655
+ 'Authorization': authHeader,
4623
4656
  'Content-Type': 'application/json'
4624
4657
  },
4625
4658
  body: JSON.stringify({