Skip to content
CAI
Software that uses CAICheck a score

E-xyza/zigler

68.8

Adequate · 23 September 2026

7.4k

lines of production code

Elixir

with Zig

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a library that enables Elixir and Erlang developers to write high-performance Native Implemented Functions (NIFs) using the Zig programming language. It provides a comprehensive interface for compiling Zig code into shared libraries, handling complex type marshalling between BEAM terms and Zig types, and managing memory allocation. The system supports various concurrency models, including threaded and dirty scheduler execution, and includes robust tooling for precompilation and C interop.

How it got here

2019 — Zig NIF integration and modernization

7 changes.

This period focused on modernizing the project's architecture by introducing a new Zig module for inline NIFs, replacing the legacy template-based approach. The update includes expanding test coverage for NIF options and data type conversions, while also upgrading dependencies to Elixir 1.15 and Zig 0.16.0.

2020–2023 — Zig NIF integration and tooling

9 changes.

This period focused on building out the core infrastructure for integrating Zig with the BEAM, including memory management, concurrency models, and comprehensive type marshaling. The team also established robust testing for compiler errors and C interop, while introducing a dedicated installer for the Zig toolchain to streamline development workflows.

2024–2025 — Comprehensive test coverage expansion

10 changes.

This period focused on achieving exhaustive test coverage across the entire codebase, including callbacks, concurrency, C interop, Erlang integration, raw NIFs, resource management, and all supported Zig types. The work also included rigorous testing of memory allocation, corner cases, and precompiled module functionality to ensure robustness and correctness.

Features

Add comprehensive type handling for Zig types in the NIF layer

The library now supports a wide range of Zig types in the NIF interface, including functions, arrays, booleans, C pointers, enums, error types, floats, integers, many-pointers, optionals, standard pointers, resources, slices, structs, and tuples. This addition enables the library to correctly marshal and unmarshal complex data structures between Elixir/Erlang and Zig, covering basic types (bool, float, integer), composite types (struct, tuple, array, slice), and pointer/ownership semantics (cpointer, manypointer, optional).

lib/zig/type · high confidence

Added Credo and Elixir formatter configurations

The project now includes \.credo.exs\ and \.formatter.exs\ configuration files, establishing a standardized code quality and formatting baseline for Elixir and Zig files. The \.credo.exs\ file enables a comprehensive suite of consistency, design, readability, refactoring, and warning checks, while \.formatter.exs\ defines input paths and plugins (including \Zig.Formatter\) to ensure consistent code style across the repository.

(repo-wide) · high confidence

Added precompiled Zigler test module

A new Elixir module, ZiglerTest.MultiplatformPrecompiledTest, was added to the precompiled directory. This module contains a basic Zig function (add\_one) that can be precompiled using the mix zig.precompile command, serving as a test case for the precompiled functionality.

precompiled · high confidence

Adds \`mix zig.get\` installer for the Zig compiler toolchain

The installer directory now includes a new \mix zig.get\ Mix task that automatically downloads and installs the Zig compiler toolchain. This standalone installer can detect the user's OS and architecture, fetch the default version (0.16.0), and handle verification and extraction, keeping the installer logic separate from the main zigler package.

installer · high confidence

Adds templates for threaded NIF functions and memory leak detection

The library now generates Zig templates for threaded NIF functions, allowing users to define NIFs that run in separate threads. The generated code includes a launch and join mechanism for these threads. Additionally, a memory leak check is integrated into the generated code, which detects and raises an Elixir RuntimeError if a memory leak is detected in the NIF function.

lib/zig/templates · high confidence

Introduce Zig precompilation and C interop modules

Added new Mix tasks and internal modules to support precompiling Zig modules for cross-platform builds and managing C interop options. The \Mix.Tasks.Zig.Precompile\ task enables generating precompiled binaries for various architectures and operating systems, outputting SHA256 hashes for verification. Additionally, \Zig.C\ provides a structured way to specify C header files, library directories, and source files for C interop, while \Zig.Version\ relays the installed Zig compiler version. These changes lay the groundwork for more robust cross-compilation and C library integration.

lib/zig · high confidence

Introduces BEAM allocator and NIF interface layer

Adds a new \priv/beam\ module that provides a Zig-based interface for Erlang/BEAM NIFs. This includes a custom \beam\_allocator\ for memory management, wrappers for \erl\_nif\ C API functions, and utilities for marshaling data between Zig and BEAM terms (e.g., \get\ and \make\ functions for integers, enums, structs, and binaries). The change also introduces a thread-safe \Mutex\ wrapper and an \io\ module that overrides standard library I/O to use BEAM-consistent time and stderr handling.

priv/beam · high confidence

Introduces concurrency and threading support for NIFs

The NIF generation system now supports different concurrency models. A new \Zig.Nif.Concurrency\ behaviour and implementations for \DirtyCpu\, \DirtyIo\, \Synchronous\, and \Threaded\ NIFs have been added. This allows users to define NIFs that run on dirty schedulers or in separate threads, with the code generator producing the necessary Erlang/Elixir wrappers to handle thread launching, joining, and error states.

lib/zig/nif · high confidence

Introduction of the Zig module for inline NIFs

A new \Zig\ module has been added to the library, providing a \use\ macro that enables inline Zig code compilation for Elixir modules. This change introduces the primary interface for defining NIFs using the \\~Z\ sigil, handling the automatic compilation and binding of shared objects. The existing \Zigler\ module is refactored to act as a parse transform for Erlang, delegating to the new \Zig\ module for the core compilation logic.

lib · high confidence

Removals

Removed deprecated compiler and Zig code generation modules

The \Zigler.Compiler\ and \Zigler.Zig\ modules have been removed from the codebase. This change eliminates the previous implementation for generating Zig NIF code and handling compilation, marking the end of that specific code generation approach in favor of a newer architecture.

lib/zigler · high confidence

Removed legacy NIF adapter templates

The Elixir template files used to generate NIF (Native Implemented Functions) adapter code have been removed. This includes the header, footer, and export templates that previously generated the C/Erlang interop layer for Zig-based NIFs. Users relying on these specific template files for NIF generation will need to update their setup or templates.

assets · high confidence

Behavioural changes

Removed custom Erlang NIF header file

The custom header file \priv/include/erl\_nif.h\, which defined types and function declarations for Erlang NIFs (Native Implemented Functions), has been removed. This eliminates the local copy of NIF-related definitions, likely to rely on the standard Erlang/OTP headers instead.

priv/include · high confidence

Test coverage

Add raw NIF test coverage; Add tests for on\_load, on\_unload, and on\_upgrade callbacks; Added C integration test for header inclusion and build flags; Added Erlang integration tests for the Zigler library; Added concurrency and sigil\_z test coverage; Added resource management tests for basic, cleanup, keep, release, and unusable types; Added test support utilities for compiling and generating test files; Added tests for compiler error handling; Added tests for corner cases including return spec override, staging directory, and transitive imports; Added tests for memory allocator and leak detection; Comprehensive test coverage for all supported Zig types; Expanded C interop test coverage; Expanded test coverage for NIF options and precompiled libraries.

Dependencies

Upgrade to Elixir 1.15 and Zig 0.16.0

The project now requires Elixir 1.15 and targets Zig 0.16.0, updating the minimum supported Elixir version from 1.9 to 1.15. This change includes a major version bump to 0.16.0, updates to the \mix.exs\ configuration to support packaging and documentation generation for the new versions, and updates to the \mix.lock\ files to reflect the new dependency graph.

(dependencies) · 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

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 61 → 69 (+8.1)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 96 → 98 (+2.5)
  • Architecture 98 → 99 (+0.9)
  • Maturity 60 → 64 (+4.1)
  • Readiness 50 → 55 (+5.0)
  • Security 68 → 99 (+31.2)

Resolved (31)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — no supported dependency manifest was read
  • Duplicated block (7 lines × 2) (lib/zig/command.ex)
  • FileTooLong: lib/zig.ex (lib/zig.ex)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 11 more

New (28)

  • Documentation: no contributor guidance (README.md)
  • Duplicated block (9 lines × 2) (lib/zig/command.ex)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 8 more

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

Survey your own repository

E-xyza/zigler 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 23 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 afb8a604e278a21717e73151eff078854f4c84ce — 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-955b9cee9818.