From 840a6142234a4da963f95298acff2778aa987b1e Mon Sep 17 00:00:00 2001 From: Antonio Date: Tue, 24 Mar 2026 11:07:01 -0300 Subject: [PATCH] fix: respect XDG_CACHE_HOME for model cache directory MODEL_CACHE_DIR was hardcoded to ~/.cache/qmd/models/, ignoring the XDG_CACHE_HOME environment variable. This was inconsistent with the rest of the codebase (store.ts, cli/qmd.ts) which already respects XDG paths. Fixes #425 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/llm.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/llm.ts b/src/llm.ts index 2385456..43c9742 100644 --- a/src/llm.ts +++ b/src/llm.ts @@ -209,7 +209,9 @@ export const DEFAULT_RERANK_MODEL_URI = DEFAULT_RERANK_MODEL; export const DEFAULT_GENERATE_MODEL_URI = DEFAULT_GENERATE_MODEL; // Local model cache directory -const MODEL_CACHE_DIR = join(homedir(), ".cache", "qmd", "models"); +const MODEL_CACHE_DIR = process.env.XDG_CACHE_HOME + ? join(process.env.XDG_CACHE_HOME, "qmd", "models") + : join(homedir(), ".cache", "qmd", "models"); export const DEFAULT_MODEL_CACHE_DIR = MODEL_CACHE_DIR; export type PullResult = {