Rho.Tools.DynTool (rho v0.1.0)

Copy Markdown View Source

What the dyn_* Core tools share: the agent edits its Dyn layer's staging copy and proposes it (Rho.Dyn). There is deliberately no tool to activate or revert: those need the human's approval (the screen lock).

The tools act on the app's Keeper, or on ctx[:dyn] (a Keeper name; the selftests use their own Keeper on a temp dir, with_selftest_keeper/1).

Summary

Functions

A tool error for Rho.Dyn's staging errors.

:ok if result matches, else {:error, result} (for selftests).

The Keeper the tools act on.

The path argument's JSON Schema.

Does staging differ from the current generation's sources?

Runs fun.(ctx) against a fresh Keeper on a temp dir (no generation, Core approval refusing everything), for the tools' selftests.

Functions

error(other, path)

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

A tool error for Rho.Dyn's staging errors.

expect(result, ok?)

@spec expect(term(), (term() -> boolean())) :: :ok | {:error, term()}

:ok if result matches, else {:error, result} (for selftests).

keeper(ctx)

@spec keeper(map()) :: atom()

The Keeper the tools act on.

path_schema()

@spec path_schema() :: map()

The path argument's JSON Schema.

staging_line(keeper)

@spec staging_line(atom()) :: String.t()

Does staging differ from the current generation's sources?

with_selftest_keeper(fun)

@spec with_selftest_keeper((map() -> result)) :: result when result: term()

Runs fun.(ctx) against a fresh Keeper on a temp dir (no generation, Core approval refusing everything), for the tools' selftests.