Skip to content

feat(cli): create empty .sandcat/settings.local.json scaffold on init - #96

Open
shejnowicz wants to merge 2 commits into
masterfrom
feat/27-create-settings-local
Open

feat(cli): create empty .sandcat/settings.local.json scaffold on init#96
shejnowicz wants to merge 2 commits into
masterfrom
feat/27-create-settings-local

Conversation

@shejnowicz

Copy link
Copy Markdown
Collaborator

Fixes #27.

Summary

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 project tree right 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.

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 absent
    • settings preserves an existing settings.local.json
  • Full init bats suite still green (133/133)

🤖 Generated with Claude Code

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>
Copilot AI lite review requested due to automatic review settings August 13, 2026 08:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.json alongside the generated settings.json during init when it doesn’t already exist.
  • Preserve any existing settings.local.json on 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.

Comment thread cli/libexec/init/settings Outdated
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.
@shejnowicz

Copy link
Copy Markdown
Collaborator Author

Addressed in 1c2ae44 — both info messages (the pre-existing Settings file created at and the new Local settings scaffold created at) now log the actual $settings_file / $local_settings variable values instead of hardcoded $SCT_PROJECT_DIR/... paths. Bats tests remain green — assert_output --partial "Settings file created at" still matches; the path portion is what changed.

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.

feat: Create other files during init

2 participants