# docs(setup): correct settings-scope comments; cover merged hook path

`4b79c94`→[main](/content/gh/entireio/cli/commits/main/index.html)

Fix two factual comment errors flagged in review:
- The #1140 e2e test claimed `entire status` still showed disabled. It did not: settings.local.json (enabled:true) overrides settings.json in the merged view status reads, so status showed enabled; only the committed file was stale. Reword to the accurate symptom.
- setEnabledFlag's doc said it operated on raw content "unlike" saveEnabledState (implying saveEnabledState writes the merged view) and overclaimed a bidirectional sync. Make setEnabledFlag the canonical merged-vs-scoped explanation (one-directional project->local sync), and reduce the other sites to one-line pointers.

Polish: add a merged-view assertion for absolute_git_hook_path (a mutation reverting it to the scoped struct now fails), assert the #1140 e2e leaves no contradicting local override after re-enable, and replace hardcoded line numbers / a truncated finding id in test docs with symbol names.

## Changes

3

- cmd/entire/cli

- integration_test
    - Missue_1140_enable_state_e2e_test.go+36/-2
  - Msetup.go+32/-27
  - Msetup_test.go+69/-10

```plaintext
12 unmodified lines

// reproduction of #1140: after `entire disable --project`, running
// `entire enable --checkpoint-remote ...` with no --project/--local reported
// success but wrote the enabled flag to .entire/settings.local.json, leaving the
// project .entire/settings.json the user disabled still enabled=false. `entire
// status` then still showed disabled.
// project .entire/settings.json the user disabled still enabled=false.

```

// assertLocalSettingsAbsentOrEnabled asserts that .entire/settings.local.json,
// if present, does not carry an enabled:false override that would mask the
// committed project scope.
func assertLocalSettingsAbsentOrEnabled(t *testing.T, env *TestEnv) {
    t.Helper()
    localPath := filepath.Join(env.RepoDir, ".entire", "settings.local.json")
    data, err := os.ReadFile(localPath)
    if os.IsNotExist(err) {
        return
    }
    if err != nil {
        t.Fatalf("read .entire/settings.local.json: %v", err)
    }
    var s struct {
        Enabled *bool `json:"enabled"`
    }
    if err := json.Unmarshal(data, &s); err != nil {
        t.Fatalf("parse .entire/settings.local.json: %v\ncontent: %s", err, data)
    }
    if s.Enabled != nil && !*s.Enabled {
        t.Fatalf("settings.local.json carries enabled:false, which would mask the re-enabled project scope\ncontent: %s", data)
    }
}

// assertProjectSettingsEnabled reads .entire/settings.json (the project scope,

```

// setEnabledFlag flips only the "enabled" key in the target settings file's
// raw JSON, and also updates the other scope's file if it exists, so
// local/project can't get out of sync. Unlike saveEnabledState, this operates
// on each file's own raw content rather than the LoadEntireSettings merged
// view: that view flattens settings.local.json overrides (local_dev,
// log_level, personal strategy_options/checkpoint_remote, ...) on top of
// settings.json, so writing the merged struct back through SaveEntireSettings
// would leak a developer's local-only overrides into the shared, committed
// project file whenever a bare `entire enable`/`entire disable` resolves to
// settings.json (#1140). Merge semantics still apply everywhere enable/
// disable *read* current state (e.g. IsEnabled); only the write path needs to
// stay scoped to the target file.
func setEnabledFlag(ctx context.Context, enabled, useProjectSettings bool) error {

// TestSetupAgentHooksNonInteractive_DoesNotLeakLocalOverridesIntoProject
// covers finding 019f5185-5be: `entire enable --agent <name>` on an
// already-configured repo used to load the merged settings view and write it
// back wholesale to the project file, flattening settings.local.json-only
// overrides (e.g. log_level) into the shared, committed settings.json.
func TestSetupAgentHooksNonInteractive_DoesNotLeakLocalOverridesIntoProject(t *testing.T) {
    setupTestRepo(t)
    writeSettings(t, testSettingsEnabled)
}

// TestSetupAgentHooksNonInteractive_UsesMergedViewForHookInstall covers the
// finding at cmd/entire/cli/setup.go:1747: setupAgentHooksNonInteractive
// loads settings.LoadFromFile(targetFileAbs), scoped to a single file, for
// building the settings struct it writes.
