@daghis/teamcity-mcp 1.10.8 → 1.11.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/index.js +487 -305
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34,21 +34,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
|
|
36
36
|
// src/teamcity/errors.ts
|
|
37
|
-
function isRetryableError(
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
37
|
+
function isRetryableError(error3) {
|
|
38
|
+
if (error3 instanceof TeamCityAPIError) {
|
|
39
|
+
if (error3 instanceof TeamCityNetworkError) {
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (error3 instanceof TeamCityTimeoutError) {
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
-
if (
|
|
45
|
+
if (error3 instanceof TeamCityServerError) {
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
|
-
if (
|
|
48
|
+
if (error3 instanceof TeamCityRateLimitError) {
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
|
-
if (
|
|
51
|
+
if (error3.statusCode === 503) {
|
|
52
52
|
return true;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -78,21 +78,21 @@ var init_errors = __esm({
|
|
|
78
78
|
/**
|
|
79
79
|
* Create from Axios error
|
|
80
80
|
*/
|
|
81
|
-
static fromAxiosError(
|
|
82
|
-
if (
|
|
83
|
-
const data =
|
|
81
|
+
static fromAxiosError(error3, requestId) {
|
|
82
|
+
if (error3.response) {
|
|
83
|
+
const data = error3.response.data;
|
|
84
84
|
return new _TeamCityAPIError(
|
|
85
|
-
(typeof data?.["message"] === "string" ? data["message"] : null) ??
|
|
86
|
-
(typeof data?.["code"] === "string" ? data["code"] : null) ?? `HTTP_${
|
|
87
|
-
|
|
85
|
+
(typeof data?.["message"] === "string" ? data["message"] : null) ?? error3.message,
|
|
86
|
+
(typeof data?.["code"] === "string" ? data["code"] : null) ?? `HTTP_${error3.response.status}`,
|
|
87
|
+
error3.response.status,
|
|
88
88
|
data,
|
|
89
89
|
requestId,
|
|
90
|
-
|
|
90
|
+
error3
|
|
91
91
|
);
|
|
92
|
-
} else if (
|
|
93
|
-
return new TeamCityNetworkError(
|
|
92
|
+
} else if (error3.request !== null && error3.request !== void 0) {
|
|
93
|
+
return new TeamCityNetworkError(error3.message, requestId, error3);
|
|
94
94
|
} else {
|
|
95
|
-
return new TeamCityRequestError(
|
|
95
|
+
return new TeamCityRequestError(error3.message, requestId, error3);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
toJSON() {
|
|
@@ -212,7 +212,7 @@ var require_is_retry_allowed = __commonJS({
|
|
|
212
212
|
"CERT_REJECTED",
|
|
213
213
|
"HOSTNAME_MISMATCH"
|
|
214
214
|
]);
|
|
215
|
-
module2.exports = (
|
|
215
|
+
module2.exports = (error3) => !denyList.has(error3 && error3.code);
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
|
|
@@ -275,16 +275,16 @@ var init_build_status_manager = __esm({
|
|
|
275
275
|
this.setCachedResult(cacheKey, result);
|
|
276
276
|
}
|
|
277
277
|
return result;
|
|
278
|
-
} catch (
|
|
279
|
-
if (
|
|
278
|
+
} catch (error3) {
|
|
279
|
+
if (error3 != null && typeof error3 === "object" && "response" in error3 && error3.response?.status === 404) {
|
|
280
280
|
throw new BuildNotFoundError(`Build not found: ${options.buildId ?? options.buildNumber}`);
|
|
281
281
|
}
|
|
282
|
-
if (
|
|
282
|
+
if (error3 != null && typeof error3 === "object" && "response" in error3 && error3.response?.status === 403) {
|
|
283
283
|
throw new BuildAccessDeniedError(
|
|
284
284
|
`Access denied to build: ${options.buildId ?? options.buildNumber}`
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
|
-
throw
|
|
287
|
+
throw error3;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
@@ -305,11 +305,11 @@ var init_build_status_manager = __esm({
|
|
|
305
305
|
throw new BuildNotFoundError(`No builds found for locator: ${locator}`);
|
|
306
306
|
}
|
|
307
307
|
return this.transformBuildResponse(firstBuild, {});
|
|
308
|
-
} catch (
|
|
309
|
-
if (
|
|
308
|
+
} catch (error3) {
|
|
309
|
+
if (error3 != null && typeof error3 === "object" && "response" in error3 && error3.response?.status === 404) {
|
|
310
310
|
throw new BuildNotFoundError(`No builds found for locator: ${locator}`);
|
|
311
311
|
}
|
|
312
|
-
throw
|
|
312
|
+
throw error3;
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
@@ -642,6 +642,43 @@ function getTeamCityToken() {
|
|
|
642
642
|
return config2.teamcity.token;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
// src/server-runner.ts
|
|
646
|
+
async function startServerLifecycle(server, transport) {
|
|
647
|
+
await server.connect(transport);
|
|
648
|
+
return new Promise((resolve2, reject) => {
|
|
649
|
+
const previousOnClose = server.onclose;
|
|
650
|
+
const previousOnError = server.onerror;
|
|
651
|
+
const cleanup = () => {
|
|
652
|
+
server.onclose = previousOnClose;
|
|
653
|
+
server.onerror = previousOnError;
|
|
654
|
+
};
|
|
655
|
+
server.onclose = () => {
|
|
656
|
+
previousOnClose?.();
|
|
657
|
+
cleanup();
|
|
658
|
+
resolve2();
|
|
659
|
+
};
|
|
660
|
+
server.onerror = (rawError) => {
|
|
661
|
+
previousOnError?.(rawError);
|
|
662
|
+
const error3 = rawError instanceof Error ? rawError : new Error(String(rawError));
|
|
663
|
+
const closeTransport = () => {
|
|
664
|
+
if (!transport.close) {
|
|
665
|
+
return Promise.resolve();
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
return Promise.resolve(transport.close());
|
|
669
|
+
} catch (closeError) {
|
|
670
|
+
return Promise.reject(closeError);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
void closeTransport().catch(() => {
|
|
674
|
+
}).finally(() => {
|
|
675
|
+
cleanup();
|
|
676
|
+
reject(error3);
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
|
|
645
682
|
// src/server.ts
|
|
646
683
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
647
684
|
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -699,7 +736,8 @@ var TeamCityLogger = class _TeamCityLogger {
|
|
|
699
736
|
if (enableConsole) {
|
|
700
737
|
transports.push(
|
|
701
738
|
new import_winston.default.transports.Console({
|
|
702
|
-
format: isProduction ? prodFormat : devFormat
|
|
739
|
+
format: isProduction ? prodFormat : devFormat,
|
|
740
|
+
stderrLevels: ["error", "warn", "info", "http", "verbose", "debug", "silly"]
|
|
703
741
|
})
|
|
704
742
|
);
|
|
705
743
|
}
|
|
@@ -754,8 +792,8 @@ var TeamCityLogger = class _TeamCityLogger {
|
|
|
754
792
|
if ((0, import_node_fs.existsSync)(directory) === false) {
|
|
755
793
|
(0, import_node_fs.mkdirSync)(directory, { recursive: true });
|
|
756
794
|
}
|
|
757
|
-
} catch (
|
|
758
|
-
this.winston?.warn?.("Failed to create log directory, using current directory", { error:
|
|
795
|
+
} catch (error3) {
|
|
796
|
+
this.winston?.warn?.("Failed to create log directory, using current directory", { error: error3 });
|
|
759
797
|
}
|
|
760
798
|
}
|
|
761
799
|
/**
|
|
@@ -802,13 +840,13 @@ var TeamCityLogger = class _TeamCityLogger {
|
|
|
802
840
|
/**
|
|
803
841
|
* Error level logging with optional error object
|
|
804
842
|
*/
|
|
805
|
-
error(message,
|
|
843
|
+
error(message, error3, context = {}) {
|
|
806
844
|
const errorContext = { ...context };
|
|
807
|
-
if (
|
|
808
|
-
errorContext["error"] =
|
|
809
|
-
errorContext["stack"] =
|
|
810
|
-
} else if (
|
|
811
|
-
errorContext["error"] = String(
|
|
845
|
+
if (error3 instanceof Error) {
|
|
846
|
+
errorContext["error"] = error3.message;
|
|
847
|
+
errorContext["stack"] = error3.stack;
|
|
848
|
+
} else if (error3 != null) {
|
|
849
|
+
errorContext["error"] = String(error3);
|
|
812
850
|
}
|
|
813
851
|
this.winston.error(message, errorContext);
|
|
814
852
|
}
|
|
@@ -891,27 +929,139 @@ var logger = {
|
|
|
891
929
|
debug: (message, context) => getLogger().debug(message, context),
|
|
892
930
|
info: (message, context) => getLogger().info(message, context),
|
|
893
931
|
warn: (message, context) => getLogger().warn(message, context),
|
|
894
|
-
error: (message,
|
|
932
|
+
error: (message, error3, context) => getLogger().error(message, error3, context),
|
|
895
933
|
child: (context) => getLogger().child(context),
|
|
896
934
|
logToolExecution: (toolName, args, result, duration, context) => getLogger().logToolExecution(toolName, args, result, duration, context),
|
|
897
935
|
logTeamCityRequest: (method, url, status, duration, context) => getLogger().logTeamCityRequest(method, url, status, duration, context),
|
|
898
936
|
logLifecycle: (event, details) => getLogger().logLifecycle(event, details)
|
|
899
937
|
};
|
|
938
|
+
var { debug, info, warn, error, child } = logger;
|
|
900
939
|
|
|
901
940
|
// src/utils/logger.ts
|
|
902
|
-
function
|
|
941
|
+
function info2(message, meta) {
|
|
903
942
|
logger.info(message, meta);
|
|
904
943
|
}
|
|
905
|
-
function
|
|
944
|
+
function error2(message, err, meta) {
|
|
906
945
|
logger.error(message, err, meta);
|
|
907
946
|
}
|
|
908
|
-
function
|
|
947
|
+
function warn2(message, meta) {
|
|
909
948
|
logger.warn(message, meta);
|
|
910
949
|
}
|
|
911
|
-
function
|
|
950
|
+
function debug2(message, meta) {
|
|
912
951
|
logger.debug(message, meta);
|
|
913
952
|
}
|
|
914
953
|
|
|
954
|
+
// package.json
|
|
955
|
+
var package_default = {
|
|
956
|
+
name: "@daghis/teamcity-mcp",
|
|
957
|
+
version: "1.11.0",
|
|
958
|
+
description: "Model Control Protocol server for TeamCity CI/CD integration with AI coding assistants",
|
|
959
|
+
mcpName: "io.github.daghis/teamcity",
|
|
960
|
+
main: "dist/index.js",
|
|
961
|
+
types: "dist/index.d.ts",
|
|
962
|
+
bin: {
|
|
963
|
+
"teamcity-mcp": "dist/index.js"
|
|
964
|
+
},
|
|
965
|
+
engines: {
|
|
966
|
+
node: ">=20.10.0 <21"
|
|
967
|
+
},
|
|
968
|
+
scripts: {
|
|
969
|
+
dev: "node ./node_modules/tsx/dist/cli.mjs watch src/index.ts",
|
|
970
|
+
"dev:interactive": "bash scripts/interact.sh",
|
|
971
|
+
build: "node scripts/build.cjs",
|
|
972
|
+
"build:bundle": "CODECOV_BUNDLE=true npm run build",
|
|
973
|
+
"build:tsc": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
974
|
+
start: "node dist/index.js",
|
|
975
|
+
test: "jest",
|
|
976
|
+
"test:watch": "jest --watch",
|
|
977
|
+
"test:coverage": "jest --coverage --runInBand",
|
|
978
|
+
"test:coverage:ci": "jest -c jest.ci.config.js --coverage --runInBand",
|
|
979
|
+
"test:unit": "jest tests/unit",
|
|
980
|
+
"test:integration": "node scripts/verify-integration-env.cjs && jest tests/integration",
|
|
981
|
+
"test:ci": "jest --coverage --ci --reporters=default --reporters=jest-junit",
|
|
982
|
+
lint: `sh -c "node ./node_modules/eslint/bin/eslint.js 'src/**/*.{ts,tsx}' 'tests/**/*.test.{ts,tsx,js}' --fix --no-error-on-unmatched-pattern"`,
|
|
983
|
+
"lint:check": "node ./node_modules/eslint/bin/eslint.js 'src/**/*.{ts,tsx}' 'tests/**/*.test.{ts,tsx,js}' --no-error-on-unmatched-pattern",
|
|
984
|
+
format: "node ./node_modules/prettier/bin/prettier.cjs --write 'src/**/*.{ts,tsx,json,md}' 'tests/**/*.{ts,tsx,js,json,md}'",
|
|
985
|
+
"format:check": "node ./node_modules/prettier/bin/prettier.cjs --check 'src/**/*.{ts,tsx,json,md}' 'tests/**/*.{ts,tsx,js,json,md}'",
|
|
986
|
+
typecheck: "node ./node_modules/typescript/bin/tsc --noEmit -p tsconfig.build.json",
|
|
987
|
+
"typecheck:all": "node ./node_modules/typescript/bin/tsc --noEmit",
|
|
988
|
+
check: "npm run typecheck && npm run lint:check && npm run format:check",
|
|
989
|
+
clean: "rm -rf dist coverage",
|
|
990
|
+
"fetch:swagger": "node ./node_modules/tsx/dist/cli.mjs scripts/fetch-swagger-spec.ts",
|
|
991
|
+
"generate:client": "npm exec -y @openapitools/openapi-generator-cli@2.23.1 -- generate -c openapi-generator-config.json",
|
|
992
|
+
"update:client": "npm run fetch:swagger -- --force && npm run generate:client",
|
|
993
|
+
e2e: "node ./node_modules/tsx/dist/cli.mjs tests/e2e/index.ts",
|
|
994
|
+
"e2e:build": "npm run build && node dist/e2e/index.js",
|
|
995
|
+
"e2e:setup": "node ./node_modules/tsx/dist/cli.mjs tests/e2e/setup-playground.ts",
|
|
996
|
+
"e2e:cleanup": "node ./node_modules/tsx/dist/cli.mjs tests/e2e/cleanup.ts",
|
|
997
|
+
"generate:notices": "node scripts/generate-third-party-notices.cjs"
|
|
998
|
+
},
|
|
999
|
+
keywords: [
|
|
1000
|
+
"mcp",
|
|
1001
|
+
"teamcity",
|
|
1002
|
+
"ci",
|
|
1003
|
+
"cd",
|
|
1004
|
+
"ai",
|
|
1005
|
+
"claude",
|
|
1006
|
+
"cursor",
|
|
1007
|
+
"windsurf",
|
|
1008
|
+
"devops"
|
|
1009
|
+
],
|
|
1010
|
+
author: "",
|
|
1011
|
+
license: "MIT",
|
|
1012
|
+
repository: {
|
|
1013
|
+
type: "git",
|
|
1014
|
+
url: "https://github.com/Daghis/teamcity-mcp.git"
|
|
1015
|
+
},
|
|
1016
|
+
dependencies: {
|
|
1017
|
+
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
1018
|
+
ajv: "^8.17.1",
|
|
1019
|
+
"ajv-formats": "^3.0.1",
|
|
1020
|
+
axios: "^1.12.1",
|
|
1021
|
+
dotenv: "^17.2.2",
|
|
1022
|
+
express: "^5.1.0",
|
|
1023
|
+
inversify: "^7.9.1",
|
|
1024
|
+
morgan: "^1.10.0",
|
|
1025
|
+
"reflect-metadata": "^0.2.2",
|
|
1026
|
+
tslib: "^2.8.1",
|
|
1027
|
+
winston: "^3.11.0",
|
|
1028
|
+
zod: "^4.1.11"
|
|
1029
|
+
},
|
|
1030
|
+
devDependencies: {
|
|
1031
|
+
"@codecov/bundler-plugin-core": "^1.9.1",
|
|
1032
|
+
"@eslint/compat": "^1.4.0",
|
|
1033
|
+
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
|
|
1034
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
1035
|
+
"@types/ajv": "^1.0.4",
|
|
1036
|
+
"@types/express": "^5.0.3",
|
|
1037
|
+
"@types/jest": "^30.0.0",
|
|
1038
|
+
"@types/js-yaml": "^4.0.9",
|
|
1039
|
+
"@types/morgan": "^1.9.9",
|
|
1040
|
+
"@types/node": "^24.3.1",
|
|
1041
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
1042
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
1043
|
+
"axios-retry": "^4.5.0",
|
|
1044
|
+
esbuild: "^0.25.9",
|
|
1045
|
+
eslint: "^9.36.0",
|
|
1046
|
+
"eslint-config-prettier": "^10.1.8",
|
|
1047
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
1048
|
+
"eslint-plugin-import": "^2.32.0",
|
|
1049
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
1050
|
+
jest: "^30.1.3",
|
|
1051
|
+
"jest-junit": "^16.0.0",
|
|
1052
|
+
"js-yaml": "^4.1.0",
|
|
1053
|
+
prettier: "^3.1.0",
|
|
1054
|
+
"ts-jest": "^29.4.1",
|
|
1055
|
+
"tsc-alias": "^1.8.8",
|
|
1056
|
+
"tsconfig-paths": "^4.2.0",
|
|
1057
|
+
tsx: "^4.6.0",
|
|
1058
|
+
typescript: "^5.3.2"
|
|
1059
|
+
},
|
|
1060
|
+
overrides: {
|
|
1061
|
+
axios: "^1.12.1"
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
|
|
915
1065
|
// src/tools.ts
|
|
916
1066
|
var import_node_crypto = require("node:crypto");
|
|
917
1067
|
var import_node_fs2 = require("node:fs");
|
|
@@ -1037,11 +1187,11 @@ var AgentRequirementsManager = class {
|
|
|
1037
1187
|
JSON_GET_HEADERS
|
|
1038
1188
|
);
|
|
1039
1189
|
return response.data;
|
|
1040
|
-
} catch (
|
|
1041
|
-
if (typeof
|
|
1190
|
+
} catch (error3) {
|
|
1191
|
+
if (typeof error3 === "object" && error3 !== null && "response" in error3 && error3.response?.status === 404) {
|
|
1042
1192
|
return null;
|
|
1043
1193
|
}
|
|
1044
|
-
throw
|
|
1194
|
+
throw error3;
|
|
1045
1195
|
}
|
|
1046
1196
|
}
|
|
1047
1197
|
buildPayload(existing, input) {
|
|
@@ -1118,15 +1268,15 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1118
1268
|
}
|
|
1119
1269
|
this.cacheResult(cacheKey, artifacts);
|
|
1120
1270
|
return artifacts;
|
|
1121
|
-
} catch (
|
|
1122
|
-
const err =
|
|
1271
|
+
} catch (error3) {
|
|
1272
|
+
const err = error3;
|
|
1123
1273
|
if (err.response?.status === 401) {
|
|
1124
1274
|
throw new Error("Authentication failed: Invalid TeamCity token");
|
|
1125
1275
|
}
|
|
1126
1276
|
if (err.response?.status === 404) {
|
|
1127
1277
|
throw new Error(`Build not found: ${buildId}`);
|
|
1128
1278
|
}
|
|
1129
|
-
const errMsg = err.message ?? String(
|
|
1279
|
+
const errMsg = err.message ?? String(error3);
|
|
1130
1280
|
throw new Error(`Failed to fetch artifacts: ${errMsg}`);
|
|
1131
1281
|
}
|
|
1132
1282
|
}
|
|
@@ -1138,7 +1288,7 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1138
1288
|
for (let attempt = 1; attempt <= _ArtifactManager.artifactRetryAttempts; attempt += 1) {
|
|
1139
1289
|
const artifacts = await this.listArtifacts(buildId, { forceRefresh: attempt > 1 });
|
|
1140
1290
|
const listSample = artifacts.slice(0, 5).map((entry) => entry.path);
|
|
1141
|
-
|
|
1291
|
+
debug2("artifact-manager.downloadArtifact.list", {
|
|
1142
1292
|
buildId,
|
|
1143
1293
|
requested: artifactPath,
|
|
1144
1294
|
availableCount: artifacts.length,
|
|
@@ -1153,7 +1303,7 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1153
1303
|
forceRefresh: true
|
|
1154
1304
|
});
|
|
1155
1305
|
const nestedSample = nestedArtifacts.slice(0, 5).map((entry) => entry.path);
|
|
1156
|
-
|
|
1306
|
+
debug2("artifact-manager.downloadArtifact.listNested", {
|
|
1157
1307
|
buildId,
|
|
1158
1308
|
requested: artifactPath,
|
|
1159
1309
|
availableCount: nestedArtifacts.length,
|
|
@@ -1170,7 +1320,7 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1170
1320
|
}
|
|
1171
1321
|
}
|
|
1172
1322
|
if (!artifact) {
|
|
1173
|
-
|
|
1323
|
+
debug2("artifact-manager.downloadArtifact.miss", {
|
|
1174
1324
|
buildId,
|
|
1175
1325
|
requested: artifactPath,
|
|
1176
1326
|
attempts: _ArtifactManager.artifactRetryAttempts
|
|
@@ -1248,11 +1398,11 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1248
1398
|
content,
|
|
1249
1399
|
mimeType: typeof axiosResponse.headers?.["content-type"] === "string" ? axiosResponse.headers["content-type"] : void 0
|
|
1250
1400
|
};
|
|
1251
|
-
} catch (
|
|
1401
|
+
} catch (error3) {
|
|
1252
1402
|
let errMsg;
|
|
1253
|
-
if ((0, import_axios.isAxiosError)(
|
|
1254
|
-
const status =
|
|
1255
|
-
const data =
|
|
1403
|
+
if ((0, import_axios.isAxiosError)(error3)) {
|
|
1404
|
+
const status = error3.response?.status;
|
|
1405
|
+
const data = error3.response?.data;
|
|
1256
1406
|
let detail;
|
|
1257
1407
|
if (typeof data === "string") {
|
|
1258
1408
|
detail = data;
|
|
@@ -1265,7 +1415,7 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1265
1415
|
}
|
|
1266
1416
|
errMsg = `HTTP ${status ?? "unknown"}${detail ? `: ${detail}` : ""}`;
|
|
1267
1417
|
} else {
|
|
1268
|
-
errMsg =
|
|
1418
|
+
errMsg = error3 instanceof Error ? error3.message : "Unknown error";
|
|
1269
1419
|
}
|
|
1270
1420
|
throw new Error(`Failed to download artifact: ${errMsg}`);
|
|
1271
1421
|
}
|
|
@@ -1283,11 +1433,11 @@ var ArtifactManager = class _ArtifactManager {
|
|
|
1283
1433
|
try {
|
|
1284
1434
|
const artifact = await this.downloadArtifact(buildId, path, downloadOptions);
|
|
1285
1435
|
results.push(artifact);
|
|
1286
|
-
} catch (
|
|
1287
|
-
const reason =
|
|
1436
|
+
} catch (error3) {
|
|
1437
|
+
const reason = error3;
|
|
1288
1438
|
const message = reason instanceof Error ? reason.message : typeof reason === "object" && reason?.message ? String(reason.message) : String(reason ?? "Unknown error");
|
|
1289
1439
|
const fallbackName = path ?? "unknown";
|
|
1290
|
-
|
|
1440
|
+
debug2("artifact-manager.downloadMultipleArtifacts.error", {
|
|
1291
1441
|
buildId,
|
|
1292
1442
|
requested: fallbackName,
|
|
1293
1443
|
encoding: downloadOptions.encoding,
|
|
@@ -1588,7 +1738,7 @@ var BuildConfigurationCloneManager = class {
|
|
|
1588
1738
|
} catch (err) {
|
|
1589
1739
|
const axiosError = err;
|
|
1590
1740
|
if (axiosError.response?.status === 404) {
|
|
1591
|
-
|
|
1741
|
+
debug2("Build configuration not found", { configId });
|
|
1592
1742
|
return null;
|
|
1593
1743
|
}
|
|
1594
1744
|
if (axiosError.response?.status === 403) {
|
|
@@ -1612,11 +1762,11 @@ var BuildConfigurationCloneManager = class {
|
|
|
1612
1762
|
} catch (err) {
|
|
1613
1763
|
const axiosError = err;
|
|
1614
1764
|
if (axiosError.response?.status === 404) {
|
|
1615
|
-
|
|
1765
|
+
debug2("Target project not found", { projectId });
|
|
1616
1766
|
return null;
|
|
1617
1767
|
}
|
|
1618
1768
|
if (axiosError.response?.status === 403) {
|
|
1619
|
-
|
|
1769
|
+
debug2("No permission to access target project", { projectId });
|
|
1620
1770
|
return null;
|
|
1621
1771
|
}
|
|
1622
1772
|
throw err;
|
|
@@ -1665,7 +1815,7 @@ var BuildConfigurationCloneManager = class {
|
|
|
1665
1815
|
}
|
|
1666
1816
|
return { id: newId, name: newName };
|
|
1667
1817
|
} catch (err) {
|
|
1668
|
-
|
|
1818
|
+
error2("Failed to clone VCS root", err);
|
|
1669
1819
|
throw new Error(`Failed to clone VCS root: ${err.message}`);
|
|
1670
1820
|
}
|
|
1671
1821
|
}
|
|
@@ -1787,29 +1937,29 @@ var BuildConfigurationCloneManager = class {
|
|
|
1787
1937
|
parameters: options.parameters,
|
|
1788
1938
|
url: `${teamcityUrl}/viewType.html?buildTypeId=${id}`
|
|
1789
1939
|
};
|
|
1790
|
-
|
|
1940
|
+
info2("Build configuration cloned", {
|
|
1791
1941
|
id: result.id,
|
|
1792
1942
|
name: result.name,
|
|
1793
1943
|
sourceId: source.id
|
|
1794
1944
|
});
|
|
1795
1945
|
return result;
|
|
1796
1946
|
} catch (err) {
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
1947
|
+
const error3 = err;
|
|
1948
|
+
if (error3.response?.status === 409) {
|
|
1799
1949
|
throw new Error(`Build configuration already exists with ID: ${configId}`);
|
|
1800
1950
|
}
|
|
1801
|
-
if (
|
|
1951
|
+
if (error3.response?.status === 403) {
|
|
1802
1952
|
throw new Error("Permission denied: You need project edit permissions");
|
|
1803
1953
|
}
|
|
1804
|
-
if (
|
|
1805
|
-
const message =
|
|
1954
|
+
if (error3.response?.status === 400) {
|
|
1955
|
+
const message = error3.response?.data?.message ?? "Invalid configuration";
|
|
1806
1956
|
throw new Error(`Invalid configuration: ${message}`);
|
|
1807
1957
|
}
|
|
1808
|
-
|
|
1958
|
+
error2(
|
|
1809
1959
|
"Failed to clone build configuration",
|
|
1810
|
-
|
|
1960
|
+
error3 instanceof Error ? error3 : new Error(String(error3))
|
|
1811
1961
|
);
|
|
1812
|
-
throw
|
|
1962
|
+
throw error3;
|
|
1813
1963
|
}
|
|
1814
1964
|
}
|
|
1815
1965
|
/**
|
|
@@ -1891,10 +2041,10 @@ var BuildConfigurationCloneManager = class {
|
|
|
1891
2041
|
// src/teamcity/build-configuration-update-manager.ts
|
|
1892
2042
|
var ARTIFACT_RULES_SETTINGS_FIELD = "settings/artifactRules";
|
|
1893
2043
|
var ARTIFACT_RULES_LEGACY_FIELD = "artifactRules";
|
|
1894
|
-
var isArtifactRulesRetryableError = (
|
|
1895
|
-
if (
|
|
1896
|
-
if (!("response" in
|
|
1897
|
-
const response =
|
|
2044
|
+
var isArtifactRulesRetryableError = (error3) => {
|
|
2045
|
+
if (error3 == null || typeof error3 !== "object") return false;
|
|
2046
|
+
if (!("response" in error3)) return false;
|
|
2047
|
+
const response = error3.response;
|
|
1898
2048
|
const status = response?.status;
|
|
1899
2049
|
return status === 400 || status === 404;
|
|
1900
2050
|
};
|
|
@@ -1906,14 +2056,14 @@ var setArtifactRulesWithFallback = async (api, buildTypeId, artifactRules) => {
|
|
|
1906
2056
|
throw err;
|
|
1907
2057
|
}
|
|
1908
2058
|
const status = err.response?.status;
|
|
1909
|
-
|
|
2059
|
+
debug2("Retrying artifact rules update via legacy field", {
|
|
1910
2060
|
buildTypeId,
|
|
1911
2061
|
status
|
|
1912
2062
|
});
|
|
1913
2063
|
try {
|
|
1914
2064
|
await api.setBuildTypeField(buildTypeId, ARTIFACT_RULES_LEGACY_FIELD, artifactRules);
|
|
1915
2065
|
} catch (fallbackError) {
|
|
1916
|
-
|
|
2066
|
+
debug2("Legacy artifact rules update failed", {
|
|
1917
2067
|
buildTypeId,
|
|
1918
2068
|
status: fallbackError.response?.status
|
|
1919
2069
|
});
|
|
@@ -1981,7 +2131,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1981
2131
|
};
|
|
1982
2132
|
} catch (err) {
|
|
1983
2133
|
if (err != null && typeof err === "object" && "response" in err && err.response?.status === 404) {
|
|
1984
|
-
|
|
2134
|
+
debug2("Build configuration not found", { configId });
|
|
1985
2135
|
return null;
|
|
1986
2136
|
}
|
|
1987
2137
|
if (err != null && typeof err === "object" && "response" in err && err.response?.status === 403) {
|
|
@@ -1994,7 +2144,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
1994
2144
|
* Validate updates before applying
|
|
1995
2145
|
*/
|
|
1996
2146
|
async validateUpdates(currentConfig, updates) {
|
|
1997
|
-
|
|
2147
|
+
debug2("Validating updates", {
|
|
1998
2148
|
configId: currentConfig.id,
|
|
1999
2149
|
updateFields: Object.keys(updates)
|
|
2000
2150
|
});
|
|
@@ -2043,7 +2193,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2043
2193
|
* Apply updates to configuration
|
|
2044
2194
|
*/
|
|
2045
2195
|
async applyUpdates(currentConfig, updates) {
|
|
2046
|
-
|
|
2196
|
+
info2("Applying updates to build configuration", {
|
|
2047
2197
|
id: currentConfig.id,
|
|
2048
2198
|
updateCount: Object.keys(updates).length
|
|
2049
2199
|
});
|
|
@@ -2109,7 +2259,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2109
2259
|
};
|
|
2110
2260
|
}
|
|
2111
2261
|
if (updates.agentRequirements) {
|
|
2112
|
-
|
|
2262
|
+
debug2("Agent requirements update requested", updates.agentRequirements);
|
|
2113
2263
|
}
|
|
2114
2264
|
try {
|
|
2115
2265
|
if (updates.name !== void 0 || updates.description !== void 0) {
|
|
@@ -2153,7 +2303,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2153
2303
|
currentConfig.id
|
|
2154
2304
|
);
|
|
2155
2305
|
} catch (err) {
|
|
2156
|
-
|
|
2306
|
+
debug2(`Failed to remove parameter ${paramName}`, err);
|
|
2157
2307
|
}
|
|
2158
2308
|
}
|
|
2159
2309
|
}
|
|
@@ -2170,24 +2320,24 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2170
2320
|
if (!updatedConfig) {
|
|
2171
2321
|
throw new Error("Failed to retrieve updated configuration");
|
|
2172
2322
|
}
|
|
2173
|
-
|
|
2323
|
+
info2("Configuration updated successfully", {
|
|
2174
2324
|
id: updatedConfig.id,
|
|
2175
2325
|
name: updatedConfig.name
|
|
2176
2326
|
});
|
|
2177
2327
|
return updatedConfig;
|
|
2178
2328
|
} catch (err) {
|
|
2179
|
-
const
|
|
2180
|
-
if (
|
|
2329
|
+
const error3 = err;
|
|
2330
|
+
if (error3.response?.status === 409) {
|
|
2181
2331
|
throw new Error("Configuration was modified by another user");
|
|
2182
2332
|
}
|
|
2183
|
-
if (
|
|
2333
|
+
if (error3.response?.status === 403) {
|
|
2184
2334
|
throw new Error("Permission denied: You need project edit permissions");
|
|
2185
2335
|
}
|
|
2186
|
-
if (
|
|
2187
|
-
const message =
|
|
2336
|
+
if (error3.response?.status === 400) {
|
|
2337
|
+
const message = error3.response?.data?.message ?? "Invalid configuration";
|
|
2188
2338
|
throw new Error(`Invalid update: ${message}`);
|
|
2189
2339
|
}
|
|
2190
|
-
|
|
2340
|
+
error2("Failed to apply updates", error3);
|
|
2191
2341
|
throw new Error("Partial update failure");
|
|
2192
2342
|
}
|
|
2193
2343
|
}
|
|
@@ -2280,7 +2430,7 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2280
2430
|
*/
|
|
2281
2431
|
async rollbackChanges(configId, originalConfig) {
|
|
2282
2432
|
try {
|
|
2283
|
-
|
|
2433
|
+
info2("Rolling back configuration changes", { configId });
|
|
2284
2434
|
await this.applyUpdates(originalConfig, {
|
|
2285
2435
|
name: originalConfig.name,
|
|
2286
2436
|
description: originalConfig.description,
|
|
@@ -2288,9 +2438,9 @@ var BuildConfigurationUpdateManager = class {
|
|
|
2288
2438
|
artifactRules: originalConfig.artifactRules,
|
|
2289
2439
|
parameters: originalConfig.parameters
|
|
2290
2440
|
});
|
|
2291
|
-
|
|
2441
|
+
info2("Rollback completed successfully", { configId });
|
|
2292
2442
|
} catch (err) {
|
|
2293
|
-
|
|
2443
|
+
error2("Failed to rollback changes", err);
|
|
2294
2444
|
throw new Error("Rollback failed: Manual intervention may be required");
|
|
2295
2445
|
}
|
|
2296
2446
|
}
|
|
@@ -2630,11 +2780,11 @@ var BuildDependencyManager = class {
|
|
|
2630
2780
|
JSON_GET_HEADERS2
|
|
2631
2781
|
);
|
|
2632
2782
|
return response.data;
|
|
2633
|
-
} catch (
|
|
2634
|
-
if (this.isNotFound(
|
|
2783
|
+
} catch (error3) {
|
|
2784
|
+
if (this.isNotFound(error3)) {
|
|
2635
2785
|
return null;
|
|
2636
2786
|
}
|
|
2637
|
-
throw
|
|
2787
|
+
throw error3;
|
|
2638
2788
|
}
|
|
2639
2789
|
}
|
|
2640
2790
|
buildPayload(dependencyType, existing, input) {
|
|
@@ -2703,9 +2853,9 @@ var BuildDependencyManager = class {
|
|
|
2703
2853
|
}
|
|
2704
2854
|
return payload;
|
|
2705
2855
|
}
|
|
2706
|
-
isNotFound(
|
|
2856
|
+
isNotFound(error3) {
|
|
2707
2857
|
return Boolean(
|
|
2708
|
-
typeof
|
|
2858
|
+
typeof error3 === "object" && error3 !== null && "response" in error3 && error3.response?.status === 404
|
|
2709
2859
|
);
|
|
2710
2860
|
}
|
|
2711
2861
|
};
|
|
@@ -2823,11 +2973,11 @@ var BuildFeatureManager = class {
|
|
|
2823
2973
|
JSON_GET_HEADERS3
|
|
2824
2974
|
);
|
|
2825
2975
|
return response.data;
|
|
2826
|
-
} catch (
|
|
2827
|
-
if (typeof
|
|
2976
|
+
} catch (error3) {
|
|
2977
|
+
if (typeof error3 === "object" && error3 !== null && "response" in error3 && error3.response?.status === 404) {
|
|
2828
2978
|
return null;
|
|
2829
2979
|
}
|
|
2830
|
-
throw
|
|
2980
|
+
throw error3;
|
|
2831
2981
|
}
|
|
2832
2982
|
}
|
|
2833
2983
|
buildPayload(existing, input) {
|
|
@@ -2924,28 +3074,28 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
2924
3074
|
this.cacheResult(cacheKey, result);
|
|
2925
3075
|
}
|
|
2926
3076
|
return result;
|
|
2927
|
-
} catch (
|
|
2928
|
-
if (
|
|
2929
|
-
if (
|
|
2930
|
-
throw new TeamCityNotFoundError("Build", buildId,
|
|
3077
|
+
} catch (error3) {
|
|
3078
|
+
if (error3 instanceof TeamCityAPIError) {
|
|
3079
|
+
if (error3.statusCode === 404) {
|
|
3080
|
+
throw new TeamCityNotFoundError("Build", buildId, error3.requestId, error3);
|
|
2931
3081
|
}
|
|
2932
|
-
throw
|
|
3082
|
+
throw error3;
|
|
2933
3083
|
}
|
|
2934
|
-
if (this.isAxiosNotFound(
|
|
2935
|
-
const axiosError =
|
|
3084
|
+
if (this.isAxiosNotFound(error3)) {
|
|
3085
|
+
const axiosError = error3;
|
|
2936
3086
|
const apiError = TeamCityAPIError.fromAxiosError(axiosError);
|
|
2937
3087
|
if (apiError.statusCode === 404) {
|
|
2938
3088
|
throw new TeamCityNotFoundError("Build", buildId, apiError.requestId, apiError);
|
|
2939
3089
|
}
|
|
2940
3090
|
throw apiError;
|
|
2941
3091
|
}
|
|
2942
|
-
const message =
|
|
3092
|
+
const message = error3 instanceof Error ? error3.message : String(error3);
|
|
2943
3093
|
if (/not found/i.test(message)) {
|
|
2944
3094
|
throw new TeamCityNotFoundError(
|
|
2945
3095
|
"Build",
|
|
2946
3096
|
buildId,
|
|
2947
3097
|
void 0,
|
|
2948
|
-
|
|
3098
|
+
error3 instanceof Error ? error3 : void 0
|
|
2949
3099
|
);
|
|
2950
3100
|
}
|
|
2951
3101
|
throw new TeamCityAPIError(
|
|
@@ -2954,7 +3104,7 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
2954
3104
|
void 0,
|
|
2955
3105
|
void 0,
|
|
2956
3106
|
void 0,
|
|
2957
|
-
|
|
3107
|
+
error3 instanceof Error ? error3 : void 0
|
|
2958
3108
|
);
|
|
2959
3109
|
}
|
|
2960
3110
|
}
|
|
@@ -3153,9 +3303,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
3153
3303
|
})
|
|
3154
3304
|
);
|
|
3155
3305
|
return result;
|
|
3156
|
-
} catch (
|
|
3157
|
-
|
|
3158
|
-
error:
|
|
3306
|
+
} catch (error3) {
|
|
3307
|
+
warn2("Failed to fetch artifacts", {
|
|
3308
|
+
error: error3 instanceof Error ? error3.message : error3,
|
|
3159
3309
|
buildId,
|
|
3160
3310
|
expected: "file[]"
|
|
3161
3311
|
});
|
|
@@ -3341,9 +3491,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
3341
3491
|
}
|
|
3342
3492
|
}
|
|
3343
3493
|
return stats;
|
|
3344
|
-
} catch (
|
|
3345
|
-
|
|
3346
|
-
error:
|
|
3494
|
+
} catch (error3) {
|
|
3495
|
+
warn2("Failed to fetch statistics", {
|
|
3496
|
+
error: error3 instanceof Error ? error3.message : error3,
|
|
3347
3497
|
buildId,
|
|
3348
3498
|
expected: "property[]"
|
|
3349
3499
|
});
|
|
@@ -3368,9 +3518,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
3368
3518
|
changeType: file.changeType ?? "edited"
|
|
3369
3519
|
}))
|
|
3370
3520
|
}));
|
|
3371
|
-
} catch (
|
|
3372
|
-
|
|
3373
|
-
error:
|
|
3521
|
+
} catch (error3) {
|
|
3522
|
+
warn2("Failed to fetch changes", {
|
|
3523
|
+
error: error3 instanceof Error ? error3.message : error3,
|
|
3374
3524
|
buildId,
|
|
3375
3525
|
expected: "change[]"
|
|
3376
3526
|
});
|
|
@@ -3394,9 +3544,9 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
3394
3544
|
buildTypeId: build.buildTypeId,
|
|
3395
3545
|
status: build.status
|
|
3396
3546
|
}));
|
|
3397
|
-
} catch (
|
|
3398
|
-
|
|
3399
|
-
error:
|
|
3547
|
+
} catch (error3) {
|
|
3548
|
+
warn2("Failed to fetch dependencies", {
|
|
3549
|
+
error: error3 instanceof Error ? error3.message : error3,
|
|
3400
3550
|
buildId,
|
|
3401
3551
|
expected: "build[]"
|
|
3402
3552
|
});
|
|
@@ -3467,8 +3617,8 @@ var BuildResultsManager = class _BuildResultsManager {
|
|
|
3467
3617
|
getCacheKey(buildId, options) {
|
|
3468
3618
|
return `${buildId}:${JSON.stringify(options)}`;
|
|
3469
3619
|
}
|
|
3470
|
-
isAxiosNotFound(
|
|
3471
|
-
const axiosError =
|
|
3620
|
+
isAxiosNotFound(error3) {
|
|
3621
|
+
const axiosError = error3;
|
|
3472
3622
|
return Boolean(axiosError?.response && axiosError.response.status === 404);
|
|
3473
3623
|
}
|
|
3474
3624
|
/**
|
|
@@ -3589,7 +3739,7 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
|
|
|
3589
3739
|
}
|
|
3590
3740
|
};
|
|
3591
3741
|
if (fallbackBaseUrl === FALLBACK_BASE_URL && resolvedApiConfig.baseUrl === FALLBACK_BASE_URL) {
|
|
3592
|
-
|
|
3742
|
+
warn2("TeamCity adapter using fallback baseUrl placeholder", {
|
|
3593
3743
|
reason: "missing_base_url",
|
|
3594
3744
|
hasApiConfig: Boolean(options.apiConfig)
|
|
3595
3745
|
});
|
|
@@ -3741,7 +3891,7 @@ async function fetchAllPages(fetchFn, options = {}) {
|
|
|
3741
3891
|
let currentPage = 0;
|
|
3742
3892
|
const pageSize = options.pageSize ?? 100;
|
|
3743
3893
|
const maxPages = options.maxPages;
|
|
3744
|
-
|
|
3894
|
+
info2("Starting paginated fetch", { pageSize, maxPages });
|
|
3745
3895
|
while (hasMore && (!maxPages || currentPage < maxPages)) {
|
|
3746
3896
|
const start = currentPage * pageSize;
|
|
3747
3897
|
const response = await fetchFn({
|
|
@@ -3754,13 +3904,13 @@ async function fetchAllPages(fetchFn, options = {}) {
|
|
|
3754
3904
|
if (response.items.length < pageSize) {
|
|
3755
3905
|
hasMore = false;
|
|
3756
3906
|
}
|
|
3757
|
-
|
|
3907
|
+
info2(`Fetched page ${currentPage}`, {
|
|
3758
3908
|
itemsInPage: response.items.length,
|
|
3759
3909
|
totalItems: allItems.length,
|
|
3760
3910
|
hasMore
|
|
3761
3911
|
});
|
|
3762
3912
|
}
|
|
3763
|
-
|
|
3913
|
+
info2("Paginated fetch complete", {
|
|
3764
3914
|
totalPages: currentPage,
|
|
3765
3915
|
totalItems: allItems.length
|
|
3766
3916
|
});
|
|
@@ -3904,7 +4054,7 @@ var MCPRateLimitError = class extends MCPToolError {
|
|
|
3904
4054
|
};
|
|
3905
4055
|
function formatError(err, context) {
|
|
3906
4056
|
if (err instanceof MCPToolError) {
|
|
3907
|
-
|
|
4057
|
+
error2("MCP Tool Error", err, {
|
|
3908
4058
|
code: err.code,
|
|
3909
4059
|
statusCode: err.statusCode,
|
|
3910
4060
|
data: err.data,
|
|
@@ -3920,7 +4070,7 @@ function formatError(err, context) {
|
|
|
3920
4070
|
};
|
|
3921
4071
|
}
|
|
3922
4072
|
if (err instanceof import_zod2.z.ZodError) {
|
|
3923
|
-
|
|
4073
|
+
error2("Validation Error", err, {
|
|
3924
4074
|
errors: err.issues,
|
|
3925
4075
|
...context
|
|
3926
4076
|
});
|
|
@@ -3934,7 +4084,7 @@ function formatError(err, context) {
|
|
|
3934
4084
|
};
|
|
3935
4085
|
}
|
|
3936
4086
|
if (err instanceof Error) {
|
|
3937
|
-
|
|
4087
|
+
error2("Internal Error", err, context);
|
|
3938
4088
|
return {
|
|
3939
4089
|
success: false,
|
|
3940
4090
|
error: {
|
|
@@ -3943,7 +4093,7 @@ function formatError(err, context) {
|
|
|
3943
4093
|
}
|
|
3944
4094
|
};
|
|
3945
4095
|
}
|
|
3946
|
-
|
|
4096
|
+
error2("Unknown Error", new Error(String(err)), context);
|
|
3947
4097
|
return {
|
|
3948
4098
|
success: false,
|
|
3949
4099
|
error: {
|
|
@@ -3967,37 +4117,37 @@ var ErrorLogger = class _ErrorLogger {
|
|
|
3967
4117
|
/**
|
|
3968
4118
|
* Log error with structured context
|
|
3969
4119
|
*/
|
|
3970
|
-
logError(message,
|
|
4120
|
+
logError(message, error3, context) {
|
|
3971
4121
|
const loggedError = {
|
|
3972
4122
|
message,
|
|
3973
4123
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3974
4124
|
context
|
|
3975
4125
|
};
|
|
3976
|
-
if (
|
|
3977
|
-
loggedError.stack =
|
|
3978
|
-
if (
|
|
3979
|
-
loggedError.code =
|
|
4126
|
+
if (error3 instanceof Error) {
|
|
4127
|
+
loggedError.stack = error3.stack;
|
|
4128
|
+
if (error3 instanceof MCPToolError) {
|
|
4129
|
+
loggedError.code = error3.code;
|
|
3980
4130
|
loggedError.context = {
|
|
3981
4131
|
...context,
|
|
3982
|
-
statusCode:
|
|
3983
|
-
errorData:
|
|
4132
|
+
statusCode: error3.statusCode,
|
|
4133
|
+
errorData: error3.data
|
|
3984
4134
|
};
|
|
3985
4135
|
}
|
|
3986
4136
|
}
|
|
3987
|
-
|
|
4137
|
+
error2(message, error3 instanceof Error ? error3 : void 0, context);
|
|
3988
4138
|
return loggedError;
|
|
3989
4139
|
}
|
|
3990
4140
|
/**
|
|
3991
4141
|
* Log warning with context
|
|
3992
4142
|
*/
|
|
3993
4143
|
logWarning(message, context) {
|
|
3994
|
-
|
|
4144
|
+
warn2(message, context);
|
|
3995
4145
|
}
|
|
3996
4146
|
/**
|
|
3997
4147
|
* Log info with context
|
|
3998
4148
|
*/
|
|
3999
4149
|
logInfo(message, context) {
|
|
4000
|
-
|
|
4150
|
+
info2(message, context);
|
|
4001
4151
|
}
|
|
4002
4152
|
/**
|
|
4003
4153
|
* Create error logger for a specific component
|
|
@@ -4011,8 +4161,8 @@ var ComponentErrorLogger = class {
|
|
|
4011
4161
|
this.componentName = componentName;
|
|
4012
4162
|
this.errorLogger = errorLogger2;
|
|
4013
4163
|
}
|
|
4014
|
-
logError(message,
|
|
4015
|
-
return this.errorLogger.logError(message,
|
|
4164
|
+
logError(message, error3, context) {
|
|
4165
|
+
return this.errorLogger.logError(message, error3, {
|
|
4016
4166
|
...context,
|
|
4017
4167
|
component: this.componentName
|
|
4018
4168
|
});
|
|
@@ -4052,13 +4202,13 @@ var GlobalErrorHandler = class _GlobalErrorHandler {
|
|
|
4052
4202
|
/**
|
|
4053
4203
|
* Handle error from MCP tool execution
|
|
4054
4204
|
*/
|
|
4055
|
-
handleToolError(
|
|
4205
|
+
handleToolError(error3, toolName, context) {
|
|
4056
4206
|
const enhancedContext = {
|
|
4057
4207
|
...context,
|
|
4058
4208
|
operation: toolName,
|
|
4059
4209
|
component: "MCP_TOOL"
|
|
4060
4210
|
};
|
|
4061
|
-
const transformedError = this.transformError(
|
|
4211
|
+
const transformedError = this.transformError(error3, enhancedContext);
|
|
4062
4212
|
if (this.options.logErrors) {
|
|
4063
4213
|
errorLogger.logError(
|
|
4064
4214
|
`Error in tool '${toolName}'`,
|
|
@@ -4071,13 +4221,13 @@ var GlobalErrorHandler = class _GlobalErrorHandler {
|
|
|
4071
4221
|
/**
|
|
4072
4222
|
* Handle async operation errors
|
|
4073
4223
|
*/
|
|
4074
|
-
handleAsyncError(
|
|
4224
|
+
handleAsyncError(error3, operationName, context) {
|
|
4075
4225
|
const enhancedContext = {
|
|
4076
4226
|
...context,
|
|
4077
4227
|
operation: operationName,
|
|
4078
4228
|
component: "ASYNC_HANDLER"
|
|
4079
4229
|
};
|
|
4080
|
-
const transformedError = this.transformError(
|
|
4230
|
+
const transformedError = this.transformError(error3, enhancedContext);
|
|
4081
4231
|
if (this.options.logErrors) {
|
|
4082
4232
|
errorLogger.logError(
|
|
4083
4233
|
`Async error in '${operationName}'`,
|
|
@@ -4090,28 +4240,28 @@ var GlobalErrorHandler = class _GlobalErrorHandler {
|
|
|
4090
4240
|
/**
|
|
4091
4241
|
* Transform raw errors into structured MCP errors
|
|
4092
4242
|
*/
|
|
4093
|
-
transformError(
|
|
4094
|
-
if (
|
|
4243
|
+
transformError(error3, context) {
|
|
4244
|
+
if (error3 instanceof TeamCityAPIError) {
|
|
4095
4245
|
return new MCPTeamCityError(
|
|
4096
|
-
this.sanitizeErrorMessage(
|
|
4097
|
-
|
|
4098
|
-
|
|
4246
|
+
this.sanitizeErrorMessage(error3.message),
|
|
4247
|
+
error3.statusCode ?? 500,
|
|
4248
|
+
error3.code,
|
|
4099
4249
|
context.requestId
|
|
4100
4250
|
);
|
|
4101
4251
|
}
|
|
4102
|
-
if (
|
|
4252
|
+
if (error3 instanceof MCPToolError) {
|
|
4103
4253
|
if (this.options.sanitizeErrors) {
|
|
4104
|
-
const sanitizedMessage = this.sanitizeErrorMessage(
|
|
4105
|
-
return new MCPToolError(sanitizedMessage,
|
|
4254
|
+
const sanitizedMessage = this.sanitizeErrorMessage(error3.message);
|
|
4255
|
+
return new MCPToolError(sanitizedMessage, error3.code, error3.statusCode, error3.data);
|
|
4106
4256
|
}
|
|
4107
|
-
return
|
|
4257
|
+
return error3;
|
|
4108
4258
|
}
|
|
4109
|
-
if (
|
|
4110
|
-
return this.transformAxiosError(
|
|
4259
|
+
if (error3 instanceof import_axios3.AxiosError) {
|
|
4260
|
+
return this.transformAxiosError(error3, context);
|
|
4111
4261
|
}
|
|
4112
|
-
if (
|
|
4113
|
-
const sanitizedMessage = this.sanitizeErrorMessage(
|
|
4114
|
-
if (sanitizedMessage.includes("timeout") ||
|
|
4262
|
+
if (error3 instanceof Error) {
|
|
4263
|
+
const sanitizedMessage = this.sanitizeErrorMessage(error3.message);
|
|
4264
|
+
if (sanitizedMessage.includes("timeout") || error3.name === "TimeoutError") {
|
|
4115
4265
|
return new MCPTimeoutError(context.operation ?? "unknown", 3e4);
|
|
4116
4266
|
}
|
|
4117
4267
|
if (sanitizedMessage.includes("rate limit") || sanitizedMessage.includes("429")) {
|
|
@@ -4119,7 +4269,7 @@ var GlobalErrorHandler = class _GlobalErrorHandler {
|
|
|
4119
4269
|
}
|
|
4120
4270
|
return new Error(sanitizedMessage);
|
|
4121
4271
|
}
|
|
4122
|
-
return new Error(this.sanitizeErrorMessage(String(
|
|
4272
|
+
return new Error(this.sanitizeErrorMessage(String(error3)));
|
|
4123
4273
|
}
|
|
4124
4274
|
/**
|
|
4125
4275
|
* Transform Axios errors into MCPTeamCityError
|
|
@@ -4156,15 +4306,15 @@ var GlobalErrorHandler = class _GlobalErrorHandler {
|
|
|
4156
4306
|
/**
|
|
4157
4307
|
* Check if error should be retried
|
|
4158
4308
|
*/
|
|
4159
|
-
isRetryableError(
|
|
4160
|
-
if (
|
|
4161
|
-
return
|
|
4309
|
+
isRetryableError(error3) {
|
|
4310
|
+
if (error3 instanceof MCPTeamCityError) {
|
|
4311
|
+
return error3.statusCode >= 500 && error3.statusCode < 600;
|
|
4162
4312
|
}
|
|
4163
|
-
if (
|
|
4313
|
+
if (error3 instanceof MCPTimeoutError) {
|
|
4164
4314
|
return true;
|
|
4165
4315
|
}
|
|
4166
|
-
if (
|
|
4167
|
-
return !
|
|
4316
|
+
if (error3 instanceof import_axios3.AxiosError) {
|
|
4317
|
+
return !error3.response || error3.response.status >= 500 && error3.response.status < 600;
|
|
4168
4318
|
}
|
|
4169
4319
|
return false;
|
|
4170
4320
|
}
|
|
@@ -4226,41 +4376,41 @@ var import_axios35 = __toESM(require("axios"));
|
|
|
4226
4376
|
// node_modules/axios-retry/dist/esm/index.js
|
|
4227
4377
|
var import_is_retry_allowed = __toESM(require_is_retry_allowed(), 1);
|
|
4228
4378
|
var namespace = "axios-retry";
|
|
4229
|
-
function isNetworkError(
|
|
4379
|
+
function isNetworkError(error3) {
|
|
4230
4380
|
const CODE_EXCLUDE_LIST = ["ERR_CANCELED", "ECONNABORTED"];
|
|
4231
|
-
if (
|
|
4381
|
+
if (error3.response) {
|
|
4232
4382
|
return false;
|
|
4233
4383
|
}
|
|
4234
|
-
if (!
|
|
4384
|
+
if (!error3.code) {
|
|
4235
4385
|
return false;
|
|
4236
4386
|
}
|
|
4237
|
-
if (CODE_EXCLUDE_LIST.includes(
|
|
4387
|
+
if (CODE_EXCLUDE_LIST.includes(error3.code)) {
|
|
4238
4388
|
return false;
|
|
4239
4389
|
}
|
|
4240
|
-
return (0, import_is_retry_allowed.default)(
|
|
4390
|
+
return (0, import_is_retry_allowed.default)(error3);
|
|
4241
4391
|
}
|
|
4242
4392
|
var SAFE_HTTP_METHODS = ["get", "head", "options"];
|
|
4243
4393
|
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(["put", "delete"]);
|
|
4244
|
-
function isRetryableError2(
|
|
4245
|
-
return
|
|
4394
|
+
function isRetryableError2(error3) {
|
|
4395
|
+
return error3.code !== "ECONNABORTED" && (!error3.response || error3.response.status === 429 || error3.response.status >= 500 && error3.response.status <= 599);
|
|
4246
4396
|
}
|
|
4247
|
-
function isSafeRequestError(
|
|
4248
|
-
if (!
|
|
4397
|
+
function isSafeRequestError(error3) {
|
|
4398
|
+
if (!error3.config?.method) {
|
|
4249
4399
|
return false;
|
|
4250
4400
|
}
|
|
4251
|
-
return isRetryableError2(
|
|
4401
|
+
return isRetryableError2(error3) && SAFE_HTTP_METHODS.indexOf(error3.config.method) !== -1;
|
|
4252
4402
|
}
|
|
4253
|
-
function isIdempotentRequestError(
|
|
4254
|
-
if (!
|
|
4403
|
+
function isIdempotentRequestError(error3) {
|
|
4404
|
+
if (!error3.config?.method) {
|
|
4255
4405
|
return false;
|
|
4256
4406
|
}
|
|
4257
|
-
return isRetryableError2(
|
|
4407
|
+
return isRetryableError2(error3) && IDEMPOTENT_HTTP_METHODS.indexOf(error3.config.method) !== -1;
|
|
4258
4408
|
}
|
|
4259
|
-
function isNetworkOrIdempotentRequestError(
|
|
4260
|
-
return isNetworkError(
|
|
4409
|
+
function isNetworkOrIdempotentRequestError(error3) {
|
|
4410
|
+
return isNetworkError(error3) || isIdempotentRequestError(error3);
|
|
4261
4411
|
}
|
|
4262
|
-
function retryAfter(
|
|
4263
|
-
const retryAfterHeader =
|
|
4412
|
+
function retryAfter(error3 = void 0) {
|
|
4413
|
+
const retryAfterHeader = error3?.response?.headers["retry-after"];
|
|
4264
4414
|
if (!retryAfterHeader) {
|
|
4265
4415
|
return 0;
|
|
4266
4416
|
}
|
|
@@ -4270,19 +4420,19 @@ function retryAfter(error2 = void 0) {
|
|
|
4270
4420
|
}
|
|
4271
4421
|
return Math.max(0, retryAfterMs);
|
|
4272
4422
|
}
|
|
4273
|
-
function noDelay(_retryNumber = 0,
|
|
4274
|
-
return Math.max(0, retryAfter(
|
|
4423
|
+
function noDelay(_retryNumber = 0, error3 = void 0) {
|
|
4424
|
+
return Math.max(0, retryAfter(error3));
|
|
4275
4425
|
}
|
|
4276
|
-
function exponentialDelay(retryNumber = 0,
|
|
4426
|
+
function exponentialDelay(retryNumber = 0, error3 = void 0, delayFactor = 100) {
|
|
4277
4427
|
const calculatedDelay = 2 ** retryNumber * delayFactor;
|
|
4278
|
-
const delay = Math.max(calculatedDelay, retryAfter(
|
|
4428
|
+
const delay = Math.max(calculatedDelay, retryAfter(error3));
|
|
4279
4429
|
const randomSum = delay * 0.2 * Math.random();
|
|
4280
4430
|
return delay + randomSum;
|
|
4281
4431
|
}
|
|
4282
4432
|
function linearDelay(delayFactor = 100) {
|
|
4283
|
-
return (retryNumber = 0,
|
|
4433
|
+
return (retryNumber = 0, error3 = void 0) => {
|
|
4284
4434
|
const delay = retryNumber * delayFactor;
|
|
4285
|
-
return Math.max(delay, retryAfter(
|
|
4435
|
+
return Math.max(delay, retryAfter(error3));
|
|
4286
4436
|
};
|
|
4287
4437
|
}
|
|
4288
4438
|
var DEFAULT_OPTIONS = {
|
|
@@ -4319,9 +4469,9 @@ function fixConfig(axiosInstance, config2) {
|
|
|
4319
4469
|
delete config2.httpsAgent;
|
|
4320
4470
|
}
|
|
4321
4471
|
}
|
|
4322
|
-
async function shouldRetry(currentState,
|
|
4472
|
+
async function shouldRetry(currentState, error3) {
|
|
4323
4473
|
const { retries, retryCondition } = currentState;
|
|
4324
|
-
const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(
|
|
4474
|
+
const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error3);
|
|
4325
4475
|
if (typeof shouldRetryOrPromise === "object") {
|
|
4326
4476
|
try {
|
|
4327
4477
|
const shouldRetryPromiseResult = await shouldRetryOrPromise;
|
|
@@ -4332,21 +4482,21 @@ async function shouldRetry(currentState, error2) {
|
|
|
4332
4482
|
}
|
|
4333
4483
|
return shouldRetryOrPromise;
|
|
4334
4484
|
}
|
|
4335
|
-
async function handleRetry(axiosInstance, currentState,
|
|
4485
|
+
async function handleRetry(axiosInstance, currentState, error3, config2) {
|
|
4336
4486
|
currentState.retryCount += 1;
|
|
4337
4487
|
const { retryDelay, shouldResetTimeout, onRetry } = currentState;
|
|
4338
|
-
const delay = retryDelay(currentState.retryCount,
|
|
4488
|
+
const delay = retryDelay(currentState.retryCount, error3);
|
|
4339
4489
|
fixConfig(axiosInstance, config2);
|
|
4340
4490
|
if (!shouldResetTimeout && config2.timeout && currentState.lastRequestTime) {
|
|
4341
4491
|
const lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
4342
4492
|
const timeout = config2.timeout - lastRequestDuration - delay;
|
|
4343
4493
|
if (timeout <= 0) {
|
|
4344
|
-
return Promise.reject(
|
|
4494
|
+
return Promise.reject(error3);
|
|
4345
4495
|
}
|
|
4346
4496
|
config2.timeout = timeout;
|
|
4347
4497
|
}
|
|
4348
4498
|
config2.transformRequest = [(data) => data];
|
|
4349
|
-
await onRetry(currentState.retryCount,
|
|
4499
|
+
await onRetry(currentState.retryCount, error3, config2);
|
|
4350
4500
|
if (config2.signal?.aborted) {
|
|
4351
4501
|
return Promise.resolve(axiosInstance(config2));
|
|
4352
4502
|
}
|
|
@@ -4366,9 +4516,9 @@ async function handleRetry(axiosInstance, currentState, error2, config2) {
|
|
|
4366
4516
|
}
|
|
4367
4517
|
});
|
|
4368
4518
|
}
|
|
4369
|
-
async function handleMaxRetryTimesExceeded(currentState,
|
|
4519
|
+
async function handleMaxRetryTimesExceeded(currentState, error3) {
|
|
4370
4520
|
if (currentState.retryCount >= currentState.retries)
|
|
4371
|
-
await currentState.onMaxRetryTimesExceeded(
|
|
4521
|
+
await currentState.onMaxRetryTimesExceeded(error3, currentState.retryCount);
|
|
4372
4522
|
}
|
|
4373
4523
|
var axiosRetry = (axiosInstance, defaultOptions) => {
|
|
4374
4524
|
const requestInterceptorId = axiosInstance.interceptors.request.use((config2) => {
|
|
@@ -4378,20 +4528,20 @@ var axiosRetry = (axiosInstance, defaultOptions) => {
|
|
|
4378
4528
|
}
|
|
4379
4529
|
return config2;
|
|
4380
4530
|
});
|
|
4381
|
-
const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (
|
|
4382
|
-
const { config: config2 } =
|
|
4531
|
+
const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error3) => {
|
|
4532
|
+
const { config: config2 } = error3;
|
|
4383
4533
|
if (!config2) {
|
|
4384
|
-
return Promise.reject(
|
|
4534
|
+
return Promise.reject(error3);
|
|
4385
4535
|
}
|
|
4386
4536
|
const currentState = setCurrentState(config2, defaultOptions);
|
|
4387
|
-
if (
|
|
4388
|
-
return
|
|
4537
|
+
if (error3.response && currentState.validateResponse?.(error3.response)) {
|
|
4538
|
+
return error3.response;
|
|
4389
4539
|
}
|
|
4390
|
-
if (await shouldRetry(currentState,
|
|
4391
|
-
return handleRetry(axiosInstance, currentState,
|
|
4540
|
+
if (await shouldRetry(currentState, error3)) {
|
|
4541
|
+
return handleRetry(axiosInstance, currentState, error3, config2);
|
|
4392
4542
|
}
|
|
4393
|
-
await handleMaxRetryTimesExceeded(currentState,
|
|
4394
|
-
return Promise.reject(
|
|
4543
|
+
await handleMaxRetryTimesExceeded(currentState, error3);
|
|
4544
|
+
return Promise.reject(error3);
|
|
4395
4545
|
});
|
|
4396
4546
|
return { requestInterceptorId, responseInterceptorId };
|
|
4397
4547
|
};
|
|
@@ -4425,7 +4575,7 @@ function addRequestId(config2) {
|
|
|
4425
4575
|
if (metaContainer) {
|
|
4426
4576
|
metaContainer._tcMeta = { start: Date.now() };
|
|
4427
4577
|
}
|
|
4428
|
-
|
|
4578
|
+
info2("Starting TeamCity API request", {
|
|
4429
4579
|
requestId,
|
|
4430
4580
|
method: config2.method?.toUpperCase(),
|
|
4431
4581
|
url: config2.url,
|
|
@@ -4442,7 +4592,7 @@ function logResponse(response) {
|
|
|
4442
4592
|
const headers = response.headers;
|
|
4443
4593
|
const headerDuration = headers?.["x-response-time"] ?? headers?.["x-response-duration"];
|
|
4444
4594
|
const duration = headerDuration ?? (meta?.start ? Date.now() - meta.start : void 0);
|
|
4445
|
-
|
|
4595
|
+
info2("TeamCity API request completed", {
|
|
4446
4596
|
requestId,
|
|
4447
4597
|
method: response.config.method?.toUpperCase(),
|
|
4448
4598
|
url: response.config.url,
|
|
@@ -4451,10 +4601,10 @@ function logResponse(response) {
|
|
|
4451
4601
|
});
|
|
4452
4602
|
return response;
|
|
4453
4603
|
}
|
|
4454
|
-
function logAndTransformError(
|
|
4455
|
-
const requestId =
|
|
4456
|
-
const tcError = TeamCityAPIError.fromAxiosError(
|
|
4457
|
-
const meta = asTimingMetaContainer(
|
|
4604
|
+
function logAndTransformError(error3) {
|
|
4605
|
+
const requestId = error3.config?.requestId;
|
|
4606
|
+
const tcError = TeamCityAPIError.fromAxiosError(error3, requestId);
|
|
4607
|
+
const meta = asTimingMetaContainer(error3.config)?._tcMeta;
|
|
4458
4608
|
const duration = meta?.start ? Date.now() - meta.start : void 0;
|
|
4459
4609
|
const sanitize = (val) => {
|
|
4460
4610
|
const redact = (s) => s.replace(/(token[=:\s]*)[^\s&]+/gi, "$1***").replace(/(password[=:\s]*)[^\s&]+/gi, "$1***").replace(/(apikey[=:\s]*)[^\s&]+/gi, "$1***").replace(/(authorization[=:\s:]*)[^\s&]+/gi, "$1***");
|
|
@@ -4466,7 +4616,7 @@ function logAndTransformError(error2) {
|
|
|
4466
4616
|
return val;
|
|
4467
4617
|
}
|
|
4468
4618
|
};
|
|
4469
|
-
|
|
4619
|
+
error2("TeamCity API request failed", void 0, {
|
|
4470
4620
|
requestId: tcError.requestId,
|
|
4471
4621
|
code: tcError.code,
|
|
4472
4622
|
message: sanitize(tcError.message),
|
|
@@ -38047,15 +38197,15 @@ var TeamCityAPI = class _TeamCityAPI {
|
|
|
38047
38197
|
this.http = this.axiosInstance;
|
|
38048
38198
|
esm_default(this.axiosInstance, {
|
|
38049
38199
|
retries: 3,
|
|
38050
|
-
retryDelay: (retryCount,
|
|
38051
|
-
const reqId =
|
|
38052
|
-
const tcError = TeamCityAPIError.fromAxiosError(
|
|
38200
|
+
retryDelay: (retryCount, error3) => {
|
|
38201
|
+
const reqId = error3?.config?.requestId;
|
|
38202
|
+
const tcError = TeamCityAPIError.fromAxiosError(error3, reqId);
|
|
38053
38203
|
const retryAfter2 = extractRetryAfterMilliseconds(tcError);
|
|
38054
38204
|
return retryAfter2 ?? Math.min(1e3 * Math.pow(2, Math.max(0, retryCount - 1)), 8e3);
|
|
38055
38205
|
},
|
|
38056
|
-
retryCondition: (
|
|
38057
|
-
const reqId =
|
|
38058
|
-
const tcError = TeamCityAPIError.fromAxiosError(
|
|
38206
|
+
retryCondition: (error3) => {
|
|
38207
|
+
const reqId = error3?.config?.requestId;
|
|
38208
|
+
const tcError = TeamCityAPIError.fromAxiosError(error3, reqId);
|
|
38059
38209
|
return isRetryableError(tcError);
|
|
38060
38210
|
}
|
|
38061
38211
|
});
|
|
@@ -38134,7 +38284,7 @@ var TeamCityAPI = class _TeamCityAPI {
|
|
|
38134
38284
|
vcsRootInstances: this.vcsRootInstances,
|
|
38135
38285
|
versionedSettings: this.versionedSettings
|
|
38136
38286
|
});
|
|
38137
|
-
|
|
38287
|
+
info2("TeamCityAPI initialized", { baseUrl: basePath, timeout });
|
|
38138
38288
|
}
|
|
38139
38289
|
static getInstance(arg1, arg2) {
|
|
38140
38290
|
const requestedConfig = this.normalizeArgs(arg1, arg2);
|
|
@@ -38413,12 +38563,12 @@ var ensureUniquePath = async (candidate) => {
|
|
|
38413
38563
|
const handle = await import_node_fs2.promises.open(next, "wx");
|
|
38414
38564
|
await handle.close();
|
|
38415
38565
|
return next;
|
|
38416
|
-
} catch (
|
|
38417
|
-
const err =
|
|
38566
|
+
} catch (error3) {
|
|
38567
|
+
const err = error3;
|
|
38418
38568
|
if (err?.code === "EEXIST") {
|
|
38419
38569
|
return probe(attempt + 1);
|
|
38420
38570
|
}
|
|
38421
|
-
throw
|
|
38571
|
+
throw error3;
|
|
38422
38572
|
}
|
|
38423
38573
|
};
|
|
38424
38574
|
return probe(0);
|
|
@@ -38502,10 +38652,10 @@ var toNormalizedArtifactRequests = (inputs, defaultBuildId) => inputs.map((entry
|
|
|
38502
38652
|
downloadUrl: entry.downloadUrl?.trim()
|
|
38503
38653
|
};
|
|
38504
38654
|
});
|
|
38505
|
-
var getErrorMessage = (
|
|
38506
|
-
if ((0, import_axios36.isAxiosError)(
|
|
38507
|
-
const status =
|
|
38508
|
-
const data =
|
|
38655
|
+
var getErrorMessage = (error3) => {
|
|
38656
|
+
if ((0, import_axios36.isAxiosError)(error3)) {
|
|
38657
|
+
const status = error3.response?.status;
|
|
38658
|
+
const data = error3.response?.data;
|
|
38509
38659
|
let detail;
|
|
38510
38660
|
if (typeof data === "string") {
|
|
38511
38661
|
detail = data;
|
|
@@ -38518,13 +38668,13 @@ var getErrorMessage = (error2) => {
|
|
|
38518
38668
|
}
|
|
38519
38669
|
return `HTTP ${status ?? "unknown"}${detail ? `: ${detail}` : ""}`;
|
|
38520
38670
|
}
|
|
38521
|
-
if (
|
|
38522
|
-
return
|
|
38671
|
+
if (error3 instanceof Error) {
|
|
38672
|
+
return error3.message;
|
|
38523
38673
|
}
|
|
38524
|
-
if (typeof
|
|
38525
|
-
return String(
|
|
38674
|
+
if (typeof error3 === "object" && error3 !== null && "message" in error3) {
|
|
38675
|
+
return String(error3.message);
|
|
38526
38676
|
}
|
|
38527
|
-
return String(
|
|
38677
|
+
return String(error3 ?? "Unknown error");
|
|
38528
38678
|
};
|
|
38529
38679
|
var downloadArtifactByUrl = async (adapter, request, encoding, options) => {
|
|
38530
38680
|
const axios3 = adapter.getAxios();
|
|
@@ -38892,7 +39042,7 @@ var DEV_TOOLS = [
|
|
|
38892
39042
|
if (propertiesPayload) {
|
|
38893
39043
|
buildRequest.properties = propertiesPayload;
|
|
38894
39044
|
}
|
|
38895
|
-
const sendXmlFallback = async (
|
|
39045
|
+
const sendXmlFallback = async (error3) => {
|
|
38896
39046
|
const escapeXml2 = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
38897
39047
|
const branchPart = branchName ? `<branchName>${escapeXml2(branchName)}</branchName>` : "";
|
|
38898
39048
|
const commentPart = commentText ? `<comment><text>${escapeXml2(commentText)}</text></comment>` : "";
|
|
@@ -38914,7 +39064,7 @@ var DEV_TOOLS = [
|
|
|
38914
39064
|
state: build.state ?? void 0,
|
|
38915
39065
|
status: build.status ?? void 0,
|
|
38916
39066
|
branchName: build.branchName ?? branchName,
|
|
38917
|
-
fallback: { mode: "xml", reason:
|
|
39067
|
+
fallback: { mode: "xml", reason: error3?.message }
|
|
38918
39068
|
});
|
|
38919
39069
|
};
|
|
38920
39070
|
try {
|
|
@@ -38934,8 +39084,8 @@ var DEV_TOOLS = [
|
|
|
38934
39084
|
status: build.status ?? void 0,
|
|
38935
39085
|
branchName: build.branchName ?? branchName
|
|
38936
39086
|
});
|
|
38937
|
-
} catch (
|
|
38938
|
-
return sendXmlFallback(
|
|
39087
|
+
} catch (error3) {
|
|
39088
|
+
return sendXmlFallback(error3);
|
|
38939
39089
|
}
|
|
38940
39090
|
},
|
|
38941
39091
|
args
|
|
@@ -39180,15 +39330,15 @@ var DEV_TOOLS = [
|
|
|
39180
39330
|
if (!effectiveBuildId) {
|
|
39181
39331
|
throw new Error("Failed to resolve buildId from inputs");
|
|
39182
39332
|
}
|
|
39183
|
-
const shouldRetry2 = (
|
|
39184
|
-
if (
|
|
39185
|
-
if (
|
|
39333
|
+
const shouldRetry2 = (error3) => {
|
|
39334
|
+
if (error3 instanceof TeamCityAPIError) {
|
|
39335
|
+
if (error3.code === "HTTP_404") {
|
|
39186
39336
|
return true;
|
|
39187
39337
|
}
|
|
39188
|
-
return isRetryableError(
|
|
39338
|
+
return isRetryableError(error3);
|
|
39189
39339
|
}
|
|
39190
|
-
if ((0, import_axios36.isAxiosError)(
|
|
39191
|
-
const status =
|
|
39340
|
+
if ((0, import_axios36.isAxiosError)(error3)) {
|
|
39341
|
+
const status = error3.response?.status;
|
|
39192
39342
|
if (status === 404) {
|
|
39193
39343
|
return true;
|
|
39194
39344
|
}
|
|
@@ -39201,17 +39351,17 @@ var DEV_TOOLS = [
|
|
|
39201
39351
|
}
|
|
39202
39352
|
return false;
|
|
39203
39353
|
};
|
|
39204
|
-
const normalizeError = (
|
|
39205
|
-
if ((0, import_axios36.isAxiosError)(
|
|
39206
|
-
const status =
|
|
39207
|
-
const statusText = (
|
|
39208
|
-
const base = status ? `${status}${statusText ? ` ${statusText}` : ""}` :
|
|
39354
|
+
const normalizeError = (error3) => {
|
|
39355
|
+
if ((0, import_axios36.isAxiosError)(error3)) {
|
|
39356
|
+
const status = error3.response?.status;
|
|
39357
|
+
const statusText = (error3.response?.statusText ?? "").trim();
|
|
39358
|
+
const base = status ? `${status}${statusText ? ` ${statusText}` : ""}` : error3.message;
|
|
39209
39359
|
return new Error(base || "Request failed");
|
|
39210
39360
|
}
|
|
39211
|
-
if (
|
|
39212
|
-
return
|
|
39361
|
+
if (error3 instanceof Error) {
|
|
39362
|
+
return error3;
|
|
39213
39363
|
}
|
|
39214
|
-
return new Error(String(
|
|
39364
|
+
return new Error(String(error3));
|
|
39215
39365
|
};
|
|
39216
39366
|
const wait = (ms) => new Promise((resolve2) => {
|
|
39217
39367
|
setTimeout(resolve2, ms);
|
|
@@ -39304,12 +39454,12 @@ var DEV_TOOLS = [
|
|
|
39304
39454
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
39305
39455
|
try {
|
|
39306
39456
|
return await (isStream ? attemptStream() : attemptBuffered());
|
|
39307
|
-
} catch (
|
|
39308
|
-
if (shouldRetry2(
|
|
39457
|
+
} catch (error3) {
|
|
39458
|
+
if (shouldRetry2(error3) && attempt < maxAttempts - 1) {
|
|
39309
39459
|
await wait(500 * (attempt + 1));
|
|
39310
39460
|
continue;
|
|
39311
39461
|
}
|
|
39312
|
-
throw normalizeError(
|
|
39462
|
+
throw normalizeError(error3);
|
|
39313
39463
|
}
|
|
39314
39464
|
}
|
|
39315
39465
|
throw new Error("Unable to fetch build log after retries");
|
|
@@ -39801,8 +39951,8 @@ var DEV_TOOLS = [
|
|
|
39801
39951
|
null,
|
|
39802
39952
|
async () => {
|
|
39803
39953
|
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
39804
|
-
const
|
|
39805
|
-
return json(
|
|
39954
|
+
const info3 = await adapter.modules.server.getServerInfo();
|
|
39955
|
+
return json(info3.data);
|
|
39806
39956
|
},
|
|
39807
39957
|
{}
|
|
39808
39958
|
);
|
|
@@ -40338,11 +40488,11 @@ var DEV_TOOLS = [
|
|
|
40338
40488
|
artifactEncoding: typed.artifactEncoding ?? "base64"
|
|
40339
40489
|
});
|
|
40340
40490
|
return json(result);
|
|
40341
|
-
} catch (
|
|
40342
|
-
if (
|
|
40343
|
-
throw new TeamCityNotFoundError("Build", friendlyIdentifier,
|
|
40491
|
+
} catch (error3) {
|
|
40492
|
+
if (error3 instanceof TeamCityNotFoundError) {
|
|
40493
|
+
throw new TeamCityNotFoundError("Build", friendlyIdentifier, error3.requestId, error3);
|
|
40344
40494
|
}
|
|
40345
|
-
throw
|
|
40495
|
+
throw error3;
|
|
40346
40496
|
}
|
|
40347
40497
|
},
|
|
40348
40498
|
args
|
|
@@ -40388,7 +40538,7 @@ var DEV_TOOLS = [
|
|
|
40388
40538
|
async (typed) => {
|
|
40389
40539
|
const encoding = typed.encoding ?? "base64";
|
|
40390
40540
|
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
40391
|
-
|
|
40541
|
+
debug2("tools.download_build_artifact.start", {
|
|
40392
40542
|
buildId: typed.buildId,
|
|
40393
40543
|
encoding,
|
|
40394
40544
|
artifactPath: typed.artifactPath,
|
|
@@ -40509,49 +40659,49 @@ var DEV_TOOLS = [
|
|
|
40509
40659
|
});
|
|
40510
40660
|
}
|
|
40511
40661
|
results.push({ ...payload, success: true });
|
|
40512
|
-
|
|
40662
|
+
debug2("tools.download_build_artifacts.success", {
|
|
40513
40663
|
path: request.path,
|
|
40514
40664
|
encoding: payload.encoding,
|
|
40515
40665
|
outputPath: payload.encoding === "stream" ? payload.outputPath : void 0
|
|
40516
40666
|
});
|
|
40517
40667
|
if (payload.encoding === "stream") {
|
|
40518
40668
|
const streamPayload = payload;
|
|
40519
|
-
|
|
40669
|
+
debug2("tools.download_build_artifacts.stream", {
|
|
40520
40670
|
path: request.path,
|
|
40521
40671
|
outputPath: streamPayload.outputPath,
|
|
40522
40672
|
bytesWritten: streamPayload.bytesWritten
|
|
40523
40673
|
});
|
|
40524
40674
|
} else {
|
|
40525
|
-
|
|
40675
|
+
debug2("tools.download_build_artifacts.buffered", {
|
|
40526
40676
|
path: request.path,
|
|
40527
40677
|
encoding: payload.encoding,
|
|
40528
40678
|
size: payload.size
|
|
40529
40679
|
});
|
|
40530
40680
|
}
|
|
40531
|
-
} catch (
|
|
40681
|
+
} catch (error3) {
|
|
40532
40682
|
results.push({
|
|
40533
40683
|
name: request.path,
|
|
40534
40684
|
path: request.path,
|
|
40535
40685
|
size: 0,
|
|
40536
40686
|
encoding,
|
|
40537
40687
|
success: false,
|
|
40538
|
-
error: getErrorMessage(
|
|
40688
|
+
error: getErrorMessage(error3)
|
|
40539
40689
|
});
|
|
40540
|
-
|
|
40690
|
+
debug2("tools.download_build_artifacts.failure", {
|
|
40541
40691
|
path: request.path,
|
|
40542
40692
|
encoding,
|
|
40543
|
-
error: getErrorMessage(
|
|
40693
|
+
error: getErrorMessage(error3),
|
|
40544
40694
|
downloadUrl: request.downloadUrl,
|
|
40545
40695
|
buildId: request.buildId
|
|
40546
40696
|
});
|
|
40547
40697
|
}
|
|
40548
40698
|
}
|
|
40549
|
-
|
|
40699
|
+
debug2("tools.download_build_artifacts.complete", {
|
|
40550
40700
|
buildId: typed.buildId,
|
|
40551
40701
|
successCount: results.filter((item) => item.success).length,
|
|
40552
40702
|
failureCount: results.filter((item) => !item.success).length
|
|
40553
40703
|
});
|
|
40554
|
-
|
|
40704
|
+
debug2("tools.download_build_artifacts.complete", {
|
|
40555
40705
|
buildId: typed.buildId,
|
|
40556
40706
|
successCount: results.filter((item) => item.success).length,
|
|
40557
40707
|
failureCount: results.filter((item) => !item.success).length
|
|
@@ -41217,12 +41367,12 @@ var DEV_TOOLS = [
|
|
|
41217
41367
|
const maybeChildren = project.projects?.project ?? [];
|
|
41218
41368
|
if (Array.isArray(maybeChildren)) {
|
|
41219
41369
|
for (const childRaw of maybeChildren) {
|
|
41220
|
-
const
|
|
41221
|
-
if (typeof
|
|
41222
|
-
const sub = await buildHierarchy(
|
|
41223
|
-
children.push({ id: sub.id ??
|
|
41224
|
-
} else if (typeof
|
|
41225
|
-
children.push({ id:
|
|
41370
|
+
const child2 = childRaw;
|
|
41371
|
+
if (typeof child2.id === "string" && depth < 3) {
|
|
41372
|
+
const sub = await buildHierarchy(child2.id, depth + 1);
|
|
41373
|
+
children.push({ id: sub.id ?? child2.id, name: sub.name });
|
|
41374
|
+
} else if (typeof child2.id === "string") {
|
|
41375
|
+
children.push({ id: child2.id, name: child2.name });
|
|
41226
41376
|
}
|
|
41227
41377
|
}
|
|
41228
41378
|
}
|
|
@@ -41327,7 +41477,7 @@ var FULL_MODE_TOOLS = [
|
|
|
41327
41477
|
schema,
|
|
41328
41478
|
async (typedArgs) => {
|
|
41329
41479
|
const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
|
|
41330
|
-
|
|
41480
|
+
debug2("update_project_settings invoked", {
|
|
41331
41481
|
projectId: typedArgs.projectId,
|
|
41332
41482
|
// Only log which fields are present to reduce noise
|
|
41333
41483
|
requestedChanges: {
|
|
@@ -41337,7 +41487,7 @@ var FULL_MODE_TOOLS = [
|
|
|
41337
41487
|
}
|
|
41338
41488
|
});
|
|
41339
41489
|
if (typedArgs.name) {
|
|
41340
|
-
|
|
41490
|
+
debug2("Setting project field", {
|
|
41341
41491
|
projectId: typedArgs.projectId,
|
|
41342
41492
|
field: "name",
|
|
41343
41493
|
valuePreview: typedArgs.name
|
|
@@ -41349,7 +41499,7 @@ var FULL_MODE_TOOLS = [
|
|
|
41349
41499
|
);
|
|
41350
41500
|
}
|
|
41351
41501
|
if (typedArgs.description !== void 0) {
|
|
41352
|
-
|
|
41502
|
+
debug2("Setting project field", {
|
|
41353
41503
|
projectId: typedArgs.projectId,
|
|
41354
41504
|
field: "description",
|
|
41355
41505
|
valuePreview: typedArgs.description
|
|
@@ -41361,7 +41511,7 @@ var FULL_MODE_TOOLS = [
|
|
|
41361
41511
|
);
|
|
41362
41512
|
}
|
|
41363
41513
|
if (typedArgs.archived !== void 0) {
|
|
41364
|
-
|
|
41514
|
+
debug2("Setting project field", {
|
|
41365
41515
|
projectId: typedArgs.projectId,
|
|
41366
41516
|
field: "archived",
|
|
41367
41517
|
valuePreview: String(typedArgs.archived)
|
|
@@ -41372,7 +41522,7 @@ var FULL_MODE_TOOLS = [
|
|
|
41372
41522
|
String(typedArgs.archived)
|
|
41373
41523
|
);
|
|
41374
41524
|
}
|
|
41375
|
-
|
|
41525
|
+
debug2("Project settings updated", {
|
|
41376
41526
|
projectId: typedArgs.projectId,
|
|
41377
41527
|
appliedChanges: {
|
|
41378
41528
|
name: typedArgs.name ?? null,
|
|
@@ -41502,11 +41652,11 @@ var FULL_MODE_TOOLS = [
|
|
|
41502
41652
|
url: cloned.url,
|
|
41503
41653
|
description: cloned.description
|
|
41504
41654
|
});
|
|
41505
|
-
} catch (
|
|
41655
|
+
} catch (error3) {
|
|
41506
41656
|
return json({
|
|
41507
41657
|
success: false,
|
|
41508
41658
|
action: "clone_build_config",
|
|
41509
|
-
error:
|
|
41659
|
+
error: error3 instanceof Error ? error3.message : "Failed to clone build configuration."
|
|
41510
41660
|
});
|
|
41511
41661
|
}
|
|
41512
41662
|
},
|
|
@@ -43042,7 +43192,7 @@ function createSimpleServer() {
|
|
|
43042
43192
|
const server = new import_server.Server(
|
|
43043
43193
|
{
|
|
43044
43194
|
name: "teamcity-mcp",
|
|
43045
|
-
version:
|
|
43195
|
+
version: package_default.version
|
|
43046
43196
|
},
|
|
43047
43197
|
{
|
|
43048
43198
|
capabilities: {
|
|
@@ -43054,7 +43204,7 @@ function createSimpleServer() {
|
|
|
43054
43204
|
);
|
|
43055
43205
|
server.setRequestHandler(import_types.ListToolsRequestSchema, async () => {
|
|
43056
43206
|
const currentTools = getAvailableTools();
|
|
43057
|
-
|
|
43207
|
+
info2("MCP request: tools/list", { mode: getMCPMode2(), count: currentTools.length });
|
|
43058
43208
|
const response = {
|
|
43059
43209
|
tools: currentTools.map((tool) => ({
|
|
43060
43210
|
name: tool.name,
|
|
@@ -43062,17 +43212,17 @@ function createSimpleServer() {
|
|
|
43062
43212
|
inputSchema: tool.inputSchema
|
|
43063
43213
|
}))
|
|
43064
43214
|
};
|
|
43065
|
-
|
|
43215
|
+
debug2("MCP response: tools/list", { count: response.tools.length, success: true });
|
|
43066
43216
|
return response;
|
|
43067
43217
|
});
|
|
43068
43218
|
server.setRequestHandler(import_types.CallToolRequestSchema, async (request) => {
|
|
43069
43219
|
const { name, arguments: args } = request.params;
|
|
43070
43220
|
const started = Date.now();
|
|
43071
|
-
|
|
43221
|
+
info2("MCP request: tools/call", { tool: name, args });
|
|
43072
43222
|
const tool = getTool(name);
|
|
43073
43223
|
if (!tool) {
|
|
43074
43224
|
const availableTools = getAvailableTools();
|
|
43075
|
-
|
|
43225
|
+
error2("MCP error: unknown tool", void 0, {
|
|
43076
43226
|
tool: name,
|
|
43077
43227
|
available: availableTools.map((t) => t.name),
|
|
43078
43228
|
mode: getMCPMode2()
|
|
@@ -43091,28 +43241,28 @@ function createSimpleServer() {
|
|
|
43091
43241
|
};
|
|
43092
43242
|
const duration = Date.now() - started;
|
|
43093
43243
|
const success = result?.success !== false;
|
|
43094
|
-
|
|
43244
|
+
debug2("MCP response: tools/call", {
|
|
43095
43245
|
tool: name,
|
|
43096
43246
|
success,
|
|
43097
43247
|
duration,
|
|
43098
43248
|
contentTypes: response.content?.map((c) => c.type)
|
|
43099
43249
|
});
|
|
43100
43250
|
return response;
|
|
43101
|
-
} catch (
|
|
43102
|
-
if (
|
|
43251
|
+
} catch (error3) {
|
|
43252
|
+
if (error3 instanceof import_types.McpError) {
|
|
43103
43253
|
const duration2 = Date.now() - started;
|
|
43104
|
-
|
|
43105
|
-
throw
|
|
43254
|
+
error2("MCP error: tool call", error3, { tool: name, success: false, duration: duration2 });
|
|
43255
|
+
throw error3;
|
|
43106
43256
|
}
|
|
43107
43257
|
const duration = Date.now() - started;
|
|
43108
|
-
|
|
43258
|
+
error2("MCP error: tool call (unexpected)", error3, {
|
|
43109
43259
|
tool: name,
|
|
43110
43260
|
success: false,
|
|
43111
43261
|
duration
|
|
43112
43262
|
});
|
|
43113
43263
|
throw new import_types.McpError(
|
|
43114
43264
|
import_types.ErrorCode.InternalError,
|
|
43115
|
-
`Tool execution failed: ${
|
|
43265
|
+
`Tool execution failed: ${error3 instanceof Error ? error3.message : String(error3)}`
|
|
43116
43266
|
);
|
|
43117
43267
|
}
|
|
43118
43268
|
});
|
|
@@ -43120,7 +43270,35 @@ function createSimpleServer() {
|
|
|
43120
43270
|
}
|
|
43121
43271
|
|
|
43122
43272
|
// src/index.ts
|
|
43123
|
-
dotenv2.config();
|
|
43273
|
+
dotenv2.config({ quiet: true });
|
|
43274
|
+
var activeServer = null;
|
|
43275
|
+
var lifecyclePromise = null;
|
|
43276
|
+
var shuttingDown = false;
|
|
43277
|
+
var clearServerState = () => {
|
|
43278
|
+
activeServer = null;
|
|
43279
|
+
lifecyclePromise = null;
|
|
43280
|
+
};
|
|
43281
|
+
async function shutdown(exitCode) {
|
|
43282
|
+
if (shuttingDown) {
|
|
43283
|
+
process.exit(exitCode);
|
|
43284
|
+
}
|
|
43285
|
+
shuttingDown = true;
|
|
43286
|
+
process.stderr.write("\nShutting down TeamCity MCP Server...\n");
|
|
43287
|
+
try {
|
|
43288
|
+
const serverToClose = activeServer;
|
|
43289
|
+
const lifecycleToAwait = lifecyclePromise;
|
|
43290
|
+
await serverToClose?.close();
|
|
43291
|
+
await lifecycleToAwait;
|
|
43292
|
+
} catch (error3) {
|
|
43293
|
+
process.stderr.write(
|
|
43294
|
+
`Error while closing server: ${error3 instanceof Error ? error3.message : String(error3)}
|
|
43295
|
+
`
|
|
43296
|
+
);
|
|
43297
|
+
} finally {
|
|
43298
|
+
clearServerState();
|
|
43299
|
+
process.exit(exitCode);
|
|
43300
|
+
}
|
|
43301
|
+
}
|
|
43124
43302
|
async function main() {
|
|
43125
43303
|
try {
|
|
43126
43304
|
let hasUrl;
|
|
@@ -43140,24 +43318,28 @@ async function main() {
|
|
|
43140
43318
|
`);
|
|
43141
43319
|
const server = createSimpleServer();
|
|
43142
43320
|
const transport = new import_stdio.StdioServerTransport();
|
|
43143
|
-
|
|
43321
|
+
const lifecycle = startServerLifecycle(server, transport);
|
|
43322
|
+
activeServer = server;
|
|
43323
|
+
lifecyclePromise = lifecycle;
|
|
43144
43324
|
process.stderr.write("TeamCity MCP Server is running and ready to accept connections\n");
|
|
43145
|
-
|
|
43146
|
-
|
|
43325
|
+
await lifecycle;
|
|
43326
|
+
clearServerState();
|
|
43327
|
+
process.stderr.write("TeamCity MCP Server connection closed\n");
|
|
43328
|
+
} catch (error3) {
|
|
43329
|
+
clearServerState();
|
|
43330
|
+
process.stderr.write(`Failed to start server: ${error3}
|
|
43147
43331
|
`);
|
|
43148
43332
|
process.exit(1);
|
|
43149
43333
|
}
|
|
43150
43334
|
}
|
|
43151
43335
|
process.on("SIGINT", () => {
|
|
43152
|
-
|
|
43153
|
-
process.exit(0);
|
|
43336
|
+
void shutdown(0);
|
|
43154
43337
|
});
|
|
43155
43338
|
process.on("SIGTERM", () => {
|
|
43156
|
-
|
|
43157
|
-
process.exit(0);
|
|
43339
|
+
void shutdown(0);
|
|
43158
43340
|
});
|
|
43159
|
-
main().catch((
|
|
43160
|
-
process.stderr.write(`Unhandled error: ${
|
|
43341
|
+
main().catch((error3) => {
|
|
43342
|
+
process.stderr.write(`Unhandled error: ${error3}
|
|
43161
43343
|
`);
|
|
43162
43344
|
process.exit(1);
|
|
43163
43345
|
});
|