feat(cli): create empty .sandcat/settings.local.json scaffold on init - #96
feat(cli): create empty .sandcat/settings.local.json scaffold on init#96shejnowicz wants to merge 2 commits into
Conversation
The mitmproxy addon has always read a third settings layer at
.sandcat/settings.local.json for per-machine overrides (highest
precedence, above the team-shared settings.json), and sandcat's
.gitignore template already keeps it out of git — but the file itself
was never scaffolded. Users had to know the convention exists.
Create an empty {} file on `sandcat init` when it doesn't already
exist, so the layer is visible in the tree next to settings.json.
Existence check preserves any real credentials the user may have
added on a re-init; unlike settings.json (which is regenerated from
template), settings.local.json is never overwritten.
Fixes #27.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a small UX improvement to the sandcat init flow by scaffolding the previously “hidden” per-machine settings override layer (settings.local.json) when absent, and extends the init Bats tests to cover both creation and non-overwrite behavior.
Changes:
- Create an empty
settings.local.jsonalongside the generatedsettings.jsonduring init when it doesn’t already exist. - Preserve any existing
settings.local.jsonon re-init (no overwrite). - Add Bats tests validating scaffold creation and preservation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cli/libexec/init/settings | Adds conditional creation of settings.local.json scaffold during settings init. |
| cli/test/init/settings.bats | Adds tests ensuring settings.local.json is created when absent and preserved when present. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Both info messages in the settings function hardcoded $SCT_PROJECT_DIR/... paths, but the function accepts an explicit settings_file argument (and derives the local one from it). When called with a non-standard path — including in bats tests where BATS_TEST_TMPDIR is the target — the logs misreport where the files were actually written. Use the real $settings_file / $local_settings values so the output matches the actual write location in every call context.
|
Addressed in |
Fixes #27.
Summary
The mitmproxy addon has always read a third settings layer at
.sandcat/settings.local.jsonfor per-machine overrides (highest precedence, above the team-sharedsettings.json), and sandcat's.gitignoretemplate already keeps it out of git — but the file itself was never scaffolded. Users had to know the convention exists.Create an empty
{}file onsandcat initwhen it doesn't already exist, so the layer is visible in the project tree right next tosettings.json. Existence check preserves any real credentials the user may have added on a re-init; unlikesettings.json(which is regenerated from template),settings.local.jsonis never overwritten.Closes the third sub-request of #27. The other two ("create global settings with credentials" + "add local settings to .gitignore automatically") were already implemented earlier — see the issue body for the full trio.
Test plan
cli/test/init/settings.bats— 4/4 pass, including two new tests:settings creates empty settings.local.json scaffold when absentsettings preserves an existing settings.local.json🤖 Generated with Claude Code