yats-toolkit 0.1.3 → 0.1.5
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 +5 -2
- package/package.json +1 -1
- package/src/indexer.js +6 -1
- package/src/setup.js +10 -3
package/bin/setup.js
CHANGED
|
@@ -18,9 +18,12 @@ switch (cmd) {
|
|
|
18
18
|
import("../src/setup.js").then(m => m.default());
|
|
19
19
|
break;
|
|
20
20
|
case "index":
|
|
21
|
-
case "add":
|
|
22
|
-
|
|
21
|
+
case "add": {
|
|
22
|
+
const skipDocs = args.includes("--skip-docs");
|
|
23
|
+
const cleanArgs = args.filter(a => a !== "--skip-docs");
|
|
24
|
+
import("../src/indexer.js").then(m => m.default(cleanArgs, { skipDocs }));
|
|
23
25
|
break;
|
|
26
|
+
}
|
|
24
27
|
case "status":
|
|
25
28
|
import("../src/status.js").then(m => m.default());
|
|
26
29
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yats-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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": "MIT",
|
package/src/indexer.js
CHANGED
|
@@ -27,7 +27,8 @@ async function walk(dir) {
|
|
|
27
27
|
return files;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export default async function indexRepo(args) {
|
|
30
|
+
export default async function indexRepo(args, options = {}) {
|
|
31
|
+
const skipDocs = options.skipDocs || false;
|
|
31
32
|
const repoPath = args[0];
|
|
32
33
|
if (!repoPath) {
|
|
33
34
|
console.error("Usage: npx yats index <path>");
|
|
@@ -61,6 +62,10 @@ export default async function indexRepo(args) {
|
|
|
61
62
|
|
|
62
63
|
for (const file of files) {
|
|
63
64
|
const relPath = relative(repoPath, file);
|
|
65
|
+
|
|
66
|
+
// Skip docs if requested
|
|
67
|
+
if (skipDocs && relPath.endsWith(".md")) continue;
|
|
68
|
+
|
|
64
69
|
try {
|
|
65
70
|
const content = readFileSync(file, "utf-8");
|
|
66
71
|
// Skip binary/large files
|
package/src/setup.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { spawn } from "node:child_process";
|
|
12
|
-
import { writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
12
|
+
import { writeFileSync, mkdirSync, existsSync, readFileSync } from "node:fs";
|
|
13
13
|
import { homedir } from "node:os";
|
|
14
14
|
import { join } from "node:path";
|
|
15
15
|
import { createInterface } from "node:readline";
|
|
@@ -18,7 +18,13 @@ import { createInterface } from "node:readline";
|
|
|
18
18
|
// Constants
|
|
19
19
|
// ============================================================
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// Read version from package.json dynamically
|
|
22
|
+
let YATS_VERSION = "0.1.0";
|
|
23
|
+
try {
|
|
24
|
+
const pkgPath = new URL("../package.json", import.meta.url);
|
|
25
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
26
|
+
YATS_VERSION = pkg.version || YATS_VERSION;
|
|
27
|
+
} catch {}
|
|
22
28
|
const YATS_DIR = join(homedir(), ".yats");
|
|
23
29
|
const REPOS_DIR = join(YATS_DIR, "repos");
|
|
24
30
|
const COMPOSE_FILE = join(YATS_DIR, "docker-compose.yml");
|
|
@@ -161,7 +167,7 @@ function box(lines, width = W) {
|
|
|
161
167
|
if (line === "") {
|
|
162
168
|
console.log(` ║ ${" ".repeat(width)} ║`);
|
|
163
169
|
} else {
|
|
164
|
-
console.log(` ║ ${
|
|
170
|
+
console.log(` ║ ${center(line)} ║`);
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
console.log(bottom);
|
|
@@ -430,6 +436,7 @@ async function main() {
|
|
|
430
436
|
console.log("");
|
|
431
437
|
console.log(` ${Y}⚠${R} This is a paid service — you may be charged for API usage.`);
|
|
432
438
|
console.log("");
|
|
439
|
+
console.log("");
|
|
433
440
|
}
|
|
434
441
|
|
|
435
442
|
// Step 3: Embedding batch size
|