@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.
Files changed (88) hide show
  1. package/dist/cli/coolify-state.d.ts +51 -0
  2. package/dist/cli/coolify-state.d.ts.map +1 -0
  3. package/dist/cli/index.js +2862 -631
  4. package/dist/coolify/config.d.ts +1 -1
  5. package/dist/coolify/config.d.ts.map +1 -1
  6. package/dist/coolify/index.d.ts +626 -12
  7. package/dist/coolify/index.d.ts.map +1 -1
  8. package/dist/coolify/types.d.ts +87 -3
  9. package/dist/coolify/types.d.ts.map +1 -1
  10. package/dist/dist-C4hIkHif.js +66 -0
  11. package/dist/dist-C4hIkHif.js.map +1 -0
  12. package/dist/dist-DEPvJhbP.js +3 -0
  13. package/dist/index.cjs +8511 -28542
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +32 -8
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +8470 -28506
  18. package/dist/index.js.map +1 -1
  19. package/dist/network.d.ts +75 -0
  20. package/dist/network.d.ts.map +1 -0
  21. package/dist/sdk.d.ts +356 -0
  22. package/dist/sdk.d.ts.map +1 -0
  23. package/dist/server/index.d.ts +9 -0
  24. package/dist/server/index.d.ts.map +1 -0
  25. package/dist/server/sse.js +3 -1
  26. package/dist/server/stdio.d.ts +0 -2
  27. package/dist/server/stdio.d.ts.map +1 -1
  28. package/dist/server/stdio.js +3307 -1618
  29. package/dist/tools/definitions.d.ts +1 -1
  30. package/dist/tools/definitions.d.ts.map +1 -1
  31. package/dist/tools/handlers.d.ts +6 -7
  32. package/dist/tools/handlers.d.ts.map +1 -1
  33. package/dist/tools/index.d.ts +8 -0
  34. package/dist/tools/index.d.ts.map +1 -0
  35. package/dist/trace.d.ts +71 -0
  36. package/dist/trace.d.ts.map +1 -0
  37. package/dist/utils/format.d.ts +1 -1
  38. package/dist/utils/format.d.ts.map +1 -1
  39. package/package.json +13 -7
  40. package/src/cli/actions.ts +162 -0
  41. package/src/cli/commands/active-deployments.ts +24 -0
  42. package/src/cli/commands/build-logs.ts +25 -22
  43. package/src/cli/commands/cancel-deploy.ts +35 -0
  44. package/src/cli/commands/config.ts +53 -47
  45. package/src/cli/commands/create.ts +74 -53
  46. package/src/cli/commands/databases.ts +63 -0
  47. package/src/cli/commands/db.ts +68 -0
  48. package/src/cli/commands/delete.ts +41 -29
  49. package/src/cli/commands/deploy.ts +42 -21
  50. package/src/cli/commands/deployments.ts +41 -31
  51. package/src/cli/commands/destinations.ts +19 -27
  52. package/src/cli/commands/diagnose.ts +139 -0
  53. package/src/cli/commands/env.ts +66 -41
  54. package/src/cli/commands/environments.ts +36 -32
  55. package/src/cli/commands/exec.ts +39 -0
  56. package/src/cli/commands/keys.ts +46 -0
  57. package/src/cli/commands/list.ts +29 -27
  58. package/src/cli/commands/logs.ts +33 -18
  59. package/src/cli/commands/network.ts +145 -0
  60. package/src/cli/commands/projects.ts +51 -39
  61. package/src/cli/commands/restart.ts +34 -18
  62. package/src/cli/commands/server-resources.ts +71 -0
  63. package/src/cli/commands/servers.ts +23 -23
  64. package/src/cli/commands/service-logs.ts +24 -16
  65. package/src/cli/commands/services.ts +63 -0
  66. package/src/cli/commands/show.ts +72 -41
  67. package/src/cli/commands/start.ts +34 -18
  68. package/src/cli/commands/stop.ts +34 -18
  69. package/src/cli/commands/svc.ts +68 -0
  70. package/src/cli/commands/teams.ts +60 -0
  71. package/src/cli/commands/update.ts +73 -49
  72. package/src/cli/commands/version.ts +37 -0
  73. package/src/cli/coolify-state.ts +88 -0
  74. package/src/cli/index.ts +383 -151
  75. package/src/coolify/config.ts +29 -27
  76. package/src/coolify/index.ts +1829 -123
  77. package/src/coolify/types.ts +217 -124
  78. package/src/index.ts +82 -868
  79. package/src/network.ts +298 -0
  80. package/src/sdk.ts +597 -0
  81. package/src/server/index.ts +13 -0
  82. package/src/server/sse.ts +33 -25
  83. package/src/server/stdio.ts +24 -27
  84. package/src/tools/definitions.ts +893 -264
  85. package/src/tools/handlers.ts +556 -748
  86. package/src/tools/index.ts +8 -0
  87. package/src/trace.ts +116 -0
  88. package/src/utils/format.ts +36 -33
@@ -4,46 +4,61 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { isErr } from '@mks2508/no-throw'
8
- import chalk from 'chalk'
9
- import { getCoolifyService } from '../../coolify/index.js'
7
+ import { isErr } from "@mks2508/no-throw";
8
+ import chalk from "chalk";
9
+ import { getCoolifyService } from "../../coolify/index.js";
10
+ import { resolveUuid } from "../coolify-state.js";
10
11
 
11
12
  /**
12
13
  * Logs command handler.
14
+ * If no UUID is provided, reads from .coolify.json in the current directory.
13
15
  *
14
- * @param uuid - Application UUID
16
+ * @param uuid - Application UUID (optional if .coolify.json exists)
15
17
  * @param options - Logs options
16
18
  */
17
- export async function logsCommand(uuid: string, options: { lines?: number; follow?: boolean }) {
18
- const coolify = getCoolifyService()
19
- const initResult = await coolify.init()
19
+ export async function logsCommand(
20
+ uuid: string | undefined,
21
+ options: { lines?: number; follow?: boolean },
22
+ ) {
23
+ const resolvedUuid = resolveUuid(uuid);
24
+ if (!resolvedUuid) {
25
+ console.error(
26
+ chalk.red("Error: No UUID provided and no .coolify.json found"),
27
+ );
28
+ return;
29
+ }
30
+ uuid = resolvedUuid;
31
+ const coolify = getCoolifyService();
32
+ const initResult = await coolify.init();
20
33
 
21
34
  if (isErr(initResult)) {
22
- console.error(chalk.red(`Error: ${initResult.error.message}`))
23
- return
35
+ console.error(chalk.red(`Error: ${initResult.error.message}`));
36
+ return;
24
37
  }
25
38
 
26
- const result = await coolify.getApplicationLogs(uuid, { tail: options.lines || 50 })
39
+ const result = await coolify.getApplicationLogs(uuid, {
40
+ tail: options.lines || 50,
41
+ });
27
42
 
28
43
  if (isErr(result)) {
29
- console.error(chalk.red(`Error: ${result.error.message}`))
30
- return
44
+ console.error(chalk.red(`Error: ${result.error.message}`));
45
+ return;
31
46
  }
32
47
 
33
- const logs = result.value
48
+ const logs = result.value;
34
49
 
35
50
  if (logs.logs.length === 0) {
36
- console.log(chalk.yellow('No logs available'))
37
- return
51
+ console.log(chalk.yellow("No logs available"));
52
+ return;
38
53
  }
39
54
 
40
- console.log(chalk.gray(`Application logs (${logs.logs.length} lines):\n`))
55
+ console.log(chalk.gray(`Application logs (${logs.logs.length} lines):\n`));
41
56
 
42
57
  for (const line of logs.logs) {
43
- console.log(line)
58
+ console.log(line);
44
59
  }
45
60
 
46
61
  if (options.follow) {
47
- console.log(chalk.yellow('\nFollow mode not yet implemented'))
62
+ console.log(chalk.yellow("\nFollow mode not yet implemented"));
48
63
  }
49
64
  }
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Network diagnostic CLI commands.
3
+ *
4
+ * Inspects Docker container networking, DNS, proxy, and connectivity.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ import { chalk, getCliSdk } from "../actions.js";
10
+ import { resolveUuid } from "../coolify-state.js";
11
+
12
+ /** Inspect container network environment. */
13
+ export async function networkInspectCommand(
14
+ uuid: string | undefined,
15
+ options: { services?: string } = {},
16
+ ): Promise<void> {
17
+ const resolved = resolveUuid(uuid);
18
+ if (!resolved) {
19
+ console.error(
20
+ chalk.red("Error: No UUID provided and no .coolify.json found"),
21
+ );
22
+ return;
23
+ }
24
+
25
+ const servicesToTest = options.services
26
+ ? options.services.split(",").map((s) => s.trim())
27
+ : [];
28
+
29
+ console.log(chalk.cyan(`Inspecting network for ${resolved}...\n`));
30
+
31
+ try {
32
+ const info = await getCliSdk().network.inspect(resolved, servicesToTest);
33
+
34
+ // Hosts
35
+ console.log(chalk.bold("Container Hosts (/etc/hosts):"));
36
+ if (info.hosts.length > 0) {
37
+ for (const h of info.hosts) {
38
+ console.log(` ${chalk.gray(h)}`);
39
+ }
40
+ } else {
41
+ console.log(chalk.yellow(" No entries"));
42
+ }
43
+
44
+ // Network interfaces
45
+ if (info.interfaces.length > 0) {
46
+ console.log(chalk.bold("\nNetwork Interfaces:"));
47
+ for (const iface of info.interfaces) {
48
+ console.log(` ${chalk.gray(iface.trim())}`);
49
+ }
50
+ }
51
+
52
+ // Network env vars
53
+ const envEntries = Object.entries(info.networkEnv);
54
+ if (envEntries.length > 0) {
55
+ console.log(chalk.bold("\nNetwork Environment Variables:"));
56
+ for (const [key, val] of envEntries) {
57
+ console.log(` ${chalk.green(key)} = ${chalk.gray(val)}`);
58
+ }
59
+ }
60
+
61
+ // DNS resolution
62
+ if (info.dns.length > 0) {
63
+ console.log(chalk.bold("\nDNS Resolution:"));
64
+ for (const d of info.dns) {
65
+ const status = d.resolved
66
+ ? chalk.green(`✓ ${d.ip}`)
67
+ : chalk.red("✗ FAILED");
68
+ console.log(` ${chalk.white(d.hostname)} → ${status}`);
69
+ }
70
+ }
71
+
72
+ // Connectivity
73
+ if (info.connectivity.length > 0) {
74
+ console.log(chalk.bold("\nService Connectivity:"));
75
+ for (const c of info.connectivity) {
76
+ const status = c.reachable
77
+ ? chalk.green(`✓ reachable (${c.responseTime}ms)`)
78
+ : chalk.red("✗ unreachable");
79
+ console.log(` ${chalk.white(c.target)} → ${status}`);
80
+ }
81
+ }
82
+
83
+ // Trace
84
+ console.log(chalk.bold("\nTrace:"));
85
+ for (const step of info.trace.steps) {
86
+ console.log(
87
+ ` ${chalk.gray(step.step)} ${chalk.yellow(step.durationMs + "ms")}${step.detail ? chalk.gray(` (${step.detail})`) : ""}`,
88
+ );
89
+ }
90
+ console.log(chalk.gray(` Total: ${info.trace.totalMs}ms`));
91
+ } catch (error) {
92
+ console.error(
93
+ chalk.red(
94
+ `Error: ${error instanceof Error ? error.message : String(error)}`,
95
+ ),
96
+ );
97
+ }
98
+ }
99
+
100
+ /** Analyze a failed deployment. */
101
+ export async function analyzeDeployCommand(
102
+ deploymentUuid: string,
103
+ ): Promise<void> {
104
+ console.log(chalk.cyan(`Analyzing deployment ${deploymentUuid}...\n`));
105
+
106
+ try {
107
+ const analysis = await getCliSdk().diagnose.deployFailure(deploymentUuid);
108
+
109
+ console.log(chalk.bold("Deployment:"));
110
+ console.log(` ${chalk.gray("UUID:")} ${analysis.deploymentUuid}`);
111
+ console.log(` ${chalk.gray("Status:")} ${analysis.status}`);
112
+ console.log(
113
+ ` ${chalk.gray("Category:")} ${chalk.yellow(analysis.category)}`,
114
+ );
115
+
116
+ console.log(chalk.bold.red(`\nDiagnosis: ${analysis.summary}`));
117
+ console.log(chalk.cyan(`Suggestion: ${analysis.suggestion}`));
118
+
119
+ if (analysis.errors.length > 0) {
120
+ console.log(chalk.bold(`\nError Lines (${analysis.errors.length}):`));
121
+ for (const line of analysis.errors.slice(0, 10)) {
122
+ console.log(` ${chalk.red(line.trim())}`);
123
+ }
124
+ if (analysis.errors.length > 10) {
125
+ console.log(
126
+ chalk.gray(` ... and ${analysis.errors.length - 10} more`),
127
+ );
128
+ }
129
+ }
130
+
131
+ // Trace
132
+ console.log(chalk.bold("\nTrace:"));
133
+ for (const step of analysis.trace.steps) {
134
+ console.log(
135
+ ` ${chalk.gray(step.step)} ${chalk.yellow(step.durationMs + "ms")}${step.detail ? chalk.gray(` (${step.detail})`) : ""}`,
136
+ );
137
+ }
138
+ } catch (error) {
139
+ console.error(
140
+ chalk.red(
141
+ `Error: ${error instanceof Error ? error.message : String(error)}`,
142
+ ),
143
+ );
144
+ }
145
+ }
@@ -4,83 +4,95 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { isOk, isErr } from '@mks2508/no-throw'
8
- import ora from 'ora'
9
- import chalk from 'chalk'
10
- import Table from 'cli-table3'
11
- import { getCoolifyService } from '../../coolify/index.js'
7
+ import { isOk, isErr } from "@mks2508/no-throw";
8
+ import ora from "ora";
9
+ import chalk from "chalk";
10
+ import Table from "cli-table3";
11
+ import { getCoolifyService } from "../../coolify/index.js";
12
12
 
13
13
  /**
14
14
  * Projects command handler.
15
15
  * Lists all projects, or creates a new one if --create is provided.
16
16
  */
17
- export async function projectsCommand(options: { full?: boolean; create?: string; description?: string } = {}) {
18
- const spinner = ora('Connecting to Coolify...').start()
17
+ export async function projectsCommand(
18
+ options: { full?: boolean; create?: string; description?: string } = {},
19
+ ) {
20
+ const spinner = ora("Connecting to Coolify...").start();
19
21
 
20
22
  try {
21
- const coolify = getCoolifyService()
22
- const initResult = await coolify.init()
23
+ const coolify = getCoolifyService();
24
+ const initResult = await coolify.init();
23
25
 
24
26
  if (isErr(initResult)) {
25
- spinner.fail(chalk.red(`Failed to initialize: ${initResult.error.message}`))
26
- return
27
+ spinner.fail(
28
+ chalk.red(`Failed to initialize: ${initResult.error.message}`),
29
+ );
30
+ return;
27
31
  }
28
32
 
29
33
  // Create mode
30
34
  if (options.create) {
31
- spinner.text = `Creating project "${options.create}"...`
32
- const createResult = await coolify.createProject(options.create, options.description)
35
+ spinner.text = `Creating project "${options.create}"...`;
36
+ const createResult = await coolify.createProject(
37
+ options.create,
38
+ options.description,
39
+ );
33
40
 
34
41
  if (isOk(createResult)) {
35
- spinner.succeed(chalk.green(`Project created: ${chalk.cyan(createResult.value.uuid)}`))
36
- console.log(` Name: ${chalk.cyan(options.create)}`)
37
- console.log(` UUID: ${chalk.cyan(createResult.value.uuid)}`)
42
+ spinner.succeed(
43
+ chalk.green(
44
+ `Project created: ${chalk.cyan(createResult.value.uuid)}`,
45
+ ),
46
+ );
47
+ console.log(` Name: ${chalk.cyan(options.create)}`);
48
+ console.log(` UUID: ${chalk.cyan(createResult.value.uuid)}`);
38
49
  } else {
39
- spinner.fail(chalk.red(`Failed to create project: ${createResult.error.message}`))
50
+ spinner.fail(
51
+ chalk.red(`Failed to create project: ${createResult.error.message}`),
52
+ );
40
53
  }
41
- return
54
+ return;
42
55
  }
43
56
 
44
57
  // List mode
45
- spinner.text = 'Fetching projects...'
58
+ spinner.text = "Fetching projects...";
46
59
 
47
- const result = await coolify.listProjects()
60
+ const result = await coolify.listProjects();
48
61
 
49
62
  if (isOk(result)) {
50
- spinner.succeed(chalk.green('Projects retrieved'))
63
+ spinner.succeed(chalk.green("Projects retrieved"));
51
64
 
52
- const projects = result.value
65
+ const projects = result.value;
53
66
 
54
67
  if (projects.length === 0) {
55
- console.log(chalk.yellow('No projects found'))
56
- return
68
+ console.log(chalk.yellow("No projects found"));
69
+ return;
57
70
  }
58
71
 
59
72
  const table = new Table({
60
73
  head: [
61
- chalk.cyan('UUID'),
62
- chalk.cyan('Name'),
63
- chalk.cyan('Description'),
74
+ chalk.cyan("UUID"),
75
+ chalk.cyan("Name"),
76
+ chalk.cyan("Description"),
64
77
  ],
65
- ...(options.full ? { colWidths: [36, 30, 40] } : {}),
66
- })
78
+ });
67
79
 
68
80
  for (const project of projects) {
69
- table.push([
70
- options.full ? project.uuid : project.uuid.slice(0, 8),
71
- project.name,
72
- project.description || '-',
73
- ])
81
+ table.push([project.uuid, project.name, project.description || "-"]);
74
82
  }
75
83
 
76
- console.log(table.toString())
77
- console.log(chalk.gray(`Total: ${projects.length} project(s)`))
84
+ console.log(table.toString());
85
+ console.log(chalk.gray(`Total: ${projects.length} project(s)`));
78
86
  } else {
79
- spinner.fail(chalk.red(`Failed to fetch projects: ${result.error.message}`))
87
+ spinner.fail(
88
+ chalk.red(`Failed to fetch projects: ${result.error.message}`),
89
+ );
80
90
  }
81
91
  } catch (error) {
82
92
  spinner.fail(
83
- chalk.red(`Error: ${error instanceof Error ? error.message : String(error)}`)
84
- )
93
+ chalk.red(
94
+ `Error: ${error instanceof Error ? error.message : String(error)}`,
95
+ ),
96
+ );
85
97
  }
86
98
  }
@@ -4,41 +4,57 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { isErr } from '@mks2508/no-throw'
8
- import ora from 'ora'
9
- import chalk from 'chalk'
10
- import { getCoolifyService } from '../../coolify/index.js'
7
+ import { isErr } from "@mks2508/no-throw";
8
+ import ora from "ora";
9
+ import chalk from "chalk";
10
+ import { getCoolifyService } from "../../coolify/index.js";
11
+ import { resolveUuid } from "../coolify-state.js";
11
12
 
12
13
  /**
13
14
  * Restart command handler.
15
+ * If no UUID is provided, reads from .coolify.json in the current directory.
14
16
  *
15
- * @param uuid - Application UUID
17
+ * @param uuid - Application UUID (optional if .coolify.json exists)
16
18
  */
17
- export async function restartCommand(uuid: string) {
18
- const spinner = ora('Initializing Coolify connection...').start()
19
+ export async function restartCommand(uuid?: string) {
20
+ const resolvedUuid = resolveUuid(uuid);
21
+ if (!resolvedUuid) {
22
+ console.error(
23
+ chalk.red("Error: No UUID provided and no .coolify.json found"),
24
+ );
25
+ return;
26
+ }
27
+ uuid = resolvedUuid;
28
+ const spinner = ora("Initializing Coolify connection...").start();
19
29
 
20
30
  try {
21
- const coolify = getCoolifyService()
22
- const initResult = await coolify.init()
31
+ const coolify = getCoolifyService();
32
+ const initResult = await coolify.init();
23
33
 
24
34
  if (isErr(initResult)) {
25
- spinner.fail(chalk.red(`Failed to initialize: ${initResult.error.message}`))
26
- return
35
+ spinner.fail(
36
+ chalk.red(`Failed to initialize: ${initResult.error.message}`),
37
+ );
38
+ return;
27
39
  }
28
40
 
29
- spinner.text = 'Restarting application...'
41
+ spinner.text = "Restarting application...";
30
42
 
31
- const result = await coolify.restartApplication(uuid)
43
+ const result = await coolify.restartApplication(uuid);
32
44
 
33
45
  if (isErr(result)) {
34
- spinner.fail(chalk.red(`Failed to restart application: ${result.error.message}`))
35
- return
46
+ spinner.fail(
47
+ chalk.red(`Failed to restart application: ${result.error.message}`),
48
+ );
49
+ return;
36
50
  }
37
51
 
38
- spinner.succeed(chalk.green(`Application restarted: ${chalk.cyan(uuid.slice(0, 8))}`))
52
+ spinner.succeed(chalk.green(`Application restarted: ${chalk.cyan(uuid)}`));
39
53
  } catch (error) {
40
54
  spinner.fail(
41
- chalk.red(`Error: ${error instanceof Error ? error.message : String(error)}`)
42
- )
55
+ chalk.red(
56
+ `Error: ${error instanceof Error ? error.message : String(error)}`,
57
+ ),
58
+ );
43
59
  }
44
60
  }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Server resources command for CLI.
3
+ *
4
+ * Shows resources deployed on a specific server.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ import { isErr } from "@mks2508/no-throw";
10
+ import chalk from "chalk";
11
+ import Table from "cli-table3";
12
+ import { getCoolifyService } from "../../coolify/index.js";
13
+ import { formatStatus } from "../../utils/format.js";
14
+
15
+ /**
16
+ * Server resources command handler.
17
+ *
18
+ * @param serverUuid - Server UUID
19
+ * @param options - Command options
20
+ */
21
+ export async function serverResourcesCommand(
22
+ serverUuid: string,
23
+ _options: { full?: boolean } = {},
24
+ ) {
25
+ const coolify = getCoolifyService();
26
+ const initResult = await coolify.init();
27
+
28
+ if (isErr(initResult)) {
29
+ console.error(chalk.red(`Error: ${initResult.error.message}`));
30
+ return;
31
+ }
32
+
33
+ const result = await coolify.getServerResources(serverUuid);
34
+
35
+ if (isErr(result)) {
36
+ console.error(chalk.red(`Error: ${result.error.message}`));
37
+ return;
38
+ }
39
+
40
+ const resources = result.value;
41
+
42
+ if (resources.length === 0) {
43
+ console.log(chalk.yellow("No resources found on this server"));
44
+ return;
45
+ }
46
+
47
+ const table = new Table({
48
+ head: [
49
+ chalk.cyan("UUID"),
50
+ chalk.cyan("Name"),
51
+ chalk.cyan("Type"),
52
+ chalk.cyan("Status"),
53
+ ],
54
+ });
55
+
56
+ for (const res of resources) {
57
+ table.push([
58
+ res.uuid,
59
+ res.name || "-",
60
+ res.type || "-",
61
+ formatStatus(res.status),
62
+ ]);
63
+ }
64
+
65
+ console.log(table.toString());
66
+ console.log(
67
+ chalk.gray(
68
+ `Total: ${resources.length} resource(s) on server ${serverUuid}`,
69
+ ),
70
+ );
71
+ }
@@ -4,49 +4,49 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { isErr } from '@mks2508/no-throw'
8
- import chalk from 'chalk'
9
- import { getCoolifyService } from '../../coolify/index.js'
10
- import { createTable } from '../../utils/format.js'
7
+ import { isErr } from "@mks2508/no-throw";
8
+ import chalk from "chalk";
9
+ import { getCoolifyService } from "../../coolify/index.js";
10
+ import { createTable } from "../../utils/format.js";
11
11
 
12
12
  /**
13
13
  * Servers command handler.
14
14
  */
15
- export async function serversCommand(options: { full?: boolean } = {}) {
16
- const coolify = getCoolifyService()
17
- const initResult = await coolify.init()
15
+ export async function serversCommand(_options: { full?: boolean } = {}) {
16
+ const coolify = getCoolifyService();
17
+ const initResult = await coolify.init();
18
18
 
19
19
  if (isErr(initResult)) {
20
- console.error(chalk.red(`Error: ${initResult.error.message}`))
21
- return
20
+ console.error(chalk.red(`Error: ${initResult.error.message}`));
21
+ return;
22
22
  }
23
23
 
24
- const result = await coolify.listServers()
24
+ const result = await coolify.listServers();
25
25
 
26
26
  if (isErr(result)) {
27
- console.error(chalk.red(`Error: ${result.error.message}`))
28
- return
27
+ console.error(chalk.red(`Error: ${result.error.message}`));
28
+ return;
29
29
  }
30
30
 
31
- const servers = result.value
31
+ const servers = result.value;
32
32
 
33
33
  if (servers.length === 0) {
34
- console.log(chalk.yellow('No servers found'))
35
- return
34
+ console.log(chalk.yellow("No servers found"));
35
+ return;
36
36
  }
37
37
 
38
- const table = createTable(['UUID', 'Name', 'IP', 'Status'], [options.full ? 36 : 8, 25, 20, 15])
38
+ const table = createTable(["UUID", "Name", "IP", "Status"], [28, 25, 20, 15]);
39
39
 
40
40
  for (const server of servers) {
41
- const statusColor = server.is_usable ? chalk.green : chalk.red
41
+ const statusColor = server.is_usable ? chalk.green : chalk.red;
42
42
  table.push([
43
- options.full ? server.uuid : server.uuid.slice(0, 8),
43
+ server.uuid,
44
44
  server.name,
45
- server.ip || 'N/A',
46
- statusColor(server.is_usable ? '● Usable' : '○ Unusable'),
47
- ])
45
+ server.ip || "N/A",
46
+ statusColor(server.is_usable ? "● Usable" : "○ Unusable"),
47
+ ]);
48
48
  }
49
49
 
50
- console.log(table.toString())
51
- console.log(chalk.gray(`Total: ${servers.length} server(s)`))
50
+ console.log(table.toString());
51
+ console.log(chalk.gray(`Total: ${servers.length} server(s)`));
52
52
  }
@@ -6,9 +6,9 @@
6
6
  * @module
7
7
  */
8
8
 
9
- import { isErr } from '@mks2508/no-throw'
10
- import chalk from 'chalk'
11
- import { getCoolifyService } from '../../coolify/index.js'
9
+ import { isErr } from "@mks2508/no-throw";
10
+ import chalk from "chalk";
11
+ import { getCoolifyService } from "../../coolify/index.js";
12
12
 
13
13
  /**
14
14
  * Service logs command handler.
@@ -17,35 +17,43 @@ import { getCoolifyService } from '../../coolify/index.js'
17
17
  * @param serviceName - Docker Compose service name
18
18
  * @param options - Logs options
19
19
  */
20
- export async function serviceLogsCommand(uuid: string, serviceName: string, options: { lines?: number }) {
21
- const coolify = getCoolifyService()
22
- const initResult = await coolify.init()
20
+ export async function serviceLogsCommand(
21
+ uuid: string,
22
+ serviceName: string,
23
+ options: { lines?: number },
24
+ ) {
25
+ const coolify = getCoolifyService();
26
+ const initResult = await coolify.init();
23
27
 
24
28
  if (isErr(initResult)) {
25
- console.error(chalk.red(`Error: ${initResult.error.message}`))
26
- return
29
+ console.error(chalk.red(`Error: ${initResult.error.message}`));
30
+ return;
27
31
  }
28
32
 
29
33
  const result = await coolify.getApplicationLogs(uuid, {
30
34
  tail: options.lines || 50,
31
35
  serviceName,
32
- })
36
+ });
33
37
 
34
38
  if (isErr(result)) {
35
- console.error(chalk.red(`Error: ${result.error.message}`))
36
- return
39
+ console.error(chalk.red(`Error: ${result.error.message}`));
40
+ return;
37
41
  }
38
42
 
39
- const logs = result.value
43
+ const logs = result.value;
40
44
 
41
45
  if (logs.logs.length === 0) {
42
- console.log(chalk.yellow(`No logs available for service "${serviceName}"`))
43
- return
46
+ console.log(chalk.yellow(`No logs available for service "${serviceName}"`));
47
+ return;
44
48
  }
45
49
 
46
- console.log(chalk.gray(`Service "${chalk.white(serviceName)}" logs (${logs.logs.length} lines):\n`))
50
+ console.log(
51
+ chalk.gray(
52
+ `Service "${chalk.white(serviceName)}" logs (${logs.logs.length} lines):\n`,
53
+ ),
54
+ );
47
55
 
48
56
  for (const line of logs.logs) {
49
- console.log(line)
57
+ console.log(line);
50
58
  }
51
59
  }