Skip to content

Deep merge hooksConfig/hooks settings across scopes #1802

@acoliver

Description

@acoliver

Problem

In `packages/cli/src/config/settings.ts` line ~322, `hooksConfig` and `hooks` objects are merged across settings scopes (system, user, workspace) using shallow spread (`...spread`).

This means a higher-precedence scope that sets only one nested field (e.g., workspace sets `hooksConfig.disabled`) completely replaces the entire lower-precedence `hooksConfig` object, silently dropping other fields like `enabled` or `notifications` from the user scope.

Expected Behavior

Settings scopes should deep-merge nested objects so that workspace-level overrides only replace the specific nested fields they define, preserving unrelated fields from lower-precedence scopes.

Reproduction

  1. Set user-level: `hooksConfig: { enabled: true, disabled: ['hookA'] }`
  2. Set workspace-level: `hooksConfig: { disabled: [] }`
  3. Observe: `enabled` is lost from the merged result

Context

Discovered during CodeRabbit review of PR #1797 (gmerge/0.26.0). Requires careful deep-merge logic and thorough testing to avoid breaking other settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code Quality / ModularizationIssues to do with the quality of llxprt code and its maintainability.

    Type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions