yats-toolkit 0.1.14 → 0.1.20
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 +100 -0
- package/package.json +1 -1
- package/src/setup.js +3 -1
- package/src/update-base.js +55 -0
- package/src/update.js +12 -0
package/bin/setup.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* YATS Toolkit — Code intelligence for AI agents.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* yats setup # One-time setup wizard
|
|
7
|
+
* yats index <path> # Index a repository
|
|
8
|
+
* yats search <query> # Search indexed code
|
|
9
|
+
* yats list # List indexed repositories
|
|
10
|
+
* yats summary <repo> # Show repository summary
|
|
11
|
+
* yats clear <repo> # Delete indexed data
|
|
12
|
+
* yats status # Check indexed repos
|
|
13
|
+
* yats stop # Stop all YATS services
|
|
14
|
+
* yats start # Start YATS services
|
|
15
|
+
* yats update # Update CLI to latest version
|
|
16
|
+
* yats update-base # Update Docker images
|
|
17
|
+
* yats bridge # MCP stdio ↔ HTTP proxy (for Copilot, Claude)
|
|
18
|
+
* yats benchmark # AI agent token comparison
|
|
19
|
+
* yats watch <path> # Watch a repo and keep the index live
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const cmd = process.argv[2] || "setup";
|
|
23
|
+
const args = process.argv.slice(3);
|
|
24
|
+
|
|
25
|
+
switch (cmd) {
|
|
26
|
+
case "setup":
|
|
27
|
+
import("../src/setup.js").then(m => m.default());
|
|
28
|
+
break;
|
|
29
|
+
case "index":
|
|
30
|
+
case "add": {
|
|
31
|
+
const skipDocs = args.includes("--skip-docs");
|
|
32
|
+
const cleanArgs = args.filter(a => a !== "--skip-docs");
|
|
33
|
+
import("../src/indexer.js").then(m => m.default(cleanArgs, { skipDocs }));
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "search":
|
|
37
|
+
import("../src/search.js").then(m => m.default(args));
|
|
38
|
+
break;
|
|
39
|
+
case "list":
|
|
40
|
+
import("../src/list.js").then(m => m.default());
|
|
41
|
+
break;
|
|
42
|
+
case "summary":
|
|
43
|
+
import("../src/summary.js").then(m => m.default(args));
|
|
44
|
+
break;
|
|
45
|
+
case "clear":
|
|
46
|
+
import("../src/clear.js").then(m => m.default(args));
|
|
47
|
+
break;
|
|
48
|
+
case "status":
|
|
49
|
+
import("../src/status.js").then(m => m.default());
|
|
50
|
+
break;
|
|
51
|
+
case "stop":
|
|
52
|
+
import("../src/stop.js").then(m => m.default());
|
|
53
|
+
break;
|
|
54
|
+
case "start":
|
|
55
|
+
import("../src/start.js").then(m => m.default());
|
|
56
|
+
break;
|
|
57
|
+
case "update":
|
|
58
|
+
import("../src/update.js").then(m => m.default());
|
|
59
|
+
break;
|
|
60
|
+
case "update-base":
|
|
61
|
+
import("../src/update-base.js").then(m => m.default());
|
|
62
|
+
break;
|
|
63
|
+
case "bridge":
|
|
64
|
+
import("../src/bridge.js");
|
|
65
|
+
break;
|
|
66
|
+
case "benchmark":
|
|
67
|
+
import("../src/benchmark.js").then(m => m.runBenchmark());
|
|
68
|
+
break;
|
|
69
|
+
case "watch":
|
|
70
|
+
import("../src/watch.js");
|
|
71
|
+
break;
|
|
72
|
+
case "--version":
|
|
73
|
+
case "-v":
|
|
74
|
+
try {
|
|
75
|
+
const { readFileSync } = await import("node:fs");
|
|
76
|
+
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
77
|
+
console.log(`yats v${pkg.version}`);
|
|
78
|
+
} catch {
|
|
79
|
+
console.log("yats v0.1.10");
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
console.log(`YATS Toolkit — Code intelligence for AI agents`);
|
|
84
|
+
console.log(``);
|
|
85
|
+
console.log(` yats setup Setup wizard`);
|
|
86
|
+
console.log(` yats index <path> Index a repository`);
|
|
87
|
+
console.log(` yats search <query> Search indexed code`);
|
|
88
|
+
console.log(` yats list List indexed repositories`);
|
|
89
|
+
console.log(` yats summary <repo> Show repository summary`);
|
|
90
|
+
console.log(` yats clear <repo> Delete indexed data`);
|
|
91
|
+
console.log(` yats status Check indexed repos`);
|
|
92
|
+
console.log(` yats stop Stop YATS services`);
|
|
93
|
+
console.log(` yats start Start YATS services`);
|
|
94
|
+
console.log(` yats update Update CLI to latest version`);
|
|
95
|
+
console.log(` yats update-base Update Docker images`);
|
|
96
|
+
console.log(` yats bridge Stdio proxy for Copilot/Claude`);
|
|
97
|
+
console.log(` yats benchmark AI agent token comparison`);
|
|
98
|
+
console.log(` yats watch <path> Keep index in sync with live edits`);
|
|
99
|
+
break;
|
|
100
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yats-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
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/setup.js
CHANGED
|
@@ -670,7 +670,9 @@ async function main() {
|
|
|
670
670
|
console.log(` yats add ~/work/project Add a repo to index`);
|
|
671
671
|
console.log(` yats status Check what's indexed`);
|
|
672
672
|
console.log(` yats stop Stop all services`);
|
|
673
|
-
console.log(` yats
|
|
673
|
+
console.log(` yats start Start all services`);
|
|
674
|
+
console.log(` yats update Update CLI to latest`);
|
|
675
|
+
console.log(` yats update-base Update Docker images`);
|
|
674
676
|
console.log("");
|
|
675
677
|
console.log(` Docs: ${C}https://yats.site${R}`);
|
|
676
678
|
console.log("");
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** yats update-base — Update YATS Docker images to the latest version */
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { createInterface } from "node:readline";
|
|
6
|
+
|
|
7
|
+
export default async function updateBase() {
|
|
8
|
+
const composeFile = join(homedir(), ".yats", "docker-compose.yml");
|
|
9
|
+
const B = "\x1b[1m";
|
|
10
|
+
const Y = "\x1b[33m";
|
|
11
|
+
const G = "\x1b[32m";
|
|
12
|
+
const R = "\x1b[0m";
|
|
13
|
+
|
|
14
|
+
console.log("");
|
|
15
|
+
console.log(` ${Y}${B}⚠️ This will:${R}`);
|
|
16
|
+
console.log(` • Stop all YATS containers (Neo4j, Qdrant, YATS server)`);
|
|
17
|
+
console.log(` • Pull the latest Docker images`);
|
|
18
|
+
console.log(` • Recreate containers with the new images`);
|
|
19
|
+
console.log("");
|
|
20
|
+
console.log(` ${G}✓${R} Your indexed data is preserved in Docker volumes.`);
|
|
21
|
+
console.log(` ${Y}⏳${R} Downtime: ~30-60 seconds.`);
|
|
22
|
+
console.log("");
|
|
23
|
+
|
|
24
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
25
|
+
const answer = await new Promise((resolve) => {
|
|
26
|
+
rl.question(` ${B}Proceed? [y/N]${R} `, resolve);
|
|
27
|
+
});
|
|
28
|
+
rl.close();
|
|
29
|
+
|
|
30
|
+
if (answer.toLowerCase() !== "y") {
|
|
31
|
+
console.log("");
|
|
32
|
+
console.log(" Cancelled.");
|
|
33
|
+
console.log("");
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log("");
|
|
38
|
+
console.log(" Pulling latest images...");
|
|
39
|
+
await run("docker", ["compose", "-f", composeFile, "pull"]);
|
|
40
|
+
|
|
41
|
+
console.log(" Recreating containers...");
|
|
42
|
+
await run("docker", ["compose", "-f", composeFile, "up", "-d", "--force-recreate"]);
|
|
43
|
+
|
|
44
|
+
console.log("");
|
|
45
|
+
console.log(` ${G}✓${R} YATS base updated.`);
|
|
46
|
+
console.log("");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function run(cmd, args) {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
const proc = spawn(cmd, args, { stdio: "inherit" });
|
|
52
|
+
proc.on("close", (code) => code === 0 ? resolve() : reject(new Error(`exit ${code}`)));
|
|
53
|
+
proc.on("error", reject);
|
|
54
|
+
});
|
|
55
|
+
}
|
package/src/update.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** yats update — Update YATS CLI to the latest version */
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
export default async function update() {
|
|
5
|
+
console.log("Updating yats-toolkit to latest version...");
|
|
6
|
+
await new Promise((resolve, reject) => {
|
|
7
|
+
const proc = spawn("npm", ["install", "-g", "yats-toolkit@latest"], { stdio: "inherit" });
|
|
8
|
+
proc.on("close", (code) => code === 0 ? resolve() : reject(new Error(`exit ${code}`)));
|
|
9
|
+
proc.on("error", reject);
|
|
10
|
+
});
|
|
11
|
+
console.log("YATS CLI updated.");
|
|
12
|
+
}
|