MCPcopy Index your code
hub / github.com/azriel91/peace

github.com/azriel91/peace @0.0.15

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.0.15 ↗ · + Follow
3,396 symbols 9,086 edges 692 files 700 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🕊️ peace – zero stress automation

Crates.io docs.rs CI Coverage Status

peace is a framework to build empathetic and forgiving software automation.

See:

  • peace.mk for the project vision.
  • Background for the motivation to create this framework.
  • Operations UX for a book about the dimensions considered during peace's design and development.

Guiding Principles

  • A joy to use.
  • Ergonomic API and guidance to do the right thing.
  • Understandable output.

Features

Symbol Meaning
🟢 Works well
🟡 Partial support
Planned
🔵 Compatible by design
🟣 Works, "fun idea"
  • 🟢 Idempotent: Multiple invocations result in the goal outcome.
  • 🟢 Clean: Every item creation is paired with how it is cleaned up.
  • 🟢 Understandable: Progress is shown at an understandable level of detail.
  • 🔵 Understandable: Error reporting is compatible with [miette].
  • 🟢 Interruptible: Execution can be interrupted.
  • 🟢 Resumable: Automation resumes where it was interrupted.
  • 🟢 Diffable: States and diffs are serialized as YAML.
  • 🟢 Efficient: Tasks are concurrently executed via [fn_graph].
  • 🟢 Namespaced: Profile directories isolate environments from each other.
  • 🟢 Type Safe: Items and parameters are defined in code, not configuration.

Roadmap

  • 🟢 Define items to manage with automation.
  • 🟢 Define dependencies between items.
  • 🟢 Define "apply" logic.
  • 🟢 Define "clean up" logic.
  • 🟢 Discover current and goal states.
  • 🟢 Define diff calculation between states.
  • 🟢 Store and recall parameters across commands.
  • 🟢 Diff states between multiple profiles.
  • 🟢 Type-safe referential parameters -- specify usage of values generated during automation as parameters to subsequent items.
  • 🟢 Cancel-safe interruption.
  • 🟡 Feature-gated incremental functionality.
  • 🟡 Off-the-shelf support for common items.
  • 🟡 Dry run.
  • 🟣 WASM support.
  • 🟡 Web based UI with interactive graph.
  • ⚫ Run command with subset of items.
  • ⚫ Params specification: Read values from other flows.
  • ⚫ Flow versions: Support migrating environment deployed using previous flow version.
  • ⚫ Secure-by-design Support: Encrypted value storage, decrypted per execution / time based agent.
  • ⚫ Tutorial for writing a software lifecycle management tool.
  • ⚫ Built-in application execution methods -- CLI, web service.
  • peace binary for configuration based workflows.
  • ⚫ Agent mode to run peace on servers (Web API invocation).

Further ideas:

  • Back up current state.
  • Restore previous state.
  • Telemetry / metrics logging for analysis.

Examples

Examples are run using --package instead of --example, as each example is organized as its own crate.

download example

cargo run --package $example_name --all-features

# e.g.
cargo build --package download --all-features
cargo run -q --package download --all-features -- init https://ifconfig.me ip.json

for cmd in status goal diff ensure ensure diff clean clean diff
do
    printf "=== ${cmd} ===\n"
    cargo run -q --package download --all-features -- --format text $cmd
    printf '\n'
done

# Look at metadata that Peace has saved
find .peace -type f -exec bash -c 'echo \# {}; cat {}; echo' \;

# Clean up the metadata directory
rm -rf .peace

WASM

The download example can be built as a web assembly application using [wasm-pack]:

cd examples/download
wasm-pack build --target web

In the examples/download directory, start an HTTP server, and open http://localhost:8000/:

python3 -m http.server 8000 # or
simple-http-server --nocache --port 8000 -i

envman example

  1. Install cargo-leptos.

    bash cargo install --locked cargo-leptos

  2. Build the envman example:

    ```bash

    defined in .cargo/config.toml

    cargo envman_build_debug ```

  3. Copy artifacts to a temporary directory:

    bash demo_dir=/tmp/demo/envman test -d "${demo_dir}" || mkdir -p "${demo_dir}" cp ./target/debug/envman "${demo_dir}" cp ./target/web/envman/pkg "${demo_dir}"

  4. Switch to the demo directory:

    bash demo_dir=/tmp/demo/envman cd "${demo_dir}"

  5. Make sure you have AWS credentials set up in ~/.aws/credentials.

  6. Run the appropriate envman commands:

    1. Initialize a project:

      ```bash

      initialize a project to download from azriel91/web_app

      ./envman init \ --type development \ --flow deploy \ demo_1 azriel91/web_app 0.1.1 ```

    2. Status / Goal / Diff:

      bash ./envman status ./envman goal ./envman diff

    3. Deploy / Clean

      ```bash ./envman deploy ./envman deploy --format json ./envman deploy --format none

      ./envman clean ./envman clean --format json ./envman clean --format none ```

    4. You can also interrupt the deploy/clean process.

  7. Run the web interface:

    bash ./envman web

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

Data (Interface)
Defines the logic to instantiate and retrieve runtime data. # Note for API Consumers This trait is implemented by usin [7 …
crate/data/src/data.rs
CmdCtxTypes (Interface)
Trait so that a single type parameter can be used in `CmdCtx` and `Scopes`. The associated types linked to the concrete [12 …
crate/cmd_ctx/src/cmd_ctx_types.rs
StatesTsApplyExt (Interface)
Infers the target state, ensure or clean, and dry run, from a `StateTs`. [4 implementers]
crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs
CmdBlock (Interface)
(no doc) [12 implementers]
crate/cmd_rt/src/cmd_block.rs
AnySpecRt (Interface)
Runtime logic of how to look up values for each field in this struct. This trait is automatically implemented by `#[der [4 …
crate/params/src/any_spec_rt.rs
Item (Interface)
(no doc) [11 implementers]
crate/cfg/src/item.rs
Presentable (Interface)
(no doc) [18 implementers]
crate/fmt/src/presentable.rs
MaybeEq (Interface)
Types that may be equal. This trait and [`Equality`] represent when two values are known to exist, but their content is [3 …
crate/diff/src/maybe_eq.rs

Core symbols most depended-on inside this repo

into
called by 1093
crate/cfg/src/ref_into.rs
clone
called by 671
crate/flow_rt/src/flow.rs
map
called by 249
crate/cmd_model/src/cmd_outcome.rs
build
called by 210
crate/flow_rt/src/item_graph_builder.rs
push
called by 101
crate/params/src/value_resolution_ctx.rs
path
called by 92
items/tar_x/src/file_metadata.rs
clone
called by 65
crate/params/src/mapping_fn.rs
get
called by 65
crate/cfg/src/accessors/stored.rs

Shape

Method 1,573
Function 1,312
Class 362
Enum 117
Interface 32

Languages

Rust100%
TypeScript1%
C#1%

Modules by API surface

workspace_tests/src/params/derive.rs67 symbols
workspace_tests/src/params/params_spec.rs50 symbols
workspace_tests/src/mock_item.rs45 symbols
workspace_tests/src/cli/output/cli_md_presenter.rs37 symbols
crate/cmd_ctx/src/cmd_ctx_spsf.rs36 symbols
crate/cmd_ctx/src/cmd_ctx_mpsf.rs35 symbols
crate/params_derive/src/util.rs34 symbols
workspace_tests/src/params/value_spec.rs32 symbols
workspace_tests/src/params/params_spec_fieldless.rs32 symbols
crate/rt_model/src/item_wrapper.rs32 symbols
workspace_tests/src/vec_copy_item.rs30 symbols
crate/webi_output/src/outcome_info_graph_calculator.rs30 symbols

For agents

$ claude mcp add peace \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact