bdy 1.25.28-stage → 1.25.29-beta

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.25.28-stage",
4
+ "version": "1.25.29-beta",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",
@@ -427,13 +427,18 @@ class Agent extends events_1.default {
427
427
  },
428
428
  }));
429
429
  }
430
- else if (tunnel.hasChanged(data)) {
431
- tunnel.recreate(data);
430
+ else {
431
+ if (tunnel.hasChanged(data))
432
+ tunnel.recreate(data);
433
+ // retries a tunnel whose start() failed - a no-op for one already started
434
+ if (this.canStartTunnel(tunnel))
435
+ tunnel.start();
432
436
  }
433
437
  });
434
438
  }
435
- catch {
436
- // do nothing
439
+ catch (err) {
440
+ logger_1.default.error(texts_1.LOG_ERROR_WHILE_REFRESHING_TUNNELS);
441
+ logger_1.default.error(err);
437
442
  }
438
443
  this.tunnelsUpdating = false;
439
444
  if (!this.service && hasTunnels && !this.tunnels.length) {
@@ -835,8 +835,10 @@ class AgentManagerClass {
835
835
  catch {
836
836
  // save from param
837
837
  }
838
- if (!this.sshHostKey) {
839
- const { createSshHostKey } = require('../sshKeygen');
838
+ const { createSshHostKey, isSshHostKeyValid } = require('../sshKeygen');
839
+ if (!isSshHostKeyValid(this.sshHostKey)) {
840
+ if (this.sshHostKey)
841
+ logger_1.default.error(texts_1.LOG_AGENT_SSH_HOST_KEY_INVALID);
840
842
  this.sshHostKey = createSshHostKey();
841
843
  }
842
844
  try {
@@ -1348,13 +1348,40 @@ class ApiClient {
1348
1348
  parseResponseBody: true,
1349
1349
  });
1350
1350
  }
1351
- async getIntegrations(workspace) {
1351
+ // Exact-scope like targets: no filter lists the workspace integrations only
1352
+ async getIntegrations(workspace, project, environmentId) {
1353
+ const query = {};
1354
+ if (project)
1355
+ query.project_name = project;
1356
+ if (environmentId)
1357
+ query.environment_id = environmentId;
1352
1358
  return await this.request({
1353
1359
  method: 'GET',
1354
1360
  path: `/workspaces/${encodeURIComponent(workspace)}/integrations`,
1361
+ query,
1362
+ parseResponseBody: true,
1363
+ });
1364
+ }
1365
+ async getIntegration(workspace, hashId) {
1366
+ return await this.request({
1367
+ method: 'GET',
1368
+ path: `/workspaces/${encodeURIComponent(workspace)}/integrations/${encodeURIComponent(hashId)}`,
1355
1369
  parseResponseBody: true,
1356
1370
  });
1357
1371
  }
1372
+ async deleteIntegration(workspace, hashId) {
1373
+ return await this.request({
1374
+ method: 'DELETE',
1375
+ path: `/workspaces/${encodeURIComponent(workspace)}/integrations/${encodeURIComponent(hashId)}`,
1376
+ parseResponseBody: false,
1377
+ });
1378
+ }
1379
+ async getIntegrationByIdentifier(workspace, identifier, line = {}) {
1380
+ return await this.getResourceByIdentifier(workspace, {
1381
+ integration: identifier,
1382
+ ...line,
1383
+ });
1384
+ }
1358
1385
  async deleteProject(workspace, project) {
1359
1386
  return await this.request({
1360
1387
  method: 'DELETE',
@@ -27,6 +27,7 @@ const domain_1 = __importDefault(require("./command/domain"));
27
27
  const distro_1 = __importDefault(require("./command/distro"));
28
28
  const target_1 = __importDefault(require("./command/target"));
29
29
  const environment_1 = __importDefault(require("./command/environment"));
30
+ const integration_1 = __importDefault(require("./command/integration"));
30
31
  const register_1 = __importDefault(require("./command/register"));
31
32
  const mcp_1 = __importDefault(require("./command/mcp"));
32
33
  const discover_1 = __importDefault(require("./command/discover"));
@@ -66,6 +67,7 @@ function cliIndex() {
66
67
  program.addCommand(distro_1.default);
67
68
  program.addCommand(target_1.default);
68
69
  program.addCommand(environment_1.default);
70
+ program.addCommand(integration_1.default);
69
71
  program.addCommand(login_1.default);
70
72
  program.addCommand(register_1.default);
71
73
  program.addCommand(whoami_1.default);
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../utils");
7
+ const texts_1 = require("../../texts");
8
+ const distro_1 = require("../../types/distro");
9
+ const output_1 = __importDefault(require("../../output"));
10
+ const input_1 = __importDefault(require("../../input"));
11
+ const cliError_1 = __importDefault(require("../../cliError"));
12
+ const catalog_1 = require("./catalog");
13
+ // Integrations hold credentials (tokens, keys, OAuth), so the CLI never takes
14
+ // them: it points at the app's add form for the scope instead.
15
+ // The app's origin comes from the html_url of the integration list in that
16
+ // scope: the API knows its frontend, while guessing it from the API host
17
+ // (getAppUrl) falls back to the API host itself for unknown instances.
18
+ const commandIntegrationAdd = (0, utils_1.newCommand)('add', texts_1.DESC_COMMAND_INTEGRATION_ADD, {
19
+ requiredScopes: [utils_1.REST_API_SCOPE.INTEGRATION_READ],
20
+ examples: texts_1.EXAMPLE_INTEGRATION_ADD,
21
+ });
22
+ commandIntegrationAdd.alias('create');
23
+ (0, utils_1.sandboxScopeOptions)(commandIntegrationAdd, false);
24
+ commandIntegrationAdd.option('--format <text|json>', texts_1.OPTION_FORMAT);
25
+ commandIntegrationAdd.argument('[type]', texts_1.OPTION_INTEGRATION_TYPE);
26
+ commandIntegrationAdd.action(async (type, options) => {
27
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
28
+ if (type) {
29
+ type = type.toUpperCase();
30
+ if (!catalog_1.INTEGRATION_TYPES.includes(type)) {
31
+ throw new cliError_1.default('usage_error', (0, texts_1.ERR_INTEGRATION_TYPE)(type), texts_1.HINT_INTEGRATION_TYPE);
32
+ }
33
+ }
34
+ const client = input_1.default.restApiTokenClient();
35
+ const { scope, project, environmentId } = await input_1.default.sandboxScope(client, workspace, options);
36
+ let path = `/${encodeURIComponent(workspace)}`;
37
+ if (environmentId) {
38
+ // the resolved environment may be a workspace one even with a project
39
+ // (read fallback), so its own project decides the page
40
+ const environment = await client.getEnvironment(workspace, environmentId);
41
+ path += environment.project?.name
42
+ ? `/${encodeURIComponent(environment.project.name)}`
43
+ : '/-';
44
+ path += `/environments/environment/${encodeURIComponent(environmentId)}/integrations`;
45
+ }
46
+ else if (scope === distro_1.SCOPE.PROJECT) {
47
+ path += `/${encodeURIComponent(project)}/integrations`;
48
+ }
49
+ else {
50
+ path += '/-/workspace/integrations';
51
+ }
52
+ path += '/add';
53
+ if (type)
54
+ path += `/${type}`;
55
+ // also rejects a nonexistent project rather than linking to a 404 page
56
+ const list = await client.getIntegrations(workspace, project, environmentId);
57
+ let origin;
58
+ try {
59
+ origin = new URL(list.html_url || '').origin;
60
+ }
61
+ catch {
62
+ throw new cliError_1.default('not_found', texts_1.ERR_INTEGRATION_ADD_URL_MISSING);
63
+ }
64
+ const url = `${origin}${path}`;
65
+ if (options.format === 'json') {
66
+ output_1.default.json({ url });
67
+ output_1.default.exitNormal();
68
+ }
69
+ output_1.default.exitNormal((0, texts_1.TXT_INTEGRATION_ADD_URL)(url));
70
+ });
71
+ exports.default = commandIntegrationAdd;
@@ -0,0 +1,318 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTEGRATION_TYPES = exports.INTEGRATION_TYPE_CATALOG = void 0;
4
+ exports.INTEGRATION_TYPE_CATALOG = [
5
+ {
6
+ type: 'GIT_HUB',
7
+ name: 'GitHub',
8
+ group: 'GIT',
9
+ description: 'GitHub repositories as project sources, PR and commit statuses',
10
+ },
11
+ {
12
+ type: 'GIT_HUB_ENTERPRISE',
13
+ name: 'GitHub EE',
14
+ group: 'GIT',
15
+ description: 'Self-hosted GitHub Enterprise repositories as project sources',
16
+ },
17
+ {
18
+ type: 'GIT_LAB',
19
+ name: 'GitLab',
20
+ group: 'GIT',
21
+ description: 'GitLab repositories as project sources',
22
+ },
23
+ {
24
+ type: 'GIT_LAB_ENTERPRISE',
25
+ name: 'GitLab EE/CE',
26
+ group: 'GIT',
27
+ description: 'Self-hosted GitLab repositories as project sources',
28
+ },
29
+ {
30
+ type: 'BITBUCKET',
31
+ name: 'Bitbucket',
32
+ group: 'GIT',
33
+ description: 'Bitbucket repositories as project sources',
34
+ },
35
+ {
36
+ type: 'AMAZON',
37
+ name: 'Amazon Web Services',
38
+ group: 'IAAS',
39
+ description: 'Deploy to AWS: S3, EC2, ECS, EKS, Lambda, Elastic Beanstalk, CloudFront and more',
40
+ },
41
+ {
42
+ type: 'AZURE_CLOUD',
43
+ name: 'Azure',
44
+ group: 'IAAS',
45
+ description: 'Deploy to Microsoft Azure: App Service, AKS, Storage, Azure CLI',
46
+ },
47
+ {
48
+ type: 'GOOGLE_SERVICE_ACCOUNT',
49
+ name: 'Google Cloud',
50
+ group: 'IAAS',
51
+ description: 'Deploy to Google Cloud: GKE, Cloud Run, App Engine, Cloud Storage, gcloud CLI',
52
+ },
53
+ {
54
+ type: 'GOOGLE_PLAY_STORE',
55
+ name: 'Google Play Store',
56
+ group: 'IAAS',
57
+ description: 'Publish Android apps to Google Play',
58
+ },
59
+ {
60
+ type: 'DIGITAL_OCEAN',
61
+ name: 'DigitalOcean',
62
+ group: 'IAAS',
63
+ description: 'Deploy to DigitalOcean droplets, Kubernetes and App Platform',
64
+ },
65
+ {
66
+ type: 'VULTR',
67
+ name: 'Vultr',
68
+ group: 'IAAS',
69
+ description: 'Deploy to Vultr servers',
70
+ },
71
+ {
72
+ type: 'UPCLOUD',
73
+ name: 'UpCloud',
74
+ group: 'IAAS',
75
+ description: 'Deploy to UpCloud servers',
76
+ },
77
+ {
78
+ type: 'BACKBLAZE',
79
+ name: 'Backblaze',
80
+ group: 'IAAS',
81
+ description: 'Upload files to Backblaze B2 storage',
82
+ },
83
+ {
84
+ type: 'HEROKU',
85
+ name: 'Heroku',
86
+ group: 'PAAS',
87
+ description: 'Deploy apps to Heroku',
88
+ },
89
+ {
90
+ type: 'NETLIFY',
91
+ name: 'Netlify',
92
+ group: 'PAAS',
93
+ description: 'Deploy sites to Netlify',
94
+ },
95
+ {
96
+ type: 'CLOUDFLARE',
97
+ name: 'Cloudflare',
98
+ group: 'PAAS',
99
+ description: 'Purge Cloudflare cache, deploy Workers and Pages',
100
+ },
101
+ {
102
+ type: 'FIREBASE',
103
+ name: 'Firebase',
104
+ group: 'PAAS',
105
+ description: 'Deploy to Firebase Hosting and run the Firebase CLI',
106
+ },
107
+ {
108
+ type: 'DO_SPACES',
109
+ name: 'DigitalOcean Spaces',
110
+ group: 'PAAS',
111
+ description: 'Upload files to DigitalOcean Spaces',
112
+ },
113
+ {
114
+ type: 'RACKSPACE',
115
+ name: 'Rackspace',
116
+ group: 'PAAS',
117
+ description: 'Upload files to Rackspace Cloud Files',
118
+ },
119
+ {
120
+ type: 'SHOPIFY',
121
+ name: 'Shopify',
122
+ group: 'PAAS',
123
+ description: 'Deploy themes to Shopify stores',
124
+ },
125
+ {
126
+ type: 'CONTENTFUL',
127
+ name: 'Contentful',
128
+ group: 'PAAS',
129
+ description: 'Run Contentful CLI and migrations, trigger pipelines on content changes',
130
+ },
131
+ {
132
+ type: 'JIRA',
133
+ name: 'Jira',
134
+ group: 'PAAS',
135
+ description: 'Update Jira issues from pipelines',
136
+ },
137
+ {
138
+ type: 'BLACKFIRE',
139
+ name: 'Blackfire',
140
+ group: 'PAAS',
141
+ description: 'Run Blackfire performance tests',
142
+ },
143
+ {
144
+ type: 'SLACK',
145
+ name: 'Slack',
146
+ group: 'NOTIFICATION',
147
+ description: 'Send pipeline notifications to Slack channels',
148
+ },
149
+ {
150
+ type: 'TELEGRAM',
151
+ name: 'Telegram',
152
+ group: 'NOTIFICATION',
153
+ description: 'Send pipeline notifications to Telegram chats',
154
+ },
155
+ {
156
+ type: 'PUSHOVER',
157
+ name: 'Pushover',
158
+ group: 'NOTIFICATION',
159
+ description: 'Send push notifications through Pushover',
160
+ },
161
+ {
162
+ type: 'PUSHBULLET',
163
+ name: 'Pushbullet',
164
+ group: 'NOTIFICATION',
165
+ description: 'Send push notifications through Pushbullet',
166
+ },
167
+ {
168
+ type: 'SENTRY',
169
+ name: 'Sentry',
170
+ group: 'MONITORING',
171
+ description: 'Create Sentry releases, trigger pipelines on Sentry events',
172
+ },
173
+ {
174
+ type: 'SENTRY_ENTERPRISE',
175
+ name: 'Sentry Self-Hosted',
176
+ group: 'MONITORING',
177
+ description: 'Create releases in a self-hosted Sentry',
178
+ },
179
+ {
180
+ type: 'NEW_RELIC',
181
+ name: 'New Relic',
182
+ group: 'MONITORING',
183
+ description: 'Record deployments in New Relic',
184
+ },
185
+ {
186
+ type: 'ROLLBAR',
187
+ name: 'Rollbar',
188
+ group: 'MONITORING',
189
+ description: 'Record deployments in Rollbar',
190
+ },
191
+ {
192
+ type: 'DATADOG',
193
+ name: 'Datadog',
194
+ group: 'MONITORING',
195
+ description: 'Send deployment events to Datadog',
196
+ },
197
+ {
198
+ type: 'HONEYBADGER',
199
+ name: 'Honeybadger',
200
+ group: 'MONITORING',
201
+ description: 'Record deployments in Honeybadger',
202
+ },
203
+ {
204
+ type: 'LOGGLY',
205
+ name: 'Loggly',
206
+ group: 'MONITORING',
207
+ description: 'Send pipeline logs and events to Loggly',
208
+ },
209
+ {
210
+ type: 'ANTHROPIC',
211
+ name: 'Anthropic',
212
+ group: 'AI',
213
+ description: 'Claude API key for AI actions and agents',
214
+ },
215
+ {
216
+ type: 'OPEN_AI',
217
+ name: 'OpenAI',
218
+ group: 'AI',
219
+ description: 'OpenAI API key for AI actions and agents',
220
+ },
221
+ {
222
+ type: 'GOOGLE_GEMINI',
223
+ name: 'Google Gemini',
224
+ group: 'AI',
225
+ description: 'Gemini API key for AI actions and agents',
226
+ },
227
+ {
228
+ type: 'GROK',
229
+ name: 'Grok',
230
+ group: 'AI',
231
+ description: 'xAI Grok API key for AI actions and agents',
232
+ },
233
+ {
234
+ type: 'CURSOR',
235
+ name: 'Cursor',
236
+ group: 'AI',
237
+ description: 'Cursor API key for Cursor agents in pipelines',
238
+ },
239
+ {
240
+ type: 'OPENCODE',
241
+ name: 'opencode',
242
+ group: 'AI',
243
+ description: 'opencode API key for opencode agents in pipelines',
244
+ },
245
+ {
246
+ type: 'TYPESAFE',
247
+ name: 'TypeSafe',
248
+ group: 'AI',
249
+ description: 'TypeSafe API key for AI judgments in pipelines',
250
+ },
251
+ {
252
+ type: 'DOCKER_HUB',
253
+ name: 'Docker Hub',
254
+ group: 'OTHER',
255
+ description: 'Pull and push images in Docker Hub',
256
+ },
257
+ {
258
+ type: 'NPM_REGISTRY',
259
+ name: 'npm',
260
+ group: 'OTHER',
261
+ description: 'Publish and install packages from an npm registry',
262
+ },
263
+ {
264
+ type: 'APP_STORE',
265
+ name: 'App Store',
266
+ group: 'OTHER',
267
+ description: 'Publish iOS apps to App Store Connect and TestFlight',
268
+ },
269
+ {
270
+ type: 'SNYK',
271
+ name: 'Snyk',
272
+ group: 'OTHER',
273
+ description: 'Scan code and dependencies for vulnerabilities with Snyk',
274
+ },
275
+ {
276
+ type: 'STACK_HAWK',
277
+ name: 'StackHawk',
278
+ group: 'OTHER',
279
+ description: 'Run StackHawk security scans',
280
+ },
281
+ {
282
+ type: 'GHOST_INSPECTOR',
283
+ name: 'Ghost Inspector',
284
+ group: 'OTHER',
285
+ description: 'Run Ghost Inspector browser tests',
286
+ },
287
+ {
288
+ type: 'ATOP',
289
+ name: 'ATOP',
290
+ group: 'OTHER',
291
+ description: 'Connect pipelines to an ATOP instance (API key and secret)',
292
+ },
293
+ {
294
+ type: 'CLICKUP',
295
+ name: 'ClickUp',
296
+ group: 'OTHER',
297
+ description: 'Update ClickUp tasks from pipelines, MCP server access',
298
+ },
299
+ {
300
+ type: 'OKTA',
301
+ name: 'Okta',
302
+ group: 'OTHER',
303
+ description: 'Single sign-on to the workspace with Okta',
304
+ },
305
+ {
306
+ type: 'ONE_LOGIN',
307
+ name: 'OneLogin',
308
+ group: 'OTHER',
309
+ description: 'Single sign-on to the workspace with OneLogin',
310
+ },
311
+ {
312
+ type: 'BUDDY',
313
+ name: 'Buddy',
314
+ group: 'OTHER',
315
+ description: 'Access another Buddy workspace from pipelines',
316
+ },
317
+ ];
318
+ exports.INTEGRATION_TYPES = exports.INTEGRATION_TYPE_CATALOG.map((t) => t.type);
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../utils");
7
+ const texts_1 = require("../../texts");
8
+ const output_1 = __importDefault(require("../../output"));
9
+ const input_1 = __importDefault(require("../../input"));
10
+ const scope_1 = require("./scope");
11
+ const commandIntegrationDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_INTEGRATION_DELETE, {
12
+ requiredScopes: [utils_1.REST_API_SCOPE.INTEGRATION_MANAGE],
13
+ examples: texts_1.EXAMPLE_INTEGRATION_DELETE,
14
+ });
15
+ commandIntegrationDelete.alias('rm');
16
+ commandIntegrationDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
17
+ commandIntegrationDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
18
+ commandIntegrationDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE_ENVIRONMENT);
19
+ commandIntegrationDelete.option('--environment <identifier>', texts_1.OPTION_INTEGRATION_ENVIRONMENT);
20
+ commandIntegrationDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
21
+ commandIntegrationDelete.option('--format <text|json>', texts_1.OPTION_FORMAT);
22
+ commandIntegrationDelete.argument('<identifier>', texts_1.OPTION_INTEGRATION_IDENTIFIER);
23
+ commandIntegrationDelete.action(async (identifier, options) => {
24
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
25
+ const client = input_1.default.restApiTokenClient();
26
+ const hash_id = await (0, scope_1.resolveIntegrationId)(client, workspace, identifier, options,
27
+ /* strictLine */ true);
28
+ const json = options.format === 'json';
29
+ const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.TXT_INTEGRATION_DELETE_CONFIRM)(identifier), json);
30
+ if (!confirmed)
31
+ output_1.default.exitResult(json, { deleted: null });
32
+ await client.deleteIntegration(workspace, hash_id);
33
+ output_1.default.exitResult(json, { deleted: identifier }, (0, texts_1.TXT_INTEGRATION_DELETED)(identifier));
34
+ });
35
+ exports.default = commandIntegrationDelete;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../utils");
7
+ const texts_1 = require("../../texts");
8
+ const output_1 = __importDefault(require("../../output"));
9
+ const input_1 = __importDefault(require("../../input"));
10
+ const scope_1 = require("./scope");
11
+ const commandIntegrationGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_INTEGRATION_GET, {
12
+ requiredScopes: [utils_1.REST_API_SCOPE.INTEGRATION_READ],
13
+ examples: texts_1.EXAMPLE_INTEGRATION_GET,
14
+ });
15
+ commandIntegrationGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
16
+ commandIntegrationGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
17
+ commandIntegrationGet.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE_ENVIRONMENT);
18
+ commandIntegrationGet.option('--environment <identifier>', texts_1.OPTION_INTEGRATION_ENVIRONMENT);
19
+ commandIntegrationGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
20
+ commandIntegrationGet.argument('<identifier>', texts_1.OPTION_INTEGRATION_IDENTIFIER);
21
+ commandIntegrationGet.action(async (identifier, options) => {
22
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
23
+ const client = input_1.default.restApiTokenClient();
24
+ const hash_id = await (0, scope_1.resolveIntegrationId)(client, workspace, identifier, options);
25
+ const integration = await client.getIntegration(workspace, hash_id);
26
+ if (options.format === 'json') {
27
+ output_1.default.json(integration);
28
+ }
29
+ else {
30
+ const data = [
31
+ ['Field', 'Value'],
32
+ ['Hash ID', integration.hash_id || '-'],
33
+ ['Identifier', integration.identifier || '-'],
34
+ ['Name', integration.name || '-'],
35
+ ['Type', integration.type || '-'],
36
+ ['Auth type', integration.auth_type || '-'],
37
+ ['Scope', integration.scope || '-'],
38
+ ];
39
+ if (integration.project_name) {
40
+ data.push(['Project', integration.project_name]);
41
+ }
42
+ data.push([
43
+ 'Pipelines',
44
+ integration.all_pipelines_allowed
45
+ ? 'all'
46
+ : (integration.allowed_pipelines || [])
47
+ .map((p) => p.identifier || p.name || String(p.id))
48
+ .join(', ') || '-',
49
+ ], ['Note', integration.note || '-'], ['Agent note', integration.agent_note || '-'], ['Disabled', integration.disabled ? 'true' : 'false']);
50
+ if (integration.html_url) {
51
+ data.push(['URL', integration.html_url]);
52
+ }
53
+ output_1.default.table(data);
54
+ }
55
+ output_1.default.exitNormal();
56
+ });
57
+ exports.default = commandIntegrationGet;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../utils");
7
+ const texts_1 = require("../../texts");
8
+ const output_1 = __importDefault(require("../../output"));
9
+ const input_1 = __importDefault(require("../../input"));
10
+ const commandIntegrationList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_INTEGRATION_LIST, {
11
+ requiredScopes: [utils_1.REST_API_SCOPE.INTEGRATION_READ],
12
+ examples: texts_1.EXAMPLE_INTEGRATION_LIST,
13
+ });
14
+ commandIntegrationList.alias('ls');
15
+ (0, utils_1.sandboxScopeOptions)(commandIntegrationList, false);
16
+ commandIntegrationList.option('--format <text|json>', texts_1.OPTION_FORMAT);
17
+ commandIntegrationList.action(async (options) => {
18
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
19
+ const client = input_1.default.restApiTokenClient();
20
+ // workspace, project and environment scopes take the same flags as
21
+ // sandboxes; one scope per call, the endpoint does not cascade
22
+ const { scope, project, environmentId } = await input_1.default.sandboxScope(client, workspace, options);
23
+ input_1.default.projectScopeNote(options, project, scope, 'integrations');
24
+ const result = await client.getIntegrations(workspace, project, environmentId);
25
+ const integrations = result.integrations || [];
26
+ if (options.format === 'json') {
27
+ output_1.default.json(integrations);
28
+ }
29
+ else {
30
+ if (integrations.length === 0) {
31
+ output_1.default.exitNormal(texts_1.TXT_INTEGRATION_NOT_FOUND);
32
+ }
33
+ const data = [
34
+ ['NAME', 'IDENTIFIER', 'TYPE', 'AUTH', 'SCOPE', 'DISABLED'],
35
+ ];
36
+ for (const integration of integrations) {
37
+ data.push([
38
+ integration.name || '-',
39
+ integration.identifier || '-',
40
+ integration.type || '-',
41
+ integration.auth_type || '-',
42
+ integration.scope || '-',
43
+ integration.disabled ? 'true' : 'false',
44
+ ]);
45
+ }
46
+ output_1.default.table(data);
47
+ }
48
+ output_1.default.exitNormal();
49
+ });
50
+ exports.default = commandIntegrationList;