@hypnosis/docker-mcp-server 1.0.4 → 1.3.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.
Files changed (105) hide show
  1. package/README.md +99 -28
  2. package/dist/adapters/database-adapter.d.ts +9 -5
  3. package/dist/adapters/database-adapter.d.ts.map +1 -1
  4. package/dist/adapters/postgresql.d.ts +14 -5
  5. package/dist/adapters/postgresql.d.ts.map +1 -1
  6. package/dist/adapters/postgresql.js +36 -23
  7. package/dist/adapters/postgresql.js.map +1 -1
  8. package/dist/adapters/redis.d.ts +10 -1
  9. package/dist/adapters/redis.d.ts.map +1 -1
  10. package/dist/adapters/redis.js +28 -13
  11. package/dist/adapters/redis.js.map +1 -1
  12. package/dist/adapters/sqlite.d.ts +11 -1
  13. package/dist/adapters/sqlite.d.ts.map +1 -1
  14. package/dist/adapters/sqlite.js +11 -7
  15. package/dist/adapters/sqlite.js.map +1 -1
  16. package/dist/adapters/types.d.ts +7 -0
  17. package/dist/adapters/types.d.ts.map +1 -1
  18. package/dist/discovery/compose-parser.d.ts +4 -0
  19. package/dist/discovery/compose-parser.d.ts.map +1 -1
  20. package/dist/discovery/compose-parser.js +27 -5
  21. package/dist/discovery/compose-parser.js.map +1 -1
  22. package/dist/discovery/project-discovery.d.ts.map +1 -1
  23. package/dist/discovery/project-discovery.js +28 -2
  24. package/dist/discovery/project-discovery.js.map +1 -1
  25. package/dist/discovery/remote-discovery.d.ts +99 -0
  26. package/dist/discovery/remote-discovery.d.ts.map +1 -0
  27. package/dist/discovery/remote-discovery.js +410 -0
  28. package/dist/discovery/remote-discovery.js.map +1 -0
  29. package/dist/discovery/types.d.ts +4 -0
  30. package/dist/discovery/types.d.ts.map +1 -1
  31. package/dist/index.js +76 -24
  32. package/dist/index.js.map +1 -1
  33. package/dist/managers/compose-manager.d.ts +3 -1
  34. package/dist/managers/compose-manager.d.ts.map +1 -1
  35. package/dist/managers/compose-manager.js +10 -1
  36. package/dist/managers/compose-manager.js.map +1 -1
  37. package/dist/managers/container-manager.d.ts +11 -1
  38. package/dist/managers/container-manager.d.ts.map +1 -1
  39. package/dist/managers/container-manager.js +75 -76
  40. package/dist/managers/container-manager.js.map +1 -1
  41. package/dist/tools/container-tools.d.ts +1 -3
  42. package/dist/tools/container-tools.d.ts.map +1 -1
  43. package/dist/tools/container-tools.js +142 -28
  44. package/dist/tools/container-tools.js.map +1 -1
  45. package/dist/tools/database-tools.d.ts +15 -1
  46. package/dist/tools/database-tools.d.ts.map +1 -1
  47. package/dist/tools/database-tools.js +152 -16
  48. package/dist/tools/database-tools.js.map +1 -1
  49. package/dist/tools/discovery-tools.d.ts +22 -0
  50. package/dist/tools/discovery-tools.d.ts.map +1 -0
  51. package/dist/tools/discovery-tools.js +137 -0
  52. package/dist/tools/discovery-tools.js.map +1 -0
  53. package/dist/tools/env-tools.d.ts +1 -2
  54. package/dist/tools/env-tools.d.ts.map +1 -1
  55. package/dist/tools/env-tools.js +123 -22
  56. package/dist/tools/env-tools.js.map +1 -1
  57. package/dist/tools/executor-tool.d.ts +0 -2
  58. package/dist/tools/executor-tool.d.ts.map +1 -1
  59. package/dist/tools/executor-tool.js +27 -9
  60. package/dist/tools/executor-tool.js.map +1 -1
  61. package/dist/tools/mcp-health-tool.d.ts +9 -0
  62. package/dist/tools/mcp-health-tool.d.ts.map +1 -1
  63. package/dist/tools/mcp-health-tool.js +34 -7
  64. package/dist/tools/mcp-health-tool.js.map +1 -1
  65. package/dist/tools/profile-tool.d.ts +39 -0
  66. package/dist/tools/profile-tool.d.ts.map +1 -0
  67. package/dist/tools/profile-tool.js +70 -0
  68. package/dist/tools/profile-tool.js.map +1 -0
  69. package/dist/utils/compose-exec.d.ts +28 -3
  70. package/dist/utils/compose-exec.d.ts.map +1 -1
  71. package/dist/utils/compose-exec.js +100 -26
  72. package/dist/utils/compose-exec.js.map +1 -1
  73. package/dist/utils/docker-client.d.ts +81 -8
  74. package/dist/utils/docker-client.d.ts.map +1 -1
  75. package/dist/utils/docker-client.js +520 -17
  76. package/dist/utils/docker-client.js.map +1 -1
  77. package/dist/utils/profile-resolver.d.ts +58 -0
  78. package/dist/utils/profile-resolver.d.ts.map +1 -0
  79. package/dist/utils/profile-resolver.js +218 -0
  80. package/dist/utils/profile-resolver.js.map +1 -0
  81. package/dist/utils/profiles-file.d.ts +57 -0
  82. package/dist/utils/profiles-file.d.ts.map +1 -0
  83. package/dist/utils/profiles-file.js +167 -0
  84. package/dist/utils/profiles-file.js.map +1 -0
  85. package/dist/utils/remote-compose.d.ts +32 -0
  86. package/dist/utils/remote-compose.d.ts.map +1 -0
  87. package/dist/utils/remote-compose.js +69 -0
  88. package/dist/utils/remote-compose.js.map +1 -0
  89. package/dist/utils/retry.d.ts +49 -0
  90. package/dist/utils/retry.d.ts.map +1 -0
  91. package/dist/utils/retry.js +120 -0
  92. package/dist/utils/retry.js.map +1 -0
  93. package/dist/utils/schema-helpers.d.ts +96 -0
  94. package/dist/utils/schema-helpers.d.ts.map +1 -0
  95. package/dist/utils/schema-helpers.js +61 -0
  96. package/dist/utils/schema-helpers.js.map +1 -0
  97. package/dist/utils/ssh-config.d.ts +104 -0
  98. package/dist/utils/ssh-config.d.ts.map +1 -0
  99. package/dist/utils/ssh-config.js +346 -0
  100. package/dist/utils/ssh-config.js.map +1 -0
  101. package/dist/utils/ssh-exec.d.ts +59 -0
  102. package/dist/utils/ssh-exec.d.ts.map +1 -0
  103. package/dist/utils/ssh-exec.js +159 -0
  104. package/dist/utils/ssh-exec.js.map +1 -0
  105. package/package.json +21 -3
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Retry & Timeout Utility
3
+ * Утилита для повторных попыток с экспоненциальным backoff и timeout
4
+ */
5
+ import { logger } from './logger.js';
6
+ /**
7
+ * Ошибка таймаута
8
+ */
9
+ export class TimeoutError extends Error {
10
+ constructor(message = 'Operation timed out') {
11
+ super(message);
12
+ this.name = 'TimeoutError';
13
+ }
14
+ }
15
+ /**
16
+ * Ошибка исчерпания попыток
17
+ */
18
+ export class RetryExhaustedError extends Error {
19
+ attempts;
20
+ lastError;
21
+ constructor(attempts, lastError) {
22
+ super(`Operation failed after ${attempts} attempts: ${lastError.message}`);
23
+ this.name = 'RetryExhaustedError';
24
+ this.attempts = attempts;
25
+ this.lastError = lastError;
26
+ }
27
+ }
28
+ /**
29
+ * Выполнить функцию с повторными попытками и таймаутом
30
+ *
31
+ * @param fn - Асинхронная функция для выполнения
32
+ * @param options - Опции retry
33
+ * @returns Результат выполнения функции
34
+ * @throws TimeoutError - если операция превысила timeout
35
+ * @throws RetryExhaustedError - если исчерпаны все попытки
36
+ */
37
+ export async function retryWithTimeout(fn, options = {}) {
38
+ const { maxAttempts = 3, timeout = 30000, initialDelay = 1000, backoffMultiplier = 2, shouldRetry = () => true, // По умолчанию повторяем для любых ошибок
39
+ } = options;
40
+ let lastError;
41
+ let delay = initialDelay;
42
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
43
+ try {
44
+ // Создаем Promise с таймаутом
45
+ const timeoutPromise = new Promise((_, reject) => {
46
+ setTimeout(() => {
47
+ reject(new TimeoutError(`Operation timed out after ${timeout}ms`));
48
+ }, timeout);
49
+ });
50
+ // Выполняем функцию с таймаутом
51
+ const result = await Promise.race([fn(), timeoutPromise]);
52
+ // Если успешно выполнено с первой попытки - не логируем
53
+ if (attempt > 1) {
54
+ logger.info(`Operation succeeded on attempt ${attempt}/${maxAttempts}`);
55
+ }
56
+ return result;
57
+ }
58
+ catch (error) {
59
+ lastError = error;
60
+ // Если это TimeoutError - не повторяем
61
+ if (error instanceof TimeoutError) {
62
+ logger.error(`Operation timed out on attempt ${attempt}/${maxAttempts}`);
63
+ throw error;
64
+ }
65
+ // Проверяем, стоит ли повторять попытку
66
+ if (!shouldRetry(error)) {
67
+ logger.error(`Operation failed on attempt ${attempt}/${maxAttempts}, not retrying: ${error.message}`);
68
+ throw error;
69
+ }
70
+ // Если это последняя попытка - выбрасываем ошибку
71
+ if (attempt >= maxAttempts) {
72
+ logger.error(`Operation failed after ${maxAttempts} attempts: ${error.message}`);
73
+ throw new RetryExhaustedError(maxAttempts, lastError);
74
+ }
75
+ // Логируем попытку и ждем перед следующей
76
+ logger.warn(`Operation failed on attempt ${attempt}/${maxAttempts}: ${error.message}. Retrying in ${delay}ms...`);
77
+ await sleep(delay);
78
+ // Увеличиваем задержку для следующей попытки (экспоненциальный backoff)
79
+ delay *= backoffMultiplier;
80
+ }
81
+ }
82
+ // Этот код не должен выполняться, но на всякий случай
83
+ throw new RetryExhaustedError(maxAttempts, lastError);
84
+ }
85
+ /**
86
+ * Создать функцию shouldRetry для сетевых ошибок
87
+ * Повторяет попытку для сетевых ошибок и таймаутов, но не для ошибок валидации
88
+ */
89
+ export function createNetworkRetryPredicate() {
90
+ return (error) => {
91
+ // Повторяем для сетевых ошибок
92
+ if (error.code === 'ECONNREFUSED' ||
93
+ error.code === 'ETIMEDOUT' ||
94
+ error.code === 'ENOTFOUND' ||
95
+ error.code === 'EAI_AGAIN' ||
96
+ error.code === 'ECONNRESET') {
97
+ return true;
98
+ }
99
+ // Повторяем для ошибок с сообщениями о таймауте
100
+ if (error.message && (error.message.includes('timeout') ||
101
+ error.message.includes('timed out') ||
102
+ error.message.includes('connection') ||
103
+ error.message.includes('network'))) {
104
+ return true;
105
+ }
106
+ // Не повторяем для ошибок валидации или авторизации
107
+ if (error.statusCode === 400 || error.statusCode === 401 || error.statusCode === 403) {
108
+ return false;
109
+ }
110
+ // По умолчанию повторяем
111
+ return true;
112
+ };
113
+ }
114
+ /**
115
+ * Утилита для задержки
116
+ */
117
+ function sleep(ms) {
118
+ return new Promise((resolve) => setTimeout(resolve, ms));
119
+ }
120
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkBrC;;GAEG;AACH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E,SAAS,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,+BAA+B;QAC/B,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;YAC7B,KAAK,CAAC,IAAI,KAAK,WAAW;YAC1B,KAAK,CAAC,IAAI,KAAK,WAAW;YAC1B,KAAK,CAAC,IAAI,KAAK,WAAW;YAC1B,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,gDAAgD;QAChD,IAAI,KAAK,CAAC,OAAO,IAAI,CACnB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;YACjC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;YACnC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;YACpC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAClC,EAAE,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,oDAAoD;QACpD,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YACrF,OAAO,KAAK,CAAC;QACf,CAAC;QAED,yBAAyB;QACzB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Schema Helpers
3
+ * Common schema definitions for MCP tools
4
+ */
5
+ /**
6
+ * SSH configuration schema for direct SSH connection
7
+ * Can be used instead of profile parameter
8
+ */
9
+ export declare const sshConfigSchema: {
10
+ type: "object";
11
+ description: string;
12
+ properties: {
13
+ host: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ username: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ port: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ privateKeyPath: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ password: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ passphrase: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ projectsPath: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ };
42
+ required: string[];
43
+ };
44
+ /**
45
+ * Profile parameter schema
46
+ */
47
+ export declare const profileSchema: {
48
+ type: "string";
49
+ description: string;
50
+ };
51
+ /**
52
+ * Get common connection parameters (profile + ssh)
53
+ * Use this in tool schemas for consistent SSH/profile support
54
+ */
55
+ export declare function getConnectionParams(): {
56
+ profile: {
57
+ type: "string";
58
+ description: string;
59
+ };
60
+ ssh: {
61
+ type: "object";
62
+ description: string;
63
+ properties: {
64
+ host: {
65
+ type: string;
66
+ description: string;
67
+ };
68
+ username: {
69
+ type: string;
70
+ description: string;
71
+ };
72
+ port: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ privateKeyPath: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ password: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ passphrase: {
85
+ type: string;
86
+ description: string;
87
+ };
88
+ projectsPath: {
89
+ type: string;
90
+ description: string;
91
+ };
92
+ };
93
+ required: string[];
94
+ };
95
+ };
96
+ //# sourceMappingURL=schema-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/schema-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Schema Helpers
3
+ * Common schema definitions for MCP tools
4
+ */
5
+ /**
6
+ * SSH configuration schema for direct SSH connection
7
+ * Can be used instead of profile parameter
8
+ */
9
+ export const sshConfigSchema = {
10
+ type: 'object',
11
+ description: 'Direct SSH configuration (overrides profile parameter)',
12
+ properties: {
13
+ host: {
14
+ type: 'string',
15
+ description: 'Server address (IP or domain)',
16
+ },
17
+ username: {
18
+ type: 'string',
19
+ description: 'SSH username',
20
+ },
21
+ port: {
22
+ type: 'number',
23
+ description: 'SSH port (default: 22)',
24
+ },
25
+ privateKeyPath: {
26
+ type: 'string',
27
+ description: 'Path to private SSH key (supports ~ for home directory)',
28
+ },
29
+ password: {
30
+ type: 'string',
31
+ description: 'SSH password (not recommended, use privateKeyPath instead)',
32
+ },
33
+ passphrase: {
34
+ type: 'string',
35
+ description: 'Passphrase for encrypted private key',
36
+ },
37
+ projectsPath: {
38
+ type: 'string',
39
+ description: 'Base path for Docker projects on remote server (e.g., /var/www)',
40
+ },
41
+ },
42
+ required: ['host', 'username'],
43
+ };
44
+ /**
45
+ * Profile parameter schema
46
+ */
47
+ export const profileSchema = {
48
+ type: 'string',
49
+ description: 'Profile name from DOCKER_PROFILES environment variable (default: uses default profile from config)',
50
+ };
51
+ /**
52
+ * Get common connection parameters (profile + ssh)
53
+ * Use this in tool schemas for consistent SSH/profile support
54
+ */
55
+ export function getConnectionParams() {
56
+ return {
57
+ profile: profileSchema,
58
+ ssh: sshConfigSchema,
59
+ };
60
+ }
61
+ //# sourceMappingURL=schema-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-helpers.js","sourceRoot":"","sources":["../../src/utils/schema-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAiB;IACvB,WAAW,EAAE,wDAAwD;IACrE,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+BAA+B;SAC7C;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,cAAc;SAC5B;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wBAAwB;SACtC;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yDAAyD;SACvE;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,4DAA4D;SAC1E;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,sCAAsC;SACpD;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iEAAiE;SAC/E;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,QAAiB;IACvB,WAAW,EAAE,oGAAoG;CAClH,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,GAAG,EAAE,eAAe;KACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * SSH Configuration Module
3
+ * SSH configuration management for remote Docker
4
+ */
5
+ /**
6
+ * SSH configuration for connecting to remote Docker server
7
+ */
8
+ export interface SSHConfig {
9
+ /** Server address (IP or domain name) */
10
+ host: string;
11
+ /** SSH port (default: 22) */
12
+ port?: number;
13
+ /** Username for SSH connection */
14
+ username: string;
15
+ /** Path to private SSH key */
16
+ privateKeyPath?: string;
17
+ /** Passphrase for encrypted SSH key */
18
+ passphrase?: string;
19
+ /** Password for authentication (not recommended for production) */
20
+ password?: string;
21
+ /** Base path for Docker projects on remote server (e.g., "/var/www") */
22
+ projectsPath?: string;
23
+ }
24
+ /**
25
+ * SSH profile with name and configuration
26
+ * Allows working with multiple servers
27
+ */
28
+ export interface SSHProfile {
29
+ /** Profile name (e.g., 'production', 'staging') */
30
+ name: string;
31
+ /** SSH configuration */
32
+ config: SSHConfig;
33
+ }
34
+ /**
35
+ * SSH configuration loading result
36
+ */
37
+ export interface SSHConfigResult {
38
+ /** SSH configuration or null if not found */
39
+ config: SSHConfig | null;
40
+ /** Validation errors (if any) */
41
+ errors: string[];
42
+ }
43
+ /**
44
+ * SSH profiles loading result
45
+ */
46
+ export interface SSHProfilesResult {
47
+ /** Profiles or empty object if not found */
48
+ profiles: Record<string, SSHConfig>;
49
+ /** Validation errors (if any) */
50
+ errors: string[];
51
+ }
52
+ /**
53
+ * Валидация SSH конфигурации
54
+ * @param config - SSH конфигурация для проверки
55
+ * @returns Массив ошибок (пустой, если валидация прошла успешно)
56
+ */
57
+ export declare function validateSSHConfig(config: Partial<SSHConfig>): string[];
58
+ /**
59
+ * Load SSH configuration from environment variables or profiles file
60
+ *
61
+ * Priority order:
62
+ * 1. DOCKER_MCP_PROFILES_FILE - Load from JSON file
63
+ * 2. DOCKER_SSH_PROFILE + DOCKER_SSH_PROFILES - Load from env JSON
64
+ * 3. DOCKER_SSH_HOST + DOCKER_SSH_USER - Simple single server config
65
+ *
66
+ * @param env - Environment variables object (defaults to process.env)
67
+ * @param profileName - Optional profile name to load (overrides DOCKER_SSH_PROFILE)
68
+ * @returns SSH configuration result with config and errors
69
+ */
70
+ export declare function loadSSHConfig(env?: Record<string, string | undefined>, profileName?: string): SSHConfigResult;
71
+ /**
72
+ * Загрузить SSH профили из environment variables
73
+ *
74
+ * Формат DOCKER_SSH_PROFILES: JSON объект
75
+ * {
76
+ * "profile1": {
77
+ * "host": "server1.com",
78
+ * "username": "user1",
79
+ * "port": 22,
80
+ * "privateKeyPath": "/path/to/key1"
81
+ * },
82
+ * "profile2": {
83
+ * "host": "server2.com",
84
+ * "username": "user2"
85
+ * }
86
+ * }
87
+ *
88
+ * @param env - Объект с environment variables (по умолчанию process.env)
89
+ * @returns Результат загрузки с профилями и ошибками
90
+ */
91
+ export declare function loadSSHProfiles(env?: Record<string, string | undefined>): SSHProfilesResult;
92
+ /**
93
+ * Get active SSH profile name
94
+ * @param env - Environment variables object
95
+ * @returns Active profile name or null
96
+ */
97
+ export declare function getActiveSSHProfile(env?: Record<string, string | undefined>): string | null;
98
+ /**
99
+ * Проверить существование SSH ключа по пути
100
+ * @param keyPath - Путь к SSH ключу
101
+ * @returns true, если ключ существует
102
+ */
103
+ export declare function checkSSHKeyExists(keyPath: string): boolean;
104
+ //# sourceMappingURL=ssh-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssh-config.d.ts","sourceRoot":"","sources":["../../src/utils/ssh-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,iCAAiC;IACjC,MAAM,EAA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