diff --git a/README.md b/README.md index 2662574..794b2ce 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ A swarm intelligence prediction engine. Upload documents describing any scenario, and MiroFish simulates thousands of AI agents reacting on social media to predict how events will unfold. **Live:** [synth.scty.org](https://synth.scty.org) +**Discord:** [discord.gg/ePf5aPaHnA](https://discord.gg/ePf5aPaHnA) > Fork of [666ghj/MiroFish](https://github.com/666ghj/MiroFish) — fully translated to English, local graph storage with embedded KuzuDB by default, Claude/Codex CLI support added. diff --git a/backend/tests/test_llm_client.py b/backend/tests/test_llm_client.py new file mode 100644 index 0000000..0ec1f86 --- /dev/null +++ b/backend/tests/test_llm_client.py @@ -0,0 +1,26 @@ +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) + +from app.utils.llm_client import LLMClient + + +def test_clean_content_strips_think_tags(): + client = object.__new__(LLMClient) + + cleaned = LLMClient._clean_content( + client, + 'hidden reasoning\n{"status": "ok"}', + ) + + assert cleaned == '{"status": "ok"}' + + +def test_chat_json_accepts_markdown_fenced_json(): + client = object.__new__(LLMClient) + client.chat = lambda **kwargs: '```json\n{"status": "ok"}\n```' + + payload = LLMClient.chat_json(client, messages=[]) + + assert payload == {"status": "ok"} diff --git a/package.json b/package.json index 63ace21..d27bf82 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "dev": "concurrently --kill-others -n \"backend,frontend\" -c \"green,cyan\" \"npm run backend\" \"npm run frontend\"", "backend": "cd backend && uv run python run.py", "frontend": "cd frontend && npm run dev", - "build": "cd frontend && npm run build" + "build": "cd frontend && npm run build", + "lint": "node scripts/lint.mjs" }, "devDependencies": { "concurrently": "^9.1.2" diff --git a/scripts/lint.mjs b/scripts/lint.mjs new file mode 100644 index 0000000..be982ec --- /dev/null +++ b/scripts/lint.mjs @@ -0,0 +1,38 @@ +import { spawnSync } from 'node:child_process'; + +const shouldFix = process.argv.includes('--fix'); +const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'; + +if (shouldFix) { + console.log('No auto-fixers are configured; running verification checks only.'); +} + +const commands = [ + { + cmd: npmCommand, + args: ['run', 'build', '--prefix', 'frontend'], + }, + { + cmd: 'uv', + args: ['run', 'pytest', 'tests'], + cwd: 'backend', + env: { + UV_CACHE_DIR: '/tmp/uv-cache', + }, + }, +]; + +for (const command of commands) { + const result = spawnSync(command.cmd, command.args, { + cwd: command.cwd, + env: { + ...process.env, + ...command.env, + }, + stdio: 'inherit', + }); + + if (result.status !== 0) { + process.exit(result.status ?? 1); + } +}