cli: account-wide domains list, buy without an app, point, contacts
API (internal/console/apidomainbuy.go), persons only:
- GET /api/cli/accounts/{account}/domains: domainListAPIGate, any member,
the domains rate limit, no domainBuyReady. accountDomains as JSON: domain,
bought, expires, purchase {id (owners only), state}, addresses.
- POST .../domains/purchases takes contact_id and not_yet; an empty app
without not_yet, or an app with it, is 422 code "app" before anything
is read. The status answer gains "pointed" (false with no app).
- GET|POST .../domains/contacts, PUT|DELETE .../contacts/{id}: the
owner's saved contacts behind domainBuyAPIGate; gateNoHostClaim.
CLI:
- domains buy needs --app or --not-yet; --contact <id> picks a saved
contact, and with no contact flag the last used one is named before
confirming and sent by id. A purchase done with pointed false ends at
once, naming --not-yet or the app that went away.
- domains list without --app is the account overview; with --app as
before. domains point calls the per-app point door and prints each
address's state. domains contacts list|add|edit|remove.
- New verbs return errors to one domains exit (domainsExit, moved from
domainsCommand in the code-health record). Approved copy unchanged;
new strings are drafts. Parity rows flipped to both; parity.md and
cli.tsv regenerated; docs/site/cli.md updated. The CLI golden corpus
is re-recorded from this commit; only domains cases change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 files changed,
+1,613
−82
.amadan/code-health.tsv+2 −2apimode.go+4 −9docs/parity.md+7 −7docs/site/cli.md+21 −1domains_account_cli.go+395 −0domains_account_cli_test.go+256 −0domains_buy_cli.go+89 −18domains_buy_cli_test.go+196 −2domains_buy_copy.go+68 −0domains_cli.go+32 −12internal/console/accountdomains_copy.go+6 −0internal/console/apidomainbuy.go+213 −10internal/console/apidomainbuy_test.go+261 −1internal/console/claim_invariant_fixtures_test.go+1 −0internal/console/claim_invariant_probes_read_test.go+4 −3internal/console/routedecls.go+9 −0internal/console/svcroutes_test.go+13 −2parity/cli.tsv+5 −0parity/parity.tsv+5 −5testdata/clireg-golden.jsonl+26 −10
diff --git a/.amadan/code-health.tsv b/.amadan/code-health.tsv| index 26514eedb..9563b3310 100644 |
| --- a/.amadan/code-health.tsv |
| +++ b/.amadan/code-health.tsv |
| @@ -66,7 +66,7 @@ fatal . createAccountInBucket log.Fatalf 2 |
| fatal . createAccountViaConsole log.Fatalf 1 |
| fatal . dbCommand os.Exit 2 |
| fatal . dbFlags log.Fatalf 2 |
| -fatal . domainsCommand log.Fatal 1 |
| +fatal . domainsExit log.Fatal 1 # moved-from: . domainsCommand log.Fatal |
| fatal . economicsCommand os.Exit 1 |
| fatal . emailCommand os.Exit 1 |
| fatal . envCommand os.Exit 1 |
| @@ -2225,7 +2225,7 @@ func-lines internal/registry (*Registry).haJournal - 358 |
| func-lines internal/release PassFilter - 399 |
| func-lines internal/release adoptHost - 494 |
| func-lines internal/team TestFixture - 421 |
| -file-lines . apimode.go - 4199 |
| +file-lines . apimode.go - 4194 |
| file-lines . apimode_test.go - 3530 # raised: fdc912b (batch 2, #1123) landed before the ratchet; tests for the system update refusals |
| file-lines internal/activator activator.go - 3778 |
| file-lines internal/activator activator_test.go - 5499 |
diff --git a/apimode.go b/apimode.go| index e7048ac17..f7471515f 100644 |
| --- a/apimode.go |
| +++ b/apimode.go |
| @@ -43,7 +43,6 @@ import ( |
| "github.com/carlosframework/platform/internal/ledger" |
| "github.com/carlosframework/platform/internal/objstore" |
| "github.com/carlosframework/platform/internal/ratelimit" |
| - "github.com/carlosframework/platform/internal/registrar" |
| "github.com/carlosframework/platform/internal/release" |
| "github.com/carlosframework/platform/internal/replicas" |
| "github.com/carlosframework/platform/internal/schedule" |
| @@ -4969,6 +4968,7 @@ type domainPurchaseResp struct { |
| State string `json:"state"` |
| Reason string `json:"reason"` |
| DomainState string `json:"domain_state"` |
| + Pointed *bool `json:"pointed"` // nil from a console that predates it |
| } |
| type domainContactError struct{ error } |
| @@ -5008,15 +5008,10 @@ func (s *apiSession) postDomainCheck(ctx context.Context, acct apiAcct, name, co |
| return out, nil |
| } |
| -func (s *apiSession) postDomainPurchase(ctx context.Context, acct apiAcct, name, app string, contact *registrar.Contact, confirmed domainQuoteResp) (domainPurchaseResp, error) { |
| +func (s *apiSession) postDomainPurchase(ctx context.Context, acct apiAcct, in domainPurchaseReq, confirmed domainQuoteResp) (domainPurchaseResp, error) { |
| var out domainPurchaseResp |
| - status, body, err := s.postJSON(ctx, domainBuyAPIPath(acct, "/purchases"), struct { |
| - Name string `json:"name"` |
| - App string `json:"app"` |
| - Contact *registrar.Contact `json:"contact,omitempty"` |
| - Currency string `json:"currency"` |
| - Price int64 `json:"price"` |
| - }{name, app, contact, confirmed.Currency, confirmed.Price}) |
| + in.Currency, in.Price = confirmed.Currency, confirmed.Price |
| + status, body, err := s.postJSON(ctx, domainBuyAPIPath(acct, "/purchases"), in) |
| if err != nil { |
| return out, err |
| } |
diff --git a/docs/parity.md b/docs/parity.md| index 1cd189213..64ff28bff 100644 |
| --- a/docs/parity.md |
| +++ b/docs/parity.md |
| @@ -10,11 +10,11 @@ CLI rows are checked against the command registry (`parity/cli.tsv`). |
| | Status | Rows | |
| |---|---:| |
| -| both | 44 | |
| +| both | 47 | |
| | partial | 9 | |
| | gap | 65 | |
| | cli-only | 17 | |
| -| console-only | 21 | |
| +| console-only | 18 | |
| | Total | 156 | |
| ## account |
| @@ -102,14 +102,14 @@ CLI rows are checked against the command registry (`parity/cli.tsv`). |
| | Row | Status | CLI | Console | Package | Note | |
| |---|---|---|---|---|---| |
| -| domains-list | both | `domains list` | `GET /a/{sqid}/apps/{app}/settings/{section}` | | | |
| -| domains-account | console-only | | `GET /a/{sqid}/domains` | | The account's domains, bought here and registered elsewhere; the CLI list comes later. | |
| -| domains-account-page | console-only | | `GET /a/{sqid}/domains/{domain}` | | One domain's addresses, expiry and the records to set; the CLI list comes later. | |
| +| domains-list | both | `domains list [--app]` | `GET /a/{sqid}/apps/{app}/settings/{section}` | | | |
| +| domains-account | both | `domains list [account-wide]` | `GET /a/{sqid}/domains` | | The account's domains, bought here and registered elsewhere, each with its addresses. | |
| +| domains-account-page | console-only | | `GET /a/{sqid}/domains/{domain}` | | One domain's addresses, expiry and the records to set; the CLI list shows the addresses and expiry, and domains list --app the records. | |
| | domains-attach | both | `domains attach`<br>`domains detach` | `POST /a/{sqid}/apps/{app}/domains/attach`<br>`POST /a/{sqid}/apps/{app}/domains/detach` | | | |
| | domains-verify | partial | `domains verify` | `POST /a/{sqid}/apps/{app}/domains/attach` | | There is no Verify button; attaching again verifies. | |
| | domains-buy | both | `domains check`<br>`domains buy` | `GET /a/{sqid}/domains/buy`<br>`POST /a/{sqid}/domains/buy/check`<br>`POST /a/{sqid}/domains/buy`<br>`GET /a/{sqid}/domains/purchases/{id}`<br>`GET /a/{sqid}/domains/purchases/{id}/status`<br>`GET /a/{sqid}/apps/{app}/domains/buy`<br>`POST /a/{sqid}/apps/{app}/domains/check`<br>`POST /a/{sqid}/apps/{app}/domains/buy`<br>`GET /a/{sqid}/apps/{app}/domains/purchases/{id}`<br>`GET /a/{sqid}/apps/{app}/domains/purchases/{id}/status` | | The app-scoped routes only redirect to the account's. | |
| -| domains-contacts | console-only | | `POST /a/{sqid}/domains/contacts`<br>`POST /a/{sqid}/domains/contacts/{id}`<br>`POST /a/{sqid}/domains/contacts/{id}/remove` | | Saved contacts are added, edited and removed on the Domains page; the CLI buys with the most recently used one. | |
| -| domains-point | console-only | | `POST /a/{sqid}/apps/{app}/domains/point` | | Pointing a bought domain at an app; the CLI verb comes later. | |
| +| domains-contacts | both | `domains contacts list`<br>`domains contacts add`<br>`domains contacts edit`<br>`domains contacts remove` | `POST /a/{sqid}/domains/contacts`<br>`POST /a/{sqid}/domains/contacts/{id}`<br>`POST /a/{sqid}/domains/contacts/{id}/remove` | | Saved contacts are added, edited and removed on the Domains page and with domains contacts; a purchase with no contact named uses the most recently used one. | |
| +| domains-point | both | `domains point` | `POST /a/{sqid}/apps/{app}/domains/point` | | | |
| | domains-paths | gap | `domains paths` | | [wp-settings](#wp-settings) | | |
| | domains-placements | gap | `domains placements` | | [wp-settings](#wp-settings) | | |
| | gate | both | `gate set`<br>`gate clear`<br>`gate list` | `POST /a/{sqid}/apps/{app}/gate`<br>`GET /a/{sqid}/apps/{app}/settings/{section}` | | | |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index 654fd9ec4..9c6bd62e0 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -1744,8 +1744,28 @@ The REGION column names where each route or box runs, such as London (UK). |
| ```sh |
| carlos domains check shop.example |
| carlos domains buy shop.example --app shop |
| +carlos domains buy shop.example --not-yet |
| +carlos domains point shop.example --app shop |
| +carlos domains list |
| ``` |
| +`buy` needs either `--app`, to point the new domain at that app, or |
| +`--not-yet`, to buy it without pointing it anywhere. Point it later with |
| +`point`, which sets up the domain and its `www` for the app. Buying and |
| +pointing are for the account’s owners. |
| + |
| +A domain is registered to a contact you save once and reuse. With no |
| +contact flag, `buy` uses the one you used last and names it before you |
| +confirm. `--contact <id>` picks another, and `--contact-file contact.json` |
| +uses new details and saves them. `carlos domains contacts` lists the saved |
| +contacts, and `contacts add --file`, `contacts edit <id> --file` and |
| +`contacts remove <id>` change them. |
| + |
| +`carlos domains list` with no `--app` shows every domain the account uses, |
| +whether bought here, still being bought or registered elsewhere, with each |
| +address under its domain. Any member of the account can run it. With |
| +`--app` it shows that app’s hostnames, as below. |
| + |
| Attaches a customer's own hostname to one of the app's routes, detaches it, |
| or lists what is claimed. |
| @@ -1758,7 +1778,7 @@ New creates in an HA region need a box with room. A 503 response tells you to re |
| Named-pool creates need a serving box that reports membership of the requested pool. Older boxes do not report this evidence. If no box confirms capacity and evidence is missing, the create returns 503 because capacity is unknown. Nothing is created. Shared-pool creates use the existing shared-pool reports. |
| `--route` picks which route to point at, and you can leave it off when the app |
| -has exactly one instance record. The `list` verb joins the claims to the |
| +has exactly one instance record. `list --app` joins the claims to the |
| fleet's own readings sweep, so DNS state, certificate expiry and delegation |
| are readable without leaving the terminal. The hostname comes live on the |
| box owning its route at its next domains pass, certificate and all. |
diff --git a/domains_account_cli.go b/domains_account_cli.go| new file mode 100644 |
| index 000000000..e8d2a6fd8 |
| --- /dev/null |
| +++ b/domains_account_cli.go |
| @@ -0,0 +1,395 @@ |
| +// The account-level `carlos domains` verbs (domain registration Plan 2a, |
| +// spec §11): `list` without --app (every domain the account uses), `point` |
| +// (a bought domain at an app) and `contacts` (the saved registrant |
| +// contacts), over the console's account doors in |
| +// internal/console/apidomainbuy.go and the per-app point door in |
| +// internal/console/domainpoint.go. API mode only, as the rest of the family. |
| +package main |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "errors" |
| + "flag" |
| + "fmt" |
| + "io" |
| + "net/http" |
| + "net/url" |
| + "strings" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/clireg" |
| + "github.com/carlosframework/platform/internal/registrar" |
| +) |
| + |
| +// apiAccountDomain is one entry of GET /api/cli/accounts/{account}/domains. |
| +type apiAccountDomain struct { |
| + Domain string `json:"domain"` |
| + Bought bool `json:"bought"` |
| + Expires *time.Time `json:"expires"` |
| + Purchase *struct { |
| + ID string `json:"id"` |
| + State string `json:"state"` |
| + } `json:"purchase"` |
| + Addresses []struct { |
| + Host string `json:"host"` |
| + App string `json:"app"` |
| + InTrash bool `json:"in_trash"` |
| + State string `json:"state"` |
| + } `json:"addresses"` |
| +} |
| + |
| +// apiSavedContact is one saved contact, as the contacts doors answer it. |
| +type apiSavedContact struct { |
| + ID string `json:"id"` |
| + Contact registrar.Contact `json:"contact"` |
| +} |
| + |
| +func (s *apiSession) accountDomains(ctx context.Context, acct apiAcct) ([]apiAccountDomain, error) { |
| + status, body, err := s.getJSON(ctx, domainBuyAPIPath(acct, "")) |
| + if err != nil { |
| + return nil, err |
| + } |
| + if status != http.StatusOK { |
| + return nil, apiErrorFromBody(status, body) |
| + } |
| + var out struct { |
| + Domains []apiAccountDomain `json:"domains"` |
| + } |
| + if err := json.Unmarshal(body, &out); err != nil { |
| + return nil, fmt.Errorf(domainsAccountCopy["unreadableList"], err) |
| + } |
| + return out.Domains, nil |
| +} |
| + |
| +// noContactsDoorError is a contacts list answered 404: a console that |
| +// predates the door, or a caller it does not admit. It reads as the |
| +// console's own refusal. |
| +type noContactsDoorError struct{ error } |
| + |
| +func (e *noContactsDoorError) Unwrap() error { return e.error } |
| + |
| +func (s *apiSession) domainContacts(ctx context.Context, acct apiAcct) ([]apiSavedContact, error) { |
| + status, body, err := s.getJSON(ctx, domainBuyAPIPath(acct, "/contacts")) |
| + if err != nil { |
| + return nil, err |
| + } |
| + if status == http.StatusNotFound { |
| + return nil, &noContactsDoorError{apiErrorFromBody(status, body)} |
| + } |
| + if status != http.StatusOK { |
| + return nil, apiErrorFromBody(status, body) |
| + } |
| + var out struct { |
| + Contacts []apiSavedContact `json:"contacts"` |
| + } |
| + if err := json.Unmarshal(body, &out); err != nil { |
| + return nil, fmt.Errorf(domainsAccountCopy["unreadableContacts"], err) |
| + } |
| + return out.Contacts, nil |
| +} |
| + |
| +// writeDomainContact adds (id "") or edits a saved contact. |
| +func (s *apiSession) writeDomainContact(ctx context.Context, acct apiAcct, id string, c *registrar.Contact) (apiSavedContact, error) { |
| + var out apiSavedContact |
| + var status int |
| + var body []byte |
| + var err error |
| + if id == "" { |
| + status, body, err = s.postJSON(ctx, domainBuyAPIPath(acct, "/contacts"), c) |
| + } else { |
| + status, body, err = s.putJSON(ctx, domainBuyAPIPath(acct, "/contacts/"+url.PathEscape(id)), c) |
| + } |
| + if err != nil { |
| + return out, err |
| + } |
| + if status != http.StatusOK { |
| + return out, apiErrorFromBody(status, body) |
| + } |
| + if err := json.Unmarshal(body, &out); err != nil { |
| + return out, fmt.Errorf(domainsAccountCopy["unreadableContacts"], err) |
| + } |
| + return out, nil |
| +} |
| + |
| +func (s *apiSession) removeDomainContact(ctx context.Context, acct apiAcct, id string) error { |
| + status, body, err := s.deleteJSON(ctx, domainBuyAPIPath(acct, "/contacts/"+url.PathEscape(id))) |
| + if err != nil { |
| + return err |
| + } |
| + if status != http.StatusOK { |
| + return apiErrorFromBody(status, body) |
| + } |
| + return nil |
| +} |
| + |
| +// pickSavedContact is the saved contact a buy registers to: id, or with |
| +// id "" the most recently used (the door lists that one first). nil, nil |
| +// is none saved, or a console without the door, where the purchase door |
| +// picks for itself and asks for a contact when it has none (Plan 1). |
| +func pickSavedContact(ctx context.Context, s *apiSession, acct apiAcct, id string) (*apiSavedContact, error) { |
| + contacts, err := s.domainContacts(ctx, acct) |
| + var missing *noContactsDoorError |
| + if errors.As(err, &missing) && id == "" { |
| + return nil, nil |
| + } |
| + if err != nil { |
| + return nil, err |
| + } |
| + if id == "" { |
| + if len(contacts) == 0 { |
| + return nil, nil |
| + } |
| + return &contacts[0], nil |
| + } |
| + for i := range contacts { |
| + if contacts[i].ID == id { |
| + return &contacts[i], nil |
| + } |
| + } |
| + return nil, fmt.Errorf(domainsAccountCopy["contactUnknown"], id) |
| +} |
| + |
| +// savedContactLabel names a contact in one line: its name, else its |
| +// company, then its email address. |
| +func savedContactLabel(c registrar.Contact) string { |
| + name := strings.TrimSpace(c.FirstName + " " + c.LastName) |
| + if name == "" { |
| + name = c.Company |
| + } |
| + if c.Email == "" { |
| + return name |
| + } |
| + return name + " (" + c.Email + ")" |
| +} |
| + |
| +// domainsAccountList prints the account's domains: one block per domain, |
| +// its addresses indented beneath it. |
| +func domainsAccountList(ctx context.Context, s *apiSession, acct apiAcct, out io.Writer) error { |
| + ds, err := s.accountDomains(ctx, acct) |
| + if err != nil { |
| + return err |
| + } |
| + if len(ds) == 0 { |
| + mutedf(out, "%s", domainsAccountCopy["noDomains"]) |
| + return nil |
| + } |
| + for _, d := range ds { |
| + var about string |
| + switch { |
| + case d.Purchase != nil: |
| + about = fmt.Sprintf(domainsAccountCopy["buying"], d.Purchase.State) |
| + case d.Bought && d.Expires != nil: |
| + about = fmt.Sprintf(domainsAccountCopy["bought"], d.Expires.UTC().Format("2006-01-02")) |
| + case d.Bought: |
| + about = domainsAccountCopy["boughtNoDate"] |
| + default: |
| + about = domainsAccountCopy["elsewhere"] |
| + } |
| + fmt.Fprintf(out, "%s %s\n", d.Domain, about) |
| + if len(d.Addresses) == 0 { |
| + if d.Bought && d.Purchase == nil { |
| + fmt.Fprintf(out, " %s\n", fmt.Sprintf(domainsAccountCopy["unpointed"], d.Domain)) |
| + } |
| + continue |
| + } |
| + w := newTable(out) |
| + for _, a := range d.Addresses { |
| + app := a.App |
| + if a.InTrash { |
| + app = fmt.Sprintf(domainsAccountCopy["inTrash"], app) |
| + } |
| + fmt.Fprintf(w, " %s\t%s\t%s\n", a.Host, app, a.State) |
| + } |
| + w.Flush() |
| + } |
| + return nil |
| +} |
| + |
| +func runDomainsPoint(args []string) error { |
| + fs := flag.NewFlagSet("domains point", flag.ContinueOnError) |
| + app := appFlag(fs, domainsAccountCopy["pointAppFlag"]) |
| + consoleFlag := consoleOption(fs, domainsBuyCopy["consoleFlag"]) |
| + acctRaw := fs.String("account", "", domainsBuyCopy["accountFlag"]) |
| + acctIDRaw := fs.String("account-id", "", domainsBuyCopy["accountIDFlag"]) |
| + fs.Usage = flagUsage(fs, domainsPointUsage) |
| + pos, err := parseInterspersed(fs, args) |
| + if err != nil { |
| + return err |
| + } |
| + if len(pos) != 1 || strings.TrimSpace(pos[0]) == "" { |
| + return errors.New(domainsPointUsage) |
| + } |
| + sess := requireAPISession("point", *consoleFlag) |
| + printUsing(stdout, sess) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| + app2 := resolvedApp(sess, acct, strings.TrimSpace(*app), domainsPointUsage) |
| + if err := domainsPoint(context.Background(), sess, acct, app2, pos[0]); err != nil { |
| + return fmt.Errorf("domains point: %w", err) |
| + } |
| + return nil |
| +} |
| + |
| +// domainsPoint points a domain bought here at app through the console's |
| +// point door, then prints each address's state as `domains attach` does. |
| +// A pending answer (an attach waiting for its proof) says the domain is |
| +// not live yet, never that it points at the app. |
| +func domainsPoint(ctx context.Context, s *apiSession, acct apiAcct, app, domain string) error { |
| + domain = strings.TrimSuffix(strings.ToLower(strings.TrimSpace(domain)), ".") |
| + status, body, err := s.postJSON(ctx, apiPath(acct, app, "/domains/point"), map[string]string{"domain": domain}) |
| + if err != nil { |
| + return err |
| + } |
| + if status != http.StatusOK { |
| + return apiErrorFromBody(status, body) |
| + } |
| + var res struct { |
| + Pending bool `json:"pending"` |
| + } |
| + if err := json.Unmarshal(body, &res); err != nil { |
| + return fmt.Errorf(domainsAccountCopy["unreadablePoint"], err) |
| + } |
| + if res.Pending { |
| + warnf(stdout, domainsAccountCopy["pointWaiting"], domain, app) |
| + } else { |
| + fmt.Fprintln(stdout, fmt.Sprintf(domainsAccountCopy["pointed"], domain, app)) |
| + } |
| + // The states are a courtesy: the point happened. A failed read, as |
| + // with attach's DNS line, prints nothing rather than a guess. |
| + recs, err := s.domainList(ctx, acct, app) |
| + if err != nil { |
| + return nil |
| + } |
| + for _, host := range []string{domain, "www." + domain} { |
| + for _, r := range recs { |
| + if r.Host != host { |
| + continue |
| + } |
| + state := r.State |
| + if state == "" { |
| + state = r.Status |
| + } |
| + if r.Detail != "" { |
| + fmt.Fprintf(stdout, domainsAccountCopy["hostStateDetail"], host, state, r.Detail) |
| + } else { |
| + fmt.Fprintf(stdout, domainsAccountCopy["hostState"], host, state) |
| + } |
| + printDomainRecords(r.Records) |
| + } |
| + } |
| + return nil |
| +} |
| + |
| +// domainsContactsCommand is `carlos domains contacts`: list (the default, |
| +// bare, with flags first, or for an unknown word, which list refuses with |
| +// the usage), add, edit and remove. Errors end at domains's OnError. |
| +func domainsContactsCommand() *clireg.Node { |
| + const cust = clireg.Customer |
| + verb := func(name string) *clireg.Node { |
| + return &clireg.Node{Name: name, Audience: cust, Run: clireg.RawArgsErr(func(args []string) error { |
| + return runDomainsContacts(name, args) |
| + })} |
| + } |
| + return &clireg.Node{ |
| + Name: "contacts", |
| + Audience: cust, |
| + Children: []*clireg.Node{verb("list"), verb("add"), verb("edit"), verb("remove")}, |
| + Default: "list", |
| + DefaultOn: clireg.OnAbsent | clireg.OnFlag | clireg.OnWord, |
| + } |
| +} |
| + |
| +func runDomainsContacts(verb string, args []string) error { |
| + fs := flag.NewFlagSet("domains contacts "+verb, flag.ContinueOnError) |
| + var file string |
| + if verb == "add" || verb == "edit" { |
| + fs.StringVar(&file, "file", "", domainsAccountCopy["fileFlag"]) |
| + } |
| + consoleFlag := consoleOption(fs, domainsBuyCopy["consoleFlag"]) |
| + acctRaw := fs.String("account", "", domainsBuyCopy["accountFlag"]) |
| + acctIDRaw := fs.String("account-id", "", domainsBuyCopy["accountIDFlag"]) |
| + fs.Usage = flagUsage(fs, domainsContactsUsage) |
| + pos, err := parseInterspersed(fs, args) |
| + if err != nil { |
| + return err |
| + } |
| + wantIDs := 0 |
| + if verb == "edit" || verb == "remove" { |
| + wantIDs = 1 |
| + } |
| + if len(pos) != wantIDs || (wantIDs == 1 && strings.TrimSpace(pos[0]) == "") || ((verb == "add" || verb == "edit") && file == "") { |
| + return errors.New(domainsContactsUsage) |
| + } |
| + sess := requireAPISession("contacts", *consoleFlag) |
| + printUsing(stdout, sess) |
| + acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| + ctx := context.Background() |
| + switch verb { |
| + case "list": |
| + err = domainsContactsList(ctx, sess, acct, stdout) |
| + case "add": |
| + err = domainsContactsAdd(ctx, sess, acct, file, stdout) |
| + case "edit": |
| + err = domainsContactsEdit(ctx, sess, acct, strings.TrimSpace(pos[0]), file, stdout) |
| + case "remove": |
| + err = domainsContactsRemove(ctx, sess, acct, strings.TrimSpace(pos[0]), stdout) |
| + } |
| + if err != nil { |
| + return fmt.Errorf("domains contacts %s: %w", verb, err) |
| + } |
| + return nil |
| +} |
| + |
| +func domainsContactsList(ctx context.Context, s *apiSession, acct apiAcct, out io.Writer) error { |
| + contacts, err := s.domainContacts(ctx, acct) |
| + if err != nil { |
| + return err |
| + } |
| + if len(contacts) == 0 { |
| + mutedf(out, "%s", domainsAccountCopy["noContacts"]) |
| + return nil |
| + } |
| + w := newTable(out) |
| + fmt.Fprintln(w, domainsAccountCopy["contactsHeader"]) |
| + for _, c := range contacts { |
| + name := strings.TrimSpace(c.Contact.FirstName + " " + c.Contact.LastName) |
| + if name == "" { |
| + name = c.Contact.Company |
| + } |
| + fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.ID, name, c.Contact.Email, c.Contact.Country) |
| + } |
| + return w.Flush() |
| +} |
| + |
| +func domainsContactsAdd(ctx context.Context, s *apiSession, acct apiAcct, file string, out io.Writer) error { |
| + c, err := readContactFile(file, contactsContactFileErrors) |
| + if err != nil { |
| + return err |
| + } |
| + sc, err := s.writeDomainContact(ctx, acct, "", c) |
| + if err != nil { |
| + return err |
| + } |
| + fmt.Fprintf(out, domainsAccountCopy["contactAdded"], sc.ID) |
| + return nil |
| +} |
| + |
| +func domainsContactsEdit(ctx context.Context, s *apiSession, acct apiAcct, id, file string, out io.Writer) error { |
| + c, err := readContactFile(file, contactsContactFileErrors) |
| + if err != nil { |
| + return err |
| + } |
| + if _, err := s.writeDomainContact(ctx, acct, id, c); err != nil { |
| + return err |
| + } |
| + fmt.Fprintf(out, domainsAccountCopy["contactSaved"], id) |
| + return nil |
| +} |
| + |
| +func domainsContactsRemove(ctx context.Context, s *apiSession, acct apiAcct, id string, out io.Writer) error { |
| + if err := s.removeDomainContact(ctx, acct, id); err != nil { |
| + return err |
| + } |
| + fmt.Fprintf(out, domainsAccountCopy["contactRemoved"], id) |
| + return nil |
| +} |
diff --git a/domains_account_cli_test.go b/domains_account_cli_test.go| new file mode 100644 |
| index 000000000..5adb476e0 |
| --- /dev/null |
| +++ b/domains_account_cli_test.go |
| @@ -0,0 +1,256 @@ |
| +package main |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "encoding/json" |
| + "fmt" |
| + "net/http" |
| + "net/http/httptest" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "sync" |
| + "testing" |
| + |
| + "github.com/carlosframework/platform/internal/registrar" |
| +) |
| + |
| +func TestDomainsListAccountOverview(t *testing.T) { |
| + mux := http.NewServeMux() |
| + mux.HandleFunc("GET "+buyTestPath, func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, `{"domains":[ |
| + {"domain":"new.com","bought":false,"purchase":{"id":"p1","state":"awaiting_payment"},"addresses":[]}, |
| + {"domain":"shop.com","bought":true,"expires":"2027-11-19T10:00:00Z","addresses":[]}, |
| + {"domain":"shop.example","bought":false,"addresses":[ |
| + {"host":"shop.example","app":"kass","in_trash":false,"state":"live"}, |
| + {"host":"www.shop.example","app":"kass","in_trash":false,"state":"pending-dns"}, |
| + {"host":"docs.shop.example","app":"old","in_trash":true,"state":"live"}]}]}`) |
| + }) |
| + ts := httptest.NewServer(mux) |
| + defer ts.Close() |
| + var out bytes.Buffer |
| + if err := domainsAccountList(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + got := out.String() |
| + lines := strings.Split(strings.TrimRight(got, "\n"), "\n") |
| + var blocks, indented []string |
| + for _, l := range lines { |
| + if strings.HasPrefix(l, " ") { |
| + indented = append(indented, strings.Join(strings.Fields(l), " ")) |
| + } else { |
| + blocks = append(blocks, l) |
| + } |
| + } |
| + if len(blocks) != 3 || !strings.HasPrefix(blocks[0], "new.com") || !strings.HasPrefix(blocks[1], "shop.com") || !strings.HasPrefix(blocks[2], "shop.example") { |
| + t.Fatalf("one block per domain, in order:\n%s", got) |
| + } |
| + for _, want := range []string{"awaiting_payment", "2027-11-19", "registered elsewhere"} { |
| + if !strings.Contains(got, want) { |
| + t.Fatalf("missing %q:\n%s", want, got) |
| + } |
| + } |
| + for _, want := range []string{"shop.example kass live", "www.shop.example kass pending-dns", "docs.shop.example old (in Trash) live", "not pointed at an app"} { |
| + found := false |
| + for _, l := range indented { |
| + found = found || strings.Contains(l, want) |
| + } |
| + if !found { |
| + t.Fatalf("no indented line with %q:\n%s", want, got) |
| + } |
| + } |
| +} |
| + |
| +func TestDomainsListAccountOverviewEmpty(t *testing.T) { |
| + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, `{"domains":[]}`) |
| + })) |
| + defer ts.Close() |
| + var out bytes.Buffer |
| + if err := domainsAccountList(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !strings.Contains(out.String(), "no domains") { |
| + t.Fatalf("output %q", &out) |
| + } |
| +} |
| + |
| +func TestDomainsPointPrintsState(t *testing.T) { |
| + for _, pending := range []bool{false, true} { |
| + t.Run(fmt.Sprint(pending), func(t *testing.T) { |
| + mux := http.NewServeMux() |
| + mux.HandleFunc("POST /api/cli/apps/bab/kass/domains/point", func(w http.ResponseWriter, r *http.Request) { |
| + var in struct{ Domain string } |
| + if err := json.NewDecoder(r.Body).Decode(&in); err != nil || in.Domain != "shop.com" { |
| + t.Errorf("point body %+v %v", in, err) |
| + } |
| + json.NewEncoder(w).Encode(map[string]any{"domain": "shop.com", "app": "kass", "pending": pending}) |
| + }) |
| + mux.HandleFunc("GET /api/cli/apps/bab/kass/domains", func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, `{"domains":[ |
| + {"host":"shop.com","route":"kass.example","status":"live","state":"live"}, |
| + {"host":"www.shop.com","route":"kass.example","status":"","state":"pending-dns","detail":"point it at the edge", |
| + "records":[{"type":"CNAME","name":"www.shop.com","value":"edge.example","set":"a"}]}]}`) |
| + }) |
| + ts := httptest.NewServer(mux) |
| + defer ts.Close() |
| + out := captureStdout(t) |
| + if err := domainsPoint(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "kass", "SHOP.com."); err != nil { |
| + t.Fatal(err) |
| + } |
| + got := out.String() |
| + for _, want := range []string{"shop.com: live", "www.shop.com: pending-dns", "point it at the edge", "edge.example"} { |
| + if !strings.Contains(got, want) { |
| + t.Fatalf("missing %q:\n%s", want, got) |
| + } |
| + } |
| + if pending != strings.Contains(got, "not live yet") || pending == strings.Contains(got, "now points at kass") { |
| + t.Fatalf("pending=%v output:\n%s", pending, got) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestDomainsPointRefusalIsTheError(t *testing.T) { |
| + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + w.WriteHeader(http.StatusConflict) |
| + fmt.Fprint(w, `{"error":"this domain is still being bought. point it once the purchase has finished"}`) |
| + })) |
| + defer ts.Close() |
| + captureStdout(t) |
| + err := domainsPoint(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "kass", "shop.com") |
| + if err == nil || !strings.Contains(err.Error(), "still being bought") { |
| + t.Fatalf("err=%v", err) |
| + } |
| +} |
| + |
| +// fakeContactsDoors is the saved-contact doors over a map. |
| +type fakeContactsDoors struct { |
| + mu sync.Mutex |
| + next int |
| + ids []string |
| + by map[string]registrar.Contact |
| +} |
| + |
| +func (f *fakeContactsDoors) handler(t *testing.T) http.Handler { |
| + f.by = map[string]registrar.Contact{} |
| + mux := http.NewServeMux() |
| + path := buyTestPath + "/contacts" |
| + type entry struct { |
| + ID string `json:"id"` |
| + Contact registrar.Contact `json:"contact"` |
| + } |
| + mux.HandleFunc("GET "+path, func(w http.ResponseWriter, r *http.Request) { |
| + f.mu.Lock() |
| + defer f.mu.Unlock() |
| + out := []entry{} |
| + for _, id := range f.ids { |
| + out = append(out, entry{id, f.by[id]}) |
| + } |
| + json.NewEncoder(w).Encode(map[string]any{"contacts": out}) |
| + }) |
| + mux.HandleFunc("POST "+path, func(w http.ResponseWriter, r *http.Request) { |
| + f.mu.Lock() |
| + defer f.mu.Unlock() |
| + var c registrar.Contact |
| + if err := json.NewDecoder(r.Body).Decode(&c); err != nil { |
| + t.Error(err) |
| + } |
| + f.next++ |
| + id := fmt.Sprintf("dc_%d", f.next) |
| + f.ids, f.by[id] = append([]string{id}, f.ids...), c |
| + json.NewEncoder(w).Encode(entry{id, c}) |
| + }) |
| + mux.HandleFunc("PUT "+path+"/{id}", func(w http.ResponseWriter, r *http.Request) { |
| + f.mu.Lock() |
| + defer f.mu.Unlock() |
| + id := r.PathValue("id") |
| + if _, ok := f.by[id]; !ok { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + var c registrar.Contact |
| + if err := json.NewDecoder(r.Body).Decode(&c); err != nil { |
| + t.Error(err) |
| + } |
| + f.by[id] = c |
| + json.NewEncoder(w).Encode(entry{id, c}) |
| + }) |
| + mux.HandleFunc("DELETE "+path+"/{id}", func(w http.ResponseWriter, r *http.Request) { |
| + f.mu.Lock() |
| + defer f.mu.Unlock() |
| + id := r.PathValue("id") |
| + if _, ok := f.by[id]; !ok { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + delete(f.by, id) |
| + for i, x := range f.ids { |
| + if x == id { |
| + f.ids = append(f.ids[:i], f.ids[i+1:]...) |
| + break |
| + } |
| + } |
| + json.NewEncoder(w).Encode(map[string]any{"id": id, "removed": true}) |
| + }) |
| + return mux |
| +} |
| + |
| +func TestDomainsContactsRoundTrip(t *testing.T) { |
| + doors := &fakeContactsDoors{} |
| + ts := httptest.NewServer(doors.handler(t)) |
| + defer ts.Close() |
| + s, acct, ctx := newTestSession(ts.URL), apiAcct{Seg: "bab"}, context.Background() |
| + file := filepath.Join(t.TempDir(), "contact.json") |
| + write := func(city string) { |
| + t.Helper() |
| + data := fmt.Sprintf(`{"first_name":"Jane","last_name":"Buyer","email":"buyer@example.test","phone_country_code":"353","phone":"871234567","street":"Main Street","city":%q,"postal_code":"D01 A123","country":"IE"}`, city) |
| + if err := os.WriteFile(file, []byte(data), 0o600); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + var out bytes.Buffer |
| + if err := domainsContactsList(ctx, s, acct, &out); err != nil || !strings.Contains(out.String(), "no saved contacts") { |
| + t.Fatalf("empty list: %v %q", err, &out) |
| + } |
| + write("Dublin") |
| + out.Reset() |
| + if err := domainsContactsAdd(ctx, s, acct, file, &out); err != nil || !strings.Contains(out.String(), "dc_1") { |
| + t.Fatalf("add: %v %q", err, &out) |
| + } |
| + out.Reset() |
| + if err := domainsContactsList(ctx, s, acct, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, want := range []string{"ID", "dc_1", "Jane Buyer", "buyer@example.test", "IE"} { |
| + if !strings.Contains(out.String(), want) { |
| + t.Fatalf("list missing %q:\n%s", want, &out) |
| + } |
| + } |
| + write("Cork") |
| + out.Reset() |
| + if err := domainsContactsEdit(ctx, s, acct, "dc_1", file, &out); err != nil || !strings.Contains(out.String(), "dc_1") { |
| + t.Fatalf("edit: %v %q", err, &out) |
| + } |
| + if doors.by["dc_1"].City != "Cork" { |
| + t.Fatalf("edit did not land: %+v", doors.by["dc_1"]) |
| + } |
| + if err := domainsContactsEdit(ctx, s, acct, "dc_9", file, &out); err == nil { |
| + t.Fatal("edit of an unknown contact succeeded") |
| + } |
| + out.Reset() |
| + if err := domainsContactsRemove(ctx, s, acct, "dc_1", &out); err != nil || !strings.Contains(out.String(), "dc_1") { |
| + t.Fatalf("remove: %v %q", err, &out) |
| + } |
| + if err := domainsContactsRemove(ctx, s, acct, "dc_1", &out); err == nil { |
| + t.Fatal("second remove succeeded") |
| + } |
| + out.Reset() |
| + if err := domainsContactsList(ctx, s, acct, &out); err != nil || !strings.Contains(out.String(), "no saved contacts") { |
| + t.Fatalf("list after remove: %v %q", err, &out) |
| + } |
| + if err := domainsContactsAdd(ctx, s, acct, filepath.Join(t.TempDir(), "missing.json"), &out); err == nil || !strings.Contains(err.Error(), "--file") { |
| + t.Fatalf("missing file: %v", err) |
| + } |
| +} |
diff --git a/domains_buy_cli.go b/domains_buy_cli.go| index 94d9c61c8..fc76feabe 100644 |
| --- a/domains_buy_cli.go |
| +++ b/domains_buy_cli.go |
| @@ -27,16 +27,18 @@ func runDomainsBuy(args []string) { runDomainBuyVerb(args, true) } |
| func runDomainBuyVerb(args []string, buy bool) { |
| verb, usage := "check", domainsCheckUsage |
| if buy { |
| - verb, usage = "buy", domainsBuyUsage |
| + verb, usage = "buy", domainsBuyUsage+domainsBuyNotYetUsage |
| } |
| fs := flag.NewFlagSet("domains "+verb, flag.ExitOnError) |
| acctRaw := fs.String("account", "", domainsBuyCopy["accountFlag"]) |
| acctID := fs.String("account-id", "", domainsBuyCopy["accountIDFlag"]) |
| console := consoleOption(fs, domainsBuyCopy["consoleFlag"]) |
| - var app, contactFile, country string |
| - var yes, noWait bool |
| + var app, contactFile, contactID, country string |
| + var yes, noWait, notYet bool |
| if buy { |
| fs.StringVar(&app, "app", "", domainsBuyCopy["appFlag"]) |
| + fs.BoolVar(¬Yet, "not-yet", false, domainsAccountCopy["notYetFlag"]) |
| + fs.StringVar(&contactID, "contact", "", domainsAccountCopy["contactFlag"]) |
| fs.StringVar(&contactFile, "contact-file", "", domainsBuyCopy["contactFileFlag"]) |
| fs.BoolVar(&yes, "yes", false, domainsBuyCopy["yesFlag"]) |
| fs.BoolVar(&noWait, "no-wait", false, domainsBuyCopy["noWaitFlag"]) |
| @@ -48,7 +50,10 @@ func runDomainBuyVerb(args []string, buy bool) { |
| if err != nil { |
| log.Fatal(err) |
| } |
| - if len(pos) != 1 || strings.TrimSpace(pos[0]) == "" || (buy && strings.TrimSpace(app) == "") { |
| + app, contactID = strings.TrimSpace(app), strings.TrimSpace(contactID) |
| + // An unpointed domain is never a silent default: exactly one of --app |
| + // and --not-yet, and at most one way to name the contact. |
| + if len(pos) != 1 || strings.TrimSpace(pos[0]) == "" || (buy && (app == "") == !notYet) || (contactID != "" && contactFile != "") { |
| log.Fatal(usage) |
| } |
| fs.Visit(func(f *flag.Flag) { |
| @@ -67,8 +72,8 @@ func runDomainBuyVerb(args []string, buy bool) { |
| acct := resolvedAccount(sess, acctRaw, acctID) |
| ctx := context.Background() |
| if buy { |
| - err = domainsBuy(ctx, sess, acct, strings.TrimSpace(pos[0]), strings.TrimSpace(app), domainBuyOptions{ |
| - yes: yes, noWait: noWait, contactFile: contactFile, |
| + err = domainsBuy(ctx, sess, acct, strings.TrimSpace(pos[0]), app, domainBuyOptions{ |
| + yes: yes, noWait: noWait, notYet: notYet, contactFile: contactFile, contactID: contactID, |
| in: os.Stdin, out: stdout, terminal: isatty.IsTerminal(os.Stdin.Fd()), |
| now: time.Now, wait: waitDomainBuy, |
| }) |
| @@ -97,9 +102,24 @@ func domainsCheck(ctx context.Context, s *apiSession, acct apiAcct, name, countr |
| return nil |
| } |
| +// domainPurchaseReq is a purchase's body: App, or NotYet with no app; at |
| +// most one of Contact and ContactID (neither buys with the last used). |
| +type domainPurchaseReq struct { |
| + Name string `json:"name"` |
| + App string `json:"app"` |
| + NotYet bool `json:"not_yet,omitempty"` |
| + Contact *registrar.Contact `json:"contact,omitempty"` |
| + ContactID string `json:"contact_id,omitempty"` |
| + Currency string `json:"currency"` |
| + Price int64 `json:"price"` |
| +} |
| + |
| type domainBuyOptions struct { |
| yes, noWait, terminal bool |
| - contactFile string |
| + notYet bool // buy for no app; app is "" |
| + contactFile string // a new contact, from a file |
| + contactID string // a saved contact; "" with no file is the last used |
| + name, app string // set by domainsBuy for the waiting messages |
| in io.Reader |
| out io.Writer |
| now func() time.Time |
| @@ -107,17 +127,27 @@ type domainBuyOptions struct { |
| } |
| func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app string, o domainBuyOptions) error { |
| + o.name, o.app = name, app |
| var contact *registrar.Contact |
| + var saved *apiSavedContact |
| if o.contactFile != "" { |
| var err error |
| - contact, err = readDomainContact(o.contactFile) |
| + contact, err = readContactFile(o.contactFile, buyContactFileErrors) |
| if err != nil { |
| return err |
| } |
| + } else { |
| + var err error |
| + if saved, err = pickSavedContact(ctx, s, acct, o.contactID); err != nil { |
| + return err |
| + } |
| } |
| country := "" |
| - if contact != nil { |
| + switch { |
| + case contact != nil: |
| country = contact.Country |
| + case saved != nil: |
| + country = saved.Contact.Country |
| } |
| q, err := s.postDomainCheck(ctx, acct, name, country) |
| if err != nil { |
| @@ -128,11 +158,18 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| return errors.New(domainsBuyCopy["unavailable"]) |
| } |
| input := bufio.NewScanner(o.in) |
| + if o.yes && saved != nil { |
| + fmt.Fprintf(o.out, domainsAccountCopy["contactUsed"], savedContactLabel(saved.Contact)) |
| + } |
| if !o.yes { |
| if !o.terminal { |
| return errors.New(domainsBuyCopy["confirmNonTTY"]) |
| } |
| - answer, err := domainBuyAnswer(input, o.out, domainsBuyCopy["confirm"]) |
| + prompt := domainsBuyCopy["confirm"] |
| + if saved != nil { |
| + prompt = fmt.Sprintf(domainsAccountCopy["confirmContact"], savedContactLabel(saved.Contact)) |
| + } |
| + answer, err := domainBuyAnswer(input, o.out, prompt) |
| if err != nil { |
| return err |
| } |
| @@ -144,7 +181,11 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| var p domainPurchaseResp |
| contactRetried, priceRetried := false, false |
| for { |
| - p, err = s.postDomainPurchase(ctx, acct, name, app, contact, q) |
| + req := domainPurchaseReq{Name: name, App: app, NotYet: o.notYet, Contact: contact} |
| + if contact == nil && saved != nil { |
| + req.ContactID = saved.ID |
| + } |
| + p, err = s.postDomainPurchase(ctx, acct, req, q) |
| var contactErr *domainContactError |
| var priceErr *domainPriceChangedError |
| if errors.As(err, &contactErr) && !contactRetried { |
| @@ -197,30 +238,40 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| return waitDomainPurchase(ctx, s, acct, p, o) |
| } |
| -func readDomainContact(path string) (*registrar.Contact, error) { |
| +// contactFileErrors are the errors readContactFile words by the flag that |
| +// named the file: buy's --contact-file, or contacts' --file. |
| +type contactFileErrors struct{ read, json, size string } |
| + |
| +var ( |
| + buyContactFileErrors = contactFileErrors{domainsBuyCopy["contactFile"], domainsBuyCopy["contactJSON"], domainsBuyCopy["contactSize"]} |
| + contactsContactFileErrors = contactFileErrors{domainsAccountCopy["fileRead"], domainsAccountCopy["fileJSON"], domainsAccountCopy["fileSize"]} |
| +) |
| + |
| +// readContactFile reads one contact JSON object from path. |
| +func readContactFile(path string, words contactFileErrors) (*registrar.Contact, error) { |
| f, err := os.Open(path) |
| if err != nil { |
| - return nil, fmt.Errorf(domainsBuyCopy["contactFile"], err) |
| + return nil, fmt.Errorf(words.read, err) |
| } |
| defer f.Close() |
| data, err := io.ReadAll(io.LimitReader(f, (16<<10)+1)) |
| if err != nil { |
| - return nil, fmt.Errorf(domainsBuyCopy["contactFile"], err) |
| + return nil, fmt.Errorf(words.read, err) |
| } |
| if len(data) > 16<<10 { |
| - return nil, errors.New(domainsBuyCopy["contactSize"]) |
| + return nil, errors.New(words.size) |
| } |
| dec := json.NewDecoder(strings.NewReader(string(data))) |
| dec.DisallowUnknownFields() |
| var contact *registrar.Contact |
| if err := dec.Decode(&contact); err != nil { |
| - return nil, fmt.Errorf(domainsBuyCopy["contactFile"], err) |
| + return nil, fmt.Errorf(words.read, err) |
| } |
| if contact == nil { |
| - return nil, errors.New(domainsBuyCopy["contactJSON"]) |
| + return nil, errors.New(words.json) |
| } |
| if err := dec.Decode(new(any)); err != io.EOF { |
| - return nil, errors.New(domainsBuyCopy["contactJSON"]) |
| + return nil, errors.New(words.json) |
| } |
| return contact, nil |
| } |
| @@ -289,6 +340,12 @@ func waitDomainPurchase(ctx context.Context, s *apiSession, acct apiAcct, p doma |
| case "expired", "unpaid": |
| return errors.New(domainsBuyCopy[p.State]) |
| case "done": |
| + // No app (Not yet, or the app went away): nothing will serve |
| + // it, so there is no domain state to wait for. |
| + if p.Pointed != nil && !*p.Pointed { |
| + printDomainUnpointed(o.out, p, o) |
| + return nil |
| + } |
| if doneAt.IsZero() { |
| doneAt = o.now() |
| } |
| @@ -340,3 +397,17 @@ func waitDomainPurchase(ctx context.Context, s *apiSession, acct apiAcct, p doma |
| } |
| } |
| } |
| + |
| +// printDomainUnpointed is the end of a purchase that finished pointed at no |
| +// app: bought with --not-yet, or its app went away first (app_gone). |
| +func printDomainUnpointed(out io.Writer, p domainPurchaseResp, o domainBuyOptions) { |
| + domain := p.Domain |
| + if domain == "" { |
| + domain = o.name |
| + } |
| + if p.Reason == "app_gone" && o.app != "" { |
| + fmt.Fprintln(out, fmt.Sprintf(domainsAccountCopy["appGone"], o.app, domain, domain)) |
| + return |
| + } |
| + fmt.Fprintln(out, fmt.Sprintf(domainsAccountCopy["notPointed"], domain, domain)) |
| +} |
diff --git a/domains_buy_cli_test.go b/domains_buy_cli_test.go| index ea044ecd8..a5d4c1e68 100644 |
| --- a/domains_buy_cli_test.go |
| +++ b/domains_buy_cli_test.go |
| @@ -320,7 +320,7 @@ func TestDomainsBuyDoorErrors(t *testing.T) { |
| case "check": |
| _, err = s.postDomainCheck(context.Background(), apiAcct{Seg: "bab"}, "shop.com", "") |
| case "purchase": |
| - _, err = s.postDomainPurchase(context.Background(), apiAcct{Seg: "bab"}, "shop.com", "shop", nil, domainQuoteResp{Currency: "eur", Price: 1299}) |
| + _, err = s.postDomainPurchase(context.Background(), apiAcct{Seg: "bab"}, domainPurchaseReq{Name: "shop.com", App: "shop"}, domainQuoteResp{Currency: "eur", Price: 1299}) |
| case "status": |
| _, err = s.getDomainPurchase(context.Background(), apiAcct{Seg: "bab"}, "p1") |
| } |
| @@ -362,7 +362,7 @@ func TestDomainsBuyAPIExactAccountAndEscapedID(t *testing.T) { |
| case "check": |
| _, err = s.postDomainCheck(context.Background(), a, "shop.com", "") |
| case "purchase": |
| - _, err = s.postDomainPurchase(context.Background(), a, "shop.com", "shop", nil, domainQuoteResp{Currency: "eur", Price: 1299}) |
| + _, err = s.postDomainPurchase(context.Background(), a, domainPurchaseReq{Name: "shop.com", App: "shop"}, domainQuoteResp{Currency: "eur", Price: 1299}) |
| case "status": |
| _, err = s.getDomainPurchase(context.Background(), a, "p/1") |
| } |
| @@ -666,3 +666,197 @@ func TestDomainsBuyContactFileCountryWithYes(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// ---- Plan 2a Task 10: --app or --not-yet, saved contacts, ending at done ---- |
| + |
| +const savedContactsJSON = `{"contacts":[ |
| + {"id":"dc_recent","contact":{"first_name":"Ada","last_name":"Lovelace","email":"ada@example.com","phone_country_code":"44","phone":"2071234567","street":"Example Road","city":"London","postal_code":"N1 1AA","country":"GB"}}, |
| + {"id":"dc_older","contact":{"first_name":"Jane","last_name":"Buyer","email":"buyer@example.test","phone_country_code":"353","phone":"871234567","street":"Main Street","city":"Dublin","postal_code":"D01 A123","country":"IE"}}]}` |
| + |
| +func TestDomainsBuyNeedsAppOrNotYet(t *testing.T) { |
| + for name, args := range map[string][]string{ |
| + "neither": {}, |
| + "both": {"--app", "shop", "--not-yet"}, |
| + "contacts both": {"--app", "shop", "--contact", "dc_recent", "--contact-file", "contact.json"}, |
| + } { |
| + t.Run(name, func(t *testing.T) { |
| + var requests atomic.Int32 |
| + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + requests.Add(1) |
| + http.Error(w, "unexpected request", http.StatusInternalServerError) |
| + })) |
| + defer ts.Close() |
| + scratch := t.TempDir() |
| + creds := filepath.Join(scratch, "credentials") |
| + writeTestCredential(t, creds, ts.URL) |
| + argv := append([]string{"domains", "buy", "shop.com", "--account", "bab", "--console", ts.URL, "--yes"}, args...) |
| + cmd := exec.Command(buildCarlos(t), argv...) |
| + cmd.Dir = scratch |
| + cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+creds, "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=", "CARLOS_CONFIG=") |
| + out, err := cmd.CombinedOutput() |
| + if err == nil || requests.Load() != 0 || !strings.Contains(string(out), "buy needs one of --app and --not-yet") { |
| + t.Fatalf("requests=%d err=%v output=%s", requests.Load(), err, out) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// contactsBuyServer serves the saved contacts, the check (recording its |
| +// country) and the purchase (recording its body). |
| +func contactsBuyServer(t *testing.T, country *string, purchase *map[string]json.RawMessage) *httptest.Server { |
| + t.Helper() |
| + mux := http.NewServeMux() |
| + mux.HandleFunc("GET "+buyTestPath+"/contacts", func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, savedContactsJSON) |
| + }) |
| + mux.HandleFunc("POST "+buyTestPath+"/check", func(w http.ResponseWriter, r *http.Request) { |
| + var in struct{ Name, Country string } |
| + if err := json.NewDecoder(r.Body).Decode(&in); err != nil { |
| + t.Error(err) |
| + } |
| + *country = in.Country |
| + fmt.Fprint(w, `{"domain":"shop.com","available":true,"price":1299,"currency":"eur"}`) |
| + }) |
| + mux.HandleFunc("POST "+buyTestPath+"/purchases", func(w http.ResponseWriter, r *http.Request) { |
| + if err := json.NewDecoder(r.Body).Decode(purchase); err != nil { |
| + t.Error(err) |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment","checkout_url":"https://checkout.example/p1"}`) |
| + }) |
| + ts := httptest.NewServer(mux) |
| + t.Cleanup(ts.Close) |
| + return ts |
| +} |
| + |
| +// TestDomainsBuyUsesLastContactAndNamesIt: with no contact flag the most |
| +// recently used saved contact is bought with, named in the confirm line |
| +// and sent by id; --contact picks another; an unknown id buys nothing. |
| +func TestDomainsBuyUsesLastContactAndNamesIt(t *testing.T) { |
| + for _, tc := range []struct{ name, flag, wantID, wantName, wantCountry string }{ |
| + {"last used", "", "dc_recent", "Ada Lovelace", "GB"}, |
| + {"--contact", "dc_older", "dc_older", "Jane Buyer", "IE"}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + var country string |
| + var purchase map[string]json.RawMessage |
| + ts := contactsBuyServer(t, &country, &purchase) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait, o.contactID = false, true, true, tc.flag |
| + o.in = strings.NewReader("y\n") |
| + if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("%v\n%s", err, &out) |
| + } |
| + confirm := "" |
| + for _, line := range strings.Split(out.String(), "\n") { |
| + if strings.Contains(line, "[y/N]") { |
| + confirm = line |
| + } |
| + } |
| + if !strings.Contains(confirm, tc.wantName) { |
| + t.Fatalf("confirm line %q does not name %s:\n%s", confirm, tc.wantName, &out) |
| + } |
| + if country != tc.wantCountry { |
| + t.Fatalf("check country %q, want %q", country, tc.wantCountry) |
| + } |
| + var id string |
| + json.Unmarshal(purchase["contact_id"], &id) |
| + if _, sent := purchase["contact"]; sent || id != tc.wantID { |
| + t.Fatalf("purchase body %v", purchase) |
| + } |
| + }) |
| + } |
| + t.Run("unknown id", func(t *testing.T) { |
| + var country string |
| + var purchase map[string]json.RawMessage |
| + ts := contactsBuyServer(t, &country, &purchase) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.contactID = "dc_nope" |
| + err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o) |
| + if err == nil || !strings.Contains(err.Error(), "dc_nope") || purchase != nil { |
| + t.Fatalf("err=%v purchase=%v", err, purchase) |
| + } |
| + }) |
| + t.Run("with --yes", func(t *testing.T) { |
| + var country string |
| + var purchase map[string]json.RawMessage |
| + ts := contactsBuyServer(t, &country, &purchase) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.noWait = true |
| + if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !strings.Contains(out.String(), "Ada Lovelace") { |
| + t.Fatalf("--yes does not name the contact:\n%s", &out) |
| + } |
| + }) |
| +} |
| + |
| +// notPointedServer buys with no contacts saved and answers every status |
| +// poll with done, pointed false. |
| +func notPointedServer(t *testing.T, reason string, purchase *map[string]json.RawMessage, polls *int) *httptest.Server { |
| + t.Helper() |
| + return buyTestServer(t, func(w http.ResponseWriter, r *http.Request) { |
| + if err := json.NewDecoder(r.Body).Decode(purchase); err != nil { |
| + t.Error(err) |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment","checkout_url":"https://checkout.example/p1"}`) |
| + }, func(w http.ResponseWriter, r *http.Request) { |
| + *polls++ |
| + json.NewEncoder(w).Encode(map[string]any{"id": "p1", "domain": "shop.com", "app": "", "state": "done", "reason": reason, "domain_state": "", "pointed": false}) |
| + }) |
| +} |
| + |
| +func TestDomainsBuyNotYetEndsAtDone(t *testing.T) { |
| + var purchase map[string]json.RawMessage |
| + polls := 0 |
| + ts := notPointedServer(t, "", &purchase, &polls) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.notYet = true |
| + start := o.now() |
| + if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "", o); err != nil { |
| + t.Fatalf("%v\n%s", err, &out) |
| + } |
| + var app string |
| + var notYet bool |
| + json.Unmarshal(purchase["app"], &app) |
| + json.Unmarshal(purchase["not_yet"], ¬Yet) |
| + if app != "" || !notYet { |
| + t.Fatalf("purchase body %v", purchase) |
| + } |
| + if polls != 1 || o.now().Sub(start) != domainBuyPollInterval { |
| + t.Fatalf("polls=%d waited=%v: done with pointed false must end at once", polls, o.now().Sub(start)) |
| + } |
| + got := out.String() |
| + for _, want := range []string{"done", "not pointed at an app", "carlos domains point shop.com --app"} { |
| + if !strings.Contains(got, want) { |
| + t.Fatalf("output missing %q:\n%s", want, got) |
| + } |
| + } |
| + if strings.Contains(got, "domain: ") || strings.Contains(got, "background") { |
| + t.Fatalf("waited for a domain state:\n%s", got) |
| + } |
| +} |
| + |
| +func TestDomainsBuyAppGoneEndsAtDoneAndSaysSo(t *testing.T) { |
| + var purchase map[string]json.RawMessage |
| + polls := 0 |
| + ts := notPointedServer(t, "app_gone", &purchase, &polls) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("%v\n%s", err, &out) |
| + } |
| + if polls != 1 { |
| + t.Fatalf("polls=%d", polls) |
| + } |
| + got := out.String() |
| + for _, want := range []string{"shop went away", "not pointed at an app", "carlos domains point shop.com --app"} { |
| + if !strings.Contains(got, want) { |
| + t.Fatalf("output missing %q:\n%s", want, got) |
| + } |
| + } |
| +} |
diff --git a/domains_buy_copy.go b/domains_buy_copy.go| index 8d928368e..59dcaf4b3 100644 |
| --- a/domains_buy_copy.go |
| +++ b/domains_buy_copy.go |
| @@ -63,3 +63,71 @@ var domainsBuyCopy = map[string]string{ |
| "expired": "checkout was not completed. nothing was charged", |
| "unpaid": "the domain is registered but the payment did not go through. we will contact you about paying", |
| } |
| + |
| +// Drafts (Plan 2a Task 10, 2026-11-19), awaiting the copy pass (Task 11): |
| +// the account-wide list, point, saved contacts, and buying for no app. |
| +// The approved buy help and usage above stay as they are; these add the |
| +// forms they do not name. |
| +const domainsBuyNotYetHelp = ` buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags] |
| + buy a domain and point it at no app yet. buy needs one of |
| + --app and --not-yet. --contact <id> registers it to that |
| + saved contact; with neither contact flag, the one used |
| + last |
| + |
| +` |
| + |
| +const domainsBuyNotYetUsage = " carlos domains buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\n" + |
| + "buy needs one of --app and --not-yet. either takes --contact <id> in place of --contact-file\n" |
| + |
| +const domainsAccountHelp = ` list [--app <a>] [flags] |
| + without --app, every domain the account uses: bought here, |
| + being bought, or registered elsewhere, each with its |
| + addresses. with --app, that app's hostname claims, joined |
| + to the fleet's own readings sweep |
| + (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION) |
| + point <domain> --app <a> [flags] |
| + point a domain bought here at an app: the domain and its |
| + www serve the app. owners only |
| + contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags] |
| + the contacts saved for registering domains. owners only |
| +` |
| + |
| +const domainsListUsage = "usage: carlos domains list [--app <a>] [--account <a>] [--account-id <id>] [--console <origin>]\n" |
| + |
| +const domainsPointUsage = "usage: carlos domains point <domain> --app <a> [--account <a>] [--account-id <id>] [--console <origin>]\n" |
| + |
| +const domainsContactsUsage = "usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\n" |
| + |
| +var domainsAccountCopy = map[string]string{ |
| + "notYetFlag": "buy the domain without pointing it at an app yet", |
| + "contactFlag": "saved contact to register the domain to (carlos domains contacts lists them)", |
| + "fileFlag": "JSON file containing the contact details", |
| + "pointAppFlag": "app to point the domain at", |
| + "contactUnknown": "no saved contact %s. carlos domains contacts lists them", |
| + "confirmContact": "buy this domain registered to %s? [y/N] ", |
| + "contactUsed": "registered to %s\n", |
| + "notPointed": "%s is yours and not pointed at an app yet. point it with: carlos domains point %s --app <app>", |
| + "appGone": "%s went away before %s could point at it. the domain is yours and not pointed at an app. point it with: carlos domains point %s --app <app>", |
| + "noDomains": "no domains yet. buy one with carlos domains buy, or attach one to an app with carlos domains attach", |
| + "bought": "bought here, expires %s", |
| + "boughtNoDate": "bought here", |
| + "elsewhere": "registered elsewhere", |
| + "buying": "being bought: %s", |
| + "inTrash": "%s (in Trash)", |
| + "unpointed": "not pointed at an app. point it with: carlos domains point %s --app <app>", |
| + "pointed": "%s now points at %s", |
| + "pointWaiting": "saved %s for %s, but it is not live yet. its DNS records can take a few minutes to show. run this again then to finish", |
| + "hostState": "%s: %s\n", |
| + "hostStateDetail": "%s: %s (%s)\n", |
| + "noContacts": "no saved contacts. add one with: carlos domains contacts add --file contact.json", |
| + "contactsHeader": "ID\tNAME\tEMAIL\tCOUNTRY", |
| + "contactAdded": "added contact %s\n", |
| + "contactSaved": "saved contact %s\n", |
| + "contactRemoved": "removed contact %s\n", |
| + "unreadableList": "domains list: unreadable response: %w", |
| + "unreadableContacts": "domains contacts: unreadable response: %w", |
| + "unreadablePoint": "domains point: unreadable response: %w", |
| + "fileRead": "read --file: %w", |
| + "fileJSON": "--file must contain one contact JSON object", |
| + "fileSize": "--file is too large (maximum 16 KiB)", |
| +} |
diff --git a/domains_cli.go b/domains_cli.go| index 9a743cc07..c003ea088 100644 |
| --- a/domains_cli.go |
| +++ b/domains_cli.go |
| @@ -21,9 +21,9 @@ import ( |
| "github.com/carlosframework/platform/internal/clireg" |
| ) |
| -const domainsUsage = `usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags] |
| +const domainsUsage = `usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags] |
| -` + domainsBuyHelp + ` attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname> |
| +` + domainsBuyHelp + domainsBuyNotYetHelp + ` attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname> |
| claim a customer's hostname for the app, pointed at |
| --route (default: the app's single instance record, if it |
| has exactly one — otherwise --route is required). |
| @@ -46,10 +46,7 @@ const domainsUsage = `usage: carlos domains <check|buy|attach|verify|detach|list |
| the app's first route, when the app follows several. |
| detach --app <a> [flags] <hostname> |
| release a hostname claim |
| - list --app <a> [flags] |
| - this app's hostname claims, joined to the fleet's own |
| - readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION) |
| - paths --app <a> [flags] <hostname> |
| +` + domainsAccountHelp + ` paths --app <a> [flags] <hostname> |
| the leading path segments this hostname's traffic is split |
| by, as PUBLISHED. Read-only: the platform that owns the |
| hostname republishes the whole map, so there is no verb |
| @@ -82,9 +79,6 @@ const domainsVerifyUsage = `usage: carlos domains verify --app <a> [--channel <c |
| const domainsDetachUsage = `usage: carlos domains detach --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname> |
| ` |
| -const domainsListUsage = `usage: carlos domains list --app <a> [--account <a>] [--account-id <id>] [--console <origin>] |
| -` |
| - |
| const domainsPathsUsage = `usage: carlos domains paths --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname> |
| ` |
| @@ -111,13 +105,26 @@ func domainsCommand() *clireg.Node { |
| raw("verify", cust, runDomainsVerify), |
| raw("detach", cust, runDomainsDetach), |
| raw("list", cust, runDomainsList), |
| + {Name: "point", Audience: cust, Run: clireg.RawArgsErr(runDomainsPoint)}, |
| + domainsContactsCommand(), |
| raw("paths", cust, runDomainsPaths), |
| raw("placements", cust, runDomainsPlacements), |
| }, |
| Fallback: func(args, consumed []string) { |
| - log.Fatal(domainsUsage) |
| + domainsExit(errors.New(domainsUsage)) |
| }, |
| + // The verbs that return their errors (point, contacts) end here. |
| + OnError: func(path []string, err error) { domainsExit(err) }, |
| + } |
| +} |
| + |
| +// domainsExit is the family's one way out: the error (or usage) on stderr |
| +// and exit 1. -h has printed its usage already and exits 0. |
| +func domainsExit(err error) { |
| + if errors.Is(err, flag.ErrHelp) { |
| + return |
| } |
| + log.Fatal(err) |
| } |
| func runDomainsAttach(args []string) { |
| @@ -349,11 +356,24 @@ func runDomainsList(args []string) { |
| sess := requireAPISession("list", *consoleFlag) |
| printUsing(stdout, sess) |
| acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| - app2 := resolvedApp(sess, acct, *app, domainsListUsage) |
| - recs, err := sess.domainList(context.Background(), acct, app2) |
| + var err error |
| + if app2 := strings.TrimSpace(*app); app2 == "" { |
| + // Without --app, the account's domains (Plan 2a): one block per |
| + // domain, its addresses indented. |
| + err = domainsAccountList(context.Background(), sess, acct, stdout) |
| + } else { |
| + var recs []apiDomainRecord |
| + if recs, err = sess.domainList(context.Background(), acct, app2); err == nil { |
| + printDomainClaims(recs) |
| + } |
| + } |
| if err != nil { |
| log.Fatalf("domains list: %v", err) |
| } |
| +} |
| + |
| +// printDomainClaims is `domains list --app`'s table. |
| +func printDomainClaims(recs []apiDomainRecord) { |
| w := newTable(stdout) |
| // WILDCARD/CATCHALL print "yes" or "" (the route table's --hibernate/HIB |
| // convention, cli.go), never "no" — a blank cell reads as "not set" |
diff --git a/internal/console/accountdomains_copy.go b/internal/console/accountdomains_copy.go| index 4692f550d..46485fc2d 100644 |
| --- a/internal/console/accountdomains_copy.go |
| +++ b/internal/console/accountdomains_copy.go |
| @@ -165,3 +165,9 @@ var accountBuyCopy = struct { |
| ReadyTitle: "{domain} is yours", |
| ReadyLede: "It’s registered and ready to point at an app.", |
| } |
| + |
| +// domainAPICopy is the account domain API doors' own refusal (Plan 2a |
| +// Task 10). DRAFT (2026-11-19), awaiting the copy pass (Task 11). |
| +var domainAPICopy = struct{ ChooseApp string }{ |
| + ChooseApp: "choose an app to point the domain at, or not yet", |
| +} |
diff --git a/internal/console/apidomainbuy.go b/internal/console/apidomainbuy.go| index 0993fdc05..5490c1358 100644 |
| --- a/internal/console/apidomainbuy.go |
| +++ b/internal/console/apidomainbuy.go |
| @@ -101,25 +101,34 @@ func (s *Server) handleAPIDomainPurchase(w http.ResponseWriter, r *http.Request) |
| return |
| } |
| var in struct { |
| - Name string `json:"name"` |
| - App string `json:"app"` |
| - Contact *registrar.Contact `json:"contact"` |
| - Currency string `json:"currency"` |
| - Price int64 `json:"price"` |
| + Name string `json:"name"` |
| + App string `json:"app"` |
| + NotYet bool `json:"not_yet"` |
| + Contact *registrar.Contact `json:"contact"` |
| + ContactID string `json:"contact_id"` |
| + Currency string `json:"currency"` |
| + Price int64 `json:"price"` |
| } |
| if !readJSONStrictLimit(w, r, &in, 16<<10) { |
| return |
| } |
| + // An unpointed domain is never a silent default (§11.4): no app needs |
| + // not_yet, and not_yet takes no app. Refused before anything is read. |
| + if (in.App == "") != in.NotYet { |
| + writeJSON(w, http.StatusUnprocessableEntity, map[string]string{"error": domainAPICopy.ChooseApp, "code": "app"}) |
| + return |
| + } |
| if ref := s.customDomainRefusal(acct, in.Name); ref != nil { |
| writeDoorRefusalJSON(w, r, ref) |
| return |
| } |
| ctx, cancel := context.WithTimeout(r.Context(), 30*time.Second) |
| defer cancel() |
| - // A request with no contact buys with the most recently used saved |
| - // contact; with none saved, the contact refusal asks for one. |
| - sel := purchaseContactSelection{New: in.Contact} |
| - if in.Contact == nil { |
| + // A request names a saved contact (contact_id), a new one, or neither: |
| + // then it buys with the most recently used saved contact, and with none |
| + // saved the contact refusal asks for one. Both is the contact refusal. |
| + sel := purchaseContactSelection{ID: in.ContactID, New: in.Contact} |
| + if in.Contact == nil && in.ContactID == "" { |
| contacts, err := s.store.SavedContacts(ctx, acct.ID) |
| if err != nil { |
| writeDoorRefusalJSON(w, r, domainBuyUnavailable()) |
| @@ -152,6 +161,10 @@ type domainPurchaseReply struct { |
| State PurchaseState `json:"state"` |
| Reason string `json:"reason"` |
| DomainState string `json:"domain_state"` |
| + // Pointed is false for a purchase with no app: bought with Not yet, or |
| + // one whose app went away (Unpointing, then Reason "app_gone"). Its |
| + // domain_state stays empty, so a waiting caller ends at done. |
| + Pointed bool `json:"pointed"` |
| } |
| func (s *Server) purchaseForAccount(w http.ResponseWriter, r *http.Request, acct *Account, app string) *DomainPurchase { |
| @@ -168,7 +181,7 @@ func (s *Server) purchaseForAccount(w http.ResponseWriter, r *http.Request, acct |
| } |
| func (s *Server) writeDomainPurchaseStatus(w http.ResponseWriter, r *http.Request, acct *Account, p *DomainPurchase) { |
| s.nudgePurchase(p.ID) |
| - out := domainPurchaseReply{ID: p.ID, Domain: p.Domain, App: p.App, State: p.State, Reason: p.Reason} |
| + out := domainPurchaseReply{ID: p.ID, Domain: p.Domain, App: p.App, State: p.State, Reason: p.Reason, Pointed: !purchaseNoApp(p)} |
| ctx, cancel := context.WithTimeout(r.Context(), instanceStoreTimeout) |
| defer cancel() |
| out.DomainState = s.purchaseDomainState(ctx, acct, p) |
| @@ -196,3 +209,193 @@ func (s *Server) handleAPIDomainPurchaseStatus(w http.ResponseWriter, r *http.Re |
| } |
| s.writeDomainPurchaseStatus(w, r, acct, p) |
| } |
| + |
| +// domainListAPIGate is the account list's gate (Plan 2a): a person who is |
| +// any member of the account, under the domains rate ceiling. It does not |
| +// need domainBuyReady: a domain registered elsewhere needs nothing bought. |
| +func (s *Server) domainListAPIGate(w http.ResponseWriter, r *http.Request) (string, *Account, bool) { |
| + if !s.apiPerson(w, r) { |
| + return "", nil, false |
| + } |
| + addr, acct, ok := s.apiAccount(w, r) |
| + if !ok { |
| + return "", nil, false |
| + } |
| + role, err := s.store.RoleContext(r.Context(), acct.ID, addr) |
| + if err != nil || role == "" { |
| + http.NotFound(w, r) |
| + return "", nil, false |
| + } |
| + p, _ := principalFrom(r.Context()) |
| + if !s.allowDomains(p, time.Now()) { |
| + jsonError(w, http.StatusTooManyRequests, domainBuyCopy["rate"]) |
| + return "", nil, false |
| + } |
| + w.Header().Set("Cache-Control", "no-store") |
| + return role, acct, true |
| +} |
| + |
| +type apiDomainAddress struct { |
| + Host string `json:"host"` |
| + App string `json:"app"` |
| + InTrash bool `json:"in_trash"` |
| + State string `json:"state"` |
| +} |
| + |
| +type apiDomainPurchaseRef struct { |
| + ID string `json:"id,omitempty"` // owners only: the status door is theirs |
| + State PurchaseState `json:"state"` |
| +} |
| + |
| +type apiAccountDomain struct { |
| + Domain string `json:"domain"` |
| + Bought bool `json:"bought"` |
| + Expires *time.Time `json:"expires,omitempty"` |
| + Purchase *apiDomainPurchaseRef `json:"purchase,omitempty"` |
| + Addresses []apiDomainAddress `json:"addresses"` |
| +} |
| + |
| +// handleAPIAccountDomains is GET /api/cli/accounts/{account}/domains: the |
| +// Domains page's cards (accountDomains) for `carlos domains list`. |
| +func (s *Server) handleAPIAccountDomains(w http.ResponseWriter, r *http.Request) { |
| + role, acct, ok := s.domainListAPIGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + cards, err := s.accountDomains(r.Context(), acct) |
| + if err != nil { |
| + log.Printf("console: api domains %s: %v", acct.Sqid, err) |
| + jsonError(w, http.StatusServiceUnavailable, domainsPageCopy.Unread) |
| + return |
| + } |
| + out := make([]apiAccountDomain, 0, len(cards)) |
| + for _, c := range cards { |
| + d := apiAccountDomain{Domain: c.Domain, Addresses: make([]apiDomainAddress, 0, len(c.Addresses))} |
| + if c.Registration != nil { |
| + d.Bought = true |
| + expires := c.Registration.Expires.UTC() |
| + d.Expires = &expires |
| + } |
| + if c.Purchase != nil { |
| + d.Purchase = &apiDomainPurchaseRef{State: c.Purchase.State} |
| + if role == RoleOwner { |
| + d.Purchase.ID = c.Purchase.ID |
| + } |
| + } |
| + for _, a := range c.Addresses { |
| + d.Addresses = append(d.Addresses, apiDomainAddress{Host: a.Host, App: a.App, InTrash: a.AppInTrash, State: a.State}) |
| + } |
| + out = append(out, d) |
| + } |
| + writeJSON(w, http.StatusOK, map[string]any{"domains": out}) |
| +} |
| + |
| +// ---- saved contacts (Plan 2a): the owner's, behind domainBuyAPIGate ---- |
| + |
| +type apiSavedContact struct { |
| + ID string `json:"id"` |
| + Contact registrar.Contact `json:"contact"` |
| + LastUsed *time.Time `json:"last_used,omitempty"` |
| +} |
| + |
| +func apiSavedContactOf(c SavedContact) apiSavedContact { |
| + out := apiSavedContact{ID: c.ID, Contact: c.Contact} |
| + if !c.LastUsed.IsZero() { |
| + lu := c.LastUsed.UTC() |
| + out.LastUsed = &lu |
| + } |
| + return out |
| +} |
| + |
| +func writeContactRefusal(w http.ResponseWriter) { |
| + writeJSON(w, http.StatusUnprocessableEntity, map[string]string{"error": domainBuyCopy["contactError"], "code": "contact"}) |
| +} |
| + |
| +// handleAPIDomainContacts is GET .../domains/contacts: most recently used |
| +// first, the order a purchase with no contact picks from. |
| +func (s *Server) handleAPIDomainContacts(w http.ResponseWriter, r *http.Request) { |
| + _, acct, ok := s.domainBuyAPIGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + contacts, err := s.store.SavedContacts(r.Context(), acct.ID) |
| + if err != nil { |
| + log.Printf("console: api saved contacts %s: %v", acct.Sqid, err) |
| + writeDoorRefusalJSON(w, r, domainBuyUnavailable()) |
| + return |
| + } |
| + out := make([]apiSavedContact, 0, len(contacts)) |
| + for _, c := range contacts { |
| + out = append(out, apiSavedContactOf(c)) |
| + } |
| + writeJSON(w, http.StatusOK, map[string]any{"contacts": out}) |
| +} |
| + |
| +func (s *Server) handleAPIDomainContactAdd(w http.ResponseWriter, r *http.Request) { |
| + _, acct, ok := s.domainBuyAPIGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + var c registrar.Contact |
| + if !readJSONStrictLimit(w, r, &c, 16<<10) { |
| + return |
| + } |
| + if c.Validate() != nil { |
| + writeContactRefusal(w) |
| + return |
| + } |
| + sc, err := s.store.AddSavedContact(r.Context(), acct.ID, c, time.Now()) |
| + if err != nil { |
| + log.Printf("console: api add saved contact %s: %v", acct.Sqid, err) |
| + writeDoorRefusalJSON(w, r, domainBuyUnavailable()) |
| + return |
| + } |
| + writeJSON(w, http.StatusOK, apiSavedContactOf(sc)) |
| +} |
| + |
| +// handleAPIDomainContactEdit is PUT .../domains/contacts/{id}. The store |
| +// bumps the version and clears the registrar handle; purchases already |
| +// started keep their frozen copy. |
| +func (s *Server) handleAPIDomainContactEdit(w http.ResponseWriter, r *http.Request) { |
| + _, acct, ok := s.domainBuyAPIGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + var c registrar.Contact |
| + if !readJSONStrictLimit(w, r, &c, 16<<10) { |
| + return |
| + } |
| + if c.Validate() != nil { |
| + writeContactRefusal(w) |
| + return |
| + } |
| + id := r.PathValue("id") |
| + err := s.store.EditSavedContact(r.Context(), acct.ID, id, c) |
| + switch { |
| + case errors.Is(err, ErrSavedContactNotFound): |
| + http.NotFound(w, r) |
| + case err != nil: |
| + log.Printf("console: api edit saved contact %s: %v", acct.Sqid, err) |
| + writeDoorRefusalJSON(w, r, domainBuyUnavailable()) |
| + default: |
| + writeJSON(w, http.StatusOK, map[string]any{"id": id, "contact": c}) |
| + } |
| +} |
| + |
| +func (s *Server) handleAPIDomainContactRemove(w http.ResponseWriter, r *http.Request) { |
| + _, acct, ok := s.domainBuyAPIGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + id := r.PathValue("id") |
| + err := s.store.RemoveSavedContact(r.Context(), acct.ID, id) |
| + switch { |
| + case errors.Is(err, ErrSavedContactNotFound): |
| + http.NotFound(w, r) |
| + case err != nil: |
| + log.Printf("console: api remove saved contact %s: %v", acct.Sqid, err) |
| + writeDoorRefusalJSON(w, r, domainBuyUnavailable()) |
| + default: |
| + writeJSON(w, http.StatusOK, map[string]any{"id": id, "removed": true}) |
| + } |
| +} |
diff --git a/internal/console/apidomainbuy_test.go b/internal/console/apidomainbuy_test.go| index 6e9f1e410..23dd40ca9 100644 |
| --- a/internal/console/apidomainbuy_test.go |
| +++ b/internal/console/apidomainbuy_test.go |
| @@ -272,6 +272,10 @@ func TestBuyDoorsAbsentOnHostClaimConsole(t *testing.T) { |
| "route POST /api/cli/accounts/{account}/domains/check", |
| "route POST /api/cli/accounts/{account}/domains/purchases", |
| "route GET /api/cli/accounts/{account}/domains/purchases/{id}", |
| + "route GET /api/cli/accounts/{account}/domains/contacts", |
| + "route POST /api/cli/accounts/{account}/domains/contacts", |
| + "route PUT /api/cli/accounts/{account}/domains/contacts/{id}", |
| + "route DELETE /api/cli/accounts/{account}/domains/contacts/{id}", |
| "route GET /a/{sqid}/apps/{app}/domains/buy", |
| "route POST /a/{sqid}/apps/{app}/domains/check", |
| "route POST /a/{sqid}/apps/{app}/domains/buy", |
| @@ -386,7 +390,7 @@ func TestCheckDoorQuoteAndPurchaseStatusShape(t *testing.T) { |
| if err := json.Unmarshal([]byte(b), &result); err != nil { |
| t.Fatal(err) |
| } |
| - if status != 200 || len(result) != 6 || result["state"] != "done" || result["domain_state"] != StateChecking { |
| + if status != 200 || len(result) != 7 || result["state"] != "done" || result["domain_state"] != StateChecking || result["pointed"] != true { |
| t.Fatalf("status %d %s", status, b) |
| } |
| } |
| @@ -446,3 +450,259 @@ func TestBuyDoorLiveAndHeldRefusalsAreNeutral(t *testing.T) { |
| t.Fatalf("live %d %q held %d %q", s1, b1, s2, b2) |
| } |
| } |
| + |
| +// ---- Plan 2a Task 10: the account's domains, Not yet, saved contacts ---- |
| + |
| +type apiDomainsListReply struct { |
| + Domains []struct { |
| + Domain string `json:"domain"` |
| + Bought bool `json:"bought"` |
| + Expires *string `json:"expires"` |
| + Purchase *struct { |
| + ID string `json:"id"` |
| + State string `json:"state"` |
| + } `json:"purchase"` |
| + Addresses []struct { |
| + Host string `json:"host"` |
| + App string `json:"app"` |
| + InTrash bool `json:"in_trash"` |
| + State string `json:"state"` |
| + } `json:"addresses"` |
| + } `json:"domains"` |
| +} |
| + |
| +func memberToken(t *testing.T, f *purchaseFixture) string { |
| + t.Helper() |
| + if err := f.st.AddMember(f.acct.ID, "member@example.com", RoleMember, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + return cliToken(t, f.consoleFixture, "member@example.com", "list-member") |
| +} |
| + |
| +func readDomainsList(t *testing.T, f *purchaseFixture, tok string) apiDomainsListReply { |
| + t.Helper() |
| + status, b := buyRequest(t, f, "GET", buyAPIPath(f), tok, "") |
| + if status != 200 { |
| + t.Fatalf("list: %d %s", status, b) |
| + } |
| + var out apiDomainsListReply |
| + if err := json.Unmarshal([]byte(b), &out); err != nil { |
| + t.Fatalf("list: %v %s", err, b) |
| + } |
| + return out |
| +} |
| + |
| +// TestAPIDomainsListGroups: the account's domains as the Domains page |
| +// groups them: one entry per registrable domain, bought here or not, its |
| +// addresses with their app, Trash flag and state. Members read it; another |
| +// account and service credentials do not. |
| +func TestAPIDomainsListGroups(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + f.boughtUnpointed(t) |
| + adClaim(t, f.consoleFixture, f.acct, "kass", "shop.example") |
| + adClaim(t, f.consoleFixture, f.acct, "kass", "www.shop.example") |
| + for _, tok := range []string{buyToken(t, f), memberToken(t, f)} { |
| + got := readDomainsList(t, f, tok) |
| + if len(got.Domains) != 2 { |
| + t.Fatalf("domains: %+v", got) |
| + } |
| + bought, elsewhere := got.Domains[0], got.Domains[1] |
| + if bought.Domain != "shop.com" || !bought.Bought || bought.Expires == nil || len(bought.Addresses) != 0 || bought.Purchase != nil { |
| + t.Fatalf("bought: %+v", bought) |
| + } |
| + if _, err := time.Parse(time.RFC3339, *bought.Expires); err != nil { |
| + t.Fatalf("expires %q: %v", *bought.Expires, err) |
| + } |
| + if elsewhere.Domain != "shop.example" || elsewhere.Bought || elsewhere.Expires != nil || len(elsewhere.Addresses) != 2 { |
| + t.Fatalf("elsewhere: %+v", elsewhere) |
| + } |
| + for i, host := range []string{"shop.example", "www.shop.example"} { |
| + a := elsewhere.Addresses[i] |
| + if a.Host != host || a.App != "kass" || a.InTrash || a.State == "" { |
| + t.Fatalf("address %d: %+v", i, a) |
| + } |
| + } |
| + } |
| + other := planAccount(t, f.consoleFixture, 502) |
| + otherTok := cliToken(t, f.consoleFixture, "owner"+other.Sqid+"@example.com", "list-other") |
| + if status, b := buyRequest(t, f, "GET", buyAPIPath(f), otherTok, ""); status != 404 { |
| + t.Fatalf("stranger: %d %s", status, b) |
| + } |
| + svc := serviceToken(t, f.st, f.acct.ID, "list-service", "kass", svcrole.Publish) |
| + if status, b := buyRequest(t, f, "GET", buyAPIPath(f), svc, ""); status != 401 && status != 403 && status != 404 { |
| + t.Fatalf("service: %d %s", status, b) |
| + } |
| +} |
| + |
| +// TestAPIDomainsListShowsPurchase: a purchase in flight is on its domain's |
| +// entry; its id only for the owner, who alone can open it. |
| +func TestAPIDomainsListShowsPurchase(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + p := f.start(t) |
| + owner := readDomainsList(t, f, buyToken(t, f)) |
| + if len(owner.Domains) != 1 || owner.Domains[0].Purchase == nil || owner.Domains[0].Purchase.ID != p.ID || owner.Domains[0].Purchase.State != string(PurchaseAwaitingPayment) { |
| + t.Fatalf("owner: %+v", owner) |
| + } |
| + member := readDomainsList(t, f, memberToken(t, f)) |
| + if len(member.Domains) != 1 || member.Domains[0].Purchase == nil || member.Domains[0].Purchase.ID != "" || member.Domains[0].Purchase.State != string(PurchaseAwaitingPayment) { |
| + t.Fatalf("member: %+v", member) |
| + } |
| +} |
| + |
| +// TestAPIDomainsListWithoutBuyConfigured: the list is a member read, so it |
| +// answers where buying is not configured. |
| +func TestAPIDomainsListWithoutBuyConfigured(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + adClaim(t, f.consoleFixture, f.acct, "kass", "shop.example") |
| + f.srv.cfg.Registrar = nil |
| + if f.srv.domainBuyReady() { |
| + t.Fatal("buying still configured") |
| + } |
| + got := readDomainsList(t, f, memberToken(t, f)) |
| + if len(got.Domains) != 1 || got.Domains[0].Domain != "shop.example" { |
| + t.Fatalf("list: %+v", got) |
| + } |
| + if status, b := buyRequest(t, f, "GET", buyAPIPath(f)+"/contacts", buyToken(t, f), ""); status != 404 { |
| + t.Fatalf("contacts without buying: %d %s", status, b) |
| + } |
| +} |
| + |
| +// TestAPIPurchaseNotYetExplicit: no app buys nothing unless the request |
| +// says not_yet; an app and not_yet together are refused too. A Not yet |
| +// purchase answers pointed false; an app's answers true. contact_id picks |
| +// the saved contact the purchase freezes. |
| +func TestAPIPurchaseNotYetExplicit(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + tok := buyToken(t, f) |
| + first := f.saveContact(t, purchaseContact()) |
| + picked := purchaseContact() |
| + picked.FirstName = "Picked" |
| + second := f.saveContact(t, picked) |
| + if err := f.st.TouchSavedContact(context.Background(), f.acct.ID, first.ID, time.Now().Add(time.Hour)); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, body := range []string{ |
| + `{"name":"shop.com","app":"","currency":"usd","price":1500}`, |
| + `{"name":"shop.com","currency":"usd","price":1500}`, |
| + `{"name":"shop.com","app":"kass","not_yet":true,"currency":"usd","price":1500}`, |
| + } { |
| + status, b := buyRequest(t, f, "POST", buyAPIPath(f)+"/purchases", tok, body) |
| + if status != 422 || !strings.Contains(b, `"code":"app"`) { |
| + t.Fatalf("%s: %d %s", body, status, b) |
| + } |
| + } |
| + f.assertStartedNothing(t) |
| + status, b := buyRequest(t, f, "POST", buyAPIPath(f)+"/purchases", tok, |
| + `{"name":"shop.com","app":"","not_yet":true,"contact_id":"`+second.ID+`","currency":"usd","price":1500}`) |
| + if status != 200 { |
| + t.Fatalf("not yet: %d %s", status, b) |
| + } |
| + var started struct{ ID string } |
| + if err := json.Unmarshal([]byte(b), &started); err != nil || started.ID == "" { |
| + t.Fatalf("start answer %s: %v", b, err) |
| + } |
| + p := f.read(t, started.ID) |
| + if p.App != "" { |
| + t.Fatalf("app %q", p.App) |
| + } |
| + f.authorise(t, p) |
| + f.until(t, p.ID, PurchaseDone) |
| + if got := f.registrant(t, "shop.com"); got.FirstName != "Picked" { |
| + t.Fatalf("registrant %+v, want the picked contact", got) |
| + } |
| + status, b = buyRequest(t, f, "GET", buyAPIPath(f)+"/purchases/"+p.ID, tok, "") |
| + if status != 200 || !strings.Contains(b, `"pointed":false`) || !strings.Contains(b, `"state":"done"`) { |
| + t.Fatalf("status %d %s", status, b) |
| + } |
| + q := newPurchaseFixture(t) |
| + qp := q.start(t) |
| + status, b = buyRequest(t, q, "GET", buyAPIPath(q)+"/purchases/"+qp.ID, buyToken(t, q), "") |
| + if status != 200 || !strings.Contains(b, `"pointed":true`) { |
| + t.Fatalf("app purchase status %d %s", status, b) |
| + } |
| +} |
| + |
| +// TestAPIContactsOwnerOnly: the saved-contact doors list, add, edit and |
| +// remove for the owner. Members, service credentials and another account |
| +// get 404s (or the credential refusal); another account's contact is the |
| +// same 404 as an unknown one; an invalid contact is 422 code contact. |
| +func TestAPIContactsOwnerOnly(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + tok := buyToken(t, f) |
| + path := buyAPIPath(f) + "/contacts" |
| + contact, _ := json.Marshal(purchaseContact()) |
| + status, b := buyRequest(t, f, "POST", path, tok, string(contact)) |
| + if status != 200 { |
| + t.Fatalf("add: %d %s", status, b) |
| + } |
| + var added struct { |
| + ID string `json:"id"` |
| + Contact registrar.Contact `json:"contact"` |
| + } |
| + if err := json.Unmarshal([]byte(b), &added); err != nil || added.ID == "" || added.Contact != purchaseContact() { |
| + t.Fatalf("add answer %s: %v", b, err) |
| + } |
| + status, b = buyRequest(t, f, "GET", path, tok, "") |
| + var listed struct { |
| + Contacts []struct { |
| + ID string `json:"id"` |
| + Contact registrar.Contact `json:"contact"` |
| + } `json:"contacts"` |
| + } |
| + if status != 200 || json.Unmarshal([]byte(b), &listed) != nil || len(listed.Contacts) != 1 || listed.Contacts[0].ID != added.ID { |
| + t.Fatalf("list: %d %s", status, b) |
| + } |
| + edited := purchaseContact() |
| + edited.City = "Cork" |
| + editBody, _ := json.Marshal(edited) |
| + if status, b := buyRequest(t, f, "PUT", path+"/"+added.ID, tok, string(editBody)); status != 200 { |
| + t.Fatalf("edit: %d %s", status, b) |
| + } |
| + if sc, err := f.st.SavedContact(context.Background(), f.acct.ID, added.ID); err != nil || sc == nil || sc.Contact.City != "Cork" || sc.Version != 2 { |
| + t.Fatalf("edited: %+v %v", sc, err) |
| + } |
| + if status, b := buyRequest(t, f, "POST", path, tok, `{"first_name":"Jane"}`); status != 422 || !strings.Contains(b, `"code":"contact"`) { |
| + t.Fatalf("invalid add: %d %s", status, b) |
| + } |
| + if status, b := buyRequest(t, f, "PUT", path+"/"+added.ID, tok, `{"first_name":"Jane"}`); status != 422 || !strings.Contains(b, `"code":"contact"`) { |
| + t.Fatalf("invalid edit: %d %s", status, b) |
| + } |
| + |
| + other := planAccount(t, f.consoleFixture, 502) |
| + theirs, err := f.st.AddSavedContact(context.Background(), other.ID, purchaseContact(), time.Now()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, method := range []string{"PUT", "DELETE"} { |
| + s1, b1 := buyRequest(t, f, method, path+"/"+theirs.ID, tok, string(editBody)) |
| + s2, b2 := buyRequest(t, f, method, path+"/dc_unknown", tok, string(editBody)) |
| + if s1 != 404 || s2 != 404 || b1 != b2 { |
| + t.Fatalf("%s foreign %d %q unknown %d %q", method, s1, b1, s2, b2) |
| + } |
| + } |
| + |
| + member := memberToken(t, f) |
| + svc := serviceToken(t, f.st, f.acct.ID, "contacts-service", "kass", svcrole.Publish) |
| + otherTok := cliToken(t, f.consoleFixture, "owner"+other.Sqid+"@example.com", "contacts-other") |
| + for _, who := range []string{member, svc, otherTok} { |
| + for _, r := range []struct{ method, path, body string }{ |
| + {"GET", path, ""}, {"POST", path, string(contact)}, |
| + {"PUT", path + "/" + added.ID, string(editBody)}, {"DELETE", path + "/" + added.ID, ""}, |
| + } { |
| + status, b := buyRequest(t, f, r.method, r.path, who, r.body) |
| + if status != 404 && status != 403 && status != 401 { |
| + t.Fatalf("%s %s: %d %s", r.method, r.path, status, b) |
| + } |
| + } |
| + } |
| + if sc, err := f.st.SavedContacts(context.Background(), f.acct.ID); err != nil || len(sc) != 1 { |
| + t.Fatalf("refused callers changed the contacts: %+v %v", sc, err) |
| + } |
| + |
| + if status, b := buyRequest(t, f, "DELETE", path+"/"+added.ID, tok, ""); status != 200 { |
| + t.Fatalf("remove: %d %s", status, b) |
| + } |
| + if status, b := buyRequest(t, f, "DELETE", path+"/"+added.ID, tok, ""); status != 404 { |
| + t.Fatalf("remove again: %d %s", status, b) |
| + } |
| +} |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index 33efa0794..e66c139f7 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -917,6 +917,7 @@ var claimFixtures = map[string]claimFixture{ |
| "route GET /api/cli/status/layout": claimRead("operator layout view"), |
| "route GET /api/cli/store/approvals": claimRead("operator entitlement queue"), |
| "route GET /api/cli/accounts/{account}/plan": claimRead("operator view of an account's plan and limits"), |
| + "route GET /api/cli/accounts/{account}/domains": claimRead("lists the account's domains from its registrations, purchases and claims; writes nothing"), |
| "route GET /api/cli/billing/problems": claimRead("operator view of billing problems; names no app"), |
| "route GET /api/cli/billing/revenue": claimRead("operator view of billing revenue; names no app"), |
| "route GET /api/cli/billing/payments": claimRead("operator view of billing payments; names no app"), |
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go| index 6e440c576..04b8f7d58 100644 |
| --- a/internal/console/claim_invariant_probes_read_test.go |
| +++ b/internal/console/claim_invariant_probes_read_test.go |
| @@ -354,9 +354,10 @@ var claimReadProbes = map[string]claimProbe{ |
| "route GET /api/cli/fleets/{account}": claimAPIRead(claimWorldFleet, "/api/cli/fleets/bab", `"pi"`, `"pi-fleet-data"`), |
| "route GET /api/cli/services/{account}": claimAPIRead(func(t *testing.T, cx *claimCase) { cx.service(t) }, |
| "/api/cli/services/bab", `"svc-a"`), |
| - "route GET /api/cli/status/instances": claimAPIRead(nil, "/api/cli/status/instances", `"instances"`), |
| - "route GET /api/cli/status/layout": claimAPIRead(nil, "/api/cli/status/layout", `"boxes"`), |
| - "route GET /api/cli/store/approvals": claimAPIRead(claimWorldApply, "/api/cli/store/approvals", `"applications"`, claimFxOwner), |
| + "route GET /api/cli/status/instances": claimAPIRead(nil, "/api/cli/status/instances", `"instances"`), |
| + "route GET /api/cli/status/layout": claimAPIRead(nil, "/api/cli/status/layout", `"boxes"`), |
| + "route GET /api/cli/store/approvals": claimAPIRead(claimWorldApply, "/api/cli/store/approvals", `"applications"`, claimFxOwner), |
| + "route GET /api/cli/accounts/{account}/domains": claimAPIRead(claimWorldAlias, "/api/cli/accounts/bab/domains", `"domain":"example.com"`, `"host":"tickets.example.com"`), |
| "route GET /api/cli/accounts/{account}/plan": claimAPIRead(func(t *testing.T, cx *claimCase) { cx.srv.cfg.PlanCatalog = examplePlanCatalog(t) }, |
| "/api/cli/accounts/bab/plan", `"plan":"free"`), |
| "route GET /api/cli/billing/problems": claimAPIRead(claimBillingProblemWorld, "/api/cli/billing/problems", `"reason":"unrecognised"`), |
diff --git a/internal/console/routedecls.go b/internal/console/routedecls.go| index f5ccd7ade..fe885c27d 100644 |
| --- a/internal/console/routedecls.go |
| +++ b/internal/console/routedecls.go |
| @@ -857,6 +857,15 @@ var routeDecls = []routeDecl{ |
| // a team credential (no team set here) cannot reach it either. |
| {Pattern: "PUT /api/cli/apps/{account}/{app}/domains/{host}/placements", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainPlacementsPut}, |
| {Pattern: "POST /api/cli/apps/{account}/{app}/domains", Kind: kindCLIScoped, Allow: svcrole.Allow(svcrole.Publish, svcrole.Instance), Target: scopeDomainBody, Handler: (*Server).handleAPIDomainAttach}, |
| + // The account's domains (apidomainbuy.go, Plan 2a): a person who is any |
| + // member, not gated on buying, since a domain registered elsewhere needs |
| + // nothing bought. Every door below it is the owner's, behind |
| + // domainBuyAPIGate, and not registered on a host-claim console. |
| + {Pattern: "GET /api/cli/accounts/{account}/domains", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIAccountDomains}, |
| + {Pattern: "GET /api/cli/accounts/{account}/domains/contacts", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainContacts}, |
| + {Pattern: "POST /api/cli/accounts/{account}/domains/contacts", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainContactAdd}, |
| + {Pattern: "PUT /api/cli/accounts/{account}/domains/contacts/{id}", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainContactEdit}, |
| + {Pattern: "DELETE /api/cli/accounts/{account}/domains/contacts/{id}", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainContactRemove}, |
| {Pattern: "POST /api/cli/accounts/{account}/domains/check", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainCheck}, |
| {Pattern: "POST /api/cli/accounts/{account}/domains/purchases", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainPurchase}, |
| {Pattern: "GET /api/cli/accounts/{account}/domains/purchases/{id}", Kind: kindCLI, Gate: gateNoHostClaim, Allow: svcrole.Set{}, Handler: (*Server).handleAPIDomainPurchaseStatus}, |
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go| index 63f35f1c8..907ea35ff 100644 |
| --- a/internal/console/svcroutes_test.go |
| +++ b/internal/console/svcroutes_test.go |
| @@ -239,6 +239,13 @@ var closedDoors = []string{ |
| "GET /api/cli/accounts/{account}/domains/purchases/{id}", |
| "POST /api/cli/accounts/{account}/domains/check", |
| "POST /api/cli/accounts/{account}/domains/purchases", |
| + // An account's domains are read by its people (members), and its saved |
| + // contacts are the owner's personal data: no machine credential. |
| + "GET /api/cli/accounts/{account}/domains", |
| + "GET /api/cli/accounts/{account}/domains/contacts", |
| + "POST /api/cli/accounts/{account}/domains/contacts", |
| + "PUT /api/cli/accounts/{account}/domains/contacts/{id}", |
| + "DELETE /api/cli/accounts/{account}/domains/contacts/{id}", |
| // Pointing a bought domain is the owner's act, a person's (domainpoint.go). |
| "POST /api/cli/apps/{account}/{app}/domains/point", |
| "GET /api/cli/accounts/{account}/plan", |
| @@ -444,6 +451,10 @@ var demoOperatorDoors = []string{ |
| // domainBuyDoors are closed doors (in closedDoors) that a host-claim console |
| // does not register: buying domains is off there. |
| var domainBuyDoors = []string{ |
| + "GET /api/cli/accounts/{account}/domains/contacts", |
| + "POST /api/cli/accounts/{account}/domains/contacts", |
| + "PUT /api/cli/accounts/{account}/domains/contacts/{id}", |
| + "DELETE /api/cli/accounts/{account}/domains/contacts/{id}", |
| "GET /api/cli/accounts/{account}/domains/purchases/{id}", |
| "POST /api/cli/accounts/{account}/domains/check", |
| "POST /api/cli/accounts/{account}/domains/purchases", |
| @@ -1772,8 +1783,8 @@ func TestEveryClosedDoorRefusesAServiceCredential(t *testing.T) { |
| } |
| seen++ |
| } |
| - if seen != len(closedDoors) || seen != 104 { |
| - t.Errorf("walked %d closed doors, want all %d (and 104 today: three domain purchase doors, the domain point door, two managed admission doors, the fleet show door, two managed configuration doors, three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, seven fleets, the instance label door, the fleet secrets key door, the two person link doors (list and unlink), the six home link doors, four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, eleven system doors, three deployment-wide antivirus, the PDF status door, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, the billing revenue and payments doors, the billing house door, three account subdomain doors, the subdomain inventory, and the claimed source door)", |
| + if seen != len(closedDoors) || seen != 109 { |
| + t.Errorf("walked %d closed doors, want all %d (and 109 today: three domain purchase doors, the account's domains list, four saved-contact doors, the domain point door, two managed admission doors, the fleet show door, two managed configuration doors, three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, seven fleets, the instance label door, the fleet secrets key door, the two person link doors (list and unlink), the six home link doors, four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, eleven system doors, three deployment-wide antivirus, the PDF status door, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, the billing revenue and payments doors, the billing house door, three account subdomain doors, the subdomain inventory, and the claimed source door)", |
| seen, len(closedDoors)) |
| } |
| } |
diff --git a/parity/cli.tsv b/parity/cli.tsv| index cb32f4faf..817ec33ad 100644 |
| --- a/parity/cli.tsv |
| +++ b/parity/cli.tsv |
| @@ -67,10 +67,15 @@ devbox unshare customer - - - - - |
| domains attach customer - - - - - |
| domains buy customer - - - - - |
| domains check customer - - - - - |
| +domains contacts add customer - - - - - |
| +domains contacts edit customer - - - - - |
| +domains contacts list customer - - - - - |
| +domains contacts remove customer - - - - - |
| domains detach customer - - - - - |
| domains list customer - - - - - |
| domains paths customer - - - - - |
| domains placements customer - - - - - |
| +domains point customer - - - - - |
| domains verify customer - - - - - |
| economics backhaul operator - - - - - |
| economics bill operator - - - - - |
diff --git a/parity/parity.tsv b/parity/parity.tsv| index 9ff3ff8e1..21ef1b936 100644 |
| --- a/parity/parity.tsv |
| +++ b/parity/parity.tsv |
| @@ -81,14 +81,14 @@ restart instances partial restart POST /a/{sqid}/apps/{app}/restart ; POST /a/{s |
| move instances gap move ; move status ; move cut ; move abort ; move resolve [--retry] ; move offline stage ; move offline start ; move offline seal ; move offline flip ; move offline open ; move offline finish ; move offline abort ; move offline status ; move offline run wp-instances Region moves; the instance page shows only that a move is running. |
| # domains |
| -domains-list domains both domains list GET /a/{sqid}/apps/{app}/settings/{section} |
| -domains-account domains console-only GET /a/{sqid}/domains The account's domains, bought here and registered elsewhere; the CLI list comes later. |
| -domains-account-page domains console-only GET /a/{sqid}/domains/{domain} One domain's addresses, expiry and the records to set; the CLI list comes later. |
| +domains-list domains both domains list [--app] GET /a/{sqid}/apps/{app}/settings/{section} |
| +domains-account domains both domains list [account-wide] GET /a/{sqid}/domains The account's domains, bought here and registered elsewhere, each with its addresses. |
| +domains-account-page domains console-only GET /a/{sqid}/domains/{domain} One domain's addresses, expiry and the records to set; the CLI list shows the addresses and expiry, and domains list --app the records. |
| domains-attach domains both domains attach ; domains detach POST /a/{sqid}/apps/{app}/domains/attach ; POST /a/{sqid}/apps/{app}/domains/detach |
| domains-verify domains partial domains verify POST /a/{sqid}/apps/{app}/domains/attach There is no Verify button; attaching again verifies. |
| domains-buy domains both domains check ; domains buy GET /a/{sqid}/domains/buy ; POST /a/{sqid}/domains/buy/check ; POST /a/{sqid}/domains/buy ; GET /a/{sqid}/domains/purchases/{id} ; GET /a/{sqid}/domains/purchases/{id}/status ; GET /a/{sqid}/apps/{app}/domains/buy ; POST /a/{sqid}/apps/{app}/domains/check ; POST /a/{sqid}/apps/{app}/domains/buy ; GET /a/{sqid}/apps/{app}/domains/purchases/{id} ; GET /a/{sqid}/apps/{app}/domains/purchases/{id}/status The app-scoped routes only redirect to the account's. |
| -domains-contacts domains console-only POST /a/{sqid}/domains/contacts ; POST /a/{sqid}/domains/contacts/{id} ; POST /a/{sqid}/domains/contacts/{id}/remove Saved contacts are added, edited and removed on the Domains page; the CLI buys with the most recently used one. |
| -domains-point domains console-only POST /a/{sqid}/apps/{app}/domains/point Pointing a bought domain at an app; the CLI verb comes later. |
| +domains-contacts domains both domains contacts list ; domains contacts add ; domains contacts edit ; domains contacts remove POST /a/{sqid}/domains/contacts ; POST /a/{sqid}/domains/contacts/{id} ; POST /a/{sqid}/domains/contacts/{id}/remove Saved contacts are added, edited and removed on the Domains page and with domains contacts; a purchase with no contact named uses the most recently used one. |
| +domains-point domains both domains point POST /a/{sqid}/apps/{app}/domains/point |
| domains-paths domains gap domains paths wp-settings |
| domains-placements domains gap domains placements wp-settings |
| gate domains both gate set ; gate clear ; gate list POST /a/{sqid}/apps/{app}/gate ; GET /a/{sqid}/apps/{app}/settings/{section} |
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl| index 39e24f262..b474993d3 100644 |
| --- a/testdata/clireg-golden.jsonl |
| +++ b/testdata/clireg-golden.jsonl |
| @@ -218,26 +218,42 @@ |
| {"case":"devbox | zz-unknown","argv":["devbox","zz-unknown"],"exit":2,"stdout":"","stderr":"unknown devbox command zz-unknown. use share, unshare or list\n"} |
| {"case":"domains attach | --zz-unknown-flag","argv":["domains","attach","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --catchall derive a *.<host> catch-all alias to the same route (needs --wildcard)\n --console <string> console to attach through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --platform attach a hostname in this deployment's own domains (platform operators only)\n --route <string> route hostname to attach to\n --wildcard enable a delegated wildcard cert for this hostname (needs a CNAME — see the 422 message if refused)\n"} |
| {"case":"domains attach | -h","argv":["domains","attach","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --catchall derive a *.<host> catch-all alias to the same route (needs --wildcard)\n --console <string> console to attach through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --platform attach a hostname in this deployment's own domains (platform operators only)\n --route <string> route hostname to attach to\n --wildcard enable a delegated wildcard cert for this hostname (needs a CNAME — see the 422 message if refused)\n"} |
| -{"case":"domains buy | --zz-unknown-flag","argv":["domains","buy","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app <string> app the domain will serve\n --console <string> console to use (default: the only logged-in one)\n --contact-file <string> JSON file containing your contact details\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --no-wait print the checkout link and return without waiting\n --yes confirm the purchase without prompting\n"} |
| -{"case":"domains buy | -h","argv":["domains","buy","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app <string> app the domain will serve\n --console <string> console to use (default: the only logged-in one)\n --contact-file <string> JSON file containing your contact details\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --no-wait print the checkout link and return without waiting\n --yes confirm the purchase without prompting\n"} |
| +{"case":"domains buy | --zz-unknown-flag","argv":["domains","buy","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\n carlos domains buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\nbuy needs one of --app and --not-yet. either takes --contact <id> in place of --contact-file\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app <string> app the domain will serve\n --console <string> console to use (default: the only logged-in one)\n --contact <string> saved contact to register the domain to (carlos domains contacts lists them)\n --contact-file <string> JSON file containing your contact details\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --no-wait print the checkout link and return without waiting\n --not-yet buy the domain without pointing it at an app yet\n --yes confirm the purchase without prompting\n"} |
| +{"case":"domains buy | -h","argv":["domains","buy","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\n carlos domains buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [--account <a>] [--account-id <id>] [--console <origin>]\nbuy needs one of --app and --not-yet. either takes --contact <id> in place of --contact-file\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app <string> app the domain will serve\n --console <string> console to use (default: the only logged-in one)\n --contact <string> saved contact to register the domain to (carlos domains contacts lists them)\n --contact-file <string> JSON file containing your contact details\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --no-wait print the checkout link and return without waiting\n --not-yet buy the domain without pointing it at an app yet\n --yes confirm the purchase without prompting\n"} |
| {"case":"domains check | --zz-unknown-flag","argv":["domains","check","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains check <name> [--country <cc>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --country <string> country for the price check when no billing currency is set (two letters)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains check | -h","argv":["domains","check","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains check <name> [--country <cc>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --country <string> country for the price check when no billing currency is set (two letters)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains contacts add | --zz-unknown-flag","argv":["domains","contacts","add","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --file <string> JSON file containing the contact details\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains contacts add | -h","argv":["domains","contacts","add","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --file <string> JSON file containing the contact details\n"} |
| +{"case":"domains contacts edit | --zz-unknown-flag","argv":["domains","contacts","edit","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --file <string> JSON file containing the contact details\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains contacts edit | -h","argv":["domains","contacts","edit","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --file <string> JSON file containing the contact details\n"} |
| +{"case":"domains contacts list | --zz-unknown-flag","argv":["domains","contacts","list","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains contacts list | -h","argv":["domains","contacts","list","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains contacts remove | --zz-unknown-flag","argv":["domains","contacts","remove","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains contacts remove | -h","argv":["domains","contacts","remove","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains contacts | --help","argv":["domains","contacts","--help"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains contacts | --zz-unknown-flag","argv":["domains","contacts","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains contacts | -h","argv":["domains","contacts","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains contacts | bare","argv":["domains","contacts"],"exit":1,"stdout":"","stderr":"no deployment target configured: set CARLOS_DEPLOYMENT_BUCKET (or CARLOS_DEPLOYMENT_DIR) for direct bucket access, or run carlos auth login --console <url> to work through a console\n"} |
| +{"case":"domains contacts | help","argv":["domains","contacts","help"],"exit":1,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\n"} |
| +{"case":"domains contacts | zz-unknown","argv":["domains","contacts","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos domains contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [--account <a>] [--account-id <id>] [--console <origin>]\n"} |
| {"case":"domains detach | --zz-unknown-flag","argv":["domains","detach","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains detach --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --console <string> console to detach through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains detach | -h","argv":["domains","detach","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains detach --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --console <string> console to detach through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| -{"case":"domains list | --zz-unknown-flag","argv":["domains","list","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains list --app <a> [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app whose hostname claims to list\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| -{"case":"domains list | -h","argv":["domains","list","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains list --app <a> [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app whose hostname claims to list\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains list | --zz-unknown-flag","argv":["domains","list","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains list [--app <a>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app whose hostname claims to list\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| +{"case":"domains list | -h","argv":["domains","list","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains list [--app <a>] [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app whose hostname claims to list\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains paths | --zz-unknown-flag","argv":["domains","paths","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains paths --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --console <string> console to read through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains paths | -h","argv":["domains","paths","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains paths --app <a> [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --console <string> console to read through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains placements | --zz-unknown-flag","argv":["domains","placements","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --catchall also serve every one-label name under the domain from the same instances. set it only when the domain is created. it requires --wildcard\n --console <string> console to read through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --set <value> give the region and the instance that serves the hostname there, as region=instance. repeat this for each region\n --wildcard use one wildcard certificate for the domain. set it only when the domain is created. it needs a CNAME. the message says which CNAME is missing\n"} |
| {"case":"domains placements | -h","argv":["domains","placements","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --catchall also serve every one-label name under the domain from the same instances. set it only when the domain is created. it requires --wildcard\n --console <string> console to read through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --set <value> give the region and the instance that serves the hostname there, as region=instance. repeat this for each region\n --wildcard use one wildcard certificate for the domain. set it only when the domain is created. it needs a CNAME. the message says which CNAME is missing\n"} |
| +{"case":"domains point | --zz-unknown-flag","argv":["domains","point","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains point <domain> --app <a> [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app, -a <string> app to point the domain at\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\nflag provided but not defined: -zz-unknown-flag\n"} |
| +{"case":"domains point | -h","argv":["domains","point","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains point <domain> --app <a> [--account <a>] [--account-id <id>] [--console <origin>]\nflags:\n --account <string> account (sqid or name)\n --account-id <string> account sqid, matched as a sqid only\n --app, -a <string> app to point the domain at\n --console <string> console to use (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains verify | --zz-unknown-flag","argv":["domains","verify","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos domains verify --app <a> [--channel <c>] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --channel <string> channel a first-route hostname serves (only needed when the app follows several)\n --console <string> console to verify through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| {"case":"domains verify | -h","argv":["domains","verify","-h"],"exit":0,"stdout":"","stderr":"usage: carlos domains verify --app <a> [--channel <c>] [--account <a>] [--account-id <id>] [--console <origin>] <hostname>\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> app the hostname belongs to\n --channel <string> channel a first-route hostname serves (only needed when the app follows several)\n --console <string> console to verify through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"} |
| -{"case":"domains | --help","argv":["domains","--help"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| -{"case":"domains | --zz-unknown-flag","argv":["domains","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| -{"case":"domains | -h","argv":["domains","-h"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| -{"case":"domains | bare","argv":["domains"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| -{"case":"domains | help","argv":["domains","help"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| -{"case":"domains | zz-unknown","argv":["domains","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list --app <a> [flags]\n this app's hostname claims, joined to the fleet's own\n readings sweep (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | --help","argv":["domains","--help"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | --zz-unknown-flag","argv":["domains","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | -h","argv":["domains","-h"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | bare","argv":["domains"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | help","argv":["domains","help"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| +{"case":"domains | zz-unknown","argv":["domains","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos domains <check|buy|attach|verify|detach|list|point|contacts|paths|placements> [flags]\n\n check <name> [--country <cc>] [flags]\n check availability and the price for one year\n buy <name> --app <a> [--contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and wait for it to serve the app\n\n buy <name> --not-yet [--contact <id> | --contact-file contact.json] [--yes] [--no-wait] [flags]\n buy a domain and point it at no app yet. buy needs one of\n --app and --not-yet. --contact <id> registers it to that\n saved contact; with neither contact flag, the one used\n last\n\n attach --app <a> [--route <r>] [--wildcard] [--catchall] [--platform] [flags] <hostname>\n claim a customer's hostname for the app, pointed at\n --route (default: the app's single instance record, if it\n has exactly one — otherwise --route is required).\n --wildcard/--catchall are capability flips: naming either\n one changes it, an unset flag leaves it as it was.\n --platform attaches a hostname in this deployment's own\n domains. Platform operators only.\n Where the deployment requires proof of control, the\n hostname is not served until you add the TXT record\n attach prints.\n attach --app <a> '*.<parent>'\n an instance catch-all: each of the app's instances also\n answers at <label>.<parent>, where <label> is its host's\n first label. <parent> must already be attached to an app\n in this account. Signed-in people only; takes no other\n flag. Detach it with: detach --app <a> '*.<parent>'.\n verify --app <a> [--channel <c>] [flags] <hostname>\n check the TXT record and, once it is there, make the\n hostname live. --channel is for a hostname that will be\n the app's first route, when the app follows several.\n detach --app <a> [flags] <hostname>\n release a hostname claim\n list [--app <a>] [flags]\n without --app, every domain the account uses: bought here,\n being bought, or registered elsewhere, each with its\n addresses. with --app, that app's hostname claims, joined\n to the fleet's own readings sweep\n (DNS/CERT-EXPIRES/WILDCARD/CATCHALL/DELEGATION)\n point <domain> --app <a> [flags]\n point a domain bought here at an app: the domain and its\n www serve the app. owners only\n contacts [list | add --file contact.json | edit <id> --file contact.json | remove <id>] [flags]\n the contacts saved for registering domains. owners only\n paths --app <a> [flags] <hostname>\n the leading path segments this hostname's traffic is split\n by, as PUBLISHED. Read-only: the platform that owns the\n hostname republishes the whole map, so there is no verb\n here that writes one.\n placements --app <a> [--set <region>=<instance>]... [--wildcard] [--catchall] [flags] <hostname>\n without --set, shows which instance serves the hostname in\n each region, whether it is ready, and the addresses to\n point DNS at. with --set, makes the hostname a regional\n domain. each region serves it from the instance named for\n it, and a request is never sent to another region. give\n the whole set every time. --wildcard and --catchall take\n effect only when the domain is created.\n\n --account <a> account (sqid or name; default \"ops\")\n --account-id <id> account sqid, matched as a sqid ONLY\n --console <origin> console to act through (default: the only logged-in one)\n\nSigned-in only (carlos auth login): a claim is a console-authorized write —\nthe console checks the hostname against the deploy's deny list, resolves the\nroute, and writes it. The hostname comes live on the box that owns the route\nat its next domains pass.\n"} |
| {"case":"economics backhaul | --zz-unknown-flag","argv":["economics","backhaul","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos economics backhaul [--period mtd|last|7d] [--console <origin>]\n\nShows what serving through region edges costs the platform this period:\nthe part of every account's egress that was backhauled from its home box\n(usage.EdgeRow's hop subset — inside the egress totals, never on top),\npriced at the rate card's inter-region $/GB (the extra leg; the home box's\nbytes are already egress) and ABSORBED — it is in nobody's bill (#284).\nOperator only; a non-operator's token gets the same bare 404 an unknown\nroute gets.\nflags:\n --console <string> console to ask (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --period <string> mtd (default), last, or 7d\n"} |
| {"case":"economics backhaul | -h","argv":["economics","backhaul","-h"],"exit":0,"stdout":"","stderr":"usage: carlos economics backhaul [--period mtd|last|7d] [--console <origin>]\n\nShows what serving through region edges costs the platform this period:\nthe part of every account's egress that was backhauled from its home box\n(usage.EdgeRow's hop subset — inside the egress totals, never on top),\npriced at the rate card's inter-region $/GB (the extra leg; the home box's\nbytes are already egress) and ABSORBED — it is in nobody's bill (#284).\nOperator only; a non-operator's token gets the same bare 404 an unknown\nroute gets.\nflags:\n --console <string> console to ask (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --period <string> mtd (default), last, or 7d\n"} |
| {"case":"economics bill | --zz-unknown-flag","argv":["economics","bill","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos economics bill --month <YYYY-MM> --total <usd> [--line Service=usd ...] [--basis account|whole] [--console <origin>]\n carlos economics backhaul [--period mtd|last|7d] [--console <origin>]\n\nRecords one month's AWS bill for the economics dashboard. Operator only: the\nconsole answers a non-operator's token with the same bare 404 it gives an\nunknown route (it must not be probeable), so \"not found\" here almost always\nmeans your account lacks the fleet-operator bit.\n\nA manual entry always overwrites whatever the console already holds for that\nmonth — a previous Cost Explorer pull or an earlier manual entry alike.\nflags:\n --basis <string> what the total covers: account (the whole account, which runs only CARLOS) or whole (the whole account, CARLOS and other things)\n --console <string> console to record through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --line <value> one line item, repeatable: Service=usd\n --month <string> billing month, YYYY-MM (required)\n --total <float> invoice total in US dollars (required)\n"} |