Skip to content

Commit 527d9f9

Browse files
committed
feat(store): implement dynamic database path selection
- Prioritize local `.store/documents.db` if it exists for development. - Fallback to standard OS application data directory using `env-paths`. - Add tests using `memfs` to verify path selection logic. - Update ARCHITECTURE.md and README.md with details.
1 parent 1daedbe commit 527d9f9

File tree

6 files changed

+708
-559
lines changed

6 files changed

+708
-559
lines changed

ARCHITECTURE.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ graph TD
151151

152152
### Document Storage Design
153153

154-
The project uses SQLite for document storage, providing a lightweight and efficient database solution that requires no separate server setup. Documents are stored with URLs and sequential ordering to maintain source context:
154+
The project uses SQLite for document storage, providing a lightweight and efficient database solution that requires no separate server setup.
155+
156+
**Database Location:** The application determines the database file (`documents.db`) location dynamically:
157+
158+
1. It first checks for a `.store` directory in the current working directory (`process.cwd()`). If `.store/documents.db` exists, it uses this path. This prioritizes local development databases.
159+
2. If the local `.store/documents.db` does not exist, it defaults to a standard, OS-specific application data directory (e.g., `~/Library/Application Support/docs-mcp-server/` on macOS, `~/.local/share/docs-mcp-server/` on Linux) determined using the `env-paths` library. This ensures a stable, persistent location when running via `npx` or outside a local project context.
160+
161+
Documents are stored with URLs and sequential ordering to maintain source context:
155162

156163
```mermaid
157164
graph LR

0 commit comments

Comments
 (0)