yats-toolkit 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/setup.js +15 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yats-toolkit",
3
- "version": "0.1.1",
3
+ "version": "0.1.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": "MIT",
package/src/setup.js CHANGED
@@ -297,8 +297,11 @@ async function checkPort(port) {
297
297
  }
298
298
 
299
299
  async function checkYatsRunning() {
300
+ // Check if the compose file from a previous setup exists
301
+ if (!existsSync(COMPOSE_FILE)) return false;
302
+ // Check if the YATS setup container is actually running
300
303
  return new Promise((resolve) => {
301
- const proc = spawn("docker", ["ps", "--format", "{{.Names}}", "--filter", "name=yats"], { stdio: "pipe" });
304
+ const proc = spawn("docker", ["ps", "--format", "{{.Names}}", "--filter", "name=yats-yats"], { stdio: "pipe" });
302
305
  let out = "";
303
306
  proc.stdout.on("data", (d) => (out += d));
304
307
  proc.on("close", () => resolve(out.trim().length > 0));
@@ -383,12 +386,18 @@ async function main() {
383
386
  // Check for existing YATS containers BEFORE the wizard
384
387
  const existingContainers = await checkYatsRunning();
385
388
  if (existingContainers) {
386
- console.log(` ${Y}YATS containers are already running.${R}`);
387
- console.log("");
388
- console.log(` To start fresh, run this first ${B}(destroys all indexed data):${R}`);
389
- console.log(` ${C}docker compose -f ~/.yats/docker-compose.yml down -v${R}`);
389
+ // Try to read the port from the existing compose/env
390
+ let port = 5555;
391
+ try {
392
+ const composeContent = require("fs").readFileSync(COMPOSE_FILE, "utf-8");
393
+ const match = composeContent.match(/YATS_PORT=(\d+)/) || composeContent.match(/"(\d+):(\d+)"/);
394
+ if (match) port = parseInt(match[1] || match[2], 10);
395
+ } catch {}
396
+
397
+ console.log(` ${G}✓${R} YATS is already running on ${C}http://localhost:${port}/mcp${R}`);
390
398
  console.log("");
391
- console.log(` Then re-run ${B}npx yats-toolkit${R}`);
399
+ console.log(` To start fresh ${B}(destroys all indexed data):${R}`);
400
+ console.log(` ${C}cd ~/.yats && docker compose down -v${R}`);
392
401
  console.log("");
393
402
  process.exit(0);
394
403
  }