Add config search and creation order and set default to ~/.config/lstk/config.toml#43
Merged
Add config search and creation order and set default to ~/.config/lstk/config.toml#43
~/.config/lstk/config.toml#43Conversation
2a3e5a7 to
8a66cef
Compare
$HOME/.config/lstk/config.toml
$HOME/.config/lstk/config.toml~/.config/lstk/config.toml
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughImplements prioritized config lookup (project-local, XDG, OS), deterministic creation when missing, exposes Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as "lstk CLI"
participant Init as "initConfig (env.Init + config.Init)"
participant ConfigPkg as "internal/config"
participant FS as "Filesystem"
CLI->>Init: command invoked (PreRunE)
Init->>ConfigPkg: env.Init()
Init->>ConfigPkg: config.Init()
ConfigPkg->>FS: firstExistingConfigPath() (local, XDG, OS)
alt config exists
FS-->>ConfigPkg: return existing path
ConfigPkg-->>CLI: resolved path available
else config missing
ConfigPkg->>FS: compute creation dir (prefer ~/.config if exists)
ConfigPkg->>FS: write default config file
FS-->>ConfigPkg: confirm write
ConfigPkg-->>CLI: resolved path available
end
CLI->>CLI: Run command logic (RunE)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
# Conflicts: # cmd/root.go
cde02e8 to
89aea35
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/config/containers.go`:
- Line 44: Remove the redundant comment above the Name function; it simply
restates what the function signature and implementation already convey. Locate
the Name(...) method (the container name builder) in
internal/config/containers.go and delete the line comment that explains the
return format ("localstack-{type}" or "localstack-{type}-{tag}" if tag !=
latest), leaving the function and its implementation intact.
carole-lavillonniere
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
While
os.UserConfigDir()is the OS-standard location, most developer tools conventionally use~/.configdirectly for user-level config. To alignlstkwith common dev-tool expectations, we now prefer~/.config/lstk/config.tomlby default, and only fall back toos.UserConfigDir()/lstk/config.tomlwhen~/.configdoes not exist.To make the active config source explicit and easier to debug/document, this PR also adds a
lstk config pathcommand that prints the resolved config file path.This also unlocks project-local config support in a predictable way.
./lstk.toml>~/.config/lstk/config.toml>os.UserConfigDir()/lstk/config.toml~/.config/lstk/config.toml>os.UserConfigDir()/lstk/config.toml(if~/.configis missing)Changes
ConfigFilePath()now supports side-effect-free path resolution and returns absolute paths.ConfigDir()now reflects the resolved config file directory.lstk config pathto print the resolved configuration file path.config pathandversionTests