@tenux/cli 0.0.20 → 0.0.21

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 (2) hide show
  1. package/dist/cli.js +47 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -25,7 +25,7 @@ import { createClient } from "@supabase/supabase-js";
25
25
  // src/handlers/project.ts
26
26
  import { spawn, execSync } from "child_process";
27
27
  import { resolve, join } from "path";
28
- import { existsSync, mkdirSync, readdirSync, statSync } from "fs";
28
+ import { existsSync, mkdirSync, readdirSync, statSync, rmSync } from "fs";
29
29
  import chalk from "chalk";
30
30
  var LOCKFILE_PM = {
31
31
  "bun.lockb": "bun",
@@ -334,6 +334,51 @@ async function handleProjectGitStatus(command, supabase) {
334
334
  }).eq("id", command.id);
335
335
  }
336
336
  }
337
+ async function handleProjectDelete(command, supabase) {
338
+ const { name, path: projectPath, project_id } = command.payload;
339
+ const config = loadConfig();
340
+ const targetDir = resolve(config.projectsDir, projectPath);
341
+ const normalizedTarget = resolve(targetDir);
342
+ const normalizedProjects = resolve(config.projectsDir);
343
+ const sep = process.platform === "win32" ? "\\" : "/";
344
+ if (!normalizedTarget.startsWith(normalizedProjects + sep) && normalizedTarget !== normalizedProjects) {
345
+ const msg = `Refusing to delete \u2014 path escapes projects dir: ${projectPath}`;
346
+ console.log(chalk.red("\u2717"), msg);
347
+ await supabase.from("commands").update({
348
+ status: "error",
349
+ result: { error: msg },
350
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
351
+ }).eq("id", command.id);
352
+ return;
353
+ }
354
+ if (!existsSync(targetDir)) {
355
+ console.log(chalk.yellow("!"), `Project directory not found: ${projectPath} (already deleted?)`);
356
+ await supabase.from("commands").update({
357
+ status: "done",
358
+ result: { deleted: false, reason: "directory_not_found" },
359
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
360
+ }).eq("id", command.id);
361
+ return;
362
+ }
363
+ console.log(chalk.blue("\u2192"), `Deleting project directory: ${name} (${targetDir})`);
364
+ try {
365
+ rmSync(targetDir, { recursive: true, force: true });
366
+ console.log(chalk.green("\u2713"), `Deleted ${name}`);
367
+ await supabase.from("commands").update({
368
+ status: "done",
369
+ result: { deleted: true, path: projectPath },
370
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
371
+ }).eq("id", command.id);
372
+ } catch (err) {
373
+ const msg = err instanceof Error ? err.message : String(err);
374
+ console.log(chalk.red("\u2717"), `Delete failed: ${msg}`);
375
+ await supabase.from("commands").update({
376
+ status: "error",
377
+ result: { error: msg },
378
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
379
+ }).eq("id", command.id);
380
+ }
381
+ }
337
382
 
338
383
  // src/cli.ts
339
384
  var __dirname = dirname(fileURLToPath(import.meta.url));
@@ -579,7 +624,7 @@ program.command("start").description("Start the agent and listen for commands").
579
624
  await supabase.from("devices").update({ is_online: false }).eq("id", config.deviceId);
580
625
  process.exit(0);
581
626
  };
582
- relay.on("claude.query", handleClaudeQuery).on("project.clone", handleProjectClone).on("project.create", handleProjectCreate).on("project.tree", handleProjectTree).on("project.git_status", handleProjectGitStatus).on("agent.shutdown", async () => {
627
+ relay.on("claude.query", handleClaudeQuery).on("project.clone", handleProjectClone).on("project.create", handleProjectCreate).on("project.tree", handleProjectTree).on("project.git_status", handleProjectGitStatus).on("project.delete", handleProjectDelete).on("agent.shutdown", async () => {
583
628
  console.log(chalk2.yellow("\n \u26A1 Remote shutdown requested"));
584
629
  await shutdown();
585
630
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenux/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Tenux — mobile-first IDE for 10x engineering",
5
5
  "author": "Antelogic LLC",
6
6
  "license": "MIT",