@copado/agentia-cli 0.36.0-alpha.0 → 0.37.0-alpha.0

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.
@@ -0,0 +1,15 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class EnvironmentOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ credentialid: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<{
12
+ provider: string;
13
+ url: string;
14
+ }>;
15
+ }
@@ -0,0 +1,61 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ import { ProjectDefaultResolutionError, resolveProjectDefaultId } from '../../lib/project-default-id.js';
6
+ export default class EnvironmentOpen extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'Copado environment ID (defaults to the configured project default environment)',
10
+ required: false,
11
+ }),
12
+ };
13
+ static description = 'Open a Copado environment or credential in the browser';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %>',
16
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
17
+ '<%= config.bin %> <%= command.id %> --credentialid <credential-id>',
18
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --credentialid <credential-id> --json',
19
+ ];
20
+ static flags = {
21
+ credentialid: Flags.string({
22
+ description: 'Credential ID to open instead of the environment record',
23
+ }),
24
+ };
25
+ async run() {
26
+ const { args, flags } = await this.parse(EnvironmentOpen);
27
+ const credentialId = flags.credentialid?.trim();
28
+ const resourceType = credentialId !== undefined && credentialId.length > 0 ? 'credential' : 'environment';
29
+ let resourceId;
30
+ try {
31
+ if (resourceType === 'credential') {
32
+ if (credentialId === undefined || credentialId.length === 0) {
33
+ this.error('Credential ID is required when opening a credential.', { exit: 2 });
34
+ }
35
+ resourceId = credentialId;
36
+ }
37
+ else {
38
+ resourceId = await resolveProjectDefaultId('environment', args.id);
39
+ }
40
+ }
41
+ catch (error) {
42
+ if (error instanceof ProjectDefaultResolutionError) {
43
+ this.error(error.message, {
44
+ exit: 1,
45
+ suggestions: [`${this.config.bin} project default set --environment <environment-id>`],
46
+ });
47
+ }
48
+ throw error;
49
+ }
50
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
51
+ id: resourceId,
52
+ resourceType,
53
+ }));
54
+ await openNavigationTarget(target, {
55
+ jsonEnabled: this.jsonEnabled(),
56
+ log: this.log.bind(this),
57
+ });
58
+ return target;
59
+ }
60
+ }
61
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/environment/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAC,6BAA6B,EAAE,uBAAuB,EAAC,MAAM,iCAAiC,CAAA;AAEtG,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,cAAc;IACzD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,wDAAwD,CAAA;IACtF,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,uDAAuD;QACvD,oEAAoE;QACpE,6FAA6F;KAC9F,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,yDAAyD;SACvE,CAAC;KACH,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAEvD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,CAAA;QAC/C,MAAM,YAAY,GAAG,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAA;QAEzG,IAAI,UAAkB,CAAA;QAEtB,IAAI,CAAC;YACH,IAAI,YAAY,KAAK,YAAY,EAAE,CAAC;gBAClC,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC5D,IAAI,CAAC,KAAK,CAAC,sDAAsD,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;gBAC/E,CAAC;gBAED,UAAU,GAAG,YAAY,CAAA;YAC3B,CAAC;iBAAM,CAAC;gBACN,UAAU,GAAG,MAAM,uBAAuB,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YACpE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,6BAA6B,EAAE,CAAC;gBACnD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,CAAC;oBACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,qDAAqD,CAAC;iBACvF,CAAC,CAAA;YACJ,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,UAAU;YACd,YAAY;SACb,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class JobOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ provider: string;
10
+ url: string;
11
+ }>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ export default class JobOpen extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'JobExecution ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Open a Copado job execution in the browser';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> <job-id>',
15
+ '<%= config.bin %> <%= command.id %> <job-id> --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(JobOpen);
19
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
20
+ id: args.id,
21
+ resourceType: 'job',
22
+ }));
23
+ await openNavigationTarget(target, {
24
+ jsonEnabled: this.jsonEnabled(),
25
+ log: this.log.bind(this),
26
+ });
27
+ return target;
28
+ }
29
+ }
30
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/job/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,cAAc;IACjD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,4CAA4C,CAAA;IAC1E,MAAM,CAAU,QAAQ,GAAG;QACzB,8CAA8C;QAC9C,qDAAqD;KACtD,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAExC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,KAAK;SACpB,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class PipelineOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ provider: string;
10
+ url: string;
11
+ }>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ export default class PipelineOpen extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Pipeline ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Open a Copado pipeline in the browser';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> <pipeline-id>',
15
+ '<%= config.bin %> <%= command.id %> <pipeline-id> --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(PipelineOpen);
19
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
20
+ id: args.id,
21
+ resourceType: 'pipeline',
22
+ }));
23
+ await openNavigationTarget(target, {
24
+ jsonEnabled: this.jsonEnabled(),
25
+ log: this.log.bind(this),
26
+ });
27
+ return target;
28
+ }
29
+ }
30
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/pipeline/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,cAAc;IACtD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,uCAAuC,CAAA;IACrE,MAAM,CAAU,QAAQ,GAAG;QACzB,mDAAmD;QACnD,0DAA0D;KAC3D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QAE7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,UAAU;SACzB,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class ProjectOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ provider: string;
10
+ url: string;
11
+ }>;
12
+ }
@@ -0,0 +1,45 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ import { ProjectDefaultResolutionError, resolveProjectDefaultId } from '../../lib/project-default-id.js';
6
+ export default class ProjectOpen extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'Copado project ID (defaults to the configured project default)',
10
+ required: false,
11
+ }),
12
+ };
13
+ static description = 'Open a Copado project in the browser';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %>',
16
+ '<%= config.bin %> <%= command.id %> a0wKC000000CmZ2AU',
17
+ '<%= config.bin %> <%= command.id %> a0wKC000000CmZ2AU --json',
18
+ ];
19
+ async run() {
20
+ const { args } = await this.parse(ProjectOpen);
21
+ let projectId;
22
+ try {
23
+ projectId = await resolveProjectDefaultId('project', args.id);
24
+ }
25
+ catch (error) {
26
+ if (error instanceof ProjectDefaultResolutionError) {
27
+ this.error(error.message, {
28
+ exit: 1,
29
+ suggestions: [`${this.config.bin} project default set --project <project-id>`],
30
+ });
31
+ }
32
+ throw error;
33
+ }
34
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
35
+ id: projectId,
36
+ resourceType: 'project',
37
+ }));
38
+ await openNavigationTarget(target, {
39
+ jsonEnabled: this.jsonEnabled(),
40
+ log: this.log.bind(this),
41
+ });
42
+ return target;
43
+ }
44
+ }
45
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/project/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAC,6BAA6B,EAAE,uBAAuB,EAAC,MAAM,iCAAiC,CAAA;AAEtG,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;IACrD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,sCAAsC,CAAA;IACpE,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,uDAAuD;QACvD,8DAA8D;KAC/D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAE5C,IAAI,SAAiB,CAAA;QAErB,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,uBAAuB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,6BAA6B,EAAE,CAAC;gBACnD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,CAAC;oBACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,6CAA6C,CAAC;iBAC/E,CAAC,CAAA;YACJ,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,SAAS;YACb,YAAY,EAAE,SAAS;SACxB,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class PromotionOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ provider: string;
10
+ url: string;
11
+ }>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ export default class PromotionOpen extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Copado promotion ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Open a Copado promotion in the browser';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> <promotion-id>',
15
+ '<%= config.bin %> <%= command.id %> <promotion-id> --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(PromotionOpen);
19
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
20
+ id: args.id,
21
+ resourceType: 'promotion',
22
+ }));
23
+ await openNavigationTarget(target, {
24
+ jsonEnabled: this.jsonEnabled(),
25
+ log: this.log.bind(this),
26
+ });
27
+ return target;
28
+ }
29
+ }
30
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/promotion/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,wCAAwC,CAAA;IACtE,MAAM,CAAU,QAAQ,GAAG;QACzB,oDAAoD;QACpD,2DAA2D;KAC5D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAE9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,WAAW;SAC1B,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ export default class WorkOpen extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ provider: string;
10
+ url: string;
11
+ }>;
12
+ }
@@ -0,0 +1,45 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { openNavigationTarget } from '../../lib/navigation-open.js';
4
+ import { resolveNavigationTarget } from '../../lib/navigation.js';
5
+ import { resolveWorkItemId, WorkActiveResolutionError } from '../../lib/work-active.js';
6
+ export default class WorkOpen extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'User story ID (defaults to the active work item from `work set`)',
10
+ required: false,
11
+ }),
12
+ };
13
+ static description = 'Open a Copado user story in the browser';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %>',
16
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
17
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --json',
18
+ ];
19
+ async run() {
20
+ const { args } = await this.parse(WorkOpen);
21
+ let workItemId;
22
+ try {
23
+ workItemId = await resolveWorkItemId(args.id);
24
+ }
25
+ catch (error) {
26
+ if (error instanceof WorkActiveResolutionError) {
27
+ this.error(error.message, {
28
+ exit: 1,
29
+ suggestions: [`${this.config.bin} work set <id>`],
30
+ });
31
+ }
32
+ throw error;
33
+ }
34
+ const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
35
+ id: workItemId,
36
+ resourceType: 'work',
37
+ }));
38
+ await openNavigationTarget(target, {
39
+ jsonEnabled: this.jsonEnabled(),
40
+ log: this.log.bind(this),
41
+ });
42
+ return target;
43
+ }
44
+ }
45
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/work/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAC,iBAAiB,EAAE,yBAAyB,EAAC,MAAM,0BAA0B,CAAA;AAErF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,cAAc;IAClD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,kEAAkE;YAC/E,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,yCAAyC,CAAA;IACvE,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,uDAAuD;QACvD,8DAA8D;KAC/D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAEzC,IAAI,UAAkB,CAAA;QAEtB,IAAI,CAAC;YACH,UAAU,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,yBAAyB,EAAE,CAAC;gBAC/C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,CAAC;oBACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;iBAClD,CAAC,CAAA;YACJ,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,GAAG,EAAE,CACrE,uBAAuB,CAAC;YACtB,EAAE,EAAE,UAAU;YACd,YAAY,EAAE,MAAM;SACrB,CAAC,CACH,CAAA;QAED,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -5,6 +5,7 @@ import { type Environment, type EnvironmentListFilters } from '../environment-ty
5
5
  import { type JobListFilters } from '../job-types.js';
6
6
  import { type ComparisonMode, type ContentSource, type DependencyResult, type IndexSearchResult, type IndexSource, type MetadataContentResult, type ModuleType, type OrderDirection, type PlatformExperience, type RetrieveMode } from '../metadata-common.js';
7
7
  import { type IndexRefreshResult, type RefreshDeletedMetadataIndexResult } from '../metadata-refresh.js';
8
+ import { NAVIGATION_RESOURCE_TYPES } from '../navigation.js';
8
9
  import { type PipelineConnection, type PipelineDescribe, type PipelineListFilters } from '../pipeline-types.js';
9
10
  import { type ProjectDefaultScope } from '../project-defaults.js';
10
11
  import { type Project, type ProjectListFilters } from '../project-types.js';
@@ -342,6 +343,10 @@ declare function workStatus(args?: {
342
343
  }): Promise<{
343
344
  result: HeadlessWorkStatusResult;
344
345
  }>;
346
+ declare function navigationResolve(args: {
347
+ id: string;
348
+ resourceType: (typeof NAVIGATION_RESOURCE_TYPES)[number];
349
+ }): Promise<import("../navigation.js").NavigationTarget>;
345
350
  export declare const agentiaMcpToolHandlers: {
346
351
  workCreate: (args?: Partial<import("../work-types.js").UserStoryMutationPayload>) => Promise<{
347
352
  userStory: import("../work-types.js").UserStory;
@@ -722,6 +727,7 @@ export declare const agentiaMcpToolHandlers: {
722
727
  metadataRefreshDeleted: typeof metadataRefreshDeleted;
723
728
  metadataRefreshRun: typeof metadataRefreshRun;
724
729
  metadataRefreshStatus: typeof metadataRefreshStatus;
730
+ navigationResolve: typeof navigationResolve;
725
731
  pipelineConnectionList: typeof pipelineConnectionList;
726
732
  pipelineGet: typeof pipelineGet;
727
733
  pipelineList: typeof pipelineList;
@@ -9,7 +9,7 @@ import { assertRequired } from '../assert.js';
9
9
  import { CicdGateway, normalizeCicdBaseUrl } from '../cicd-gateway.js';
10
10
  import { CICD_REGIONS } from '../cicd-region.js';
11
11
  import { ALL_CREDENTIAL_TYPES, credentialLabel, getCicdBaseUrl, getCredential, maskSecret, setCicdBaseUrl, setCredential, } from '../credential-store.js';
12
- import { readDefaults, readLastWorkItem, resolveDefaults, unsetDefaults, writeDefaults, } from '../defaults-store.js';
12
+ import { readDefaults, readLastWorkItem, resolveDefaults, unsetDefaults, writeDefaults } from '../defaults-store.js';
13
13
  import { runEnvironmentAuthStatus } from '../environment-auth-status.js';
14
14
  import { buildCreatePayload, buildMutationPayload, ENVIRONMENT_STRING_VALIDATION_KEYS, validateNonEmptyStringFields, } from '../environment-flags.js';
15
15
  import { DEFAULT_ENVIRONMENT_PLATFORM, DEFAULT_ENVIRONMENT_TYPE, ENVIRONMENT_TYPES, environmentEndpoint, environmentsListEndpoint, } from '../environment-types.js';
@@ -18,6 +18,7 @@ import { listPaginationZodFields, mcpPaginatedListPayload } from '../list-pagina
18
18
  import { normalizeLocalGatewayBaseUrl, readLocalGatewayConfig } from '../local-gateway-config.js';
19
19
  import { COMPARISON_MODES, CONTENT_SOURCES, contentResultToCompareSide, createUnifiedDiff, INDEX_SOURCES, MODULE_TYPES, ORDER_DIRECTIONS, PLATFORM_EXPERIENCES, RETRIEVE_MODES, sourceSideLabel, } from '../metadata-common.js';
20
20
  import { buildRefreshDeletedRequest, buildRefreshIndexRequest, refreshStatusEndpoint, resolveRefreshSourceFromEnv, } from '../metadata-refresh.js';
21
+ import { NAVIGATION_RESOURCE_TYPES, resolveNavigationTarget } from '../navigation.js';
21
22
  import { normalizePipelineDescribe, normalizePipelines, normalizePipelinesListPage, pipelineConnectionsFromPipelines, pipelineDescribeEndpoint, pipelineListEndpoint, } from '../pipeline-types.js';
22
23
  import { buildSetValues, collectSelectedKeys } from '../project-default-flags.js';
23
24
  import { PROJECT_DEFAULT_KEYS } from '../project-defaults.js';
@@ -606,9 +607,18 @@ async function workStatus(args = {}) {
606
607
  const workItem = args.id?.trim() || (await readLastWorkItem());
607
608
  if (!workItem)
608
609
  throw new Error('No work item specified and no last work item recorded.');
609
- const result = await CicdGateway.call({ endpoint: workStatusEndpoint(workItem), method: 'GET' });
610
+ const result = await CicdGateway.call({
611
+ endpoint: workStatusEndpoint(workItem),
612
+ method: 'GET',
613
+ });
610
614
  return { result };
611
615
  }
616
+ async function navigationResolve(args) {
617
+ return resolveNavigationTarget({
618
+ id: assertRequired(args.id, 'id'),
619
+ resourceType: args.resourceType,
620
+ });
621
+ }
612
622
  export const agentiaMcpToolHandlers = {
613
623
  authGet,
614
624
  authSet,
@@ -632,6 +642,7 @@ export const agentiaMcpToolHandlers = {
632
642
  metadataRefreshDeleted,
633
643
  metadataRefreshRun,
634
644
  metadataRefreshStatus,
645
+ navigationResolve,
635
646
  pipelineConnectionList,
636
647
  pipelineGet,
637
648
  pipelineList,
@@ -828,6 +839,14 @@ export function registerAgentiaMcpTools(server) {
828
839
  },
829
840
  title: 'Agentia User Get',
830
841
  }, (args) => safelyHandleTool(() => userGet(args || {})));
842
+ server.registerTool('agentia_navigation_resolve', {
843
+ description: 'Resolve a browser navigation URL for a Copado resource.',
844
+ inputSchema: {
845
+ id: z.string().describe('Resource ID to open in the browser.'),
846
+ resourceType: z.enum(NAVIGATION_RESOURCE_TYPES).describe('Type of resource to resolve.'),
847
+ },
848
+ title: 'Agentia Navigation Resolve',
849
+ }, (args) => safelyHandleTool(() => navigationResolve(args)));
831
850
  server.registerTool('agentia_project_default_get', {
832
851
  description: 'Show Agentia project default values for the current project or globally.',
833
852
  inputSchema: projectSelectorSchema,