@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
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Version command for CLI.
3
+ *
4
+ * Shows the Coolify server version.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ import { isErr } from "@mks2508/no-throw";
10
+ import chalk from "chalk";
11
+ import { getCoolifyService } from "../../coolify/index.js";
12
+
13
+ /**
14
+ * Version command handler.
15
+ * Displays the Coolify server version.
16
+ */
17
+ export async function versionCommand() {
18
+ const coolify = getCoolifyService();
19
+ const initResult = await coolify.init();
20
+
21
+ if (isErr(initResult)) {
22
+ console.error(chalk.red(`Error: ${initResult.error.message}`));
23
+ return;
24
+ }
25
+
26
+ const result = await coolify.getVersion();
27
+
28
+ if (isErr(result)) {
29
+ console.error(chalk.red(`Error: ${result.error.message}`));
30
+ return;
31
+ }
32
+
33
+ console.log(
34
+ chalk.cyan("Coolify Server Version:"),
35
+ chalk.bold(result.value.version),
36
+ );
37
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * .coolify.json state loader for CLI.
3
+ *
4
+ * When running CLI commands from a project directory that has a .coolify.json
5
+ * (generated by create-bunspace or first deploy), reads the state to auto-fill
6
+ * UUIDs so users don't need to copy-paste them.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ import { existsSync, readFileSync } from "node:fs";
12
+ import { join } from "node:path";
13
+
14
+ /**
15
+ * State stored in .coolify.json (generated by create-bunspace deployer).
16
+ */
17
+ export interface ICoolifyDeployState {
18
+ /** Application UUID in Coolify */
19
+ appUuid: string;
20
+ /** Server UUID */
21
+ serverUuid: string;
22
+ /** Project UUID */
23
+ projectUuid: string;
24
+ /** Environment UUID */
25
+ environmentUuid: string;
26
+ /** Domain if configured */
27
+ domain?: string;
28
+ /** Docker compose or Dockerfile path */
29
+ dockerComposePath?: string;
30
+ /** Base directory for build context */
31
+ baseDirectory?: string;
32
+ /** Git branch */
33
+ branch?: string;
34
+ /** Application type */
35
+ type?: string;
36
+ /** Build pack */
37
+ buildPack?: string;
38
+ /** Auto-deploy enabled */
39
+ autoDeployEnabled?: boolean;
40
+ }
41
+
42
+ const STATE_FILE = ".coolify.json";
43
+
44
+ /**
45
+ * Loads .coolify.json from the current working directory.
46
+ *
47
+ * @returns The deploy state if found, null otherwise
48
+ */
49
+ export function loadCoolifyState(): ICoolifyDeployState | null {
50
+ const statePath = join(process.cwd(), STATE_FILE);
51
+
52
+ if (!existsSync(statePath)) {
53
+ return null;
54
+ }
55
+
56
+ try {
57
+ const content = readFileSync(statePath, "utf-8");
58
+ const state = JSON.parse(content) as ICoolifyDeployState;
59
+
60
+ if (!state.appUuid) {
61
+ return null;
62
+ }
63
+
64
+ return state;
65
+ } catch {
66
+ return null;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Resolves a UUID argument — if not provided, tries to read from .coolify.json.
72
+ *
73
+ * @param uuid - UUID from CLI argument (may be undefined)
74
+ * @param field - Which field to read from .coolify.json (default: appUuid)
75
+ * @returns The resolved UUID or null if not found
76
+ */
77
+ export function resolveUuid(
78
+ uuid: string | undefined,
79
+ field: keyof ICoolifyDeployState = "appUuid",
80
+ ): string | null {
81
+ if (uuid) return uuid;
82
+
83
+ const state = loadCoolifyState();
84
+ if (!state) return null;
85
+
86
+ const value = state[field];
87
+ return typeof value === "string" ? value : null;
88
+ }