From 869d6a2cbd2c23f06d2d979a85007aa537aa1a69 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 26 Sep 2026 23:49:03 -0400 Subject: [PATCH 1/3] feat(review): run natu for Nix targets --- .pi/prompts/review.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.pi/prompts/review.md b/.pi/prompts/review.md index e115e3f..d732bbd 100644 --- a/.pi/prompts/review.md +++ b/.pi/prompts/review.md @@ -17,6 +17,15 @@ If the target includes multiple matching file types, use all matching skills. If the target is a diff, choose skills from the changed files. Do not use a style skill when no reviewed file matches it. +For every reviewed `*.nix` file, run: + +```bash +bazel run //src/natu:natu -- +``` + +Pass every reviewed Nix path to Natu. +Report every Natu diagnostic as an actionable finding. + Report only actionable findings. Order findings by severity. Do not report preferences unless a loaded rule states them. @@ -36,6 +45,7 @@ Keep the code excerpt to one to three lines when possible. Use a longer excerpt only when the violation needs surrounding context. Use `...` to omit unrelated lines from a multi-line excerpt. Use a style-skill rule citation in the form `skill::rule-file:line`. +Cite Natu diagnostics as `natu::`. Make the fix direct. Do not include alternatives when one fix best follows the cited rule. -- 2.47.3 From 11d11c7c02642a40ff0b779a1d0becc0e4eefb3c Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 26 Sep 2026 23:49:03 -0400 Subject: [PATCH 2/3] feat(style-nix): require shared file discovery --- src/skills/style/nix/rules/general.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/skills/style/nix/rules/general.md diff --git a/src/skills/style/nix/rules/general.md b/src/skills/style/nix/rules/general.md new file mode 100644 index 0000000..3b51109 --- /dev/null +++ b/src/skills/style/nix/rules/general.md @@ -0,0 +1,12 @@ +## Discover Nix files + +### Rule + +Use `util.collectNixFiles` to discover Nix files. +Do not use `builtins.readDir` with a `.nix` suffix filter for this purpose. +Pass `util` to Nix functions that need the helper. + +### Rationale + +`util.collectNixFiles` centralizes recursive discovery of Nix files. +Repository Nix code uses one implementation. -- 2.47.3 From 3b2d16743e3ce64b596c09ab9c6e4a88bb81f0a6 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 26 Sep 2026 23:49:03 -0400 Subject: [PATCH 3/3] refactor(dotfiles): share Nix file discovery --- src/dotfiles/default.nix | 2 +- src/dotfiles/guests.nix | 5 +---- src/dotfiles/registry.nix | 18 ++++++------------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/dotfiles/default.nix b/src/dotfiles/default.nix index 245364c..2a53e2a 100644 --- a/src/dotfiles/default.nix +++ b/src/dotfiles/default.nix @@ -17,7 +17,7 @@ let util = import ./util.nix { inherit lib; }; registry = import ./registry.nix { - inherit lib; + inherit lib util; hosts = self.nixosConfigurations; root = root + "/registry"; }; diff --git a/src/dotfiles/guests.nix b/src/dotfiles/guests.nix index ba4cad9..896ff97 100644 --- a/src/dotfiles/guests.nix +++ b/src/dotfiles/guests.nix @@ -276,10 +276,7 @@ let }; }; - names = map (file: lib.removeSuffix ".nix" file) (lib.attrNames guestFiles); - guestFiles = lib.filterAttrs (file: type: type == "regular" && lib.hasSuffix ".nix" file) ( - builtins.readDir root - ); + names = map (path: lib.removeSuffix ".nix" (builtins.baseNameOf path)) files; in { imports = files ++ map mkGuest names; diff --git a/src/dotfiles/registry.nix b/src/dotfiles/registry.nix index 8d6c2e0..6950765 100644 --- a/src/dotfiles/registry.nix +++ b/src/dotfiles/registry.nix @@ -2,20 +2,14 @@ hosts, lib, root, + util, }: let - definitions = - lib.mapAttrs' - ( - name: _type: - let - path = root + "/${name}"; - in - lib.nameValuePair (registryName name) (mkRegistry path) - ) - ( - lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) (builtins.readDir root) - ); + definitions = lib.listToAttrs ( + map (path: lib.nameValuePair (registryName (builtins.baseNameOf path)) (mkRegistry path)) ( + util.collectNixFiles root + ) + ); registryName = fileName: lib.removeSuffix ".nix" fileName; -- 2.47.3