e2e/: E2E tests with real agent calls (see e2e/README.md)
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 their canonical paths are always
runnable.
Experimental commands are gated by a build-time visibility flag (the
cmd/entire/cli/experimental package): they are shown — grouped under an
"Experimental commands:" help section — in developer and nightly builds, and
hidden in stable release builds. Visibility is toggled by experimental.Visible
(default "true"), which GoReleaser stamps "false" only on stable tags
(.Prerelease empty); nightly (vX.Y.Z-nightly.*) and local builds leave it at
the default. Register a command as experimental with experimental.Register(parent, child) instead of parent.AddCommand(child). Gating only controls visibility —
the commands are always runnable in every build.
session (alias: sessions): list, info, tokens, stop, attach, adopt, resume, current.
resume with a branch arg switches to it and resumes its session; with no arg
it opens an interactive picker of stopped sessions (across all worktrees),
resolving each to its branch and pointing at the owning worktree when the
branch is checked out elsewhere. Resume keeps an existing local session log
as-is by default (--force overwrites it from the checkpoint).
adopt moves an active session from another repo or worktree into the current
worktree and resets target-local checkpoint bookkeeping so future commits link
to the adopted session from the new location.
checkpoint (aliases: cp, checkpoints): list, explain, tokens, search, plus
the deprecated rewind (functional, prints a cobra deprecation message, will
be removed in a future release)
agent: bare opens the interactive agent selector, plus list, add, remove
configure: bare prints help and a hint pointing at entire agent; flags
manage non-agent settings (telemetry, git-hook installation mode, strategy
options, summary provider). Agent CRUD lives under entire agent.
auth: login, logout, status, contexts, use, plus
token (prints the active control-plane bearer to stdout for scripting/curl;
honors ENTIRE_TOKEN, else the refreshed active-context login JWT). token
also takes --jurisdiction <slug> (e.g. us, eu), which instead mints a
jurisdictional identity token (RFC 8693 exchange, scope=openid,
aud=<jurisdiction host>) for that jurisdiction's entire-api cells (e.g.
https://aws-us-east-2.api.entire.io/api/v1), which reject the control-plane
bearer; it exchanges ENTIRE_TOKEN when set (deriving the environment from the
env token's aud), else the active login. auth status shows the caller's
home jurisdiction so the slug is discoverable. logout
takes --everywhere (revoke every session on the active core, not just the
current one) and (log out of every saved login)
Experimental commands (gated by the build-time visibility flag above — visible
and grouped under "Experimental commands:" in developer/nightly builds, hidden
in stable releases, always runnable): tokens, import, review,
investigate, blame, why, the top-level search shortcut, experts,
runner, and checkpoint policy. tokens is also advertised through entire labs. The canonical checkpoint search is not gated and stays visible.
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
"when to use entire / which subcommand" map; agent-help <command> drills into
one command's current flags; --json emits structured output. It is the single
source of truth the first-turn context injection and the --agent-help-skill
skill point agents at, instead of enumerating a surface that goes stale.
Hidden commands opt into being advertised here by setting
Annotations[agentHelpAnnotation] = "true" (e.g. trail). Because agent-help
renders live and lists non-hidden commands, the experimental commands appear in
agent-help in developer/nightly builds and are absent in stable releases — the
advertised surface is build-dependent, matching what entire help shows.
No-channel agents (Cursor, Copilot CLI, Factory Droid, MCP hosts — no
context-injection channel and no agent-help skill template) reach it without an
active push. All of them can discover it passively: it is visible in entire help, the entire status footer points at it, and entire status --json
exposes it as the agent_help field. On top of that, Factory AI Droid (which is
banner-only) gets the pointer appended to its SessionStart hook banner, and
MCP-host agents can launch the hidden entire mcp stdio server, which exposes
agent_help and entire_status as MCP tools using the same live rendering.
Enabling a no-channel agent with --agent-help-skill reports the skill
unsupported and points the agent at this passive path instead.
Hidden top-level shortcuts (functional, emit a one-line deprecation hint):
resume → session resume, attach → session attach, explain →
checkpoint explain, trace → doctor trace.
Cobra-native aliases (no hint): sessions → session, cp/checkpoints →
checkpoint. The search top-level is experimental (see the visibility gate
above), so it follows the build-dependent visibility rather than being
unconditionally hidden.
Deprecated top-level commands (functional, print a cobra deprecation message):
reset → clean, and rewind (no replacement, announces removal — same
deprecation as checkpoint rewind).
Hidden infrastructure commands: hooks, trail,
curl-bash-post-install, __send_analytics, mcp (MCP stdio server for
MCP-host agents).
The hideAsAlias(cmd, canonical) helper in cmd/entire/cli/aliascmd.go
marks a command Hidden and sets cobra's Deprecated field so the hint
renders to stderr on every invocation while the command stays functional.
Diagnostic subcommands live alongside doctor.go as doctor_logs.go and
doctor_bundle.go. Group roots and noun-group children live in files
named <noun>_group.go and <noun>_<verb>.go respectively.
Tech Stack
Language: Go 1.26.x
Build tool: mise, go modules
Linting: golangci-lint
Development
Running Tests
bash
mise run test
Running Integration Tests
bash
mise run test:integration
Running All Tests (CI)
bash
mise run test:ci
This runs unit tests, integration tests, and the E2E canary (Vogon agent) in sequence. Integration tests use the //go:build integration build tag and are located in cmd/entire/cli/integration_test/.
Running E2E Canary Tests (Vogon Agent)
The Vogon agent is a deterministic fake agent that exercises the full E2E test suite without making any API calls.
bash
mise run test:e2e:canary # Run all E2E tests with the Vogon agent
mise run test:e2e:canary TestFoo # Run a specific test
Runs as part of test:ci — canary failures block merges
No API calls, no cost — safe to run freely, unlike real agent E2E tests
If a canary test fails, the bug is in the CLI or test infrastructure, not in an agent
Located in e2e/vogon/ (binary) and cmd/entire/cli/agent/vogon/ (Agent interface)
The binary parses prompts via regex, creates/modifies/deletes files, and fires lifecycle hooks
IMPORTANT: When changing E2E test prompt wording, the Vogon binary (e2e/vogon/main.go) parses prompts with hardcoded regexes. New phrasing may not match existing patterns — always run mise run test:e2e:canary after changing prompt text and fix Vogon's parsing if tests fail.
Running E2E Tests (Only When Explicitly Requested)
IMPORTANT: Do NOT run E2E tests proactively. E2E tests make real API calls to agents, which consume tokens and cost money. Only run them when the user explicitly asks for E2E testing.
bash
mise run test:e2e [filter] # All agents, filtered
mise run test:e2e --agent claude-code [filter] # Claude Code only as an example here, replace `claude-code` with other agents to run tests for those agents
E2E tests:
Use the //go:build e2e build tag
Located in e2e/tests/
See e2e/README.md for full documentation (structure, debugging, adding agents)
Test real agent interactions (Claude Code, Gemini CLI, OpenCode, Cursor, Factory AI Droid, Copilot CLI, Pi, or Vogon creating files, committing, etc.)
Validate checkpoint scenarios documented in docs/architecture/checkpoint-scenarios.md
Support multiple agents via E2E_AGENT env var (claude-code, gemini, opencode, cursor, factoryai-droid, copilot-cli, pi, vogon)
Environment variables:
E2E_AGENT - Agent to test with (default: claude-code)
E2E_CLAUDE_MODEL - Claude model to use (default: haiku for cost efficiency)
E2E_TIMEOUT - Timeout per prompt (default: 2m)
Test Parallelization
Always use t.Parallel() in tests. Every top-level test function and subtest should call t.Parallel() unless it modifies process-global state (e.g., os.Chdir()).
Exception: Tests that modify process-global state cannot be parallelized. This includes os.Chdir()/t.Chdir() and os.Setenv()/t.Setenv() — Go's test framework will panic if these are used after t.Parallel().
Git in Tests
Tests that touch git state must use an isolated temp repo — never the real repo CWD.
Many handlers (lifecycle, strategy, hooks) resolve the git repo from CWD via OpenRepository, GetGitCommonDir, DetectFileChanges, etc. Without isolation, tests can create session state files, shadow branches, or other artifacts in the real .git/ directory.
Use the testutil helpers:
go
tmpDir := t.TempDir()
testutil.InitRepo(t, tmpDir) // git init + user config + disable GPG
testutil.WriteFile(t, tmpDir, "f.txt", "init") // create a file
testutil.GitAdd(t, tmpDir, "f.txt") // stage it
testutil.GitCommit(t, tmpDir, "init") // commit (needs at least one commit for HEAD)
t.Chdir(tmpDir) // redirect CWD-based git resolution
testutil.InitRepo configures user.name, user.email, and disables GPG signing — safe for CI environments without global git config.
Prefer testutil.InitRepo() over direct git.PlainInit() in tests. When a test in this repo needs an initialized repository, use testutil.InitRepo(t, dir) unless the test specifically needs lower-level initialization behavior that the helper cannot provide. Do not call git.PlainInit() directly and then create commits or run CLI git operations without also reproducing the helper's repo-local config.
Do NOT shell out to git init/git commit directly without setting user config and --no-gpg-sign, and do NOT run lifecycle/strategy handlers from the real repo CWD in tests.
Config/Cache/Keyring Isolation in Tests
Tests must never read or write the developer's real ~/.config/entire
(contexts.json, version_check.json), ~/.cache/entire (nodes.json,
cluster_cores.json, api_discovery.json), or OS keychain. The developer may be
using entire for real while tests run.
Single resolver: internal/entireclient/userdirs is the only place
that resolves the per-user config dir (userdirs.Config():
$ENTIRE_CONFIG_DIR else ~/.config/entire) and cache dir
(userdirs.Cache(): $XDG_CACHE_HOME/entire else ~/.cache/entire).
Never derive these paths anywhere else.
In-process safety net: userdirs and the tokenstore default backend
detect go test (via internal/testdirs) and fall back to a throwaway
per-process temp directory when their env override is unset. The fallback
is shared across tests in one process — for per-test isolation still set
t.Setenv("ENTIRE_CONFIG_DIR", t.TempDir()) and
tokenstore.UseFileBackendForTesting(...).
Spawned binaries are NOT covered: testing.Testing() is false in a
subprocess. The integration and e2e TestMains set ENTIRE_CONFIG_DIR,
XDG_CACHE_HOME, ENTIRE_TOKEN_STORE=file, ENTIRE_TOKEN_STORE_PATH, and
ENTIRE_TEST_AUTH_STORE_FILE process-wide so every spawned entire (and
every agent-invoked hook) inherits isolation. Any new harness that spawns
the real binary must do the same.
Legacy auth store: auth.NewStore() talks straight to the zalando
keyring; packages whose tests can reach it need keyring.MockInit() in
TestMain (see cmd/entire/cli/global_test.go) — the testdirs fallback
does not cover it in-process.
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.
interactive.CanPromptInteractively() resolves in this order:
ENTIRE_TEST_TTY=1 → force interactive ON (any other non-empty value → force OFF).
testing.Testing() → false. In-process go test runs are non-interactive by default; no per-test t.Setenv("ENTIRE_TEST_TTY", "0") is needed.
For subprocesses spawning the real entire binary (e2e, integration tests, entire calling itself from a hook), prefer execx.NonInteractive over env-var plumbing:
execx.NonInteractive puts the child in a new session with no controlling terminal (Setsid on Unix, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows), so the child's /dev/tty probe fails naturally. No env var required.
interactive.UnderTest() returns true when testing.Testing() or ENTIRE_TEST_TTY is set — use it where code needs to skip a real-terminal operation even if CanPromptInteractively() returns true (e.g., reading from /dev/tty directly inside askConfirmTTY).
Linting and Formatting
bash
mise run fmt && mise run lint
mise run fmt can rewrite files. Treat mise run fmt && mise run lint as a single verification sequence: if formatting changes anything, run lint again on the formatted tree rather than assuming a previous lint result still applies.
Before Every Commit (REQUIRED)
CI will fail if you skip these steps:
bash
mise run check
Equivalent expanded form:
bash
mise run fmt # Format code (CI enforces gofmt)
mise run lint # Lint check (CI enforces golangci-lint)
mise run test:ci # Run all tests (unit + integration)
mise run check runs the three commands above.
Safety note: do not treat a clean mise run lint result as final unless it was run after the most recent mise run fmt pass.
Before Any Push Or Remote Code Update (REQUIRED)
Before pushing commits or otherwise sending code changes to any remote, run mise run lint on the current tree and ensure it passes. If mise run fmt changed files, rerun mise run lint on the formatted tree before pushing.
Common CI failures from skipping this:
gofmt formatting differences → run mise run fmt
Lint errors → run mise run lint and fix issues
Test failures → run mise run test and fix
Code Duplication Prevention
Before implementing Go code, use /go:discover-related to find existing utilities and patterns that might be reusable.
Check for duplication:
bash
mise run dup # Comprehensive check (threshold 50) with summary
mise run dup:staged # Check only staged files
mise run lint # Normal lint includes dupl at threshold 75 (new issues only)
mise run lint:full # All issues at threshold 75
Tiered thresholds:
75 tokens (lint/CI) - Blocks on serious duplication (~20+ lines)
Check if a helper already exists in common.go or nearby utility files
If not, consider extracting the duplicated logic to a shared helper
If duplication is intentional (e.g., test setup), add a //nolint:dupl comment with explanation
Code Patterns
Error Handling
The CLI uses a specific pattern for error output to avoid duplication between Cobra and main.go.
How it works:
root.go sets SilenceErrors: true globally - Cobra never prints errors
main.go prints errors to stderr, unless the error is a SilentError
Commands return NewSilentError(err) when they've already printed a custom message
When to use SilentError:
Use NewSilentError() when you want to print a custom, user-friendly error message instead of the raw error:
go
// 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"))
}
When NOT to use SilentError:
For normal errors where the default error message is sufficient, return the error directly. main.go will print it:
go
// Normal error - main.go will print "unknown strategy: foo"
return fmt.Errorf("unknown strategy: %s", name)
Key files:
errors.go - Defines SilentError type and NewSilentError() constructor
root.go - Sets SilenceErrors: true on root command
main.go - Checks for SilentError before printing
Settings
All settings access should go through the settings package (cmd/entire/cli/settings/).
Why a separate package:
The settings package exists to avoid import cycles. The cli package imports strategy, so strategy cannot import cli. The settings package provides shared settings loading that both can use.
Usage:
go
import "github.com/entireio/cli/cmd/entire/cli/settings"
// Load full settings object
s, err := settings.Load()
if err != nil {
// handle error
}
if s.Enabled {
// ...
}
// Or use convenience functions
if settings.IsSummarizeEnabled() {
// ...
}
Do NOT:
Read .entire/settings.json or .entire/settings.local.json directly with os.ReadFile
Duplicate settings parsing logic in other packages
Create new settings helpers without adding them to the settings package
Key files:
settings/settings.go - EntireSettings struct, Load(), and helper methods
config.go - Higher-level config functions that use settings (for cli package consumers)
Logging vs User Output
Internal/debug logging: Use logging.Debug/Info/Warn/Error(ctx, msg, attrs...) from cmd/entire/cli/logging/. Writes to .entire/logs/.
Enabling debug/perf logs locally: Prefer adding "log_level": "DEBUG" to .entire/settings.local.json when you need detailed hook/perf logs. This file is gitignored. ENTIRE_LOG_LEVEL=debug also works and takes precedence.
User-facing output: Use fmt.Fprint*(cmd.OutOrStdout(), ...) or cmd.ErrOrStderr().
Don't use fmt.Print* for operational messages (checkpoint saves, hook invocations, strategy decisions) - those should use the logging package.
Privacy: Don't log user content (prompts, file contents, commit messages). Log only operational metadata (IDs, counts, paths, durations).
Git Operations
We use github.com/go-git/go-git for most git operations, but with important exceptions:
Opening Repositories - Always Use gitrepo
Never call git.Open, git.PlainOpen, or git.PlainOpenWithOptions directly.
cmd/entire/cli/gitrepo is the single source of truth for opening a
repository. Use gitrepo.OpenCurrent(ctx) for the current worktree or
gitrepo.OpenPath(root) for a specific worktree root. Both funnel through
openPathWithAlternates, which is the only place that opens a *git.Repository.
Routing every open through gitrepo guarantees two behaviours no ad-hoc
git.PlainOpen call gets right:
Object alternates are rewritten to absolute paths so shared clones resolve
their objects (PlainOpen cannot follow relative/absolute alternates).
Reftable repositories are detected and opened through the git-CLI-backed
reference storer (reftableStorer). A direct git.PlainOpen on a reftable
repo fails outright with unknown extension: refstorage, because go-git's
filesystem storer cannot read the reftable backend. The reftable storer also
re-approves the objectformat (sha1/sha256) and worktreeconfig extensions
that go-git verifies at open time.
If a code path opens a repo with a bare go-git call, it silently breaks on
reftable and sha256 repositories. Reviewers should flag any new
git.PlainOpen*/git.Open outside gitrepo. Key files: gitrepo/repository.go
(open entry points) and gitrepo/reftable.go (reftableStorer).
go-git v5 Bugs - Use CLI Instead
Do NOT use go-git v5 for checkout or reset --hard operations.
go-git v5 has a bug where worktree.Reset() with git.HardReset and worktree.Checkout() incorrectly delete untracked directories even when they're listed in .gitignore. This would destroy .entire/ and .worktrees/ directories.
See CheckoutBranch() in git_operations.go for an example.
Repo Root vs Current Working Directory
Always use repo root (not os.Getwd()) when working with git-relative paths.
Git commands like git status and worktree.Status() return paths relative to the repository root, not the current working directory. When an agent runs from a subdirectory (e.g., /repo/frontend), using os.Getwd() to construct absolute paths will produce incorrect results for files in sibling directories.
This also affects path filtering. The paths.ToRelativePath() function rejects paths starting with .., so computing relative paths from cwd instead of repo root will filter out files in sibling directories:
When to use os.Getwd(): Only when you actually need the current directory (e.g., finding agent session directories that are cwd-relative).
When to use repo root: Any time you're working with paths from git status, git diff, or any git-relative file list.
Test case in state_test.go: TestFilterAndNormalizePaths_SiblingDirectories documents this bug pattern.
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), or — when
ENTIRE_TOKEN is set — the env token's aud (the bypass inside New/
NewForCluster). This precedence lives only inside coreapi; nothing else
re-derives it.
To display which core a request uses, ask the client: client.CoreOrigin().
It returns whatever was actually wired in, so the shown core can never diverge
from where the request goes. Do NOT re-resolve with
auth.ResolveControlPlaneTarget() for display — it only knows the active
context and silently ignores both ENTIRE_TOKEN and the cluster case, so it can
name a core the request never touches (this was a real bug in the mirror list
banner; see repo_mirror.go and coreapi.Client.CoreOrigin).
When a command resolves auth outside a coreapi.Client (e.g. entire auth status, which builds its own /me client), it must apply the same
env-token-first precedence itself — see resolveAuthStatusTarget /
resolveEnvTokenStatusTarget in auth.go, which branch on
auth.EnvTokenVar before falling back to the active context. logout is the
deliberate exception: it manages a stored login session, which an ephemeral
env token has none of, so it stays on the active context.
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, user /me/* activity is consolidated in the
caller's home cell, and no server-side cross-cell aggregator exists. The CLI
therefore has exactly three routing shapes, mirroring the entire.io BFF:
Repo-scoped → one cell: resolveRepoCellTarget (cell_target.go) maps
a repo (ULID or owner/repo) to the cell hosting it via mirrors + the cluster
catalog. Best-effort: any failure returns nil and the auth layer falls back
to home-jurisdiction routing. Used by experts
(NewAuthenticatedEntireAPICellClient in api_client.go).
User-scoped /me → home cell, never fan out:
auth.NewEntireAPICellClient(ctx, insecure, nil) routes by the
home_jurisdiction JWT claim; activity/recap use it with a data-API
fallback (runAuthenticatedActivityAPI in entireapi_client.go).
Repo-set queries → fan out and merge client-side: cell_fanout.go —
groupReposByCell (repo index → per-cell groups; the catalog join key is
ClusterSlug↔Cluster.Slug, NOT the cell name, which the catalog does not
expose), resolveCellBaseURLs, and fanOutCells (parallel per-cell calls,
per-cell timeout, partial failures isolated per slot). Merge semantics stay
with the command.
Token rule: identity tokens are per-jurisdiction, not per-cell. Multi-cell
callers must build one auth.CellClientFactory
(NewEntireAPICellClientFactory) per operation — it resolves the login
subject once and mints at most one token per jurisdiction. fanOutCells does
this automatically; do not call NewEntireAPICellClient in a loop.
Session Strategy (cmd/entire/cli/strategy/)
The CLI uses a manual-commit strategy for managing session data and checkpoints. The strategy implements the Strategy interface defined in strategy.go.
Strategy Interface
The Strategy interface provides:
SaveStep() - Save session step checkpoint (code + metadata)
SaveTaskStep() - Save subagent task step checkpoint
GetRewindPoints() / Rewind() - List and restore to checkpoints
GetSessionLog() / GetSessionInfo() - Retrieve session data
How It Works
The manual-commit strategy (manual_commit*.go) does not modify the active branch - no commits are created on the working branch. Instead it:
Creates shadow branch entire/<HEAD-commit-hash[:7]>-<worktreeHash[:6]> per base commit + worktree
Worktree-specific branches - each git worktree gets its own shadow branch namespace, preventing conflicts
Supports multiple concurrent sessions - checkpoints from different sessions in the same directory interleave on the same shadow branch
Condenses session logs to permanent entire/checkpoints/v1 branch on user commits
Each committed session stores the raw transcript (full.jsonl, read by CLI rewind/resume/explain) plus a best-effort compact transcript (transcript.jsonl, generated via transcript/compact). Like full.jsonl, transcript.jsonl stores the full compacted session on every checkpoint (via compact.FullWithBoundary), so each checkpoint is self-contained and the session survives a mid-history checkpoint being lost/reverted/rebased. This checkpoint's slice begins at the session metadata's compact_transcript_start (a line offset in compact-output coordinates, distinct from checkpoint_transcript_start which indexes raw full.jsonl lines); a nil/absent marker means a legacy delta-only transcript.jsonl (read from line 0). The marker rounds toward inclusion when a streaming message straddles the boundary, so the slice never drops this checkpoint's content but may repeat ≤1 merged line at its head. Compact generation is best-effort and is skipped when the compacted output exceeds the 50MB blob cap (unlike full.jsonl, transcript.jsonl is not chunked — full.jsonl stays authoritative and the compact is regenerable); in the OPF finalize rewrite a failed/skipped regeneration drops the prior transcript.jsonl and clears the marker rather than shipping a stale, less-redacted compact. Both files are pushed with the v1 branch. The root metadata.jsonsessions[].transcript pointer keeps targeting full.jsonl; when the compact transcript was generated the session entry also carries a compact_transcript path pointing at transcript.jsonl (omitted otherwise) so external readers can locate it next to full.jsonl.
Uses the post-rewrite Git hook to keep local session linkage aligned after amend/rebase rewrites
Builds git trees in-memory using go-git plumbing APIs
Rewind restores files from shadow branch commit tree (does not use git reset)
A user reported that scripts/install.sh doesn't work with Fish shell. Analyze this issue.
Assistant
I’ll trace how scripts/install.sh detects and edits the user’s shell environment, then reproduce the Fish-specific path if Fish is available. I’ll keep this diagnostic-only and report the likely failure mode, affected lines, and test gaps.
Assistant
The script itself is Bash-only (#!/bin/bash and Bash arrays/[[ … ]]), but the advertised install form pipes it explicitly into Bash, so merely having Fish as the login shell should not break the download/install phase. The suspicious area is the first-install PATH handoff: Fish is detected only after the binary is installed, and the script prints a configuration command instead of applying it. I’m checking the exact Fish semantics and prior intent now.
Assistant
History confirms Fish support was added deliberately in the completion/PATH work, but the installer has no tests of its own; only the Go post-install completion helper is table-tested. I’m separating three possible meanings of “doesn’t work”: running the Bash script with Fish, installing from a Fish session via the documented | bash command, and whether the printed PATH fix is actually sourced by Fish.
Assistant
The diagnosis is now clear enough to bound: there is no Fish parsing support in install.sh, and there are additional Fish-only correctness gaps even when it is launched correctly through Bash. I’m doing one final syntax/test-coverage check, then I’ll rank the findings by likelihood and suggest the smallest repair scope.
Assistant
The report is valid, but there are two distinct failure modes.
Findings
install.sh is a Bash script, not a Fish script.
It uses [[ … ]], Bash arrays, local, and set -o pipefail starting at scripts/install.sh. Therefore these forms fail:
fish
fish scripts/install.sh
source scripts/install.sh
curl -fsSL https://entire.io/install.sh | fish
The documented command correctly invokes Bash explicitly in README.md:
fish
curl -fsSL https://entire.io/install.sh | bash
Thus, if the reporter used | fish, this is the immediate cause.
The documented | bash flow still has genuine Fish-specific problems.
Shell detection relies entirely on $SHELL at scripts/install.sh. $SHELL generally describes the configured/login shell, not necessarily the currently running shell. Someone who launches Fish from Bash or Zsh can therefore receive instructions for the wrong shell.
Fish’s config path is hardcoded.
The installer writes to ~/.config/fish/config.fish at scripts/install.sh, ignoring XDG_CONFIG_HOME. Fish actually uses $XDG_CONFIG_HOME/fish/config.fish when configured that way. The Go completion setup duplicates this assumption at setup.go. Fish documents the XDG-controlled location here.
A normal first install deliberately leaves entire unavailable in the current shell.
When ~/.local/bin is absent from PATH, the script only prints commands and exits at scripts/install.sh. The user must run those commands and restart Fish; otherwise remains “command not found.” The early exit also skips , so completion setup does not run during the usual first-install case.
User
Branch off, then implement those fixes
Assistant
I’ll create a focused fix/install-fish-support branch, update both the installer PATH flow and the Go completion target so their Fish/XDG behavior agrees, then add isolated tests and run the relevant checks. The requested /go:discover-related skill is not available in this session, so I’ll do the required duplication/pattern search directly with rg before editing.
Assistant
The smallest consistent design is to keep the transport explicitly Bash, remove Fish’s config-file editing entirely, and tell Fish users to run the native persistent command fish_add_path "$HOME/.local/bin". For the Go completion writer—which must edit a file—I’ll resolve $XDG_CONFIG_HOME/fish/config.fish with the standard ~/.config fallback and extend the existing table tests. I’ll also make the installer’s first-install branch run post-install work before returning, since it already has the absolute binary path.
Assistant
The first targeted pass confirms the new installer tests work. The changes now cover active-shell detection (parent Fish overriding a Zsh login shell), native persistent Fish PATH setup without editing config.fish, unknown-shell fallback instructions, installer-to-postinstall shell propagation, and XDG-aware Fish completion placement. I’m reviewing the diff for edge cases before the broader checks.
Assistant
The mocked end-to-end installer test now proves the critical sequence: with SHELL=/bin/zsh, a Fish parent, and no ~/.local/bin on PATH, installation succeeds, post-install still runs with ENTIRE_INSTALLER_SHELL=fish, and the output gives the native Fish command. A separate pipe test protects the new sourceability guard so curl … | bash continues to execute main. I’m moving into repository-wide formatting/lint and unit verification.
Assistant
Formatting and all non-Go lint stages are clean. The Go linter is still running; once it finishes I’ll address any findings, rerun lint if necessary, and then run the unit suite.
Assistant
The Go lint stage is taking longer than the shell and module checks but has not emitted an error or stalled subprocess output. I’m leaving it to complete because this repository’s lint gate analyzes the full tree, including the new test package under scripts/.
Assistant
Lint found only three repository-style violations in the new tests: subprocesses must use exec.CommandContext. I’m switching them to t.Context() and will rerun formatting and the full lint gate afterward.
Assistant
The corrected targeted tests pass, including the mocked Fish installation and the Go XDG cases. Shell syntax and ShellCheck are also clean; the second full Go lint pass is still running without new findings.
Assistant
The full unit suite is progressing cleanly across the CLI and agent packages. No failures have appeared; I’m waiting for the remaining checkpoint/integration-adjacent packages to finish, then I’ll inspect the final diff and branch status.
Assistant
All completed unit packages are passing, including the new scripts package and the checkpoint/review suites. The large top-level CLI package is the only remaining test process and is still active without failure output.
Assistant
The advisory duplication scan reports the repository’s existing baseline (845 findings) and does not flag the new installer test file. I also added a non-Windows build constraint because the installer tests intentionally require /bin/bash; I’m rerunning the mandatory format-then-lint sequence after that portability adjustment.
Assistant
Implemented on branch fix/install-fish-support.
Key changes:
Detects the invoking shell before falling back to $SHELL.
Runs post-install actions for first-time installs.
Honors XDG_CONFIG_HOME for Fish completions.
Documents that Fish users must retain | bash.
Adds mocked installer and Fish/XDG regression tests in install_test.go.
Verification passed:
mise run fmt
mise run lint — 0 issues
mise run test
bash -n scripts/install.sh
ShellCheck
Changes are uncommitted.
User
Did you install fish on this machine and try it?
Assistant
No. Fish wasn’t installed, so I used mocked end-to-end installer tests and ShellCheck. I did not validate the command in a real Fish process, and should have called that out explicitly.
User
Do that then
Assistant
I’ll install Fish with the available system package manager, run the real installer helper and pipe behavior from an actual Fish process, then report whether the implementation behaves as expected. I’ll also keep the test isolated from your real home and configuration wherever possible.
Assistant
Fish is not currently installed; Homebrew is available. I’m installing fish now, then I’ll test three real cases: Fish parsing (which should fail with a clear Bash requirement), the documented … | bash launch from Fish, and the emitted fish_add_path behavior in an isolated Fish configuration.
Assistant
Fish 4.8.1 is installed. I’m now running the local script from a real Fish parent with a deliberately misleading SHELL=/bin/zsh, plus a separate isolated universal-variable test to verify fish_add_path affects both the current and a subsequent Fish session without touching your real Fish config.
Assistant
The first test command was blocked before execution because its temporary-directory cleanup used a disallowed recursive removal pattern. Nothing ran. I’ll rerun without destructive cleanup; the isolated temporary directory can be left for the OS temp cleaner.
Assistant
The real test exposed an important test-isolation detail: Fish resets $HOME to the account home on startup, so overriding HOME is not sufficient. The attempted target was already present in this machine’s inherited PATH and therefore did not exercise persistence. No real Fish PATH state was changed. I’m rerunning with a unique temporary directory passed as a separate environment variable while keeping Fish’s universal-variable store under an isolated XDG_CONFIG_HOME.
Assistant
The real Fish checks now confirm:
cat install.sh | bash works from Fish.
With a real Fish parent and SHELL=/bin/zsh, detection returns fish.
Directly sourcing the Bash script in Fish fails, as expected.
fish_add_path correctly handles a path containing spaces and persists into a second Fish process using an isolated universal-variable store.
I’m doing one final true end-to-end run of the local installer from Fish against the real stable release, with HOME, PATH, and Fish configuration redirected inside the Fish process to a temporary location so it cannot overwrite your existing Entire installation or Fish state.
Assistant
The true end-to-end run passed: Fish launched the local installer, it downloaded and verified stable 0.9.0, installed under the temporary home, detected Fish despite SHELL=/bin/zsh, ran post-install, and printed the expected fish_add_path command. Running that exact command made entire immediately available, and a second Fish process found it via persisted Fish state. I’m checking that the repository working tree remains unchanged apart from the implementation.
Assistant
Yes. I installed Fish 4.8.1 via Homebrew and tested it directly.
Results:
install.sh | bash from Fish: passed.
Fish detected correctly even with SHELL=/bin/zsh.
Real stable release downloaded, checksummed, and installed in an isolated temp home.
Printed fish_add_path "$HOME/.local/bin" worked immediately.
A second Fish process retained the PATH and ran entire version.
Directly sourcing the Bash script in Fish fails as expected.
Fish remains installed on the machine. Repository changes are unchanged.
User
Cool. When the Entire CLI detects a new update, how does it install those?
Assistant
I’ll trace the version-check decision through the update prompt and installer execution so I can distinguish Homebrew, Scoop, and install.sh behavior precisely.
Assistant
The update path delegates to the detected package manager rather than replacing the running process itself. One Fish-related detail is worth checking: curl-installed updates are wrapped in sh -c, which may affect the invoking-shell detection we just added.
Assistant
It delegates to the original installation mechanism after a command finishes.
Checks GitHub at most once every 24 hours, after visible commands complete.
If interactive, prompts: “Update now,” “Skip,” or “Skip until next version.”
The command runs through sh -c on Unix or cmd /C on Windows with stdio attached. The existing process remains the old version, so users are told to rerun entire. See autoupdate.go and versioncheck.go.
One issue: for curl-installed updates, sh -c introduces a parent shell around curl | bash. I reproduced that an active Fish launched from Zsh is detected as Zsh on this update path. Default-login Fish works, but our new parent-shell detection needs to traverse further up the process tree or receive the shell explicitly from the updater.
User
I am not following. Does the update process work on fish?
Assistant
Yes—the CLI update itself works on Fish.
The updater launches Homebrew/Mise/Scoop or install.sh through sh, and install.sh runs through Bash. Fish never parses the installer.
The edge case I mentioned only affects which shell-completion configuration is selected afterward; it does not prevent the binary from updating.
User
Ok, open a draft PR for the changes in this branch
Assistant
I’m using the github:yeet workflow because this request includes scoping the local changes, committing, pushing, and opening a draft PR. I’ll inspect its required publish steps first, then verify the branch one last time before sending anything remote.
Assistant
The PR scope is clean: exactly the five Fish-installer files, with no unrelated worktree changes. GitHub authentication and the entireio/cli target are ready. Per this repository’s commit policy, I’m running the full mise run check gate now (format, lint, integration tests, and the no-cost Vogon E2E canary) before committing or pushing.
Assistant
The full pre-commit gate is running cleanly so far. Formatting and shell checks are complete; race-enabled unit/integration tests and the Go lint analysis are still in progress.
Assistant
Lint is fully green with zero issues. The race-enabled test suite is still running; this repository’s checkpoint and top-level CLI packages are typically the long tail, so I’m waiting for their completion before creating the commit.
Assistant
The race-enabled suite remains active without failure output. I’m keeping the publish flow paused until it exits, as required by the repository’s “before every commit” policy.
Assistant
The full check has been running about six minutes and is still inside go test -tags=integration -race ./...; the process is alive, not exited or replaced by the E2E stage yet. No failure output has appeared.
Assistant
Race-enabled unit and integration tests all passed. The final Vogon E2E canary stage has started; once that deterministic suite passes, I’ll commit the five files, rerun the mandatory pre-push lint on the committed tree, push, and open the draft PR.
Assistant
The canary is still running without failure output. This stage exercises the full checkpoint flow with the deterministic Vogon agent and often produces no incremental output until completion.
Assistant
The full required check passed, including all race-enabled unit/integration tests, 59 Vogon canaries, and 4 Roger Roger canaries. I’m staging only the five reviewed files and creating the commit now.
Assistant
Commit 41a2f7748 was created with only the intended files. I’m running the repository-mandated pre-push lint on the committed tree; after it passes I’ll push with upstream tracking and open the draft PR against main.
Assistant
Pre-push lint passed with zero issues, and branch fix/install-fish-support is now on origin. I’m creating the draft PR with the root cause, user impact, real Fish validation, and full check results.
Assistant
The GitHub connector can read the repo but lacks permission to create pull requests. I’m using the authenticated gh fallback for the draft PR.
I’m using the GitHub review-feedback workflow to inspect unresolved Cursor threads on PR #1891, validate each comment against the current code, and implement the actionable fixes.
Assistant
There are two unresolved Cursor findings, both actionable:
First installs can write completion before PATH setup, so the next shell may execute entire completion before entire is discoverable.
ps -o comm= output is not trimmed, so padded parent-process names can fall back to the wrong login shell.
I’ll address both and leave the separate Copilot-only install-directory consistency thread untouched unless the fix naturally overlaps it.
Assistant
The fixes are in place: first-install completion now prepends the install directory only for the completion-generation command, preserving the user’s existing PATH and avoiding a permanently pinned binary path. The installer also trims padded parent-process output before shell matching. I’m validating the generated syntax in Fish, Bash, and Zsh now.
Assistant
Focused regression tests pass, and the generated fallback command executes successfully in Fish, Bash, and Zsh with an install path containing spaces. I’m running the repository’s required full pre-commit check now.
Assistant
The full race-enabled test suite is still running; formatting, shellcheck, and module checks have passed so far. No failures yet.
Assistant
The required check is in its slower integration/race phase. The process remains active and has not reported an error; I’ll let it finish before committing anything.
Assistant
mise run fmt exposed four unrelated simplifications elsewhere in the repository. They were not part of the review fix, so I’m removing only those formatter side effects before committing the four intended files.
Assistant
The full required check passed: lint, race-enabled unit/integration tests, 59 Vogon canaries, and 4 Roger Roger canaries. The working tree is back to only the four intended installer/completion files; I’m committing those review fixes next.
Assistant
The review-fix commit is created as cb6472c78. The final post-format lint gate is still running and remains clean so far; I’ll push as soon as it completes.
Assistant
Addressed both Cursor findings and pushed commit cb6472c78 to PR #1891:
Completion now works before first-install PATH setup.
Padded ps output is trimmed before shell detection.
mise run check and final lint passed.
Cursor’s threads remain unresolved for re-review; the separate Copilot thread was left untouched.
Both Cursor threads remain unresolved and have not been re-reviewed.
One separate Copilot comment remains open about the hard-coded Fish install path.
Local branch is clean and synced with origin.
GitHub reports it blocked only by draft/review requirements.
User
Resolve the threads that have been address. What's with the Copilot comment?
Assistant
I’m using the GitHub review-thread workflow to verify the two Cursor fixes against the current head, resolve only those addressed threads, and assess the still-open Copilot comment separately.
Assistant
The two Cursor threads match code now present at the PR head, so I’m resolving those two. The Copilot thread is a separate maintainability concern and will remain open while I explain its tradeoff.
Assistant
The GitHub App lacks permission to resolve threads, so I’m falling back to the authenticated GitHub CLI as prescribed by the review workflow.
Assistant
Both addressed Cursor threads are now resolved on PR #1891.
The Copilot comment is valid but low priority:
show_path_setup accepts install_dir.
Bash/Zsh use that value.
Fish still hard-codes $HOME/.local/bin.
That works today because $HOME/.local/bin is the installer’s only destination. However, it could become wrong if configurable install directories are added. I left that thread open; the clean fix is to derive a Fish-friendly display path from install_dir.
User
"The Copilot comment is valid but low priority" is a useless statement
Assistant
You’re right. Concretely: Copilot found no current user-facing bug because the installer always uses $HOME/.local/bin. It found an internal inconsistency—Fish ignores install_dir while other shells use it.
The sensible choice is to fix it now because the change is trivial and prevents future drift, then resolve the thread.
User
Fix it
Assistant
I’m using the GitHub review-feedback workflow to fix the remaining Copilot thread, verify the generated commands for Fish and POSIX shells, then push and resolve it.
Assistant
The fix now derives one display path from install_dir: paths under the user’s home are rendered portably as $HOME/..., while custom locations such as /opt/entire/bin are preserved. Fish and POSIX regression tests pass; I’m running the required full check.
Assistant
Formatting, shellcheck, and module validation have passed. The full race-enabled test suite is still running without failures.
User
Then after that, look into the one human user comment
Assistant
After this fix is pushed and the Copilot thread is resolved, I’ll inspect the remaining human-authored PR comment and report whether it requires a change.
Assistant
The check remains in the slow integration/race phase; lint is clean and there are still no test failures. The human comment review is queued immediately afterward.
Assistant
The full check passed, including all race-enabled tests and both canary suites. Only the two intended installer files changed; I’m committing this fix, then I’ll inspect the human comment while the final push gate runs.
Assistant
The Copilot fix is pushed as 3b15ae169, and final lint passed. I’m resolving that thread now. The human report reveals a separate rollout-compatibility issue: the branch installer downloads stable 0.9.0, while part of this fix lives in the unreleased binary; I’m verifying the exact compatibility path.
Assistant
Copilot’s fix is pushed as 3b15ae169, its thread is resolved, and all checks passed. PR #1891 now has no unresolved review threads.
The human report identifies a real compatibility gap:
The branch installer still downloads stable CLI v0.9.0.
v0.9.0 reads only $SHELL.
It ignores the new ENTIRE_INSTALLER_SHELL and XDG_CONFIG_HOME handling.
Therefore the script detects Fish correctly, but the downloaded binary still configures Zsh.
This would also affect rollout if the new installer is published before a compatible CLI release.
The backward-compatible fix is to pass both variables to post-install:
New binaries use ENTIRE_INSTALLER_SHELL; v0.9.0 falls back to the overridden SHELL. I have not implemented or replied to the human comment yet.
User
Well?
Assistant
You’re right—I should have fixed the confirmed compatibility gap instead of stopping at the diagnosis. I’m adding the legacy $SHELL handoff now, testing it against the actual stable v0.9.0 binary from Fish, then I’ll push it to the PR.
Assistant
The automated regression passes. I’m now running the exact transition case: local branch installer launched from real Fish, downloading the released v0.9.0 binary into an isolated home with login $SHELL deliberately set to Zsh.
Assistant
The real transition test now passes: Fish launched the installer with login $SHELL=/bin/zsh, it downloaded actual v0.9.0, detected Fish, and wrote completion to the isolated Fish config—not .zshrc. I’m running the required pre-commit check on this final shim.
Assistant
The final check is in the integration/race phase. Lint is clean and the stable-binary Fish reproduction remains successful; no failures so far.
Assistant
The required check hit one unrelated timing-flake in agent/external (DeadlineWhileLookingUpMissingHelper); every installer test passed. I’m stress-running that exact test to confirm it is transient, then I’ll rerun the full gate before committing.
Assistant
The rerun passed completely; the earlier failure was confirmed transient by 20 consecutive passes of the flaky test. I’m committing the two-file compatibility shim now.
The installer now overrides $SHELL for the post-install child while also passing ENTIRE_INSTALLER_SHELL, making it compatible with both v0.9.0 and newer binaries.
Verified end-to-end with:
Real Fish shell
Login $SHELL=/bin/zsh
Actual downloaded v0.9.0 binary
Completion correctly written to ~/.config/fish/config.fish
repo: control-plane repository lifecycle — create, list, get, delete,
clone, plus the mirror and visibility subtrees. Git content operations
(log, diff, …) are intentionally out of scope.
grant: manage access grants and org membership — org, project, and repo
each support add / list / remove
entire
curl-bash-post-install
The Fish advice is more complicated than necessary.
Fish recommends running this once:
fish
fish_add_path "$HOME/.local/bin"
It updates the current session and persists through Fish’s universal variables. Fish explicitly recommends this approach. The installer instead tells users to append fish_add_path … to a hardcoded config file. Its emitted path is also unquoted, breaking homes containing spaces.
Recommended repair
Keep the installer Bash-based, but:
Clearly state that Bash is required and that | fish is unsupported.
For detected Fish, print fish_add_path "$HOME/.local/bin" directly.
Avoid relying solely on $SHELL, or show both POSIX and Fish PATH instructions.
Respect XDG_CONFIG_HOME anywhere Fish configuration is written.
Consider running post-install actions before the PATH-related early exit.
Add an isolated installer test with mocked downloads covering Fish, missing PATH, XDG_CONFIG_HOME, and misleading $SHELL.
bash -n and ShellCheck both pass; this is behavioral compatibility, not a Bash syntax defect. No files were changed.