@@ -245,10 +245,34 @@ resolve_absolute_path() {
245245 fi
246246}
247247
248+ # Bare credential names (no slash) live in the agent config home — the store.
249+ # Explicit --config-home root layouts clear CONFIG_HOME and set CONFIG_ROOT
250+ # (deva.sh), so honor the root before falling back to the XDG default.
251+ auth_store_dir () {
252+ if [ -n " ${CONFIG_HOME:- } " ]; then
253+ printf ' %s' " $CONFIG_HOME "
254+ elif [ -n " ${CONFIG_ROOT:- } " ]; then
255+ printf ' %s/%s' " $CONFIG_ROOT " " ${ACTIVE_AGENT:- claude} "
256+ elif command -v default_config_home_for_agent > /dev/null 2>&1 ; then
257+ default_config_home_for_agent " ${ACTIVE_AGENT:- claude} "
258+ else
259+ printf ' %s/deva/%s' " ${XDG_CONFIG_HOME:- $HOME / .config} " " ${ACTIVE_AGENT:- claude} "
260+ fi
261+ }
262+
248263expand_and_validate_file () {
249264 local path
250265 path=" $( expand_auth_file_tilde " $1 " ) "
251266
267+ # Bare name: CWD first (compat), then the store; provision lands in the store.
268+ if [[ " $path " != * /* ]]; then
269+ if [ -f " $path " ]; then
270+ resolve_absolute_path " $path "
271+ return
272+ fi
273+ path=" $( auth_store_dir) /$path "
274+ fi
275+
252276 if [ -f " $path " ]; then
253277 resolve_absolute_path " $path "
254278 return
@@ -257,7 +281,7 @@ expand_and_validate_file() {
257281 # File missing — attempt provision mode
258282 local dir
259283 dir=" $( dirname " $path " ) "
260- if [ ! -d " $dir " ]; then
284+ if [[ " $1 " == * / * ]] && [ ! -d " $dir " ]; then
261285 auth_error " Credentials file not found: $path " \
262286 " Parent directory does not exist: $dir "
263287 fi
0 commit comments