Skip to main content

Module surface

Module surface 

Source
Expand description

CodexSurfaceklasp_core::AgentSurface impl for Codex.

Mirrors the install flow of [klasp_agents_claude::ClaudeCodeSurface]: compute paths → render the managed-block bodies → idempotent merge / replace into the on-disk files → atomic write → report what changed. The two surfaces differ in their target files (Claude writes one bash shim and one JSON settings file; Codex writes AGENTS.md and a pair of git hooks) and in their conflict-handling story: Codex has to coexist with husky / lefthook / pre-commit framework, so the hook writer skips-with-warning rather than failing the install.

§v0.2 W2 scope

  • install writes the AGENTS.md managed block (W1 behaviour) and the .git/hooks/pre-commit + .git/hooks/pre-push hook files.
  • When a foreign hook manager is detected via git_hooks::detect_conflict, the hook write is skipped and a HookWarning rides alongside the InstallReport (returned via the typed CodexSurface::install_detailed entry-point — the plain AgentSurface::install trait method, which W3 will wire into the CLI, discards warnings to keep the cross-crate contract klasp-core defines unchanged).
  • uninstall strips the managed block from each managed file and removes any file klasp owned end-to-end (round-trip from the missing-file install). Sibling content — both other tools’ hooks and any prose in AGENTS.md — is preserved byte-for-byte.

§Windows notes

AGENTS.md is plain text. .git/hooks/pre-commit and pre-push are shell scripts that git itself executes through sh.exe (Git for Windows) or whatever the user’s git is configured to use; they need a shebang for portability but no executable bit on NTFS. Behaviour parity with klasp_agents_claudeapply_mode is a no-op there too.

Structs§

CodexInstallReport
Result of a CodexSurface::install_detailed call. Bundles the standard InstallReport with the per-hook warnings collected during install.
CodexSurface
Codex agent surface. Stateless; the registry stores it as Box<dyn AgentSurface>.