yats-toolkit 0.3.2 → 0.3.3

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/README.md CHANGED
@@ -126,7 +126,7 @@ See the [GitHub repository](https://github.com/fvinciarelli/yats.ai) for the ful
126
126
  ```bash
127
127
  yats setup
128
128
  ```
129
- Runs the one-time setup wizard. Detects if YATS is already running, asks for embedding provider (Ollama/OpenAI/Mistral/Voyage), API keys if needed, batch size, docs indexing preference, optional pre-index directories, and MCP port. Generates `~/.yats/docker-compose.yml` and starts all services.
129
+ Runs the one-time setup wizard. Detects if YATS is already running, asks for embedding provider (Ollama/OpenAI/Mistral/Voyage), API keys if needed, batch size, docs indexing preference, optional pre-index directories, and MCP port. Generates `~/.yats/docker-compose.yml`, writes `~/.yats/.env` (embedding keys plus empty `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GEMINI_API_KEY` / `DEEPSEEK_API_KEY` placeholders for `yats benchmark`), and starts all services.
130
130
 
131
131
  ```bash
132
132
  yats index <path> [--skip-docs]
@@ -176,8 +176,9 @@ codebase questions with and without YATS. Supports Claude, Codex, Copilot, Gemin
176
176
  and Cursor (CLI). Clones/indexes test repos and saves results with averages.
177
177
 
178
178
  **Where your agent's keys come from** — the benchmark runs *your* agent, which uses
179
- *your* credentials with its provider. It auto-loads `.env` (from the current dir,
180
- walking up to the repo root) into the environment; shell env vars take precedence.
179
+ *your* credentials with its provider. It loads `~/.yats/.env` (written by `yats setup`,
180
+ which pre-fills the agent key names) and any `.env` in the current dir or repo root;
181
+ shell env vars take precedence.
181
182
 
182
183
  | Agent | Credential |
183
184
  |---|---|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yats-toolkit",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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
@@ -416,6 +416,23 @@ async function loadEnv() {
416
416
  return env;
417
417
  }
418
418
 
419
+ // Merge embedding + benchmark keys into the env map before writing ~/.yats/.env.
420
+ // Benchmark agent keys are added empty (if missing) so users see exactly what to
421
+ // fill in for `yats benchmark`; any existing values are preserved.
422
+ export function applyEnvKeys(envMap, { provider, apiKey, model }) {
423
+ envMap.EMBEDDING_PROVIDER = provider;
424
+ envMap.YATS_PROVIDER = provider;
425
+ if (provider === "openai" && apiKey) envMap.EMBEDDING_OPENAI_API_KEY = apiKey;
426
+ if (provider === "mistral" && apiKey) envMap.EMBEDDING_MISTRAL_API_KEY = apiKey;
427
+ if (provider === "voyage" && apiKey) envMap.EMBEDDING_VOYAGE_API_KEY = apiKey;
428
+ const modelVar = { openai: "EMBEDDING_OPENAI_MODEL", mistral: "EMBEDDING_MISTRAL_MODEL", voyage: "EMBEDDING_VOYAGE_MODEL", ollama: "EMBEDDING_OLLAMA_MODEL" }[provider];
429
+ if (model && modelVar) envMap[modelVar] = model;
430
+ for (const k of ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "GEMINI_API_KEY", "DEEPSEEK_API_KEY"]) {
431
+ if (!(k in envMap)) envMap[k] = "";
432
+ }
433
+ return envMap;
434
+ }
435
+
419
436
  async function testApiConnection(provider, apiKey) {
420
437
  const endpoints = {
421
438
  openai: { url: "https://api.openai.com/v1/embeddings", key: apiKey, body: { model: "text-embedding-3-small", input: ["test"] } },
@@ -743,15 +760,8 @@ async function main(options = {}) {
743
760
  writeFileSync(MCP_CONFIG_FILE, JSON.stringify(mcpConfig, null, 2));
744
761
 
745
762
  // Persist keys to ~/.yats/.env — canonical source (embedding + benchmark keys).
746
- // Merge with any keys the user already added (e.g. ANTHROPIC_API_KEY, GEMINI_API_KEY).
747
763
  const envMap = loadEnv();
748
- envMap.EMBEDDING_PROVIDER = provider;
749
- envMap.YATS_PROVIDER = provider;
750
- if (provider === "openai" && apiKey) envMap.EMBEDDING_OPENAI_API_KEY = apiKey;
751
- if (provider === "mistral" && apiKey) envMap.EMBEDDING_MISTRAL_API_KEY = apiKey;
752
- if (provider === "voyage" && apiKey) envMap.EMBEDDING_VOYAGE_API_KEY = apiKey;
753
- const modelVar = { openai: "EMBEDDING_OPENAI_MODEL", mistral: "EMBEDDING_MISTRAL_MODEL", voyage: "EMBEDDING_VOYAGE_MODEL", ollama: "EMBEDDING_OLLAMA_MODEL" }[provider];
754
- if (model && modelVar) envMap[modelVar] = model;
764
+ applyEnvKeys(envMap, { provider, apiKey, model });
755
765
  writeFileSync(ENV_FILE, Object.entries(envMap).map(([k, v]) => `${k}=${v}`).join("\n") + "\n");
756
766
 
757
767
  // Pull the YATS Docker image from GitHub Container Registry