dockup-cli 1.0.2 → 1.1.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.
@@ -1,103 +1,135 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.envList = envList;
7
- exports.envSet = envSet;
8
- exports.envRemove = envRemove;
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const ora_1 = __importDefault(require("ora"));
11
- const config_1 = require("../lib/config");
12
- const api_1 = require("../lib/api");
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var env_exports = {};
30
+ __export(env_exports, {
31
+ envList: () => envList,
32
+ envRemove: () => envRemove,
33
+ envSet: () => envSet
34
+ });
35
+ module.exports = __toCommonJS(env_exports);
36
+ var import_chalk = __toESM(require("chalk"));
37
+ var import_ora = __toESM(require("ora"));
38
+ var import_config = require("../lib/config");
39
+ var import_api = require("../lib/api");
13
40
  async function envList() {
14
- if (!(0, config_1.isLoggedIn)()) {
15
- console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
16
- process.exit(1);
17
- }
18
- const config = (0, config_1.getProjectConfig)();
19
- if (!config) {
20
- console.log(chalk_1.default.red('Not linked to any service. Run `dockup link` first.'));
21
- process.exit(1);
41
+ if (!(0, import_config.isLoggedIn)()) {
42
+ console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
43
+ process.exit(1);
44
+ }
45
+ const config = (0, import_config.getProjectConfig)();
46
+ if (!config) {
47
+ console.log(import_chalk.default.red("Not linked to any service. Run `dockup link` first."));
48
+ process.exit(1);
49
+ }
50
+ const spinner = (0, import_ora.default)("Loading environment variables...").start();
51
+ try {
52
+ const envVars = await import_api.api.getEnvVariables(config.projectSlug, config.serviceSlug);
53
+ spinner.stop();
54
+ console.log(import_chalk.default.cyan(`
55
+ Environment variables for ${import_chalk.default.bold(config.serviceName)}
56
+ `));
57
+ if (envVars.length === 0) {
58
+ console.log(import_chalk.default.yellow(" No environment variables set"));
59
+ console.log(import_chalk.default.dim("\n Add one with: dockup env set KEY=value\n"));
60
+ return;
22
61
  }
23
- const spinner = (0, ora_1.default)('Loading environment variables...').start();
24
- try {
25
- const envVars = await api_1.api.getEnvVariables(config.projectSlug, config.serviceSlug);
26
- spinner.stop();
27
- console.log(chalk_1.default.cyan(`\n Environment variables for ${chalk_1.default.bold(config.serviceName)}\n`));
28
- if (envVars.length === 0) {
29
- console.log(chalk_1.default.yellow(' No environment variables set'));
30
- console.log(chalk_1.default.dim('\n Add one with: dockup env set KEY=value\n'));
31
- return;
32
- }
33
- // Find max key length for alignment
34
- const maxKeyLen = Math.max(...envVars.map(e => e.key.length));
35
- for (const env of envVars) {
36
- const key = env.key.padEnd(maxKeyLen);
37
- const value = env.isSecret ? chalk_1.default.dim('••••••••') : env.value;
38
- const badge = env.isSecret ? chalk_1.default.yellow(' [secret]') : '';
39
- console.log(` ${chalk_1.default.green(key)} ${value}${badge}`);
40
- }
41
- console.log(chalk_1.default.dim(`\n Total: ${envVars.length} variable(s)\n`));
42
- }
43
- catch (error) {
44
- spinner.fail(`Failed to load environment variables: ${error.message}`);
45
- process.exit(1);
62
+ const maxKeyLen = Math.max(...envVars.map((e) => e.key.length));
63
+ for (const env of envVars) {
64
+ const key = env.key.padEnd(maxKeyLen);
65
+ const value = env.isSecret ? import_chalk.default.dim("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") : env.value;
66
+ const badge = env.isSecret ? import_chalk.default.yellow(" [secret]") : "";
67
+ console.log(` ${import_chalk.default.green(key)} ${value}${badge}`);
46
68
  }
69
+ console.log(import_chalk.default.dim(`
70
+ Total: ${envVars.length} variable(s)
71
+ `));
72
+ } catch (error) {
73
+ spinner.fail(`Failed to load environment variables: ${error.message}`);
74
+ process.exit(1);
75
+ }
47
76
  }
48
77
  async function envSet(keyValue, options) {
49
- if (!(0, config_1.isLoggedIn)()) {
50
- console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
51
- process.exit(1);
52
- }
53
- const config = (0, config_1.getProjectConfig)();
54
- if (!config) {
55
- console.log(chalk_1.default.red('Not linked to any service. Run `dockup link` first.'));
56
- process.exit(1);
57
- }
58
- // Parse KEY=value
59
- const eqIndex = keyValue.indexOf('=');
60
- if (eqIndex === -1) {
61
- console.log(chalk_1.default.red('Invalid format. Use: dockup env set KEY=value'));
62
- process.exit(1);
63
- }
64
- const key = keyValue.substring(0, eqIndex);
65
- const value = keyValue.substring(eqIndex + 1);
66
- if (!key) {
67
- console.log(chalk_1.default.red('Key cannot be empty'));
68
- process.exit(1);
69
- }
70
- const spinner = (0, ora_1.default)(`Setting ${key}...`).start();
71
- try {
72
- await api_1.api.setEnvVariable(config.projectSlug, config.serviceSlug, key, value, options.secret || false);
73
- spinner.succeed(`Set ${chalk_1.default.green(key)}${options.secret ? chalk_1.default.yellow(' [secret]') : ''}`);
74
- console.log(chalk_1.default.dim('\n Note: Redeploy for changes to take effect'));
75
- console.log(chalk_1.default.dim(' Run: dockup push\n'));
76
- }
77
- catch (error) {
78
- spinner.fail(`Failed to set variable: ${error.message}`);
79
- process.exit(1);
80
- }
78
+ if (!(0, import_config.isLoggedIn)()) {
79
+ console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
80
+ process.exit(1);
81
+ }
82
+ const config = (0, import_config.getProjectConfig)();
83
+ if (!config) {
84
+ console.log(import_chalk.default.red("Not linked to any service. Run `dockup link` first."));
85
+ process.exit(1);
86
+ }
87
+ const eqIndex = keyValue.indexOf("=");
88
+ if (eqIndex === -1) {
89
+ console.log(import_chalk.default.red("Invalid format. Use: dockup env set KEY=value"));
90
+ process.exit(1);
91
+ }
92
+ const key = keyValue.substring(0, eqIndex);
93
+ const value = keyValue.substring(eqIndex + 1);
94
+ if (!key) {
95
+ console.log(import_chalk.default.red("Key cannot be empty"));
96
+ process.exit(1);
97
+ }
98
+ const spinner = (0, import_ora.default)(`Setting ${key}...`).start();
99
+ try {
100
+ await import_api.api.setEnvVariable(config.projectSlug, config.serviceSlug, key, value, options.secret || false);
101
+ spinner.succeed(`Set ${import_chalk.default.green(key)}${options.secret ? import_chalk.default.yellow(" [secret]") : ""}`);
102
+ console.log(import_chalk.default.dim("\n Note: Redeploy for changes to take effect"));
103
+ console.log(import_chalk.default.dim(" Run: dockup push\n"));
104
+ } catch (error) {
105
+ spinner.fail(`Failed to set variable: ${error.message}`);
106
+ process.exit(1);
107
+ }
81
108
  }
82
109
  async function envRemove(key) {
83
- if (!(0, config_1.isLoggedIn)()) {
84
- console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
85
- process.exit(1);
86
- }
87
- const config = (0, config_1.getProjectConfig)();
88
- if (!config) {
89
- console.log(chalk_1.default.red('Not linked to any service. Run `dockup link` first.'));
90
- process.exit(1);
91
- }
92
- const spinner = (0, ora_1.default)(`Removing ${key}...`).start();
93
- try {
94
- await api_1.api.deleteEnvVariable(config.projectSlug, config.serviceSlug, key);
95
- spinner.succeed(`Removed ${chalk_1.default.red(key)}`);
96
- console.log(chalk_1.default.dim('\n Note: Redeploy for changes to take effect'));
97
- console.log(chalk_1.default.dim(' Run: dockup push\n'));
98
- }
99
- catch (error) {
100
- spinner.fail(`Failed to remove variable: ${error.message}`);
101
- process.exit(1);
102
- }
110
+ if (!(0, import_config.isLoggedIn)()) {
111
+ console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
112
+ process.exit(1);
113
+ }
114
+ const config = (0, import_config.getProjectConfig)();
115
+ if (!config) {
116
+ console.log(import_chalk.default.red("Not linked to any service. Run `dockup link` first."));
117
+ process.exit(1);
118
+ }
119
+ const spinner = (0, import_ora.default)(`Removing ${key}...`).start();
120
+ try {
121
+ await import_api.api.deleteEnvVariable(config.projectSlug, config.serviceSlug, key);
122
+ spinner.succeed(`Removed ${import_chalk.default.red(key)}`);
123
+ console.log(import_chalk.default.dim("\n Note: Redeploy for changes to take effect"));
124
+ console.log(import_chalk.default.dim(" Run: dockup push\n"));
125
+ } catch (error) {
126
+ spinner.fail(`Failed to remove variable: ${error.message}`);
127
+ process.exit(1);
128
+ }
103
129
  }
130
+ // Annotate the CommonJS export names for ESM import in node:
131
+ 0 && (module.exports = {
132
+ envList,
133
+ envRemove,
134
+ envSet
135
+ });
@@ -1,199 +1,158 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
37
11
  };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.link = link;
40
- exports.unlink = unlink;
41
- const chalk_1 = __importDefault(require("chalk"));
42
- const ora_1 = __importDefault(require("ora"));
43
- const readline = __importStar(require("readline"));
44
- const config_1 = require("../lib/config");
45
- const api_1 = require("../lib/api");
46
- function createReadline() {
47
- return readline.createInterface({
48
- input: process.stdin,
49
- output: process.stdout
50
- });
51
- }
52
- function askQuestion(rl, question) {
53
- return new Promise((resolve) => {
54
- rl.question(question, (answer) => {
55
- resolve(answer.trim());
56
- });
57
- });
58
- }
59
- function askConfirm(rl, question, defaultValue = false) {
60
- return new Promise((resolve) => {
61
- const hint = defaultValue ? '[Y/n]' : '[y/N]';
62
- rl.question(`${question} ${hint}: `, (answer) => {
63
- if (!answer.trim()) {
64
- resolve(defaultValue);
65
- }
66
- else {
67
- resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
68
- }
69
- });
70
- });
71
- }
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var link_exports = {};
30
+ __export(link_exports, {
31
+ link: () => link,
32
+ unlink: () => unlink
33
+ });
34
+ module.exports = __toCommonJS(link_exports);
35
+ var import_chalk = __toESM(require("chalk"));
36
+ var import_inquirer = __toESM(require("inquirer"));
37
+ var import_ora = __toESM(require("ora"));
38
+ var import_config = require("../lib/config");
39
+ var import_api = require("../lib/api");
72
40
  async function link(target) {
73
- if (!(0, config_1.isLoggedIn)()) {
74
- console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
75
- process.exit(1);
41
+ if (!(0, import_config.isLoggedIn)()) {
42
+ console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
43
+ process.exit(1);
44
+ }
45
+ const existing = (0, import_config.getProjectConfig)();
46
+ if (existing) {
47
+ console.log(import_chalk.default.yellow(`Already linked to ${existing.projectName}/${existing.serviceName}`));
48
+ const { confirm } = await import_inquirer.default.prompt([{
49
+ type: "confirm",
50
+ name: "confirm",
51
+ message: "Do you want to relink to a different service?",
52
+ default: false
53
+ }]);
54
+ if (!confirm) {
55
+ return;
76
56
  }
77
- const existing = (0, config_1.getProjectConfig)();
78
- if (existing) {
79
- console.log(chalk_1.default.yellow(`Already linked to ${existing.projectName}/${existing.serviceName}`));
80
- const rl = createReadline();
81
- const confirm = await askConfirm(rl, 'Do you want to relink to a different service?', false);
82
- rl.close();
83
- if (!confirm) {
84
- return;
85
- }
57
+ }
58
+ let projectSlug;
59
+ let serviceSlug;
60
+ let projectName;
61
+ let serviceName;
62
+ if (target) {
63
+ const parts = target.split("/");
64
+ if (parts.length !== 2) {
65
+ console.log(import_chalk.default.red("Invalid format. Use: dockup link <project>/<service>"));
66
+ process.exit(1);
86
67
  }
87
- let projectSlug;
88
- let serviceSlug;
89
- let projectName;
90
- let serviceName;
91
- if (target) {
92
- // Parse target: project/service
93
- const parts = target.split('/');
94
- if (parts.length !== 2) {
95
- console.log(chalk_1.default.red('Invalid format. Use: dockup link <project>/<service>'));
96
- process.exit(1);
97
- }
98
- [projectSlug, serviceSlug] = parts;
99
- // Verify the service exists
100
- const spinner = (0, ora_1.default)('Verifying service...').start();
101
- try {
102
- const service = await api_1.api.getServiceStatus(projectSlug, serviceSlug);
103
- projectName = service.project?.name || projectSlug;
104
- serviceName = service.name || serviceSlug;
105
- spinner.succeed(`Found service: ${serviceName}`);
106
- }
107
- catch (error) {
108
- spinner.fail(`Service not found: ${error.message}`);
109
- process.exit(1);
110
- }
68
+ [projectSlug, serviceSlug] = parts;
69
+ const spinner = (0, import_ora.default)("Verifying service...").start();
70
+ try {
71
+ const service = await import_api.api.getServiceStatus(projectSlug, serviceSlug);
72
+ projectName = service.project?.name || projectSlug;
73
+ serviceName = service.name || serviceSlug;
74
+ spinner.succeed(`Found service: ${serviceName}`);
75
+ } catch (error) {
76
+ spinner.fail(`Service not found: ${error.message}`);
77
+ process.exit(1);
111
78
  }
112
- else {
113
- // Interactive selection
114
- const spinner = (0, ora_1.default)('Loading projects...').start();
115
- try {
116
- const projects = await api_1.api.getProjects();
117
- spinner.stop();
118
- if (projects.length === 0) {
119
- console.log(chalk_1.default.yellow('No projects found. Create a project first at https://app.dockup.ai'));
120
- process.exit(1);
121
- }
122
- // Display projects
123
- console.log(chalk_1.default.bold('\nAvailable Projects:\n'));
124
- projects.forEach((p, index) => {
125
- console.log(` ${chalk_1.default.cyan(index + 1)}. ${p.name} ${chalk_1.default.dim(`(${p.slug})`)}`);
126
- });
127
- console.log();
128
- const rl = createReadline();
129
- const projectChoice = await askQuestion(rl, 'Select a project (number): ');
130
- const projectIndex = parseInt(projectChoice) - 1;
131
- if (isNaN(projectIndex) || projectIndex < 0 || projectIndex >= projects.length) {
132
- rl.close();
133
- console.log(chalk_1.default.red('Invalid selection'));
134
- process.exit(1);
135
- }
136
- const selectedProject = projects[projectIndex];
137
- projectSlug = selectedProject.slug;
138
- projectName = selectedProject.name;
139
- // Get services for the project
140
- spinner.start('Loading services...');
141
- const services = await api_1.api.getServices(projectSlug);
142
- spinner.stop();
143
- if (services.length === 0) {
144
- rl.close();
145
- console.log(chalk_1.default.yellow('No services found in this project.'));
146
- process.exit(1);
147
- }
148
- // Display services
149
- console.log(chalk_1.default.bold('\nAvailable Services:\n'));
150
- services.forEach((s, index) => {
151
- const statusIcon = s.status === 'running' ? chalk_1.default.green('●') : chalk_1.default.red('●');
152
- console.log(` ${chalk_1.default.cyan(index + 1)}. ${s.name} ${chalk_1.default.dim(`(${s.slug})`)} ${statusIcon}`);
153
- });
154
- console.log();
155
- const serviceChoice = await askQuestion(rl, 'Select a service (number): ');
156
- rl.close();
157
- const serviceIndex = parseInt(serviceChoice) - 1;
158
- if (isNaN(serviceIndex) || serviceIndex < 0 || serviceIndex >= services.length) {
159
- console.log(chalk_1.default.red('Invalid selection'));
160
- process.exit(1);
161
- }
162
- const selectedService = services[serviceIndex];
163
- serviceSlug = selectedService.slug;
164
- serviceName = selectedService.name;
165
- }
166
- catch (error) {
167
- spinner.fail(`Failed to load projects: ${error.message}`);
168
- process.exit(1);
169
- }
79
+ } else {
80
+ const spinner = (0, import_ora.default)("Loading projects...").start();
81
+ try {
82
+ const projects = await import_api.api.getProjects();
83
+ spinner.stop();
84
+ if (projects.length === 0) {
85
+ console.log(import_chalk.default.yellow("No projects found. Create a project first at https://app.dockup.ai"));
86
+ process.exit(1);
87
+ }
88
+ const { selectedProject } = await import_inquirer.default.prompt([{
89
+ type: "list",
90
+ name: "selectedProject",
91
+ message: "Select a project:",
92
+ choices: projects.map((p) => ({
93
+ name: `${p.name} ${import_chalk.default.dim(`(${p.slug})`)}`,
94
+ value: p
95
+ }))
96
+ }]);
97
+ projectSlug = selectedProject.slug;
98
+ projectName = selectedProject.name;
99
+ spinner.start("Loading services...");
100
+ const services = await import_api.api.getServices(projectSlug);
101
+ spinner.stop();
102
+ if (services.length === 0) {
103
+ console.log(import_chalk.default.yellow("No services found in this project."));
104
+ process.exit(1);
105
+ }
106
+ const { selectedService } = await import_inquirer.default.prompt([{
107
+ type: "list",
108
+ name: "selectedService",
109
+ message: "Select a service:",
110
+ choices: services.map((s) => ({
111
+ name: `${s.name} ${import_chalk.default.dim(`(${s.slug})`)} ${s.status === "running" ? import_chalk.default.green("\u25CF") : import_chalk.default.red("\u25CF")}`,
112
+ value: s
113
+ }))
114
+ }]);
115
+ serviceSlug = selectedService.slug;
116
+ serviceName = selectedService.name;
117
+ } catch (error) {
118
+ spinner.fail(`Failed to load projects: ${error.message}`);
119
+ process.exit(1);
170
120
  }
171
- // Save config
172
- (0, config_1.saveProjectConfig)({
173
- projectSlug,
174
- serviceSlug,
175
- projectName,
176
- serviceName
177
- });
178
- console.log(chalk_1.default.green(`\n✓ Linked to ${chalk_1.default.bold(projectName)}/${chalk_1.default.bold(serviceName)}`));
179
- console.log(chalk_1.default.dim('\nYou can now run:'));
180
- console.log(chalk_1.default.cyan(' dockup push ') + chalk_1.default.dim('- Deploy your code'));
181
- console.log(chalk_1.default.cyan(' dockup logs ') + chalk_1.default.dim('- View live logs'));
182
- console.log(chalk_1.default.cyan(' dockup status ') + chalk_1.default.dim('- Check service status'));
183
- console.log();
121
+ }
122
+ (0, import_config.saveProjectConfig)({
123
+ projectSlug,
124
+ serviceSlug,
125
+ projectName,
126
+ serviceName
127
+ });
128
+ console.log(import_chalk.default.green(`
129
+ \u2713 Linked to ${import_chalk.default.bold(projectName)}/${import_chalk.default.bold(serviceName)}`));
130
+ console.log(import_chalk.default.dim("\nYou can now run:"));
131
+ console.log(import_chalk.default.cyan(" dockup push ") + import_chalk.default.dim("- Deploy your code"));
132
+ console.log(import_chalk.default.cyan(" dockup logs ") + import_chalk.default.dim("- View live logs"));
133
+ console.log(import_chalk.default.cyan(" dockup status ") + import_chalk.default.dim("- Check service status"));
134
+ console.log();
184
135
  }
185
136
  async function unlink() {
186
- const config = (0, config_1.getProjectConfig)();
187
- if (!config) {
188
- console.log(chalk_1.default.yellow('Not linked to any service'));
189
- return;
190
- }
191
- const rl = createReadline();
192
- const confirm = await askConfirm(rl, `Unlink from ${config.projectName}/${config.serviceName}?`, false);
193
- rl.close();
194
- if (!confirm) {
195
- return;
196
- }
197
- (0, config_1.removeProjectConfig)();
198
- console.log(chalk_1.default.green('✓ Unlinked successfully'));
137
+ const config = (0, import_config.getProjectConfig)();
138
+ if (!config) {
139
+ console.log(import_chalk.default.yellow("Not linked to any service"));
140
+ return;
141
+ }
142
+ const { confirm } = await import_inquirer.default.prompt([{
143
+ type: "confirm",
144
+ name: "confirm",
145
+ message: `Unlink from ${config.projectName}/${config.serviceName}?`,
146
+ default: false
147
+ }]);
148
+ if (!confirm) {
149
+ return;
150
+ }
151
+ (0, import_config.removeProjectConfig)();
152
+ console.log(import_chalk.default.green("\u2713 Unlinked successfully"));
199
153
  }
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ link,
157
+ unlink
158
+ });