yats-toolkit 0.1.20 → 0.1.22

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/bin/setup.js CHANGED
@@ -8,7 +8,8 @@
8
8
  * yats search <query> # Search indexed code
9
9
  * yats list # List indexed repositories
10
10
  * yats summary <repo> # Show repository summary
11
- * yats clear <repo> # Delete indexed data
11
+ * yats clear <repo> # Delete indexed data by name
12
+ * yats remove <path> # Delete indexed data by path
12
13
  * yats status # Check indexed repos
13
14
  * yats stop # Stop all YATS services
14
15
  * yats start # Start YATS services
@@ -45,6 +46,9 @@ switch (cmd) {
45
46
  case "clear":
46
47
  import("../src/clear.js").then(m => m.default(args));
47
48
  break;
49
+ case "remove":
50
+ import("../src/remove.js").then(m => m.default(args));
51
+ break;
48
52
  case "status":
49
53
  import("../src/status.js").then(m => m.default());
50
54
  break;
@@ -87,7 +91,8 @@ switch (cmd) {
87
91
  console.log(` yats search <query> Search indexed code`);
88
92
  console.log(` yats list List indexed repositories`);
89
93
  console.log(` yats summary <repo> Show repository summary`);
90
- console.log(` yats clear <repo> Delete indexed data`);
94
+ console.log(` yats clear <repo> Delete indexed data by name`);
95
+ console.log(` yats remove <path> Delete indexed data by path`);
91
96
  console.log(` yats status Check indexed repos`);
92
97
  console.log(` yats stop Stop YATS services`);
93
98
  console.log(` yats start Start YATS services`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yats-toolkit",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "YATS — Yet Another Token Saver. One-command MCP server that indexes your codebase into a knowledge graph so AI agents (Claude, Cursor, Copilot) can search and navigate it without burning tokens.",
5
5
  "author": "Franco Vinciarelli <vinciarellifranco@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/src/remove.js ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * yats remove <path> — Delete a repository from the index by its path.
3
+ * Wraps the MCP delete_repository tool, accepting a directory path
4
+ * instead of requiring the exact repo name.
5
+ */
6
+ import { resolve } from "node:path";
7
+
8
+ const YATS_URL = process.env.YATS_URL || "http://localhost:5555";
9
+
10
+ async function mcpCall(tool, args = {}) {
11
+ const res = await fetch(`${YATS_URL}/mcp`, {
12
+ method: "POST",
13
+ headers: { "Content-Type": "application/json" },
14
+ body: JSON.stringify({
15
+ jsonrpc: "2.0",
16
+ id: 1,
17
+ method: "tools/call",
18
+ params: { name: tool, arguments: args },
19
+ }),
20
+ });
21
+ const data = await res.json();
22
+ return data?.result?.content?.[0]?.text;
23
+ }
24
+
25
+ export default async function remove(args) {
26
+ const rawPath = args[0];
27
+ if (!rawPath) {
28
+ console.error("Usage: yats remove <path>");
29
+ process.exit(1);
30
+ }
31
+
32
+ const repoPath = resolve(rawPath);
33
+
34
+ try {
35
+ // Step 1: ask for confirmation (using path, server resolves to repo)
36
+ console.log(`Looking up "${repoPath}"...`);
37
+ const warning = await mcpCall("delete_repository", { path: repoPath });
38
+ console.log(warning);
39
+ console.log("");
40
+
41
+ // Step 2: confirm
42
+ const readline = await import("node:readline");
43
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
44
+ const answer = await new Promise((resolve) => rl.question(" Confirm deletion? [y/N] ", resolve));
45
+ rl.close();
46
+
47
+ if (answer.toLowerCase() !== "y") {
48
+ console.log("Cancelled.");
49
+ process.exit(0);
50
+ }
51
+
52
+ // Step 3: execute
53
+ console.log("Deleting...");
54
+ const result = await mcpCall("delete_repository", { path: repoPath, confirm: true });
55
+ console.log(result);
56
+ console.log("");
57
+ } catch (err) {
58
+ console.error(`Cannot reach YATS at ${YATS_URL}. Is it running?`);
59
+ process.exit(1);
60
+ }
61
+ }
package/src/setup.js CHANGED
@@ -408,6 +408,29 @@ async function main() {
408
408
  process.exit(0);
409
409
  }
410
410
 
411
+ // Check for existing stopped install (compose file exists but containers not running)
412
+ if (existsSync(COMPOSE_FILE)) {
413
+ console.log(` ${Y}⚠${R} Found existing YATS installation (containers not running).`);
414
+ console.log("");
415
+ const rlStopped = createInterface({ input: process.stdin, output: process.stdout });
416
+ const cleanAnswer = await ask(rlStopped, ` ${B}Start fresh (deletes all indexed data)? [y/N]${R} `);
417
+ rlStopped.close();
418
+ if (cleanAnswer.toLowerCase() === "y") {
419
+ console.log("");
420
+ const sClean = spinner("Cleaning up previous installation...");
421
+ try {
422
+ await runCmd("docker", ["compose", "-f", COMPOSE_FILE, "down", "-v"]);
423
+ sClean.done(true);
424
+ } catch {
425
+ sClean.done(false);
426
+ }
427
+ } else {
428
+ console.log("");
429
+ console.log(` ${G}✓${R} Keeping existing data. Proceeding with reconfiguration.`);
430
+ }
431
+ console.log("");
432
+ }
433
+
411
434
  // Step 1: Embedding provider
412
435
  step("Step 1 — Embedding provider");
413
436
 
@@ -669,6 +692,8 @@ async function main() {
669
692
  console.log(` ${B}Commands:${R}`);
670
693
  console.log(` yats add ~/work/project Add a repo to index`);
671
694
  console.log(` yats status Check what's indexed`);
695
+ console.log(` yats clear <repo> Delete index by name`);
696
+ console.log(` yats remove <path> Delete index by path`);
672
697
  console.log(` yats stop Stop all services`);
673
698
  console.log(` yats start Start all services`);
674
699
  console.log(` yats update Update CLI to latest`);