@neta-art/cohub-cli 1.7.0 → 1.7.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.
@@ -125,6 +125,21 @@ async function uploadFiles(command, paths, opts) {
125
125
  handleHttp(e);
126
126
  }
127
127
  }
128
+ async function confirmRestart(opts) {
129
+ if (opts.yes)
130
+ return;
131
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
132
+ return error("Confirmation required", "Pass --yes to restart the sandbox automatically.");
133
+ process.stdout.write("Changing mods restarts the sandbox and may interrupt running work. Continue? [y/N] ");
134
+ const chunks = [];
135
+ for await (const chunk of process.stdin) {
136
+ chunks.push(chunk);
137
+ break;
138
+ }
139
+ const answer = Buffer.concat(chunks).toString().trim().toLowerCase();
140
+ if (answer !== "y" && answer !== "yes")
141
+ return error("Cancelled");
142
+ }
128
143
  async function readPromptContent(words) {
129
144
  let content = words.join(" ");
130
145
  if (!content && !process.stdin.isTTY) {
@@ -403,7 +418,7 @@ function registerMods(spacesCmd) {
403
418
  table(result.items, [
404
419
  { key: "id", label: "ID" },
405
420
  { key: "modSpaceName", label: "Name" },
406
- { key: "modSpaceId", label: "Space" },
421
+ { key: "mountPath", label: "Mount" },
407
422
  { key: "enabled", label: "On" },
408
423
  ]);
409
424
  }
@@ -414,15 +429,19 @@ function registerMods(spacesCmd) {
414
429
  modsCmd
415
430
  .command("add <modSpaceId>")
416
431
  .description("Add a mod")
432
+ .option("--name <name>", "Display name")
433
+ .option("--slug <slug>", "Mount slug")
434
+ .option("-y, --yes", "Confirm sandbox restart")
417
435
  .option("--json", "Output as JSON")
418
436
  .action(async (modSpaceId, opts) => {
437
+ await confirmRestart(opts);
419
438
  const spaceId = requireSpace(spacesCmd);
420
439
  const client = createClient();
421
440
  try {
422
- const result = await client.space(spaceId).mods.create({ modSpaceId });
441
+ const result = await client.space(spaceId).mods.create({ modSpaceId, name: opts.name, mountSlug: opts.slug });
423
442
  if (opts.json)
424
443
  return outJson(result);
425
- ok("Mod added");
444
+ ok(`Mod added — ${result.item.mountPath}; sandbox restarting`);
426
445
  }
427
446
  catch (e) {
428
447
  handleHttp(e);
@@ -431,15 +450,17 @@ function registerMods(spacesCmd) {
431
450
  modsCmd
432
451
  .command("enable <modId>")
433
452
  .description("Enable a mod")
453
+ .option("-y, --yes", "Confirm sandbox restart")
434
454
  .option("--json", "Output as JSON")
435
455
  .action(async (modId, opts) => {
456
+ await confirmRestart(opts);
436
457
  const spaceId = requireSpace(spacesCmd);
437
458
  const client = createClient();
438
459
  try {
439
460
  const result = await client.space(spaceId).mods.update(modId, { enabled: true });
440
461
  if (opts.json)
441
462
  return outJson(result);
442
- ok("Mod enabled");
463
+ ok("Mod enabled; sandbox restarting");
443
464
  }
444
465
  catch (e) {
445
466
  handleHttp(e);
@@ -448,15 +469,17 @@ function registerMods(spacesCmd) {
448
469
  modsCmd
449
470
  .command("disable <modId>")
450
471
  .description("Disable a mod")
472
+ .option("-y, --yes", "Confirm sandbox restart")
451
473
  .option("--json", "Output as JSON")
452
474
  .action(async (modId, opts) => {
475
+ await confirmRestart(opts);
453
476
  const spaceId = requireSpace(spacesCmd);
454
477
  const client = createClient();
455
478
  try {
456
479
  const result = await client.space(spaceId).mods.update(modId, { enabled: false });
457
480
  if (opts.json)
458
481
  return outJson(result);
459
- ok("Mod disabled");
482
+ ok("Mod disabled; sandbox restarting");
460
483
  }
461
484
  catch (e) {
462
485
  handleHttp(e);
@@ -466,15 +489,17 @@ function registerMods(spacesCmd) {
466
489
  .command("rm <modId>")
467
490
  .alias("remove")
468
491
  .description("Remove a mod")
492
+ .option("-y, --yes", "Confirm sandbox restart")
469
493
  .option("--json", "Output as JSON")
470
494
  .action(async (modId, opts) => {
495
+ await confirmRestart(opts);
471
496
  const spaceId = requireSpace(spacesCmd);
472
497
  const client = createClient();
473
498
  try {
474
499
  const result = await client.space(spaceId).mods.remove(modId);
475
500
  if (opts.json)
476
501
  return outJson(result);
477
- ok("Mod removed");
502
+ ok("Mod removed; sandbox restarting");
478
503
  }
479
504
  catch (e) {
480
505
  handleHttp(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "commander": "^13.1.0",
17
17
  "sharp": "^0.34.5",
18
- "@neta-art/cohub": "1.15.0"
18
+ "@neta-art/cohub": "1.15.1"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"