@daileyos/cli 0.2.0 → 0.4.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.
@@ -26,6 +26,55 @@ export function registerScaleCommands(program: Command): void {
26
26
  }),
27
27
  );
28
28
 
29
+ program
30
+ .command('stop <idOrName>')
31
+ .description('Stop an app (scale to 0 replicas)')
32
+ .action(
33
+ withErrorHandler(async (idOrName: unknown) => {
34
+ const project = await resolveProject(String(idOrName));
35
+ const spinner = ora(`Stopping "${project.name}"...`).start();
36
+ await api(`/projects/${project.id}/scale`, {
37
+ method: 'POST',
38
+ body: { replicas: 0 },
39
+ });
40
+ spinner.succeed(chalk.green(`Stopped "${project.name}" — scaled to 0 replicas.`));
41
+ console.log(chalk.gray(` Start again: ${chalk.white(`dailey start ${String(idOrName)}`)}`));
42
+ }),
43
+ );
44
+
45
+ program
46
+ .command('start <idOrName>')
47
+ .description('Start an app (scale to 1 replica)')
48
+ .option('-r, --replicas <n>', 'Number of replicas to start with', '1')
49
+ .action(
50
+ withErrorHandler(async (idOrName: unknown, opts: { replicas: string }) => {
51
+ const project = await resolveProject(String(idOrName));
52
+ const count = parseInt(opts.replicas, 10) || 1;
53
+ const spinner = ora(`Starting "${project.name}" with ${count} replica${count > 1 ? 's' : ''}...`).start();
54
+ await api(`/projects/${project.id}/scale`, {
55
+ method: 'POST',
56
+ body: { replicas: count },
57
+ });
58
+ spinner.succeed(chalk.green(`Started "${project.name}" with ${count} replica${count > 1 ? 's' : ''}.`));
59
+ console.log(chalk.gray(` View: ${chalk.white(`https://${project.slug}.dailey.cloud`)}`));
60
+ }),
61
+ );
62
+
63
+ program
64
+ .command('restart <idOrName>')
65
+ .description('Restart an app (rolling restart, no downtime)')
66
+ .action(
67
+ withErrorHandler(async (idOrName: unknown) => {
68
+ const project = await resolveProject(String(idOrName));
69
+ const spinner = ora(`Restarting "${project.name}"...`).start();
70
+ // Scale to 0 then back to current replicas
71
+ const replicas = Number(project.replicas) || 1;
72
+ await api(`/projects/${project.id}/scale`, { method: 'POST', body: { replicas: 0 } });
73
+ await api(`/projects/${project.id}/scale`, { method: 'POST', body: { replicas } });
74
+ spinner.succeed(chalk.green(`Restarted "${project.name}" with ${replicas} replica${replicas > 1 ? 's' : ''}.`));
75
+ }),
76
+ );
77
+
29
78
  program
30
79
  .command('status <idOrName>')
31
80
  .description('Show app status (pods, replicas, health)')
package/src/index.ts CHANGED
@@ -14,6 +14,9 @@ import { registerOpenCommand } from './commands/open.js';
14
14
  import { registerPlatformCommands } from './commands/platform.js';
15
15
  import { registerStorageCommands } from './commands/storage.js';
16
16
  import { registerJobCommands } from './commands/jobs.js';
17
+ import { registerImageCommands } from './commands/images.js';
18
+ import { registerLinkCommands } from './commands/links.js';
19
+ import { registerResourceCommands } from './commands/resources.js';
17
20
 
18
21
  const program = new Command();
19
22
 
@@ -35,5 +38,8 @@ registerOpenCommand(program);
35
38
  registerPlatformCommands(program);
36
39
  registerStorageCommands(program);
37
40
  registerJobCommands(program);
41
+ registerImageCommands(program);
42
+ registerLinkCommands(program);
43
+ registerResourceCommands(program);
38
44
 
39
45
  program.parse();