Skip to content

Commit 3e53cae

Browse files
lroolleclaude
andcommitted
feat(auth): resolve bare --auth-with names against the agent config home
Bare *.json names (no slash) now act as store names: CWD first for compat, then ~/.config/deva/<agent>/. Provisioning a missing bare name creates it in the store instead of erroring with a path the user never typed. - auth_store_dir: CONFIG_HOME when set, else agent default config home - slash paths keep CWD-relative/absolute behavior and the parent-dir check; bare names skip it (store dir is created on provision) Closes #417 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent ba30e5d commit 3e53cae

3 files changed

Lines changed: 40 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: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,30 @@ resolve_absolute_path() {
245245
fi
246246
}
247247

248+
# Bare credential names (no slash) live in the agent config home — the store.
249+
auth_store_dir() {
250+
if [ -n "${CONFIG_HOME:-}" ]; then
251+
printf '%s' "$CONFIG_HOME"
252+
elif command -v default_config_home_for_agent >/dev/null 2>&1; then
253+
default_config_home_for_agent "${ACTIVE_AGENT:-claude}"
254+
else
255+
printf '%s/deva/%s' "${XDG_CONFIG_HOME:-$HOME/.config}" "${ACTIVE_AGENT:-claude}"
256+
fi
257+
}
258+
248259
expand_and_validate_file() {
249260
local path
250261
path="$(expand_auth_file_tilde "$1")"
251262

263+
# Bare name: CWD first (compat), then the store; provision lands in the store.
264+
if [[ "$path" != */* ]]; then
265+
if [ -f "$path" ]; then
266+
resolve_absolute_path "$path"
267+
return
268+
fi
269+
path="$(auth_store_dir)/$path"
270+
fi
271+
252272
if [ -f "$path" ]; then
253273
resolve_absolute_path "$path"
254274
return
@@ -257,7 +277,7 @@ expand_and_validate_file() {
257277
# File missing — attempt provision mode
258278
local dir
259279
dir="$(dirname "$path")"
260-
if [ ! -d "$dir" ]; then
280+
if [[ "$1" == */* ]] && [ ! -d "$dir" ]; then
261281
auth_error "Credentials file not found: $path" \
262282
"Parent directory does not exist: $dir"
263283
fi

docs/authentication.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ 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 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+
A missing bare name provisions into the store.
167+
155168
#### Provisioning new credentials
156169

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

0 commit comments

Comments
 (0)