$ show entireio/cli
The Entire CLI (`entire`) is a production-grade command-line tool that integrates AI coding agents (Claude Code, Codex, Gemini CLI, Cursor, Copilot, OpenCode, Factory AI Droid, Pi) with Git workflows. It captures session transcripts, token usage, file changes, and agent prompts as git-backed checkpoints, enabling traceability, review, and collaboration on AI-assisted development. The CLI provides commands for session management (`session`, `resume`, `clean`), checkpoint inspection (`checkpoint list`, `checkpoint policy`), multi-agent code review (`review`, `investigate`), authentication (`auth`, `login`), and project management (`project`, `grant`). It operates as a git remote helper (`git-remote-entire`) for pushing/pulling checkpoint data via the Entire data plane. Architecturally, the system is a modular Go CLI built on Cobra, with pluggable backends for checkpoint storage (git-refs and git-branch) and agent integration. Each agent has a dedicated package under `cmd/entire/cli/agent/` that implements hooks, transcript parsing, and lifecycle management. Security is a first-class concern: file operations use `os.Root` to prevent symlink escapes (`osroot`), session IDs are validated against path traversal (`validation`), and a configurable redaction pipeline strips secrets from transcripts (`redact`). The system uses OpenAPI-generated client code (`internal/coreapi`) for control plane communication and supports multi-region deployment via cross-jurisdictional HTTP clients. The codebase demonstrates high craftsmanship with clean package boundaries, extensive test coverage (unit, integration, e2e, and benchmarks), and well-documented interfaces for extensibility. Reusable components include atomic JSON file writing, cross-platform process management (`execx`), advisory file locking (`flock`), and process liveness detection (`proclive`). The review subsystem provides a framework for multi-agent code review with structured findings, which could be adapted for other automated review workflows. While the codebase is well-maintained and actively developed, the tight coupling to many agent-specific formats and the dual checkpoint backend add maintenance surface area and complexity.
The LLM identified 5 files worth highlighting for reuse:
Provides safe filesystem operations using Go 1.21's `os.Root` to prevent symlink traversal attacks. Functions like `MkdirAllNoSymlink`, `OpenFileNoFollow`, and `ReadFileNoFollow` ensure every path component is verified before access. Includes a guard test (`rootbase_guard_test.go`) that forces explicit allowlisting of all code paths that open an `os.Root`, preventing accidental escape points. This is a reusable security primitive for any CLI or server that handles user-controlled directories.
Manages child processes with platform-aware features: detached spawning, process group creation, and `TerminateOnCancel` that kills the entire process tree on context cancellation. On Unix it uses `Setpgid` and `SIGTERM`; on Windows falls back to job objects. `PathScanDirs` prevents execution of commands from relative PATH entries (security). This is a drop-in replacement for `exec.Command` in apps needing robust subprocess lifecycle management.
A multi-layer redaction engine that combines regex-based scanners (betterleaks, goredact), custom PII rules, and an external OpenAI Privacy Filter. Supports configurable scanner packs, fingerprint-based caching to avoid re-scanning unchanged content, and a degradation detection mechanism (`ErrScannerDegraded`). Benchmarked at ~220ms/MB throughput. This is a general-purpose secret redaction framework that can be extracted for any service needing to sanitize text before storage or transmission.
Provides advisory file locking with support for deadine-aware acquisition (`AcquireContext`) and a workaround for macOS `openat` race conditions by splitting the create-or-open step. On Unix uses `flock()`, on Windows uses `LockFileEx` via `syscall`. Includes a `FileLock` type that releases on close. This is a portable file-locking utility suitable for any application needing coordinated access to shared resources.
A lightweight nested timing span implementation that logs durations at multiple granularities (DEBUG, INFO, WARN) with automatic escalation when spans exceed defined thresholds. Spans are parent-child linked via `context.Context`, allowing precise performance attribution across asynchronous operations. Includes a `SlowSpan` event that triggers WARN logging. This can be reused in any Go application needing structured, context-aware performance instrumentation without heavy frameworks.