diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..efc6358 --- /dev/null +++ b/.env.example @@ -0,0 +1,16 @@ +# llama-server base URL +LLAMA_CPP_BASE_URL=http://127.0.0.1:8080 + +# llama-server model names +LLAMA_CPP_EMBEDDING_MODEL=embeddinggemma-300m +LLAMA_CPP_MODEL= +LLAMA_CPP_MODEL_PATH=models/embeddinggemma-300m-q4_0.gguf + +# Embedding dimension (384 for Gemma 3 300M) +VEC_DIM=384 + +# MCP Server port +MCP_PORT=3000 + +# Database path +DB_PATH=data/vector.db diff --git a/.gitignore b/.gitignore index d2dbc3f..e69ade0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,10 +11,11 @@ *.lcov # logs -logs -_.log -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json -# SQLite +logs/ +*.log + +# SQLite & Data +data/ *.db *.db-journal @@ -23,56 +24,28 @@ !.vscode/launch.json !.vscode/tasks.json -# MCP Config -mcp.json - # dotenv environment variable files .env -.env.development.local -.env.test.local -.env.production.local .env.local -# secrets / credentials -*.pem -*.key -*.pfx -*.p12 -*.crt -*.cer -*.der -id_rsa -id_rsa.pub -secrets.json -credentials.json -.npmrc - -# caches -.eslintcache -.cache -*.tsbuildinfo - -# IntelliJ based IDEs -.idea - -# Finder (MacOS) folder config -.DS_Store - # Journals journals/ -# Rust/Tauri +# Rust/Tauri (Build Artifacts) target/ -src-tauri/target/ -src-tauri/bin/*.exe -src-tauri/bin/*.dll -src-tauri/resources/*.dll +src/backend/gen/ + +# Binaries & DLLs +bin/*.exe +bin/*.dll +resources/*.dll +*.zip +*_extracted/ # Models models/ *.gguf -# Temp/Extracted -*.zip -*_extracted/ -src-tauri/build_error.txt +# Compilation Artifacts +src/backend/build_error*.txt +src/backend/test_errors.txt diff --git a/README.md b/README.md index 24faf25..f626f04 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,28 @@ --- +## 📁 ディレクトリ構成 + +プロジェクトは、論理的な役割に基づいて以下のように「合理的」に整理されています。 + +```text +. +├── bin/ # 🚀 サイドカーバイナリ (llama-server等) +├── data/ # 🗄️ データベースファイル (vector.db) +├── document/ # 📚 技術詳細ドキュメント +├── journals/ # 開発の軌跡(非公開) +├── logs/ # 📝 実行ログ (開発時) +├── resources/ # 🎨 静的アセット (icons等) +├── scripts/ # 🏗️ セットアップ・自動化スクリプト +├── src/ +│ ├── backend/ # 🦀 Tauri / Rust (Core Source Only) +│ └── frontend/ # ⚛️ Webview UI (React) +├── target/ # 🏗️ ビルド成果物 (一括集約) +└── test/ # 🧪 E2E / 統合テスト +``` + +--- + ## 🏗️ システムアーキテクチャ 本システムは、高い分離性と連携性を両立した 3 レイヤー構造を採用しています。 @@ -80,29 +102,22 @@ ### プリリクエスト -- **Rust**: 1.75 以上 -- **Bun** (または Node.js): パッケージ管理用 -- **Vulkan 1.3 互換ドライバ**: GPU 加速を利用する場合 - ### 1. セットアップ -専用のスクリプトを使用して、必要なバイナリとモデルを自動的に収集します。 +依存関係のインストールと、必要なバイナリ・モデルのダウンロードを一括で行います。 -```powershell -# llama-server バイナリのダウンロード (Windows 用) -pwsh -File scripts/setup-llama-server-vulkan.ps1 - -# Gemma 3 300M モデルのダウンロード -pwsh -File scripts/setup-model.ps1 +```bash +bun install +bun setup ``` ### 2. 開発起動 ```bash -bun install -bun tauri dev +bun dev ``` +または、プロジェクトルートの `launch.cmd` をダブルクリックするだけでも起動可能です。 起動後、システムトレイに 🦀 アイコンが表示されます。 --- diff --git a/package.json b/package.json index 97978ba..057ad51 100644 --- a/package.json +++ b/package.json @@ -26,11 +26,9 @@ "license": "ISC", "scripts": { "test": "bun test test/**/*.test.js", - "test:db": "bun test test/db.test.js", - "test:llama": "bun test test/llama-client.test.js", - "test:tools": "bun test test/mcp-tools.test.js", - "test:handlers": "bun test test/mcp-handlers.test.js", - "test:integration": "bun test test/integration.test.js", + "setup": "pwsh -File scripts/setup-llama-server-vulkan.ps1 && pwsh -File scripts/setup-model.ps1", + "dev": "tauri --config src/backend/tauri.conf.json dev", + "build": "tauri --config src/backend/tauri.conf.json build", "tauri": "tauri --config src/backend/tauri.conf.json", "test:watch": "bun test --watch test/**/*.test.js" }, diff --git a/src/backend/.cargo/config.toml b/src/backend/.cargo/config.toml new file mode 100644 index 0000000..9766b81 --- /dev/null +++ b/src/backend/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target-dir = "../../target"