# cli/api: add `--jurisdiction` and document the command

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

Soph·1w ago·3 files·+101 added/-11 removed

`entire api --to cell` only reached the caller's home entire-api cell.
Add `--jurisdiction <slug>` (e.g. us, eu) to target a specific
jurisdiction's cell instead, reusing the existing cell machinery: it
passes `auth.CellTarget{Jurisdiction: slug}` into NewEntireAPICellClient,
which mints the jurisdictional identity token and resolves that
jurisdiction's cell URL. No new exchange/URL/security logic.

`--jurisdiction` targets a cell, so it implies `--to cell`; combining it
with an explicit `--to core` is a contradiction and errors clearly. The
slug is normalized to a bare lowercase DNS label (US/" us " -> us).

Surface it to agents: the command was already visible in `entire help`
and `entire agent-help`, and agent-help renders live from the Cobra tree,
so the updated Long/Example/flag-usage explain `--jurisdiction`
automatically on drill-down. Also document `entire api` in CLAUDE.md,
which was missing it entirely.

## Sessions

## Changes

- MCLAUDE.md+11/-1
- cmd/entire/cli  
  - Mapi_cmd.go+52/-9
  - Mapi_cmd_test.go+38/-1

```
57 unmodified lines
```

Top-level lifecycle and standalone commands: `enable`, `disable`, `status`,
`login`, `logout`, `clean`, `version`, `dispatch`, `activity`, `help`,
`configure`, `agent-help`.

`api` is an authenticated passthrough to Entire's HTTP APIs (gh-style): it
attaches the right bearer and dials the right host so callers don't plumb auth
themselves. `--to core` (default) hits the control plane; `--to cell` hits an
entire-api cell. `--jurisdiction <slug>` (e.g. `us`, `eu`) targets a specific
jurisdiction's cell instead of the caller's home cell and implies `--to cell`
(cell routing + identity-token exchange live in `auth.NewEntireAPICellClient`
via `auth.CellTarget`). `{owner}`/`{repo}`/`{repo_id}` in the path are filled
from the current repo's origin remote. It is visible in `entire help` and
`entire agent-help`, so agents discover it as the supported way to call the API.

`agent-help` renders machine-readable, agent-facing usage live from the Cobra
command tree (so it always matches the installed binary): bare prints a
```

MCLAUDE.md+11/-1
```

```
const apiMaxResponseBytes = 32 << 20 // 32 MiB cap on a printed response body.

// The two --to backends: the control plane (core) and a per-jurisdiction
// entire-api cell.
const (
	apiTargetCore = "core"
	apiTargetCell = "cell"
)

type apiFlags struct {
	to           string
	jurisdiction string
	method       string
	rawFields    []string
	typedFields  []string
}
```

```go
func runAPI(ctx context.Context, w, errW io.Writer, rawPath string, f *apiFlags) error {
	... // function implementation
}
```

```go
func TestResolveAPIClient_UnknownTarget(t *testing.T) {
	... // function test logic
}
```
