@mks2508/coolify-mks-cli-mcp 0.5.0 → 0.6.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/dist/cli/coolify-state.d.ts +51 -0
- package/dist/cli/coolify-state.d.ts.map +1 -0
- package/dist/cli/index.js +2862 -631
- package/dist/coolify/config.d.ts +1 -1
- package/dist/coolify/config.d.ts.map +1 -1
- package/dist/coolify/index.d.ts +626 -12
- package/dist/coolify/index.d.ts.map +1 -1
- package/dist/coolify/types.d.ts +87 -3
- package/dist/coolify/types.d.ts.map +1 -1
- package/dist/dist-C4hIkHif.js +66 -0
- package/dist/dist-C4hIkHif.js.map +1 -0
- package/dist/dist-DEPvJhbP.js +3 -0
- package/dist/index.cjs +8511 -28542
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +32 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8470 -28506
- package/dist/index.js.map +1 -1
- package/dist/network.d.ts +75 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/sdk.d.ts +356 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/sse.js +3 -1
- package/dist/server/stdio.d.ts +0 -2
- package/dist/server/stdio.d.ts.map +1 -1
- package/dist/server/stdio.js +3307 -1618
- package/dist/tools/definitions.d.ts +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/handlers.d.ts +6 -7
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/trace.d.ts +71 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/package.json +13 -7
- package/src/cli/actions.ts +162 -0
- package/src/cli/commands/active-deployments.ts +24 -0
- package/src/cli/commands/build-logs.ts +25 -22
- package/src/cli/commands/cancel-deploy.ts +35 -0
- package/src/cli/commands/config.ts +53 -47
- package/src/cli/commands/create.ts +74 -53
- package/src/cli/commands/databases.ts +63 -0
- package/src/cli/commands/db.ts +68 -0
- package/src/cli/commands/delete.ts +41 -29
- package/src/cli/commands/deploy.ts +42 -21
- package/src/cli/commands/deployments.ts +41 -31
- package/src/cli/commands/destinations.ts +19 -27
- package/src/cli/commands/diagnose.ts +139 -0
- package/src/cli/commands/env.ts +66 -41
- package/src/cli/commands/environments.ts +36 -32
- package/src/cli/commands/exec.ts +39 -0
- package/src/cli/commands/keys.ts +46 -0
- package/src/cli/commands/list.ts +29 -27
- package/src/cli/commands/logs.ts +33 -18
- package/src/cli/commands/network.ts +145 -0
- package/src/cli/commands/projects.ts +51 -39
- package/src/cli/commands/restart.ts +34 -18
- package/src/cli/commands/server-resources.ts +71 -0
- package/src/cli/commands/servers.ts +23 -23
- package/src/cli/commands/service-logs.ts +24 -16
- package/src/cli/commands/services.ts +63 -0
- package/src/cli/commands/show.ts +72 -41
- package/src/cli/commands/start.ts +34 -18
- package/src/cli/commands/stop.ts +34 -18
- package/src/cli/commands/svc.ts +68 -0
- package/src/cli/commands/teams.ts +60 -0
- package/src/cli/commands/update.ts +73 -49
- package/src/cli/commands/version.ts +37 -0
- package/src/cli/coolify-state.ts +88 -0
- package/src/cli/index.ts +383 -151
- package/src/coolify/config.ts +29 -27
- package/src/coolify/index.ts +1829 -123
- package/src/coolify/types.ts +217 -124
- package/src/index.ts +82 -868
- package/src/network.ts +298 -0
- package/src/sdk.ts +597 -0
- package/src/server/index.ts +13 -0
- package/src/server/sse.ts +33 -25
- package/src/server/stdio.ts +24 -27
- package/src/tools/definitions.ts +893 -264
- package/src/tools/handlers.ts +556 -748
- package/src/tools/index.ts +8 -0
- package/src/trace.ts +116 -0
- package/src/utils/format.ts +36 -33
package/src/coolify/config.ts
CHANGED
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { readFile, writeFile, mkdir } from
|
|
11
|
-
import { existsSync } from
|
|
12
|
-
import { homedir } from
|
|
13
|
-
import { join } from
|
|
14
|
-
import { ok, err, isOk, type Result } from
|
|
10
|
+
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { ok, err, isOk, type Result } from "@mks2508/no-throw";
|
|
15
15
|
|
|
16
|
-
const CONFIG_DIR = join(homedir(),
|
|
17
|
-
const CONFIG_FILE = join(CONFIG_DIR,
|
|
16
|
+
const CONFIG_DIR = join(homedir(), ".config", "coolify-mks-cli-mcp");
|
|
17
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Coolify configuration structure.
|
|
21
21
|
*/
|
|
22
22
|
export interface ICoolifyConfig {
|
|
23
23
|
/** Coolify instance URL */
|
|
24
|
-
url?: string
|
|
24
|
+
url?: string;
|
|
25
25
|
/** Coolify API token */
|
|
26
|
-
token?: string
|
|
26
|
+
token?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -44,18 +44,18 @@ export interface ICoolifyConfig {
|
|
|
44
44
|
export async function loadConfig(): Promise<Result<ICoolifyConfig, Error>> {
|
|
45
45
|
try {
|
|
46
46
|
if (existsSync(CONFIG_FILE)) {
|
|
47
|
-
const content = await readFile(CONFIG_FILE,
|
|
48
|
-
const parsed = JSON.parse(content) as ICoolifyConfig
|
|
49
|
-
return ok(parsed)
|
|
47
|
+
const content = await readFile(CONFIG_FILE, "utf-8");
|
|
48
|
+
const parsed = JSON.parse(content) as ICoolifyConfig;
|
|
49
|
+
return ok(parsed);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Fallback to environment variables
|
|
53
53
|
return ok({
|
|
54
54
|
url: process.env.COOLIFY_URL,
|
|
55
|
-
token: process.env.COOLIFY_TOKEN
|
|
56
|
-
})
|
|
55
|
+
token: process.env.COOLIFY_TOKEN,
|
|
56
|
+
});
|
|
57
57
|
} catch (error) {
|
|
58
|
-
return err(error instanceof Error ? error : new Error(String(error)))
|
|
58
|
+
return err(error instanceof Error ? error : new Error(String(error)));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -72,15 +72,17 @@ export async function loadConfig(): Promise<Result<ICoolifyConfig, Error>> {
|
|
|
72
72
|
* const result = await saveConfig({ url: 'https://coolify.example.com', token: 'xxx' })
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
export async function saveConfig(
|
|
75
|
+
export async function saveConfig(
|
|
76
|
+
config: ICoolifyConfig,
|
|
77
|
+
): Promise<Result<void, Error>> {
|
|
76
78
|
try {
|
|
77
79
|
if (!existsSync(CONFIG_DIR)) {
|
|
78
|
-
await mkdir(CONFIG_DIR, { recursive: true })
|
|
80
|
+
await mkdir(CONFIG_DIR, { recursive: true });
|
|
79
81
|
}
|
|
80
|
-
await writeFile(CONFIG_FILE, JSON.stringify(config, null, 2))
|
|
81
|
-
return ok(undefined)
|
|
82
|
+
await writeFile(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
83
|
+
return ok(undefined);
|
|
82
84
|
} catch (error) {
|
|
83
|
-
return err(error instanceof Error ? error : new Error(String(error)))
|
|
85
|
+
return err(error instanceof Error ? error : new Error(String(error)));
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
|
|
@@ -90,11 +92,11 @@ export async function saveConfig(config: ICoolifyConfig): Promise<Result<void, E
|
|
|
90
92
|
* @returns Coolify URL or undefined
|
|
91
93
|
*/
|
|
92
94
|
export async function getCoolifyUrl(): Promise<string | undefined> {
|
|
93
|
-
const result = await loadConfig()
|
|
95
|
+
const result = await loadConfig();
|
|
94
96
|
if (isOk(result)) {
|
|
95
|
-
return result.value.url || process.env.COOLIFY_URL
|
|
97
|
+
return result.value.url || process.env.COOLIFY_URL;
|
|
96
98
|
}
|
|
97
|
-
return process.env.COOLIFY_URL
|
|
99
|
+
return process.env.COOLIFY_URL;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -103,11 +105,11 @@ export async function getCoolifyUrl(): Promise<string | undefined> {
|
|
|
103
105
|
* @returns Coolify token or undefined
|
|
104
106
|
*/
|
|
105
107
|
export async function getCoolifyToken(): Promise<string | undefined> {
|
|
106
|
-
const result = await loadConfig()
|
|
108
|
+
const result = await loadConfig();
|
|
107
109
|
if (isOk(result)) {
|
|
108
|
-
return result.value.token || process.env.COOLIFY_TOKEN
|
|
110
|
+
return result.value.token || process.env.COOLIFY_TOKEN;
|
|
109
111
|
}
|
|
110
|
-
return process.env.COOLIFY_TOKEN
|
|
112
|
+
return process.env.COOLIFY_TOKEN;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
export { CONFIG_DIR, CONFIG_FILE }
|
|
115
|
+
export { CONFIG_DIR, CONFIG_FILE };
|