feat(control-plane): accept org/project names + close two API gaps · Entire
feat(control-plane): accept org/project names + close two API gaps
1f4ec38·
toothbrush·3w ago·6 files·+446 added/-20 removed
Control-plane commands now accept an org/project name wherever they previously required the parent's ULID: repo create --project, repo list, project create --owner (org owners), and grant org/project args. A ULID is detected by shape and passed through unchanged (no extra lookup); anything else is resolved by name, with clear errors on no-match or ambiguity.
Also surfaces two existing-but-unwired API operations:
- entire project list --org <name|ULID> (ListOrgProjects)
- entire grant project remove --provider/--provider-user-id (RevokeProjectAccessByProvider), alongside the existing --grantee-* form
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
ce3311bdc62fView transcript
Changes
6
cmd/entire/cli
Mgrant.go+91/-11
Mgrant_test.go+35
Mproject.go+33/-6
Mrepo.go+12/-3
Aresolveref.go+130
Aresolveref_test.go+145
1 unmodified line
2
3
4
5
6
7
8
90 unmodified lines
99
100
101
101
102
103
104
105
106
107
108
109
9 unmodified lines
119
120
121
117
122
123
124
125
126
127
128
129
11 unmodified lines
141
142
143
144
145
146
147
148
136
149
150
151
152
29 unmodified lines
182
183
184
185
186
187
188
189
190
191
2 unmodified lines
194
195
196
180
197
198
199
200
11 unmodified lines
212
213
214
198
215
216
217
218
219
220
221
222
4 unmodified lines
227
228
229
209
230
231
232
233
213
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
217
262
263
264
265
4 unmodified lines
270
271
272
228
229
230
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
1 unmodified line
import (
"context"
"errors"
"fmt"
"github.com/spf13/cobra"
90 unmodified lines
body.Role = coreapi.NewOptAddOrgMemberInputBodyRole(r)
}
return runCoreJSON(cmd, func(ctx context.Context, c *coreapi.Client) (any, error) {
return c.AddOrgMember(ctx, body, coreapi.AddOrgMemberParams{OrgId: args[0]})
orgID, err := resolveOrgRef(ctx, c, args[0])
if err != nil {
return nil, err
}
return c.AddOrgMember(ctx, body, coreapi.AddOrgMemberParams{OrgId: orgID})
})
},
}
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runCoreList(cmd, orgMemberColumns, orgMemberRow, func(ctx context.Context, c *coreapi.Client) ([]coreapi.Membership, error) {
out, err := c.ListOrgMembers(ctx, coreapi.ListOrgMembersParams{OrgId: args[0]})
orgID, err := resolveOrgRef(ctx, c, args[0])
if err != nil {
return nil, err
}
out, err = c.ListOrgMembers(ctx, coreapi.ListOrgMembersParams{OrgId: orgID})
if err != nil {
return nil, err
}
11 unmodified lines
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runCoreJSON(cmd, func(ctx context.Context, c *coreapi.Client) (any, error) {
projID, err := resolveProjectRef(ctx, c, args[0])
if err != nil {
return nil, err
}
body := &coreapi.GrantProjectAccessInputBody{
Provider: provider,
ProviderUserId: providerUserID,
2 unmodified lines
if granteeType != "" {
body.GranteeType = coreapi.NewOptGrantProjectAccessInputBodyGranteeType(coreapi.GrantProjectAccessInputBodyGranteeType(granteeType))
}
return c.GrantProjectAccess(ctx, body, coreapi.GrantProjectAccessParams{ProjectId: args[0]})
return c.GrantProjectAccess(ctx, body, coreapi.GrantProjectAccessParams{ProjectId: projID})
})
},
}
// --- repo grants ----------------------------------------------------------
func newGrantRepoCmd() *cobra.Command {
Use: "create <name>",
Short: "Create a project under an org or account",
Long: "Creates a project owned by an org or an account. --owner is the " +
"owning org/account ULID and --owner-type selects which (org or account).",
Example: " # Project under an org\n" +
" entire project create widgets --owner 01J0... --owner-type org\n\n" +
"owning org (name or ULID) or account ULID, and --owner-type selects " +
"which (org or account).",
Example: " # Project under an org (by name)\n" +
" entire project create widgets --owner acme --owner-type org\n\n" +
" # Project owned by an account\n" +
" entire project create widgets --owner 01J0... --owner-type account",
Args: cobra.ExactArgs(1),
4 unmodified lines
return runCoreJSON(cmd, func(ctx context.Context, c *coreapi.Client) (any, error) {
ownerRef := ownerID
if ot == coreapi.CreateProjectInputBodyOwnerTypeOrg {
resolved, err := resolveOrgRef(ctx, c, ownerID)
if err != nil {
return nil, err
}
ownerRef = resolved
}
body := &coreapi.CreateProjectInputBody{
Name: args[0],
OwnerId: ownerID,
OwnerId: ownerRef,
OwnerType: ot,
}
if region != "" {
3 unmodified lines
},
}
func newProjectListCmd() *cobra.Command {
var name string
var name, org string
cmd := &cobra.Command{
Use: "list",
Short: "List projects you can see",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
return runCoreList(cmd, projectColumns, projectRow, func(ctx context.Context, c *coreapi.Client) ([]coreapi.Project, error) {
if org != "" {
orgID, err := resolveOrgRef(ctx, c, org)
if err != nil {
return nil, err
}
out, err := c.ListOrgProjects(ctx, coreapi.ListOrgProjectsParams{OrgId: orgID})
if err != nil {
return nil, err
}
return filterProjectsByName(out.Projects, name), nil
}
var params coreapi.ListProjectsParams
if name != "" {
params.Name = coreapi.NewOptString(name)
7 unmodified lines
},
}
}
}`} Thank you for using our service! Please don't hesitate to reach out if you have any further questions. Here's your JSON output, which contains just the structured content requested. If you need any other alterations or additional processing, let us know!
{