@debugg-ai/debugg-ai-mcp 1.0.44 → 1.0.45
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/dist/services/index.js +13 -9
- package/package.json +1 -1
package/dist/services/index.js
CHANGED
|
@@ -47,26 +47,30 @@ export class DebuggAIServerClient {
|
|
|
47
47
|
this.tunnels = createTunnelsService(this.tx);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Look up a project by repo name.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* Look up a project by repo name.
|
|
51
|
+
* Accepts "owner/repo" or bare "repo" — searches with the short name
|
|
52
|
+
* (more likely to match project names) then ranks results by match quality.
|
|
53
53
|
*/
|
|
54
54
|
async findProjectByRepoName(repoName) {
|
|
55
55
|
if (!this.tx)
|
|
56
56
|
throw new Error('Client not initialized — call init() first');
|
|
57
|
-
|
|
57
|
+
// "debugg-ai/react-web-app" → short = "react-web-app"
|
|
58
|
+
const short = repoName.includes('/') ? repoName.split('/').pop() : repoName;
|
|
59
|
+
const response = await this.tx.get('api/v1/projects/', { search: short });
|
|
58
60
|
const projects = response?.results ?? [];
|
|
59
61
|
if (projects.length === 0)
|
|
60
62
|
return null;
|
|
61
|
-
// Exact match on
|
|
62
|
-
const exact = projects.find(p => p.name === repoName || p.
|
|
63
|
+
// Exact match on full "owner/repo" or short name against project name/slug
|
|
64
|
+
const exact = projects.find(p => p.name === repoName || p.name === short
|
|
65
|
+
|| p.slug === repoName || p.slug === short);
|
|
63
66
|
if (exact)
|
|
64
67
|
return exact;
|
|
65
|
-
// Match on repo.name
|
|
66
|
-
const repoMatch = projects.find(p => p.repo?.name === repoName || p.repo?.name
|
|
68
|
+
// Match on repo.name — backend may store "owner/repo" or just "repo"
|
|
69
|
+
const repoMatch = projects.find(p => p.repo?.name === repoName || p.repo?.name === short
|
|
70
|
+
|| p.repo?.name?.endsWith(`/${short}`));
|
|
67
71
|
if (repoMatch)
|
|
68
72
|
return repoMatch;
|
|
69
|
-
// Fallback to first result
|
|
73
|
+
// Fallback to first search result
|
|
70
74
|
return projects[0];
|
|
71
75
|
}
|
|
72
76
|
/**
|