@tenux/cli 0.0.19 → 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.
- package/dist/{chunk-BMALGL6Q.js → chunk-PNQQWSNW.js} +6 -5
- package/dist/cli.js +48 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -241,15 +241,16 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
241
241
|
if (!existsSync2(config.projectsDir)) {
|
|
242
242
|
mkdirSync2(config.projectsDir, { recursive: true });
|
|
243
243
|
}
|
|
244
|
-
let
|
|
244
|
+
let focusPrefix = "";
|
|
245
245
|
if (project_path) {
|
|
246
246
|
const projectDir = resolve(config.projectsDir, project_path);
|
|
247
|
-
const relPath = `./projects/${project_path}`;
|
|
248
247
|
if (existsSync2(projectDir)) {
|
|
249
|
-
|
|
248
|
+
focusPrefix = `>> focused: ./projects/${project_path}
|
|
249
|
+
`;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const baseSystemPrompt = `You are working inside a Tenux workspace at ${cwd}. All projects live under ./projects/. User messages may start with ">> focused: ./projects/<name>" \u2014 this indicates which project the user is currently viewing. Treat it as context for which project changes likely apply to, unless the user explicitly says otherwise. Never echo the ">>" line back to the user.`;
|
|
253
|
+
const fullSystemPrompt = [baseSystemPrompt, system_prompt].filter(Boolean).join("\n\n");
|
|
253
254
|
const args = [
|
|
254
255
|
"--print",
|
|
255
256
|
// non-interactive
|
|
@@ -272,7 +273,7 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
272
273
|
shell: isWindows,
|
|
273
274
|
stdio: ["pipe", "pipe", "pipe"]
|
|
274
275
|
});
|
|
275
|
-
proc.stdin.write(prompt);
|
|
276
|
+
proc.stdin.write(focusPrefix + prompt);
|
|
276
277
|
proc.stdin.end();
|
|
277
278
|
let seq = 0;
|
|
278
279
|
let capturedSessionId = null;
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
loadConfig,
|
|
10
10
|
saveConfig,
|
|
11
11
|
updateConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PNQQWSNW.js";
|
|
13
13
|
|
|
14
14
|
// src/cli.ts
|
|
15
15
|
import { Command } from "commander";
|
|
@@ -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/dist/index.js
CHANGED