yats-toolkit 0.1.20 → 0.1.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/bin/setup.js +7 -2
- package/package.json +1 -1
- package/src/remove.js +61 -0
- package/src/setup.js +2 -0
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.
|
|
3
|
+
"version": "0.1.21",
|
|
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
|
@@ -669,6 +669,8 @@ async function main() {
|
|
|
669
669
|
console.log(` ${B}Commands:${R}`);
|
|
670
670
|
console.log(` yats add ~/work/project Add a repo to index`);
|
|
671
671
|
console.log(` yats status Check what's indexed`);
|
|
672
|
+
console.log(` yats clear <repo> Delete index by name`);
|
|
673
|
+
console.log(` yats remove <path> Delete index by path`);
|
|
672
674
|
console.log(` yats stop Stop all services`);
|
|
673
675
|
console.log(` yats start Start all services`);
|
|
674
676
|
console.log(` yats update Update CLI to latest`);
|