comprehensive completion generation: native, manpage, --help

Three-strategy pipeline with priority: native completion generators
(e.g. CMD completions nushell) > manpage parsing > --help fallback.
Single `generate` command produces one module-wrapped .nu file per
command. Parallel execution scaled to cores, 200ms timeouts, ELF
string scanning to skip binaries without -h support, native gzip
decompression via camlzip, SYNOPSIS-based subcommand detection,
nix3 manpage strategy, deduplication, nushell builtin exclusion.
This commit is contained in:
atagen 2026-03-21 02:07:46 +11:00
parent 01ccf64efc
commit 7f0ec8ab4d
9 changed files with 937 additions and 265 deletions

View file

@ -19,6 +19,7 @@
ocaml
angstrom
angstrom-unix
camlzip
ppx_inline_test
ocaml-lsp
ocamlformat
@ -41,6 +42,7 @@
ocaml
angstrom
angstrom-unix
camlzip
];
meta.mainProgram = "inshellah";
@ -49,6 +51,40 @@
}
);
checks = forAllSystems (
pkgs: sys:
let
# Evaluate a minimal NixOS config that enables the module.
# If the module has infinite recursion, this evaluation will fail.
mockSystem = nixpkgs.lib.nixosSystem {
system = sys;
modules = [
self.nixosModules.default
{
# Minimal config to make NixOS evaluation happy
boot.loader.grub.device = "nodev";
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
programs.inshellah.enable = true;
environment.systemPackages = [ pkgs.hello ];
}
];
};
in
{
module-no-infinite-recursion = pkgs.runCommandLocal "inshellah-module-test" {
# Force evaluation of extraSetup and systemPackages at eval time.
# If the module has infinite recursion, this derivation can't even
# be instantiated.
extraSetupLen = builtins.stringLength mockSystem.config.environment.extraSetup;
syspkgCount = builtins.length mockSystem.config.environment.systemPackages;
} ''
echo "environment.extraSetup length: $extraSetupLen"
echo "environment.systemPackages count: $syspkgCount"
touch $out
'';
}
);
nixosModules.default =
{ pkgs, ... }:
{