MCPcopy Index your code
hub / github.com/MaxBondABE/attempt

github.com/MaxBondABE/attempt @v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.1 ↗ · + Follow
171 symbols 323 edges 10 files 13 documented · 8%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

attempt - a CLI for retrying fallible commands

attempt allows you to retry fallible commands with a delay.

How do I use it?

attempt [BACKOFF] [OPTIONS] [COMMAND]...

# Rerun database migrations if the server was not ready
attempt --retry-if-contains "server not ready" sqlx migrate

# Use an exponential backoff
attempt exponential --retry-if-contains "server not ready" sqlx migrate

What can I do with it?

  • Wait for a service to start when you aren't restricted to bash
  • Write robust scripts accessing resources which may become temporarily unavailable
  • Bodge flaky programs into working

Key features

  • Simple.
    • The featureset is small but flexible enough to covers most usecases.
    • The codebase can be audited in an afternoon.
  • Robust.
    • It provides the tools you need to implement fault tolerance, like timeouts, jitter, and exponential backoff.
    • The test suite is extensive and contains both end-to-end and unit tests.
  • Free forever.
    • The codebase is in the public domain.
    • All future versions will be released under the same license.

Documentation

  • See the usage instructions to get a quick start
  • The scripting guide has advice about using attempt in scripts
  • Read the user manual for full documentation
  • Run attempt --help for quick access to documentation
    • Note that you need to specify a strategy to see it's parameters, eg attempt exponential --help

Known issues

  • attempt assumes that the child command's output will be UTF-8 encoded. If any output predicates are used on a program that outputs invalid UTF-8, attempt will crash.
  • attempt --help will not reflect that the fixed strategy will be used if no strategy is specified.

Installation

Cargo:

cargo install attempt-cli

Homebrew:

brew install attempt-cli

Extension points exported contracts — how you extend this code

OutputShim (Interface)
Trait that decouples access to `std::process::Output` to allow mocking in tests [10 implementers]
src/policy.rs
Pollable (Interface)
Trait that decouples access to `std::process::Child::try_wait()` to allow mocking in tests [4 implementers]
src/util/poll.rs

Core symbols most depended-on inside this repo

assert
called by 26
src/util/pattern.rs
contains
called by 15
src/util/pattern.rs
into_iter
called by 14
src/arguments.rs
backoff
called by 11
src/arguments.rs
poll_child
called by 11
src/util/poll.rs
wait_delay
called by 10
src/arguments.rs
stdout
called by 9
src/policy.rs
parse_arguments_from
called by 9
src/arguments.rs

Shape

Function 94
Method 44
Class 25
Enum 6
Interface 2

Languages

Rust100%

Modules by API surface

src/policy.rs34 symbols
src/arguments.rs34 symbols
tests/e2e.rs23 symbols
src/util/pattern.rs23 symbols
src/util/poll.rs15 symbols
src/util/value_parsing.rs14 symbols
src/util/mock_sleep.rs12 symbols
src/main.rs10 symbols
src/util/logger.rs6 symbols

For agents

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

⬇ download graph artifact