Skip to main content

CodexSurface

Struct CodexSurface 

Source
pub struct CodexSurface;
Expand description

Codex agent surface. Stateless; the registry stores it as Box<dyn AgentSurface>.

Implementations§

Source§

impl CodexSurface

Source

pub const AGENT_ID: &'static str = "codex"

Source

pub const AGENTS_MD: &'static str = "AGENTS.md"

Filename of the markdown file Codex reads from the repo root.

Source

pub const PRE_COMMIT_RELPATH: &'static [&'static str]

Repo-relative path of the git pre-commit hook.

Source

pub const PRE_PUSH_RELPATH: &'static [&'static str]

Repo-relative path of the git pre-push hook.

Source

pub const HOOK_RELPATH: &'static [&'static str] = Self::PRE_COMMIT_RELPATH

Repo-relative path of the primary hook reported via the trait’s hook_path method. Kept as pre-commit for parity with the W1 API; consumers needing both paths should use Self::all_hook_paths.

Source

pub fn all_hook_paths(repo_root: &Path) -> [(HookKind, PathBuf); 2]

Both managed hook paths, in install order. W3 callers that want to render the full install report (e.g. for klasp install --dry-run) should iterate this rather than relying on the trait’s single hook_path.

Source

pub fn install_detailed( &self, ctx: &InstallContext, ) -> Result<CodexInstallReport, InstallError>

Detailed install entry-point. Returns the standard InstallReport and the list of HookWarnings collected from the hook writer. The trait’s AgentSurface::install method calls this and discards the warnings to keep the cross-crate trait surface unchanged; W3’s CLI plumbing calls this method directly so it can render warnings to the user.

Trait Implementations§

Source§

impl AgentSurface for CodexSurface

Source§

fn agent_id(&self) -> &'static str

Stable agent identifier (e.g. "claude_code", "codex").
Source§

fn detect(&self, repo_root: &Path) -> bool

Auto-detect whether this surface is relevant to the given repo (e.g. presence of .claude/ for Claude Code, AGENTS.md for Codex). klasp install --force overrides a false here.
Source§

fn hook_path(&self, repo_root: &Path) -> PathBuf

Path to the hook-script file this surface owns.
Source§

fn settings_path(&self, repo_root: &Path) -> PathBuf

Path to the agent’s settings/config file this surface mutates.
Source§

fn render_hook_script(&self, ctx: &InstallContext) -> String

Render the hook-script content this surface would write. Pure — no filesystem access. Used by install and by --dry-run.
Source§

fn install(&self, ctx: &InstallContext) -> Result<InstallReport, InstallError>

Perform the install. Must be idempotent: running twice with the same input yields the same on-disk state and returns already_installed = true on the second run.
Source§

fn uninstall( &self, repo_root: &Path, dry_run: bool, ) -> Result<Vec<PathBuf>, InstallError>

Remove klasp’s managed entries. Returns the list of paths that were (or would be, in dry_run) modified. Sibling hooks must be preserved.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.