@copado/agentia-cli 1.0.0-beta.6 → 1.0.0-beta.7
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/CHANGELOG.md +7 -0
- package/README.md +280 -277
- package/dist/commands/adv/component/add.js +1 -1
- package/dist/commands/adv/component/remove.js +1 -1
- package/dist/commands/adv/component/types.js +1 -1
- package/dist/commands/adv/deployment/deploy.js +4 -1
- package/dist/commands/adv/deployment/list.js +1 -1
- package/dist/commands/adv/deployment/options.js +1 -1
- package/dist/commands/adv/deployment/quick-deploy.js +5 -2
- package/dist/commands/adv/deployment/validate.js +4 -1
- package/dist/commands/adv/job/list.js +3 -3
- package/dist/commands/adv/job/wait.js +7 -3
- package/dist/commands/cicd/environment/get.js +3 -6
- package/dist/commands/cicd/environment/list.js +2 -7
- package/dist/commands/cicd/job/get.js +3 -7
- package/dist/commands/cicd/job/list.js +3 -7
- package/dist/commands/cicd/pipeline/get.js +3 -7
- package/dist/commands/cicd/pipeline/list.js +3 -7
- package/dist/commands/cicd/project/get.js +3 -7
- package/dist/commands/cicd/project/list.js +3 -7
- package/dist/commands/cicd/promotion/get.js +3 -7
- package/dist/commands/cicd/promotion/list.js +3 -7
- package/dist/commands/cicd/stage/list.js +5 -6
- package/dist/commands/cicd/user/get.js +3 -7
- package/dist/commands/cicd/work/get.js +2 -2
- package/dist/commands/cicd/work/list.js +3 -7
- package/dist/commands/cicd/work/promote.js +1 -0
- package/dist/lib/adv-operations.js +4 -1
- package/dist/lib/agentia-command.js +38 -2
- package/dist/lib/ai-config.js +3 -1
- package/dist/lib/auth-profile.js +2 -1
- package/dist/lib/environment-get.js +4 -0
- package/dist/lib/job-get.js +4 -0
- package/dist/lib/mcp/adv-tools.js +12 -6
- package/dist/lib/mcp/tools.js +25 -67
- package/dist/lib/mcp/work-tools.js +4 -8
- package/dist/lib/pipeline-get.js +4 -0
- package/dist/lib/plugin-host/ai.js +5 -0
- package/dist/lib/plugin-host/environment.js +4 -0
- package/dist/lib/plugin-host/event-log.js +2 -1
- package/dist/lib/plugin-host/input.js +7 -0
- package/dist/lib/plugin-host/job.js +4 -0
- package/dist/lib/plugin-host/pipeline.js +4 -0
- package/dist/lib/plugin-host/project.js +5 -0
- package/dist/lib/plugin-host/projection-utils.js +6 -1
- package/dist/lib/plugin-host/promotion.js +4 -0
- package/dist/lib/plugin-host/stage.js +4 -0
- package/dist/lib/plugin-host/user.js +4 -0
- package/dist/lib/plugin-host/workspace.js +3 -0
- package/dist/lib/project-get.js +4 -0
- package/dist/lib/promotion-get.js +4 -0
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/stage-list.js +3 -0
- package/dist/lib/testing-gateway.js +2 -1
- package/dist/lib/user-get.js +3 -0
- package/dist/lib/work-get.js +3 -2
- package/oclif.manifest.json +271 -20
- package/package.json +1 -1
- package/templates/skills/agentia-adv/SKILL.md +3 -1
- package/templates/skills/agentia-adv/references/pipelines-advanced.md +19 -3
|
@@ -23,7 +23,7 @@ export default class AdvComponentAdd extends AgentiaCommand {
|
|
|
23
23
|
exclusive: ['component', 'json-file'],
|
|
24
24
|
}),
|
|
25
25
|
'json-file': Flags.string({
|
|
26
|
-
description: 'JSON file
|
|
26
|
+
description: 'JSON file containing a bare component array (not a --json envelope); accepts list rows, {type, fullName}, or {nodeType: {name}, fullName}.',
|
|
27
27
|
exclusive: ['component', 'file'],
|
|
28
28
|
}),
|
|
29
29
|
};
|
|
@@ -18,7 +18,7 @@ export default class AdvComponentRemove extends AgentiaCommand {
|
|
|
18
18
|
multiple: true,
|
|
19
19
|
}),
|
|
20
20
|
'json-file': Flags.string({
|
|
21
|
-
description: 'JSON file
|
|
21
|
+
description: 'JSON file containing a bare component array (not a --json envelope); text-file input is not supported.',
|
|
22
22
|
exclusive: ['component'],
|
|
23
23
|
}),
|
|
24
24
|
};
|
|
@@ -2,7 +2,7 @@ import { listAdvComponentTypes } from '../../../lib/adv-operations.js';
|
|
|
2
2
|
import { formatAdvRecord } from '../../../lib/adv-types.js';
|
|
3
3
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
4
4
|
export default class AdvComponentTypes extends AgentiaCommand {
|
|
5
|
-
static description = 'List Pipelines Advanced component type views';
|
|
5
|
+
static description = 'List Pipelines Advanced component type views; a component type can appear in multiple views';
|
|
6
6
|
static examples = [
|
|
7
7
|
'<%= config.bin %> <%= command.id %>',
|
|
8
8
|
'<%= config.bin %> <%= command.id %> --json',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { advWaitFlags, advYesFlag, confirmAdvAction, requiresAdvExplicitYes } from '../../../lib/adv-flags.js';
|
|
3
|
-
import { runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
3
|
+
import { advRunErrorJson, runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
4
4
|
import { formatAdvRecord } from '../../../lib/adv-types.js';
|
|
5
5
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
6
6
|
import { isPromptCanceled } from '../../../lib/setup-prompts.js';
|
|
@@ -42,5 +42,8 @@ export default class AdvDeploymentDeploy extends AgentiaCommand {
|
|
|
42
42
|
this.display(() => this.log(formatAdvRecord(result)));
|
|
43
43
|
return result;
|
|
44
44
|
}
|
|
45
|
+
toErrorJson(error) {
|
|
46
|
+
return advRunErrorJson(super.toErrorJson(error), error);
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -3,7 +3,7 @@ import { listAdvDeployments } from '../../../lib/adv-operations.js';
|
|
|
3
3
|
import { formatAdvDeployments } from '../../../lib/adv-types.js';
|
|
4
4
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
5
5
|
export default class AdvDeploymentList extends AgentiaCommand {
|
|
6
|
-
static description = 'List Pipelines Advanced deployments visible to the PAT user';
|
|
6
|
+
static description = 'List up to 500 Pipelines Advanced deployments visible to the PAT user; the API does not support filters';
|
|
7
7
|
static examples = [
|
|
8
8
|
'<%= config.bin %> <%= command.id %>',
|
|
9
9
|
'<%= config.bin %> <%= command.id %> --include-archived',
|
|
@@ -18,7 +18,7 @@ export default class AdvDeploymentOptions extends AgentiaCommand {
|
|
|
18
18
|
exclusive: ['set'],
|
|
19
19
|
}),
|
|
20
20
|
set: Flags.string({
|
|
21
|
-
description: 'Deployment option as name=value;
|
|
21
|
+
description: 'Deployment option as name=value; true, false, null, and any finite JavaScript Number value (including hex and exponent notation) are converted.',
|
|
22
22
|
exclusive: ['file'],
|
|
23
23
|
multiple: true,
|
|
24
24
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { advWaitFlags, advYesFlag, confirmAdvAction, requiresAdvExplicitYes } from '../../../lib/adv-flags.js';
|
|
3
|
-
import { runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
3
|
+
import { advRunErrorJson, runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
4
4
|
import { formatAdvRecord } from '../../../lib/adv-types.js';
|
|
5
5
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
6
6
|
import { isPromptCanceled } from '../../../lib/setup-prompts.js';
|
|
@@ -18,7 +18,7 @@ export default class AdvDeploymentQuickDeploy extends AgentiaCommand {
|
|
|
18
18
|
...advYesFlag,
|
|
19
19
|
backup: Flags.boolean({
|
|
20
20
|
default: false,
|
|
21
|
-
description: '
|
|
21
|
+
description: 'Run backupThenDeploy instead of a quick deploy; the returned action reflects backupThenDeploy.',
|
|
22
22
|
}),
|
|
23
23
|
};
|
|
24
24
|
async run() {
|
|
@@ -50,5 +50,8 @@ export default class AdvDeploymentQuickDeploy extends AgentiaCommand {
|
|
|
50
50
|
this.display(() => this.log(formatAdvRecord(result)));
|
|
51
51
|
return result;
|
|
52
52
|
}
|
|
53
|
+
toErrorJson(error) {
|
|
54
|
+
return advRunErrorJson(super.toErrorJson(error), error);
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
//# sourceMappingURL=quick-deploy.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { advWaitFlags } from '../../../lib/adv-flags.js';
|
|
3
|
-
import { runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
3
|
+
import { advRunErrorJson, runAdvDeploymentAction } from '../../../lib/adv-operations.js';
|
|
4
4
|
import { formatAdvRecord } from '../../../lib/adv-types.js';
|
|
5
5
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
6
6
|
export default class AdvDeploymentValidate extends AgentiaCommand {
|
|
@@ -25,5 +25,8 @@ export default class AdvDeploymentValidate extends AgentiaCommand {
|
|
|
25
25
|
this.display(() => this.log(formatAdvRecord(result)));
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
|
+
toErrorJson(error) {
|
|
29
|
+
return advRunErrorJson(super.toErrorJson(error), error);
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
//# sourceMappingURL=validate.js.map
|
|
@@ -6,14 +6,14 @@ export default class AdvJobList extends AgentiaCommand {
|
|
|
6
6
|
static args = {
|
|
7
7
|
'deployment-id': Args.integer({ description: 'Pipelines Advanced deployment ID.', required: true }),
|
|
8
8
|
};
|
|
9
|
-
static description = 'List
|
|
9
|
+
static description = 'List deploy and quick-deploy history for a Pipelines Advanced deployment; validation runs are not included';
|
|
10
10
|
static examples = [
|
|
11
11
|
'<%= config.bin %> <%= command.id %> 1025',
|
|
12
12
|
'<%= config.bin %> <%= command.id %> 1025 --page 1 --page-size 25',
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
-
page: Flags.integer({ description: 'Page number starting at 0.' }),
|
|
16
|
-
'page-size': Flags.integer({ description: 'Rows per page.' }),
|
|
15
|
+
page: Flags.integer({ description: 'Page number starting at 0 (default: 0).' }),
|
|
16
|
+
'page-size': Flags.integer({ description: 'Rows per page (default: 50; server maximum: 100).' }),
|
|
17
17
|
};
|
|
18
18
|
async run() {
|
|
19
19
|
const { args, flags } = await this.parse(AdvJobList);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import { waitForAdvJob } from '../../../lib/adv-operations.js';
|
|
2
|
+
import { advRunErrorJson, assertAdvJobSucceeded, waitForAdvJob } from '../../../lib/adv-operations.js';
|
|
3
3
|
import { formatAdvRecord } from '../../../lib/adv-types.js';
|
|
4
4
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
5
5
|
export default class AdvJobWait extends AgentiaCommand {
|
|
@@ -12,8 +12,8 @@ export default class AdvJobWait extends AgentiaCommand {
|
|
|
12
12
|
'<%= config.bin %> <%= command.id %> 1025 --interval 5 --timeout 1800',
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
-
interval: Flags.integer({ description: 'Seconds between job status polls.' }),
|
|
16
|
-
timeout: Flags.integer({ description: 'Maximum seconds to wait.' }),
|
|
15
|
+
interval: Flags.integer({ description: 'Seconds between job status polls (default: 3).' }),
|
|
16
|
+
timeout: Flags.integer({ description: 'Maximum seconds to wait (default: 3600).' }),
|
|
17
17
|
};
|
|
18
18
|
async run() {
|
|
19
19
|
const { args, flags } = await this.parse(AdvJobWait);
|
|
@@ -22,8 +22,12 @@ export default class AdvJobWait extends AgentiaCommand {
|
|
|
22
22
|
intervalSeconds: flags.interval,
|
|
23
23
|
timeoutSeconds: flags.timeout,
|
|
24
24
|
}));
|
|
25
|
+
assertAdvJobSucceeded(result);
|
|
25
26
|
this.display(() => this.log(formatAdvRecord(result)));
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
29
|
+
toErrorJson(error) {
|
|
30
|
+
return advRunErrorJson(super.toErrorJson(error), error);
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
//# sourceMappingURL=wait.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
4
3
|
import { sanitizeEnvironment } from '../../../lib/environment-credential-operations.js';
|
|
5
|
-
import {
|
|
4
|
+
import { fetchEnvironment } from '../../../lib/environment-get.js';
|
|
5
|
+
import { formatEnvironmentDetail } from '../../../lib/environment-types.js';
|
|
6
6
|
export default class EnvironmentGet extends AgentiaCommand {
|
|
7
7
|
static args = {
|
|
8
8
|
id: Args.string({
|
|
@@ -18,10 +18,7 @@ export default class EnvironmentGet extends AgentiaCommand {
|
|
|
18
18
|
];
|
|
19
19
|
async run() {
|
|
20
20
|
const { args } = await this.parse(EnvironmentGet);
|
|
21
|
-
const environment = sanitizeEnvironment(await this.withSpinner('Fetching environment', () =>
|
|
22
|
-
endpoint: environmentEndpoint(args.id),
|
|
23
|
-
method: 'GET',
|
|
24
|
-
})));
|
|
21
|
+
const environment = sanitizeEnvironment(await this.withSpinner('Fetching environment', () => fetchEnvironment(args.id)));
|
|
25
22
|
this.display(() => {
|
|
26
23
|
this.log(formatEnvironmentDetail(environment));
|
|
27
24
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { buildEnvironmentListFilters, environmentListFilterFlags } from '../../../lib/environment-flags.js';
|
|
4
|
-
import {
|
|
3
|
+
import { fetchEnvironments } from '../../../lib/environment-get.js';
|
|
5
4
|
import { cellValue, table } from '../../../lib/format.js';
|
|
6
5
|
import { buildPaginatedListResult, displayListPagination, pickCursorPageMeta, } from '../../../lib/list-pagination.js';
|
|
7
6
|
export function normalizeEnvironmentsListPage(response) {
|
|
@@ -53,11 +52,7 @@ export default class EnvironmentList extends AgentiaCommand {
|
|
|
53
52
|
async run() {
|
|
54
53
|
const { flags } = await this.parse(EnvironmentList);
|
|
55
54
|
const filters = buildEnvironmentListFilters(flags);
|
|
56
|
-
const
|
|
57
|
-
endpoint: environmentsListEndpoint(filters),
|
|
58
|
-
method: 'GET',
|
|
59
|
-
}));
|
|
60
|
-
const page = normalizeEnvironmentsListPage(response);
|
|
55
|
+
const page = await this.withSpinner('Fetching environments', () => fetchEnvironments(filters));
|
|
61
56
|
this.display(() => {
|
|
62
57
|
if (page.data.length === 0) {
|
|
63
58
|
this.log('No environments found.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatJobDetail
|
|
3
|
+
import { fetchJob } from '../../../lib/job-get.js';
|
|
4
|
+
import { formatJobDetail } from '../../../lib/job-types.js';
|
|
5
5
|
export default class JobGet extends AgentiaCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
id: Args.string({
|
|
@@ -16,11 +16,7 @@ export default class JobGet extends AgentiaCommand {
|
|
|
16
16
|
];
|
|
17
17
|
async run() {
|
|
18
18
|
const { args } = await this.parse(JobGet);
|
|
19
|
-
const
|
|
20
|
-
endpoint: jobEndpoint(args.id),
|
|
21
|
-
method: 'GET',
|
|
22
|
-
}));
|
|
23
|
-
const job = normalizeJob(response);
|
|
19
|
+
const job = await this.withSpinner('Fetching job', () => fetchJob(args.id));
|
|
24
20
|
this.display(() => {
|
|
25
21
|
this.log(formatJobDetail(job));
|
|
26
22
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatJobTable
|
|
3
|
+
import { fetchJobs } from '../../../lib/job-get.js';
|
|
4
|
+
import { formatJobTable } from '../../../lib/job-types.js';
|
|
5
5
|
import { buildListPaginationQuery, displayListPagination, listPaginationFlags, } from '../../../lib/list-pagination.js';
|
|
6
6
|
import { getUserContext } from '../../../lib/user-context.js';
|
|
7
7
|
export default class JobList extends AgentiaCommand {
|
|
@@ -56,11 +56,7 @@ export default class JobList extends AgentiaCommand {
|
|
|
56
56
|
}
|
|
57
57
|
filters.ownerId = userId;
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
endpoint: jobListEndpoint(filters),
|
|
61
|
-
method: 'GET',
|
|
62
|
-
}));
|
|
63
|
-
const page = normalizeJobsListPage(response);
|
|
59
|
+
const page = await this.withSpinner('Fetching jobs', () => fetchJobs(filters));
|
|
64
60
|
this.display(() => {
|
|
65
61
|
if (page.data.length === 0) {
|
|
66
62
|
this.log('No jobs found.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatPipelineDetail
|
|
3
|
+
import { fetchPipeline } from '../../../lib/pipeline-get.js';
|
|
4
|
+
import { formatPipelineDetail } from '../../../lib/pipeline-types.js';
|
|
5
5
|
export default class PipelineGet extends AgentiaCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
id: Args.string({
|
|
@@ -16,11 +16,7 @@ export default class PipelineGet extends AgentiaCommand {
|
|
|
16
16
|
];
|
|
17
17
|
async run() {
|
|
18
18
|
const { args } = await this.parse(PipelineGet);
|
|
19
|
-
const
|
|
20
|
-
endpoint: pipelineDescribeEndpoint(args.id),
|
|
21
|
-
method: 'GET',
|
|
22
|
-
}));
|
|
23
|
-
const pipeline = normalizePipelineDescribe(response);
|
|
19
|
+
const pipeline = await this.withSpinner('Fetching pipeline', () => fetchPipeline(args.id));
|
|
24
20
|
this.display(() => {
|
|
25
21
|
this.log(formatPipelineDetail(pipeline));
|
|
26
22
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { displayListPagination, } from '../../../lib/list-pagination.js';
|
|
4
3
|
import { buildPipelineListFilters, pipelineListFlags } from '../../../lib/pipeline-flags.js';
|
|
5
|
-
import {
|
|
4
|
+
import { fetchPipelines } from '../../../lib/pipeline-get.js';
|
|
5
|
+
import { formatPipelineTable } from '../../../lib/pipeline-types.js';
|
|
6
6
|
export default class PipelineList extends AgentiaCommand {
|
|
7
7
|
static description = 'List Copado pipelines';
|
|
8
8
|
static examples = [
|
|
@@ -13,11 +13,7 @@ export default class PipelineList extends AgentiaCommand {
|
|
|
13
13
|
static flags = pipelineListFlags;
|
|
14
14
|
async run() {
|
|
15
15
|
const { flags } = await this.parse(PipelineList);
|
|
16
|
-
const
|
|
17
|
-
endpoint: pipelineListEndpoint(buildPipelineListFilters(flags)),
|
|
18
|
-
method: 'GET',
|
|
19
|
-
}));
|
|
20
|
-
const page = normalizePipelinesListPage(response);
|
|
16
|
+
const page = await this.withSpinner('Fetching pipelines', () => fetchPipelines(buildPipelineListFilters(flags)));
|
|
21
17
|
this.display(() => {
|
|
22
18
|
if (page.data.length === 0) {
|
|
23
19
|
this.log('No pipelines found.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatProjectDetail
|
|
3
|
+
import { fetchProject } from '../../../lib/project-get.js';
|
|
4
|
+
import { formatProjectDetail } from '../../../lib/project-types.js';
|
|
5
5
|
export default class ProjectGet extends AgentiaCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
id: Args.string({
|
|
@@ -17,11 +17,7 @@ export default class ProjectGet extends AgentiaCommand {
|
|
|
17
17
|
];
|
|
18
18
|
async run() {
|
|
19
19
|
const { args } = await this.parse(ProjectGet);
|
|
20
|
-
const
|
|
21
|
-
endpoint: projectEndpoint(args.id),
|
|
22
|
-
method: 'GET',
|
|
23
|
-
}));
|
|
24
|
-
const project = normalizeProject(response);
|
|
20
|
+
const project = await this.withSpinner('Fetching project', () => fetchProject(args.id));
|
|
25
21
|
this.display(() => {
|
|
26
22
|
this.log(formatProjectDetail(project));
|
|
27
23
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { displayListPagination } from '../../../lib/list-pagination.js';
|
|
4
3
|
import { buildProjectListFilters, projectListFlags, validateProjectListFilters, } from '../../../lib/project-flags.js';
|
|
5
|
-
import {
|
|
4
|
+
import { fetchProjects } from '../../../lib/project-get.js';
|
|
5
|
+
import { formatProjectTable } from '../../../lib/project-types.js';
|
|
6
6
|
export default class ProjectList extends AgentiaCommand {
|
|
7
7
|
static description = 'List Copado projects';
|
|
8
8
|
static examples = [
|
|
@@ -19,11 +19,7 @@ export default class ProjectList extends AgentiaCommand {
|
|
|
19
19
|
if (validationError !== undefined) {
|
|
20
20
|
this.error(validationError, { exit: 2 });
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
endpoint: projectsListEndpoint(filters),
|
|
24
|
-
method: 'GET',
|
|
25
|
-
}));
|
|
26
|
-
const page = normalizeProjectsListPage(response);
|
|
22
|
+
const page = await this.withSpinner('Fetching projects', () => fetchProjects(filters));
|
|
27
23
|
this.display(() => {
|
|
28
24
|
if (page.data.length === 0) {
|
|
29
25
|
this.log('No projects found.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatPromotionDetail
|
|
3
|
+
import { fetchPromotion } from '../../../lib/promotion-get.js';
|
|
4
|
+
import { formatPromotionDetail } from '../../../lib/promotion-types.js';
|
|
5
5
|
export default class PromotionGet extends AgentiaCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
id: Args.string({
|
|
@@ -17,11 +17,7 @@ export default class PromotionGet extends AgentiaCommand {
|
|
|
17
17
|
];
|
|
18
18
|
async run() {
|
|
19
19
|
const { args } = await this.parse(PromotionGet);
|
|
20
|
-
const
|
|
21
|
-
endpoint: promotionEndpoint(args.id),
|
|
22
|
-
method: 'GET',
|
|
23
|
-
}));
|
|
24
|
-
const promotion = normalizePromotionDetail(response);
|
|
20
|
+
const promotion = await this.withSpinner('Fetching promotion', () => fetchPromotion(args.id));
|
|
25
21
|
this.display(() => {
|
|
26
22
|
this.log(formatPromotionDetail(promotion));
|
|
27
23
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { displayListPagination } from '../../../lib/list-pagination.js';
|
|
4
3
|
import { buildPromotionListFilters, promotionListFilterFlags } from '../../../lib/promotion-flags.js';
|
|
5
|
-
import {
|
|
4
|
+
import { fetchPromotions } from '../../../lib/promotion-get.js';
|
|
5
|
+
import { formatPromotionTable } from '../../../lib/promotion-types.js';
|
|
6
6
|
export const PROMOTION_TABLE_DISPLAY_LIMIT = 100;
|
|
7
7
|
export function selectPromotionsForTableDisplay(promotions) {
|
|
8
8
|
const total = promotions.length;
|
|
@@ -27,11 +27,7 @@ export default class PromotionList extends AgentiaCommand {
|
|
|
27
27
|
async run() {
|
|
28
28
|
const { flags } = await this.parse(PromotionList);
|
|
29
29
|
const filters = buildPromotionListFilters(flags);
|
|
30
|
-
const
|
|
31
|
-
endpoint: promotionListEndpoint(filters),
|
|
32
|
-
method: 'GET',
|
|
33
|
-
}));
|
|
34
|
-
const page = normalizePromotionsListPage(response);
|
|
30
|
+
const page = await this.withSpinner('Fetching promotions', () => fetchPromotions(filters));
|
|
35
31
|
this.display(() => {
|
|
36
32
|
if (page.data.length === 0) {
|
|
37
33
|
this.log('No promotions found.');
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { displayListPagination, listPaginationFlags } from '../../../lib/list-pagination.js';
|
|
4
|
-
import {
|
|
3
|
+
import { fetchStages } from '../../../lib/stage-list.js';
|
|
4
|
+
import { formatStageTable } from '../../../lib/stage-types.js';
|
|
5
5
|
export default class StageList extends AgentiaCommand {
|
|
6
6
|
static description = 'List Copado stages';
|
|
7
7
|
static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --json'];
|
|
8
8
|
static flags = listPaginationFlags;
|
|
9
9
|
async run() {
|
|
10
10
|
const { flags } = await this.parse(StageList);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const page = await this.withSpinner('Fetching stages', () => fetchStages({
|
|
12
|
+
cursor: flags.cursor,
|
|
13
|
+
pageSize: flags['page-size'],
|
|
14
14
|
}));
|
|
15
|
-
const page = normalizeStagesListPage(response);
|
|
16
15
|
this.display(() => {
|
|
17
16
|
if (page.data.length === 0) {
|
|
18
17
|
this.log('No stages found.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_USER_ID, formatUserDetail
|
|
3
|
+
import { fetchUser } from '../../../lib/user-get.js';
|
|
4
|
+
import { DEFAULT_USER_ID, formatUserDetail } from '../../../lib/user-types.js';
|
|
5
5
|
export default class UserGet extends AgentiaCommand {
|
|
6
6
|
static description = 'Get a Copado user by ID (defaults to the authenticated user)';
|
|
7
7
|
static examples = [
|
|
@@ -18,11 +18,7 @@ export default class UserGet extends AgentiaCommand {
|
|
|
18
18
|
};
|
|
19
19
|
async run() {
|
|
20
20
|
const { flags } = await this.parse(UserGet);
|
|
21
|
-
const
|
|
22
|
-
const user = await this.withSpinner('Fetching user', () => CicdGateway.call({
|
|
23
|
-
endpoint: userEndpoint(userId),
|
|
24
|
-
method: 'GET',
|
|
25
|
-
}));
|
|
21
|
+
const user = await this.withSpinner('Fetching user', () => fetchUser(flags.id));
|
|
26
22
|
this.display(() => {
|
|
27
23
|
this.log(formatUserDetail(user));
|
|
28
24
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
3
|
import { WorkActiveResolutionError } from '../../../lib/work-active.js';
|
|
4
|
-
import {
|
|
4
|
+
import { fetchWorkItem } from '../../../lib/work-get.js';
|
|
5
5
|
import { formatUserStoriesAheadBehindLines, reportUserStoriesAheadBehindForStory, } from '../../../lib/work-submit-ahead-behind.js';
|
|
6
6
|
import { formatUserStoryDetail, } from '../../../lib/work-types.js';
|
|
7
7
|
export default class WorkGet extends AgentiaCommand {
|
|
@@ -29,7 +29,7 @@ export default class WorkGet extends AgentiaCommand {
|
|
|
29
29
|
const { args, flags } = await this.parse(WorkGet);
|
|
30
30
|
let userStory;
|
|
31
31
|
try {
|
|
32
|
-
userStory = await this.withSpinner('Fetching user story', () =>
|
|
32
|
+
userStory = await this.withSpinner('Fetching user story', () => fetchWorkItem(args.id));
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
35
35
|
if (error instanceof WorkActiveResolutionError) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
3
2
|
import { displayListPagination } from '../../../lib/list-pagination.js';
|
|
4
3
|
import { getUserContext } from '../../../lib/user-context.js';
|
|
5
4
|
import { buildWorkListFilters, workListFilterFlags } from '../../../lib/work-flags.js';
|
|
6
|
-
import {
|
|
5
|
+
import { fetchWorkItems } from '../../../lib/work-get.js';
|
|
6
|
+
import { formatUserStoryTable } from '../../../lib/work-types.js';
|
|
7
7
|
export default class WorkList extends AgentiaCommand {
|
|
8
8
|
static description = 'List Copado user stories';
|
|
9
9
|
static examples = [
|
|
@@ -41,11 +41,7 @@ export default class WorkList extends AgentiaCommand {
|
|
|
41
41
|
filters.ownerId = userId;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
endpoint: workListEndpoint(filters),
|
|
46
|
-
method: 'GET',
|
|
47
|
-
}));
|
|
48
|
-
const page = normalizeUserStoriesListPage(response);
|
|
44
|
+
const page = await this.withSpinner('Fetching user stories', () => fetchWorkItems(filters));
|
|
49
45
|
this.display(() => {
|
|
50
46
|
if (page.data.length === 0) {
|
|
51
47
|
this.log('No user stories found.');
|
|
@@ -36,6 +36,7 @@ export default class WorkPromote extends AgentiaCommand {
|
|
|
36
36
|
'<%= config.bin %> <%= command.id %> --promotion=P29354 --abort',
|
|
37
37
|
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC --json',
|
|
38
38
|
];
|
|
39
|
+
static experimental = true;
|
|
39
40
|
static flags = {
|
|
40
41
|
abort: Flags.boolean({
|
|
41
42
|
default: false,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {modules} from './runtime.js';
|
|
2
|
+
const AdvRunFailedError = modules["adv-operations.js"]["AdvRunFailedError"]
|
|
2
3
|
const addAdvComponents = modules["adv-operations.js"]["addAdvComponents"]
|
|
4
|
+
const advRunErrorJson = modules["adv-operations.js"]["advRunErrorJson"]
|
|
5
|
+
const assertAdvJobSucceeded = modules["adv-operations.js"]["assertAdvJobSucceeded"]
|
|
3
6
|
const cancelAdvDeployment = modules["adv-operations.js"]["cancelAdvDeployment"]
|
|
4
7
|
const createAdvDeployment = modules["adv-operations.js"]["createAdvDeployment"]
|
|
5
8
|
const deriveAdvJobResult = modules["adv-operations.js"]["deriveAdvJobResult"]
|
|
@@ -23,4 +26,4 @@ const selectedAdvComponents = modules["adv-operations.js"]["selectedAdvComponent
|
|
|
23
26
|
const updateAdvDeploymentOptions = modules["adv-operations.js"]["updateAdvDeploymentOptions"]
|
|
24
27
|
const validateAdvOrganization = modules["adv-operations.js"]["validateAdvOrganization"]
|
|
25
28
|
const waitForAdvJob = modules["adv-operations.js"]["waitForAdvJob"]
|
|
26
|
-
export {addAdvComponents, cancelAdvDeployment, createAdvDeployment, deriveAdvJobResult, getAdvAuthStatus, getAdvDeployment, getAdvJob, getAdvOrganization, getStoredAdvAuthSummary, listAdvComponentTypes, listAdvComponents, listAdvDeployments, listAdvJobs, listAdvOrganizations, parseAdvComponentSpec, readAdvComponentsFromJsonFile, readAdvComponentsFromTextFile, refreshAdvComponents, removeAdvComponents, runAdvDeploymentAction, selectedAdvComponents, updateAdvDeploymentOptions, validateAdvOrganization, waitForAdvJob};
|
|
29
|
+
export {AdvRunFailedError, addAdvComponents, advRunErrorJson, assertAdvJobSucceeded, cancelAdvDeployment, createAdvDeployment, deriveAdvJobResult, getAdvAuthStatus, getAdvDeployment, getAdvJob, getAdvOrganization, getStoredAdvAuthSummary, listAdvComponentTypes, listAdvComponents, listAdvDeployments, listAdvJobs, listAdvOrganizations, parseAdvComponentSpec, readAdvComponentsFromJsonFile, readAdvComponentsFromTextFile, refreshAdvComponents, removeAdvComponents, runAdvDeploymentAction, selectedAdvComponents, updateAdvDeploymentOptions, validateAdvOrganization, waitForAdvJob};
|
|
@@ -5,6 +5,7 @@ import { colorizeCliSeverityError, colorizeCliSeverityText } from './cli-severit
|
|
|
5
5
|
import { isCommandOutputCaptureActive } from './command-output-buffer.js';
|
|
6
6
|
import { rememberIdeCommandError } from './ide-command-events.js';
|
|
7
7
|
const TRANSACTION_ID_REPORTED = Symbol('agentiaTransactionIdReported');
|
|
8
|
+
const EXPERIMENTAL_COMMAND_WARNING = 'This command is experimental and may change without notice.';
|
|
8
9
|
export function elapsedSecondsSince(startedAtMs, nowMs = Date.now()) {
|
|
9
10
|
return Math.max(0, Math.floor((nowMs - startedAtMs) / 1000));
|
|
10
11
|
}
|
|
@@ -13,6 +14,7 @@ export function formatElapsedSecondsMessage(seconds) {
|
|
|
13
14
|
}
|
|
14
15
|
export class AgentiaCommand extends Command {
|
|
15
16
|
static enableJsonFlag = true;
|
|
17
|
+
static experimental = false;
|
|
16
18
|
commandTransactionId;
|
|
17
19
|
async _run() {
|
|
18
20
|
const transactionId = createTransactionId();
|
|
@@ -50,6 +52,12 @@ export class AgentiaCommand extends Command {
|
|
|
50
52
|
rememberIdeCommandError(error);
|
|
51
53
|
return super.finally(error);
|
|
52
54
|
}
|
|
55
|
+
async init() {
|
|
56
|
+
await super.init();
|
|
57
|
+
if (this.isExperimentalCommand() && !this.jsonEnabled()) {
|
|
58
|
+
this.warn(EXPERIMENTAL_COMMAND_WARNING);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
53
61
|
log(message, ...args) {
|
|
54
62
|
if (this.jsonEnabled() && isCommandOutputCaptureActive()) {
|
|
55
63
|
const formatted = format(message ?? '', ...args);
|
|
@@ -65,10 +73,21 @@ export class AgentiaCommand extends Command {
|
|
|
65
73
|
}
|
|
66
74
|
toErrorJson(err) {
|
|
67
75
|
const base = super.toErrorJson(err);
|
|
68
|
-
|
|
76
|
+
const warnings = this.jsonWarnings();
|
|
77
|
+
return {
|
|
78
|
+
...base,
|
|
79
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
80
|
+
transactionId: this.commandTransactionId,
|
|
81
|
+
};
|
|
69
82
|
}
|
|
70
83
|
toSuccessJson(result) {
|
|
71
|
-
|
|
84
|
+
const warnings = this.jsonWarnings(result);
|
|
85
|
+
return {
|
|
86
|
+
result,
|
|
87
|
+
status: 0,
|
|
88
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
89
|
+
transactionId: this.commandTransactionId,
|
|
90
|
+
};
|
|
72
91
|
}
|
|
73
92
|
warn(input) {
|
|
74
93
|
if (this.jsonEnabled()) {
|
|
@@ -98,6 +117,16 @@ export class AgentiaCommand extends Command {
|
|
|
98
117
|
throw error;
|
|
99
118
|
}
|
|
100
119
|
}
|
|
120
|
+
isExperimentalCommand() {
|
|
121
|
+
return this.constructor.experimental === true;
|
|
122
|
+
}
|
|
123
|
+
jsonWarnings(result) {
|
|
124
|
+
const warnings = [
|
|
125
|
+
...(this.isExperimentalCommand() ? [EXPERIMENTAL_COMMAND_WARNING] : []),
|
|
126
|
+
...this.resultWarnings(result),
|
|
127
|
+
];
|
|
128
|
+
return [...new Set(warnings)];
|
|
129
|
+
}
|
|
101
130
|
reportHumanErrorTransactionId(error) {
|
|
102
131
|
if (this.jsonEnabled() || this.commandTransactionId === undefined) {
|
|
103
132
|
return;
|
|
@@ -109,5 +138,12 @@ export class AgentiaCommand extends Command {
|
|
|
109
138
|
reportedError[TRANSACTION_ID_REPORTED] = true;
|
|
110
139
|
this.logToStderr(`Transaction ID: ${this.commandTransactionId}`);
|
|
111
140
|
}
|
|
141
|
+
resultWarnings(result) {
|
|
142
|
+
if (typeof result !== 'object' || result === null || Array.isArray(result)) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
const { warnings } = result;
|
|
146
|
+
return Array.isArray(warnings) ? warnings.filter((warning) => typeof warning === 'string') : [];
|
|
147
|
+
}
|
|
112
148
|
}
|
|
113
149
|
//# sourceMappingURL=agentia-command.js.map
|
package/dist/lib/ai-config.js
CHANGED
|
@@ -4,6 +4,8 @@ const AI_DEFAULT_WORKSPACE_NAME = modules["ai-config.js"]["AI_DEFAULT_WORKSPACE_
|
|
|
4
4
|
const AI_DISCOVERY_DOMAINS = modules["ai-config.js"]["AI_DISCOVERY_DOMAINS"]
|
|
5
5
|
const AI_GATEWAY_HOST_PREFIX = modules["ai-config.js"]["AI_GATEWAY_HOST_PREFIX"]
|
|
6
6
|
const aiBaseUrl = modules["ai-config.js"]["aiBaseUrl"]
|
|
7
|
+
const evaluateAiReady = modules["ai-config.js"]["evaluateAiReady"]
|
|
8
|
+
const isAiReady = modules["ai-config.js"]["isAiReady"]
|
|
7
9
|
const normalizeAiDialogueId = modules["ai-config.js"]["normalizeAiDialogueId"]
|
|
8
10
|
const normalizeAiDomain = modules["ai-config.js"]["normalizeAiDomain"]
|
|
9
11
|
const normalizeAiGatewayUrl = modules["ai-config.js"]["normalizeAiGatewayUrl"]
|
|
@@ -11,4 +13,4 @@ const normalizeAiOrgId = modules["ai-config.js"]["normalizeAiOrgId"]
|
|
|
11
13
|
const normalizeAiUuid = modules["ai-config.js"]["normalizeAiUuid"]
|
|
12
14
|
const normalizeAiWorkspaceId = modules["ai-config.js"]["normalizeAiWorkspaceId"]
|
|
13
15
|
const resolveAiCredentials = modules["ai-config.js"]["resolveAiCredentials"]
|
|
14
|
-
export {AI_DEFAULT_TIMEOUT_MS, AI_DEFAULT_WORKSPACE_NAME, AI_DISCOVERY_DOMAINS, AI_GATEWAY_HOST_PREFIX, aiBaseUrl, normalizeAiDialogueId, normalizeAiDomain, normalizeAiGatewayUrl, normalizeAiOrgId, normalizeAiUuid, normalizeAiWorkspaceId, resolveAiCredentials};
|
|
16
|
+
export {AI_DEFAULT_TIMEOUT_MS, AI_DEFAULT_WORKSPACE_NAME, AI_DISCOVERY_DOMAINS, AI_GATEWAY_HOST_PREFIX, aiBaseUrl, evaluateAiReady, isAiReady, normalizeAiDialogueId, normalizeAiDomain, normalizeAiGatewayUrl, normalizeAiOrgId, normalizeAiUuid, normalizeAiWorkspaceId, resolveAiCredentials};
|