@copado/agentia-cli 0.5.0-alpha.0 → 0.7.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.
- package/README.md +1106 -83
- package/dist/commands/auth/get.d.ts +23 -0
- package/dist/commands/auth/get.js +73 -0
- package/dist/commands/auth/get.js.map +1 -0
- package/dist/commands/auth/set.d.ts +21 -0
- package/dist/commands/auth/set.js +113 -0
- package/dist/commands/auth/set.js.map +1 -0
- package/dist/commands/environment/auth/status.d.ts +13 -0
- package/dist/commands/environment/auth/status.js +36 -0
- package/dist/commands/environment/auth/status.js.map +1 -0
- package/dist/commands/environment/auth/web/login.d.ts +15 -0
- package/dist/commands/environment/auth/web/login.js +55 -0
- package/dist/commands/environment/auth/web/login.js.map +1 -0
- package/dist/commands/environment/create.d.ts +22 -0
- package/dist/commands/environment/create.js +41 -0
- package/dist/commands/environment/create.js.map +1 -0
- package/dist/commands/environment/get.d.ts +10 -0
- package/dist/commands/environment/get.js +30 -0
- package/dist/commands/environment/get.js.map +1 -0
- package/dist/commands/environment/list.d.ts +17 -0
- package/dist/commands/environment/list.js +69 -0
- package/dist/commands/environment/list.js.map +1 -0
- package/dist/commands/environment/update.d.ts +23 -0
- package/dist/commands/environment/update.js +70 -0
- package/dist/commands/environment/update.js.map +1 -0
- package/dist/commands/job/get.d.ts +14 -0
- package/dist/commands/job/get.js +33 -0
- package/dist/commands/job/get.js.map +1 -0
- package/dist/commands/job/kill.d.ts +14 -0
- package/dist/commands/job/kill.js +34 -0
- package/dist/commands/job/kill.js.map +1 -0
- package/dist/commands/job/list.d.ts +18 -0
- package/dist/commands/job/list.js +68 -0
- package/dist/commands/job/list.js.map +1 -0
- package/dist/commands/job/pause.d.ts +14 -0
- package/dist/commands/job/pause.js +34 -0
- package/dist/commands/job/pause.js.map +1 -0
- package/dist/commands/job/resume.d.ts +14 -0
- package/dist/commands/job/resume.js +34 -0
- package/dist/commands/job/resume.js.map +1 -0
- package/dist/commands/job/run.d.ts +15 -0
- package/dist/commands/job/run.js +40 -0
- package/dist/commands/job/run.js.map +1 -0
- package/dist/commands/mcp/start.d.ts +7 -0
- package/dist/commands/mcp/start.js +15 -0
- package/dist/commands/mcp/start.js.map +1 -0
- package/dist/commands/metadata/content/compare.d.ts +40 -0
- package/dist/commands/metadata/content/compare.js +127 -0
- package/dist/commands/metadata/content/compare.js.map +1 -0
- package/dist/commands/metadata/content/get.d.ts +39 -0
- package/dist/commands/metadata/content/get.js +158 -0
- package/dist/commands/metadata/content/get.js.map +1 -0
- package/dist/commands/metadata/dependency/list.d.ts +49 -0
- package/dist/commands/metadata/dependency/list.js +216 -0
- package/dist/commands/metadata/dependency/list.js.map +1 -0
- package/dist/commands/metadata/index/compare.d.ts +34 -0
- package/dist/commands/metadata/index/compare.js +100 -0
- package/dist/commands/metadata/index/compare.js.map +1 -0
- package/dist/commands/metadata/list.d.ts +56 -0
- package/dist/commands/metadata/list.js +133 -0
- package/dist/commands/metadata/list.js.map +1 -0
- package/dist/commands/metadata/refresh/deleted.d.ts +15 -0
- package/dist/commands/metadata/refresh/deleted.js +55 -0
- package/dist/commands/metadata/refresh/deleted.js.map +1 -0
- package/dist/commands/metadata/refresh/run.d.ts +23 -0
- package/dist/commands/metadata/refresh/run.js +95 -0
- package/dist/commands/metadata/refresh/run.js.map +1 -0
- package/dist/commands/metadata/refresh/status.d.ts +14 -0
- package/dist/commands/metadata/refresh/status.js +49 -0
- package/dist/commands/metadata/refresh/status.js.map +1 -0
- package/dist/commands/pipeline/connection/list.d.ts +12 -0
- package/dist/commands/pipeline/connection/list.js +39 -0
- package/dist/commands/pipeline/connection/list.js.map +1 -0
- package/dist/commands/pipeline/get.d.ts +14 -0
- package/dist/commands/pipeline/get.js +33 -0
- package/dist/commands/pipeline/get.js.map +1 -0
- package/dist/commands/pipeline/list.d.ts +11 -0
- package/dist/commands/pipeline/list.js +30 -0
- package/dist/commands/pipeline/list.js.map +1 -0
- package/dist/commands/project/default/get.d.ts +21 -0
- package/dist/commands/project/default/get.js +44 -0
- package/dist/commands/project/default/get.js.map +1 -0
- package/dist/commands/project/default/set.d.ts +21 -0
- package/dist/commands/project/default/set.js +55 -0
- package/dist/commands/project/default/set.js.map +1 -0
- package/dist/commands/project/default/unset.d.ts +21 -0
- package/dist/commands/project/default/unset.js +45 -0
- package/dist/commands/project/default/unset.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agentia-command.d.ts +7 -0
- package/dist/lib/agentia-command.js +28 -0
- package/dist/lib/agentia-command.js.map +1 -0
- package/dist/lib/agentia-oauth-error-codes.d.ts +17 -0
- package/dist/lib/agentia-oauth-error-codes.js +30 -0
- package/dist/lib/agentia-oauth-error-codes.js.map +1 -0
- package/dist/lib/assert.d.ts +1 -0
- package/dist/lib/assert.js +7 -0
- package/dist/lib/assert.js.map +1 -0
- package/dist/lib/cicd-gateway.d.ts +57 -0
- package/dist/lib/cicd-gateway.js +221 -0
- package/dist/lib/cicd-gateway.js.map +1 -0
- package/dist/lib/cicd-region.d.ts +4 -0
- package/dist/lib/cicd-region.js +8 -0
- package/dist/lib/cicd-region.js.map +1 -0
- package/dist/lib/credential-store.d.ts +18 -0
- package/dist/lib/credential-store.js +43 -0
- package/dist/lib/credential-store.js.map +1 -0
- package/dist/lib/defaults-store.d.ts +12 -0
- package/dist/lib/defaults-store.js +142 -0
- package/dist/lib/defaults-store.js.map +1 -0
- package/dist/lib/dependency-from-changes.d.ts +6 -0
- package/dist/lib/dependency-from-changes.js +97 -0
- package/dist/lib/dependency-from-changes.js.map +1 -0
- package/dist/lib/environment-auth-status.d.ts +18 -0
- package/dist/lib/environment-auth-status.js +74 -0
- package/dist/lib/environment-auth-status.js.map +1 -0
- package/dist/lib/environment-auth.d.ts +26 -0
- package/dist/lib/environment-auth.js +150 -0
- package/dist/lib/environment-auth.js.map +1 -0
- package/dist/lib/environment-credential-selection.d.ts +14 -0
- package/dist/lib/environment-credential-selection.js +60 -0
- package/dist/lib/environment-credential-selection.js.map +1 -0
- package/dist/lib/environment-flags.d.ts +81 -0
- package/dist/lib/environment-flags.js +134 -0
- package/dist/lib/environment-flags.js.map +1 -0
- package/dist/lib/environment-types.d.ts +84 -0
- package/dist/lib/environment-types.js +52 -0
- package/dist/lib/environment-types.js.map +1 -0
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.js +8 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/job-types.d.ts +85 -0
- package/dist/lib/job-types.js +115 -0
- package/dist/lib/job-types.js.map +1 -0
- package/dist/lib/loopback-callback-server.d.ts +35 -0
- package/dist/lib/loopback-callback-server.js +162 -0
- package/dist/lib/loopback-callback-server.js.map +1 -0
- package/dist/lib/mcp/redaction.d.ts +2 -0
- package/dist/lib/mcp/redaction.js +24 -0
- package/dist/lib/mcp/redaction.js.map +1 -0
- package/dist/lib/mcp/result.d.ts +37 -0
- package/dist/lib/mcp/result.js +39 -0
- package/dist/lib/mcp/result.js.map +1 -0
- package/dist/lib/mcp/server.d.ts +5 -0
- package/dist/lib/mcp/server.js +24 -0
- package/dist/lib/mcp/server.js.map +1 -0
- package/dist/lib/mcp/tools.d.ts +235 -0
- package/dist/lib/mcp/tools.js +683 -0
- package/dist/lib/mcp/tools.js.map +1 -0
- package/dist/lib/metadata-common.d.ts +159 -0
- package/dist/lib/metadata-common.js +234 -0
- package/dist/lib/metadata-common.js.map +1 -0
- package/dist/lib/metadata-refresh.d.ts +68 -0
- package/dist/lib/metadata-refresh.js +104 -0
- package/dist/lib/metadata-refresh.js.map +1 -0
- package/dist/lib/open-browser.d.ts +8 -0
- package/dist/lib/open-browser.js +40 -0
- package/dist/lib/open-browser.js.map +1 -0
- package/dist/lib/pipeline-flags.d.ts +10 -0
- package/dist/lib/pipeline-flags.js +18 -0
- package/dist/lib/pipeline-flags.js.map +1 -0
- package/dist/lib/pipeline-types.d.ts +84 -0
- package/dist/lib/pipeline-types.js +67 -0
- package/dist/lib/pipeline-types.js.map +1 -0
- package/dist/lib/project-default-flags.d.ts +41 -0
- package/dist/lib/project-default-flags.js +82 -0
- package/dist/lib/project-default-flags.js.map +1 -0
- package/dist/lib/project-defaults.d.ts +23 -0
- package/dist/lib/project-defaults.js +51 -0
- package/dist/lib/project-defaults.js.map +1 -0
- package/dist/lib/user-context-types.d.ts +12 -0
- package/dist/lib/user-context-types.js +2 -0
- package/dist/lib/user-context-types.js.map +1 -0
- package/oclif.manifest.json +2315 -2
- package/package.json +5 -2
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { normalizeEnvironments } from '../../commands/environment/list.js';
|
|
3
|
+
import { buildMetadataCompareFileRequests } from '../../commands/metadata/content/compare.js';
|
|
4
|
+
import { buildMetadataContentRequest } from '../../commands/metadata/content/get.js';
|
|
5
|
+
import { buildMetadataCompareRequest } from '../../commands/metadata/index/compare.js';
|
|
6
|
+
import { buildMetadataIndexRequest } from '../../commands/metadata/list.js';
|
|
7
|
+
import { assertRequired } from '../assert.js';
|
|
8
|
+
import { CicdGateway } from '../cicd-gateway.js';
|
|
9
|
+
import { readDefaults, resolveDefaults, unsetDefaults, writeDefaults } from '../defaults-store.js';
|
|
10
|
+
import { buildCreatePayload, buildMutationPayload, ENVIRONMENT_STRING_VALIDATION_KEYS, validateNonEmptyStringFields, } from '../environment-flags.js';
|
|
11
|
+
import { DEFAULT_ENVIRONMENT_PLATFORM, DEFAULT_ENVIRONMENT_TYPE, ENVIRONMENT_TYPES, environmentEndpoint, } from '../environment-types.js';
|
|
12
|
+
import { JOB_LIST_LIMIT_MAX, JOB_LIST_LIMIT_MIN, jobEndpoint, jobKillEndpoint, jobListEndpoint, jobPauseEndpoint, jobResumeEndpoint, jobRunEndpoint, normalizeJob, normalizeJobOperation, normalizeJobs, } from '../job-types.js';
|
|
13
|
+
import { COMPARISON_MODES, CONTENT_SOURCES, contentResultToCompareSide, createUnifiedDiff, INDEX_SOURCES, MODULE_TYPES, ORDER_DIRECTIONS, PLATFORM_EXPERIENCES, RETRIEVE_MODES, sourceSideLabel, } from '../metadata-common.js';
|
|
14
|
+
import { pipelineHeaders } from '../pipeline-flags.js';
|
|
15
|
+
import { normalizePipelineDescribe, normalizePipelines, pipelineConnectionsFromPipelines, pipelineDescribeEndpoint, pipelineListEndpoint, } from '../pipeline-types.js';
|
|
16
|
+
import { buildSetValues, collectSelectedKeys } from '../project-default-flags.js';
|
|
17
|
+
import { PROJECT_DEFAULT_KEYS } from '../project-defaults.js';
|
|
18
|
+
import { safelyHandleTool } from './result.js';
|
|
19
|
+
const MAX_LIMIT = 2000;
|
|
20
|
+
async function environmentList(args = {}) {
|
|
21
|
+
const response = await CicdGateway.call({
|
|
22
|
+
endpoint: '/corpus/environments',
|
|
23
|
+
method: 'GET',
|
|
24
|
+
});
|
|
25
|
+
const environments = normalizeEnvironments(response);
|
|
26
|
+
const limit = args.limit === undefined ? environments.length : Math.min(Math.max(args.limit, 1), MAX_LIMIT);
|
|
27
|
+
return { environments: environments.slice(0, limit) };
|
|
28
|
+
}
|
|
29
|
+
async function environmentGet(args) {
|
|
30
|
+
const environment = await CicdGateway.call({
|
|
31
|
+
endpoint: environmentEndpoint(assertRequired(args.id, 'id')),
|
|
32
|
+
method: 'GET',
|
|
33
|
+
});
|
|
34
|
+
return { environment };
|
|
35
|
+
}
|
|
36
|
+
async function environmentCreate(args) {
|
|
37
|
+
const payload = buildCreatePayload(args.name, {
|
|
38
|
+
'apex-test-level': args.apexTestLevel,
|
|
39
|
+
'enable-rollback': args.enableRollback,
|
|
40
|
+
'index-back-promotion-metadata': args.indexBackPromotionMetadata,
|
|
41
|
+
name: args.name,
|
|
42
|
+
namespace: args.namespace,
|
|
43
|
+
platform: args.platform ?? DEFAULT_ENVIRONMENT_PLATFORM,
|
|
44
|
+
'promotion-default-credential': args.promotionDefaultCredential,
|
|
45
|
+
'run-local-tests': args.runLocalTests,
|
|
46
|
+
'run-specified-tests': args.runSpecifiedTests,
|
|
47
|
+
type: args.type ?? DEFAULT_ENVIRONMENT_TYPE,
|
|
48
|
+
'validation-promotion-default-credential': args.validationPromotionDefaultCredential,
|
|
49
|
+
});
|
|
50
|
+
const validationError = validateNonEmptyStringFields(payload, ENVIRONMENT_STRING_VALIDATION_KEYS);
|
|
51
|
+
if (validationError !== undefined) {
|
|
52
|
+
throw new Error(validationError);
|
|
53
|
+
}
|
|
54
|
+
const environment = await CicdGateway.call({
|
|
55
|
+
body: payload,
|
|
56
|
+
endpoint: '/corpus/environments',
|
|
57
|
+
headers: { 'Content-Type': 'application/json' },
|
|
58
|
+
method: 'POST',
|
|
59
|
+
});
|
|
60
|
+
return { environment };
|
|
61
|
+
}
|
|
62
|
+
async function environmentUpdate(args) {
|
|
63
|
+
const flags = {
|
|
64
|
+
'apex-test-level': args.apexTestLevel,
|
|
65
|
+
'enable-rollback': args.enableRollback,
|
|
66
|
+
'index-back-promotion-metadata': args.indexBackPromotionMetadata,
|
|
67
|
+
name: args.name,
|
|
68
|
+
namespace: args.namespace,
|
|
69
|
+
platform: args.platform,
|
|
70
|
+
'promotion-default-credential': args.promotionDefaultCredential,
|
|
71
|
+
'run-local-tests': args.runLocalTests,
|
|
72
|
+
'run-specified-tests': args.runSpecifiedTests,
|
|
73
|
+
type: args.type,
|
|
74
|
+
'validation-promotion-default-credential': args.validationPromotionDefaultCredential,
|
|
75
|
+
};
|
|
76
|
+
let payload = buildMutationPayload(flags);
|
|
77
|
+
if (Object.keys(payload).length === 0) {
|
|
78
|
+
throw new Error('Must provide at least one field to update.');
|
|
79
|
+
}
|
|
80
|
+
const validationError = validateNonEmptyStringFields(payload, ENVIRONMENT_STRING_VALIDATION_KEYS);
|
|
81
|
+
if (validationError !== undefined) {
|
|
82
|
+
throw new Error(validationError);
|
|
83
|
+
}
|
|
84
|
+
if (payload.name === undefined || payload.platform === undefined) {
|
|
85
|
+
const currentEnvironment = await CicdGateway.call({
|
|
86
|
+
endpoint: environmentEndpoint(assertRequired(args.id, 'id')),
|
|
87
|
+
method: 'GET',
|
|
88
|
+
});
|
|
89
|
+
payload = {
|
|
90
|
+
...payload,
|
|
91
|
+
name: payload.name ?? currentEnvironment.name ?? undefined,
|
|
92
|
+
platform: payload.platform ?? currentEnvironment.platform ?? undefined,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (payload.name === undefined || payload.platform === undefined) {
|
|
96
|
+
throw new Error('Environment name and platform are required to update an environment.');
|
|
97
|
+
}
|
|
98
|
+
const environment = await CicdGateway.call({
|
|
99
|
+
body: payload,
|
|
100
|
+
endpoint: environmentEndpoint(args.id),
|
|
101
|
+
headers: { 'Content-Type': 'application/json' },
|
|
102
|
+
method: 'PATCH',
|
|
103
|
+
});
|
|
104
|
+
return { environment };
|
|
105
|
+
}
|
|
106
|
+
function toPipelineHeaderFlags(args) {
|
|
107
|
+
return {
|
|
108
|
+
'organization-id': assertRequired(args.organizationId, 'organizationId'),
|
|
109
|
+
'user-id': assertRequired(args.userId, 'userId'),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function jobList(args) {
|
|
113
|
+
const filters = {
|
|
114
|
+
context: args.context,
|
|
115
|
+
id: args.id,
|
|
116
|
+
limit: args.limit,
|
|
117
|
+
name: args.name,
|
|
118
|
+
parent: args.parent,
|
|
119
|
+
status: args.status,
|
|
120
|
+
type: args.type,
|
|
121
|
+
};
|
|
122
|
+
const response = await CicdGateway.call({
|
|
123
|
+
endpoint: jobListEndpoint(filters),
|
|
124
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
125
|
+
method: 'GET',
|
|
126
|
+
});
|
|
127
|
+
return { jobs: normalizeJobs(response) };
|
|
128
|
+
}
|
|
129
|
+
async function jobGet(args) {
|
|
130
|
+
const response = await CicdGateway.call({
|
|
131
|
+
endpoint: jobEndpoint(assertRequired(args.id, 'id')),
|
|
132
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
133
|
+
method: 'GET',
|
|
134
|
+
});
|
|
135
|
+
return { job: normalizeJob(response) };
|
|
136
|
+
}
|
|
137
|
+
async function jobRun(args) {
|
|
138
|
+
const result = await CicdGateway.call({
|
|
139
|
+
endpoint: jobRunEndpoint(assertRequired(args.id, 'id'), args.restart),
|
|
140
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
141
|
+
method: 'POST',
|
|
142
|
+
});
|
|
143
|
+
return { result: normalizeJobOperation(result) };
|
|
144
|
+
}
|
|
145
|
+
async function jobResume(args) {
|
|
146
|
+
const result = await CicdGateway.call({
|
|
147
|
+
endpoint: jobResumeEndpoint(assertRequired(args.id, 'id')),
|
|
148
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
149
|
+
method: 'POST',
|
|
150
|
+
});
|
|
151
|
+
return { result: normalizeJobOperation(result) };
|
|
152
|
+
}
|
|
153
|
+
async function jobKill(args) {
|
|
154
|
+
const result = await CicdGateway.call({
|
|
155
|
+
endpoint: jobKillEndpoint(assertRequired(args.id, 'id')),
|
|
156
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
157
|
+
method: 'POST',
|
|
158
|
+
});
|
|
159
|
+
return { result: normalizeJobOperation(result) };
|
|
160
|
+
}
|
|
161
|
+
async function jobPause(args) {
|
|
162
|
+
const result = await CicdGateway.call({
|
|
163
|
+
endpoint: jobPauseEndpoint(assertRequired(args.id, 'id')),
|
|
164
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
165
|
+
method: 'POST',
|
|
166
|
+
});
|
|
167
|
+
return { result: normalizeJobOperation(result) };
|
|
168
|
+
}
|
|
169
|
+
async function pipelineList(args) {
|
|
170
|
+
const response = await CicdGateway.call({
|
|
171
|
+
endpoint: pipelineListEndpoint(),
|
|
172
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
173
|
+
method: 'GET',
|
|
174
|
+
});
|
|
175
|
+
return { pipelines: normalizePipelines(response) };
|
|
176
|
+
}
|
|
177
|
+
async function pipelineGet(args) {
|
|
178
|
+
const response = await CicdGateway.call({
|
|
179
|
+
endpoint: pipelineDescribeEndpoint(assertRequired(args.id, 'id')),
|
|
180
|
+
headers: pipelineHeaders(toPipelineHeaderFlags(args)),
|
|
181
|
+
method: 'GET',
|
|
182
|
+
});
|
|
183
|
+
return { pipeline: normalizePipelineDescribe(response) };
|
|
184
|
+
}
|
|
185
|
+
async function pipelineConnectionList(args) {
|
|
186
|
+
const headers = pipelineHeaders(toPipelineHeaderFlags(args));
|
|
187
|
+
let connections;
|
|
188
|
+
if (args.pipelineId) {
|
|
189
|
+
const response = await CicdGateway.call({
|
|
190
|
+
endpoint: pipelineDescribeEndpoint(args.pipelineId),
|
|
191
|
+
headers,
|
|
192
|
+
method: 'GET',
|
|
193
|
+
});
|
|
194
|
+
const pipeline = normalizePipelineDescribe(response);
|
|
195
|
+
connections = pipeline.connections ?? [];
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const response = await CicdGateway.call({
|
|
199
|
+
endpoint: pipelineListEndpoint(),
|
|
200
|
+
headers,
|
|
201
|
+
method: 'GET',
|
|
202
|
+
});
|
|
203
|
+
connections = pipelineConnectionsFromPipelines(normalizePipelines(response));
|
|
204
|
+
}
|
|
205
|
+
return { connections };
|
|
206
|
+
}
|
|
207
|
+
async function projectDefaultGet(args = {}) {
|
|
208
|
+
const keys = collectSelectedKeys(args);
|
|
209
|
+
const selected = keys.length > 0 ? keys : [...PROJECT_DEFAULT_KEYS];
|
|
210
|
+
const scope = args.global ? 'global' : 'effective';
|
|
211
|
+
if (args.global) {
|
|
212
|
+
const globalDefaults = await readDefaults('global');
|
|
213
|
+
return {
|
|
214
|
+
defaults: selected.map((key) => ({
|
|
215
|
+
key,
|
|
216
|
+
source: globalDefaults[key] === undefined ? undefined : 'global',
|
|
217
|
+
value: globalDefaults[key],
|
|
218
|
+
})),
|
|
219
|
+
scope,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const [localDefaults, globalDefaults] = await Promise.all([readDefaults('local'), readDefaults('global')]);
|
|
223
|
+
return {
|
|
224
|
+
defaults: resolveDefaults(localDefaults, globalDefaults, selected),
|
|
225
|
+
scope,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function projectDefaultSet(args) {
|
|
229
|
+
const values = buildSetValues(args);
|
|
230
|
+
const selectedKeys = Object.keys(values);
|
|
231
|
+
if (selectedKeys.length === 0) {
|
|
232
|
+
throw new Error('Must provide at least one default field to set.');
|
|
233
|
+
}
|
|
234
|
+
for (const key of selectedKeys) {
|
|
235
|
+
if (key === 'assignMe') {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const value = values[key];
|
|
239
|
+
if (typeof value === 'string' && value.trim().length === 0) {
|
|
240
|
+
throw new Error(`${key} value cannot be empty`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const scope = args.global ? 'global' : 'local';
|
|
244
|
+
const stored = await writeDefaults(scope, values);
|
|
245
|
+
return {
|
|
246
|
+
defaults: selectedKeys.map((key) => ({
|
|
247
|
+
key,
|
|
248
|
+
source: scope,
|
|
249
|
+
value: stored[key],
|
|
250
|
+
})),
|
|
251
|
+
scope,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
async function projectDefaultUnset(args) {
|
|
255
|
+
const selectedKeys = collectSelectedKeys(args);
|
|
256
|
+
if (selectedKeys.length === 0) {
|
|
257
|
+
throw new Error('Must provide at least one default field to unset.');
|
|
258
|
+
}
|
|
259
|
+
const scope = args.global ? 'global' : 'local';
|
|
260
|
+
const previousDefaults = await readDefaults(scope);
|
|
261
|
+
const removed = selectedKeys.filter((key) => previousDefaults[key] !== undefined);
|
|
262
|
+
await unsetDefaults(scope, selectedKeys);
|
|
263
|
+
return { removed, scope };
|
|
264
|
+
}
|
|
265
|
+
async function metadataList(args) {
|
|
266
|
+
const platformExperience = args.platformExperience ?? 'salesforce';
|
|
267
|
+
const body = buildMetadataIndexRequest({
|
|
268
|
+
'avoid-source-tracking': Boolean(args.avoidSourceTracking),
|
|
269
|
+
'filter-type': args.filterType,
|
|
270
|
+
'find-managed-packages': Boolean(args.findManagedPackages),
|
|
271
|
+
limit: args.limit,
|
|
272
|
+
'metadata-types': args.metadataTypes?.join(','),
|
|
273
|
+
'modified-by': args.modifiedBy,
|
|
274
|
+
'module-type': args.moduleType,
|
|
275
|
+
'order-direction': args.orderDirection,
|
|
276
|
+
'pipeline-id': args.pipelineId,
|
|
277
|
+
'platform-experience': platformExperience,
|
|
278
|
+
source: args.source,
|
|
279
|
+
'source-credential-id': args.sourceCredentialId,
|
|
280
|
+
'source-org-id': args.sourceOrgId,
|
|
281
|
+
'target-org-id': args.targetOrgId,
|
|
282
|
+
});
|
|
283
|
+
const endpoint = args.avoidSourceTracking
|
|
284
|
+
? '/release/metadata/index?avoidSourceTracking=true'
|
|
285
|
+
: '/release/metadata/index';
|
|
286
|
+
const result = await CicdGateway.call({
|
|
287
|
+
body,
|
|
288
|
+
endpoint,
|
|
289
|
+
headers: {
|
|
290
|
+
'Content-Type': 'application/json',
|
|
291
|
+
'platform-experience': platformExperience,
|
|
292
|
+
},
|
|
293
|
+
method: 'POST',
|
|
294
|
+
});
|
|
295
|
+
return { result };
|
|
296
|
+
}
|
|
297
|
+
async function metadataContentGet(args) {
|
|
298
|
+
const body = [
|
|
299
|
+
buildMetadataContentRequest({
|
|
300
|
+
'api-name': args.apiName,
|
|
301
|
+
branch: args.branch,
|
|
302
|
+
'file-name': args.fileName,
|
|
303
|
+
'metadata-type': args.metadataType,
|
|
304
|
+
'pipeline-id': args.pipelineId,
|
|
305
|
+
'result-id': args.resultId,
|
|
306
|
+
show: false,
|
|
307
|
+
source: args.source,
|
|
308
|
+
'source-credential-id': args.sourceCredentialId,
|
|
309
|
+
'source-org-id': args.sourceOrgId,
|
|
310
|
+
}),
|
|
311
|
+
];
|
|
312
|
+
const records = await CicdGateway.call({
|
|
313
|
+
body,
|
|
314
|
+
endpoint: '/release/metadata/content',
|
|
315
|
+
headers: { 'Content-Type': 'application/json' },
|
|
316
|
+
method: 'POST',
|
|
317
|
+
});
|
|
318
|
+
return { records };
|
|
319
|
+
}
|
|
320
|
+
async function metadataIndexCompare(args) {
|
|
321
|
+
const body = buildMetadataCompareRequest({
|
|
322
|
+
'comparison-mode': args.comparisonMode,
|
|
323
|
+
'filter-type': args.filterType,
|
|
324
|
+
'pipeline-id': args.pipelineId,
|
|
325
|
+
'source-credential-id': args.sourceCredentialId,
|
|
326
|
+
'source-org-id': args.sourceOrgId,
|
|
327
|
+
'target-org-id': args.targetOrgId,
|
|
328
|
+
});
|
|
329
|
+
const result = await CicdGateway.call({
|
|
330
|
+
body,
|
|
331
|
+
endpoint: '/release/metadata/compare-org',
|
|
332
|
+
headers: { 'Content-Type': 'application/json' },
|
|
333
|
+
method: 'POST',
|
|
334
|
+
});
|
|
335
|
+
return { result };
|
|
336
|
+
}
|
|
337
|
+
async function metadataContentCompare(args) {
|
|
338
|
+
const { sourceRequest, targetRequest } = buildMetadataCompareFileRequests({
|
|
339
|
+
'api-name': args.apiName,
|
|
340
|
+
'file-name': args.fileName,
|
|
341
|
+
'metadata-type': args.metadataType,
|
|
342
|
+
'pipeline-id': args.pipelineId,
|
|
343
|
+
source: args.source ?? 'ENVIRONMENT',
|
|
344
|
+
'source-branch': args.sourceBranch ?? '',
|
|
345
|
+
'source-credential-id': args.sourceCredentialId,
|
|
346
|
+
'source-org-id': args.sourceOrgId,
|
|
347
|
+
'target-branch': args.targetBranch ?? '',
|
|
348
|
+
'target-credential-id': args.targetCredentialId,
|
|
349
|
+
'target-org-id': args.targetOrgId,
|
|
350
|
+
'target-source': args.targetSource ?? 'ENVIRONMENT',
|
|
351
|
+
});
|
|
352
|
+
const rows = await CicdGateway.call({
|
|
353
|
+
body: [sourceRequest, targetRequest],
|
|
354
|
+
endpoint: '/release/metadata/content',
|
|
355
|
+
headers: { 'Content-Type': 'application/json' },
|
|
356
|
+
method: 'POST',
|
|
357
|
+
});
|
|
358
|
+
const sourceSide = contentResultToCompareSide(rows[0], sourceRequest);
|
|
359
|
+
const targetSide = contentResultToCompareSide(rows[1] ?? rows[0], targetRequest);
|
|
360
|
+
const diff = createUnifiedDiff(sourceSideLabel(sourceSide, 'source'), sourceSideLabel(targetSide, 'target'), sourceSide.content, targetSide.content);
|
|
361
|
+
return {
|
|
362
|
+
apiName: args.apiName,
|
|
363
|
+
diff,
|
|
364
|
+
identical: diff === '',
|
|
365
|
+
metadataType: args.metadataType,
|
|
366
|
+
source: sourceSide,
|
|
367
|
+
target: targetSide,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
async function metadataDependencyList(args) {
|
|
371
|
+
const selection = {
|
|
372
|
+
name: assertRequired(args.metadataName, 'metadataName'),
|
|
373
|
+
type: assertRequired(args.metadataType, 'metadataType'),
|
|
374
|
+
};
|
|
375
|
+
if (args.metadataCategory) {
|
|
376
|
+
selection.category = args.metadataCategory;
|
|
377
|
+
}
|
|
378
|
+
const body = {
|
|
379
|
+
compareOptions: {
|
|
380
|
+
sourceCredentialId: assertRequired(args.sourceCredentialId, 'sourceCredentialId'),
|
|
381
|
+
sourceOrgId: assertRequired(args.sourceOrgId, 'sourceOrgId'),
|
|
382
|
+
},
|
|
383
|
+
metadataSelections: [selection],
|
|
384
|
+
pipelineId: assertRequired(args.pipelineId, 'pipelineId'),
|
|
385
|
+
};
|
|
386
|
+
if (args.targetOrgId) {
|
|
387
|
+
body.compareOptions.targetOrgId = args.targetOrgId;
|
|
388
|
+
}
|
|
389
|
+
if (args.retrieveMode) {
|
|
390
|
+
body.compareOptions.retrieveMode = args.retrieveMode;
|
|
391
|
+
}
|
|
392
|
+
if (args.moduleType) {
|
|
393
|
+
body.moduleType = args.moduleType;
|
|
394
|
+
}
|
|
395
|
+
if (args.resultId) {
|
|
396
|
+
body.resultId = args.resultId;
|
|
397
|
+
}
|
|
398
|
+
const platformExperience = args.platformExperience ?? 'salesforce';
|
|
399
|
+
const result = await CicdGateway.call({
|
|
400
|
+
body,
|
|
401
|
+
endpoint: '/release/metadata/dependencies',
|
|
402
|
+
headers: {
|
|
403
|
+
'Content-Type': 'application/json',
|
|
404
|
+
'platform-experience': platformExperience,
|
|
405
|
+
},
|
|
406
|
+
method: 'POST',
|
|
407
|
+
});
|
|
408
|
+
return { result };
|
|
409
|
+
}
|
|
410
|
+
export const agentiaMcpToolHandlers = {
|
|
411
|
+
environmentCreate,
|
|
412
|
+
environmentGet,
|
|
413
|
+
environmentList,
|
|
414
|
+
environmentUpdate,
|
|
415
|
+
jobGet,
|
|
416
|
+
jobKill,
|
|
417
|
+
jobList,
|
|
418
|
+
jobPause,
|
|
419
|
+
jobResume,
|
|
420
|
+
jobRun,
|
|
421
|
+
metadataContentCompare,
|
|
422
|
+
metadataContentGet,
|
|
423
|
+
metadataDependencyList,
|
|
424
|
+
metadataIndexCompare,
|
|
425
|
+
metadataList,
|
|
426
|
+
pipelineConnectionList,
|
|
427
|
+
pipelineGet,
|
|
428
|
+
pipelineList,
|
|
429
|
+
projectDefaultGet,
|
|
430
|
+
projectDefaultSet,
|
|
431
|
+
projectDefaultUnset,
|
|
432
|
+
};
|
|
433
|
+
const environmentMutationSchema = {
|
|
434
|
+
apexTestLevel: z.string().optional().describe('Apex test level.'),
|
|
435
|
+
enableRollback: z.boolean().optional().describe('Enable rollback.'),
|
|
436
|
+
indexBackPromotionMetadata: z.boolean().optional().describe('Index back promotion metadata.'),
|
|
437
|
+
namespace: z.string().optional().describe('Environment namespace.'),
|
|
438
|
+
platform: z.string().optional().describe('Environment platform.'),
|
|
439
|
+
promotionDefaultCredential: z.string().optional().describe('Default credential for promotions.'),
|
|
440
|
+
runLocalTests: z.boolean().optional().describe('Run local tests.'),
|
|
441
|
+
runSpecifiedTests: z.string().optional().describe('Specified tests to run.'),
|
|
442
|
+
type: z.enum(ENVIRONMENT_TYPES).optional().describe('Environment type.'),
|
|
443
|
+
validationPromotionDefaultCredential: z
|
|
444
|
+
.string()
|
|
445
|
+
.optional()
|
|
446
|
+
.describe('Default credential for validation promotions.'),
|
|
447
|
+
};
|
|
448
|
+
const pipelineHeaderSchema = {
|
|
449
|
+
organizationId: z.string().describe('Organization Id for the x-organization-id gateway header.'),
|
|
450
|
+
userId: z.string().describe('User Id for the x-user-id gateway header.'),
|
|
451
|
+
};
|
|
452
|
+
const projectSelectorSchema = {
|
|
453
|
+
assignMe: z.boolean().optional().describe('Select or set the assign-me default.'),
|
|
454
|
+
environment: z.boolean().optional().describe('Select the environment default.'),
|
|
455
|
+
epic: z.boolean().optional().describe('Select the epic default.'),
|
|
456
|
+
feature: z.boolean().optional().describe('Select the feature default.'),
|
|
457
|
+
global: z.boolean().optional().describe('Use machine-wide defaults instead of project-local defaults.'),
|
|
458
|
+
project: z.boolean().optional().describe('Select the project default.'),
|
|
459
|
+
sprint: z.boolean().optional().describe('Select the sprint default.'),
|
|
460
|
+
team: z.boolean().optional().describe('Select the team default.'),
|
|
461
|
+
};
|
|
462
|
+
export function registerAgentiaMcpTools(server) {
|
|
463
|
+
server.registerTool('agentia_environment_list', {
|
|
464
|
+
description: 'List Copado environments via the CICD gateway.',
|
|
465
|
+
inputSchema: {
|
|
466
|
+
limit: z.number().int().min(1).max(MAX_LIMIT).optional().describe('Maximum number of environments to return.'),
|
|
467
|
+
},
|
|
468
|
+
title: 'Agentia Environment List',
|
|
469
|
+
}, (args) => safelyHandleTool(() => environmentList(args || {})));
|
|
470
|
+
server.registerTool('agentia_environment_get', {
|
|
471
|
+
description: 'Get a Copado environment by Id via the CICD gateway.',
|
|
472
|
+
inputSchema: {
|
|
473
|
+
id: z.string().describe('Copado environment Id.'),
|
|
474
|
+
},
|
|
475
|
+
title: 'Agentia Environment Get',
|
|
476
|
+
}, (args) => safelyHandleTool(() => environmentGet(args)));
|
|
477
|
+
server.registerTool('agentia_environment_create', {
|
|
478
|
+
description: 'Create a Copado environment via the CICD gateway.',
|
|
479
|
+
inputSchema: {
|
|
480
|
+
...environmentMutationSchema,
|
|
481
|
+
name: z.string().describe('Name of the environment to create.'),
|
|
482
|
+
},
|
|
483
|
+
title: 'Agentia Environment Create',
|
|
484
|
+
}, (args) => safelyHandleTool(() => environmentCreate(args)));
|
|
485
|
+
server.registerTool('agentia_environment_update', {
|
|
486
|
+
description: 'Update a Copado environment by Id via the CICD gateway.',
|
|
487
|
+
inputSchema: {
|
|
488
|
+
...environmentMutationSchema,
|
|
489
|
+
id: z.string().describe('Copado environment Id.'),
|
|
490
|
+
name: z.string().optional().describe('Environment name.'),
|
|
491
|
+
},
|
|
492
|
+
title: 'Agentia Environment Update',
|
|
493
|
+
}, (args) => safelyHandleTool(() => environmentUpdate(args)));
|
|
494
|
+
server.registerTool('agentia_job_list', {
|
|
495
|
+
description: 'List Copado job executions via the CICD gateway.',
|
|
496
|
+
inputSchema: {
|
|
497
|
+
...pipelineHeaderSchema,
|
|
498
|
+
context: z.string().optional().describe('Contains match on JobExecution context.'),
|
|
499
|
+
id: z.string().optional().describe('Exact JobExecution Id.'),
|
|
500
|
+
limit: z
|
|
501
|
+
.number()
|
|
502
|
+
.int()
|
|
503
|
+
.min(JOB_LIST_LIMIT_MIN)
|
|
504
|
+
.max(JOB_LIST_LIMIT_MAX)
|
|
505
|
+
.optional()
|
|
506
|
+
.describe(`Maximum number of jobs to return (${JOB_LIST_LIMIT_MIN}-${JOB_LIST_LIMIT_MAX}).`),
|
|
507
|
+
name: z.string().optional().describe('Contains match on JobExecution name.'),
|
|
508
|
+
parent: z.string().optional().describe('Exact parent record Id.'),
|
|
509
|
+
status: z.string().optional().describe('Exact Copado job status.'),
|
|
510
|
+
type: z.string().optional().describe('Contains match on Job Template name.'),
|
|
511
|
+
},
|
|
512
|
+
title: 'Agentia Job List',
|
|
513
|
+
}, (args) => safelyHandleTool(() => jobList(args)));
|
|
514
|
+
server.registerTool('agentia_job_get', {
|
|
515
|
+
description: 'Get a Copado job execution with ordered steps via the CICD gateway.',
|
|
516
|
+
inputSchema: {
|
|
517
|
+
...pipelineHeaderSchema,
|
|
518
|
+
id: z.string().describe('JobExecution Id.'),
|
|
519
|
+
},
|
|
520
|
+
title: 'Agentia Job Get',
|
|
521
|
+
}, (args) => safelyHandleTool(() => jobGet(args)));
|
|
522
|
+
server.registerTool('agentia_job_run', {
|
|
523
|
+
description: 'Run all steps for a Copado job execution via the CICD gateway.',
|
|
524
|
+
inputSchema: {
|
|
525
|
+
...pipelineHeaderSchema,
|
|
526
|
+
id: z.string().describe('JobExecution Id.'),
|
|
527
|
+
restart: z.boolean().optional().describe('Restart the job run (gateway compatibility flag).'),
|
|
528
|
+
},
|
|
529
|
+
title: 'Agentia Job Run',
|
|
530
|
+
}, (args) => safelyHandleTool(() => jobRun(args)));
|
|
531
|
+
server.registerTool('agentia_job_resume', {
|
|
532
|
+
description: 'Resume outstanding steps for a Copado job execution via the CICD gateway.',
|
|
533
|
+
inputSchema: {
|
|
534
|
+
...pipelineHeaderSchema,
|
|
535
|
+
id: z.string().describe('JobExecution Id.'),
|
|
536
|
+
},
|
|
537
|
+
title: 'Agentia Job Resume',
|
|
538
|
+
}, (args) => safelyHandleTool(() => jobResume(args)));
|
|
539
|
+
server.registerTool('agentia_job_kill', {
|
|
540
|
+
description: 'Cancel a Copado job execution via the CICD gateway.',
|
|
541
|
+
inputSchema: {
|
|
542
|
+
...pipelineHeaderSchema,
|
|
543
|
+
id: z.string().describe('JobExecution Id.'),
|
|
544
|
+
},
|
|
545
|
+
title: 'Agentia Job Kill',
|
|
546
|
+
}, (args) => safelyHandleTool(() => jobKill(args)));
|
|
547
|
+
server.registerTool('agentia_job_pause', {
|
|
548
|
+
description: 'Pause a Copado job execution via the CICD gateway (resumable cancel alias).',
|
|
549
|
+
inputSchema: {
|
|
550
|
+
...pipelineHeaderSchema,
|
|
551
|
+
id: z.string().describe('JobExecution Id.'),
|
|
552
|
+
},
|
|
553
|
+
title: 'Agentia Job Pause',
|
|
554
|
+
}, (args) => safelyHandleTool(() => jobPause(args)));
|
|
555
|
+
server.registerTool('agentia_pipeline_list', {
|
|
556
|
+
description: 'List Copado pipelines via the CICD gateway.',
|
|
557
|
+
inputSchema: pipelineHeaderSchema,
|
|
558
|
+
title: 'Agentia Pipeline List',
|
|
559
|
+
}, (args) => safelyHandleTool(() => pipelineList(args)));
|
|
560
|
+
server.registerTool('agentia_pipeline_get', {
|
|
561
|
+
description: 'Describe a Copado pipeline via the CICD gateway.',
|
|
562
|
+
inputSchema: {
|
|
563
|
+
...pipelineHeaderSchema,
|
|
564
|
+
id: z.string().describe('Pipeline Id.'),
|
|
565
|
+
},
|
|
566
|
+
title: 'Agentia Pipeline Get',
|
|
567
|
+
}, (args) => safelyHandleTool(() => pipelineGet(args)));
|
|
568
|
+
server.registerTool('agentia_pipeline_connection_list', {
|
|
569
|
+
description: 'List Copado pipeline connections via list or describe endpoints.',
|
|
570
|
+
inputSchema: {
|
|
571
|
+
...pipelineHeaderSchema,
|
|
572
|
+
pipelineId: z.string().optional().describe('Optional pipeline Id. When set, uses the describe endpoint.'),
|
|
573
|
+
},
|
|
574
|
+
title: 'Agentia Pipeline Connection List',
|
|
575
|
+
}, (args) => safelyHandleTool(() => pipelineConnectionList(args)));
|
|
576
|
+
server.registerTool('agentia_project_default_get', {
|
|
577
|
+
description: 'Show Agentia project default values for the current project or globally.',
|
|
578
|
+
inputSchema: projectSelectorSchema,
|
|
579
|
+
title: 'Agentia Project Default Get',
|
|
580
|
+
}, (args) => safelyHandleTool(() => projectDefaultGet(args || {})));
|
|
581
|
+
server.registerTool('agentia_project_default_set', {
|
|
582
|
+
description: 'Set Agentia project default values for the current project or globally.',
|
|
583
|
+
inputSchema: {
|
|
584
|
+
assignMe: z.boolean().optional().describe('Assign work items to the current user by default.'),
|
|
585
|
+
environment: z.string().optional().describe('Default environment.'),
|
|
586
|
+
epic: z.string().optional().describe('Default epic.'),
|
|
587
|
+
feature: z.string().optional().describe('Default feature.'),
|
|
588
|
+
global: z.boolean().optional().describe('Use machine-wide defaults instead of project-local defaults.'),
|
|
589
|
+
project: z.string().optional().describe('Default project.'),
|
|
590
|
+
sprint: z.string().optional().describe('Default sprint.'),
|
|
591
|
+
team: z.string().optional().describe('Default team.'),
|
|
592
|
+
},
|
|
593
|
+
title: 'Agentia Project Default Set',
|
|
594
|
+
}, (args) => safelyHandleTool(() => projectDefaultSet(args || {})));
|
|
595
|
+
server.registerTool('agentia_project_default_unset', {
|
|
596
|
+
description: 'Remove Agentia project default values from the current project or globally.',
|
|
597
|
+
inputSchema: projectSelectorSchema,
|
|
598
|
+
title: 'Agentia Project Default Unset',
|
|
599
|
+
}, (args) => safelyHandleTool(() => projectDefaultUnset(args || {})));
|
|
600
|
+
server.registerTool('agentia_metadata_list', {
|
|
601
|
+
description: 'Search the Copado metadata index via the CICD gateway.',
|
|
602
|
+
inputSchema: {
|
|
603
|
+
avoidSourceTracking: z.boolean().optional().describe('Pass avoidSourceTracking=true to the gateway index route.'),
|
|
604
|
+
filterType: z.string().optional().describe('Optional metadata type name filter, for example ApexClass.'),
|
|
605
|
+
findManagedPackages: z.boolean().optional().describe('Include managed package metadata in the search.'),
|
|
606
|
+
limit: z.number().int().min(1).max(MAX_LIMIT).optional().describe('Maximum number of records to return.'),
|
|
607
|
+
metadataTypes: z.array(z.string()).optional().describe('Optional metadata types to include.'),
|
|
608
|
+
modifiedBy: z.string().optional().describe('Filter by last modified user.'),
|
|
609
|
+
moduleType: z.enum(MODULE_TYPES).optional().describe('Optional addon module type.'),
|
|
610
|
+
orderDirection: z.enum(ORDER_DIRECTIONS).optional().describe('Sort direction for last modified date.'),
|
|
611
|
+
pipelineId: z.string().describe('Pipeline Id.'),
|
|
612
|
+
platformExperience: z.enum(PLATFORM_EXPERIENCES).optional().describe('Gateway platform experience header.'),
|
|
613
|
+
source: z.enum(INDEX_SOURCES).optional().describe('Index source filter.'),
|
|
614
|
+
sourceCredentialId: z.string().describe('Source org credential Id.'),
|
|
615
|
+
sourceOrgId: z.string().describe('Source org Id.'),
|
|
616
|
+
targetOrgId: z.string().optional().describe('Optional target org Id.'),
|
|
617
|
+
},
|
|
618
|
+
title: 'Agentia Metadata List',
|
|
619
|
+
}, (args) => safelyHandleTool(() => metadataList(args)));
|
|
620
|
+
server.registerTool('agentia_metadata_content_get', {
|
|
621
|
+
description: 'Retrieve metadata file content via the CICD gateway.',
|
|
622
|
+
inputSchema: {
|
|
623
|
+
apiName: z.string().describe('Metadata API name.'),
|
|
624
|
+
branch: z.string().optional().describe('Git branch when source is REPOSITORY or GIT_MIRROR.'),
|
|
625
|
+
fileName: z.string().optional().describe('Optional metadata file name.'),
|
|
626
|
+
metadataType: z.string().describe('Metadata type, for example ApexClass.'),
|
|
627
|
+
pipelineId: z.string().describe('Pipeline Id.'),
|
|
628
|
+
resultId: z.string().optional().describe('Optional result Id from a prior metadata operation.'),
|
|
629
|
+
source: z.enum(CONTENT_SOURCES).describe('Content source.'),
|
|
630
|
+
sourceCredentialId: z.string().optional().describe('Optional source org credential Id.'),
|
|
631
|
+
sourceOrgId: z.string().describe('Source org Id.'),
|
|
632
|
+
},
|
|
633
|
+
title: 'Agentia Metadata Content Get',
|
|
634
|
+
}, (args) => safelyHandleTool(() => metadataContentGet(args)));
|
|
635
|
+
server.registerTool('agentia_metadata_index_compare', {
|
|
636
|
+
description: 'Compare metadata between orgs or Git branches via the CICD gateway.',
|
|
637
|
+
inputSchema: {
|
|
638
|
+
comparisonMode: z.enum(COMPARISON_MODES).describe('Comparison mode.'),
|
|
639
|
+
filterType: z.string().optional().describe('Optional metadata type filter, for example ApexClass.'),
|
|
640
|
+
pipelineId: z.string().describe('Pipeline Id.'),
|
|
641
|
+
sourceCredentialId: z.string().describe('Source org credential Id.'),
|
|
642
|
+
sourceOrgId: z.string().describe('Source org Id.'),
|
|
643
|
+
targetOrgId: z.string().describe('Target org Id.'),
|
|
644
|
+
},
|
|
645
|
+
title: 'Agentia Metadata Index Compare',
|
|
646
|
+
}, (args) => safelyHandleTool(() => metadataIndexCompare(args)));
|
|
647
|
+
server.registerTool('agentia_metadata_content_compare', {
|
|
648
|
+
description: 'Compare one metadata component between two orgs or Git branches and return a unified diff.',
|
|
649
|
+
inputSchema: {
|
|
650
|
+
apiName: z.string().describe('Metadata API name.'),
|
|
651
|
+
fileName: z.string().optional().describe('Optional metadata file name.'),
|
|
652
|
+
metadataType: z.string().describe('Metadata type, for example ApexClass.'),
|
|
653
|
+
pipelineId: z.string().describe('Pipeline Id.'),
|
|
654
|
+
source: z.enum(CONTENT_SOURCES).optional().describe('Content source for the source side.'),
|
|
655
|
+
sourceBranch: z.string().optional().describe('Git branch for the source side.'),
|
|
656
|
+
sourceCredentialId: z.string().describe('Source org credential Id.'),
|
|
657
|
+
sourceOrgId: z.string().describe('Source org Id.'),
|
|
658
|
+
targetBranch: z.string().optional().describe('Git branch for the target side.'),
|
|
659
|
+
targetCredentialId: z.string().optional().describe('Target org credential Id.'),
|
|
660
|
+
targetOrgId: z.string().describe('Target org Id.'),
|
|
661
|
+
targetSource: z.enum(CONTENT_SOURCES).optional().describe('Content source for the target side.'),
|
|
662
|
+
},
|
|
663
|
+
title: 'Agentia Metadata Content Compare',
|
|
664
|
+
}, (args) => safelyHandleTool(() => metadataContentCompare(args)));
|
|
665
|
+
server.registerTool('agentia_metadata_dependency_list', {
|
|
666
|
+
description: 'Retrieve metadata dependencies via the CICD gateway.',
|
|
667
|
+
inputSchema: {
|
|
668
|
+
metadataCategory: z.string().optional().describe('Optional metadata category.'),
|
|
669
|
+
metadataName: z.string().describe('Metadata API name.'),
|
|
670
|
+
metadataType: z.string().describe('Metadata type, for example ApexClass.'),
|
|
671
|
+
moduleType: z.enum(MODULE_TYPES).optional().describe('Optional addon module type.'),
|
|
672
|
+
pipelineId: z.string().describe('Pipeline Id.'),
|
|
673
|
+
platformExperience: z.enum(PLATFORM_EXPERIENCES).optional().describe('Gateway platform experience header.'),
|
|
674
|
+
resultId: z.string().optional().describe('Optional result Id from a prior metadata operation.'),
|
|
675
|
+
retrieveMode: z.enum(RETRIEVE_MODES).optional().describe('Dependency retrieve mode.'),
|
|
676
|
+
sourceCredentialId: z.string().describe('Source org credential Id.'),
|
|
677
|
+
sourceOrgId: z.string().describe('Source org Id.'),
|
|
678
|
+
targetOrgId: z.string().optional().describe('Optional target org Id.'),
|
|
679
|
+
},
|
|
680
|
+
title: 'Agentia Metadata Dependency List',
|
|
681
|
+
}, (args) => safelyHandleTool(() => metadataDependencyList(args)));
|
|
682
|
+
}
|
|
683
|
+
//# sourceMappingURL=tools.js.map
|