diff --git a/README.md b/README.md
index 5f4eb36..58c2243 100644
--- a/README.md
+++ b/README.md
@@ -318,6 +318,20 @@ module alias table. Multiple roots may map the same alias differently. Unknown a
silently disappear. Strict parsing rejects malformed source and non-literal operands; permissive
parsing returns owned syntax diagnostics and no partial edges from a rejected file.
+### Project-level `.archignore`
+
+An optional `.archignore` at the located project root adds exclusions to every architecture scan.
+It uses the same case-sensitive ArchUnit glob syntax as `ExtractionOptions.exclusions`: `*` stays
+within one path segment, `**` crosses segments, `/pattern` is rooted, a pattern without a separator
+matches a basename at any depth, and `\` is accepted as a path separator. Blank lines and full-line
+`#` comments are ignored. Inline comments and gitignore negation are not supported; a line beginning
+with `!` fails with `InvalidPattern` instead of silently behaving like a different language.
+
+Only the root file is read. Nested `.archignore` files have no effect, and all three exclusion
+sources are additive: the file cannot re-include a built-in cache/vendor/output directory or a path
+excluded explicitly through `CheckOptions`. The cache identity includes the normalized root-file
+path, its presence, and a SHA-256 fingerprint of its exact bytes, so edits invalidate cached graphs.
+
## Limitations
| Area | Current contract |
@@ -330,7 +344,7 @@ parsing returns owned syntax diagnostics and no partial edges from a rejected fi
| Language model | There are no class/interface rules, LCOM, abstractness, main-sequence distance, or class-oriented zone metrics. |
| Visibility | Zig declaration visibility is not treated as abstractness or an architecture layer. |
| Slice vocabulary | Only the projection, dependency, PlantUML, and export methods documented above are shipped; sibling-only slice methods are not implied. |
-| Filesystem traversal | Symlinks/reparse points are not followed, nested marked Zig projects are boundaries, and cache/VCS/output/docs/dependency trees are excluded by default. |
+| Filesystem traversal | Symlinks/reparse points are not followed, nested marked Zig projects are boundaries, cache/VCS/output/docs/dependency trees are excluded by default, and only the project-root `.archignore` is loaded. |
| Concurrency | Graph cache instances are unsynchronized; the process-wide cache is mutex-protected, but caller-owned writers and sinks need their own coordination if shared. |
## Configuration and diagnostics
diff --git a/docs-site/pages/extraction-modules.html b/docs-site/pages/extraction-modules.html
index ceabcc3..d760e0d 100644
--- a/docs-site/pages/extraction-modules.html
+++ b/docs-site/pages/extraction-modules.html
@@ -5,6 +5,10 @@
Project discovery and enumeration
Pass an explicit project directory or marker, or let discovery walk upward to the nearest build.zig.zon and then build.zig. Enumeration returns sorted lowercase .zig and .zon paths. Cache, VCS, output, dependency, and nested-project directories are excluded by default; custom exclusions are additive.
Symlinks and Windows reparse points are not followed. This keeps traversal bounded and makes an external target's classification independent of filesystem aliases.
+Project-wide source exclusions
+An optional .archignore beside the located root marker applies to direct enumeration and every fluent architecture check. It uses ArchUnitZig globs: * stays in one segment, ** crosses segments, a leading / anchors at the root, separator-free patterns match basenames at any depth, and Windows separators are accepted. Blank lines and full-line # comments are ignored.
+Only the root file is authoritative. Nested files do not override it, and its patterns are additive with explicit and built-in exclusions. Gitignore negation is intentionally unsupported; a line beginning with ! is an InvalidPattern error rather than an inert policy.
+
Dependency syntax
The extractor recognizes literal @import, @embedFile, and deprecated @cImport/@cInclude forms without evaluating code. Comments, ordinary string contents, and multiline strings cannot become false dependencies.
@@ -34,7 +38,7 @@
Production graphs and colocated tests
Zig test declarations live beside production code, so their imports are visible by default. Set ExtractionOptions.include_test_imports = false when enforcing a production-only architecture. Ordinary comptime dependencies remain included.
Deterministic cache identity
-
Graph-cache keys encode the canonical project root and every extraction option, including ordered compilation-unit mappings and test-import behavior. Caller-owned caches are unsynchronized; the optional process cache is mutex-protected. Reads return clones, so clearing a cache cannot invalidate a graph already returned to a caller.
+
Graph-cache keys encode the canonical project root and every extraction option, including ordered compilation-unit mappings and test-import behavior. They also encode the normalized root .archignore path, presence, and exact-content SHA-256 fingerprint, so edits invalidate prior results. Caller-owned caches are unsynchronized; the optional process cache is mutex-protected. Reads return clones, so clearing a cache cannot invalidate a graph already returned to a caller.
Local dependency suppressions
// archunit: ignore may suppress one intentional dependency occurrence. A trailing directive applies to calls on that line; a standalone directive applies only to the builtin on the next physical line. Optional target names are exact after Zig string decoding. Malformed directives are reported instead of silently changing the graph.
diff --git a/docs-site/pages/limitations.html b/docs-site/pages/limitations.html
index 468195c..f827bf2 100644
--- a/docs-site/pages/limitations.html
+++ b/docs-site/pages/limitations.html
@@ -8,7 +8,7 @@
Literal dependency calls only
The extractor records literal @import, @embedFile, and supported C-import forms. A computed dependency operand is a parser-policy error in strict mode because static analysis cannot name its target without execution.
Traversal is deliberately conservative
-
Symlinks and Windows reparse points are not followed. Nested marked Zig projects are traversal boundaries by default. Existing relative targets are canonicalized against the project root, and paths leaving that root remain external/outside rather than being silently folded into the project graph.
+
Symlinks and Windows reparse points are not followed. Nested marked Zig projects are traversal boundaries by default, and nested .archignore files do not alter the located root's policy. Existing relative targets are canonicalized against the project root, and paths leaving that root remain external/outside rather than being silently folded into the project graph.
No class-oriented metrics
There is no class/interface rule surface, inheritance policy, LCOM, abstractness, distance-from-main-sequence, or zone label. Zig declarations, containers, source structure, imports, graph coupling, and user-defined metrics are the supported vocabulary.
diff --git a/docs/architecture.md b/docs/architecture.md
index 7ab8928..057d9b1 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -202,14 +202,19 @@ Project discovery canonicalises an explicit directory/marker or searches upward
excluded directories are never opened recursively. Symlink/reparse entries are not followed, and a
nested marked Zig project is a traversal boundary by default. The owned result contains sorted,
project-relative `/` paths for lowercase `.zig` and `.zon` files; custom exclusion globs are additive
-to the documented cache, VCS, output, documentation, and dependency defaults.
+to the documented cache, VCS, output, documentation, and dependency defaults. An optional
+project-root `.archignore` supplies a second additive list in the same ArchUnit glob grammar. Only
+blank lines and full-line `#` comments are metadata; negation is deliberately unsupported, and
+nested `.archignore` files do not alter the root policy.
Extraction settings live in one `ExtractionOptions` value: exclusions, parser strictness,
resource/C-header toggles, explicit compilation-unit mappings, and build-graph mode. Graph-cache
-keys use the canonical project root plus a length-delimited encoding of every field. A schema test
-reflects over the options and nested module-mapping structs, so adding a field without acknowledging
-it in key construction fails the suite. Slice order is significant; this may conservatively miss an
-equivalent hit but cannot return a graph produced for different input.
+keys use the canonical project root plus a length-delimited encoding of every field. They also encode
+the normalized root `.archignore` path, whether the file exists, and the SHA-256 fingerprint of its
+exact bytes. A schema test reflects over the options and nested module-mapping structs, so adding a
+field without acknowledging it in key construction fails the suite. Slice order is significant;
+this may conservatively miss an equivalent hit but cannot return a graph produced for different
+input.
`GraphCache` instances own cloned keys and graphs and are deliberately not synchronized. Reads also
return clones, so clearing or destroying a cache never invalidates a caller's graph. The process-wide
diff --git a/docs/decisions.md b/docs/decisions.md
index 9607b5e..0ced6e4 100644
--- a/docs/decisions.md
+++ b/docs/decisions.md
@@ -1248,3 +1248,38 @@ headroom. CI uploads the raw JSON so future optimisation begins from comparable
Consequence: correctness and cache isolation cannot be traded for a faster number; performance
regressions are visible by stage; allocations can be profiled without platform-specific tooling;
and budget changes remain auditable against hosted evidence rather than one workstation.
+
+### D051 — `.archignore` reuses one exclusion language
+
+The optional project-root `.archignore` uses ArchUnitZig's existing glob language. A pattern without
+a path separator selects a basename at any depth; a pattern containing `/` or `\` selects a complete
+project-relative path; a leading `/` anchors an otherwise basename-shaped pattern at the project
+root; and a trailing separator selects a directory for traversal pruning. `*`, `**`, `?`, and
+character classes retain the same case-sensitive behavior as programmatic extraction exclusions.
+This is deliberately not advertised as gitignore compatibility.
+
+Surrounding spaces, tabs, and carriage returns are trimmed around each physical line. Empty lines
+and lines whose first remaining byte is `#` are ignored. `#` elsewhere is literal. Negation is not
+supported because re-inclusion would conflict with selective traversal and the promise that built-in
+cache, VCS, output, documentation, and dependency boundaries are never entered. A first
+non-whitespace `!`, an empty rooted pattern,
+`.` or `..` path segments, NUL bytes, and invalid ArchUnit globs are user-facing `InvalidPattern`
+errors with a `project.parse_archignore` diagnostic. Failing closed avoids accepting policy text
+with semantics borrowed accidentally from another ignore language.
+
+Exactly one file is authoritative: `.archignore` beside the located root marker. Nested files are
+ordinary non-analyzable files and have no policy effect. Its patterns, explicit
+`ExtractionOptions.exclusions`, and built-in exclusions form an additive union; none can re-include
+another source's exclusion. The loaded root policy is owned for one extraction and shared by cache-
+key construction and enumeration, avoiding a read-key/read-scan race inside one operation.
+
+The graph-cache key encodes the normalized absolute `.archignore` path, an explicit present/absent
+byte, and a SHA-256 fingerprint of the exact file bytes. Thus missing and empty files differ, and
+comments or line-ending edits conservatively invalidate the graph even when their effective pattern
+set is unchanged. Direct source enumeration loads the same root policy, so the public low-level API
+and fluent graph extraction cannot disagree.
+
+Consequence: repositories can keep generated or vendored source out of every architecture corpus
+without repeating options in each test; configuration errors are visible; Windows-authored patterns
+stay portable; nested projects cannot silently override their parent's scan; and cached graphs never
+outlive the exact root policy bytes that selected their source files.
diff --git a/src/common/extraction.zig b/src/common/extraction.zig
index 1c9ffe8..1666922 100644
--- a/src/common/extraction.zig
+++ b/src/common/extraction.zig
@@ -52,6 +52,7 @@ pub const locateProject = @import("extraction/project_locator.zig").locateProjec
test {
_ = @import("path.zig");
+ _ = @import("extraction/archignore.zig");
_ = @import("extraction/classifier.zig");
_ = @import("extraction/edge.zig");
_ = @import("extraction/extraction_options.zig");
diff --git a/src/common/extraction/archignore.zig b/src/common/extraction/archignore.zig
new file mode 100644
index 0000000..a1b0b97
--- /dev/null
+++ b/src/common/extraction/archignore.zig
@@ -0,0 +1,296 @@
+const std = @import("std");
+
+const common_error = @import("../error.zig");
+const common_path = @import("../path.zig");
+const matching = @import("../matching.zig");
+
+const Allocator = std.mem.Allocator;
+const Io = std.Io;
+
+pub const file_name = ".archignore";
+
+/// One owned snapshot of the root policy. The exact path, presence, and content fingerprint are
+/// retained separately from the effective patterns so cache identity can conservatively track
+/// comment and line-ending edits too.
+pub const ArchIgnore = struct {
+ path: []const u8,
+ present: bool = false,
+ fingerprint: [32]u8 = [_]u8{0} ** 32,
+ pattern_storage: std.ArrayList([]const u8) = .empty,
+
+ pub fn deinit(self: *ArchIgnore, allocator: Allocator) void {
+ allocator.free(self.path);
+ for (self.pattern_storage.items) |pattern| allocator.free(pattern);
+ self.pattern_storage.deinit(allocator);
+ self.* = undefined;
+ }
+
+ pub fn patterns(self: *const ArchIgnore) []const []const u8 {
+ return self.pattern_storage.items;
+ }
+};
+
+/// Loads only `
/.archignore`. A missing file is a valid, cache-identifiable state.
+pub fn load(
+ allocator: Allocator,
+ io: Io,
+ project_root: []const u8,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError!ArchIgnore {
+ const joined_path = std.fs.path.join(allocator, &.{ project_root, file_name }) catch {
+ return diagnostics.failTechnical(.out_of_memory, "project.load_archignore", file_name, error.OutOfMemory);
+ };
+ defer allocator.free(joined_path);
+ const normalized_path = common_path.normalize(allocator, joined_path) catch {
+ return diagnostics.failTechnical(.out_of_memory, "project.load_archignore", file_name, error.OutOfMemory);
+ };
+
+ var result = ArchIgnore{ .path = normalized_path };
+ errdefer result.deinit(allocator);
+ const contents = std.Io.Dir.cwd().readFileAllocOptions(
+ io,
+ joined_path,
+ allocator,
+ .limited(std.math.maxInt(usize)),
+ .of(u8),
+ 0,
+ ) catch |failure| switch (failure) {
+ error.FileNotFound => return result,
+ error.OutOfMemory => return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.load_archignore",
+ normalized_path,
+ failure,
+ ),
+ else => |other| return diagnostics.failTechnical(
+ .file_system,
+ "project.load_archignore",
+ normalized_path,
+ other,
+ ),
+ };
+ defer allocator.free(contents);
+
+ result.present = true;
+ var hash = std.crypto.hash.sha2.Sha256.init(.{});
+ hash.update(contents);
+ hash.final(&result.fingerprint);
+ try parseContents(allocator, &result, contents, diagnostics);
+ return result;
+}
+
+fn parseContents(
+ allocator: Allocator,
+ result: *ArchIgnore,
+ contents: []const u8,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError!void {
+ var lines = std.mem.splitScalar(u8, contents, '\n');
+ var line_number: usize = 0;
+ while (lines.next()) |line| {
+ line_number += 1;
+ const pattern = std.mem.trim(u8, line, " \t\r");
+ if (pattern.len == 0 or pattern[0] == '#') continue;
+ try validatePattern(allocator, result.path, line_number, pattern, diagnostics);
+ const owned = allocator.dupe(u8, pattern) catch {
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.parse_archignore",
+ result.path,
+ error.OutOfMemory,
+ );
+ };
+ result.pattern_storage.append(allocator, owned) catch {
+ allocator.free(owned);
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.parse_archignore",
+ result.path,
+ error.OutOfMemory,
+ );
+ };
+ }
+}
+
+fn validatePattern(
+ allocator: Allocator,
+ path: []const u8,
+ line_number: usize,
+ pattern: []const u8,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError!void {
+ if (pattern[0] == '!') return failPattern(
+ allocator,
+ diagnostics,
+ path,
+ line_number,
+ error.UnsupportedNegation,
+ );
+ if (std.mem.indexOfScalar(u8, pattern, 0) != null) return failPattern(
+ allocator,
+ diagnostics,
+ path,
+ line_number,
+ error.NulByte,
+ );
+
+ const without_anchor = if (pattern[0] == '/') pattern[1..] else pattern;
+ if (without_anchor.len == 0) return failPattern(
+ allocator,
+ diagnostics,
+ path,
+ line_number,
+ error.EmptyPattern,
+ );
+ const normalized = common_path.normalize(allocator, without_anchor) catch {
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.parse_archignore",
+ path,
+ error.OutOfMemory,
+ );
+ };
+ defer allocator.free(normalized);
+ if (std.mem.startsWith(u8, normalized, "/")) return failPattern(
+ allocator,
+ diagnostics,
+ path,
+ line_number,
+ error.InvalidRootAnchor,
+ );
+ var segments = std.mem.splitScalar(u8, normalized, '/');
+ while (segments.next()) |segment| {
+ if (std.mem.eql(u8, segment, ".") or std.mem.eql(u8, segment, "..")) {
+ return failPattern(
+ allocator,
+ diagnostics,
+ path,
+ line_number,
+ error.RelativePathSegment,
+ );
+ }
+ }
+
+ var compiled = (matching.Pattern{ .glob = without_anchor }).compile(allocator) catch |failure| {
+ if (failure == error.OutOfMemory) {
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.parse_archignore",
+ path,
+ failure,
+ );
+ }
+ return failPattern(allocator, diagnostics, path, line_number, failure);
+ };
+ compiled.deinit();
+}
+
+fn failPattern(
+ allocator: Allocator,
+ diagnostics: *common_error.ErrorContext,
+ path: []const u8,
+ line_number: usize,
+ cause: anyerror,
+) common_error.ArchUnitError {
+ const subject = std.fmt.allocPrint(allocator, "{s}:{d}", .{ path, line_number }) catch {
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.parse_archignore",
+ path,
+ error.OutOfMemory,
+ );
+ };
+ defer allocator.free(subject);
+ return diagnostics.failUser(.invalid_pattern, "project.parse_archignore", subject, cause);
+}
+
+fn temporaryRoot(tmp: *std.testing.TmpDir) ![:0]u8 {
+ return tmp.dir.realPathFileAlloc(std.testing.io, ".", std.testing.allocator);
+}
+
+test "missing policy is an owned absent snapshot" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var diagnostics = common_error.ErrorContext.init(std.testing.allocator);
+ defer diagnostics.deinit();
+
+ var policy = try load(std.testing.allocator, std.testing.io, root, &diagnostics);
+ defer policy.deinit(std.testing.allocator);
+ try std.testing.expect(!policy.present);
+ try std.testing.expectEqual(@as(usize, 0), policy.patterns().len);
+ try std.testing.expect(std.mem.endsWith(u8, policy.path, "/.archignore"));
+}
+
+test "comments whitespace CRLF and literal inline hashes parse deterministically" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = file_name,
+ .data = " # root policy\r\n\r\n src/** \r\nnested\\generated\\**\nfile#literal.zig\n",
+ });
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var diagnostics = common_error.ErrorContext.init(std.testing.allocator);
+ defer diagnostics.deinit();
+
+ var policy = try load(std.testing.allocator, std.testing.io, root, &diagnostics);
+ defer policy.deinit(std.testing.allocator);
+ try std.testing.expect(policy.present);
+ try std.testing.expectEqual(@as(usize, 3), policy.patterns().len);
+ try std.testing.expectEqualStrings("src/**", policy.patterns()[0]);
+ try std.testing.expectEqualStrings("nested\\generated\\**", policy.patterns()[1]);
+ try std.testing.expectEqualStrings("file#literal.zig", policy.patterns()[2]);
+ try std.testing.expect(!std.mem.allEqual(u8, &policy.fingerprint, 0));
+}
+
+fn expectInvalid(contents: []const u8, expected_cause: anyerror) !void {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = file_name, .data = contents });
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var diagnostics = common_error.ErrorContext.init(std.testing.allocator);
+ defer diagnostics.deinit();
+
+ try std.testing.expectError(
+ error.InvalidPattern,
+ load(std.testing.allocator, std.testing.io, root, &diagnostics),
+ );
+ try std.testing.expectEqualStrings("project.parse_archignore", diagnostics.diagnostic.?.operation);
+ try std.testing.expect(std.mem.endsWith(u8, diagnostics.diagnostic.?.subject.?, "/.archignore:2"));
+ try std.testing.expectEqual(expected_cause, diagnostics.diagnostic.?.cause.?);
+}
+
+test "unsupported negation and malformed project-relative globs fail closed" {
+ try expectInvalid("# policy\n!generated/**\n", error.UnsupportedNegation);
+ try expectInvalid("# policy\n/\n", error.EmptyPattern);
+ try expectInvalid("# policy\nsrc/../private/**\n", error.RelativePathSegment);
+ try expectInvalid("# policy\n[z-a].zig\n", error.InvalidCharRange);
+ try expectInvalid("# policy\nembedded\x00nul\n", error.NulByte);
+}
+
+fn exerciseAllocationFailures(allocator: Allocator, root: []const u8) !void {
+ var diagnostics = common_error.ErrorContext.init(allocator);
+ defer diagnostics.deinit();
+ var policy = try load(allocator, std.testing.io, root, &diagnostics);
+ defer policy.deinit(allocator);
+ try std.testing.expectEqual(@as(usize, 2), policy.patterns().len);
+}
+
+test "policy loading cleans up every allocation failure" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = file_name,
+ .data = "generated/**\nsrc/**/*_generated.zig\n",
+ });
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ try std.testing.checkAllAllocationFailures(
+ std.testing.allocator,
+ exerciseAllocationFailures,
+ .{root},
+ );
+}
diff --git a/src/common/extraction/graph_cache.zig b/src/common/extraction/graph_cache.zig
index 76d03bc..5db084d 100644
--- a/src/common/extraction/graph_cache.zig
+++ b/src/common/extraction/graph_cache.zig
@@ -1,5 +1,6 @@
const std = @import("std");
+const archignore = @import("archignore.zig");
const common_error = @import("../error.zig");
const common_path = @import("../path.zig");
const extraction_options = @import("extraction_options.zig");
@@ -12,7 +13,7 @@ pub const BuildGraphMode = extraction_options.BuildGraphMode;
pub const ExtractionOptions = extraction_options.ExtractionOptions;
pub const Graph = graph_module.Graph;
-const cache_key_schema_version: u64 = 2;
+const cache_key_schema_version: u64 = 3;
const keyed_option_fields = [_][]const u8{
"exclusions",
"strictness",
@@ -53,31 +54,80 @@ pub fn buildGraphCacheKey(
options: ExtractionOptions,
diagnostics: *common_error.ErrorContext,
) common_error.ArchUnitError!GraphCacheKey {
+ const canonical_root = try canonicalProjectRoot(allocator, io, project_root, diagnostics);
+ defer allocator.free(canonical_root);
+ var root_policy = try archignore.load(allocator, io, canonical_root, diagnostics);
+ defer root_policy.deinit(allocator);
+ return buildCanonicalGraphCacheKey(
+ allocator,
+ canonical_root,
+ options,
+ &root_policy,
+ diagnostics,
+ );
+}
+
+/// Coherent extraction entry point: encodes the exact policy snapshot used by source enumeration.
+pub fn buildGraphCacheKeyWithArchIgnore(
+ allocator: Allocator,
+ io: Io,
+ project_root: []const u8,
+ options: ExtractionOptions,
+ root_policy: *const archignore.ArchIgnore,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError!GraphCacheKey {
+ const canonical_root = try canonicalProjectRoot(allocator, io, project_root, diagnostics);
+ defer allocator.free(canonical_root);
+ return buildCanonicalGraphCacheKey(
+ allocator,
+ canonical_root,
+ options,
+ root_policy,
+ diagnostics,
+ );
+}
+
+fn canonicalProjectRoot(
+ allocator: Allocator,
+ io: Io,
+ project_root: []const u8,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError![:0]u8 {
if (project_root.len == 0) {
return diagnostics.failUser(.invalid_project_path, "graph_cache.build_key", project_root, null);
}
const canonical_root = std.Io.Dir.cwd().realPathFileAlloc(io, project_root, allocator) catch |failure| {
return mapRootFailure(diagnostics, project_root, failure);
};
- defer allocator.free(canonical_root);
+ errdefer allocator.free(canonical_root);
const root_stat = std.Io.Dir.cwd().statFile(io, canonical_root, .{}) catch |failure| {
return mapRootFailure(diagnostics, project_root, failure);
};
if (root_stat.kind != .directory) {
return diagnostics.failUser(.invalid_project_path, "graph_cache.build_key", project_root, error.NotDir);
}
+ return canonical_root;
+}
+
+fn buildCanonicalGraphCacheKey(
+ allocator: Allocator,
+ canonical_root: []const u8,
+ options: ExtractionOptions,
+ root_policy: *const archignore.ArchIgnore,
+ diagnostics: *common_error.ErrorContext,
+) common_error.ArchUnitError!GraphCacheKey {
const normalized_root = common_path.normalize(allocator, canonical_root) catch {
- return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", project_root, error.OutOfMemory);
+ return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", canonical_root, error.OutOfMemory);
};
defer allocator.free(normalized_root);
var encoded: std.ArrayList(u8) = .empty;
errdefer encoded.deinit(allocator);
- appendKey(allocator, &encoded, normalized_root, options) catch {
- return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", project_root, error.OutOfMemory);
+ appendKey(allocator, &encoded, normalized_root, options, root_policy) catch {
+ return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", canonical_root, error.OutOfMemory);
};
const bytes = encoded.toOwnedSlice(allocator) catch {
- return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", project_root, error.OutOfMemory);
+ return diagnostics.failTechnical(.out_of_memory, "graph_cache.build_key", canonical_root, error.OutOfMemory);
};
return .{ .bytes = bytes, .hash_value = std.hash.Wyhash.hash(0, bytes) };
}
@@ -87,9 +137,13 @@ fn appendKey(
encoded: *std.ArrayList(u8),
canonical_root: []const u8,
options: ExtractionOptions,
+ root_policy: *const archignore.ArchIgnore,
) Allocator.Error!void {
try appendU64(allocator, encoded, cache_key_schema_version);
try appendString(allocator, encoded, canonical_root);
+ try appendString(allocator, encoded, root_policy.path);
+ try encoded.append(allocator, @intFromBool(root_policy.present));
+ try appendString(allocator, encoded, &root_policy.fingerprint);
try appendU64(allocator, encoded, @intFromEnum(options.strictness));
try encoded.append(allocator, @intFromBool(options.include_resources));
try encoded.append(allocator, @intFromBool(options.include_c_imports));
@@ -303,6 +357,50 @@ test "canonical roots produce equal keys and every option separates keys" {
}
}
+test "cache keys encode root archignore path presence and exact content fingerprint" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var context = common_error.ErrorContext.init(std.testing.allocator);
+ defer context.deinit();
+
+ var missing = try buildGraphCacheKey(std.testing.allocator, std.testing.io, root, .{}, &context);
+ defer missing.deinit(std.testing.allocator);
+ const joined_policy_path = try std.fs.path.join(std.testing.allocator, &.{ root, archignore.file_name });
+ defer std.testing.allocator.free(joined_policy_path);
+ const normalized_policy_path = try common_path.normalize(std.testing.allocator, joined_policy_path);
+ defer std.testing.allocator.free(normalized_policy_path);
+ try std.testing.expect(std.mem.indexOf(u8, missing.bytes, normalized_policy_path) != null);
+
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = archignore.file_name, .data = "" });
+ var empty = try buildGraphCacheKey(std.testing.allocator, std.testing.io, root, .{}, &context);
+ defer empty.deinit(std.testing.allocator);
+ try std.testing.expect(!missing.eql(empty));
+
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "# comment only\n",
+ });
+ var comment = try buildGraphCacheKey(std.testing.allocator, std.testing.io, root, .{}, &context);
+ defer comment.deinit(std.testing.allocator);
+ try std.testing.expect(!empty.eql(comment));
+
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "alpha/**\n",
+ });
+ var alpha = try buildGraphCacheKey(std.testing.allocator, std.testing.io, root, .{}, &context);
+ defer alpha.deinit(std.testing.allocator);
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "bravo/**\n",
+ });
+ var bravo = try buildGraphCacheKey(std.testing.allocator, std.testing.io, root, .{}, &context);
+ defer bravo.deinit(std.testing.allocator);
+ try std.testing.expect(!alpha.eql(bravo));
+}
+
test "every compilation-unit and module mapping field separates cache keys" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
diff --git a/src/common/extraction/project_graph.zig b/src/common/extraction/project_graph.zig
index a5ab19a..b2359e1 100644
--- a/src/common/extraction/project_graph.zig
+++ b/src/common/extraction/project_graph.zig
@@ -1,5 +1,6 @@
const std = @import("std");
+const archignore = @import("archignore.zig");
const classifier = @import("classifier.zig");
const common_error = @import("../error.zig");
const extraction_options = @import("extraction_options.zig");
@@ -95,16 +96,19 @@ fn extractProjectGraphObserved(
diagnostics,
);
defer project.deinit(allocator);
+ var root_policy = try archignore.load(allocator, io, project.path, diagnostics);
+ defer root_policy.deinit(allocator);
if (clear_cache) {
graph_cache.clearGraphCache();
try logger.logCache("cache cleared");
}
- var cache_key = try graph_cache.buildGraphCacheKey(
+ var cache_key = try graph_cache.buildGraphCacheKeyWithArchIgnore(
allocator,
io,
project.path,
options,
+ &root_policy,
diagnostics,
);
defer cache_key.deinit(allocator);
@@ -117,7 +121,14 @@ fn extractProjectGraphObserved(
}
try logger.logCache("cache miss");
- var graph = try extractLocatedGraph(allocator, io, project.path, options, diagnostics);
+ var graph = try extractLocatedGraph(
+ allocator,
+ io,
+ project.path,
+ options,
+ &root_policy,
+ diagnostics,
+ );
errdefer graph.deinit(allocator);
graph_cache.storeGraphInCache(cache_key, graph) catch {
return diagnostics.failTechnical(.out_of_memory, "project_graph.cache_put", project.path, error.OutOfMemory);
@@ -136,13 +147,15 @@ fn extractLocatedGraph(
io: Io,
project_root: []const u8,
options: ExtractionOptions,
+ root_policy: *const archignore.ArchIgnore,
diagnostics: *common_error.ErrorContext,
) common_error.ArchUnitError!Graph {
- var files = try source_files.enumerateSourceFiles(
+ var files = try source_files.enumerateSourceFilesWithArchIgnore(
allocator,
io,
project_root,
.{ .exclusions = options.exclusions },
+ root_policy,
diagnostics,
);
defer files.deinit(allocator);
@@ -334,6 +347,59 @@ test "project graph extracts real relative imports and returns independent cache
try std.testing.expect(first.items()[0].source.ptr != second.items()[0].source.ptr);
}
+test "editing root archignore invalidates cached extraction without an explicit clear" {
+ graph_cache.clearGraphCache();
+ defer graph_cache.clearGraphCache();
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = "build.zig.zon",
+ .data = ".{ .name = .fixture, .version = \"0.0.0\", .fingerprint = 0x2222222222222222 }",
+ });
+ try tmp.dir.createDirPath(std.testing.io, "src");
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = "src/generated.zig",
+ .data = "const kept = @import(\"kept.zig\");\n",
+ });
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "src/kept.zig", .data = "" });
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "generated.zig\n",
+ });
+ const root = try tmp.dir.realPathFileAlloc(std.testing.io, ".", std.testing.allocator);
+ defer std.testing.allocator.free(root);
+ var diagnostics = common_error.ErrorContext.init(std.testing.allocator);
+ defer diagnostics.deinit();
+
+ var ignored = try extractProjectGraph(
+ std.testing.allocator,
+ std.testing.io,
+ root,
+ ".",
+ .{},
+ false,
+ &diagnostics,
+ );
+ defer ignored.deinit(std.testing.allocator);
+ try std.testing.expect(ignored.find("src/generated.zig", "src/kept.zig") == null);
+
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "other.zig\n",
+ });
+ var included = try extractProjectGraph(
+ std.testing.allocator,
+ std.testing.io,
+ root,
+ ".",
+ .{},
+ false,
+ &diagnostics,
+ );
+ defer included.deinit(std.testing.allocator);
+ try std.testing.expect(included.find("src/generated.zig", "src/kept.zig") != null);
+}
+
test "multiple compilation units are assigned only at exact roots" {
const units = [_]module_resolver.CompilationUnitOverride{
.{ .id = "app", .root_source_path = "src/main.zig" },
diff --git a/src/common/extraction/source_files.zig b/src/common/extraction/source_files.zig
index 7805783..36c5b1d 100644
--- a/src/common/extraction/source_files.zig
+++ b/src/common/extraction/source_files.zig
@@ -1,5 +1,6 @@
const std = @import("std");
+const archignore = @import("archignore.zig");
const common_error = @import("../error.zig");
const common_path = @import("../path.zig");
const matching = @import("../matching.zig");
@@ -43,6 +44,48 @@ pub fn enumerateSourceFiles(
options: EnumerationOptions,
diagnostics: *ErrorContext,
) common_error.ArchUnitError!SourceFiles {
+ const canonical_root = try canonicalProjectRoot(allocator, io, project_root, diagnostics);
+ defer allocator.free(canonical_root);
+ var root_policy = try archignore.load(allocator, io, canonical_root, diagnostics);
+ defer root_policy.deinit(allocator);
+ return enumerateCanonicalSourceFiles(
+ allocator,
+ io,
+ canonical_root,
+ options,
+ &root_policy,
+ diagnostics,
+ );
+}
+
+/// Coherent extraction entry point: the caller supplies the exact root policy snapshot already
+/// encoded into its graph-cache key.
+pub fn enumerateSourceFilesWithArchIgnore(
+ allocator: Allocator,
+ io: Io,
+ project_root: []const u8,
+ options: EnumerationOptions,
+ root_policy: *const archignore.ArchIgnore,
+ diagnostics: *ErrorContext,
+) common_error.ArchUnitError!SourceFiles {
+ const canonical_root = try canonicalProjectRoot(allocator, io, project_root, diagnostics);
+ defer allocator.free(canonical_root);
+ return enumerateCanonicalSourceFiles(
+ allocator,
+ io,
+ canonical_root,
+ options,
+ root_policy,
+ diagnostics,
+ );
+}
+
+fn canonicalProjectRoot(
+ allocator: Allocator,
+ io: Io,
+ project_root: []const u8,
+ diagnostics: *ErrorContext,
+) common_error.ArchUnitError![:0]u8 {
if (project_root.len == 0) {
return diagnostics.failUser(.invalid_project_path, "project.enumerate", project_root, null);
}
@@ -50,17 +93,41 @@ pub fn enumerateSourceFiles(
const canonical_root = std.Io.Dir.cwd().realPathFileAlloc(io, project_root, allocator) catch |failure| {
return mapEnumerationFailure(diagnostics, project_root, failure);
};
- defer allocator.free(canonical_root);
+ errdefer allocator.free(canonical_root);
const stat = std.Io.Dir.cwd().statFile(io, canonical_root, .{}) catch |failure| {
return mapEnumerationFailure(diagnostics, project_root, failure);
};
if (stat.kind != .directory) {
return diagnostics.failUser(.invalid_project_path, "project.enumerate", project_root, error.NotDir);
}
+ return canonical_root;
+}
- var exclusions = compileExclusions(allocator, options.exclusions, diagnostics) catch |failure| {
- return failure;
+fn enumerateCanonicalSourceFiles(
+ allocator: Allocator,
+ io: Io,
+ canonical_root: []const u8,
+ options: EnumerationOptions,
+ root_policy: *const archignore.ArchIgnore,
+ diagnostics: *ErrorContext,
+) common_error.ArchUnitError!SourceFiles {
+ var combined_patterns: std.ArrayList([]const u8) = .empty;
+ defer combined_patterns.deinit(allocator);
+ combined_patterns.ensureTotalCapacity(
+ allocator,
+ options.exclusions.len + root_policy.patterns().len,
+ ) catch {
+ return diagnostics.failTechnical(
+ .out_of_memory,
+ "project.compile_exclusion",
+ root_policy.path,
+ error.OutOfMemory,
+ );
};
+ combined_patterns.appendSliceAssumeCapacity(options.exclusions);
+ combined_patterns.appendSliceAssumeCapacity(root_policy.patterns());
+
+ var exclusions = try compileExclusions(allocator, combined_patterns.items, diagnostics);
defer {
for (exclusions.items) |*filter| filter.deinit();
exclusions.deinit(allocator);
@@ -69,17 +136,17 @@ pub fn enumerateSourceFiles(
var root_dir = std.Io.Dir.openDirAbsolute(io, canonical_root, .{
.iterate = true,
.follow_symlinks = false,
- }) catch |failure| return mapEnumerationFailure(diagnostics, project_root, failure);
+ }) catch |failure| return mapEnumerationFailure(diagnostics, canonical_root, failure);
defer root_dir.close(io);
var walker = root_dir.walkSelectively(allocator) catch {
- return diagnostics.failTechnical(.out_of_memory, "project.enumerate", project_root, error.OutOfMemory);
+ return diagnostics.failTechnical(.out_of_memory, "project.enumerate", canonical_root, error.OutOfMemory);
};
defer walker.deinit();
var result = SourceFiles{};
errdefer result.deinit(allocator);
while (walker.next(io) catch |failure| {
- return mapEnumerationFailure(diagnostics, project_root, failure);
+ return mapEnumerationFailure(diagnostics, canonical_root, failure);
}) |entry| {
const relative = common_path.normalize(allocator, entry.path) catch {
return diagnostics.failTechnical(.out_of_memory, "project.enumerate", entry.path, error.OutOfMemory);
@@ -326,6 +393,70 @@ test "root-anchored and basename custom exclusions remain distinct" {
try std.testing.expectEqual(@as(usize, 0), basename.items().len);
}
+test "root archignore applies rooted basename directory and Windows-separator globs" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "# ArchUnit glob syntax\n/root-only/\ngenerated\nsrc\\windows\\**\n",
+ });
+ try writeFixture(tmp.dir, "root-only/root.zig");
+ try writeFixture(tmp.dir, "nested/root-only/child.zig");
+ try writeFixture(tmp.dir, "nested/generated/client.zig");
+ try writeFixture(tmp.dir, "src/windows/deep/client.zig");
+ try writeFixture(tmp.dir, "src/keep.zig");
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var context = ErrorContext.init(std.testing.allocator);
+ defer context.deinit();
+
+ var files = try enumerateSourceFiles(
+ std.testing.allocator,
+ std.testing.io,
+ root,
+ .{ .include_default_exclusions = false },
+ &context,
+ );
+ defer files.deinit(std.testing.allocator);
+ try std.testing.expectEqual(@as(usize, 2), files.items().len);
+ try std.testing.expectEqualStrings("nested/root-only/child.zig", files.items()[0]);
+ try std.testing.expectEqualStrings("src/keep.zig", files.items()[1]);
+}
+
+test "root file explicit options and defaults compose while nested policies have no effect" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = archignore.file_name,
+ .data = "from-policy/**\n",
+ });
+ try writeFixture(tmp.dir, "from-policy/client.zig");
+ try writeFixture(tmp.dir, "from-options/client.zig");
+ try writeFixture(tmp.dir, "vendor/client.zig");
+ try writeFixture(tmp.dir, "nested/hidden/kept.zig");
+ try writeFixture(tmp.dir, "src/keep.zig");
+ try tmp.dir.writeFile(std.testing.io, .{
+ .sub_path = "nested/.archignore",
+ .data = "/nested/hidden/**\n",
+ });
+ const root = try temporaryRoot(&tmp);
+ defer std.testing.allocator.free(root);
+ var context = ErrorContext.init(std.testing.allocator);
+ defer context.deinit();
+
+ var files = try enumerateSourceFiles(
+ std.testing.allocator,
+ std.testing.io,
+ root,
+ .{ .exclusions = &.{"from-options/**"} },
+ &context,
+ );
+ defer files.deinit(std.testing.allocator);
+ try std.testing.expectEqual(@as(usize, 2), files.items().len);
+ try std.testing.expectEqualStrings("nested/hidden/kept.zig", files.items()[0]);
+ try std.testing.expectEqualStrings("src/keep.zig", files.items()[1]);
+}
+
test "nested marked Zig projects are boundaries by default" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
diff --git a/test/acceptance.zig b/test/acceptance.zig
index 4821c61..21d49cb 100644
--- a/test/acceptance.zig
+++ b/test/acceptance.zig
@@ -4,6 +4,7 @@ const archunit = @import("archunit");
const Allocator = std.mem.Allocator;
const clean_root = "test/fixtures/acceptance projects/clean";
const violating_root = "test/fixtures/acceptance projects/violating";
+const archignore_root = "test/fixtures/archignore";
const analysis_exclusions = [_][]const u8{"testdata/**"};
const app_modules = [_]archunit.ModuleOverride{
@@ -296,3 +297,75 @@ test "malformed source is an exact strict error and a permissive owned graph nod
"testdata/malformed/broken.zig",
) != null);
}
+
+test "public enumeration and extraction honor the root archignore fixture" {
+ var diagnostics = archunit.ErrorContext.init(std.testing.allocator);
+ defer diagnostics.deinit();
+ var files = try archunit.enumerateSourceFiles(
+ std.testing.allocator,
+ std.testing.io,
+ archignore_root,
+ .{ .exclusions = &.{"testdata/**"} },
+ &diagnostics,
+ );
+ defer files.deinit(std.testing.allocator);
+ const expected = [_][]const u8{
+ "build.zig.zon",
+ "nested/hidden/kept.zig",
+ "nested/src/autogen/kept.zig",
+ "src/domain/model.zig",
+ "src/main.zig",
+ };
+ try std.testing.expectEqual(expected.len, files.items().len);
+ for (expected, files.items()) |wanted, actual| {
+ try std.testing.expectEqualStrings(wanted, actual);
+ }
+
+ var graph = try archunit.extractProjectGraph(
+ std.testing.allocator,
+ std.testing.io,
+ ".",
+ archignore_root,
+ .{ .exclusions = &.{"testdata/**"} },
+ true,
+ &diagnostics,
+ );
+ defer graph.deinit(std.testing.allocator);
+ try std.testing.expect(graph.find("src/main.zig", "src/domain/model.zig") != null);
+ try std.testing.expect(graph.find("src/autogen/client.zig", "src/domain/model.zig") == null);
+}
+
+test "CheckOptions exclusions add to archignore with a live negative control" {
+ var project = try archunit.files(std.testing.allocator, .{});
+ defer project.deinit();
+ var ignored_sources = try project.inPath(&.{
+ .{ .glob = "src/autogen/**" },
+ .{ .glob = "testdata/**" },
+ });
+ defer ignored_sources.deinit();
+ var negative = try ignored_sources.shouldNot();
+ defer negative.deinit();
+ var dependencies = try negative.dependOnFiles();
+ defer dependencies.deinit();
+ var rule = try dependencies.inPath(&.{.{ .glob = "src/domain/**" }});
+ defer rule.deinit(std.testing.allocator);
+
+ var file_only = archunit.CheckOptions.init(std.testing.allocator, std.testing.io);
+ file_only.working_directory = archignore_root;
+ file_only.clear_cache = true;
+ var control = try rule.check(file_only);
+ defer control.deinit(std.testing.allocator);
+ try std.testing.expectEqual(@as(usize, 1), control.items().len);
+ try std.testing.expectEqualStrings(
+ "testdata/excluded_by_options.zig",
+ control.items()[0].file_dependency.items()[0].source_label,
+ );
+
+ var composed = file_only;
+ composed.clear_cache = false;
+ composed.allow_empty_tests = true;
+ composed.extraction.exclusions = &.{"testdata/**"};
+ var result = try rule.check(composed);
+ defer result.deinit(std.testing.allocator);
+ try std.testing.expect(result.passes());
+}
diff --git a/test/fixtures/archignore/.archignore b/test/fixtures/archignore/.archignore
new file mode 100644
index 0000000..5cf6bd9
--- /dev/null
+++ b/test/fixtures/archignore/.archignore
@@ -0,0 +1,4 @@
+# Root-only ArchUnit glob policy.
+/src/autogen/
+third_party
+src\windows\**
diff --git a/test/fixtures/archignore/build.zig.zon b/test/fixtures/archignore/build.zig.zon
new file mode 100644
index 0000000..5ae0f36
--- /dev/null
+++ b/test/fixtures/archignore/build.zig.zon
@@ -0,0 +1,5 @@
+.{
+ .name = .archignore_fixture,
+ .version = "0.0.0",
+ .fingerprint = 0x47a47a47a47a47a4,
+}
diff --git a/test/fixtures/archignore/nested/.archignore b/test/fixtures/archignore/nested/.archignore
new file mode 100644
index 0000000..eae3104
--- /dev/null
+++ b/test/fixtures/archignore/nested/.archignore
@@ -0,0 +1 @@
+/nested/hidden/**
diff --git a/test/fixtures/archignore/nested/hidden/kept.zig b/test/fixtures/archignore/nested/hidden/kept.zig
new file mode 100644
index 0000000..326fd24
--- /dev/null
+++ b/test/fixtures/archignore/nested/hidden/kept.zig
@@ -0,0 +1 @@
+pub const nested_policy_does_not_apply = true;
diff --git a/test/fixtures/archignore/nested/src/autogen/kept.zig b/test/fixtures/archignore/nested/src/autogen/kept.zig
new file mode 100644
index 0000000..f181e08
--- /dev/null
+++ b/test/fixtures/archignore/nested/src/autogen/kept.zig
@@ -0,0 +1 @@
+pub const root_anchor_does_not_match_here = true;
diff --git a/test/fixtures/archignore/src/autogen/client.zig b/test/fixtures/archignore/src/autogen/client.zig
new file mode 100644
index 0000000..e183878
--- /dev/null
+++ b/test/fixtures/archignore/src/autogen/client.zig
@@ -0,0 +1,3 @@
+const forbidden = @import("../domain/model.zig");
+
+pub const Client = forbidden.Model;
diff --git a/test/fixtures/archignore/src/domain/model.zig b/test/fixtures/archignore/src/domain/model.zig
new file mode 100644
index 0000000..3fdaeba
--- /dev/null
+++ b/test/fixtures/archignore/src/domain/model.zig
@@ -0,0 +1 @@
+pub const Model = struct {};
diff --git a/test/fixtures/archignore/src/main.zig b/test/fixtures/archignore/src/main.zig
new file mode 100644
index 0000000..39e6ff7
--- /dev/null
+++ b/test/fixtures/archignore/src/main.zig
@@ -0,0 +1,5 @@
+const model = @import("domain/model.zig");
+
+pub fn main() void {
+ _ = model;
+}
diff --git a/test/fixtures/archignore/src/windows/generated.zig b/test/fixtures/archignore/src/windows/generated.zig
new file mode 100644
index 0000000..d3598ed
--- /dev/null
+++ b/test/fixtures/archignore/src/windows/generated.zig
@@ -0,0 +1 @@
+pub const generated = true;
diff --git a/test/fixtures/archignore/testdata/excluded_by_options.zig b/test/fixtures/archignore/testdata/excluded_by_options.zig
new file mode 100644
index 0000000..24c6c1e
--- /dev/null
+++ b/test/fixtures/archignore/testdata/excluded_by_options.zig
@@ -0,0 +1,3 @@
+const model = @import("../src/domain/model.zig");
+
+pub const ExplicitlyExcluded = model.Model;
diff --git a/test/fixtures/archignore/third_party/vendor.zig b/test/fixtures/archignore/third_party/vendor.zig
new file mode 100644
index 0000000..b6db83d
--- /dev/null
+++ b/test/fixtures/archignore/third_party/vendor.zig
@@ -0,0 +1 @@
+pub const vendored = true;