yats-toolkit 0.4.1 → 0.5.0
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 -4
- package/connect/claude/SKILL.md +36 -0
- package/connect/claude/mcp.json +8 -0
- package/connect/codex/AGENTS.md +37 -0
- package/connect/codex/config.toml +9 -0
- package/connect/copilot/instructions.md +18 -0
- package/connect/copilot/mcp.json +10 -0
- package/connect/cursor/mcp.json +7 -0
- package/connect/cursor/rules.mdc +27 -0
- package/connect/gemini/GEMINI.md +33 -0
- package/connect/gemini/mcp.json +9 -0
- package/package.json +4 -2
- package/src/benchmark.js +23 -136
- package/src/connect.js +219 -52
- package/src/indexer.js +118 -13
- package/src/indexer.test.js +87 -0
- package/src/watch.js +336 -109
- package/src/watch.test.js +153 -0
package/bin/setup.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
6
|
* yats setup # One-time setup wizard
|
|
7
|
-
* yats index <path> # Index a repository
|
|
7
|
+
* yats index <path> # Index a repository (--skip-docs: skip docs)
|
|
8
8
|
* yats search <query> # Search indexed code
|
|
9
9
|
* yats list # List indexed repositories
|
|
10
10
|
* yats summary <repo> # Show repository summary
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* yats update-base # Update Docker images
|
|
18
18
|
* yats bridge # MCP stdio ↔ HTTP proxy (for Copilot, Claude)
|
|
19
19
|
* yats benchmark # AI agent token comparison
|
|
20
|
-
* yats watch <path> #
|
|
20
|
+
* yats watch <path> # Keep the index in sync with git commits
|
|
21
|
+
* yats watch <path> --live # Also re-index on every save
|
|
21
22
|
* yats connect [agent] # Show or install agent config
|
|
22
23
|
*/
|
|
23
24
|
|
|
@@ -109,7 +110,7 @@ switch (cmd) {
|
|
|
109
110
|
console.log(`YATS Toolkit — Code intelligence for AI agents`);
|
|
110
111
|
console.log(``);
|
|
111
112
|
console.log(` yats setup Setup wizard`);
|
|
112
|
-
console.log(` yats index <path> Index a repository`);
|
|
113
|
+
console.log(` yats index <path> Index a repository (--skip-docs: skip docs)`);
|
|
113
114
|
console.log(` yats search <query> Search indexed code`);
|
|
114
115
|
console.log(` yats list List indexed repositories`);
|
|
115
116
|
console.log(` yats summary <repo> Show repository summary`);
|
|
@@ -122,7 +123,7 @@ switch (cmd) {
|
|
|
122
123
|
console.log(` yats update-base Update Docker images`);
|
|
123
124
|
console.log(` yats bridge Stdio proxy for Copilot/Claude`);
|
|
124
125
|
console.log(` yats benchmark AI agent token comparison`);
|
|
125
|
-
console.log(` yats watch <path>
|
|
126
|
+
console.log(` yats watch <path> Sync index with git commits (--live: on save)`);
|
|
126
127
|
console.log(` yats connect [agent] Show agent setup config`);
|
|
127
128
|
break;
|
|
128
129
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yats
|
|
3
|
+
description: YATS has this codebase indexed in a knowledge graph. Use when asked about the code — how something works, architecture, call chains, where something is defined. Use YATS tools first before reading files.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# YATS Code Intelligence
|
|
7
|
+
|
|
8
|
+
This repo is indexed by YATS (mcp__yats__* tools). Every symbol, call, and relationship is in a knowledge graph.
|
|
9
|
+
|
|
10
|
+
## Golden rule
|
|
11
|
+
|
|
12
|
+
**YATS first, Read second.** MCP tools return results in milliseconds for ~100 tokens. Reading files costs thousands of tokens and takes seconds.
|
|
13
|
+
|
|
14
|
+
## Efficient workflow
|
|
15
|
+
|
|
16
|
+
1. `search_code` — natural language query about the code (ALWAYS start here)
|
|
17
|
+
2. `find_symbol` on top 2-3 hits to get exact locations
|
|
18
|
+
3. `find_callers` / `find_callees` on 1-2 key symbols to trace the flow
|
|
19
|
+
4. `expand_graph` on seeds to get the full subgraph in one call
|
|
20
|
+
5. Only then `Read` files at the exact lines YATS gave you
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
|
|
24
|
+
- Max 3-5 YATS tool calls per task. Synthesize what you have.
|
|
25
|
+
- Never guess symbol names — always start with `search_code`.
|
|
26
|
+
- Prefer `expand_graph` over multiple individual `find_symbol` calls.
|
|
27
|
+
- If YATS returns empty, try a different query before falling back to file reads.
|
|
28
|
+
- Use `path="__REPO_PATH__"` for every call — YATS identifies repos by their full path.
|
|
29
|
+
|
|
30
|
+
## At startup
|
|
31
|
+
|
|
32
|
+
Run `yats list` and check if `__REPO_PATH__` is indexed. If it's not, run:
|
|
33
|
+
|
|
34
|
+
yats index __REPO_PATH__
|
|
35
|
+
|
|
36
|
+
and wait for it to finish.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# YATS Code Intelligence
|
|
2
|
+
|
|
3
|
+
This repository is indexed by YATS MCP. You have these tools:
|
|
4
|
+
`search_code`, `find_symbol`, `find_callers`, `find_callees`, `expand_graph`,
|
|
5
|
+
`find_references`, `find_implementations`, `find_inheritors`, `find_routes`,
|
|
6
|
+
`repository_summary`, `architecture_summary`, `list_repositories`.
|
|
7
|
+
|
|
8
|
+
## Golden rule
|
|
9
|
+
|
|
10
|
+
**YATS first, Read second.** MCP tools return results in milliseconds for ~100 tokens. Reading files costs thousands of tokens and takes seconds.
|
|
11
|
+
|
|
12
|
+
## Efficient workflow
|
|
13
|
+
|
|
14
|
+
1. `search_code` — natural language query about the code (ALWAYS start here)
|
|
15
|
+
2. `expand_graph` on top 2-3 symbol ids — full subgraph (callers + callees + neighbors) in ONE call
|
|
16
|
+
3. `find_callers` / `find_callees` / `find_references` only for one specific relationship
|
|
17
|
+
4. Only then `Read` files at the exact lines YATS gave you
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- Max 3-5 YATS tool calls per task. Synthesize what you have.
|
|
22
|
+
- Never guess symbol names — always start with `search_code`.
|
|
23
|
+
- Prefer `expand_graph` over multiple individual calls.
|
|
24
|
+
- If YATS returns empty, try a different query before falling back to file reads.
|
|
25
|
+
- Do NOT use shell commands (`head`, `cat`, `sed`, `rg`, `grep`) to inspect code — YATS has the symbols and relationships.
|
|
26
|
+
|
|
27
|
+
## Repository
|
|
28
|
+
|
|
29
|
+
Use `path="__REPO_PATH__"` for every call — YATS identifies repos by their full path.
|
|
30
|
+
|
|
31
|
+
## At startup
|
|
32
|
+
|
|
33
|
+
Run `yats list` and check if `__REPO_PATH__` is indexed. If it's not, run:
|
|
34
|
+
|
|
35
|
+
yats index __REPO_PATH__
|
|
36
|
+
|
|
37
|
+
and wait for it to finish.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# YATS MCP stdio bridge — added by `yats connect codex`
|
|
2
|
+
# Place in .codex/config.toml (repo root) or ~/.codex/config.toml (global)
|
|
3
|
+
|
|
4
|
+
[features]
|
|
5
|
+
multi_agent = false # REQUIRED: force direct MCP tool usage
|
|
6
|
+
|
|
7
|
+
[mcp_servers.yats]
|
|
8
|
+
command = "yats"
|
|
9
|
+
args = ["bridge"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# YATS Code Intelligence
|
|
2
|
+
|
|
3
|
+
This repo is indexed by YATS MCP. You have tools: search_code, find_symbol, find_callers, find_callees, expand_graph, find_references, find_implementations, find_inheritors, find_routes, repository_summary, list_repositories.
|
|
4
|
+
|
|
5
|
+
## Rules
|
|
6
|
+
- YATS first, file reads second. YATS is ~100 tokens and instant.
|
|
7
|
+
- Max 3 YATS calls per task. After call 3, answer with what you have.
|
|
8
|
+
- Start with search_code, then find_symbol on top hits, then expand_graph.
|
|
9
|
+
- Pass `path="__REPO_PATH__"` on every call — YATS identifies repos by their full path.
|
|
10
|
+
- Do NOT invent answers — verify with YATS or read files.
|
|
11
|
+
|
|
12
|
+
## At startup
|
|
13
|
+
|
|
14
|
+
Run `yats list` and check if `__REPO_PATH__` is indexed. If it's not, run:
|
|
15
|
+
|
|
16
|
+
yats index __REPO_PATH__
|
|
17
|
+
|
|
18
|
+
and wait for it to finish.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# YATS Code Intelligence
|
|
2
|
+
|
|
3
|
+
This repo is indexed by YATS. Use these MCP tools for code questions:
|
|
4
|
+
`search_code`, `find_symbol`, `find_callers`, `find_callees`, `expand_graph`,
|
|
5
|
+
`find_references`, `find_implementations`, `find_inheritors`, `find_routes`.
|
|
6
|
+
|
|
7
|
+
## Rules
|
|
8
|
+
|
|
9
|
+
- Start with `search_code` for any codebase question.
|
|
10
|
+
- Max 3-5 YATS calls per task. Synthesize, don't keep searching.
|
|
11
|
+
- YATS returns results in ms. File reads cost thousands of tokens.
|
|
12
|
+
- Use `path="__REPO_PATH__"` for every call — YATS identifies repos by their full path.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. `search_code("your question", path="__REPO_PATH__")`
|
|
17
|
+
2. `find_symbol` on top hits
|
|
18
|
+
3. `expand_graph` or `find_callers`/`find_callees` to trace flow
|
|
19
|
+
4. Read files only at exact lines from YATS results
|
|
20
|
+
|
|
21
|
+
## At startup
|
|
22
|
+
|
|
23
|
+
Run `yats list` and check if `__REPO_PATH__` is indexed. If it's not, run:
|
|
24
|
+
|
|
25
|
+
yats index __REPO_PATH__
|
|
26
|
+
|
|
27
|
+
and wait for it to finish.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# YATS Code Intelligence
|
|
2
|
+
|
|
3
|
+
This repository is indexed by YATS MCP. You have access to a knowledge graph.
|
|
4
|
+
|
|
5
|
+
## Tools available
|
|
6
|
+
`search_code`, `find_symbol`, `find_callers`, `find_callees`, `expand_graph`,
|
|
7
|
+
`find_references`, `find_implementations`, `find_inheritors`, `find_routes`,
|
|
8
|
+
`repository_summary`, `architecture_summary`, `list_repositories`.
|
|
9
|
+
|
|
10
|
+
## GOLDEN RULE: YATS first, files second
|
|
11
|
+
- YATS queries cost ~100 tokens, return in milliseconds.
|
|
12
|
+
- Reading files costs THOUSANDS of tokens.
|
|
13
|
+
- Always try `search_code()` BEFORE reading any file.
|
|
14
|
+
|
|
15
|
+
## Workflow (3-4 steps max)
|
|
16
|
+
1. `search_code("your question", path="__REPO_PATH__")` — ALWAYS start here
|
|
17
|
+
2. `find_symbol(name, path="__REPO_PATH__")` on top 2-3 hits
|
|
18
|
+
3. `expand_graph([top1, top2], path="__REPO_PATH__")` — callers+callees in one call
|
|
19
|
+
4. Only then read files at exact lines from YATS
|
|
20
|
+
|
|
21
|
+
## Rules
|
|
22
|
+
- Max 3-5 YATS calls per task. Synthesize and answer.
|
|
23
|
+
- NEVER guess symbol names — always start with search_code.
|
|
24
|
+
- Prefer expand_graph over multiple find_symbol calls.
|
|
25
|
+
- Use `path="__REPO_PATH__"` for every call — YATS identifies repos by their full path.
|
|
26
|
+
|
|
27
|
+
## At startup
|
|
28
|
+
|
|
29
|
+
Run `yats list` and check if `__REPO_PATH__` is indexed. If it's not, run:
|
|
30
|
+
|
|
31
|
+
yats index __REPO_PATH__
|
|
32
|
+
|
|
33
|
+
and wait for it to finish.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yats-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"bin/",
|
|
42
42
|
"src/",
|
|
43
|
+
"connect/",
|
|
43
44
|
"benchmark/questions/",
|
|
44
45
|
"benchmark/targets/",
|
|
45
46
|
"benchmark/scripts/",
|
|
@@ -47,7 +48,8 @@
|
|
|
47
48
|
"README.md"
|
|
48
49
|
],
|
|
49
50
|
"scripts": {
|
|
50
|
-
"start": "node bin/setup.js"
|
|
51
|
+
"start": "node bin/setup.js",
|
|
52
|
+
"test": "node --test src/*.test.js"
|
|
51
53
|
},
|
|
52
54
|
"dependencies": {},
|
|
53
55
|
"engines": {
|
package/src/benchmark.js
CHANGED
|
@@ -297,7 +297,7 @@ let workDir = path.join(process.cwd(), "repos");
|
|
|
297
297
|
// ============================================================
|
|
298
298
|
|
|
299
299
|
const BENCH_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "benchmark");
|
|
300
|
-
const CONNECT_DIR = path.join(BENCH_DIR, "..", "
|
|
300
|
+
const CONNECT_DIR = path.join(BENCH_DIR, "..", "connect");
|
|
301
301
|
let BENCH_HOME = null;
|
|
302
302
|
|
|
303
303
|
function benchHome() {
|
|
@@ -315,127 +315,16 @@ function readConnect(agentDir, file) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
This repo is indexed by YATS (mcp__yats__* tools). Every symbol, call, and relationship is in a knowledge graph.
|
|
329
|
-
|
|
330
|
-
## Golden rule
|
|
331
|
-
|
|
332
|
-
**YATS first, Read second.** MCP tools return results in milliseconds for ~100 tokens. Reading files costs thousands of tokens and takes seconds.
|
|
333
|
-
|
|
334
|
-
## Efficient workflow
|
|
335
|
-
|
|
336
|
-
1. \`search_code\` — natural language query about the code (ALWAYS start here)
|
|
337
|
-
2. \`find_symbol\` on top 2-3 hits to get exact locations
|
|
338
|
-
3. \`find_callers\` / \`find_callees\` on 1-2 key symbols to trace the flow
|
|
339
|
-
4. \`expand_graph\` on seeds to get the full subgraph in one call
|
|
340
|
-
5. Only then \`Read\` files at the exact lines YATS gave you
|
|
341
|
-
|
|
342
|
-
## Rules
|
|
343
|
-
|
|
344
|
-
- Max 3-5 YATS tool calls per task. Synthesize what you have.
|
|
345
|
-
- Never guess symbol names — always start with \`search_code\`.
|
|
346
|
-
- Prefer \`expand_graph\` over multiple individual \`find_symbol\` calls.
|
|
347
|
-
- If YATS returns empty, try a different query before falling back to file reads.
|
|
348
|
-
- Repository name is usually the directory name. Check \`list_repositories\` if unsure.
|
|
349
|
-
`;
|
|
350
|
-
|
|
351
|
-
const CODEX_AGENTS_MD = `# YATS Code Intelligence
|
|
352
|
-
|
|
353
|
-
This repository is indexed by YATS MCP. You have these tools:
|
|
354
|
-
\`search_code\`, \`find_symbol\`, \`find_callers\`, \`find_callees\`, \`expand_graph\`,
|
|
355
|
-
\`find_references\`, \`find_implementations\`, \`find_inheritors\`, \`find_routes\`,
|
|
356
|
-
\`repository_summary\`, \`architecture_summary\`, \`list_repositories\`.
|
|
357
|
-
|
|
358
|
-
## ⚠️ ABSOLUTE HARD LIMIT: 3 TOOL CALLS TOTAL
|
|
359
|
-
|
|
360
|
-
You are allowed **AT MOST 3 YATS tool calls** for this entire task. This is a hard budget, not a suggestion.
|
|
361
|
-
|
|
362
|
-
- After your 3rd call, you MUST write your final answer immediately.
|
|
363
|
-
- Do NOT call \`find_symbol\` separately for every symbol. \`expand_graph\` returns callers + callees + neighbors in ONE call.
|
|
364
|
-
- Do NOT re-run \`search_code\` with slightly different wording.
|
|
365
|
-
- Do NOT verify each result with another call. Trust the graph.
|
|
366
|
-
- Do NOT read source files with shell commands (\`head\`, \`cat\`, \`sed\`, \`rg\`, \`grep\`). YATS already has the symbols and relationships — use the YATS tools instead.
|
|
367
|
-
- Every extra call wastes tokens and fails this task.
|
|
368
|
-
|
|
369
|
-
## Workflow (exactly 3 calls, in this order)
|
|
370
|
-
|
|
371
|
-
1. \`search_code("<your question>", repository="__REPO_NAME__")\` — call 1
|
|
372
|
-
2. \`expand_graph([top 2 symbol ids], repository="__REPO_NAME__")\` — call 2 (full subgraph)
|
|
373
|
-
3. \`find_callers("<key symbol>", repository="__REPO_NAME__")\` — call 3 (only if you still need it)
|
|
374
|
-
4. STOP. Write the answer.
|
|
375
|
-
|
|
376
|
-
## Repository
|
|
377
|
-
|
|
378
|
-
Use \`repository="__REPO_NAME__"\` for every call. Do NOT call \`list_repositories\` — the repo name is already given.
|
|
379
|
-
`;
|
|
380
|
-
|
|
381
|
-
const COPILOT_INSTRUCTIONS_MD = `# YATS Code Intelligence
|
|
382
|
-
|
|
383
|
-
This repo is indexed by YATS MCP. You have tools: search_code, find_symbol, find_callers, find_callees, expand_graph, find_references, find_implementations, find_inheritors, find_routes, repository_summary, list_repositories.
|
|
384
|
-
|
|
385
|
-
## Rules
|
|
386
|
-
- YATS first, file reads second. YATS is ~100 tokens and instant.
|
|
387
|
-
- Max 3 YATS calls per task. After call 3, answer with what you have.
|
|
388
|
-
- Start with search_code, then find_symbol on top hits, then expand_graph.
|
|
389
|
-
- Do NOT invent answers — verify with YATS or read files.
|
|
390
|
-
`;
|
|
391
|
-
|
|
392
|
-
const CURSOR_RULES_MDC = `# YATS Code Intelligence
|
|
393
|
-
|
|
394
|
-
This repo is indexed by YATS. Use these MCP tools for code questions:
|
|
395
|
-
\`search_code\`, \`find_symbol\`, \`find_callers\`, \`find_callees\`, \`expand_graph\`,
|
|
396
|
-
\`find_references\`, \`find_implementations\`, \`find_inheritors\`, \`find_routes\`.
|
|
397
|
-
|
|
398
|
-
## Rules
|
|
399
|
-
|
|
400
|
-
- Start with \`search_code\` for any codebase question.
|
|
401
|
-
- Max 3 YATS calls per task. Synthesize, don't keep searching.
|
|
402
|
-
- YATS returns results in ms. File reads cost thousands of tokens.
|
|
403
|
-
- If unsure about repo name, call \`list_repositories\` first.
|
|
404
|
-
|
|
405
|
-
## Workflow
|
|
406
|
-
|
|
407
|
-
1. \`search_code("your question", repository="<name>")\`
|
|
408
|
-
2. \`find_symbol\` on top hits
|
|
409
|
-
3. \`expand_graph\` or \`find_callers\`/\`find_callees\` to trace flow
|
|
410
|
-
4. Read files only at exact lines from YATS results
|
|
411
|
-
`;
|
|
412
|
-
|
|
413
|
-
const GEMINI_MD = `# YATS Code Intelligence
|
|
414
|
-
|
|
415
|
-
This repository is indexed by YATS MCP. You have access to a knowledge graph.
|
|
416
|
-
|
|
417
|
-
## Tools available
|
|
418
|
-
\`search_code\`, \`find_symbol\`, \`find_callers\`, \`find_callees\`, \`expand_graph\`,
|
|
419
|
-
\`find_references\`, \`find_implementations\`, \`find_inheritors\`, \`find_routes\`,
|
|
420
|
-
\`repository_summary\`, \`architecture_summary\`, \`list_repositories\`.
|
|
421
|
-
|
|
422
|
-
## GOLDEN RULE: YATS first, files second
|
|
423
|
-
- YATS queries cost ~100 tokens, return in milliseconds.
|
|
424
|
-
- Reading files costs THOUSANDS of tokens.
|
|
425
|
-
- Always try \`search_code()\` BEFORE reading any file.
|
|
426
|
-
|
|
427
|
-
## Workflow (3 steps max)
|
|
428
|
-
1. \`search_code("your question", repository="<name>")\` — ALWAYS start here
|
|
429
|
-
2. \`find_symbol(name, repository="<name>")\` on top 2-3 hits
|
|
430
|
-
3. \`expand_graph([top1, top2], repository="<name>")\` — callers+callees in one call
|
|
431
|
-
4. Only then read files at exact lines from YATS
|
|
432
|
-
|
|
433
|
-
## Rules
|
|
434
|
-
- Max 3 YATS calls per task. Synthesize and answer.
|
|
435
|
-
- NEVER guess symbol names — always start with search_code.
|
|
436
|
-
- Prefer expand_graph over multiple find_symbol calls.
|
|
437
|
-
- Repository name is usually the directory name. Check list_repositories if unsure.
|
|
438
|
-
`;
|
|
318
|
+
// Templates ship inside the package (connect/ dir) — single source of truth
|
|
319
|
+
// shared with `yats connect --install`. The benchmark always uses exactly
|
|
320
|
+
// the same instruction files the user gets on their daily workflow.
|
|
321
|
+
function requireConnect(agentDir, file) {
|
|
322
|
+
const content = readConnect(agentDir, file);
|
|
323
|
+
if (content === null) {
|
|
324
|
+
throw new Error(`Missing template: connect/${agentDir}/${file} — reinstall yats-toolkit`);
|
|
325
|
+
}
|
|
326
|
+
return content;
|
|
327
|
+
}
|
|
439
328
|
|
|
440
329
|
// Private/unknown repos (the LLM has never seen them) — the real proof.
|
|
441
330
|
const UNKNOWN_REPOS = [
|
|
@@ -829,7 +718,7 @@ function writeSkill(repoPath, withYats) {
|
|
|
829
718
|
const skillDir = path.join(repoPath, ".claude", "skills", "yats");
|
|
830
719
|
if (withYats) {
|
|
831
720
|
fs.mkdirSync(skillDir, { recursive: true });
|
|
832
|
-
fs.writeFileSync(path.join(skillDir, "SKILL.md"),
|
|
721
|
+
fs.writeFileSync(path.join(skillDir, "SKILL.md"), requireConnect("claude", "SKILL.md").replaceAll("__REPO_PATH__", path.resolve(repoPath)));
|
|
833
722
|
} else {
|
|
834
723
|
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
835
724
|
}
|
|
@@ -844,8 +733,7 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
844
733
|
process.env.CLAUDE_CONFIG_DIR = home;
|
|
845
734
|
if (agent.needsSkill) writeSkill(repoPath, withYats);
|
|
846
735
|
if (withYats) {
|
|
847
|
-
const mcp =
|
|
848
|
-
?? JSON.stringify({ mcpServers: { yats: { command: "yats", args: ["bridge"] } } });
|
|
736
|
+
const mcp = requireConnect("claude", "mcp.json");
|
|
849
737
|
fs.writeFileSync("/tmp/yats-bench-mcp.json", mcp);
|
|
850
738
|
}
|
|
851
739
|
break;
|
|
@@ -858,9 +746,10 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
858
746
|
}
|
|
859
747
|
fs.rmSync(path.join(repoPath, ".codex", "config.toml"), { force: true });
|
|
860
748
|
const model = selectedModel ?? agent.defaultModel;
|
|
861
|
-
const base =
|
|
862
|
-
|
|
863
|
-
|
|
749
|
+
const base = requireConnect("codex", "config.toml");
|
|
750
|
+
let config = /^model\s*=.*$/m.test(base)
|
|
751
|
+
? base.replace(/^model\s*=.*$/m, `model = "${model}"`)
|
|
752
|
+
: `model = "${model}"\n` + base;
|
|
864
753
|
if (withYats) {
|
|
865
754
|
if (!/\[mcp_servers\.yats\]/.test(config)) {
|
|
866
755
|
config += `\n[mcp_servers.yats]\ncommand = "yats"\nargs = ["bridge"]\n`;
|
|
@@ -870,7 +759,7 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
870
759
|
}
|
|
871
760
|
fs.writeFileSync(path.join(home, "config.toml"), config);
|
|
872
761
|
if (withYats) {
|
|
873
|
-
const content =
|
|
762
|
+
const content = requireConnect("codex", "AGENTS.md").replaceAll("__REPO_PATH__", path.resolve(repoPath));
|
|
874
763
|
fs.writeFileSync(path.join(repoPath, "AGENTS.md"), content);
|
|
875
764
|
} else {
|
|
876
765
|
fs.rmSync(path.join(repoPath, "AGENTS.md"), { force: true });
|
|
@@ -895,7 +784,7 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
895
784
|
fs.writeFileSync("/tmp/copilot-mcp.json", mcp);
|
|
896
785
|
const ghDir = path.join(repoPath, ".github");
|
|
897
786
|
fs.mkdirSync(ghDir, { recursive: true });
|
|
898
|
-
fs.writeFileSync(path.join(ghDir, "copilot-instructions.md"),
|
|
787
|
+
fs.writeFileSync(path.join(ghDir, "copilot-instructions.md"), requireConnect("copilot", "instructions.md").replaceAll("__REPO_PATH__", path.resolve(repoPath)));
|
|
899
788
|
} else {
|
|
900
789
|
fs.rmSync(path.join(repoPath, ".github", "copilot-instructions.md"), { force: true });
|
|
901
790
|
}
|
|
@@ -904,13 +793,12 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
904
793
|
|
|
905
794
|
case "cursor-config": { // Cursor
|
|
906
795
|
if (withYats) {
|
|
907
|
-
const mcp =
|
|
908
|
-
?? JSON.stringify({ mcpServers: { yats: { url: "http://localhost:5555/mcp" } } });
|
|
796
|
+
const mcp = requireConnect("cursor", "mcp.json");
|
|
909
797
|
fs.writeFileSync("/tmp/cursor-mcp.json", mcp);
|
|
910
798
|
process.env.CURSOR_MCP_CONFIG = "/tmp/cursor-mcp.json";
|
|
911
799
|
const rulesDir = path.join(repoPath, ".cursor", "rules");
|
|
912
800
|
fs.mkdirSync(rulesDir, { recursive: true });
|
|
913
|
-
fs.writeFileSync(path.join(rulesDir, "yats.mdc"),
|
|
801
|
+
fs.writeFileSync(path.join(rulesDir, "yats.mdc"), requireConnect("cursor", "rules.mdc").replaceAll("__REPO_PATH__", path.resolve(repoPath)));
|
|
914
802
|
} else {
|
|
915
803
|
delete process.env.CURSOR_MCP_CONFIG;
|
|
916
804
|
fs.rmSync(path.join(repoPath, ".cursor", "rules", "yats.mdc"), { force: true });
|
|
@@ -923,12 +811,11 @@ function setupAgent(agent, repoPath, withYats) {
|
|
|
923
811
|
process.env.GEMINI_CLI_TRUST_WORKSPACE = "true";
|
|
924
812
|
fs.rmSync(path.join(repoPath, ".gemini", "settings.json"), { force: true });
|
|
925
813
|
if (withYats) {
|
|
926
|
-
const mcp =
|
|
927
|
-
?? JSON.stringify({ mcpServers: { yats: { command: "yats", args: ["bridge"], trust: true } } });
|
|
814
|
+
const mcp = requireConnect("gemini", "mcp.json");
|
|
928
815
|
const settingsDir = path.join(home, ".gemini");
|
|
929
816
|
fs.mkdirSync(settingsDir, { recursive: true });
|
|
930
817
|
fs.writeFileSync(path.join(settingsDir, "settings.json"), mcp);
|
|
931
|
-
fs.writeFileSync(path.join(repoPath, "GEMINI.md"),
|
|
818
|
+
fs.writeFileSync(path.join(repoPath, "GEMINI.md"), requireConnect("gemini", "GEMINI.md").replaceAll("__REPO_PATH__", path.resolve(repoPath)));
|
|
932
819
|
} else {
|
|
933
820
|
fs.rmSync(path.join(home, ".gemini", "settings.json"), { force: true });
|
|
934
821
|
fs.rmSync(path.join(repoPath, "GEMINI.md"), { force: true });
|