Skip to content

Use .lstk/config.toml for project-local config#149

Merged
silv-io merged 1 commit intomainfrom
silv-io/flc-536
Mar 20, 2026
Merged

Use .lstk/config.toml for project-local config#149
silv-io merged 1 commit intomainfrom
silv-io/flc-536

Conversation

@silv-io
Copy link
Copy Markdown
Member

@silv-io silv-io commented Mar 20, 2026

Motivation

Local config used ./lstk.toml while all other config locations used config.toml, which was confusing — users naturally create config.toml in their project directory and it doesn't get picked up. This changes the local config to .lstk/config.toml inside a conventional dotdir, making the filename consistent across all config locations.

Changes

  • Move config path constants from containers.go to paths.go where they belong
  • Change local config path from ./lstk.toml to ./.lstk/config.toml
  • Unify on a single configFileName constant since all locations now use config.toml
  • Replace manual path search in Init() with Viper's built-in AddConfigPath/SetConfigName search
  • Replace configSearchPaths() (full file paths) with configSearchDirs() (directories only)
  • Update integration test and documentation

Tests

  • All existing integration tests pass, including TestLocalConfigTakesPrecedence updated to use the new .lstk/config.toml path

Related

@silv-io silv-io changed the title Change local config path to .lstk/config.toml Use .lstk/config.toml for project-local config Mar 20, 2026
@silv-io silv-io marked this pull request as ready for review March 20, 2026 15:08
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 97332cbe-0cee-49f1-9b02-0f2989172bad

📥 Commits

Reviewing files that changed from the base of the PR and between 9925dae and b31a1e1.

📒 Files selected for processing (6)
  • CLAUDE.md
  • README.md
  • internal/config/config.go
  • internal/config/containers.go
  • internal/config/paths.go
  • test/integration/config_test.go

📝 Walkthrough

Walkthrough

The project-local configuration file path changes from ./lstk.toml to ./.lstk/config.toml. The config initialization logic is refactored to use Viper's built-in ordered search-path mechanism instead of manual path resolution, with consolidated constants and updated directory-based path handling.

Changes

Cohort / File(s) Summary
Documentation Updates
CLAUDE.md, README.md
Updated documented config discovery paths from ./lstk.toml to ./.lstk/config.toml and CLI example usage from lstk.toml to config.toml.
Constants Reorganization
internal/config/containers.go, internal/config/paths.go
Removed unused constants localConfigFileName and userConfigFileName from containers.go; added new package-level constants (localConfigDir, configName, configType, configFileName) to paths.go for unified config artifact naming.
Path Discovery & Creation Logic
internal/config/paths.go
Replaced localConfigPath() and configSearchPaths() with directory-based configSearchDirs() returning ./.lstk, XDG config, and OS-specific paths; refactored firstExistingConfigPath() and ConfigFilePath() to work with directories and append unified configFileName.
Config Initialization Refactor
internal/config/config.go
Rewrote Init() to use Viper's AddConfigPath for ordered search-path resolution instead of manual file existence checks; added enhanced error handling distinguishing file-not-found from creation failures with clearer error messages.
Test Path Update
test/integration/config_test.go
Updated TestLocalConfigTakesPrecedence to write and assert local config at ./.lstk/config.toml instead of ./lstk.toml.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • carole-lavillonniere
  • anisaoshafi
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: moving project-local config from ./lstk.toml to ./.lstk/config.toml.
Description check ✅ Passed The description clearly explains the motivation, detailed changes, testing status, and related issue, all directly relevant to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch silv-io/flc-536
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go boring solutions! It's an elegant solution, compared to other ideas discussed.

Copy link
Copy Markdown
Contributor

@anisaoshafi anisaoshafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, local test worked fine 🎉 thanks Silvio 🙏🏼

@silv-io silv-io merged commit 380b5bd into main Mar 20, 2026
14 of 15 checks passed
@silv-io silv-io deleted the silv-io/flc-536 branch March 20, 2026 16:17
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