# fix(settings): recognize local-only setup so hooks run after enable --local

`8af5849`→[main](/content/gh/entireio/cli/commits/main/index.html)·

suhaanthayyil·1w ago·2 files·+48 added/-2 removed

IsSetUpAndEnabled checked only for .entire/settings.json via IsSetUp, but
`entire enable --local` writes only .entire/settings.local.json. Hooks then
fired but silently no-op'd until a plain `entire enable` created settings.json.
Use IsSetUpAny (checks either file); Load() already merges both, so the enabled
value is correct.

Closes #1123

Co-authored-by: Cursor <cursoragent@cursor.com>

## Changes

2

- cmd/entire/cli/settings

- Alocal_enabled_test.go+42

- Msettings.go+6/-2

```
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

package settings

import (
	"context"
	"os"
	"os/exec"
	"path/filepath"
	"testing"

"github.com/entireio/cli/cmd/entire/cli/paths"
)

// Regression for #1123: `entire enable --local` writes only
// .entire/settings.local.json, but the hook activation check
// (IsSetUpAndEnabled) only looked for .entire/settings.json, so hooks silently
// no-op'd. It must recognize a local-only setup.
func TestIsSetUpAndEnabled_LocalSettingsOnly(t *testing.T) {
	root := t.TempDir()
	cmd := exec.CommandContext(context.Background(), "git", "init")
	cmd.Dir = root
	if out, err := cmd.CombinedOutput(); err != nil {
		t.Fatalf("git init: %v\n%s", err, out)
	}
	entireDir := filepath.Join(root, ".entire")
	if err := os.MkdirAll(entireDir, 0o755); err != nil {
		t.Fatal(err)
	}
	// Only the local settings file exists (no settings.json), enabled.
	if err := os.WriteFile(filepath.Join(entireDir, "settings.local.json"), []byte(`{"enabled":true}`), 0o644); err != nil {
		t.Fatal(err)
	}

t.Chdir(root)
	paths.ClearWorktreeRootCache()

if IsSetUp(context.Background()) {
		t.Fatal("precondition: IsSetUp should be false with only settings.local.json")
	}
	if !IsSetUpAndEnabled(context.Background()) {
		t.Fatal("IsSetUpAndEnabled should be true when only settings.local.json exists and is enabled (#1123)")
	}
}
```

Acmd/entire/cli/settings/local_enabled_test.go+42

```
1309 unmodified lines

1310
1311
1312
1313
1313
1314
1315
1316
1317
1318
1319
1316
1320
1321
1322
1323

1309 unmodified lines

}

// IsSetUpAndEnabled returns true if Entire is both set up and enabled.
// This checks if .entire/settings.json exists AND has enabled: true.
// Setup is detected from either .entire/settings.json or
// .entire/settings.local.json (IsSetUpAny), because `entire enable --local`
// writes only the local file; checking settings.json alone made hooks silently
// no-op for local-only setups (#1123). Load() merges both files, so the
// enabled value is correct regardless of which file is present.
// Use this for hooks that should be no-ops when Entire is not active.
func IsSetUpAndEnabled(ctx context.Context) bool {
	if !IsSetUp(ctx) {
	if !IsSetUpAny(ctx) {
		return false
	}
	s, err := Load(ctx)
```
