ship it · Entire

AGENTS.md instructions for /Users/gtrrz-victor/wks/cli/cli

Architecture

Key Directories

Commands (cmd/)

Command Layout

The visible CLI is organized around a set of noun groups plus a small set of top-level verbs. The groups are the canonical home for each verb; legacy top-level shortcuts remain functional but hidden, and emit a deprecation hint pointing at the canonical group form. Newer experimental command families are discoverable through entire labs and may remain hidden from root help while their canonical paths are still runnable.

Lifecycle commands

Experimental command families advertised through entire labs:

Tech Stack

Development

Running Tests

1

mise run test

Running Integration Tests

1

mise run test:integration

Running All Tests (CI)

1

mise run test:ci

Code Patterns

Error Handling

Use NewSilentError() when you want to print a custom, user-friendly error message instead of the raw error:

// In a command's RunE function:
if _, err := paths.WorktreeRoot(); err != nil {
    cmd.SilenceUsage = true  // Don't show usage for prerequisite errors
    fmt.Fprintln(cmd.ErrOrStderr(), "Not a git repository. Please run 'entire enable' from within a git repository.")
    return NewSilentError(errors.New("not a git repository"))
}

Logging vs User Output

Always use t.Parallel() in tests.

Config/Cache/Keyring Isolation in Tests

Tests must never read or write the developer's real ~/.config/entire.

Spawning subprocesses in tests (TTY detection)

Tests that spawn the real entire or git binary need the child to be non-interactive so prompts don't hang on a developer terminal.

1
2
3
4
5

import "github.com/entireio/cli/cmd/entire/cli/execx"

cmd := execx.NonInteractive(ctx, getTestBinary(), "status")
cmd.Dir = repoDir
out, err := cmd.CombinedOutput()

Control-Plane Core Resolution (which core am I talking to?)

Control-plane commands dial one of three cores: the active context's (coreapi.New), a specific cluster's (coreapi.NewForCluster). To display which core a request uses, ask the client: client.CoreOrigin().

Entire-API Cell Routing (which cell does a data-plane request go to?)

The data plane (entire-api) is deployed per jurisdiction; a repo placement lives in exactly one cell.