Skip to content

feat(claude-config-backup): host-prefix the layout and track machine-settings.json - #18

Merged
twistedmelonman merged 1 commit into
mainfrom
claude/feat-backup-machine-settings-1fbd36f4
Oct 28, 2026
Merged

twistedmelonman merged 1 commit into
mainfrom
claude/feat-backup-machine-settings-1fbd36f4

Conversation

@twistedmelonman

Copy link
Copy Markdown
Member

Steps 1 and 2 of dev-env docs/plans/2026-10-28-machine-settings-sync.md, un-deferred after ASIAGO's machine-settings.json lost its sandbox, hooks, permissions and enabledPlugins keys on 2026-10-28 with no record of what it held.

  • Each host writes only <HOST>/cli/claude.json, <HOST>/desktop/claude_desktop_config.json and now <HOST>/machine-settings.json, with the same quiescence, JSON and gitleaks gates.
  • <HOST> is hostname -s, uppercased, and must match ^[A-Z0-9][A-Z0-9-]*$. Not scutil: inside the Claude Code sandbox it cannot reach configd and prints placeholder names. CLAUDE_CONFIG_BACKUP_HOST overrides it (tests use it).
  • The script refuses to run on arich-mac (host name ARICH-MAC* or the arich login): company config stays out of this personal repo.
  • First run: root-level cli/ and desktop/ move into <HOST>/ with git mv, in a commit of their own. Both layouts present → ERROR, nothing changes.

Rollout order matters: ASIAGO must run the migration before any other host runs this script. A different host would otherwise see ASIAGO's root-level files and move them into its own folder. Only ASIAGO runs the job today (plan step 3, other machines, is not started).

Tests: tests/claude-config-backup.bats 23/23 (16 new). Against the old script, 18 of 23 fail.

…settings.json

Each host now writes only <HOST>/cli, <HOST>/desktop and
<HOST>/machine-settings.json, so several machines can share the backup
repo. The overlay is the per-machine --settings file claude-wrapper
passes; it is in no other repo, and on 2026-10-28 ASIAGO's copy lost its
sandbox, hooks, permissions and enabledPlugins keys with no record of
what it held. It gets the same quiescence, JSON and gitleaks gates.

The host label is CLAUDE_CONFIG_BACKUP_HOST, else `hostname -s`
uppercased. Not scutil: inside the Claude Code sandbox it cannot reach
configd and prints placeholder names ("MacBook-Air"), while hostname -s
gives the real name in and out of the sandbox. It must match
^[A-Z0-9][A-Z0-9-]*$, so it is never empty and never holds '/' or '..'.

The script refuses to run on arich-mac, the company machine, detected
by host name or by its "arich" login: company config must not go into
a personal repo.

The first run moves root-level cli/ and desktop/ into <HOST>/ with
git mv, in a commit of its own. If old and new folders both exist it
logs ERROR and changes nothing. The move goes through GIT_BIN so tests
can stub it.
@twistedmelonman
twistedmelonman merged commit 980d586 into main Oct 28, 2026
6 checks passed
@twistedmelonman
twistedmelonman deleted the claude/feat-backup-machine-settings-1fbd36f4 branch October 28, 2026 20:14
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.

1 participant