fix: use platform-aware local defaults

- Route app DB and sqlite-vec defaults through shared platform helpers
- Mirror platform DB defaults in the standalone MCP package
- Fix Windows setup npm spawning and remove macOS-only env defaults
This commit is contained in:
“BeeRad”
2026-04-27 14:46:10 +10:00
parent c9fb623e02
commit 1019a2b846
9 changed files with 41 additions and 52 deletions
+2 -2
View File
@@ -50,13 +50,13 @@ Restart Claude fully. If you need to freeze behavior for debugging, pin an exact
## Requirements
- Node.js 18-22 LTS recommended
- a RA-H database at `~/Library/Application Support/RA-H/db/rah.sqlite`, created by `setup`, `init-db`, or the app
- a RA-H database at the platform default path, created by `setup`, `init-db`, or the app
## Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `RAH_DB_PATH` | `~/Library/Application Support/RA-H/db/rah.sqlite` | Database path |
| `RAH_DB_PATH` | Platform default app-data path | Database path |
For demos or isolated installs:
@@ -7,24 +7,32 @@ const os = require('node:os');
/**
* Get the database path.
* Priority: RAH_DB_PATH env var > default app data location
* Priority: RAH_DB_PATH env var > SQLITE_DB_PATH env var > platform app data location
*/
function getDatabasePath() {
if (process.env.RAH_DB_PATH) {
return process.env.RAH_DB_PATH;
function getDefaultDbPath() {
const homeDir = os.homedir() || process.env.HOME || '~';
if (process.platform === 'win32') {
const appData = process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming');
return path.join(appData, 'RA-H', 'db', 'rah.sqlite');
}
if (process.platform === 'darwin') {
return path.join(homeDir, 'Library', 'Application Support', 'RA-H', 'db', 'rah.sqlite');
}
// Default: ~/Library/Application Support/RA-H/db/rah.sqlite
return path.join(
os.homedir(),
'Library',
'Application Support',
process.env.XDG_DATA_HOME || path.join(homeDir, '.local', 'share'),
'RA-H',
'db',
'rah.sqlite'
);
}
function getDatabasePath() {
return process.env.RAH_DB_PATH || process.env.SQLITE_DB_PATH || getDefaultDbPath();
}
let db = null;
function getExistingColumnNames(db, tableName) {
@@ -24,7 +24,7 @@ Start with product orientation and goal discovery first.
Only bring up setup details if the user actually needs them:
1. If they are on local/BYO-key mode, point them to Settings → API Keys.
2. If they ask about the database location, tell them the default macOS path is `~/Library/Application Support/RA-H/db/rah.sqlite`.
2. If they ask about the database location, tell them RA-H uses the platform default: macOS `~/Library/Application Support/RA-H/db/rah.sqlite`, Windows `%APPDATA%/RA-H/db/rah.sqlite`, Linux `~/.local/share/RA-H/db/rah.sqlite`.
3. If API keys are relevant, explain them plainly:
- **OpenAI** — powers embeddings, semantic retrieval, and extraction-related AI work.
- **Anthropic** — mainly relevant for compatible runtime paths and local/dev setups.