docs: rename gate to Visible/IsVisible for clearer semantics · Entire

docs: rename gate to Visible/IsVisible for clearer semantics

8584dac→main·

gtrrz-victor·1w ago·1 file·+20 added/-17 removed

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KX5JMAP3T5PR03GYHJ4K14MWView transcript

[?
Experimental Command Gating with Visibility FlagCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019f46c2-afcf-7472-9a2e-1f10d66becc9#timeline-01KX5JMAP3T5PR03GYHJ4K14MW/index.html) [?
Cobra CLI Command Grouping and GatingClaude Code·Opus 4.8[1m]·1 step](/content/gh/entireio/cli/session/ad57b47f-bbe3-4801-879d-635952769b85#timeline-01KX5JMAP3T5PR03GYHJ4K14MW/index.html)

Changes

1

62 unmodified lines

63
64
65
66
67
68
69
70
66
67
68
69
70
71
72
73
74
72
73
75
76
77
78
79
7 unmodified lines

87
88
89
87
90
91
92
93
23 unmodified lines

117
118
119
117
118
120
121
122
123
124
122
125
126
127
128
12 unmodified lines

141
142
143
141
142
143
144
145
146
147
145
146
148
149
150
148
151
152
153
154

62 unmodified lines

import "github.com/spf13/cobra"

// State is stamped by GoReleaser via ldflags
// (-X github.com/entireio/cli/cmd/entire/cli/experimental.State=false)
// to hide experimental commands in shipped binaries. It defaults to "true",
// so every non-release build (go build, go run, mise) shows them.
var State = "true"
// Visible controls whether experimental commands are shown in help. It is
// stamped by GoReleaser via ldflags
// (-X github.com/entireio/cli/cmd/entire/cli/experimental.Visible=false)
// to hide them in shipped binaries. It defaults to "true", so every
// non-release build (go build, go run, mise) shows them. The commands remain
// experimental and fully runnable regardless of this flag — it only toggles
// visibility.
var Visible = "true"

// Enabled reports whether experimental commands are visible.
func Enabled() bool { return State != "false" }
// IsVisible reports whether experimental commands are shown in help.
func IsVisible() bool { return Visible != "false" }

// GroupID is the cobra group experimental commands are filed under.
const GroupID = "experimental"
7 unmodified lines

if !parent.ContainsGroup(GroupID) {
        parent.AddGroup(&cobra.Group{ID: GroupID, Title: groupTitle})
    }
    child.Hidden = !Enabled()
    child.Hidden = !IsVisible()
    child.GroupID = GroupID
    parent.AddCommand(child)
}
23 unmodified lines

### Build gating

- Dev — `go build ./cmd/entire`, `go run`, mise: no ldflags → `State="true"` →
  experimental visible and grouped.
- Dev — `go build ./cmd/entire`, `go run`, mise: no ldflags → `Visible="true"
  → experimental visible and grouped.
- Release — both GoReleaser configs, `entire` binary only (not
  `git-remote-entire`), add to the `ldflags` list:
  ```
  -X github.com/entireio/cli/cmd/entire/cli/experimental.State=false
  -X github.com/entireio/cli/cmd/entire/cli/experimental.Visible=false
  ```
  - `.goreleaser.yaml` (prod `entire` build)
  - `.goreleaser.nonprod.yaml` (nightly/internal — also hidden, per decision)
12 unmodified lines

## Testing

- `cmd/entire/cli/experimental/experimental_test.go`: truth table for
  `Enabled()` (`State` = "true" / "false" / "" / arbitrary). Save/restore
  `State`; cannot `t.Parallel()` (mutates package global).
- cli-level test (in the `cli` package): flip `experimental.State`, build the
  `IsVisible()` (`Visible` = "true" / "false" / "" / arbitrary). Save/restore
  `Visible`; cannot `t.Parallel()` (mutates package global).
- cli-level test (in the `cli` package): flip `experimental.Visible`, build the
  root command, and assert:
  - release (`State="false"`): each of the 10 commands has `Hidden == true`.
  - dev (`State="true"`): each has `Hidden == false`, `GroupID == "experimental"`,
  - release (`Visible="false"`): each of the 10 commands has `Hidden == true`.
  - dev (`Visible="true"`): each has `Hidden == false`, `GroupID == "experimental"`,
    and the parent reports `ContainsGroup("experimental")`.
  - Cannot `t.Parallel()` — mutates the global `State`; save/restore in the test.
  - Cannot `t.Parallel()` — mutates the global `Visible`; save/restore in the test.

## Non-goals

Mdocs/superpowers/specs/2026-07-10-experimental-command-gating-design.md+20/-17