Session lifecycle commands -- archive, unarchive, and delete a saved session.
Wraps codex archive <session>, codex unarchive <session>, and
codex delete <session>. Each takes a session id (UUID) or a session
name; the CLI prefers the UUID interpretation when the argument parses
as one.
Usage
config = CodexWrapper.Config.new()
{:ok, _} = CodexWrapper.Commands.Archive.archive(config, "abc-123")
{:ok, _} = CodexWrapper.Commands.Archive.unarchive(config, "abc-123")Deleting
codex delete permanently destroys the saved session; there is no
undo, and unarchive/2 cannot bring it back. So delete/3 will not
run unless the caller passes confirm: true:
CodexWrapper.Commands.Archive.delete(config, "abc-123")
#=> {:error, :confirmation_required}
CodexWrapper.Commands.Archive.delete(config, "abc-123", confirm: true)
#=> {:ok, ""}Without the flag the CLI is never invoked, so a delete reached by mistake -- a wrong branch, a stale variable -- costs nothing. Archiving is the reversible option and should be the default reach.
Summary
Functions
Archive a saved session. Reversible with unarchive/2.
Build the argument list for an action and session.
Permanently delete a saved session.
Build a lifecycle command for the given action and session.
Unarchive a previously archived session.
Types
Functions
@spec archive(CodexWrapper.Config.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
Archive a saved session. Reversible with unarchive/2.
Build the argument list for an action and session.
@spec delete(CodexWrapper.Config.t(), String.t(), keyword()) :: {:ok, String.t()} | {:error, :confirmation_required | term()}
Permanently delete a saved session.
Requires confirm: true. Without it this returns
{:error, :confirmation_required} and the CLI is not invoked. See the
module docs for why.
Options
:confirm- must betruefor the delete to run
Build a lifecycle command for the given action and session.
The session is an id (UUID) or a session name.
@spec unarchive(CodexWrapper.Config.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
Unarchive a previously archived session.