@daghis/teamcity-mcp 1.3.2 → 1.3.4
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 +14 -0
- package/dist/index.js +493 -251
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,7 +57,6 @@ function isRetryableError(error2) {
|
|
|
57
57
|
var TeamCityAPIError, TeamCityAuthorizationError, TeamCityNotFoundError, TeamCityRateLimitError, TeamCityServerError, TeamCityNetworkError, TeamCityRequestError, TeamCityTimeoutError, BuildNotFoundError, BuildAccessDeniedError;
|
|
58
58
|
var init_errors = __esm({
|
|
59
59
|
"src/teamcity/errors.ts"() {
|
|
60
|
-
"use strict";
|
|
61
60
|
TeamCityAPIError = class _TeamCityAPIError extends Error {
|
|
62
61
|
code;
|
|
63
62
|
statusCode;
|
|
@@ -922,6 +921,7 @@ function debug(message, meta) {
|
|
|
922
921
|
}
|
|
923
922
|
|
|
924
923
|
// src/tools.ts
|
|
924
|
+
var import_axios35 = require("axios");
|
|
925
925
|
var import_zod4 = require("zod");
|
|
926
926
|
|
|
927
927
|
// src/teamcity-client/models/resolution.ts
|
|
@@ -942,7 +942,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
942
942
|
*/
|
|
943
943
|
async retrieveConfiguration(configId) {
|
|
944
944
|
try {
|
|
945
|
-
const response = await this.client.buildTypes.getBuildType(
|
|
945
|
+
const response = await this.client.modules.buildTypes.getBuildType(
|
|
946
946
|
configId,
|
|
947
947
|
"$long,parameters($long),settings($long),agent-requirements($long)"
|
|
948
948
|
);
|
|
@@ -1125,10 +1125,14 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1125
1125
|
try {
|
|
1126
1126
|
if (updates.name !== void 0 || updates.description !== void 0) {
|
|
1127
1127
|
if (updates.name) {
|
|
1128
|
-
await this.client.buildTypes.setBuildTypeField(
|
|
1128
|
+
await this.client.modules.buildTypes.setBuildTypeField(
|
|
1129
|
+
currentConfig.id,
|
|
1130
|
+
"name",
|
|
1131
|
+
updates.name
|
|
1132
|
+
);
|
|
1129
1133
|
}
|
|
1130
1134
|
if (updates.description !== void 0) {
|
|
1131
|
-
await this.client.buildTypes.setBuildTypeField(
|
|
1135
|
+
await this.client.modules.buildTypes.setBuildTypeField(
|
|
1132
1136
|
currentConfig.id,
|
|
1133
1137
|
"description",
|
|
1134
1138
|
updates.description ?? ""
|
|
@@ -1137,7 +1141,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1137
1141
|
}
|
|
1138
1142
|
if (settings.length > 0) {
|
|
1139
1143
|
for (const setting of settings) {
|
|
1140
|
-
await this.client.buildTypes.setBuildTypeField(
|
|
1144
|
+
await this.client.modules.buildTypes.setBuildTypeField(
|
|
1141
1145
|
currentConfig.id,
|
|
1142
1146
|
`settings/${setting.name}`,
|
|
1143
1147
|
setting.value
|
|
@@ -1147,7 +1151,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1147
1151
|
if (updates.removeParameters) {
|
|
1148
1152
|
for (const paramName of updates.removeParameters) {
|
|
1149
1153
|
try {
|
|
1150
|
-
await this.client.buildTypes.deleteBuildParameterOfBuildType_2(
|
|
1154
|
+
await this.client.modules.buildTypes.deleteBuildParameterOfBuildType_2(
|
|
1151
1155
|
paramName,
|
|
1152
1156
|
currentConfig.id
|
|
1153
1157
|
);
|
|
@@ -1158,7 +1162,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1158
1162
|
}
|
|
1159
1163
|
if (updates.parameters) {
|
|
1160
1164
|
for (const [name, value] of Object.entries(updates.parameters)) {
|
|
1161
|
-
await this.client.buildTypes.setBuildTypeField(
|
|
1165
|
+
await this.client.modules.buildTypes.setBuildTypeField(
|
|
1162
1166
|
currentConfig.id,
|
|
1163
1167
|
`parameters/${name}`,
|
|
1164
1168
|
value
|
|
@@ -1394,7 +1398,10 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1394
1398
|
* Fetch build summary data
|
|
1395
1399
|
*/
|
|
1396
1400
|
async fetchBuildSummary(buildId) {
|
|
1397
|
-
const response = await this.client.builds.getBuild(
|
|
1401
|
+
const response = await this.client.modules.builds.getBuild(
|
|
1402
|
+
this.toBuildLocator(buildId),
|
|
1403
|
+
_BuildResultsManager.fields
|
|
1404
|
+
);
|
|
1398
1405
|
return response.data;
|
|
1399
1406
|
}
|
|
1400
1407
|
/**
|
|
@@ -1447,7 +1454,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1447
1454
|
*/
|
|
1448
1455
|
async fetchArtifacts(buildId, options) {
|
|
1449
1456
|
try {
|
|
1450
|
-
const response = await this.client.
|
|
1457
|
+
const response = await this.client.modules.builds.getFilesListOfBuild(
|
|
1458
|
+
this.toBuildLocator(buildId)
|
|
1459
|
+
);
|
|
1451
1460
|
const artifactListing = response.data;
|
|
1452
1461
|
let artifacts = artifactListing.file ?? [];
|
|
1453
1462
|
if (options.artifactFilter) {
|
|
@@ -1468,11 +1477,8 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1468
1477
|
const maxSize = options.maxArtifactSize ?? _BuildResultsManager.defaultMaxArtifactSize;
|
|
1469
1478
|
if ((artifact.size ?? 0) <= maxSize) {
|
|
1470
1479
|
try {
|
|
1471
|
-
const contentResponse = await this.
|
|
1472
|
-
|
|
1473
|
-
artifactPath
|
|
1474
|
-
);
|
|
1475
|
-
artifactData.content = Buffer.from(contentResponse.data).toString("base64");
|
|
1480
|
+
const contentResponse = await this.downloadArtifactContent(buildId, artifactPath);
|
|
1481
|
+
artifactData.content = Buffer.from(contentResponse).toString("base64");
|
|
1476
1482
|
} catch (err) {
|
|
1477
1483
|
}
|
|
1478
1484
|
}
|
|
@@ -1500,7 +1506,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1500
1506
|
*/
|
|
1501
1507
|
async fetchStatistics(buildId) {
|
|
1502
1508
|
try {
|
|
1503
|
-
const response = await this.client.
|
|
1509
|
+
const response = await this.client.modules.builds.getBuildStatisticValues(
|
|
1510
|
+
this.toBuildLocator(buildId)
|
|
1511
|
+
);
|
|
1504
1512
|
const payload = response.data;
|
|
1505
1513
|
const properties = payload.property ?? [];
|
|
1506
1514
|
const stats = {};
|
|
@@ -1542,7 +1550,7 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1542
1550
|
*/
|
|
1543
1551
|
async fetchChanges(buildId) {
|
|
1544
1552
|
try {
|
|
1545
|
-
const response = await this.client.
|
|
1553
|
+
const response = await this.client.modules.changes.getAllChanges(`build:(id:${buildId})`);
|
|
1546
1554
|
const changePayload = response.data;
|
|
1547
1555
|
const changes = changePayload.change ?? [];
|
|
1548
1556
|
return changes.map((change) => ({
|
|
@@ -1565,7 +1573,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1565
1573
|
*/
|
|
1566
1574
|
async fetchDependencies(buildId) {
|
|
1567
1575
|
try {
|
|
1568
|
-
const response = await this.client.
|
|
1576
|
+
const response = await this.client.request(
|
|
1577
|
+
(ctx) => ctx.axios.get(`${ctx.baseUrl}/app/rest/builds/id:${buildId}/snapshot-dependencies`)
|
|
1578
|
+
);
|
|
1569
1579
|
const depsData = response.data;
|
|
1570
1580
|
const builds = depsData.build ?? [];
|
|
1571
1581
|
return builds.map((build) => ({
|
|
@@ -1586,10 +1596,30 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1586
1596
|
if (/^https?:/i.test(path)) {
|
|
1587
1597
|
return path;
|
|
1588
1598
|
}
|
|
1599
|
+
const baseUrl = this.getBaseUrl();
|
|
1589
1600
|
if (path.startsWith("/")) {
|
|
1590
|
-
return `${
|
|
1601
|
+
return `${baseUrl}${path}`;
|
|
1591
1602
|
}
|
|
1592
|
-
return `${
|
|
1603
|
+
return `${baseUrl}/${path}`;
|
|
1604
|
+
}
|
|
1605
|
+
getBaseUrl() {
|
|
1606
|
+
const baseUrl = this.client.getApiConfig().baseUrl;
|
|
1607
|
+
return baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
1608
|
+
}
|
|
1609
|
+
toBuildLocator(buildId) {
|
|
1610
|
+
return buildId.includes(":") ? buildId : `id:${buildId}`;
|
|
1611
|
+
}
|
|
1612
|
+
async downloadArtifactContent(buildId, artifactPath) {
|
|
1613
|
+
const normalizedPath = artifactPath.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
1614
|
+
const response = await this.client.request(
|
|
1615
|
+
(ctx) => ctx.axios.get(
|
|
1616
|
+
`${ctx.baseUrl}/app/rest/builds/id:${buildId}/artifacts/content/${normalizedPath}`,
|
|
1617
|
+
{
|
|
1618
|
+
responseType: "arraybuffer"
|
|
1619
|
+
}
|
|
1620
|
+
)
|
|
1621
|
+
);
|
|
1622
|
+
return response.data;
|
|
1593
1623
|
}
|
|
1594
1624
|
/**
|
|
1595
1625
|
* Parse TeamCity date format
|
|
@@ -1662,6 +1692,7 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
1662
1692
|
|
|
1663
1693
|
// src/teamcity/client-adapter.ts
|
|
1664
1694
|
var import_axios = __toESM(require("axios"));
|
|
1695
|
+
var FALLBACK_BASE_URL = "http://not-configured";
|
|
1665
1696
|
var resolveModules = (api) => {
|
|
1666
1697
|
const candidate = api.modules;
|
|
1667
1698
|
if (candidate != null) {
|
|
@@ -1705,12 +1736,15 @@ var resolveModules = (api) => {
|
|
|
1705
1736
|
};
|
|
1706
1737
|
function createAdapterFromTeamCityAPI(api, options = {}) {
|
|
1707
1738
|
const modules = resolveModules(api);
|
|
1708
|
-
const
|
|
1709
|
-
const
|
|
1739
|
+
const getBaseUrl = api.getBaseUrl;
|
|
1740
|
+
const inferredBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : void 0;
|
|
1741
|
+
const fallbackBaseUrl = inferredBaseUrl ?? options.apiConfig?.baseUrl ?? api.http?.defaults?.baseURL ?? FALLBACK_BASE_URL;
|
|
1742
|
+
const httpInstance = api.http ?? import_axios.default.create({ baseURL: fallbackBaseUrl });
|
|
1743
|
+
const fallbackApiConfig = resolveApiClientConfigFromApi(api, httpInstance, fallbackBaseUrl);
|
|
1710
1744
|
const resolvedApiConfig = {
|
|
1711
|
-
baseUrl: options.apiConfig?.baseUrl ?? baseUrl,
|
|
1712
|
-
token: options.apiConfig?.token ??
|
|
1713
|
-
timeout: options.apiConfig?.timeout ??
|
|
1745
|
+
baseUrl: options.apiConfig?.baseUrl ?? fallbackApiConfig.baseUrl,
|
|
1746
|
+
token: options.apiConfig?.token ?? fallbackApiConfig.token,
|
|
1747
|
+
timeout: options.apiConfig?.timeout ?? fallbackApiConfig.timeout
|
|
1714
1748
|
};
|
|
1715
1749
|
const resolvedFullConfig = options.fullConfig ?? {
|
|
1716
1750
|
connection: {
|
|
@@ -1719,7 +1753,13 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
|
|
|
1719
1753
|
timeout: resolvedApiConfig.timeout
|
|
1720
1754
|
}
|
|
1721
1755
|
};
|
|
1722
|
-
|
|
1756
|
+
if (fallbackBaseUrl === FALLBACK_BASE_URL && resolvedApiConfig.baseUrl === FALLBACK_BASE_URL) {
|
|
1757
|
+
warn("TeamCity adapter using fallback baseUrl placeholder", {
|
|
1758
|
+
reason: "missing_base_url",
|
|
1759
|
+
hasApiConfig: Boolean(options.apiConfig)
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
const request = async (fn) => fn({ axios: httpInstance, baseUrl: resolvedApiConfig.baseUrl, requestId: void 0 });
|
|
1723
1763
|
const buildApi = modules.builds;
|
|
1724
1764
|
return {
|
|
1725
1765
|
modules,
|
|
@@ -1728,7 +1768,7 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
|
|
|
1728
1768
|
getConfig: () => resolvedFullConfig,
|
|
1729
1769
|
getApiConfig: () => resolvedApiConfig,
|
|
1730
1770
|
getAxios: () => httpInstance,
|
|
1731
|
-
testConnection: () => api.testConnection(),
|
|
1771
|
+
testConnection: () => typeof api.testConnection === "function" ? api.testConnection() : Promise.resolve(true),
|
|
1732
1772
|
listProjects: (locator) => api.listProjects(locator),
|
|
1733
1773
|
getProject: (projectId) => api.getProject(projectId),
|
|
1734
1774
|
listBuilds: (locator) => api.listBuilds(locator),
|
|
@@ -1748,9 +1788,98 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
|
|
|
1748
1788
|
listVcsRoots: (projectId) => api.listVcsRoots(projectId),
|
|
1749
1789
|
listAgents: () => api.listAgents(),
|
|
1750
1790
|
listAgentPools: () => api.listAgentPools(),
|
|
1751
|
-
baseUrl
|
|
1791
|
+
baseUrl: resolvedApiConfig.baseUrl
|
|
1752
1792
|
};
|
|
1753
1793
|
}
|
|
1794
|
+
var isAxiosHeadersRecord = (value) => typeof value === "object" && value !== null;
|
|
1795
|
+
var resolveApiClientConfigFromApi = (api, http, baseUrlFallback) => {
|
|
1796
|
+
const timeout = resolveTimeout(http);
|
|
1797
|
+
const authHeader = getAuthorizationHeader(http);
|
|
1798
|
+
const token = stripBearerPrefix(authHeader);
|
|
1799
|
+
const getBaseUrl = api.getBaseUrl;
|
|
1800
|
+
const resolvedBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : http.defaults.baseURL ?? baseUrlFallback;
|
|
1801
|
+
return {
|
|
1802
|
+
baseUrl: typeof resolvedBaseUrl === "string" && resolvedBaseUrl.length > 0 ? resolvedBaseUrl : baseUrlFallback,
|
|
1803
|
+
token: token ?? "",
|
|
1804
|
+
timeout
|
|
1805
|
+
};
|
|
1806
|
+
};
|
|
1807
|
+
var getAuthorizationHeader = (http) => {
|
|
1808
|
+
const headers = http.defaults.headers;
|
|
1809
|
+
if (!isAxiosHeadersRecord(headers)) {
|
|
1810
|
+
return void 0;
|
|
1811
|
+
}
|
|
1812
|
+
const direct = pickAuthorization(headers);
|
|
1813
|
+
if (direct !== void 0) {
|
|
1814
|
+
return direct;
|
|
1815
|
+
}
|
|
1816
|
+
const commonRecord = isAxiosHeadersRecord(headers.common) ? headers.common : void 0;
|
|
1817
|
+
if (commonRecord) {
|
|
1818
|
+
const common = pickAuthorization(commonRecord);
|
|
1819
|
+
if (common !== void 0) {
|
|
1820
|
+
return common;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
const getter = resolveHeaderGetter(headers) ?? (commonRecord ? resolveHeaderGetter(commonRecord) : void 0);
|
|
1824
|
+
if (getter) {
|
|
1825
|
+
return readAuthorizationViaGetter(getter, headers);
|
|
1826
|
+
}
|
|
1827
|
+
return void 0;
|
|
1828
|
+
};
|
|
1829
|
+
var resolveTimeout = (http) => {
|
|
1830
|
+
const raw = http.defaults.timeout;
|
|
1831
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw > 0) {
|
|
1832
|
+
return raw;
|
|
1833
|
+
}
|
|
1834
|
+
return void 0;
|
|
1835
|
+
};
|
|
1836
|
+
var pickAuthorization = (record) => {
|
|
1837
|
+
for (const key of Object.keys(record)) {
|
|
1838
|
+
if (key.toLowerCase() !== "authorization") {
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
const value = record[key];
|
|
1842
|
+
if (typeof value === "string") {
|
|
1843
|
+
return value;
|
|
1844
|
+
}
|
|
1845
|
+
if (Array.isArray(value)) {
|
|
1846
|
+
const [first] = value;
|
|
1847
|
+
if (typeof first === "string") {
|
|
1848
|
+
return first;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
return void 0;
|
|
1853
|
+
};
|
|
1854
|
+
var resolveHeaderGetter = (record) => {
|
|
1855
|
+
const candidate = record.get;
|
|
1856
|
+
return typeof candidate === "function" ? candidate : void 0;
|
|
1857
|
+
};
|
|
1858
|
+
var readAuthorizationViaGetter = (getter, context) => {
|
|
1859
|
+
try {
|
|
1860
|
+
const value = getter.call(context, "Authorization");
|
|
1861
|
+
if (typeof value === "string") {
|
|
1862
|
+
return value;
|
|
1863
|
+
}
|
|
1864
|
+
if (Array.isArray(value)) {
|
|
1865
|
+
const [first] = value;
|
|
1866
|
+
return typeof first === "string" ? first : void 0;
|
|
1867
|
+
}
|
|
1868
|
+
} catch {
|
|
1869
|
+
return void 0;
|
|
1870
|
+
}
|
|
1871
|
+
return void 0;
|
|
1872
|
+
};
|
|
1873
|
+
var stripBearerPrefix = (header) => {
|
|
1874
|
+
if (typeof header !== "string") {
|
|
1875
|
+
return void 0;
|
|
1876
|
+
}
|
|
1877
|
+
const match = /^Bearer\s+(.+)$/i.exec(header);
|
|
1878
|
+
return match?.[1] ?? header;
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
// src/tools.ts
|
|
1882
|
+
init_errors();
|
|
1754
1883
|
|
|
1755
1884
|
// src/teamcity/pagination.ts
|
|
1756
1885
|
function createPaginatedFetcher(baseFetch, extractItems, extractTotal) {
|
|
@@ -36225,15 +36354,21 @@ var TeamCityAPI = class _TeamCityAPI {
|
|
|
36225
36354
|
return this.builds.getBuildStatisticValues(this.toBuildLocator(buildId), fields);
|
|
36226
36355
|
}
|
|
36227
36356
|
async listChangesForBuild(buildId, fields) {
|
|
36228
|
-
return this.
|
|
36229
|
-
params: {
|
|
36230
|
-
locator: `build:(id:${buildId})`,
|
|
36231
|
-
fields
|
|
36232
|
-
}
|
|
36233
|
-
});
|
|
36357
|
+
return this.changes.getAllChanges(`build:(id:${buildId})`, fields);
|
|
36234
36358
|
}
|
|
36235
36359
|
async listSnapshotDependencies(buildId) {
|
|
36236
|
-
|
|
36360
|
+
const response = await this.builds.getBuild(
|
|
36361
|
+
this.toBuildLocator(buildId),
|
|
36362
|
+
"snapshot-dependencies"
|
|
36363
|
+
);
|
|
36364
|
+
const dependencies = response.data["snapshot-dependencies"];
|
|
36365
|
+
if (dependencies == null) {
|
|
36366
|
+
return response;
|
|
36367
|
+
}
|
|
36368
|
+
return {
|
|
36369
|
+
...response,
|
|
36370
|
+
data: dependencies
|
|
36371
|
+
};
|
|
36237
36372
|
}
|
|
36238
36373
|
getBaseUrl() {
|
|
36239
36374
|
return this.baseUrl;
|
|
@@ -36346,7 +36481,7 @@ var DEV_TOOLS = [
|
|
|
36346
36481
|
"list_projects",
|
|
36347
36482
|
schema,
|
|
36348
36483
|
async (typed) => {
|
|
36349
|
-
const
|
|
36484
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36350
36485
|
const baseParts = [];
|
|
36351
36486
|
if (typed.locator) baseParts.push(typed.locator);
|
|
36352
36487
|
if (typed.parentProjectId) baseParts.push(`parent:(id:${typed.parentProjectId})`);
|
|
@@ -36356,7 +36491,10 @@ var DEV_TOOLS = [
|
|
|
36356
36491
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
36357
36492
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
36358
36493
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
36359
|
-
return
|
|
36494
|
+
return adapter.modules.projects.getAllProjects(
|
|
36495
|
+
locator,
|
|
36496
|
+
typed.fields
|
|
36497
|
+
);
|
|
36360
36498
|
};
|
|
36361
36499
|
const fetcher = createPaginatedFetcher(
|
|
36362
36500
|
baseFetch,
|
|
@@ -36396,8 +36534,8 @@ var DEV_TOOLS = [
|
|
|
36396
36534
|
"get_project",
|
|
36397
36535
|
schema,
|
|
36398
36536
|
async (typed) => {
|
|
36399
|
-
const
|
|
36400
|
-
const project = await
|
|
36537
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36538
|
+
const project = await adapter.getProject(typed.projectId);
|
|
36401
36539
|
return json(project);
|
|
36402
36540
|
},
|
|
36403
36541
|
args
|
|
@@ -36445,7 +36583,7 @@ var DEV_TOOLS = [
|
|
|
36445
36583
|
"list_builds",
|
|
36446
36584
|
schema,
|
|
36447
36585
|
async (typed) => {
|
|
36448
|
-
const
|
|
36586
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36449
36587
|
const baseParts = [];
|
|
36450
36588
|
if (typed.locator) baseParts.push(typed.locator);
|
|
36451
36589
|
if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
|
|
@@ -36457,7 +36595,7 @@ var DEV_TOOLS = [
|
|
|
36457
36595
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
36458
36596
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
36459
36597
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
36460
|
-
return
|
|
36598
|
+
return adapter.modules.builds.getAllBuilds(locator, typed.fields);
|
|
36461
36599
|
};
|
|
36462
36600
|
const fetcher = createPaginatedFetcher(
|
|
36463
36601
|
baseFetch,
|
|
@@ -36500,8 +36638,8 @@ var DEV_TOOLS = [
|
|
|
36500
36638
|
"get_build",
|
|
36501
36639
|
schema,
|
|
36502
36640
|
async (typed) => {
|
|
36503
|
-
const
|
|
36504
|
-
const build = await
|
|
36641
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36642
|
+
const build = await adapter.getBuild(typed.buildId);
|
|
36505
36643
|
return json(build);
|
|
36506
36644
|
},
|
|
36507
36645
|
args
|
|
@@ -36530,9 +36668,9 @@ var DEV_TOOLS = [
|
|
|
36530
36668
|
"trigger_build",
|
|
36531
36669
|
schema,
|
|
36532
36670
|
async (typed) => {
|
|
36533
|
-
const
|
|
36671
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36534
36672
|
try {
|
|
36535
|
-
const build = await
|
|
36673
|
+
const build = await adapter.triggerBuild(
|
|
36536
36674
|
typed.buildTypeId,
|
|
36537
36675
|
typed.branchName,
|
|
36538
36676
|
typed.comment
|
|
@@ -36548,9 +36686,13 @@ var DEV_TOOLS = [
|
|
|
36548
36686
|
const branchPart = typed.branchName ? `<branchName>${typed.branchName}</branchName>` : "";
|
|
36549
36687
|
const commentPart = typed.comment ? `<comment><text>${typed.comment.replace(/</g, "<").replace(/>/g, ">")}</text></comment>` : "";
|
|
36550
36688
|
const xml = `<?xml version="1.0" encoding="UTF-8"?><build><buildType id="${typed.buildTypeId}"/>${branchPart}${commentPart}</build>`;
|
|
36551
|
-
const response = await
|
|
36552
|
-
|
|
36553
|
-
|
|
36689
|
+
const response = await adapter.modules.buildQueue.addBuildToQueue(
|
|
36690
|
+
false,
|
|
36691
|
+
xml,
|
|
36692
|
+
{
|
|
36693
|
+
headers: { "Content-Type": "application/xml", Accept: "application/json" }
|
|
36694
|
+
}
|
|
36695
|
+
);
|
|
36554
36696
|
const build = response.data;
|
|
36555
36697
|
return json({
|
|
36556
36698
|
success: true,
|
|
@@ -36581,8 +36723,8 @@ var DEV_TOOLS = [
|
|
|
36581
36723
|
"cancel_queued_build",
|
|
36582
36724
|
schema,
|
|
36583
36725
|
async (typed) => {
|
|
36584
|
-
const
|
|
36585
|
-
await
|
|
36726
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36727
|
+
await adapter.modules.buildQueue.deleteQueuedBuild(typed.buildId);
|
|
36586
36728
|
return json({ success: true, action: "cancel_queued_build", buildId: typed.buildId });
|
|
36587
36729
|
},
|
|
36588
36730
|
args
|
|
@@ -36622,8 +36764,8 @@ var DEV_TOOLS = [
|
|
|
36622
36764
|
"get_build_status",
|
|
36623
36765
|
schema,
|
|
36624
36766
|
async (typed) => {
|
|
36625
|
-
const
|
|
36626
|
-
const statusManager = new (await Promise.resolve().then(() => (init_build_status_manager(), build_status_manager_exports))).BuildStatusManager(
|
|
36767
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36768
|
+
const statusManager = new (await Promise.resolve().then(() => (init_build_status_manager(), build_status_manager_exports))).BuildStatusManager(adapter);
|
|
36627
36769
|
const result = await statusManager.getBuildStatus({
|
|
36628
36770
|
buildId: typed.buildId,
|
|
36629
36771
|
includeTests: typed.includeTests,
|
|
@@ -36636,14 +36778,17 @@ var DEV_TOOLS = [
|
|
|
36636
36778
|
}
|
|
36637
36779
|
if (typed.includeQueueTotals) {
|
|
36638
36780
|
try {
|
|
36639
|
-
const countResp = await
|
|
36781
|
+
const countResp = await adapter.modules.buildQueue.getAllQueuedBuilds(
|
|
36782
|
+
void 0,
|
|
36783
|
+
"count"
|
|
36784
|
+
);
|
|
36640
36785
|
enrich.totalQueued = countResp.data.count;
|
|
36641
36786
|
} catch {
|
|
36642
36787
|
}
|
|
36643
36788
|
}
|
|
36644
36789
|
if (typed.includeQueueReason) {
|
|
36645
36790
|
try {
|
|
36646
|
-
const qb = await
|
|
36791
|
+
const qb = await adapter.modules.buildQueue.getQueuedBuild(typed.buildId);
|
|
36647
36792
|
enrich.waitReason = qb.data.waitReason;
|
|
36648
36793
|
} catch {
|
|
36649
36794
|
}
|
|
@@ -36696,7 +36841,7 @@ var DEV_TOOLS = [
|
|
|
36696
36841
|
"fetch_build_log",
|
|
36697
36842
|
schema,
|
|
36698
36843
|
async (typed) => {
|
|
36699
|
-
const
|
|
36844
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36700
36845
|
let effectiveBuildId;
|
|
36701
36846
|
if (typed.buildId) {
|
|
36702
36847
|
effectiveBuildId = typed.buildId;
|
|
@@ -36708,11 +36853,11 @@ var DEV_TOOLS = [
|
|
|
36708
36853
|
baseLocatorParts.push(`number:${numberStr}`);
|
|
36709
36854
|
baseLocatorParts.push("count:10");
|
|
36710
36855
|
const locator = baseLocatorParts.join(",");
|
|
36711
|
-
const resp = await
|
|
36856
|
+
const resp = await adapter.listBuilds(locator);
|
|
36712
36857
|
const builds = Array.isArray(resp.build) ? resp.build : [];
|
|
36713
36858
|
if (builds.length === 0) {
|
|
36714
36859
|
if (typed.buildTypeId) {
|
|
36715
|
-
const recent = await
|
|
36860
|
+
const recent = await adapter.listBuilds(
|
|
36716
36861
|
`buildType:(id:${typed.buildTypeId}),branch:default:any,count:100`
|
|
36717
36862
|
);
|
|
36718
36863
|
const items = Array.isArray(recent.build) ? recent.build : [];
|
|
@@ -36746,52 +36891,91 @@ var DEV_TOOLS = [
|
|
|
36746
36891
|
if (!effectiveBuildId) {
|
|
36747
36892
|
throw new Error("Failed to resolve buildId from inputs");
|
|
36748
36893
|
}
|
|
36749
|
-
|
|
36750
|
-
|
|
36751
|
-
|
|
36752
|
-
|
|
36753
|
-
|
|
36754
|
-
|
|
36755
|
-
|
|
36756
|
-
|
|
36894
|
+
const shouldRetry2 = (error2) => {
|
|
36895
|
+
if (error2 instanceof TeamCityAPIError) {
|
|
36896
|
+
if (error2.code === "HTTP_404") {
|
|
36897
|
+
return true;
|
|
36898
|
+
}
|
|
36899
|
+
return isRetryableError(error2);
|
|
36900
|
+
}
|
|
36901
|
+
if ((0, import_axios35.isAxiosError)(error2)) {
|
|
36902
|
+
const status = error2.response?.status;
|
|
36903
|
+
if (status === 404) {
|
|
36904
|
+
return true;
|
|
36905
|
+
}
|
|
36906
|
+
if (status != null && status >= 500 && status < 600) {
|
|
36907
|
+
return true;
|
|
36908
|
+
}
|
|
36909
|
+
if (!status) {
|
|
36910
|
+
return true;
|
|
36911
|
+
}
|
|
36912
|
+
}
|
|
36913
|
+
return false;
|
|
36914
|
+
};
|
|
36915
|
+
const wait = (ms) => new Promise((resolve) => {
|
|
36916
|
+
setTimeout(resolve, ms);
|
|
36917
|
+
});
|
|
36918
|
+
const attemptFetch = async () => {
|
|
36919
|
+
if (typed.tail) {
|
|
36920
|
+
const count = typed.lineCount ?? typed.pageSize ?? 500;
|
|
36921
|
+
const full = await adapter.getBuildLog(effectiveBuildId);
|
|
36922
|
+
const allLines = full.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
36923
|
+
if (allLines.length > 0 && allLines[allLines.length - 1] === "") allLines.pop();
|
|
36924
|
+
const total = allLines.length;
|
|
36925
|
+
const start = Math.max(0, total - count);
|
|
36926
|
+
const lines = allLines.slice(start);
|
|
36927
|
+
return json({
|
|
36928
|
+
lines,
|
|
36929
|
+
meta: {
|
|
36930
|
+
buildId: effectiveBuildId,
|
|
36931
|
+
buildNumber: typeof typed.buildNumber !== "undefined" ? String(typed.buildNumber) : void 0,
|
|
36932
|
+
buildTypeId: typed.buildTypeId,
|
|
36933
|
+
mode: "tail",
|
|
36934
|
+
pageSize: count,
|
|
36935
|
+
startLine: start,
|
|
36936
|
+
hasMore: start > 0,
|
|
36937
|
+
totalLines: total
|
|
36938
|
+
}
|
|
36939
|
+
});
|
|
36940
|
+
}
|
|
36941
|
+
const effectivePageSize = typed.lineCount ?? typed.pageSize ?? 500;
|
|
36942
|
+
const startLine = typeof typed.startLine === "number" ? typed.startLine : ((typed.page ?? 1) - 1) * effectivePageSize;
|
|
36943
|
+
const chunk = await adapter.getBuildLogChunk(effectiveBuildId, {
|
|
36944
|
+
startLine,
|
|
36945
|
+
lineCount: effectivePageSize
|
|
36946
|
+
});
|
|
36947
|
+
const page = Math.floor(startLine / effectivePageSize) + 1;
|
|
36948
|
+
const hasMore = chunk.nextStartLine !== void 0;
|
|
36757
36949
|
return json({
|
|
36758
|
-
lines,
|
|
36950
|
+
lines: chunk.lines,
|
|
36759
36951
|
meta: {
|
|
36760
36952
|
buildId: effectiveBuildId,
|
|
36761
36953
|
buildNumber: typeof typed.buildNumber !== "undefined" ? String(typed.buildNumber) : void 0,
|
|
36762
36954
|
buildTypeId: typed.buildTypeId,
|
|
36763
|
-
|
|
36764
|
-
pageSize:
|
|
36765
|
-
startLine:
|
|
36766
|
-
hasMore:
|
|
36767
|
-
|
|
36955
|
+
page,
|
|
36956
|
+
pageSize: effectivePageSize,
|
|
36957
|
+
startLine: chunk.startLine,
|
|
36958
|
+
nextPage: hasMore ? page + 1 : void 0,
|
|
36959
|
+
prevPage: page > 1 ? page - 1 : void 0,
|
|
36960
|
+
hasMore,
|
|
36961
|
+
totalLines: chunk.totalLines,
|
|
36962
|
+
nextStartLine: chunk.nextStartLine
|
|
36768
36963
|
}
|
|
36769
36964
|
});
|
|
36770
|
-
}
|
|
36771
|
-
const
|
|
36772
|
-
|
|
36773
|
-
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
meta: {
|
|
36782
|
-
buildId: effectiveBuildId,
|
|
36783
|
-
buildNumber: typeof typed.buildNumber !== "undefined" ? String(typed.buildNumber) : void 0,
|
|
36784
|
-
buildTypeId: typed.buildTypeId,
|
|
36785
|
-
page,
|
|
36786
|
-
pageSize: effectivePageSize,
|
|
36787
|
-
startLine: chunk.startLine,
|
|
36788
|
-
nextPage: hasMore ? page + 1 : void 0,
|
|
36789
|
-
prevPage: page > 1 ? page - 1 : void 0,
|
|
36790
|
-
hasMore,
|
|
36791
|
-
totalLines: chunk.totalLines,
|
|
36792
|
-
nextStartLine: chunk.nextStartLine
|
|
36965
|
+
};
|
|
36966
|
+
const maxAttempts = typed.tail ? 5 : 3;
|
|
36967
|
+
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
36968
|
+
try {
|
|
36969
|
+
return await attemptFetch();
|
|
36970
|
+
} catch (error2) {
|
|
36971
|
+
if (shouldRetry2(error2) && attempt < maxAttempts - 1) {
|
|
36972
|
+
await wait(500 * (attempt + 1));
|
|
36973
|
+
continue;
|
|
36974
|
+
}
|
|
36975
|
+
throw error2;
|
|
36793
36976
|
}
|
|
36794
|
-
}
|
|
36977
|
+
}
|
|
36978
|
+
throw new Error("Unable to fetch build log after retries");
|
|
36795
36979
|
},
|
|
36796
36980
|
args
|
|
36797
36981
|
);
|
|
@@ -36828,7 +37012,7 @@ var DEV_TOOLS = [
|
|
|
36828
37012
|
"list_build_configs",
|
|
36829
37013
|
schema,
|
|
36830
37014
|
async (typed) => {
|
|
36831
|
-
const
|
|
37015
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36832
37016
|
const baseParts = [];
|
|
36833
37017
|
if (typed.locator) baseParts.push(typed.locator);
|
|
36834
37018
|
if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
|
|
@@ -36838,7 +37022,10 @@ var DEV_TOOLS = [
|
|
|
36838
37022
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
36839
37023
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
36840
37024
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
36841
|
-
return
|
|
37025
|
+
return adapter.modules.buildTypes.getAllBuildTypes(
|
|
37026
|
+
locator,
|
|
37027
|
+
typed.fields
|
|
37028
|
+
);
|
|
36842
37029
|
};
|
|
36843
37030
|
const fetcher = createPaginatedFetcher(
|
|
36844
37031
|
baseFetch,
|
|
@@ -36878,8 +37065,8 @@ var DEV_TOOLS = [
|
|
|
36878
37065
|
"get_build_config",
|
|
36879
37066
|
schema,
|
|
36880
37067
|
async (typed) => {
|
|
36881
|
-
const
|
|
36882
|
-
const buildType = await
|
|
37068
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37069
|
+
const buildType = await adapter.getBuildType(typed.buildTypeId);
|
|
36883
37070
|
return json(buildType);
|
|
36884
37071
|
},
|
|
36885
37072
|
args
|
|
@@ -36916,14 +37103,14 @@ var DEV_TOOLS = [
|
|
|
36916
37103
|
"list_test_failures",
|
|
36917
37104
|
schema,
|
|
36918
37105
|
async (typed) => {
|
|
36919
|
-
const
|
|
37106
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36920
37107
|
const pageSize = typed.pageSize ?? 100;
|
|
36921
37108
|
const baseFetch = async ({ count, start }) => {
|
|
36922
37109
|
const parts = [`build:(id:${typed.buildId})`, "status:FAILURE"];
|
|
36923
37110
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
36924
37111
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
36925
37112
|
const locator = parts.join(",");
|
|
36926
|
-
return
|
|
37113
|
+
return adapter.modules.tests.getAllTestOccurrences(locator, typed.fields);
|
|
36927
37114
|
};
|
|
36928
37115
|
const fetcher = createPaginatedFetcher(
|
|
36929
37116
|
baseFetch,
|
|
@@ -36976,7 +37163,7 @@ var DEV_TOOLS = [
|
|
|
36976
37163
|
"list_vcs_roots",
|
|
36977
37164
|
schema,
|
|
36978
37165
|
async (typed) => {
|
|
36979
|
-
const
|
|
37166
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
36980
37167
|
const baseParts = [];
|
|
36981
37168
|
if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
|
|
36982
37169
|
const pageSize = typed.pageSize ?? 100;
|
|
@@ -36985,7 +37172,10 @@ var DEV_TOOLS = [
|
|
|
36985
37172
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
36986
37173
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
36987
37174
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
36988
|
-
return
|
|
37175
|
+
return adapter.modules.vcsRoots.getAllVcsRoots(
|
|
37176
|
+
locator,
|
|
37177
|
+
typed.fields
|
|
37178
|
+
);
|
|
36989
37179
|
};
|
|
36990
37180
|
const fetcher = createPaginatedFetcher(
|
|
36991
37181
|
baseFetch,
|
|
@@ -37025,10 +37215,10 @@ var DEV_TOOLS = [
|
|
|
37025
37215
|
"get_vcs_root",
|
|
37026
37216
|
schema,
|
|
37027
37217
|
async (typed) => {
|
|
37028
|
-
const
|
|
37029
|
-
const listing = await
|
|
37218
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37219
|
+
const listing = await adapter.modules.vcsRoots.getAllVcsRoots(`id:${typed.id}`);
|
|
37030
37220
|
const rootEntry = listing.data.vcsRoot?.[0];
|
|
37031
|
-
const props = await
|
|
37221
|
+
const props = await adapter.modules.vcsRoots.getAllVcsRootProperties(typed.id);
|
|
37032
37222
|
return json({
|
|
37033
37223
|
id: rootEntry?.id ?? typed.id,
|
|
37034
37224
|
name: rootEntry?.name,
|
|
@@ -37062,8 +37252,8 @@ var DEV_TOOLS = [
|
|
|
37062
37252
|
"set_vcs_root_property",
|
|
37063
37253
|
schema,
|
|
37064
37254
|
async (typed) => {
|
|
37065
|
-
const
|
|
37066
|
-
await
|
|
37255
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37256
|
+
await adapter.modules.vcsRoots.setVcsRootProperty(typed.id, typed.name, typed.value, {
|
|
37067
37257
|
headers: { "Content-Type": "text/plain", Accept: "text/plain" }
|
|
37068
37258
|
});
|
|
37069
37259
|
return json({
|
|
@@ -37095,8 +37285,8 @@ var DEV_TOOLS = [
|
|
|
37095
37285
|
"delete_vcs_root_property",
|
|
37096
37286
|
schema,
|
|
37097
37287
|
async (typed) => {
|
|
37098
|
-
const
|
|
37099
|
-
await
|
|
37288
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37289
|
+
await adapter.modules.vcsRoots.deleteVcsRootProperty(typed.id, typed.name);
|
|
37100
37290
|
return json({
|
|
37101
37291
|
success: true,
|
|
37102
37292
|
action: "delete_vcs_root_property",
|
|
@@ -37140,7 +37330,7 @@ var DEV_TOOLS = [
|
|
|
37140
37330
|
"update_vcs_root_properties",
|
|
37141
37331
|
schema,
|
|
37142
37332
|
async (typed) => {
|
|
37143
|
-
const
|
|
37333
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37144
37334
|
const properties = [];
|
|
37145
37335
|
if (typeof typed.url === "string") properties.push({ name: "url", value: typed.url });
|
|
37146
37336
|
if (typeof typed.branch === "string")
|
|
@@ -37159,7 +37349,7 @@ var DEV_TOOLS = [
|
|
|
37159
37349
|
updated: 0
|
|
37160
37350
|
});
|
|
37161
37351
|
}
|
|
37162
|
-
await
|
|
37352
|
+
await adapter.modules.vcsRoots.setVcsRootProperties(
|
|
37163
37353
|
typed.id,
|
|
37164
37354
|
void 0,
|
|
37165
37355
|
{ property: properties },
|
|
@@ -37209,7 +37399,7 @@ var DEV_TOOLS = [
|
|
|
37209
37399
|
"list_queued_builds",
|
|
37210
37400
|
schema,
|
|
37211
37401
|
async (typed) => {
|
|
37212
|
-
const
|
|
37402
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37213
37403
|
const baseParts = [];
|
|
37214
37404
|
if (typed.locator) baseParts.push(typed.locator);
|
|
37215
37405
|
const pageSize = typed.pageSize ?? 100;
|
|
@@ -37218,7 +37408,10 @@ var DEV_TOOLS = [
|
|
|
37218
37408
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37219
37409
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37220
37410
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37221
|
-
return
|
|
37411
|
+
return adapter.modules.buildQueue.getAllQueuedBuilds(
|
|
37412
|
+
locator,
|
|
37413
|
+
typed.fields
|
|
37414
|
+
);
|
|
37222
37415
|
};
|
|
37223
37416
|
const fetcher = createPaginatedFetcher(
|
|
37224
37417
|
baseFetch,
|
|
@@ -37252,8 +37445,8 @@ var DEV_TOOLS = [
|
|
|
37252
37445
|
"get_server_metrics",
|
|
37253
37446
|
null,
|
|
37254
37447
|
async () => {
|
|
37255
|
-
const
|
|
37256
|
-
const metrics = await
|
|
37448
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37449
|
+
const metrics = await adapter.modules.server.getAllMetrics();
|
|
37257
37450
|
return json(metrics.data);
|
|
37258
37451
|
},
|
|
37259
37452
|
{}
|
|
@@ -37270,8 +37463,8 @@ var DEV_TOOLS = [
|
|
|
37270
37463
|
"get_server_info",
|
|
37271
37464
|
null,
|
|
37272
37465
|
async () => {
|
|
37273
|
-
const
|
|
37274
|
-
const info2 = await
|
|
37466
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37467
|
+
const info2 = await adapter.modules.server.getServerInfo();
|
|
37275
37468
|
return json(info2.data);
|
|
37276
37469
|
},
|
|
37277
37470
|
{}
|
|
@@ -37296,19 +37489,19 @@ var DEV_TOOLS = [
|
|
|
37296
37489
|
"list_server_health_items",
|
|
37297
37490
|
schema,
|
|
37298
37491
|
async (typed) => {
|
|
37299
|
-
const
|
|
37492
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37300
37493
|
const normalized = (() => {
|
|
37301
37494
|
const raw = typeof typed.locator === "string" ? typed.locator.trim() : void 0;
|
|
37302
37495
|
if (!raw || raw.length === 0) return void 0;
|
|
37303
37496
|
return raw.replace(/category:\s*\((ERROR|WARNING|INFO)\)/g, "category:$1");
|
|
37304
37497
|
})();
|
|
37305
37498
|
try {
|
|
37306
|
-
const response = await
|
|
37499
|
+
const response = await adapter.modules.health.getHealthItems(normalized);
|
|
37307
37500
|
return json(response.data);
|
|
37308
37501
|
} catch (err) {
|
|
37309
37502
|
const isHttp400 = err?.statusCode === 400 || err?.code === "VALIDATION_ERROR";
|
|
37310
37503
|
if (!isHttp400) throw err;
|
|
37311
|
-
const all = await
|
|
37504
|
+
const all = await adapter.modules.health.getHealthItems();
|
|
37312
37505
|
const rawItems = all.data?.healthItem ?? [];
|
|
37313
37506
|
const filter = (item) => {
|
|
37314
37507
|
if (!normalized) return true;
|
|
@@ -37357,8 +37550,8 @@ var DEV_TOOLS = [
|
|
|
37357
37550
|
"get_server_health_item",
|
|
37358
37551
|
schema,
|
|
37359
37552
|
async (typed) => {
|
|
37360
|
-
const
|
|
37361
|
-
const response = await
|
|
37553
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37554
|
+
const response = await adapter.modules.health.getSingleHealthItem(typed.locator);
|
|
37362
37555
|
return json(response.data);
|
|
37363
37556
|
},
|
|
37364
37557
|
args
|
|
@@ -37385,8 +37578,8 @@ var DEV_TOOLS = [
|
|
|
37385
37578
|
"check_availability_guard",
|
|
37386
37579
|
schema,
|
|
37387
37580
|
async (typed) => {
|
|
37388
|
-
const
|
|
37389
|
-
const resp = await
|
|
37581
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37582
|
+
const resp = await adapter.modules.health.getHealthItems();
|
|
37390
37583
|
const items = resp.data?.healthItem ?? [];
|
|
37391
37584
|
const critical = items.filter((i) => i.severity === "ERROR");
|
|
37392
37585
|
const warnings = items.filter((i) => i.severity === "WARNING");
|
|
@@ -37412,8 +37605,8 @@ var DEV_TOOLS = [
|
|
|
37412
37605
|
"get_compatible_build_types_for_agent",
|
|
37413
37606
|
schema,
|
|
37414
37607
|
async (typed) => {
|
|
37415
|
-
const
|
|
37416
|
-
const resp = await
|
|
37608
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37609
|
+
const resp = await adapter.modules.agents.getCompatibleBuildTypes(typed.agentId);
|
|
37417
37610
|
return json(resp.data);
|
|
37418
37611
|
},
|
|
37419
37612
|
args
|
|
@@ -37434,8 +37627,8 @@ var DEV_TOOLS = [
|
|
|
37434
37627
|
"get_incompatible_build_types_for_agent",
|
|
37435
37628
|
schema,
|
|
37436
37629
|
async (typed) => {
|
|
37437
|
-
const
|
|
37438
|
-
const resp = await
|
|
37630
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37631
|
+
const resp = await adapter.modules.agents.getIncompatibleBuildTypes(typed.agentId);
|
|
37439
37632
|
return json(resp.data);
|
|
37440
37633
|
},
|
|
37441
37634
|
args
|
|
@@ -37456,8 +37649,8 @@ var DEV_TOOLS = [
|
|
|
37456
37649
|
"get_agent_enabled_info",
|
|
37457
37650
|
schema,
|
|
37458
37651
|
async (typed) => {
|
|
37459
|
-
const
|
|
37460
|
-
const resp = await
|
|
37652
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37653
|
+
const resp = await adapter.modules.agents.getEnabledInfo(typed.agentId);
|
|
37461
37654
|
return json(resp.data);
|
|
37462
37655
|
},
|
|
37463
37656
|
args
|
|
@@ -37487,11 +37680,11 @@ var DEV_TOOLS = [
|
|
|
37487
37680
|
"get_compatible_agents_for_build_type",
|
|
37488
37681
|
schema,
|
|
37489
37682
|
async (typed) => {
|
|
37490
|
-
const
|
|
37683
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37491
37684
|
const filters = [`compatible:(buildType:${typed.buildTypeId})`];
|
|
37492
37685
|
if (!typed.includeDisabled) filters.push("enabled:true");
|
|
37493
37686
|
const locator = filters.join(",");
|
|
37494
|
-
const resp = await
|
|
37687
|
+
const resp = await adapter.modules.agents.getAllAgents(locator);
|
|
37495
37688
|
return json(resp.data);
|
|
37496
37689
|
},
|
|
37497
37690
|
args
|
|
@@ -37521,11 +37714,11 @@ var DEV_TOOLS = [
|
|
|
37521
37714
|
"count_compatible_agents_for_build_type",
|
|
37522
37715
|
schema,
|
|
37523
37716
|
async (typed) => {
|
|
37524
|
-
const
|
|
37717
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37525
37718
|
const parts = [`compatible:(buildType:${typed.buildTypeId})`];
|
|
37526
37719
|
if (!typed.includeDisabled) parts.push("enabled:true");
|
|
37527
37720
|
const locator = parts.join(",");
|
|
37528
|
-
const resp = await
|
|
37721
|
+
const resp = await adapter.modules.agents.getAllAgents(locator, "count");
|
|
37529
37722
|
const count = resp.data.count ?? 0;
|
|
37530
37723
|
return json({ count });
|
|
37531
37724
|
},
|
|
@@ -37556,14 +37749,14 @@ var DEV_TOOLS = [
|
|
|
37556
37749
|
"get_compatible_agents_for_queued_build",
|
|
37557
37750
|
schema,
|
|
37558
37751
|
async (typed) => {
|
|
37559
|
-
const
|
|
37560
|
-
const build = await
|
|
37752
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37753
|
+
const build = await adapter.getBuild(typed.buildId);
|
|
37561
37754
|
const buildTypeId = build.buildTypeId;
|
|
37562
37755
|
if (!buildTypeId) return json({ items: [], count: 0, note: "Build type ID not found" });
|
|
37563
37756
|
const parts = [`compatible:(buildType:${buildTypeId})`];
|
|
37564
37757
|
if (!typed.includeDisabled) parts.push("enabled:true");
|
|
37565
37758
|
const locator = parts.join(",");
|
|
37566
|
-
const resp = await
|
|
37759
|
+
const resp = await adapter.modules.agents.getAllAgents(locator);
|
|
37567
37760
|
return json(resp.data);
|
|
37568
37761
|
},
|
|
37569
37762
|
args
|
|
@@ -37575,7 +37768,8 @@ var DEV_TOOLS = [
|
|
|
37575
37768
|
description: "Check connectivity to TeamCity server and basic readiness",
|
|
37576
37769
|
inputSchema: { type: "object", properties: {} },
|
|
37577
37770
|
handler: async (_args) => {
|
|
37578
|
-
const
|
|
37771
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37772
|
+
const ok = await adapter.testConnection();
|
|
37579
37773
|
return json({ ok });
|
|
37580
37774
|
}
|
|
37581
37775
|
},
|
|
@@ -37608,7 +37802,7 @@ var DEV_TOOLS = [
|
|
|
37608
37802
|
"list_agents",
|
|
37609
37803
|
schema,
|
|
37610
37804
|
async (typed) => {
|
|
37611
|
-
const
|
|
37805
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37612
37806
|
const pageSize = typed.pageSize ?? 100;
|
|
37613
37807
|
const baseFetch = async ({ count, start }) => {
|
|
37614
37808
|
const parts = [];
|
|
@@ -37616,7 +37810,7 @@ var DEV_TOOLS = [
|
|
|
37616
37810
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37617
37811
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37618
37812
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37619
|
-
return
|
|
37813
|
+
return adapter.modules.agents.getAllAgents(locator, typed.fields);
|
|
37620
37814
|
};
|
|
37621
37815
|
const fetcher = createPaginatedFetcher(
|
|
37622
37816
|
baseFetch,
|
|
@@ -37666,14 +37860,17 @@ var DEV_TOOLS = [
|
|
|
37666
37860
|
"list_agent_pools",
|
|
37667
37861
|
schema,
|
|
37668
37862
|
async (typed) => {
|
|
37669
|
-
const
|
|
37863
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37670
37864
|
const pageSize = typed.pageSize ?? 100;
|
|
37671
37865
|
const baseFetch = async ({ count, start }) => {
|
|
37672
37866
|
const parts = [];
|
|
37673
37867
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37674
37868
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37675
37869
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37676
|
-
return
|
|
37870
|
+
return adapter.modules.agentPools.getAllAgentPools(
|
|
37871
|
+
locator,
|
|
37872
|
+
typed.fields
|
|
37873
|
+
);
|
|
37677
37874
|
};
|
|
37678
37875
|
const fetcher = createPaginatedFetcher(
|
|
37679
37876
|
baseFetch,
|
|
@@ -37735,8 +37932,8 @@ var DEV_TOOLS = [
|
|
|
37735
37932
|
"get_build_results",
|
|
37736
37933
|
schema,
|
|
37737
37934
|
async (typed) => {
|
|
37738
|
-
const
|
|
37739
|
-
const manager = new BuildResultsManager(
|
|
37935
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37936
|
+
const manager = new BuildResultsManager(adapter);
|
|
37740
37937
|
const result = await manager.getBuildResults(typed.buildId, {
|
|
37741
37938
|
includeArtifacts: typed.includeArtifacts,
|
|
37742
37939
|
includeStatistics: typed.includeStatistics,
|
|
@@ -37771,10 +37968,10 @@ var DEV_TOOLS = [
|
|
|
37771
37968
|
"get_test_details",
|
|
37772
37969
|
schema,
|
|
37773
37970
|
async (typed) => {
|
|
37774
|
-
const
|
|
37971
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37775
37972
|
let locator = `build:(id:${typed.buildId})`;
|
|
37776
37973
|
if (typed.testNameId) locator += `,test:(id:${typed.testNameId})`;
|
|
37777
|
-
const response = await
|
|
37974
|
+
const response = await adapter.modules.tests.getAllTestOccurrences(locator);
|
|
37778
37975
|
return json(response.data);
|
|
37779
37976
|
},
|
|
37780
37977
|
args
|
|
@@ -37797,10 +37994,10 @@ var DEV_TOOLS = [
|
|
|
37797
37994
|
"analyze_build_problems",
|
|
37798
37995
|
schema,
|
|
37799
37996
|
async (typed) => {
|
|
37800
|
-
const
|
|
37801
|
-
const build = await
|
|
37802
|
-
const problems = await
|
|
37803
|
-
const failures = await
|
|
37997
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37998
|
+
const build = await adapter.getBuild(typed.buildId);
|
|
37999
|
+
const problems = await adapter.modules.builds.getBuildProblems(`id:${typed.buildId}`);
|
|
38000
|
+
const failures = await adapter.listTestFailures(typed.buildId);
|
|
37804
38001
|
return json({
|
|
37805
38002
|
buildStatus: build.status,
|
|
37806
38003
|
statusText: build.statusText,
|
|
@@ -37845,7 +38042,7 @@ var DEV_TOOLS = [
|
|
|
37845
38042
|
"list_changes",
|
|
37846
38043
|
schema,
|
|
37847
38044
|
async (typed) => {
|
|
37848
|
-
const
|
|
38045
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37849
38046
|
const baseParts = [];
|
|
37850
38047
|
if (typed.locator) baseParts.push(typed.locator);
|
|
37851
38048
|
if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
|
|
@@ -37856,7 +38053,10 @@ var DEV_TOOLS = [
|
|
|
37856
38053
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37857
38054
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37858
38055
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37859
|
-
return
|
|
38056
|
+
return adapter.modules.changes.getAllChanges(
|
|
38057
|
+
locator,
|
|
38058
|
+
typed.fields
|
|
38059
|
+
);
|
|
37860
38060
|
};
|
|
37861
38061
|
const fetcher = createPaginatedFetcher(
|
|
37862
38062
|
baseFetch,
|
|
@@ -37912,7 +38112,7 @@ var DEV_TOOLS = [
|
|
|
37912
38112
|
"list_problems",
|
|
37913
38113
|
schema,
|
|
37914
38114
|
async (typed) => {
|
|
37915
|
-
const
|
|
38115
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37916
38116
|
const baseParts = [];
|
|
37917
38117
|
if (typed.locator) baseParts.push(typed.locator);
|
|
37918
38118
|
if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
|
|
@@ -37923,7 +38123,10 @@ var DEV_TOOLS = [
|
|
|
37923
38123
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37924
38124
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37925
38125
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37926
|
-
return
|
|
38126
|
+
return adapter.modules.problems.getAllBuildProblems(
|
|
38127
|
+
locator,
|
|
38128
|
+
typed.fields
|
|
38129
|
+
);
|
|
37927
38130
|
};
|
|
37928
38131
|
const fetcher = createPaginatedFetcher(
|
|
37929
38132
|
baseFetch,
|
|
@@ -37985,7 +38188,7 @@ var DEV_TOOLS = [
|
|
|
37985
38188
|
"list_problem_occurrences",
|
|
37986
38189
|
schema,
|
|
37987
38190
|
async (typed) => {
|
|
37988
|
-
const
|
|
38191
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
37989
38192
|
const baseParts = [];
|
|
37990
38193
|
if (typed.locator) baseParts.push(typed.locator);
|
|
37991
38194
|
if (typed.buildId) baseParts.push(`build:(id:${typed.buildId})`);
|
|
@@ -37996,7 +38199,7 @@ var DEV_TOOLS = [
|
|
|
37996
38199
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
37997
38200
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
37998
38201
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
37999
|
-
return
|
|
38202
|
+
return adapter.modules.problemOccurrences.getAllBuildProblemOccurrences(
|
|
38000
38203
|
locator,
|
|
38001
38204
|
typed.fields
|
|
38002
38205
|
);
|
|
@@ -38066,7 +38269,7 @@ var DEV_TOOLS = [
|
|
|
38066
38269
|
"list_investigations",
|
|
38067
38270
|
schema,
|
|
38068
38271
|
async (typed) => {
|
|
38069
|
-
const
|
|
38272
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38070
38273
|
const baseParts = [];
|
|
38071
38274
|
if (typed.locator) baseParts.push(typed.locator);
|
|
38072
38275
|
if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
|
|
@@ -38079,7 +38282,7 @@ var DEV_TOOLS = [
|
|
|
38079
38282
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
38080
38283
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
38081
38284
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
38082
|
-
return
|
|
38285
|
+
return adapter.modules.investigations.getAllInvestigations(
|
|
38083
38286
|
locator,
|
|
38084
38287
|
typed.fields
|
|
38085
38288
|
);
|
|
@@ -38143,7 +38346,7 @@ var DEV_TOOLS = [
|
|
|
38143
38346
|
"list_muted_tests",
|
|
38144
38347
|
schema,
|
|
38145
38348
|
async (typed) => {
|
|
38146
|
-
const
|
|
38349
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38147
38350
|
const baseParts = [];
|
|
38148
38351
|
if (typed.locator) baseParts.push(typed.locator);
|
|
38149
38352
|
if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
|
|
@@ -38155,7 +38358,10 @@ var DEV_TOOLS = [
|
|
|
38155
38358
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
38156
38359
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
38157
38360
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
38158
|
-
return
|
|
38361
|
+
return adapter.modules.mutes.getAllMutedTests(
|
|
38362
|
+
locator,
|
|
38363
|
+
typed.fields
|
|
38364
|
+
);
|
|
38159
38365
|
};
|
|
38160
38366
|
const fetcher = createPaginatedFetcher(
|
|
38161
38367
|
baseFetch,
|
|
@@ -38205,8 +38411,8 @@ var DEV_TOOLS = [
|
|
|
38205
38411
|
"get_versioned_settings_status",
|
|
38206
38412
|
schema,
|
|
38207
38413
|
async (typed) => {
|
|
38208
|
-
const
|
|
38209
|
-
const response = await
|
|
38414
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38415
|
+
const response = await adapter.modules.versionedSettings.getVersionedSettingsStatus(
|
|
38210
38416
|
typed.locator,
|
|
38211
38417
|
typed.fields
|
|
38212
38418
|
);
|
|
@@ -38246,7 +38452,7 @@ var DEV_TOOLS = [
|
|
|
38246
38452
|
"list_users",
|
|
38247
38453
|
schema,
|
|
38248
38454
|
async (typed) => {
|
|
38249
|
-
const
|
|
38455
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38250
38456
|
const baseParts = [];
|
|
38251
38457
|
if (typed.locator) baseParts.push(typed.locator);
|
|
38252
38458
|
if (typed.groupId) baseParts.push(`group:(id:${typed.groupId})`);
|
|
@@ -38256,7 +38462,7 @@ var DEV_TOOLS = [
|
|
|
38256
38462
|
if (typeof count === "number") parts.push(`count:${count}`);
|
|
38257
38463
|
if (typeof start === "number") parts.push(`start:${start}`);
|
|
38258
38464
|
const locator = parts.length > 0 ? parts.join(",") : void 0;
|
|
38259
|
-
return
|
|
38465
|
+
return adapter.modules.users.getAllUsers(locator, typed.fields);
|
|
38260
38466
|
};
|
|
38261
38467
|
const fetcher = createPaginatedFetcher(
|
|
38262
38468
|
baseFetch,
|
|
@@ -38298,8 +38504,8 @@ var DEV_TOOLS = [
|
|
|
38298
38504
|
"list_roles",
|
|
38299
38505
|
schema,
|
|
38300
38506
|
async (typed) => {
|
|
38301
|
-
const
|
|
38302
|
-
const response = await
|
|
38507
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38508
|
+
const response = await adapter.modules.roles.getRoles(typed.fields);
|
|
38303
38509
|
const roles = response.data?.role ?? [];
|
|
38304
38510
|
return json({ items: roles, count: roles.length });
|
|
38305
38511
|
},
|
|
@@ -38329,9 +38535,9 @@ var DEV_TOOLS = [
|
|
|
38329
38535
|
"list_branches",
|
|
38330
38536
|
schema,
|
|
38331
38537
|
async (typed) => {
|
|
38332
|
-
const
|
|
38538
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38333
38539
|
const locator = typed.buildTypeId ? `buildType:(id:${typed.buildTypeId})` : `project:(id:${typed.projectId})`;
|
|
38334
|
-
const builds = await
|
|
38540
|
+
const builds = await adapter.listBuilds(`${locator},count:100}`);
|
|
38335
38541
|
const items = Array.isArray(builds.build) ? builds.build : [];
|
|
38336
38542
|
const branchNames = items.map((b) => b.branchName).filter((n) => typeof n === "string" && n.length > 0);
|
|
38337
38543
|
const branches = new Set(branchNames);
|
|
@@ -38357,8 +38563,8 @@ var DEV_TOOLS = [
|
|
|
38357
38563
|
"list_parameters",
|
|
38358
38564
|
schema,
|
|
38359
38565
|
async (typed) => {
|
|
38360
|
-
const
|
|
38361
|
-
const buildType = await
|
|
38566
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38567
|
+
const buildType = await adapter.getBuildType(typed.buildTypeId);
|
|
38362
38568
|
return json({
|
|
38363
38569
|
parameters: buildType.parameters?.property ?? [],
|
|
38364
38570
|
count: buildType.parameters?.property?.length ?? 0
|
|
@@ -38383,10 +38589,10 @@ var DEV_TOOLS = [
|
|
|
38383
38589
|
"list_project_hierarchy",
|
|
38384
38590
|
schema,
|
|
38385
38591
|
async (typed) => {
|
|
38386
|
-
const
|
|
38592
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38387
38593
|
const rootId = typed.rootProjectId ?? "_Root";
|
|
38388
38594
|
async function buildHierarchy(projectId, depth = 0) {
|
|
38389
|
-
const response = await
|
|
38595
|
+
const response = await adapter.modules.projects.getProject(projectId);
|
|
38390
38596
|
const project = response.data;
|
|
38391
38597
|
const children = [];
|
|
38392
38598
|
const maybeChildren = project.projects?.project ?? [];
|
|
@@ -38442,14 +38648,14 @@ var FULL_MODE_TOOLS = [
|
|
|
38442
38648
|
"create_project",
|
|
38443
38649
|
schema,
|
|
38444
38650
|
async (typedArgs) => {
|
|
38445
|
-
const
|
|
38651
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38446
38652
|
const project = {
|
|
38447
38653
|
name: typedArgs.name,
|
|
38448
38654
|
id: typedArgs.id,
|
|
38449
38655
|
parentProject: { id: typedArgs.parentProjectId ?? "_Root" },
|
|
38450
38656
|
description: typedArgs.description
|
|
38451
38657
|
};
|
|
38452
|
-
const response = await
|
|
38658
|
+
const response = await adapter.modules.projects.addProject(project, {
|
|
38453
38659
|
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
38454
38660
|
});
|
|
38455
38661
|
return json({ success: true, action: "create_project", id: response.data.id });
|
|
@@ -38471,8 +38677,8 @@ var FULL_MODE_TOOLS = [
|
|
|
38471
38677
|
},
|
|
38472
38678
|
handler: async (args) => {
|
|
38473
38679
|
const typedArgs = args;
|
|
38474
|
-
const
|
|
38475
|
-
await
|
|
38680
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38681
|
+
await adapter.modules.projects.deleteProject(typedArgs.projectId);
|
|
38476
38682
|
return json({ success: true, action: "delete_project", id: typedArgs.projectId });
|
|
38477
38683
|
},
|
|
38478
38684
|
mode: "full"
|
|
@@ -38501,7 +38707,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38501
38707
|
"update_project_settings",
|
|
38502
38708
|
schema,
|
|
38503
38709
|
async (typedArgs) => {
|
|
38504
|
-
const
|
|
38710
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38505
38711
|
debug("update_project_settings invoked", {
|
|
38506
38712
|
projectId: typedArgs.projectId,
|
|
38507
38713
|
// Only log which fields are present to reduce noise
|
|
@@ -38517,7 +38723,11 @@ var FULL_MODE_TOOLS = [
|
|
|
38517
38723
|
field: "name",
|
|
38518
38724
|
valuePreview: typedArgs.name
|
|
38519
38725
|
});
|
|
38520
|
-
await
|
|
38726
|
+
await adapter.modules.projects.setProjectField(
|
|
38727
|
+
typedArgs.projectId,
|
|
38728
|
+
"name",
|
|
38729
|
+
typedArgs.name
|
|
38730
|
+
);
|
|
38521
38731
|
}
|
|
38522
38732
|
if (typedArgs.description !== void 0) {
|
|
38523
38733
|
debug("Setting project field", {
|
|
@@ -38525,7 +38735,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38525
38735
|
field: "description",
|
|
38526
38736
|
valuePreview: typedArgs.description
|
|
38527
38737
|
});
|
|
38528
|
-
await
|
|
38738
|
+
await adapter.modules.projects.setProjectField(
|
|
38529
38739
|
typedArgs.projectId,
|
|
38530
38740
|
"description",
|
|
38531
38741
|
typedArgs.description
|
|
@@ -38537,7 +38747,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38537
38747
|
field: "archived",
|
|
38538
38748
|
valuePreview: String(typedArgs.archived)
|
|
38539
38749
|
});
|
|
38540
|
-
await
|
|
38750
|
+
await adapter.modules.projects.setProjectField(
|
|
38541
38751
|
typedArgs.projectId,
|
|
38542
38752
|
"archived",
|
|
38543
38753
|
String(typedArgs.archived)
|
|
@@ -38578,14 +38788,14 @@ var FULL_MODE_TOOLS = [
|
|
|
38578
38788
|
},
|
|
38579
38789
|
handler: async (args) => {
|
|
38580
38790
|
const typedArgs = args;
|
|
38581
|
-
const
|
|
38791
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38582
38792
|
const buildType = {
|
|
38583
38793
|
name: typedArgs.name,
|
|
38584
38794
|
id: typedArgs.id,
|
|
38585
38795
|
project: { id: typedArgs.projectId },
|
|
38586
38796
|
description: typedArgs.description
|
|
38587
38797
|
};
|
|
38588
|
-
const response = await
|
|
38798
|
+
const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType, {
|
|
38589
38799
|
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
38590
38800
|
});
|
|
38591
38801
|
return json({ success: true, action: "create_build_config", id: response.data.id });
|
|
@@ -38607,15 +38817,15 @@ var FULL_MODE_TOOLS = [
|
|
|
38607
38817
|
},
|
|
38608
38818
|
handler: async (args) => {
|
|
38609
38819
|
const typedArgs = args;
|
|
38610
|
-
const
|
|
38611
|
-
const source = await
|
|
38820
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38821
|
+
const source = await adapter.getBuildType(typedArgs.sourceBuildTypeId);
|
|
38612
38822
|
const buildType = {
|
|
38613
38823
|
...source,
|
|
38614
38824
|
name: typedArgs.name,
|
|
38615
38825
|
id: typedArgs.id,
|
|
38616
38826
|
project: { id: typedArgs.projectId ?? source.project?.id ?? "_Root" }
|
|
38617
38827
|
};
|
|
38618
|
-
const response = await
|
|
38828
|
+
const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType);
|
|
38619
38829
|
return json({ success: true, action: "clone_build_config", id: response.data.id });
|
|
38620
38830
|
},
|
|
38621
38831
|
mode: "full"
|
|
@@ -38636,10 +38846,9 @@ var FULL_MODE_TOOLS = [
|
|
|
38636
38846
|
},
|
|
38637
38847
|
handler: async (args) => {
|
|
38638
38848
|
const typedArgs = args;
|
|
38639
|
-
const
|
|
38849
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38640
38850
|
try {
|
|
38641
|
-
const
|
|
38642
|
-
const manager = new BuildConfigurationUpdateManager(clientLike);
|
|
38851
|
+
const manager = new BuildConfigurationUpdateManager(adapter);
|
|
38643
38852
|
const current = await manager.retrieveConfiguration(typedArgs.buildTypeId);
|
|
38644
38853
|
if (current) {
|
|
38645
38854
|
const updates = {};
|
|
@@ -38653,17 +38862,21 @@ var FULL_MODE_TOOLS = [
|
|
|
38653
38862
|
}
|
|
38654
38863
|
} else {
|
|
38655
38864
|
if (typedArgs.name != null && typedArgs.name !== "") {
|
|
38656
|
-
await
|
|
38865
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38866
|
+
typedArgs.buildTypeId,
|
|
38867
|
+
"name",
|
|
38868
|
+
typedArgs.name
|
|
38869
|
+
);
|
|
38657
38870
|
}
|
|
38658
38871
|
if (typedArgs.description !== void 0) {
|
|
38659
|
-
await
|
|
38872
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38660
38873
|
typedArgs.buildTypeId,
|
|
38661
38874
|
"description",
|
|
38662
38875
|
typedArgs.description
|
|
38663
38876
|
);
|
|
38664
38877
|
}
|
|
38665
38878
|
if (typedArgs.artifactRules !== void 0) {
|
|
38666
|
-
await
|
|
38879
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38667
38880
|
typedArgs.buildTypeId,
|
|
38668
38881
|
"settings/artifactRules",
|
|
38669
38882
|
typedArgs.artifactRules
|
|
@@ -38672,17 +38885,21 @@ var FULL_MODE_TOOLS = [
|
|
|
38672
38885
|
}
|
|
38673
38886
|
} catch {
|
|
38674
38887
|
if (typedArgs.name != null && typedArgs.name !== "") {
|
|
38675
|
-
await
|
|
38888
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38889
|
+
typedArgs.buildTypeId,
|
|
38890
|
+
"name",
|
|
38891
|
+
typedArgs.name
|
|
38892
|
+
);
|
|
38676
38893
|
}
|
|
38677
38894
|
if (typedArgs.description !== void 0) {
|
|
38678
|
-
await
|
|
38895
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38679
38896
|
typedArgs.buildTypeId,
|
|
38680
38897
|
"description",
|
|
38681
38898
|
typedArgs.description
|
|
38682
38899
|
);
|
|
38683
38900
|
}
|
|
38684
38901
|
if (typedArgs.artifactRules !== void 0) {
|
|
38685
|
-
await
|
|
38902
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38686
38903
|
typedArgs.buildTypeId,
|
|
38687
38904
|
"settings/artifactRules",
|
|
38688
38905
|
typedArgs.artifactRules
|
|
@@ -38690,7 +38907,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38690
38907
|
}
|
|
38691
38908
|
}
|
|
38692
38909
|
if (typedArgs.paused !== void 0) {
|
|
38693
|
-
await
|
|
38910
|
+
await adapter.modules.buildTypes.setBuildTypeField(
|
|
38694
38911
|
typedArgs.buildTypeId,
|
|
38695
38912
|
"paused",
|
|
38696
38913
|
String(typedArgs.paused)
|
|
@@ -38723,14 +38940,19 @@ var FULL_MODE_TOOLS = [
|
|
|
38723
38940
|
"add_vcs_root_to_build",
|
|
38724
38941
|
schema,
|
|
38725
38942
|
async (typed) => {
|
|
38726
|
-
const
|
|
38943
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38727
38944
|
const body = {
|
|
38728
38945
|
"vcs-root": { id: typed.vcsRootId },
|
|
38729
38946
|
"checkout-rules": typed.checkoutRules
|
|
38730
38947
|
};
|
|
38731
|
-
await
|
|
38732
|
-
|
|
38733
|
-
|
|
38948
|
+
await adapter.modules.buildTypes.addVcsRootToBuildType(
|
|
38949
|
+
typed.buildTypeId,
|
|
38950
|
+
void 0,
|
|
38951
|
+
body,
|
|
38952
|
+
{
|
|
38953
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
38954
|
+
}
|
|
38955
|
+
);
|
|
38734
38956
|
return json({
|
|
38735
38957
|
success: true,
|
|
38736
38958
|
action: "add_vcs_root_to_build",
|
|
@@ -38758,12 +38980,12 @@ var FULL_MODE_TOOLS = [
|
|
|
38758
38980
|
},
|
|
38759
38981
|
handler: async (args) => {
|
|
38760
38982
|
const typedArgs = args;
|
|
38761
|
-
const
|
|
38983
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38762
38984
|
const parameter = {
|
|
38763
38985
|
name: typedArgs.name,
|
|
38764
38986
|
value: typedArgs.value
|
|
38765
38987
|
};
|
|
38766
|
-
await
|
|
38988
|
+
await adapter.modules.buildTypes.createBuildParameterOfBuildType(
|
|
38767
38989
|
typedArgs.buildTypeId,
|
|
38768
38990
|
void 0,
|
|
38769
38991
|
parameter,
|
|
@@ -38792,8 +39014,8 @@ var FULL_MODE_TOOLS = [
|
|
|
38792
39014
|
},
|
|
38793
39015
|
handler: async (args) => {
|
|
38794
39016
|
const typedArgs = args;
|
|
38795
|
-
const
|
|
38796
|
-
await
|
|
39017
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39018
|
+
await adapter.modules.buildTypes.updateBuildParameterOfBuildType(
|
|
38797
39019
|
typedArgs.name,
|
|
38798
39020
|
typedArgs.buildTypeId,
|
|
38799
39021
|
void 0,
|
|
@@ -38825,8 +39047,11 @@ var FULL_MODE_TOOLS = [
|
|
|
38825
39047
|
},
|
|
38826
39048
|
handler: async (args) => {
|
|
38827
39049
|
const typedArgs = args;
|
|
38828
|
-
const
|
|
38829
|
-
await
|
|
39050
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39051
|
+
await adapter.modules.buildTypes.deleteBuildParameterOfBuildType_2(
|
|
39052
|
+
typedArgs.name,
|
|
39053
|
+
typedArgs.buildTypeId
|
|
39054
|
+
);
|
|
38830
39055
|
return json({
|
|
38831
39056
|
success: true,
|
|
38832
39057
|
action: "delete_parameter",
|
|
@@ -38854,7 +39079,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38854
39079
|
},
|
|
38855
39080
|
handler: async (args) => {
|
|
38856
39081
|
const typedArgs = args;
|
|
38857
|
-
const
|
|
39082
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38858
39083
|
const vcsRoot = {
|
|
38859
39084
|
name: typedArgs.name,
|
|
38860
39085
|
id: typedArgs.id,
|
|
@@ -38867,7 +39092,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38867
39092
|
]
|
|
38868
39093
|
}
|
|
38869
39094
|
};
|
|
38870
|
-
const response = await
|
|
39095
|
+
const response = await adapter.modules.vcsRoots.addVcsRoot(void 0, vcsRoot, {
|
|
38871
39096
|
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
38872
39097
|
});
|
|
38873
39098
|
return json({ success: true, action: "create_vcs_root", id: response.data.id });
|
|
@@ -38888,8 +39113,8 @@ var FULL_MODE_TOOLS = [
|
|
|
38888
39113
|
},
|
|
38889
39114
|
handler: async (args) => {
|
|
38890
39115
|
const typedArgs = args;
|
|
38891
|
-
const
|
|
38892
|
-
await
|
|
39116
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39117
|
+
await adapter.modules.agents.setAuthorizedInfo(
|
|
38893
39118
|
typedArgs.agentId,
|
|
38894
39119
|
void 0,
|
|
38895
39120
|
{ status: Boolean(typedArgs.authorize) },
|
|
@@ -38917,8 +39142,8 @@ var FULL_MODE_TOOLS = [
|
|
|
38917
39142
|
},
|
|
38918
39143
|
handler: async (args) => {
|
|
38919
39144
|
const typedArgs = args;
|
|
38920
|
-
const
|
|
38921
|
-
await
|
|
39145
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39146
|
+
await adapter.modules.agents.setAgentPool(typedArgs.agentId, void 0, {
|
|
38922
39147
|
id: parseInt(typedArgs.poolId)
|
|
38923
39148
|
});
|
|
38924
39149
|
return json({
|
|
@@ -38952,7 +39177,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38952
39177
|
},
|
|
38953
39178
|
handler: async (args) => {
|
|
38954
39179
|
const typedArgs = args;
|
|
38955
|
-
const
|
|
39180
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
38956
39181
|
switch (typedArgs.action) {
|
|
38957
39182
|
case "add": {
|
|
38958
39183
|
const stepProps = Object.fromEntries(
|
|
@@ -38968,9 +39193,14 @@ var FULL_MODE_TOOLS = [
|
|
|
38968
39193
|
property: Object.entries(stepProps).map(([k, v]) => ({ name: k, value: v }))
|
|
38969
39194
|
}
|
|
38970
39195
|
};
|
|
38971
|
-
await
|
|
38972
|
-
|
|
38973
|
-
|
|
39196
|
+
await adapter.modules.buildTypes.addBuildStepToBuildType(
|
|
39197
|
+
typedArgs.buildTypeId,
|
|
39198
|
+
void 0,
|
|
39199
|
+
step,
|
|
39200
|
+
{
|
|
39201
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
39202
|
+
}
|
|
39203
|
+
);
|
|
38974
39204
|
return json({
|
|
38975
39205
|
success: true,
|
|
38976
39206
|
action: "add_build_step",
|
|
@@ -38987,7 +39217,7 @@ var FULL_MODE_TOOLS = [
|
|
|
38987
39217
|
}
|
|
38988
39218
|
const props = Object.entries(typedArgs.properties ?? {});
|
|
38989
39219
|
for (const [k, v] of props) {
|
|
38990
|
-
await
|
|
39220
|
+
await adapter.modules.buildTypes.setBuildStepParameter(
|
|
38991
39221
|
typedArgs.buildTypeId,
|
|
38992
39222
|
typedArgs.stepId,
|
|
38993
39223
|
k,
|
|
@@ -39010,7 +39240,7 @@ var FULL_MODE_TOOLS = [
|
|
|
39010
39240
|
error: "Step ID is required for delete action"
|
|
39011
39241
|
});
|
|
39012
39242
|
}
|
|
39013
|
-
await
|
|
39243
|
+
await adapter.modules.buildTypes.deleteBuildStep(typedArgs.buildTypeId, typedArgs.stepId);
|
|
39014
39244
|
return json({
|
|
39015
39245
|
success: true,
|
|
39016
39246
|
action: "delete_build_step",
|
|
@@ -39040,7 +39270,7 @@ var FULL_MODE_TOOLS = [
|
|
|
39040
39270
|
},
|
|
39041
39271
|
handler: async (args) => {
|
|
39042
39272
|
const typedArgs = args;
|
|
39043
|
-
const
|
|
39273
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39044
39274
|
switch (typedArgs.action) {
|
|
39045
39275
|
case "add": {
|
|
39046
39276
|
const trigger = {
|
|
@@ -39052,9 +39282,14 @@ var FULL_MODE_TOOLS = [
|
|
|
39052
39282
|
}))
|
|
39053
39283
|
}
|
|
39054
39284
|
};
|
|
39055
|
-
await
|
|
39056
|
-
|
|
39057
|
-
|
|
39285
|
+
await adapter.modules.buildTypes.addTriggerToBuildType(
|
|
39286
|
+
typedArgs.buildTypeId,
|
|
39287
|
+
void 0,
|
|
39288
|
+
trigger,
|
|
39289
|
+
{
|
|
39290
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
39291
|
+
}
|
|
39292
|
+
);
|
|
39058
39293
|
return json({
|
|
39059
39294
|
success: true,
|
|
39060
39295
|
action: "add_build_trigger",
|
|
@@ -39069,7 +39304,10 @@ var FULL_MODE_TOOLS = [
|
|
|
39069
39304
|
error: "Trigger ID is required for delete action"
|
|
39070
39305
|
});
|
|
39071
39306
|
}
|
|
39072
|
-
await
|
|
39307
|
+
await adapter.modules.buildTypes.deleteTrigger(
|
|
39308
|
+
typedArgs.buildTypeId,
|
|
39309
|
+
typedArgs.triggerId
|
|
39310
|
+
);
|
|
39073
39311
|
return json({
|
|
39074
39312
|
success: true,
|
|
39075
39313
|
action: "delete_build_trigger",
|
|
@@ -39109,21 +39347,21 @@ var FULL_MODE_TOOLS = [
|
|
|
39109
39347
|
"set_build_configs_paused",
|
|
39110
39348
|
schema,
|
|
39111
39349
|
async (typed) => {
|
|
39112
|
-
const
|
|
39350
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39113
39351
|
let updated = 0;
|
|
39114
39352
|
for (const id of typed.buildTypeIds) {
|
|
39115
|
-
await
|
|
39353
|
+
await adapter.modules.buildTypes.setBuildTypeField(id, "paused", String(typed.paused));
|
|
39116
39354
|
updated += 1;
|
|
39117
39355
|
}
|
|
39118
39356
|
let canceled = 0;
|
|
39119
39357
|
if (typed.cancelQueued) {
|
|
39120
|
-
const queue = await
|
|
39358
|
+
const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
|
|
39121
39359
|
const builds = queue.data?.build ?? [];
|
|
39122
39360
|
const ids = new Set(typed.buildTypeIds);
|
|
39123
39361
|
const toCancel = builds.filter((b) => b.buildTypeId && ids.has(b.buildTypeId));
|
|
39124
39362
|
for (const b of toCancel) {
|
|
39125
39363
|
if (b.id == null) continue;
|
|
39126
|
-
await
|
|
39364
|
+
await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
|
|
39127
39365
|
canceled += 1;
|
|
39128
39366
|
}
|
|
39129
39367
|
}
|
|
@@ -39189,7 +39427,7 @@ var FULL_MODE_TOOLS = [
|
|
|
39189
39427
|
"mute_tests",
|
|
39190
39428
|
schema,
|
|
39191
39429
|
async (typed) => {
|
|
39192
|
-
const
|
|
39430
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39193
39431
|
let scope;
|
|
39194
39432
|
if (typed.buildTypeId) {
|
|
39195
39433
|
scope = { buildType: { id: typed.buildTypeId } };
|
|
@@ -39212,7 +39450,7 @@ var FULL_MODE_TOOLS = [
|
|
|
39212
39450
|
}
|
|
39213
39451
|
]
|
|
39214
39452
|
};
|
|
39215
|
-
const response = await
|
|
39453
|
+
const response = await adapter.modules.mutes.muteMultipleTests(typed.fields, payload, {
|
|
39216
39454
|
headers: {
|
|
39217
39455
|
"Content-Type": "application/json",
|
|
39218
39456
|
Accept: "application/json"
|
|
@@ -39247,8 +39485,8 @@ var FULL_MODE_TOOLS = [
|
|
|
39247
39485
|
"move_queued_build_to_top",
|
|
39248
39486
|
schema,
|
|
39249
39487
|
async (typed) => {
|
|
39250
|
-
const
|
|
39251
|
-
await
|
|
39488
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39489
|
+
await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
|
|
39252
39490
|
build: [{ id: parseInt(typed.buildId) }]
|
|
39253
39491
|
});
|
|
39254
39492
|
return json({
|
|
@@ -39276,8 +39514,8 @@ var FULL_MODE_TOOLS = [
|
|
|
39276
39514
|
"reorder_queued_builds",
|
|
39277
39515
|
schema,
|
|
39278
39516
|
async (typed) => {
|
|
39279
|
-
const
|
|
39280
|
-
await
|
|
39517
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39518
|
+
await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
|
|
39281
39519
|
build: typed.buildIds.map((id) => ({ id: parseInt(id) }))
|
|
39282
39520
|
});
|
|
39283
39521
|
return json({
|
|
@@ -39305,14 +39543,14 @@ var FULL_MODE_TOOLS = [
|
|
|
39305
39543
|
"cancel_queued_builds_for_build_type",
|
|
39306
39544
|
schema,
|
|
39307
39545
|
async (typed) => {
|
|
39308
|
-
const
|
|
39309
|
-
const queue = await
|
|
39546
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39547
|
+
const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
|
|
39310
39548
|
const builds = queue.data?.build ?? [];
|
|
39311
39549
|
const toCancel = builds.filter((b) => b.buildTypeId === typed.buildTypeId);
|
|
39312
39550
|
let canceled = 0;
|
|
39313
39551
|
for (const b of toCancel) {
|
|
39314
39552
|
if (b.id == null) continue;
|
|
39315
|
-
await
|
|
39553
|
+
await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
|
|
39316
39554
|
canceled += 1;
|
|
39317
39555
|
}
|
|
39318
39556
|
return json({
|
|
@@ -39341,13 +39579,13 @@ var FULL_MODE_TOOLS = [
|
|
|
39341
39579
|
"cancel_queued_builds_by_locator",
|
|
39342
39580
|
schema,
|
|
39343
39581
|
async (typed) => {
|
|
39344
|
-
const
|
|
39345
|
-
const queue = await
|
|
39582
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39583
|
+
const queue = await adapter.modules.buildQueue.getAllQueuedBuilds(typed.locator);
|
|
39346
39584
|
const builds = queue.data?.build ?? [];
|
|
39347
39585
|
let canceled = 0;
|
|
39348
39586
|
for (const b of builds) {
|
|
39349
39587
|
if (b.id == null) continue;
|
|
39350
|
-
await
|
|
39588
|
+
await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
|
|
39351
39589
|
canceled += 1;
|
|
39352
39590
|
}
|
|
39353
39591
|
return json({
|
|
@@ -39390,8 +39628,10 @@ var FULL_MODE_TOOLS = [
|
|
|
39390
39628
|
"pause_queue_for_pool",
|
|
39391
39629
|
schema,
|
|
39392
39630
|
async (typed) => {
|
|
39393
|
-
const
|
|
39394
|
-
const agentsResp = await
|
|
39631
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39632
|
+
const agentsResp = await adapter.modules.agents.getAllAgents(
|
|
39633
|
+
`agentPool:(id:${typed.poolId})`
|
|
39634
|
+
);
|
|
39395
39635
|
const agents = agentsResp.data?.agent ?? [];
|
|
39396
39636
|
const body = {
|
|
39397
39637
|
status: false
|
|
@@ -39402,21 +39642,21 @@ var FULL_MODE_TOOLS = [
|
|
|
39402
39642
|
for (const a of agents) {
|
|
39403
39643
|
const id = a.id;
|
|
39404
39644
|
if (!id) continue;
|
|
39405
|
-
await
|
|
39645
|
+
await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
|
|
39406
39646
|
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
39407
39647
|
});
|
|
39408
39648
|
disabled += 1;
|
|
39409
39649
|
}
|
|
39410
39650
|
let canceled = 0;
|
|
39411
39651
|
if (typed.cancelQueuedForBuildTypeId) {
|
|
39412
|
-
const queue = await
|
|
39652
|
+
const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
|
|
39413
39653
|
const builds = queue.data?.build ?? [];
|
|
39414
39654
|
const toCancel = builds.filter(
|
|
39415
39655
|
(b) => b.buildTypeId === typed.cancelQueuedForBuildTypeId
|
|
39416
39656
|
);
|
|
39417
39657
|
for (const b of toCancel) {
|
|
39418
39658
|
if (b.id == null) continue;
|
|
39419
|
-
await
|
|
39659
|
+
await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
|
|
39420
39660
|
canceled += 1;
|
|
39421
39661
|
}
|
|
39422
39662
|
}
|
|
@@ -39447,14 +39687,16 @@ var FULL_MODE_TOOLS = [
|
|
|
39447
39687
|
"resume_queue_for_pool",
|
|
39448
39688
|
schema,
|
|
39449
39689
|
async (typed) => {
|
|
39450
|
-
const
|
|
39451
|
-
const agentsResp = await
|
|
39690
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39691
|
+
const agentsResp = await adapter.modules.agents.getAllAgents(
|
|
39692
|
+
`agentPool:(id:${typed.poolId})`
|
|
39693
|
+
);
|
|
39452
39694
|
const agents = agentsResp.data?.agent ?? [];
|
|
39453
39695
|
let enabled = 0;
|
|
39454
39696
|
for (const a of agents) {
|
|
39455
39697
|
const id = a.id;
|
|
39456
39698
|
if (!id) continue;
|
|
39457
|
-
await
|
|
39699
|
+
await adapter.modules.agents.setEnabledInfo(
|
|
39458
39700
|
id,
|
|
39459
39701
|
void 0,
|
|
39460
39702
|
{ status: true },
|
|
@@ -39502,11 +39744,11 @@ var FULL_MODE_TOOLS = [
|
|
|
39502
39744
|
"set_agent_enabled",
|
|
39503
39745
|
schema,
|
|
39504
39746
|
async (typed) => {
|
|
39505
|
-
const
|
|
39747
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39506
39748
|
const body = { status: typed.enabled };
|
|
39507
39749
|
if (typed.comment) body.comment = { text: typed.comment };
|
|
39508
39750
|
if (typed.until) body.statusSwitchTime = typed.until;
|
|
39509
|
-
const resp = await
|
|
39751
|
+
const resp = await adapter.modules.agents.setEnabledInfo(typed.agentId, void 0, body, {
|
|
39510
39752
|
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
39511
39753
|
});
|
|
39512
39754
|
return json({
|
|
@@ -39561,13 +39803,13 @@ var FULL_MODE_TOOLS = [
|
|
|
39561
39803
|
"bulk_set_agents_enabled",
|
|
39562
39804
|
schema,
|
|
39563
39805
|
async (typed) => {
|
|
39564
|
-
const
|
|
39806
|
+
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39565
39807
|
const filters = [];
|
|
39566
39808
|
if (typed.poolId) filters.push(`agentPool:(id:${typed.poolId})`);
|
|
39567
39809
|
if (typed.locator) filters.push(typed.locator);
|
|
39568
39810
|
if (typed.includeDisabled === false) filters.push("enabled:true");
|
|
39569
39811
|
const locator = filters.join(",");
|
|
39570
|
-
const list = await
|
|
39812
|
+
const list = await adapter.modules.agents.getAllAgents(locator);
|
|
39571
39813
|
const agents = list.data?.agent ?? [];
|
|
39572
39814
|
const body = { status: typed.enabled };
|
|
39573
39815
|
if (typed.comment) body.comment = { text: typed.comment };
|
|
@@ -39577,7 +39819,7 @@ var FULL_MODE_TOOLS = [
|
|
|
39577
39819
|
const id = String(a.id ?? "");
|
|
39578
39820
|
if (!id) continue;
|
|
39579
39821
|
try {
|
|
39580
|
-
await
|
|
39822
|
+
await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
|
|
39581
39823
|
headers: {
|
|
39582
39824
|
"Content-Type": "application/json",
|
|
39583
39825
|
Accept: "application/json"
|