Skip to content

Commit 1d5cc33

Browse files
authored
Merge pull request #421 from thevibeworks/fix/auth-store-417
feat(auth): bare --auth-with names resolve against the agent config home
2 parents ba30e5d + e6caedd commit 1d5cc33

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- `--auth-with` bare names (`claude-max.credentials.json`, no slash) resolve
12+
against the agent config home (`~/.config/deva/<agent>/`) as a named
13+
credentials store; CWD checked first for compat. Provisioning a missing
14+
bare name creates it in the store (#417)
15+
1016
## [0.14.1] - 2026-07-13
1117

1218
### Added

agents/shared_auth.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
248263
expand_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

docs/authentication.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ Example:
152152
deva.sh claude --auth-with ~/work/claude-prod.credentials.json
153153
```
154154

155+
#### Bare names: the credentials store
156+
157+
A bare `*.json` name (no slash) resolves against the agent config home
158+
(`~/.config/deva/claude/` by default) — a named credentials store:
159+
160+
```bash
161+
deva.sh claude --auth-with claude-max.credentials.json
162+
# -> ~/.config/deva/claude/claude-max.credentials.json
163+
```
164+
165+
Resolution order: current directory first (compat), then the store.
166+
With an explicit `--config-home` root, the store is `<root>/<agent>/`.
167+
A missing bare name provisions into the store.
168+
155169
#### Provisioning new credentials
156170

157171
If the file does not exist, deva offers to create it via TUI login:

0 commit comments

Comments
 (0)