Skip to content

entire status: report whether the current clone points at a mirror - #1882

Open
gtrrz-victor wants to merge 3 commits into
mainfrom
feat/status-mirror
Open

entire status: report whether the current clone points at a mirror#1882
gtrrz-victor wants to merge 3 commits into
mainfrom
feat/status-mirror

Conversation

@gtrrz-victor

@gtrrz-victor gtrrz-victor commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/960

This draft pull request was opened by Entire after CI was requested for the linked trail. Feel free to edit the title or body — the link above is what keeps the trail and PR connected.

Adds mirror reporting to entire status: whether this clone points at an Entire mirror and, when logged in, that mirror's live state — plus a hint on how to switch a direct-GitHub clone to a mirror.

The matrix

Three independent inputs decide the mirror section of entire status:

  • authsession (logged in: ENTIRE_TOKEN set, or an active login context) / no session (logged out)
  • mirrorcreated (a mirror exists server-side) / not created
  • repomirrored (this clone's git remote is an entire:// URL) / not mirrored yet (remote points straight at GitHub)

Output codes (exact strings in the legend below): M-LIVE, M-UNKNOWN, M-LOGIN, HINT, NONE.

auth mirror repo entire status output
session created mirrored M-LIVE
no session created mirrored M-LOGIN
session not created mirrored M-UNKNOWN
no session not created mirrored M-LOGIN
session created not mirrored yet HINT
no session created not mirrored yet HINT
session not created not mirrored yet HINT
no session not created not mirrored yet HINT

What the matrix shows

  • When the clone is mirrored (remote is entire://), the output is the Mirror line; its state depends on auth and on whether the mirror still exists server-side:
    • logged in + mirror exists → the live state (M-LIVE);
    • logged in + mirror gone/never created → lookup fails → M-UNKNOWN;
    • logged out → no lookup attempted → M-LOGIN.
  • When the clone is not mirrored yet (remote is GitHub), the output is always the HINT — it does not depend on auth or on whether a mirror was created. entire status reads only local git config, so it cannot see a server-side mirror from a forge clone. That is deliberate: the hint states only the local fact and points at entire repo mirror use, which does the server-side resolution (uses an existing mirror, or tells you to mirror create).
  • If the clone is not mirrored yet and the remote is not a mirrorable host (e.g. GitLab, or no remote at all), the output is NONE.

Output legend (exact rendered lines)

M-LIVE   ⇄ Mirror: <cluster> · <state>  (remote: <name>)
              <state> ∈ { ready, processing, failed, suspended }

M-UNKNOWN ⇄ Mirror: <cluster> · status unknown  (remote: <name>)

M-LOGIN   ⇄ Mirror: <cluster> · status unknown — run `entire login`  (remote: <name>)

HINT      ⇄ This clone pulls directly from <host>, not through an Entire mirror. Switch it with:
              entire repo mirror use
              (<host> read from the remote URL, e.g. github.com)

NONE      (no mirror line printed)

Pre-conditions (short-circuit before the mirror section)

repo state output
not a git repository ✕ not a git repository
git repo, Entire not set up ○ not set up (run \entire enable` to get started)`

Once set up (enabled or disabled), the mirror section renders in both short and --detailed.

JSON (entire status --json)

mirror field on the top-level object: an object when the clone is mirrored, otherwise omitted / null (the HINT is human-output only).

{
  "remote": "origin",
  "cluster": "aws-us-east-2.entire.io",
  "owner": "octocat",
  "repo": "hello-world",
  "url": "entire://aws-us-east-2.entire.io/gh/octocat/hello-world",
  "status": "ready",
  "logged_in": true
}
  • status: ready / processing / failed / suspended / unknown (unknown = logged out, or lookup failed).
  • logged_in: the auth check.

Note on the mirror use reference

The HINT names entire repo mirror use, introduced by the repo-mirror-use PR (#1875) and not yet on main. This branch is based on main, so it is intended to merge after #1875, at which point the command is registered and the hint resolves.


Note

Medium Risk
Adds a best-effort, time-bounded control-plane call on status when a mirror remote exists and the user is authenticated; failures degrade to unknown without blocking status.

Overview
entire status now surfaces how this clone is wired to git remotes: mirror detection from local entire:// URLs (short, detailed, and --json), plus guidance when the clone talks to a mirrorable forge (e.g. GitHub) directly.

For mirror remotes, output includes cluster, remote name, and—when logged in—a 4s-capped control-plane lookup for live mirror status (ready, etc.); logged-out or failed lookups show unknown (with an entire login hint when appropriate). Direct forge clones get a human-only nudge toward entire repo mirror use (no network, no JSON field).

Adds gitremote.ListRemotesInDir and origin-first remote ordering for stable scans; CLAUDE.md documents the behavior.

Reviewed by Cursor Bugbot for commit 7d249d6. Configure here.

`entire status` now reports if this clone's git remote targets an Entire
mirror and, when logged in, that mirror's live state — and hints how to
switch a direct-forge clone to a mirror.

- Local detection (offline): scan the clone's remotes for an entire:// URL
  → mirror cluster + owner/repo.
- State (only when a mirror remote exists): best-effort, time-bounded
  control-plane lookup, gated on being logged in. Logged out → `unknown`
  with an `entire login` hint. Non-mirror clones trigger no network.
- Direct-forge clone (a mirrorable host, gated on gitremote.IsSupportedForge):
  print a hint naming the host read from the remote URL (e.g. github.com) and
  pointing at `entire repo mirror use`. The hint states only the local fact —
  this clone isn't using a mirror — and does NOT claim the repo has no mirror
  (a server-side fact status doesn't look up); `mirror use` resolves an
  existing mirror or tells the user to `mirror create` when there is none.
- Surfaced in short + `--detailed` text and as the `mirror` object in
  `status --json` (null when not mirrored; the hint is human-output only).

Adds gitremote.ListRemotesInDir to enumerate remotes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01KYVW65KNJ4PFNDQ3PCSK4TRP
Copilot AI review requested due to automatic review settings July 31, 2026 10:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7d249d6. Configure here.

Comment thread cmd/entire/cli/status_mirror.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends entire status to detect whether the current clone is configured to pull from an Entire mirror (entire:// remote), and (when authenticated) to do a best-effort, time-bounded control-plane lookup to report the mirror’s live status. It also adds stable remote-order scanning support and documents the behavior.

Changes:

  • Add mirror detection and reporting to entire status (short, --detailed, and --json) with a 4s-capped live status lookup for mirror remotes.
  • Add gitremote.ListRemotesInDir and origin-first remote ordering to make remote scanning stable and predictable.
  • Document mirror-reporting behavior in CLAUDE.md.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/entire/cli/status.go Plumbs repo root through status paths and adds mirror status output + JSON field.
cmd/entire/cli/status_mirror.go Implements mirror remote detection, optional live status lookup, human output, and JSON shaping.
cmd/entire/cli/status_mirror_test.go Adds unit tests for mirror detection, hinting behavior, and JSON output.
cmd/entire/cli/gitremote/gitremote.go Adds ListRemotesInDir helper for enumerating git remotes within a directory.
cmd/entire/cli/gitremote/gitremote_test.go Adds tests validating ListRemotesInDir behavior.
CLAUDE.md Documents the new status mirror reporting behavior and its network/auth constraints.

Comment thread cmd/entire/cli/status_mirror.go
statusLoggedIn resolved the full control-plane target just to get a boolean,
which builds a keychain-backed refreshing token source — potentially slow and
able to touch the OS keychain, contradicting its "no prompt, no network"
contract. Decide from an active context in contexts.json instead (auth.Contexts
reads only that file).

Addresses PR review: heavyweight login check in status mirror lookup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01KYVXJE9PXZMVJ6ZM26VG1K2W
@gtrrz-victor
gtrrz-victor marked this pull request as ready for review July 31, 2026 11:42
@gtrrz-victor
gtrrz-victor requested a review from a team as a code owner July 31, 2026 11:42
The mirror section is gated behind the not-set-up early return, so a repo that
hasn't run `entire enable` shows only the setup funnel. Document that gating
(and the absent --json mirror field pre-enable) so the described behavior
matches the code.

Addresses trail finding: mirror info gated behind entire enable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01KYVZZTQRD0S3JG198Z0XSVEM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants