@mks2508/coolify-mks-cli-mcp 0.1.0 → 0.2.1

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/index.js CHANGED
@@ -11204,7 +11204,8 @@ class CoolifyService {
11204
11204
  return { error: "Coolify not configured", status: 0, durationMs: Date.now() - startTime };
11205
11205
  }
11206
11206
  try {
11207
- const url = `${this.baseUrl}/api/v1${endpoint}`;
11207
+ const baseUrl = this.baseUrl.replace(/\/+$/, "");
11208
+ const url = `${baseUrl}/api/v1${endpoint}`;
11208
11209
  const response = await fetch(url, {
11209
11210
  ...options,
11210
11211
  headers: {
@@ -11243,47 +11244,81 @@ class CoolifyService {
11243
11244
  log.info(`Deploying application ${options.uuid || options.tag}`);
11244
11245
  onProgress?.(25, "Validating deployment configuration");
11245
11246
  onProgress?.(50, "Triggering build pipeline...");
11246
- const result = await this.request("/deploy", {
11247
- method: "POST",
11248
- body: JSON.stringify({
11249
- uuid: options.uuid,
11250
- tag: options.tag,
11251
- force: options.force ?? false
11252
- })
11247
+ const params = new URLSearchParams;
11248
+ if (options.uuid)
11249
+ params.set("uuid", options.uuid);
11250
+ if (options.tag)
11251
+ params.set("tag", options.tag);
11252
+ if (options.force)
11253
+ params.set("force", "true");
11254
+ const endpoint = `/deploy${params.toString() ? `?${params.toString()}` : ""}`;
11255
+ const result = await this.request(endpoint, {
11256
+ method: "POST"
11253
11257
  });
11254
11258
  if (result.error) {
11255
11259
  log.error(`Deployment failed: ${result.error}`);
11256
11260
  return err(new Error(result.error));
11257
11261
  }
11262
+ const deployments = result.data?.deployments || [];
11263
+ if (deployments.length === 0) {
11264
+ log.error("No deployments started");
11265
+ return err(new Error("No deployments started - check application configuration"));
11266
+ }
11267
+ const deployment = deployments[0];
11258
11268
  onProgress?.(90, "Build started on Coolify server");
11259
11269
  onProgress?.(100, "Deployment triggered");
11260
- log.success(`Deployment started: ${result.data?.deployment_uuid}`);
11270
+ log.success(`Deployment started: ${deployment.deployment_uuid}`);
11261
11271
  return ok({
11262
11272
  success: true,
11263
- deploymentUuid: result.data?.deployment_uuid,
11264
- resourceUuid: result.data?.resource_uuid
11273
+ deploymentUuid: deployment.deployment_uuid,
11274
+ resourceUuid: deployment.resource_uuid
11265
11275
  });
11266
11276
  }
11267
11277
  async createApplication(options, onProgress) {
11268
11278
  onProgress?.(5, `Preparing app "${options.name}"`);
11269
- log.info(`Creating application ${options.name}`);
11279
+ const appType = options.type || "public";
11280
+ log.info(`Creating application ${options.name} (type: ${appType})`);
11270
11281
  onProgress?.(25, `Validating server ${options.serverUuid.slice(0, 8)}...`);
11271
11282
  onProgress?.(50, "Sending creation request to Coolify API...");
11272
- const result = await this.request("/applications", {
11283
+ const endpointMap = {
11284
+ public: "/applications/public",
11285
+ "private-github-app": "/applications/private-github-app",
11286
+ "private-deploy-key": "/applications/private-deploy-key",
11287
+ dockerfile: "/applications/dockerfile",
11288
+ "docker-image": "/applications/docker-image",
11289
+ "docker-compose": "/applications/docker-compose"
11290
+ };
11291
+ const endpoint = endpointMap[appType] || "/applications/public";
11292
+ const body = {
11293
+ name: options.name,
11294
+ description: options.description,
11295
+ project_uuid: options.projectUuid,
11296
+ environment_uuid: options.environmentUuid,
11297
+ server_uuid: options.serverUuid
11298
+ };
11299
+ if (appType === "public" || appType === "private-github-app" || appType === "private-deploy-key") {
11300
+ if (options.githubRepoUrl) {
11301
+ body.git_repository = options.githubRepoUrl;
11302
+ }
11303
+ body.git_branch = options.branch || "main";
11304
+ body.build_pack = options.buildPack || "dockerfile";
11305
+ if (options.portsExposes) {
11306
+ body.ports_exposes = options.portsExposes;
11307
+ }
11308
+ if (options.dockerfileLocation) {
11309
+ body.dockerfile_location = options.dockerfileLocation;
11310
+ }
11311
+ if (options.baseDirectory) {
11312
+ body.base_directory = options.baseDirectory;
11313
+ }
11314
+ } else if (appType === "docker-image" && options.dockerImage) {
11315
+ body.docker_image = options.dockerImage;
11316
+ } else if (appType === "docker-compose" && options.dockerCompose) {
11317
+ body.docker_compose = options.dockerCompose;
11318
+ }
11319
+ const result = await this.request(endpoint, {
11273
11320
  method: "POST",
11274
- body: JSON.stringify({
11275
- name: options.name,
11276
- description: options.description,
11277
- server_uuid: options.serverUuid,
11278
- destination_uuid: options.destinationUuid,
11279
- project_uuid: options.serverUuid,
11280
- environment_name: "production",
11281
- git_repository: options.githubRepoUrl,
11282
- git_branch: options.branch || "main",
11283
- build_pack: options.buildPack || "nixpacks",
11284
- ports_exposes: "3000",
11285
- instant_deploy: false
11286
- })
11321
+ body: JSON.stringify(body)
11287
11322
  });
11288
11323
  if (result.error) {
11289
11324
  log.error(`Failed to create application: ${result.error}`);
@@ -11355,6 +11390,16 @@ class CoolifyService {
11355
11390
  }
11356
11391
  return ok(result.data || []);
11357
11392
  }
11393
+ async getProjectEnvironments(projectUuid) {
11394
+ log.info(`Getting environments for project ${projectUuid}`);
11395
+ const result = await this.request(`/projects/${projectUuid}`);
11396
+ if (result.error) {
11397
+ log.error(`Failed to get environments: ${result.error}`);
11398
+ return err(new Error(result.error));
11399
+ }
11400
+ log.success(`Environments retrieved for project ${projectUuid}`);
11401
+ return ok(result.data?.environments || []);
11402
+ }
11358
11403
  async listTeams() {
11359
11404
  const result = await this.request("/teams");
11360
11405
  if (result.error) {
@@ -11419,6 +11464,10 @@ class CoolifyService {
11419
11464
  body.build_command = options.buildCommand;
11420
11465
  if (options.startCommand)
11421
11466
  body.start_command = options.startCommand;
11467
+ if (options.dockerfileLocation)
11468
+ body.dockerfile_location = options.dockerfileLocation;
11469
+ if (options.baseDirectory)
11470
+ body.base_directory = options.baseDirectory;
11422
11471
  const result = await this.request(`/applications/${appUuid}`, {
11423
11472
  method: "PATCH",
11424
11473
  body: JSON.stringify(body)
@@ -11457,7 +11506,7 @@ class CoolifyService {
11457
11506
  return err(new Error(result.error));
11458
11507
  }
11459
11508
  log.success(`Deployment history retrieved for ${appUuid}`);
11460
- return ok(result.data || []);
11509
+ return ok(result.data?.deployments || []);
11461
11510
  }
11462
11511
  async startApplication(appUuid) {
11463
11512
  log.info(`Starting application ${appUuid}`);
@@ -11504,6 +11553,68 @@ function getCoolifyService() {
11504
11553
  return instance;
11505
11554
  }
11506
11555
 
11556
+ // src/cli/commands/create.ts
11557
+ async function createCommand2(options) {
11558
+ const spinner = ora("Initializing Coolify connection...").start();
11559
+ try {
11560
+ const coolify = getCoolifyService();
11561
+ const initResult = await coolify.init();
11562
+ if (isErr(initResult)) {
11563
+ spinner.fail(source_default.red(`Failed to initialize: ${initResult.error.message}`));
11564
+ return;
11565
+ }
11566
+ let environmentUuid = options.environment;
11567
+ if (!environmentUuid) {
11568
+ spinner.text = "Fetching project environments...";
11569
+ const envResult = await coolify.getProjectEnvironments(options.project);
11570
+ if (isOk(envResult) && envResult.value.length > 0) {
11571
+ environmentUuid = envResult.value[0].uuid;
11572
+ const envName = envResult.value[0].name;
11573
+ spinner.info(source_default.cyan(`Using environment: ${envName} (${environmentUuid.slice(0, 8)}...)`));
11574
+ } else {
11575
+ spinner.fail(source_default.red("No environments found for project. Please specify --environment <uuid>"));
11576
+ return;
11577
+ }
11578
+ }
11579
+ if (!environmentUuid) {
11580
+ spinner.fail(source_default.red("Environment UUID is required"));
11581
+ return;
11582
+ }
11583
+ spinner.text = "Creating application...";
11584
+ const result = await coolify.createApplication({
11585
+ name: options.name,
11586
+ description: options.description,
11587
+ projectUuid: options.project,
11588
+ environmentUuid,
11589
+ serverUuid: options.server,
11590
+ type: options.type || "public",
11591
+ githubRepoUrl: options.repo,
11592
+ branch: options.branch || "main",
11593
+ buildPack: options.buildPack || "dockerfile",
11594
+ portsExposes: options.ports || "3000",
11595
+ dockerImage: options.dockerImage,
11596
+ dockerCompose: options.dockerCompose,
11597
+ dockerfileLocation: options.dockerfileLocation,
11598
+ baseDirectory: options.baseDirectory
11599
+ }, (percent, message) => {
11600
+ spinner.text = `${source_default.bold(`[${percent}%]`)} ${message}`;
11601
+ });
11602
+ if (isOk(result)) {
11603
+ spinner.succeed(source_default.green(`Application created! UUID: ${source_default.cyan(result.value.uuid?.slice(0, 8))}`));
11604
+ console.log(` Full UUID: ${source_default.cyan(result.value.uuid)}`);
11605
+ console.log(` Name: ${source_default.cyan(options.name)}`);
11606
+ console.log(` Type: ${source_default.cyan(options.type || "public")}`);
11607
+ console.log(` Next steps:`);
11608
+ console.log(` 1. Set environment variables: ${source_default.yellow("coolify-mcp env " + result.value.uuid?.slice(0, 8))}`);
11609
+ console.log(` 2. Deploy application: ${source_default.yellow("coolify-mcp deploy " + result.value.uuid?.slice(0, 8))}`);
11610
+ } else {
11611
+ spinner.fail(source_default.red(`Creation failed: ${result.error.message}`));
11612
+ }
11613
+ } catch (error) {
11614
+ spinner.fail(source_default.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
11615
+ }
11616
+ }
11617
+
11507
11618
  // src/cli/commands/deploy.ts
11508
11619
  async function deployCommand(uuid, options) {
11509
11620
  const spinner = ora("Initializing Coolify connection...").start();
@@ -11590,11 +11701,12 @@ async function listCommand(options) {
11590
11701
  source_default.cyan("Name"),
11591
11702
  source_default.cyan("Status"),
11592
11703
  source_default.cyan("Server")
11593
- ]
11704
+ ],
11705
+ ...options.full ? { colWidths: [36, 30, 20, 10] } : {}
11594
11706
  });
11595
11707
  for (const app of apps) {
11596
11708
  table.push([
11597
- app.uuid,
11709
+ options.full ? app.uuid : app.uuid.slice(0, 8),
11598
11710
  app.name,
11599
11711
  formatStatus(app.status),
11600
11712
  app.destination?.server?.name || "N/A"
@@ -11634,7 +11746,7 @@ Follow mode not yet implemented`));
11634
11746
  }
11635
11747
 
11636
11748
  // src/cli/commands/servers.ts
11637
- async function serversCommand() {
11749
+ async function serversCommand(options = {}) {
11638
11750
  const coolify = getCoolifyService();
11639
11751
  const initResult = await coolify.init();
11640
11752
  if (isErr(initResult)) {
@@ -11651,11 +11763,11 @@ async function serversCommand() {
11651
11763
  console.log(source_default.yellow("No servers found"));
11652
11764
  return;
11653
11765
  }
11654
- const table = createTable(["UUID", "Name", "IP", "Status"], [36, 25, 20, 15]);
11766
+ const table = createTable(["UUID", "Name", "IP", "Status"], [options.full ? 36 : 8, 25, 20, 15]);
11655
11767
  for (const server of servers) {
11656
11768
  const statusColor = server.is_usable ? source_default.green : source_default.red;
11657
11769
  table.push([
11658
- server.uuid.slice(0, 8),
11770
+ options.full ? server.uuid : server.uuid.slice(0, 8),
11659
11771
  server.name,
11660
11772
  server.ip || "N/A",
11661
11773
  statusColor(server.is_usable ? "● Usable" : "○ Unusable")
@@ -11665,6 +11777,96 @@ async function serversCommand() {
11665
11777
  console.log(source_default.gray(`Total: ${servers.length} server(s)`));
11666
11778
  }
11667
11779
 
11780
+ // src/cli/commands/projects.ts
11781
+ var import_cli_table33 = __toESM(require_table(), 1);
11782
+ async function projectsCommand(options = {}) {
11783
+ const spinner = ora("Connecting to Coolify...").start();
11784
+ try {
11785
+ const coolify = getCoolifyService();
11786
+ const initResult = await coolify.init();
11787
+ if (isErr(initResult)) {
11788
+ spinner.fail(source_default.red(`Failed to initialize: ${initResult.error.message}`));
11789
+ return;
11790
+ }
11791
+ spinner.text = "Fetching projects...";
11792
+ const result = await coolify.listProjects();
11793
+ if (isOk(result)) {
11794
+ spinner.succeed(source_default.green("Projects retrieved"));
11795
+ const projects = result.value;
11796
+ if (projects.length === 0) {
11797
+ console.log(source_default.yellow("No projects found"));
11798
+ return;
11799
+ }
11800
+ const table = new import_cli_table33.default({
11801
+ head: [
11802
+ source_default.cyan("UUID"),
11803
+ source_default.cyan("Name"),
11804
+ source_default.cyan("Description")
11805
+ ],
11806
+ ...options.full ? { colWidths: [36, 30, 40] } : {}
11807
+ });
11808
+ for (const project of projects) {
11809
+ table.push([
11810
+ options.full ? project.uuid : project.uuid.slice(0, 8),
11811
+ project.name,
11812
+ project.description || "-"
11813
+ ]);
11814
+ }
11815
+ console.log(table.toString());
11816
+ console.log(source_default.gray(`Total: ${projects.length} project(s)`));
11817
+ } else {
11818
+ spinner.fail(source_default.red(`Failed to fetch projects: ${result.error.message}`));
11819
+ }
11820
+ } catch (error) {
11821
+ spinner.fail(source_default.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
11822
+ }
11823
+ }
11824
+
11825
+ // src/cli/commands/environments.ts
11826
+ var import_cli_table34 = __toESM(require_table(), 1);
11827
+ async function environmentsCommand(projectUuid, options = {}) {
11828
+ const spinner = ora("Connecting to Coolify...").start();
11829
+ try {
11830
+ const coolify = getCoolifyService();
11831
+ const initResult = await coolify.init();
11832
+ if (isErr(initResult)) {
11833
+ spinner.fail(source_default.red(`Failed to initialize: ${initResult.error.message}`));
11834
+ return;
11835
+ }
11836
+ spinner.text = `Fetching environments for project ${projectUuid.slice(0, 8)}...`;
11837
+ const result = await coolify.getProjectEnvironments(projectUuid);
11838
+ if (isOk(result)) {
11839
+ spinner.succeed(source_default.green("Environments retrieved"));
11840
+ const environments = result.value;
11841
+ if (environments.length === 0) {
11842
+ console.log(source_default.yellow("No environments found for this project"));
11843
+ return;
11844
+ }
11845
+ const table = new import_cli_table34.default({
11846
+ head: [
11847
+ source_default.cyan("UUID"),
11848
+ source_default.cyan("Name"),
11849
+ source_default.cyan("Description")
11850
+ ],
11851
+ ...options.full ? { colWidths: [36, 25, 40] } : {}
11852
+ });
11853
+ for (const env2 of environments) {
11854
+ table.push([
11855
+ options.full ? env2.uuid : env2.uuid.slice(0, 8),
11856
+ env2.name,
11857
+ env2.description || "-"
11858
+ ]);
11859
+ }
11860
+ console.log(table.toString());
11861
+ console.log(source_default.gray(`Total: ${environments.length} environment(s)`));
11862
+ } else {
11863
+ spinner.fail(source_default.red(`Failed to fetch environments: ${result.error.message}`));
11864
+ }
11865
+ } catch (error) {
11866
+ spinner.fail(source_default.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
11867
+ }
11868
+ }
11869
+
11668
11870
  // src/cli/commands/config.ts
11669
11871
  import { existsSync as existsSync2 } from "node:fs";
11670
11872
  async function configCommand(action, args) {
@@ -11767,18 +11969,253 @@ async function envCommand(uuid) {
11767
11969
  }
11768
11970
  }
11769
11971
 
11972
+ // src/cli/commands/update.ts
11973
+ async function updateCommand(options) {
11974
+ console.log(source_default.cyan(`Updating application ${source_default.bold(options.uuid)}...`));
11975
+ const service = getCoolifyService();
11976
+ const initResult = await service.init();
11977
+ if (isErr(initResult)) {
11978
+ console.error(source_default.red("Failed to initialize Coolify service"));
11979
+ console.error(source_default.gray(initResult.error.message));
11980
+ process.exit(1);
11981
+ }
11982
+ const updateOptions = {};
11983
+ if (options.name)
11984
+ updateOptions.name = options.name;
11985
+ if (options.description)
11986
+ updateOptions.description = options.description;
11987
+ if (options.buildPack)
11988
+ updateOptions.buildPack = options.buildPack;
11989
+ if (options.gitBranch)
11990
+ updateOptions.gitBranch = options.gitBranch;
11991
+ if (options.ports)
11992
+ updateOptions.portsExposes = options.ports;
11993
+ if (options.installCommand)
11994
+ updateOptions.installCommand = options.installCommand;
11995
+ if (options.buildCommand)
11996
+ updateOptions.buildCommand = options.buildCommand;
11997
+ if (options.startCommand)
11998
+ updateOptions.startCommand = options.startCommand;
11999
+ if (options.dockerfileLocation)
12000
+ updateOptions.dockerfileLocation = options.dockerfileLocation;
12001
+ if (options.baseDirectory)
12002
+ updateOptions.baseDirectory = options.baseDirectory;
12003
+ if (Object.keys(updateOptions).length === 0) {
12004
+ console.warn(source_default.yellow("No update options provided. Use --help to see available options."));
12005
+ process.exit(0);
12006
+ }
12007
+ const result = await service.updateApplication(options.uuid, updateOptions);
12008
+ if (isErr(result)) {
12009
+ console.error(source_default.red("Failed to update application"));
12010
+ console.error(source_default.gray(result.error.message));
12011
+ process.exit(1);
12012
+ }
12013
+ console.log(source_default.green("Application updated successfully"));
12014
+ console.log(source_default.gray(`UUID: ${result.value.uuid}`));
12015
+ console.log(source_default.gray(`Name: ${result.value.name}`));
12016
+ if (result.value.description) {
12017
+ console.log(source_default.gray(`Description: ${result.value.description}`));
12018
+ }
12019
+ }
12020
+
12021
+ // src/cli/commands/delete.ts
12022
+ async function deleteCommand(uuid, options = {}) {
12023
+ const service = getCoolifyService();
12024
+ const initResult = await service.init();
12025
+ if (isErr(initResult)) {
12026
+ console.error(source_default.red("Failed to initialize Coolify service"));
12027
+ console.error(source_default.gray(initResult.error.message));
12028
+ process.exit(1);
12029
+ }
12030
+ if (!options.force && !options.yes) {
12031
+ const readline = await import("readline");
12032
+ const rl = readline.createInterface({
12033
+ input: process.stdin,
12034
+ output: process.stdout
12035
+ });
12036
+ const answer = await new Promise((resolve) => {
12037
+ rl.question(source_default.yellow(`Are you sure you want to delete application ${source_default.bold(uuid)}? (yes/no): `), (ans) => {
12038
+ rl.close();
12039
+ resolve(ans.toLowerCase());
12040
+ });
12041
+ });
12042
+ if (answer !== "yes" && answer !== "y") {
12043
+ console.log(source_default.gray("Operation cancelled"));
12044
+ process.exit(0);
12045
+ }
12046
+ }
12047
+ console.log(source_default.cyan(`Deleting application ${source_default.bold(uuid)}...`));
12048
+ const result = await service.deleteApplication(uuid);
12049
+ if (isErr(result)) {
12050
+ console.error(source_default.red("Failed to delete application"));
12051
+ console.error(source_default.gray(result.error.message));
12052
+ process.exit(1);
12053
+ }
12054
+ console.log(source_default.green("Application deleted successfully"));
12055
+ if (result.value.message) {
12056
+ console.log(source_default.gray(result.value.message));
12057
+ }
12058
+ }
12059
+
12060
+ // src/cli/commands/destinations.ts
12061
+ var import_cli_table35 = __toESM(require_table(), 1);
12062
+ async function destinationsCommand(serverUuid) {
12063
+ const coolify = getCoolifyService();
12064
+ const initResult = await coolify.init();
12065
+ if (isErr(initResult)) {
12066
+ console.error(source_default.red(`Error: ${initResult.error.message}`));
12067
+ return;
12068
+ }
12069
+ const result = await coolify.getServerDestinations(serverUuid);
12070
+ if (isErr(result)) {
12071
+ console.error(source_default.red(`Error: ${result.error.message}`));
12072
+ return;
12073
+ }
12074
+ const destinations = result.value;
12075
+ if (destinations.length === 0) {
12076
+ console.log(source_default.yellow("No destinations found"));
12077
+ return;
12078
+ }
12079
+ const table = new import_cli_table35.default({
12080
+ head: [
12081
+ source_default.cyan("UUID"),
12082
+ source_default.cyan("Name"),
12083
+ source_default.cyan("Network")
12084
+ ]
12085
+ });
12086
+ for (const dest of destinations) {
12087
+ table.push([
12088
+ dest.uuid,
12089
+ dest.name,
12090
+ dest.network || "N/A"
12091
+ ]);
12092
+ }
12093
+ console.log(table.toString());
12094
+ console.log(source_default.gray(`Total: ${destinations.length} destination(s)`));
12095
+ }
12096
+
12097
+ // src/cli/commands/show.ts
12098
+ async function showCommand(uuid) {
12099
+ const coolify = getCoolifyService();
12100
+ const initResult = await coolify.init();
12101
+ if (isErr(initResult)) {
12102
+ console.error(source_default.red(`Error: ${initResult.error.message}`));
12103
+ return;
12104
+ }
12105
+ const result = await coolify.listApplications();
12106
+ if (isErr(result)) {
12107
+ console.error(source_default.red(`Error: ${result.error.message}`));
12108
+ return;
12109
+ }
12110
+ const apps = result.value;
12111
+ const app = apps.find((a) => a.uuid === uuid || a.uuid.startsWith(uuid));
12112
+ if (!app) {
12113
+ console.error(source_default.red(`Application not found: ${uuid}`));
12114
+ return;
12115
+ }
12116
+ console.log(source_default.cyan("Application Details:"));
12117
+ console.log("");
12118
+ console.log(source_default.gray("UUID: ") + source_default.white(app.uuid));
12119
+ console.log(source_default.gray("Name: ") + source_default.white(app.name));
12120
+ console.log(source_default.gray("Status: ") + source_default.white(app.status));
12121
+ console.log(source_default.gray("Description:") + source_default.white(app.description || "N/A"));
12122
+ console.log(source_default.gray("Repository: ") + source_default.white(app.git_repository || "N/A"));
12123
+ console.log(source_default.gray("Branch: ") + source_default.white(app.git_branch || "N/A"));
12124
+ console.log(source_default.gray("Build Pack: ") + source_default.white(app.build_pack || "N/A"));
12125
+ console.log(source_default.gray("Ports: ") + source_default.white(app.ports_exposes || "N/A"));
12126
+ console.log(source_default.gray("FQDN: ") + source_default.white(app.fqdn || "N/A"));
12127
+ console.log(source_default.gray("Dockerfile: ") + source_default.white(app.dockerfile_location || "N/A"));
12128
+ console.log(source_default.gray("Base Dir: ") + source_default.white(app.base_directory || "N/A"));
12129
+ console.log("");
12130
+ console.log(source_default.cyan("Destination:"));
12131
+ if (app.destination) {
12132
+ console.log(source_default.gray(" UUID: ") + source_default.white(app.destination.uuid));
12133
+ console.log(source_default.gray(" Name: ") + source_default.white(app.destination.name));
12134
+ if (app.destination.server) {
12135
+ console.log(source_default.gray(" Server:") + source_default.white(` ${app.destination.server.name} (${app.destination.server.ip})`));
12136
+ }
12137
+ } else {
12138
+ console.log(source_default.yellow(" No destination configured"));
12139
+ }
12140
+ console.log("");
12141
+ console.log(source_default.cyan("Commands:"));
12142
+ if (app.install_command)
12143
+ console.log(source_default.gray(" Install: ") + source_default.white(app.install_command));
12144
+ if (app.build_command)
12145
+ console.log(source_default.gray(" Build: ") + source_default.white(app.build_command));
12146
+ if (app.start_command)
12147
+ console.log(source_default.gray(" Start: ") + source_default.white(app.start_command));
12148
+ }
12149
+
12150
+ // src/cli/commands/deployments.ts
12151
+ var import_cli_table36 = __toESM(require_table(), 1);
12152
+ async function deploymentsCommand(uuid, options = {}) {
12153
+ const coolify = getCoolifyService();
12154
+ const initResult = await coolify.init();
12155
+ if (isErr(initResult)) {
12156
+ console.error(source_default.red(`Error: ${initResult.error.message}`));
12157
+ return;
12158
+ }
12159
+ const result = await coolify.getApplicationDeploymentHistory(uuid);
12160
+ if (isErr(result)) {
12161
+ console.error(source_default.red(`Error: ${result.error.message}`));
12162
+ return;
12163
+ }
12164
+ let deployments = result.value;
12165
+ deployments = deployments.reverse();
12166
+ if (options.limit) {
12167
+ deployments = deployments.slice(0, options.limit);
12168
+ }
12169
+ if (deployments.length === 0) {
12170
+ console.log(source_default.yellow("No deployments found"));
12171
+ return;
12172
+ }
12173
+ const table = new import_cli_table36.default({
12174
+ head: [
12175
+ source_default.cyan("ID"),
12176
+ source_default.cyan("UUID"),
12177
+ source_default.cyan("Status"),
12178
+ source_default.cyan("Commit"),
12179
+ source_default.cyan("Created")
12180
+ ],
12181
+ ...options.full ? { colWidths: [8, 36, 20, 10, 20] } : {}
12182
+ });
12183
+ for (const dep of deployments) {
12184
+ table.push([
12185
+ String(dep.id),
12186
+ options.full ? dep.uuid : dep.uuid.slice(0, 8),
12187
+ formatStatus(dep.status),
12188
+ dep.commit?.slice(0, 7) || "-",
12189
+ new Date(dep.created_at).toLocaleString()
12190
+ ]);
12191
+ }
12192
+ console.log(table.toString());
12193
+ console.log(source_default.gray(`Total: ${deployments.length} deployment(s)`));
12194
+ }
12195
+
11770
12196
  // src/cli/index.ts
11771
12197
  var program2 = new Command;
11772
12198
  program2.name("coolify-mcp").description("CLI for Coolify deployment management").version("0.1.0");
12199
+ program2.command("create").description("Create a new application").option("--name <name>", "Application name").option("--description <desc>", "Application description").option("--server <uuid>", "Server UUID").option("--project <uuid>", "Project UUID").option("--environment <uuid>", "Environment UUID (auto-fetched if not provided)").option("--repo <url>", "Git repository URL").option("--branch <branch>", "Git branch", "main").option("--type <type>", "Application type (public, private-github-app, private-deploy-key, dockerfile, docker-image, docker-compose)", "public").option("--build-pack <pack>", "Build pack (dockerfile, nixpacks, static)", "dockerfile").option("--ports <ports>", "Ports to expose (default: 3000)", "3000").option("--docker-image <image>", "Docker image (for docker-image type)").option("--docker-compose <content>", "Docker Compose content (for docker-compose type)").option("--dockerfile-location <path>", 'Dockerfile location (e.g., "apps/haidodocs/Dockerfile")').option("--base-directory <dir>", 'Base directory for build context (default: "/")', "/").action(createCommand2);
11773
12200
  program2.command("config").description("Manage configuration").argument("[action]", "Action to perform (set, get, path)").option("--key <key>", 'Configuration key (for "set" action)').option("--value <value>", 'Configuration value (for "set" action)').action(configCommand);
11774
- program2.command("list").description("List all applications").option("-t, --team <id>", "Filter by team ID").option("-p, --project <id>", "Filter by project ID").action(listCommand);
12201
+ program2.command("list").description("List all applications").option("-t, --team <id>", "Filter by team ID").option("-p, --project <id>", "Filter by project ID").option("--full", "Show full UUIDs instead of truncated").action(listCommand);
11775
12202
  program2.command("deploy <uuid>").description("Deploy an application").option("-f, --force", "Force rebuild without cache").option("-t, --tag <tag>", "Deploy specific tag/version").action(deployCommand);
11776
12203
  program2.command("logs <uuid>").description("Get application logs").option("-n, --lines <number>", "Number of lines to retrieve", "50").option("-f, --follow", "Follow logs in real-time").action((uuid, options) => {
11777
12204
  const lines = parseInt(options.lines, 10);
11778
12205
  logsCommand(uuid, { lines, follow: options.follow });
11779
12206
  });
11780
- program2.command("servers").description("List available servers").action(serversCommand);
12207
+ program2.command("servers").description("List available servers").option("--full", "Show full UUIDs instead of truncated").action((options) => serversCommand(options));
12208
+ program2.command("projects").description("List available projects").option("--full", "Show full UUIDs instead of truncated").action((options) => projectsCommand(options));
12209
+ program2.command("environments <projectUuid>").description("List environments for a project").option("--full", "Show full UUIDs instead of truncated").action((projectUuid, options) => environmentsCommand(projectUuid, options));
11781
12210
  program2.command("env <uuid>").description("Get environment variables for an application").action(envCommand);
12211
+ program2.command("update <uuid>").description("Update an application configuration").option("--name <name>", "Application name").option("--description <desc>", "Application description").option("--build-pack <pack>", "Build pack (dockerfile, nixpacks, static)").option("--git-branch <branch>", "Git branch").option("--ports <ports>", "Ports to expose (e.g., 3000)").option("--install-command <cmd>", "Install command (nixpacks)").option("--build-command <cmd>", "Build command").option("--start-command <cmd>", "Start command").option("--dockerfile-location <path>", 'Dockerfile location (e.g., "apps/haidodocs/Dockerfile")').option("--base-directory <dir>", 'Base directory for build context (e.g., "/")').action((uuid, options) => updateCommand({ uuid, ...options }));
12212
+ program2.command("delete <uuid>").description("Delete an application").option("-f, --force", "Skip confirmation prompt").option("-y, --yes", "Skip confirmation prompt (alias for --force)").action((uuid, options) => deleteCommand(uuid, options));
12213
+ program2.command("destinations <serverUuid>").description("List available destinations for a server").action(destinationsCommand);
12214
+ program2.command("show <uuid>").description("Show detailed information about an application").action(showCommand);
12215
+ program2.command("deployments <uuid>").description("Show deployment history for an application").option("--full", "Show full UUIDs").option("-n, --limit <number>", "Limit number of deployments shown", "10").action((uuid, options) => {
12216
+ const limit = parseInt(options.limit, 10);
12217
+ deploymentsCommand(uuid, { full: options.full, limit });
12218
+ });
11782
12219
  program2.action(() => {
11783
12220
  console.log(source_default.cyan("Coolify MCP CLI"));
11784
12221
  console.log(source_default.gray(`Manage Coolify deployments from the command line
@@ -6,7 +6,7 @@
6
6
  * @module
7
7
  */
8
8
  import { type Result } from '@mks2508/no-throw';
9
- import { type ICoolifyAppOptions, type ICoolifyAppResult, type ICoolifyApplication, type ICoolifyDeleteResult, type ICoolifyDeployment, type ICoolifyDeployOptions, type ICoolifyDeployResult, type ICoolifyDestination, type ICoolifyLogs, type ICoolifyLogsOptions, type ICoolifyProject, type ICoolifyServer, type ICoolifyTeam, type ICoolifyUpdateOptions, type IProgressCallback } from './types.js';
9
+ import { type ICoolifyAppOptions, type ICoolifyAppResult, type ICoolifyApplication, type ICoolifyDeleteResult, type ICoolifyDeployment, type ICoolifyDeployOptions, type ICoolifyDeployResult, type ICoolifyDestination, type ICoolifyEnvironment, type ICoolifyLogs, type ICoolifyLogsOptions, type ICoolifyProject, type ICoolifyServer, type ICoolifyTeam, type ICoolifyUpdateOptions, type IProgressCallback } from './types.js';
10
10
  /**
11
11
  * Environment variable from Coolify API.
12
12
  */
@@ -72,6 +72,14 @@ export declare class CoolifyService {
72
72
  /**
73
73
  * Creates a new application in Coolify.
74
74
  *
75
+ * Uses type-specific endpoints for different application types:
76
+ * - /applications/public - Public Git repository
77
+ * - /applications/private-github-app - Private repo with GitHub App
78
+ * - /applications/private-deploy-key - Private repo with deploy key
79
+ * - /applications/dockerfile - Dockerfile-based application
80
+ * - /applications/docker-image - Docker image
81
+ * - /applications/docker-compose - Docker Compose application
82
+ *
75
83
  * @param options - Application options
76
84
  * @param onProgress - Optional progress callback (0-100, message, step)
77
85
  * @returns Result with application UUID or error
@@ -118,6 +126,13 @@ export declare class CoolifyService {
118
126
  * @returns Result with projects list or error
119
127
  */
120
128
  listProjects(): Promise<Result<ICoolifyProject[], Error>>;
129
+ /**
130
+ * Gets environments for a project.
131
+ *
132
+ * @param projectUuid - Project UUID
133
+ * @returns Result with environments list or error
134
+ */
135
+ getProjectEnvironments(projectUuid: string): Promise<Result<ICoolifyEnvironment[], Error>>;
121
136
  /**
122
137
  * Lists all teams.
123
138
  *
@@ -197,5 +212,5 @@ export declare class CoolifyService {
197
212
  * @returns The CoolifyService instance
198
213
  */
199
214
  export declare function getCoolifyService(): CoolifyService;
200
- export type { ICoolifyServer, ICoolifyDestination, ICoolifyProject, ICoolifyTeam, ICoolifyApplication, ICoolifyDeployment, ICoolifyAppOptions, ICoolifyDeployOptions, ICoolifyUpdateOptions, ICoolifyLogsOptions, };
215
+ export type { ICoolifyServer, ICoolifyDestination, ICoolifyProject, ICoolifyTeam, ICoolifyApplication, ICoolifyDeployment, ICoolifyAppOptions, ICoolifyAppResult, ICoolifyDeployOptions, ICoolifyDeployResult, ICoolifyDeleteResult, ICoolifyUpdateOptions, ICoolifyLogsOptions, ICoolifyLogs, IProgressCallback, } from './types.js';
201
216
  //# sourceMappingURL=index.d.ts.map