codexsetup

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TrustMethodAppServer is the supported path: Codex computes the hash and
	// Codex writes it.
	TrustMethodAppServer = "app_server"
	// TrustMethodAppendedConfig is the degraded path used when Codex can report
	// hook hashes but refuses or no longer offers config/batchWrite. Overgent
	// appends the trust tables itself, and only ones that do not yet exist.
	TrustMethodAppendedConfig = "appended_config"
	// TrustMethodManual is the honest floor: hooks are installed but Codex will
	// not run them until the member reviews them.
	TrustMethodManual = "manual"
)

Trust methods, ordered by how much of the work Codex itself performs.

View Source
const ReviewGuidance = "Open Codex → Settings → Hooks and choose Trust all, or run /hooks in the Codex CLI."

ReviewGuidance is shown to a member who must trust the hooks by hand. Codex surfaces the same review in the desktop application and in the CLI.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	ProjectRoot, ConfigRoot, Executable string
	Portable                            bool
	// CodexHome overrides the Codex home directory. Empty resolves $CODEX_HOME
	// and then ~/.codex, so tests never touch real contributor state.
	CodexHome string
	// CodexExecutable overrides Codex discovery for trust repair.
	CodexExecutable string
	// Version is reported to Codex during the app-server handshake.
	Version string
}

func (Manager) Rebind

func (m Manager) Rebind() (Status, error)

Rebind transactionally replaces a structurally recognized Overgent binding from another profile. Unknown drift remains an error. Both config files are restored if either managed rewrite fails.

func (Manager) Remove

func (m Manager) Remove() (Status, error)

func (Manager) RemoveHooks

func (m Manager) RemoveHooks() error

RemoveHooks deletes the managed user-level Codex hooks. Call it only after every project binding has been removed; the hooks are shared.

func (Manager) Repair

func (m Manager) Repair() (Status, error)

Repair adopts a binding an earlier Overgent left behind, and does nothing else. It is safe to run unattended on every launch, which is the point: leftovers of our own making should never reach a member as a decision.

Unlike Rebind it never creates a binding that is not already there. A layer that is simply not configured stays not configured, because connecting an agent is the member's choice and repairing our own mess is not.

func (Manager) RepairContext

func (m Manager) RepairContext(ctx context.Context) (Status, error)

RepairContext is Repair with a caller-supplied context for the trust probe.

func (Manager) Setup

func (m Manager) Setup() (Status, error)

Setup installs the binding using a background context.

func (Manager) SetupContext

func (m Manager) SetupContext(ctx context.Context) (Status, error)

SetupContext installs the project MCP binding and the user-level activity hooks, then asks Codex to trust those hooks so they can actually run.

func (Manager) Status

func (m Manager) Status() (Status, error)

Status reports the binding using a background context.

func (Manager) StatusContext

func (m Manager) StatusContext(ctx context.Context) (Status, error)

StatusContext reports the binding without changing it. A binding whose files are present but whose hooks Codex has not trusted reports "needs_review", not "active": Codex skips an untrusted hook silently, so reporting it as working is what hid this failure in the first place.

type Status

type Status struct {
	Configured      bool   `json:"configured"`
	ConfigPath      string `json:"configPath"`
	HookPath        string `json:"hookPath,omitempty"`
	Hooks           string `json:"hooks"`
	Binding         string `json:"binding"`
	PreviousProfile string `json:"previousProfile,omitempty"`
	// PreviousExecutable is the Overgent binary an `other_profile` binding runs.
	// A binding whose executable is gone cannot fire again whatever profile it
	// names, which is one of the things that makes it a leftover rather than a
	// decision.
	PreviousExecutable string `json:"previousExecutable,omitempty"`
	// CheckedProfile names the profile this status was evaluated against, so an
	// `other_profile` result can be read without guessing what it was compared
	// with. Without it the honest answer "Codex is bound to a different profile
	// than the one you asked about" is indistinguishable from the alarming one
	// "Codex is bound to somebody else's profile", and the difference is usually
	// just a missing --config-root.
	CheckedProfile  string `json:"checkedProfile"`
	RestartRequired bool   `json:"restartRequired"`
	// Trust reports whether Codex will actually run the installed hooks. Files
	// on disk are not enough: Codex skips an untrusted hook silently (ADR-051).
	Trust TrustReport `json:"trust"`
}

type TrustReport

type TrustReport struct {
	Method   string   `json:"method"`
	Total    int      `json:"total"`
	Trusted  int      `json:"trusted"`
	Pending  []string `json:"pending,omitempty"`
	Guidance string   `json:"guidance,omitempty"`
	Detail   string   `json:"detail,omitempty"`
}

TrustReport describes whether Codex will actually run Overgent's hooks.

A binding whose files are on disk is not a binding that runs: Codex skips an untrusted hook silently. Setup and status both carry this so the desktop app can distinguish a working install from an inert one (ADR-051).

func (TrustReport) Satisfied

func (r TrustReport) Satisfied() bool

Satisfied reports whether every managed hook Codex resolved is trusted. A report that observed no hooks at all is not satisfied: that means Codex could not see the binding, which is exactly the silent failure to surface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL