Merge remote-tracking branch 'origin/main' into repo-mirror-list-name-column · Entire

Merge remote-tracking branch 'origin/main' into repo-mirror-list-name-column

1d35404→main·

gtrrz-victor·1w ago·15 files·+598 added/-103 removed

Conflicts:

cmd/entire/cli/repo_mirror.go

Changes

15


21 unmodified lines

### Command Layout

The visible CLI is organized around five noun groups plus a small set of top-level verbs. The groups are the canonical home for each verb; legacy top-level shortcuts remain functional but hidden, and emit a deprecation hint pointing at the canonical group form. Newer experimental command families are advertised through `entire labs`:

| `entire checkpoint explain` | Explain a session, commit, or checkpoint                                               |
| `entire checkpoint rewind` | Rewind to a previous checkpoint (deprecated, will be removed in a future release)       |
| `entire login`   | Authenticate the CLI with Entire device auth                                                      |
| `entire org`     | Manage Entire organizations (create, list, get, delete)                                           |
| `entire project` | Manage Entire projects (create, list, get, delete)                                                |
| `entire repo`    | Manage Entire repositories (create, list, get, delete, clone, mirror, visibility)                 |
| `entire grant`   | Manage access grants and org membership (org, project, repo)                                      |
| `entire session` | View and manage agent sessions tracked by Entire                                                  |
| `entire session resume`    | Switch to a branch, restore latest checkpointed session metadata, and show command(s) |
| `entire session attach`    | Attach to a previously detached session                                                |

MCLAUDE.md+8/-1


1 unmodified line

2
3
4
5
6
7
8
44 unmodified lines

53
54
55
56
57
58
59
60
61
62
63
64
57
58
65
66
67
68
60
69
70
62
63
71
72
73
74
75
76
77
78
69
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
23 unmodified lines

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
17 unmodified lines

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

1 unmodified line

import (
    "context"
    "net/url"
    "sort"
    "strings"
    "sync"
)

// includes the jurisdiction so entries whose index row carries no cell don't
// collapse across jurisdictions into one group routed by whichever repo came
// first — they stay per-jurisdiction and route via the jurisdiction fallback.
//
// When a RepoIndexEntry has Placements, each placement is added to the group
// for its own cell/jurisdiction with its placement-specific repo ID. This
// ensures mirror placements in other regions (e.g. a US-homed repo with an EU
// mirror) are searched in both cells — matching the BFF's fan-out behavior.
// When Placements is empty, the top-level Cell/Jurisdiction/ID are used as
// before (backward compat for index responses that predate placements).
func groupReposByCell(repos []coreapi.RepoIndexEntry) []cellGroup {
    byCell := make(map[string]*cellGroup)
    for _, r := range repos {
        id := strings.TrimSpace(r.ID)

addToGroup := func(id, cell, jurisdiction, clusterSlug string) {
            id = strings.TrimSpace(id)
            if id == "" {
                continue
                return
            }
            cell := strings.ToLower(strings.TrimSpace(r.Cell))
            jurisdiction := strings.ToLower(strings.TrimSpace(r.Jurisdiction))
            cell = strings.ToLower(strings.TrimSpace(cell))
            jurisdiction = strings.ToLower(strings.TrimSpace(jurisdiction))
            clusterSlug = strings.ToLower(strings.TrimSpace(clusterSlug))
            key := cell + "\x00" + jurisdiction
            g, ok := byCell[key]
            if !ok {
                g = &cellGroup{
                    cell:         cell,
                    clusterSlug:  strings.ToLower(strings.TrimSpace(r.ClusterSlug)),
                    jurisdiction: jurisdiction,
                }
                byCell[key] = g
            }
            // Upgrade an empty slug if a later entry provides one (a mirror
            // placement may create the group before the home placement adds the
            // slug).
            if g.clusterSlug == "" && clusterSlug != "" {
                g.clusterSlug = clusterSlug
            }
            g.repoIDs = append(g.repoIDs, id)
        }

for _, r := range repos {
        if len(r.Placements) > 0 {
            for _, p := range r.Placements {
                // Placements don't carry a cluster slug; the top-level slug
                // applies only to the home placement. RepoPlacement.Mirror is
                // the contract-guaranteed home(false)/mirror(true) marker, so
                // assign the slug to the home placement and leave mirrors
                // slugless — resolveCellBaseURLs falls back to cell/jurisdiction
                // matching for groups without a slug. (Keying off Mirror rather
                // than p.Cell == r.Cell means the join still works if the index
                // omits the top-level Cell alongside the placement array.)
                slug := ""
                if !p.Mirror {
                    slug = r.ClusterSlug
                }
                addToGroup(p.ID, p.Cell, p.Jurisdiction, slug)
            }
        } else {
            addToGroup(r.ID, r.Cell, r.Jurisdiction, r.ClusterSlug)
        }
    }

cells := make([]cellGroup, 0, len(byCell))
    for _, g := range byCell {
        cells = append(cells, *g)
    }

return cells
}