Skip to content
CAI
Software that uses CAICheck a score

donutloop/toolkit

54.0

Weak · 21 September 2026

1.2k

lines of production code

Go

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Go utility toolkit providing infrastructure components for concurrent execution, error handling, and code manipulation. It offers primitives for parallel task management, retry logic, and worker pools, alongside utilities for debugging HTTP traffic and pretty-printing values. Additionally, it includes an in-process event bus, AST-based code generation tools, and helpers for resource leasing and singleton patterns.

How it got here

2017 — concurrency and utility toolkit expansion

11 changes.

This period focused on expanding the toolkit with a comprehensive suite of concurrency primitives, including schedulers, promise handling, parallel execution utilities, and retry logic. It also introduced foundational infrastructure packages such as an in-process event bus, singleton management, and lease-based resource locking. Supporting these features were new debugging utilities and error aggregation tools to improve observability and robustness.

2018–2020 — Concurrency and code generation utilities

5 changes.

This period focused on introducing core infrastructure features, including a concurrent worker pool for asynchronous task processing and middleware support for HTTP clients. It also established capabilities for programmatic Go source code manipulation through AST-based tools and utilities, alongside enhanced panic handling for improved crash diagnostics.

Features

Add lease package for resource locking with expiration

Introduces a new \lease\ package that allows resources to be leased for a specified duration. When the lease expires, a provided callback function is invoked. The implementation supports refreshing an existing lease by calling \Lease\ again on the same resource, which cancels the previous timer and starts a new one. Users can also explicitly return (cancel) a lease early using the \Return\ method, preventing the expiration callback from firing.

lease · high confidence

Add multierror package to concatenate multiple errors

The multierror package now provides a New function that aggregates multiple error values into a single error. When multiple non-nil errors are passed, they are joined into a single string separated by semicolons (e.g., "multiple errors: err1; err2"), simplifying error handling when several operations fail simultaneously.

multierror · high confidence

Add panic handling with configurable crash behavior

The xpanic package now provides a panic handler that captures panic information and generates a full backtrace via runtime profiles. Users can configure the handler to either terminate the process with a core dump (SIGABRT) or allow execution to continue after logging the error, depending on the crashOnError setting.

xpanic · high confidence

Added AST manipulation utilities for Go code refactoring

A new internal package \internal/ast\ has been introduced, providing functions to parse, modify, and re-format Go source code using the standard \go/ast\ library. This includes capabilities to rename packages and change type identifiers within the Abstract Syntax Tree, along with a helper to apply multiple transformation functions to source code and handle formatting errors via a custom \BadFormattedCode\ error type.

internal · high confidence

Added FIFO scheduler for sequential job execution

The schedule package now includes a FIFO scheduler that executes jobs sequentially in the order they are scheduled. Users can create a scheduler instance, schedule jobs, and wait for completion using the new \NewFIFOScheduler\, \Schedule\, and \WaitFinish\ APIs. The implementation supports context cancellation for graceful shutdown and includes a configurable panic handler to manage job failures.

schedule · high confidence

Added Looper for periodic event execution with error handling

The loop package now provides a Looper that executes a provided function at a specified rate, collecting any errors returned by the function or panics that occur during execution. Users can start the loop, listen for errors via the Error() channel, and stop execution using the Stop() method.

loop · high confidence

Added event hook system with panic recovery

The event package now includes a Hooks type that allows users to register multiple functions and execute them concurrently via Fire(). The implementation ensures thread safety using mutexes and waits for all goroutines to complete before returning. A key feature is panic recovery: if any registered hook panics, the system catches it, captures the stack trace, and returns a RecoverError instead of crashing the application.

event · high confidence

Added promise package for asynchronous context-aware execution

The toolkit now includes a new \promise\ package that provides a \Do\ function to execute a context-aware task in a separate goroutine. This allows users to run asynchronous operations while receiving results via \done\ and \error\ channels, with built-in panic recovery that captures stack traces for debugging. The addition includes usage documentation, example code, and comprehensive unit tests covering success, failure, and panic scenarios.

promise · high confidence

Initial release of the in-process event bus

This change introduces a new publish-subscribe event system for Go applications. The \bus\ package provides an \InProcBus\ implementation that allows users to register event listeners via \AddEventListener\ for broadcasting messages to multiple subscribers, and handlers via \AddHandler\ for single-response dispatching. The implementation uses reflection to match message types and includes validation to ensure handlers and listeners adhere to the required function signatures (one input, one output). Documentation and example tests are included to demonstrate usage.

bus · high confidence

Introduce concurrent worker pool with request/response pattern

A new worker package has been added that provides a concurrent worker pool. It allows users to spawn a specified number of goroutines to process incoming parameters via a request channel, returning results through a response channel and errors through a separate error channel. This enables asynchronous, buffered processing of tasks with built-in error handling.

worker · high confidence

Introduce middleware support for HTTP clients

The xhttp package now provides a \Use\ function that allows users to wrap an existing \http.Client\ with a chain of middleware functions. This enables the injection of custom logic, such as logging or authentication, into HTTP requests by modifying the client's transport layer. The implementation includes validation to ensure the client and middlewares are not nil, panicking with specific error types if invalid arguments are passed.

xhttp · high confidence

New concurrent.Run utility for parallel function execution

The toolkit now includes a \concurrent.Run\ function that executes multiple \func() error\ handlers in parallel goroutines and collects any returned errors. This utility simplifies parallel task execution by handling synchronization via a WaitGroup and aggregating results into a single error slice. It also includes panic recovery, wrapping panics in a \RecoverError\ type that includes stack trace information, ensuring that a panic in one goroutine does not crash the entire program but is instead reported as an error alongside any other function errors.

concurrent · high confidence

New debug utilities for pretty-printing Go values and logging HTTP traffic

The debugutil package now provides tools to improve debugging visibility. It introduces a PrettySprint function that generates human-readable, indented representations of Go values (including structs, maps, slices, and pointers, with specific handling for nil cases). Additionally, it adds PrettySprintRequest and PrettySprintResponse functions to pretty-print HTTP requests and responses, specifically indenting JSON bodies when the content type is application/json. Finally, a LogRoundTripper is available to wrap an HTTP transport, automatically logging the full request and response dumps to a provided logger interface, which is useful for debugging HTTP interactions in non-production environments.

debugutil · high confidence

New retry package with generic and HTTP round-tripper support

The toolkit now includes a new \retry\ package that provides automatic retry logic for Go functions and HTTP requests. Users can wrap any function in a \Retrier\ to handle transient failures using configurable initial/max intervals, attempt counts, and exponential backoff strategies. Additionally, an \http.RoundTripper\ implementation is available to automatically retry HTTP client requests on specific status codes (e.g., 5xx errors) while respecting context cancellation and blacklisted status codes.

retry · high confidence

New singleton package with lazy initialization and reset capability

The toolkit now includes a singleton package that allows users to define types instantiated only once, with lazy initialization triggered on the first call to Get(). A key feature is the Reset() method, which clears the cached instance so that the next Get() call re-invokes the constructor, enabling re-initialization of the singleton. The implementation is thread-safe using mutexes and atomic operations, and includes documentation and tests to demonstrate usage.

singleton · high confidence

New xcode command for AST-based code generation

A new CLI tool named 'xcode' has been added to the cmd directory, enabling users to programmatically modify Go source files. By specifying input and output file paths, along with a target package name, type, and mode, the tool reads the input Go file, parses its Abstract Syntax Tree (AST), and applies transformations to rename the package and change the type definition before writing the result to the output file.

cmd · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 66 → 54 (-11.9)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 99 (-0.1)
  • Architecture 69 → 69 (+0.0)
  • Maturity 55 → 55 (+0.0)
  • Readiness 68 → 37 (-30.6)
  • Security 99 → 100 (+0.2)

Resolved (8)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (11 lines × 2) (debugutil/http_dump.go)
  • LLM evaluation failed
  • Medium CVE: GO-2021-0226 (go.mod)
  • No exposed public API
  • Test reliability not included
  • dormant codebase — no living knowledge left to concentrate

New (9)

  • Dependency pinned to a stale untagged commit: github.com/fatih/astrewrite
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no licence statement (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (20 lines × 2) (debugutil/http_dump.go)
  • Medium CVE: GO-2021-0226 (go.mod)
  • No ADRs found
  • No dependency advisory monitoring
  • TodoComment (singleton/singleton.go)

Changes since last survey

  • 1 commits — 1 feature/other, 0 fixes

By area

  • (root) — 1 commit

Notable commits

  • change: Update CODE_OF_CONDUCT.md

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

donutloop/toolkit was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 6a913d02fde8ed9e6fccb2b7ce70258bbfc86c12 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.