ExAthena.Web.Sessions (ExAthena v0.12.0)

Copy Markdown View Source

File-based session persistence for the web UI.

Sessions are stored as Erlang term binaries under ~/.ex_athena/web/sessions/. A compact JSON index at ~/.ex_athena/web/recent.json tracks the most recently opened working directories so users can jump back to a project quickly.

Summary

Functions

Delete a session file.

List all session headers, newest first.

List session headers for a specific working directory, newest first.

Return the list of recently opened working directories, newest first. Each entry: %{cwd: path, name: basename, opened_at: DateTime.t()}

Load a full session by id.

Remove a working directory from the recent list.

Persist a session. Overwrites if the id already exists.

Record a working directory as recently opened (deduplicates, caps at 20).

Functions

delete(id)

@spec delete(String.t()) :: :ok | {:error, term()}

Delete a session file.

list()

@spec list() :: [map()]

List all session headers, newest first.

list_for_cwd(cwd)

@spec list_for_cwd(String.t()) :: [map()]

List session headers for a specific working directory, newest first.

list_recent()

@spec list_recent() :: [map()]

Return the list of recently opened working directories, newest first. Each entry: %{cwd: path, name: basename, opened_at: DateTime.t()}

load(id)

@spec load(String.t()) :: {:ok, map()} | {:error, term()}

Load a full session by id.

remove_recent(cwd)

@spec remove_recent(String.t()) :: :ok

Remove a working directory from the recent list.

save(data)

@spec save(map()) :: :ok

Persist a session. Overwrites if the id already exists.

touch_recent(cwd)

@spec touch_recent(String.t()) :: :ok

Record a working directory as recently opened (deduplicates, caps at 20).