yats-toolkit 0.1.22 → 0.2.1
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 +21 -1
- package/package.json +1 -1
- package/src/connect.js +306 -0
- package/src/setup.js +279 -135
package/bin/setup.js
CHANGED
|
@@ -18,14 +18,30 @@
|
|
|
18
18
|
* yats bridge # MCP stdio ↔ HTTP proxy (for Copilot, Claude)
|
|
19
19
|
* yats benchmark # AI agent token comparison
|
|
20
20
|
* yats watch <path> # Watch a repo and keep the index live
|
|
21
|
+
* yats connect [agent] # Show or install agent config
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
const cmd = process.argv[2] || "setup";
|
|
24
25
|
const args = process.argv.slice(3);
|
|
25
26
|
|
|
27
|
+
function parseFlags(arr) {
|
|
28
|
+
const flags = {};
|
|
29
|
+
for (let i = 0; i < arr.length; i++) {
|
|
30
|
+
const a = arr[i];
|
|
31
|
+
if (a === "--provider" && arr[i + 1]) flags.provider = arr[++i];
|
|
32
|
+
else if (a === "--api-key" && arr[i + 1]) flags.apiKey = arr[++i];
|
|
33
|
+
else if (a === "--port" && arr[i + 1]) flags.port = arr[++i];
|
|
34
|
+
else if (a === "--batch" && arr[i + 1]) flags.batch = arr[++i];
|
|
35
|
+
else if (a === "--no-docs") flags.noDocs = true;
|
|
36
|
+
else if (a === "--yes") flags.skipConfirm = true;
|
|
37
|
+
}
|
|
38
|
+
flags.nonInteractive = !!(flags.provider && flags.apiKey);
|
|
39
|
+
return flags;
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
switch (cmd) {
|
|
27
43
|
case "setup":
|
|
28
|
-
import("../src/setup.js").then(m => m.default());
|
|
44
|
+
import("../src/setup.js").then(m => m.default(parseFlags(args)));
|
|
29
45
|
break;
|
|
30
46
|
case "index":
|
|
31
47
|
case "add": {
|
|
@@ -73,6 +89,9 @@ switch (cmd) {
|
|
|
73
89
|
case "watch":
|
|
74
90
|
import("../src/watch.js");
|
|
75
91
|
break;
|
|
92
|
+
case "connect":
|
|
93
|
+
import("../src/connect.js").then(m => m.default(args));
|
|
94
|
+
break;
|
|
76
95
|
case "--version":
|
|
77
96
|
case "-v":
|
|
78
97
|
try {
|
|
@@ -101,5 +120,6 @@ switch (cmd) {
|
|
|
101
120
|
console.log(` yats bridge Stdio proxy for Copilot/Claude`);
|
|
102
121
|
console.log(` yats benchmark AI agent token comparison`);
|
|
103
122
|
console.log(` yats watch <path> Keep index in sync with live edits`);
|
|
123
|
+
console.log(` yats connect [agent] Show agent setup config`);
|
|
104
124
|
break;
|
|
105
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yats-toolkit",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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/connect.js
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* yats connect — Set up YATS MCP config for your AI agent.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* yats connect Pick agent interactively, show config
|
|
6
|
+
* yats connect <agent> Show config for specific agent
|
|
7
|
+
* yats connect --install Place files in current directory
|
|
8
|
+
* yats connect --link Show GitHub links
|
|
9
|
+
*/
|
|
10
|
+
import { writeFileSync, readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
11
|
+
import { join, dirname } from "node:path";
|
|
12
|
+
import { createInterface } from "node:readline";
|
|
13
|
+
import { homedir } from "node:os";
|
|
14
|
+
|
|
15
|
+
const B = "\x1b[1m";
|
|
16
|
+
const D = "\x1b[2m";
|
|
17
|
+
const R = "\x1b[0m";
|
|
18
|
+
const G = "\x1b[32m";
|
|
19
|
+
const Y = "\x1b[33m";
|
|
20
|
+
const C = "\x1b[36m";
|
|
21
|
+
const RED = "\x1b[31m";
|
|
22
|
+
|
|
23
|
+
const YATS_DIR = join(homedir(), ".yats");
|
|
24
|
+
const MCP_CONFIG_FILE = join(YATS_DIR, "mcp-config.json");
|
|
25
|
+
|
|
26
|
+
const AGENTS = {
|
|
27
|
+
claude: {
|
|
28
|
+
name: "Claude Code",
|
|
29
|
+
transport: "stdio bridge",
|
|
30
|
+
files: [
|
|
31
|
+
{ src: "connect/claude/yats/SKILL.md", dest: ".claude/skills/yats/SKILL.md", type: "skill" },
|
|
32
|
+
{ src: "connect/claude/.mcp.json", dest: ".mcp.json", type: "json" },
|
|
33
|
+
],
|
|
34
|
+
url: "https://github.com/fvinciarelli/yats.ai/tree/main/connect/claude",
|
|
35
|
+
},
|
|
36
|
+
cursor: {
|
|
37
|
+
name: "Cursor",
|
|
38
|
+
transport: "HTTP",
|
|
39
|
+
files: [
|
|
40
|
+
{ src: "connect/cursor/rules.mdc", dest: ".cursor/rules/rules.mdc", type: "text" },
|
|
41
|
+
{ src: "connect/cursor/mcp.json", dest: ".cursor/mcp.json", type: "json" },
|
|
42
|
+
],
|
|
43
|
+
url: "https://github.com/fvinciarelli/yats.ai/tree/main/connect/cursor",
|
|
44
|
+
},
|
|
45
|
+
copilot: {
|
|
46
|
+
name: "GitHub Copilot",
|
|
47
|
+
transport: "stdio bridge",
|
|
48
|
+
files: [
|
|
49
|
+
{ src: "connect/copilot/instructions.md", dest: ".github/instructions.md", type: "text" },
|
|
50
|
+
{ src: "connect/copilot/mcp.json", dest: ".copilot/mcp.json", type: "json" },
|
|
51
|
+
],
|
|
52
|
+
url: "https://github.com/fvinciarelli/yats.ai/tree/main/connect/copilot",
|
|
53
|
+
},
|
|
54
|
+
gemini: {
|
|
55
|
+
name: "Gemini CLI",
|
|
56
|
+
transport: "stdio bridge",
|
|
57
|
+
files: [
|
|
58
|
+
{ src: "connect/gemini/GEMINI.md", dest: "GEMINI.md", type: "text" },
|
|
59
|
+
{ src: "connect/gemini/mcp.json", dest: ".gemini/settings.json", type: "json" },
|
|
60
|
+
],
|
|
61
|
+
url: "https://github.com/fvinciarelli/yats.ai/tree/main/connect/gemini",
|
|
62
|
+
},
|
|
63
|
+
codex: {
|
|
64
|
+
name: "Codex CLI",
|
|
65
|
+
transport: "stdio bridge",
|
|
66
|
+
files: [
|
|
67
|
+
{ src: "connect/codex/AGENTS.md", dest: "AGENTS.md", type: "text" },
|
|
68
|
+
{ src: "connect/codex/config.toml", dest: ".codex/config.toml", type: "toml" },
|
|
69
|
+
],
|
|
70
|
+
url: "https://github.com/fvinciarelli/yats.ai/tree/main/connect/codex",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function getYatsMcpConfig() {
|
|
75
|
+
try {
|
|
76
|
+
return JSON.parse(readFileSync(MCP_CONFIG_FILE, "utf-8"));
|
|
77
|
+
} catch {
|
|
78
|
+
return { mcpServers: { yats: { url: "http://localhost:5555/mcp/sse" } } };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ============================================================
|
|
83
|
+
// Install helpers
|
|
84
|
+
// ============================================================
|
|
85
|
+
|
|
86
|
+
function safeMergeJson(existingPath, newEntry) {
|
|
87
|
+
let obj = {};
|
|
88
|
+
try {
|
|
89
|
+
obj = JSON.parse(readFileSync(existingPath, "utf-8"));
|
|
90
|
+
} catch { /* file doesn't exist or invalid, start fresh */ }
|
|
91
|
+
if (!obj.mcpServers) obj.mcpServers = {};
|
|
92
|
+
obj.mcpServers = { ...obj.mcpServers, ...newEntry.mcpServers };
|
|
93
|
+
return JSON.stringify(obj, null, 2) + "\n";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function installFiles(agentKey) {
|
|
97
|
+
const agent = AGENTS[agentKey];
|
|
98
|
+
if (!agent) {
|
|
99
|
+
console.error(`Unknown agent: ${agentKey}`);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
console.log("");
|
|
104
|
+
console.log(` ${Y}${B}⚠️ Before installing, back up your existing config files.${R}`);
|
|
105
|
+
console.log(` ${D}This will modify or create files in your current directory.${R}`);
|
|
106
|
+
console.log("");
|
|
107
|
+
|
|
108
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
109
|
+
const answer = await new Promise((resolve) => {
|
|
110
|
+
rl.question(` ${B}Proceed with install for ${agent.name}? [y/N]${R} `, resolve);
|
|
111
|
+
});
|
|
112
|
+
rl.close();
|
|
113
|
+
|
|
114
|
+
if (answer.toLowerCase() !== "y") {
|
|
115
|
+
console.log("");
|
|
116
|
+
console.log(" Cancelled.");
|
|
117
|
+
console.log("");
|
|
118
|
+
process.exit(0);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
console.log("");
|
|
122
|
+
let installed = 0;
|
|
123
|
+
let skipped = 0;
|
|
124
|
+
|
|
125
|
+
for (const file of agent.files) {
|
|
126
|
+
const destPath = file.dest;
|
|
127
|
+
const mcpConfig = getYatsMcpConfig();
|
|
128
|
+
|
|
129
|
+
if (file.type === "json") {
|
|
130
|
+
const merged = safeMergeJson(destPath, mcpConfig);
|
|
131
|
+
const exists = existsSync(destPath);
|
|
132
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
133
|
+
writeFileSync(destPath, merged);
|
|
134
|
+
if (exists) {
|
|
135
|
+
console.log(` ${Y}↻${R} Merged YATS into existing ${destPath}`);
|
|
136
|
+
} else {
|
|
137
|
+
console.log(` ${G}✓${R} Created ${destPath}`);
|
|
138
|
+
}
|
|
139
|
+
installed++;
|
|
140
|
+
} else if (file.type === "text" || file.type === "skill") {
|
|
141
|
+
if (existsSync(destPath)) {
|
|
142
|
+
console.log(` ${Y}⚠${R} ${destPath} already exists — skipped (backup and remove to replace)`);
|
|
143
|
+
skipped++;
|
|
144
|
+
} else {
|
|
145
|
+
const content = getFileContent(file.src);
|
|
146
|
+
if (content) {
|
|
147
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
148
|
+
writeFileSync(destPath, content);
|
|
149
|
+
console.log(` ${G}✓${R} Created ${destPath}`);
|
|
150
|
+
installed++;
|
|
151
|
+
} else {
|
|
152
|
+
console.log(` ${RED}✗${R} Could not read ${file.src} — download from GitHub`);
|
|
153
|
+
skipped++;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else if (file.type === "toml") {
|
|
157
|
+
if (existsSync(destPath)) {
|
|
158
|
+
console.log(` ${Y}⚠${R} ${destPath} already exists — skipped (backup and remove to replace)`);
|
|
159
|
+
skipped++;
|
|
160
|
+
} else {
|
|
161
|
+
const content = getFileContent(file.src);
|
|
162
|
+
if (content) {
|
|
163
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
164
|
+
writeFileSync(destPath, content);
|
|
165
|
+
console.log(` ${G}✓${R} Created ${destPath}`);
|
|
166
|
+
installed++;
|
|
167
|
+
} else {
|
|
168
|
+
console.log(` ${RED}✗${R} Could not read ${file.src} — download from GitHub`);
|
|
169
|
+
skipped++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log("");
|
|
176
|
+
console.log(` Done: ${installed} installed, ${skipped} skipped.`);
|
|
177
|
+
console.log(` Full instructions: ${C}${agent.url}${R}`);
|
|
178
|
+
console.log("");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function getFileContent(srcPath) {
|
|
182
|
+
// Try from node_modules first (when installed via npm)
|
|
183
|
+
try {
|
|
184
|
+
const pkgDir = dirname(new URL(import.meta.url).pathname);
|
|
185
|
+
const installedPath = join(pkgDir, "..", srcPath);
|
|
186
|
+
if (existsSync(installedPath)) {
|
|
187
|
+
return readFileSync(installedPath, "utf-8");
|
|
188
|
+
}
|
|
189
|
+
} catch { /* not installed as npm package */ }
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ============================================================
|
|
194
|
+
// Display helpers
|
|
195
|
+
// ============================================================
|
|
196
|
+
|
|
197
|
+
function showConfig(agentKey) {
|
|
198
|
+
const agent = AGENTS[agentKey];
|
|
199
|
+
if (!agent) {
|
|
200
|
+
console.error(`Unknown agent: ${agentKey}`);
|
|
201
|
+
console.log("");
|
|
202
|
+
console.log(`Available: ${Object.keys(AGENTS).join(", ")}`);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const mcpConfig = getYatsMcpConfig();
|
|
207
|
+
|
|
208
|
+
console.log("");
|
|
209
|
+
console.log(` ${B}${agent.name}${R} — via ${agent.transport}`);
|
|
210
|
+
console.log("");
|
|
211
|
+
|
|
212
|
+
for (const file of agent.files) {
|
|
213
|
+
console.log(` ${B}${file.dest}${R}`);
|
|
214
|
+
if (file.type === "json") {
|
|
215
|
+
console.log(` ${D}${safeMergeJson("", mcpConfig).replace(/\n/g, "\n ")}${R}`);
|
|
216
|
+
} else {
|
|
217
|
+
const content = getFileContent(file.src);
|
|
218
|
+
if (content) {
|
|
219
|
+
const preview = content.split("\n").slice(0, 8).join("\n");
|
|
220
|
+
console.log(` ${D}${preview}${D}...${R}`);
|
|
221
|
+
} else {
|
|
222
|
+
console.log(` ${D}(download from GitHub)${R}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
console.log("");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log(` ${B}GitHub:${R} ${C}${agent.url}${R}`);
|
|
229
|
+
console.log("");
|
|
230
|
+
console.log(` Run ${B}yats connect --install${R} to auto-place these files.`);
|
|
231
|
+
console.log("");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function showLink(agentKey) {
|
|
235
|
+
if (agentKey && AGENTS[agentKey]) {
|
|
236
|
+
console.log(AGENTS[agentKey].url);
|
|
237
|
+
} else if (agentKey) {
|
|
238
|
+
console.error(`Unknown agent: ${agentKey}`);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
} else {
|
|
241
|
+
console.log("https://github.com/fvinciarelli/yats.ai/tree/main/connect");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function ask(question) {
|
|
246
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
247
|
+
const answer = await new Promise((resolve) => rl.question(question, resolve));
|
|
248
|
+
rl.close();
|
|
249
|
+
return answer;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async function choose(prompt, options) {
|
|
253
|
+
console.log(` ${prompt}`);
|
|
254
|
+
for (let i = 0; i < options.length; i++) {
|
|
255
|
+
console.log(` ${B}${i + 1}${R}. ${options[i].label}`);
|
|
256
|
+
}
|
|
257
|
+
console.log("");
|
|
258
|
+
const answer = await ask(` ${B}Pick [1-${options.length}]:${R} `);
|
|
259
|
+
const num = parseInt(answer.trim(), 10);
|
|
260
|
+
if (num >= 1 && num <= options.length) {
|
|
261
|
+
return options[num - 1].value;
|
|
262
|
+
}
|
|
263
|
+
console.log(` ${RED}Invalid.${R}`);
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ============================================================
|
|
268
|
+
// Main
|
|
269
|
+
// ============================================================
|
|
270
|
+
|
|
271
|
+
export default async function connect(args) {
|
|
272
|
+
const agentKey = args.find(a => !a.startsWith("--"));
|
|
273
|
+
const isInstall = args.includes("--install");
|
|
274
|
+
const isLink = args.includes("--link");
|
|
275
|
+
|
|
276
|
+
if (isLink) {
|
|
277
|
+
showLink(agentKey);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (isInstall) {
|
|
282
|
+
if (!agentKey) {
|
|
283
|
+
console.error("Usage: yats connect --install <agent>");
|
|
284
|
+
console.error(` Agents: ${Object.keys(AGENTS).join(", ")}`);
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
287
|
+
await installFiles(agentKey);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (agentKey) {
|
|
292
|
+
showConfig(agentKey);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Interactive picker
|
|
297
|
+
const picked = await choose("Which AI agent are you using?", [
|
|
298
|
+
{ label: "Claude Code", value: "claude" },
|
|
299
|
+
{ label: "Cursor", value: "cursor" },
|
|
300
|
+
{ label: "GitHub Copilot", value: "copilot" },
|
|
301
|
+
{ label: "Gemini CLI", value: "gemini" },
|
|
302
|
+
{ label: "Codex CLI", value: "codex" },
|
|
303
|
+
]);
|
|
304
|
+
|
|
305
|
+
showConfig(picked);
|
|
306
|
+
}
|
package/src/setup.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { spawn } from "node:child_process";
|
|
12
|
-
import { writeFileSync, mkdirSync, existsSync, readFileSync } from "node:fs";
|
|
13
|
-
import { homedir } from "node:os";
|
|
14
|
-
import { join } from "node:path";
|
|
12
|
+
import { writeFileSync, mkdirSync, existsSync, readFileSync, statSync, chmodSync } from "node:fs";
|
|
13
|
+
import { homedir, platform } from "node:os";
|
|
14
|
+
import { join, resolve } from "node:path";
|
|
15
15
|
import { createInterface } from "node:readline";
|
|
16
16
|
|
|
17
17
|
// ============================================================
|
|
@@ -29,6 +29,7 @@ const YATS_DIR = join(homedir(), ".yats");
|
|
|
29
29
|
const REPOS_DIR = join(YATS_DIR, "repos");
|
|
30
30
|
const COMPOSE_FILE = join(YATS_DIR, "docker-compose.yml");
|
|
31
31
|
const MCP_CONFIG_FILE = join(YATS_DIR, "mcp-config.json");
|
|
32
|
+
const YATS_BIN_DIR = join(YATS_DIR, "bin");
|
|
32
33
|
|
|
33
34
|
const GITHUB_COMPOSE_URL =
|
|
34
35
|
"https://raw.githubusercontent.com/fvinciarelli/yats.ai/main/docker/docker-compose.yml";
|
|
@@ -373,7 +374,57 @@ async function waitForHealth(url, retries = 30, delay = 2000) {
|
|
|
373
374
|
// Main
|
|
374
375
|
// ============================================================
|
|
375
376
|
|
|
376
|
-
async function
|
|
377
|
+
async function loadEnv() {
|
|
378
|
+
const env = {};
|
|
379
|
+
try {
|
|
380
|
+
const content = readFileSync(ENV_FILE, "utf-8");
|
|
381
|
+
for (const line of content.split("\n")) {
|
|
382
|
+
const trimmed = line.trim();
|
|
383
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
384
|
+
const eq = trimmed.indexOf("=");
|
|
385
|
+
if (eq === -1) continue;
|
|
386
|
+
env[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim();
|
|
387
|
+
}
|
|
388
|
+
} catch { /* no .env file yet */ }
|
|
389
|
+
return env;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
async function testApiConnection(provider, apiKey) {
|
|
393
|
+
const endpoints = {
|
|
394
|
+
openai: { url: "https://api.openai.com/v1/embeddings", key: apiKey, body: { model: "text-embedding-3-small", input: ["test"] } },
|
|
395
|
+
mistral: { url: "https://api.mistral.ai/v1/embeddings", key: apiKey, body: { model: "mistral-embed", input: ["test"] } },
|
|
396
|
+
voyage: { url: "https://api.voyageai.com/v1/embeddings", key: apiKey, body: { model: "voyage-3-lite", input: ["test"] } },
|
|
397
|
+
};
|
|
398
|
+
const cfg = endpoints[provider];
|
|
399
|
+
if (!cfg) return { ok: false, error: "Unknown provider" };
|
|
400
|
+
try {
|
|
401
|
+
const res = await fetch(cfg.url, {
|
|
402
|
+
method: "POST",
|
|
403
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${cfg.key}` },
|
|
404
|
+
body: JSON.stringify(cfg.body),
|
|
405
|
+
signal: AbortSignal.timeout(15000),
|
|
406
|
+
});
|
|
407
|
+
if (res.ok) return { ok: true };
|
|
408
|
+
const err = await res.text();
|
|
409
|
+
return { ok: false, error: `HTTP ${res.status}: ${err.slice(0, 200)}` };
|
|
410
|
+
} catch (e) {
|
|
411
|
+
return { ok: false, error: e.message };
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
async function main(options = {}) {
|
|
416
|
+
// Load pre-filled values from .env (if exists) or CLI flags
|
|
417
|
+
const env = loadEnv();
|
|
418
|
+
const nonInteractive = options.nonInteractive || false;
|
|
419
|
+
const prefill = {
|
|
420
|
+
provider: options.provider || env.YATS_PROVIDER || null,
|
|
421
|
+
apiKey: options.apiKey || env.OPENAI_API_KEY || env.MISTRAL_API_KEY || env.VOYAGE_API_KEY || null,
|
|
422
|
+
port: options.port ? parseInt(options.port, 10) : null,
|
|
423
|
+
batch: options.batch ? parseInt(options.batch, 10) : null,
|
|
424
|
+
noDocs: options.noDocs || false,
|
|
425
|
+
skipConfirm: options.skipConfirm || false,
|
|
426
|
+
};
|
|
427
|
+
|
|
377
428
|
header();
|
|
378
429
|
|
|
379
430
|
// Check Docker
|
|
@@ -432,14 +483,19 @@ async function main() {
|
|
|
432
483
|
}
|
|
433
484
|
|
|
434
485
|
// Step 1: Embedding provider
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
486
|
+
let provider;
|
|
487
|
+
if (nonInteractive && prefill.provider) {
|
|
488
|
+
provider = prefill.provider;
|
|
489
|
+
console.log(` Provider: ${provider}`);
|
|
490
|
+
} else {
|
|
491
|
+
step("Step 1 — Embedding provider");
|
|
492
|
+
provider = await choose("How should I generate embeddings for your code?", [
|
|
493
|
+
{ label: "Ollama (local, private, included) — recommended", value: "ollama" },
|
|
494
|
+
{ label: "OpenAI (cloud, needs API key)", value: "openai" },
|
|
495
|
+
{ label: "Mistral (cloud, needs API key)", value: "mistral" },
|
|
496
|
+
{ label: "Voyage AI (cloud, optimized for code, needs API key)", value: "voyage" },
|
|
497
|
+
]);
|
|
498
|
+
}
|
|
443
499
|
|
|
444
500
|
let apiKey = "";
|
|
445
501
|
let ollamaModel = "nomic-embed-text";
|
|
@@ -453,104 +509,152 @@ async function main() {
|
|
|
453
509
|
} else {
|
|
454
510
|
const providerNames = { openai: "OpenAI", mistral: "Mistral", voyage: "Voyage AI" };
|
|
455
511
|
step(`Step 2 — ${providerNames[provider]} API key`);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
512
|
+
|
|
513
|
+
if (nonInteractive && prefill.apiKey) {
|
|
514
|
+
apiKey = prefill.apiKey;
|
|
515
|
+
console.log(` API key: ${apiKey.slice(0, 8)}...`);
|
|
516
|
+
} else {
|
|
517
|
+
const rl2 = createInterface({ input: process.stdin, output: process.stdout });
|
|
518
|
+
const defaultKey = prefill.apiKey || "";
|
|
519
|
+
const prompt = defaultKey
|
|
520
|
+
? ` ${B}Your ${providerNames[provider]} API key${R} [${defaultKey.slice(0, 8)}...]: `
|
|
521
|
+
: ` ${B}Your ${providerNames[provider]} API key:${R} `;
|
|
522
|
+
apiKey = await ask(rl2, prompt);
|
|
523
|
+
if (!apiKey && defaultKey) apiKey = defaultKey;
|
|
524
|
+
rl2.close();
|
|
525
|
+
}
|
|
526
|
+
|
|
459
527
|
console.log("");
|
|
460
528
|
console.log(` ${Y}⚠${R} This is a paid service — you may be charged for API usage.`);
|
|
461
529
|
console.log("");
|
|
530
|
+
|
|
531
|
+
// Optional: test connection
|
|
532
|
+
if (!nonInteractive) {
|
|
533
|
+
const rlTest = createInterface({ input: process.stdin, output: process.stdout });
|
|
534
|
+
const testAnswer = await ask(rlTest, ` ${B}Test connection? [Y/n]${R} `);
|
|
535
|
+
rlTest.close();
|
|
536
|
+
if (testAnswer.toLowerCase() !== "n") {
|
|
537
|
+
const sTest = spinner("Testing API connection...");
|
|
538
|
+
const result = await testApiConnection(provider, apiKey);
|
|
539
|
+
if (result.ok) {
|
|
540
|
+
sTest.done(true);
|
|
541
|
+
console.log("");
|
|
542
|
+
} else {
|
|
543
|
+
sTest.done(false);
|
|
544
|
+
console.log(` ${RED}✗${R} Connection failed: ${result.error}`);
|
|
545
|
+
console.log(` ${Y}⚠${R} You can change the API key later in ${C}~/.yats/.env${R}`);
|
|
546
|
+
console.log("");
|
|
547
|
+
if (!nonInteractive) {
|
|
548
|
+
const rlRetry = createInterface({ input: process.stdin, output: process.stdout });
|
|
549
|
+
const retryAnswer = await ask(rlRetry, ` ${B}Re-enter API key? [Y/n]${R} `);
|
|
550
|
+
rlRetry.close();
|
|
551
|
+
if (retryAnswer.toLowerCase() !== "n") {
|
|
552
|
+
const rl2b = createInterface({ input: process.stdin, output: process.stdout });
|
|
553
|
+
apiKey = await ask(rl2b, ` ${B}Your ${providerNames[provider]} API key:${R} `);
|
|
554
|
+
rl2b.close();
|
|
555
|
+
console.log("");
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
} else {
|
|
560
|
+
console.log("");
|
|
561
|
+
}
|
|
562
|
+
}
|
|
462
563
|
console.log("");
|
|
463
564
|
}
|
|
464
565
|
|
|
465
566
|
// Step 3: Embedding batch size
|
|
466
|
-
const BATCH_DEFAULTS = {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
voyage: 100,
|
|
470
|
-
ollama: 4,
|
|
471
|
-
};
|
|
472
|
-
const BATCH_MAX = {
|
|
473
|
-
openai: 2048,
|
|
474
|
-
mistral: 1024,
|
|
475
|
-
voyage: 128,
|
|
476
|
-
ollama: 4,
|
|
477
|
-
};
|
|
478
|
-
const defaultBatch = BATCH_DEFAULTS[provider];
|
|
567
|
+
const BATCH_DEFAULTS = { openai: 200, mistral: 200, voyage: 100, ollama: 4 };
|
|
568
|
+
const BATCH_MAX = { openai: 2048, mistral: 1024, voyage: 128, ollama: 4 };
|
|
569
|
+
const defaultBatch = prefill.batch || BATCH_DEFAULTS[provider];
|
|
479
570
|
const maxBatch = BATCH_MAX[provider];
|
|
480
|
-
|
|
481
|
-
step(`Step 3 — Embedding batch size`);
|
|
482
|
-
console.log(` ${D}How many texts to embed per API request.${R}`);
|
|
483
|
-
console.log(` ${D}Higher = faster indexing, lower = safer for rate limits.${R}`);
|
|
484
|
-
console.log(` ${D}Provider max: ${maxBatch}${R}`);
|
|
485
|
-
console.log("");
|
|
486
|
-
|
|
487
|
-
const rlBatch = createInterface({ input: process.stdin, output: process.stdout });
|
|
488
|
-
const batchAnswer = await ask(rlBatch, ` ${B}Batch size${R} [${defaultBatch}]: `);
|
|
489
|
-
rlBatch.close();
|
|
490
571
|
let batchSize = defaultBatch;
|
|
491
|
-
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
|
|
572
|
+
|
|
573
|
+
if (nonInteractive) {
|
|
574
|
+
console.log(` Batch size: ${batchSize}`);
|
|
575
|
+
} else {
|
|
576
|
+
step(`Step 3 — Embedding batch size`);
|
|
577
|
+
console.log(` ${D}How many texts to embed per API request.${R}`);
|
|
578
|
+
console.log(` ${D}Higher = faster indexing, lower = safer for rate limits.${R}`);
|
|
579
|
+
console.log(` ${D}Provider max: ${maxBatch}${R}`);
|
|
580
|
+
console.log("");
|
|
581
|
+
const rlBatch = createInterface({ input: process.stdin, output: process.stdout });
|
|
582
|
+
const batchAnswer = await ask(rlBatch, ` ${B}Batch size${R} [${defaultBatch}]: `);
|
|
583
|
+
rlBatch.close();
|
|
584
|
+
const batchTrimmed = batchAnswer.trim();
|
|
585
|
+
if (batchTrimmed) {
|
|
586
|
+
const num = parseInt(batchTrimmed, 10);
|
|
587
|
+
if (num >= 1 && num <= maxBatch) batchSize = num;
|
|
588
|
+
else console.log(` ${Y}⚠${R} Must be 1–${maxBatch}. Using default ${defaultBatch}.`);
|
|
498
589
|
}
|
|
590
|
+
console.log(` ${G}✓${R} Batch size: ${batchSize}`);
|
|
591
|
+
console.log("");
|
|
499
592
|
}
|
|
500
|
-
console.log(` ${G}✓${R} Batch size: ${batchSize}`);
|
|
501
|
-
console.log("");
|
|
502
593
|
|
|
503
594
|
// Step 4: Documentation indexing
|
|
504
595
|
const docMaxFiles = 300;
|
|
505
|
-
let indexDocs =
|
|
506
|
-
|
|
507
|
-
step("Step 4 — Documentation indexing");
|
|
508
|
-
console.log(` ${D}Index README, ARCHITECTURE, AI/ docs, and docs/ directory.${R}`);
|
|
509
|
-
console.log(` ${D}Patterns (edit via DOC_PATTERNS env): AI/*.md, README.md, docs/${R}`);
|
|
510
|
-
console.log(` ${D}If docs/ has >${docMaxFiles} .md files, you'll get a warning.${R}`);
|
|
511
|
-
console.log("");
|
|
596
|
+
let indexDocs = !prefill.noDocs;
|
|
512
597
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
console.log(
|
|
598
|
+
if (!nonInteractive) {
|
|
599
|
+
step("Step 4 — Documentation indexing");
|
|
600
|
+
console.log(` ${D}Index README, ARCHITECTURE, AI/ docs, and docs/ directory.${R}`);
|
|
601
|
+
console.log(` ${D}Patterns (edit via DOC_PATTERNS env): AI/*.md, README.md, docs/${R}`);
|
|
602
|
+
console.log(` ${D}If docs/ has >${docMaxFiles} .md files, you'll get a warning.${R}`);
|
|
603
|
+
console.log("");
|
|
604
|
+
const rlDocs = createInterface({ input: process.stdin, output: process.stdout });
|
|
605
|
+
const docsAnswer = await ask(rlDocs, ` ${B}Index documentation? [Y/n]${R} `);
|
|
606
|
+
rlDocs.close();
|
|
607
|
+
if (docsAnswer.toLowerCase() === "n") {
|
|
608
|
+
indexDocs = false;
|
|
609
|
+
console.log(` ${Y}⚠${R} Documentation indexing disabled. Set INDEX_DOCS=true to re-enable.`);
|
|
610
|
+
} else {
|
|
611
|
+
console.log(` ${G}✓${R} Documentation will be indexed.`);
|
|
612
|
+
}
|
|
613
|
+
console.log("");
|
|
519
614
|
} else {
|
|
520
|
-
console.log(` ${
|
|
615
|
+
console.log(` Index docs: ${indexDocs ? "Yes" : "No"}`);
|
|
521
616
|
}
|
|
522
|
-
console.log("");
|
|
523
617
|
|
|
524
618
|
// Optional: pre-index directories
|
|
525
|
-
step("Step 5 — Pre-index (optional)");
|
|
526
|
-
console.log(` ${D}Indexing happens automatically on first search.${R}`);
|
|
527
|
-
console.log(` ${D}Want to pre-index some directories now to skip the wait later?${R}`);
|
|
528
|
-
console.log("");
|
|
529
|
-
console.log(` ${D}Tip: type a path or drag-n-drop a folder from your file manager.${R}`);
|
|
530
|
-
|
|
531
|
-
const rl3 = createInterface({ input: process.stdin, output: process.stdout });
|
|
532
619
|
const pathsToIndex = [];
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
620
|
+
if (!nonInteractive) {
|
|
621
|
+
step("Step 5 — Pre-index (optional)");
|
|
622
|
+
console.log(` ${D}Indexing happens automatically on first search.${R}`);
|
|
623
|
+
console.log(` ${D}Want to pre-index some directories now to skip the wait later?${R}`);
|
|
624
|
+
console.log("");
|
|
625
|
+
console.log(` ${D}Tip: type a path or drag-n-drop a folder from your file manager.${R}`);
|
|
626
|
+
const rl3 = createInterface({ input: process.stdin, output: process.stdout });
|
|
627
|
+
while (true) {
|
|
628
|
+
const p = await ask(rl3, ` ${B}Directory path (Enter to skip):${R} `);
|
|
629
|
+
const trimmed = p.trim();
|
|
630
|
+
if (!trimmed) break;
|
|
631
|
+
const resolved = resolve(trimmed);
|
|
632
|
+
if (existsSync(resolved)) {
|
|
633
|
+
try {
|
|
634
|
+
if (statSync(resolved).isDirectory()) {
|
|
635
|
+
pathsToIndex.push(resolved);
|
|
636
|
+
console.log(` ${G}✓${R} Added: ${resolved}`);
|
|
637
|
+
} else {
|
|
638
|
+
console.log(` ${RED}✗${R} Not a directory: ${resolved}`);
|
|
639
|
+
}
|
|
640
|
+
} catch {
|
|
641
|
+
console.log(` ${RED}✗${R} Cannot access: ${resolved}`);
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
console.log(` ${RED}✗${R} Not found: ${resolved}`);
|
|
645
|
+
}
|
|
542
646
|
}
|
|
647
|
+
rl3.close();
|
|
543
648
|
}
|
|
544
|
-
rl3.close();
|
|
545
649
|
console.log("");
|
|
546
650
|
|
|
547
651
|
// Port selection
|
|
548
|
-
let mcpPort = 5555;
|
|
549
|
-
{
|
|
652
|
+
let mcpPort = prefill.port || 5555;
|
|
653
|
+
if (!nonInteractive) {
|
|
550
654
|
const rlPort = createInterface({ input: process.stdin, output: process.stdout });
|
|
551
655
|
const inUse = await checkPort(mcpPort);
|
|
552
|
-
const suggested = inUse ?
|
|
553
|
-
const hint = inUse ? ` ${Y}(default
|
|
656
|
+
const suggested = inUse ? (mcpPort + 1) : mcpPort;
|
|
657
|
+
const hint = inUse ? ` ${Y}(default ${mcpPort} is in use)${R}` : "";
|
|
554
658
|
const answer = await ask(rlPort, ` ${B}MCP server port${R} [${suggested}]:${hint} `);
|
|
555
659
|
const trimmed = answer.trim();
|
|
556
660
|
if (trimmed) {
|
|
@@ -560,36 +664,36 @@ async function main() {
|
|
|
560
664
|
mcpPort = suggested;
|
|
561
665
|
}
|
|
562
666
|
rlPort.close();
|
|
667
|
+
console.log(` ${G}✓${R} MCP server on ${C}http://localhost:${mcpPort}/mcp/sse${R}`);
|
|
668
|
+
console.log("");
|
|
563
669
|
}
|
|
564
|
-
console.log(` ${G}✓${R} MCP server on ${C}http://localhost:${mcpPort}/mcp/sse${R}`);
|
|
565
|
-
console.log("");
|
|
566
|
-
|
|
567
|
-
// Step 5: Confirm
|
|
568
|
-
step(`Step ${pathsToIndex.length ? "6" : "5"} — Confirm`);
|
|
569
|
-
const providerName = provider === "ollama"
|
|
570
|
-
? `Ollama (${ollamaModel})`
|
|
571
|
-
: { openai: "OpenAI", mistral: "Mistral", voyage: "Voyage AI" }[provider];
|
|
572
|
-
|
|
573
|
-
box([
|
|
574
|
-
`${B}Provider:${R} ${providerName}`,
|
|
575
|
-
`${B}Port:${R} ${String(mcpPort)}`,
|
|
576
|
-
...(pathsToIndex.length ? [`${B}Pre-index:${R} ${String(pathsToIndex.length + " directorie(s)")}`] : []),
|
|
577
|
-
`${B}Batch:${R} ${String(batchSize)}`,
|
|
578
|
-
`${B}Index docs:${R} ${indexDocs ? "Yes (max " + docMaxFiles + " files)" : "No"}`,
|
|
579
|
-
`${B}API calls:${R} ${provider === "ollama" ? "None (runs locally)" : `To ${provider} API`}`,
|
|
580
|
-
`${B}Disk needed:${R} ${provider === "ollama" ? "~3GB" : "~1GB"}`,
|
|
581
|
-
]);
|
|
582
|
-
console.log("");
|
|
583
670
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
671
|
+
// Confirm
|
|
672
|
+
if (!nonInteractive && !prefill.skipConfirm) {
|
|
673
|
+
step(`Step ${pathsToIndex.length ? "6" : "5"} — Confirm`);
|
|
674
|
+
const providerName = provider === "ollama"
|
|
675
|
+
? `Ollama (${ollamaModel})`
|
|
676
|
+
: { openai: "OpenAI", mistral: "Mistral", voyage: "Voyage AI" }[provider];
|
|
677
|
+
box([
|
|
678
|
+
`${B}Provider:${R} ${providerName}`,
|
|
679
|
+
`${B}Port:${R} ${String(mcpPort)}`,
|
|
680
|
+
...(pathsToIndex.length ? [`${B}Pre-index:${R} ${String(pathsToIndex.length + " directorie(s)")}`] : []),
|
|
681
|
+
`${B}Batch:${R} ${String(batchSize)}`,
|
|
682
|
+
`${B}Index docs:${R} ${indexDocs ? "Yes (max " + docMaxFiles + " files)" : "No"}`,
|
|
683
|
+
`${B}API calls:${R} ${provider === "ollama" ? "None (runs locally)" : `To ${provider} API`}`,
|
|
684
|
+
`${B}Disk needed:${R} ${provider === "ollama" ? "~3GB" : "~1GB"}`,
|
|
685
|
+
]);
|
|
591
686
|
console.log("");
|
|
592
|
-
|
|
687
|
+
const proceed = await (() => {
|
|
688
|
+
const rl4 = createInterface({ input: process.stdin, output: process.stdout });
|
|
689
|
+
return ask(rl4, ` ${B}Proceed? [Y/n]${R} `).then((a) => { rl4.close(); return a; });
|
|
690
|
+
})();
|
|
691
|
+
if (proceed.toLowerCase() === "n") {
|
|
692
|
+
console.log("");
|
|
693
|
+
console.log(` Setup cancelled. Run ${B}npx yats-toolkit${R} anytime to try again.`);
|
|
694
|
+
console.log("");
|
|
695
|
+
process.exit(0);
|
|
696
|
+
}
|
|
593
697
|
}
|
|
594
698
|
|
|
595
699
|
// Install
|
|
@@ -663,43 +767,83 @@ async function main() {
|
|
|
663
767
|
}
|
|
664
768
|
}
|
|
665
769
|
|
|
770
|
+
// Install YATS CLI globally (or to ~/.yats/bin if global fails)
|
|
771
|
+
const sCli = spinner("Installing YATS CLI...");
|
|
772
|
+
try {
|
|
773
|
+
const osPlatform = platform();
|
|
774
|
+
mkdirSync(YATS_BIN_DIR, { recursive: true });
|
|
775
|
+
|
|
776
|
+
if (osPlatform === "win32") {
|
|
777
|
+
// Windows: create a .cmd wrapper
|
|
778
|
+
const cmdScript = `@echo off\r\nnpx yats %*\r\n`;
|
|
779
|
+
writeFileSync(join(YATS_BIN_DIR, "yats.cmd"), cmdScript);
|
|
780
|
+
} else {
|
|
781
|
+
// Linux/macOS: create a shell wrapper
|
|
782
|
+
const shScript = `#!/usr/bin/env bash\nnpx yats "$@"\n`;
|
|
783
|
+
writeFileSync(join(YATS_BIN_DIR, "yats"), shScript);
|
|
784
|
+
chmodSync(join(YATS_BIN_DIR, "yats"), 0o755);
|
|
785
|
+
}
|
|
786
|
+
sCli.done(true);
|
|
787
|
+
|
|
788
|
+
// Add to PATH
|
|
789
|
+
const rcFiles = [];
|
|
790
|
+
if (osPlatform !== "win32") {
|
|
791
|
+
// Try .bashrc and .zshrc
|
|
792
|
+
const bashrc = join(homedir(), ".bashrc");
|
|
793
|
+
const zshrc = join(homedir(), ".zshrc");
|
|
794
|
+
if (existsSync(bashrc)) rcFiles.push(bashrc);
|
|
795
|
+
if (existsSync(zshrc)) rcFiles.push(zshrc);
|
|
796
|
+
if (rcFiles.length === 0) rcFiles.push(bashrc); // if neither exists, create .bashrc
|
|
797
|
+
|
|
798
|
+
const exportLine = `\nexport PATH="$HOME/.yats/bin:$PATH" # YATS CLI\n`;
|
|
799
|
+
for (const rc of rcFiles) {
|
|
800
|
+
const content = existsSync(rc) ? readFileSync(rc, "utf-8") : "";
|
|
801
|
+
if (!content.includes(".yats/bin")) {
|
|
802
|
+
writeFileSync(rc, content + exportLine);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
} else {
|
|
806
|
+
// Windows: use setx (no visual feedback needed for the spinner)
|
|
807
|
+
// setx is best-effort; user may need admin
|
|
808
|
+
try {
|
|
809
|
+
await runCmd("setx", ["PATH", `${YATS_BIN_DIR};%PATH%`]);
|
|
810
|
+
} catch {}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
console.log(` ${G}✓${R} CLI installed to ${C}${YATS_BIN_DIR}${R}`);
|
|
814
|
+
if (osPlatform !== "win32") {
|
|
815
|
+
const names = rcFiles.map(f => f.split("/").pop()).join(" and ");
|
|
816
|
+
console.log(` ${Y}⚠${R} Added ${C}~/.yats/bin${R} to your ${C}${names}${R}`);
|
|
817
|
+
console.log(` ${Y}⚠${R} Run ${B}source ${names.includes("zshrc") ? "~/.zshrc" : "~/.bashrc"}${R} or restart your terminal`);
|
|
818
|
+
console.log(` ${Y}⚠${R} for the ${B}yats${R} command to be available.`);
|
|
819
|
+
}
|
|
820
|
+
} catch (e) {
|
|
821
|
+
sCli.done(false);
|
|
822
|
+
}
|
|
823
|
+
|
|
666
824
|
// Done
|
|
667
825
|
console.log("");
|
|
668
|
-
console.log(` ✅ ${G}YATS is ready!${R}`);
|
|
669
|
-
divider();
|
|
826
|
+
console.log(` ✅ ${G}YATS is ready!${R} → ${C}http://localhost:${mcpPort}/mcp/sse${R}`);
|
|
670
827
|
console.log("");
|
|
671
|
-
console.log(`
|
|
828
|
+
console.log(` Config saved to ${C}~/.yats/.env${R}`);
|
|
672
829
|
console.log("");
|
|
673
|
-
|
|
674
830
|
box([
|
|
675
|
-
`${B}
|
|
831
|
+
`${B}Copy this URL into your AI agent:${R}`,
|
|
676
832
|
`{ "url": "http://localhost:${mcpPort}/mcp/sse" }`,
|
|
677
833
|
"",
|
|
678
|
-
`${B}
|
|
834
|
+
`${B}Copilot / Claude Desktop:${R}`,
|
|
679
835
|
`{ "command": "npx", "args": ["yats-bridge"] }`,
|
|
836
|
+
"",
|
|
837
|
+
`${D}For more: yats connect${R}`,
|
|
838
|
+
`${C}https://github.com/fvinciarelli/yats.ai/tree/master/connect${R}`,
|
|
680
839
|
]);
|
|
681
840
|
console.log("");
|
|
682
|
-
console.log(`
|
|
683
|
-
divider();
|
|
684
|
-
console.log("");
|
|
685
|
-
console.log(` ${B}How it works:${R}`);
|
|
686
|
-
console.log("");
|
|
687
|
-
console.log(` Just ask your AI agent about your code.`);
|
|
688
|
-
console.log(` The index builds automatically on the first search.`);
|
|
689
|
-
console.log("");
|
|
690
|
-
console.log(` Example: "${D}how does authentication work in my project?${R}"`);
|
|
841
|
+
console.log(` ${B}Try:${R} ${C}"how does auth work in this project?"${R}`);
|
|
691
842
|
console.log("");
|
|
692
|
-
console.log(` ${B}Commands:${R}`);
|
|
693
|
-
console.log(`
|
|
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`);
|
|
697
|
-
console.log(` yats stop Stop all services`);
|
|
698
|
-
console.log(` yats start Start all services`);
|
|
699
|
-
console.log(` yats update Update CLI to latest`);
|
|
700
|
-
console.log(` yats update-base Update Docker images`);
|
|
843
|
+
console.log(` ${B}Commands:${R} yats status | yats clear | yats stop/start`);
|
|
844
|
+
console.log(` yats update | yats connect`);
|
|
701
845
|
console.log("");
|
|
702
|
-
console.log(` Docs:
|
|
846
|
+
console.log(` Docs: ${C}https://fvinciarelli.github.io/yats.ai/${R} · ${C}https://yats.site${R}`);
|
|
703
847
|
console.log("");
|
|
704
848
|
}
|
|
705
849
|
export default main;
|