@codacy/codacy-mcp 0.6.1 → 0.6.3

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.
@@ -19,7 +19,7 @@ const execAsync = (command, options) => {
19
19
  reject(error);
20
20
  return;
21
21
  }
22
- if (stderr && (!stdout || /error|fail|exception/i.test(stderr))) {
22
+ if (stderr && !stdout) {
23
23
  reject(new Error(stderr));
24
24
  return;
25
25
  }
@@ -1,20 +1,30 @@
1
1
  import { AccountService, OrganizationService, RepositoryService } from '../api/client/index.js';
2
+ const ORGANIZATIONS_ITERATION_LIMIT = 5;
2
3
  const findOrganization = async (provider, organization, cursor) => {
3
4
  try {
4
- const { data: orgs, pagination } = await AccountService.listOrganizations(provider, cursor, 100);
5
- const existingOrg = orgs.find(org => org.name === organization && org.provider === provider);
6
- if (!existingOrg) {
7
- if (pagination?.cursor === null) {
5
+ let currentCursor = cursor;
6
+ let hasMore = true;
7
+ let iteration = 0;
8
+ while (hasMore && iteration < ORGANIZATIONS_ITERATION_LIMIT) {
9
+ const { data: orgs, pagination } = await AccountService.listOrganizations(provider, currentCursor, 100);
10
+ const existingOrg = orgs.find(org => org.name === organization && org.provider === provider);
11
+ if (existingOrg) {
8
12
  return {
9
- success: false,
10
- message: 'Organization not found',
13
+ success: true,
14
+ organization: existingOrg,
11
15
  };
12
16
  }
13
- return findOrganization(provider, organization, pagination?.cursor);
17
+ if (!pagination?.cursor) {
18
+ hasMore = false;
19
+ }
20
+ else {
21
+ currentCursor = pagination.cursor;
22
+ }
23
+ iteration++;
14
24
  }
15
25
  return {
16
- success: true,
17
- organization: existingOrg,
26
+ success: false,
27
+ message: 'Organization not found',
18
28
  };
19
29
  }
20
30
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/codacy-mcp",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Codacy MCP server",
5
5
  "license": "MIT",
6
6
  "author": "Codacy",