Skip to content

Re-installing on existing config: deep-merge new write-tool permissions #8

@Astralchemist

Description

@Astralchemist

The installer's `merge-json` mode does a recursive deep-merge — but it merges only top-level mcpServers and permissions blocks. If a user installed Rig before Phase 3 landed (e.g., during Phase 1), their `~/.claude/settings.json` has the 9 light-tool perms. Re-running `rig install claude` should refresh the permissions block to include the 6 new write-tool perms and the heavy tool `ask` entries.

Current behaviour: deepMerge in `packages/cli/src/install/json-merge.ts` will replace arrays wholesale (since arrays aren't recursed into), so `permissions.allow` gets the full new list. That's actually correct for this case.

Open question is the inverse — what if a user added a sibling entry to `permissions.allow`? The new install will replace their custom entries. Two options:

  1. Union-merge arrays inside known permission blocks (preserves custom)
  2. Document the trade-off and let `rig install --reset-perms` handle the case

Recommend (1) for permissions.allow / permissions.ask specifically. Generic deep-merge stays array-replace.

Also: the existing claude.contract.ts `merge-json` template only carries mcpServers + permissions; the new `rig_*_write` entries are emitted into `generated/installer/claude.permissions.json` by gen, so re-running install picks them up automatically. The issue here is just the array-replace nuance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions