No cycles
Detect directed cycles among slice nodes and return a canonical closed slice path with the contributing file edges.
Zig 0.16 · v0.0.2 preview
Slices project file paths into repeated architectural units—features, components, bounded contexts—then enforce independence or diagram adherence over the projected graph.
const std = @import("std");
const archunit = @import("archunit");
test "API does not bypass service" {
var project = try archunit.projectSlices(std.testing.allocator, .{});
defer project.deinit();
var slices = try project.definedByRegex("^src/([^/]+)/");
defer slices.deinit();
var should_not = try slices.shouldNot();
defer should_not.deinit();
var rule = try should_not.containDependency("api", "domain");
defer rule.deinit(std.testing.allocator);
try archunit.expectPasses(&rule, .init(.init(std.testing.allocator, std.testing.io)));
}
Compiled source: test/readme/slices.zig
Define a slice projection with a glob or regular expression capture. A path may map to one slice label or be dropped. Equal label pairs merge while retaining all raw file-edge evidence, and isolated projected nodes remain visible.
Detect directed cycles among slice nodes and return a canonical closed slice path with the contributing file edges.
Require slices not to depend on one another, with configurable allowances for explicitly shared slices.
Compare actual projected dependencies with a supported PlantUML component diagram and report missing or forbidden relationships.
Render the owned slice graph as deterministic PlantUML without a network service or remote renderer.
The parser intentionally supports the component vocabulary the rule can verify. Aliases and directed component relationships become slice names and allowed edges. Unsupported syntax is a clear parse/configuration error rather than being guessed.
Path exclusions remove project paths before labels and edges are projected. An external module has no project path and is not a slice node. This keeps a slice rule about the internal project topology instead of mixing dependency classification into capture semantics.