Skip to content

feat: read config from ~/.config/stackdog and add stackdog init - #26

Merged
vsilent merged 2 commits into
mainfrom
feat/xdg-config
Nov 13, 2026
Merged

vsilent merged 2 commits into
mainfrom
feat/xdg-config

Conversation

@vsilent

@vsilent vsilent commented Nov 13, 2026

Copy link
Copy Markdown
  • Config resolution, nearest first: real environment variables > .env in the working directory > ~/.config/stackdog/.env ($XDG_CONFIG_HOME/stackdog/.env when set). dotenvy never overrides an already-set variable, so the nearest file wins. A missing file is no longer a warning — every setting has a default.
  • stackdog init: writes the starter config to that directory and never overwrites an existing file (it holds credentials). The template is the repo's .env.sample, embedded in the binary (include_str!), so it works for cargo install and brew where no sample file sits next to the binary.
  • Docs: README section "Where the config lives", header note in .env.sample, CHANGELOG.
  • Verified by hand against a throwaway HOME: init creates the file, a second run reports it exists and leaves it alone. 469+8+108 tests pass, clippy -D warnings and fmt clean.

Context: after cargo install or brew install no .env is created anywhere (binary only). This turns the manual cp .env.sample .env into one command with a canonical location. No auto-creation on install, by decision.

Configuration resolution, nearest first: real environment variables,
then ./.env in the working directory, then ~/.config/stackdog/.env
($XDG_CONFIG_HOME/stackdog/.env when set). dotenvy never overrides an
already-set variable, so the nearest file wins. A missing file is no
longer a warning: every setting has a default.

stackdog init writes the starter config to the config directory and
never overwrites an existing file, since it holds credentials. The
template is the repo's .env.sample, embedded in the binary so it works
for cargo install and brew, where no sample file sits next to the
binary.

Verified by hand against a throwaway HOME: init creates the file, a
second run reports it exists and leaves it alone. 469+8+108 tests pass,
clippy -D warnings and fmt clean.
@vsilent

vsilent commented Nov 13, 2026

Copy link
Copy Markdown
Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	CHANGELOG.md

Co-authored-by: vsilent <42473+vsilent@users.noreply.github.com>

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved in merge commit 8a68660. Targeted alerting tests and the init smoke test pass. Formatting still reports pre-existing differences in src/main.rs.

@vsilent
vsilent merged commit 71d887b into main Nov 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants