@intecoag/inteco-cli 1.7.0 → 1.7.1

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": "@intecoag/inteco-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "CLI-Tools for Inteco",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -122,13 +122,13 @@ async function githubSecurityAdvisories() {
122
122
  console.log();
123
123
  spinner.fail('Error checking security advisories');
124
124
 
125
- if (error.message.includes('Organization')) {
126
- console.error(chalk.red(`✗ ${error.message}`));
127
- } else if (error.message.includes('authentication')) {
125
+ if (error.message.startsWith('401')) {
128
126
  console.error(chalk.red(`✗ ${error.message}`));
129
127
  console.log(chalk.yellow('\nAuthentication setup:'));
130
128
  console.log(chalk.gray(' Option 1: Install GitHub CLI and run: gh auth login'));
131
129
  console.log(chalk.gray(' Option 2: Set GITHUB_TOKEN environment variable'));
130
+ } else if (error.message.startsWith('404')) {
131
+ console.error(chalk.red(`✗ ${error.message} - Organization or repository not found`));
132
132
  } else {
133
133
  console.error(chalk.red(`Error: ${error.message}`));
134
134
  }
@@ -150,7 +150,9 @@ async function fetchSecurityAdvisories(organization, repository, token) {
150
150
  return openAlerts;
151
151
  } catch (error) {
152
152
  // If the endpoint is not available or the repo is not accessible, return empty array
153
- if (error.message.includes('404') || error.message.includes('403')) {
153
+ // 404: Resource not found (Dependabot disabled)
154
+ // 403: Access forbidden (Dependabot disabled or insufficient permissions)
155
+ if (error.message.startsWith('404') || error.message.startsWith('403')) {
154
156
  return [];
155
157
  }
156
158
  throw error;
@@ -56,12 +56,15 @@ export async function fetchGithubAPI(url, token) {
56
56
 
57
57
  if (!res.ok) {
58
58
  if (res.status === 404) {
59
- throw new Error('Resource not found (404)');
59
+ throw new Error(`404: Resource not found`);
60
60
  }
61
- if (res.status === 401 || res.status === 403) {
62
- throw new Error('GitHub authentication failed. Please ensure your authentication is valid (run "gh auth login" or check GITHUB_TOKEN)');
61
+ if (res.status === 401) {
62
+ throw new Error('401: GitHub authentication failed');
63
63
  }
64
- throw new Error(`GitHub API request failed: ${res.statusText}`);
64
+ if (res.status === 403) {
65
+ throw new Error('403: Access forbidden (Dependabot alerts may not be enabled)');
66
+ }
67
+ throw new Error(`${res.status}: GitHub API request failed: ${res.statusText}`);
65
68
  }
66
69
 
67
70
  return res;