r/devtools • • 16d ago

KIZZ: Automatic dependency tracking for command-line workflows

I recently got sick of my projects rebuilding things because the tooling cant track dependencies, we are expected to manually declare them with perfection. I call this working in negative space, the space is empty and your expected to fill it up accurately or things break.

GitHub Repository: https://github.com/Sakura-Industries-LLC/kizz
Docs: https://sakura-industries-llc.github.io/kizz/

KIZZ is a tool which tracks the dependencies of a command, can be used as a build tool and has build tasks written as literate programming inside `kizz.md` files using starlark code blocks.

It automatically tracks dependencies, you don't declare file dependencies, and can't. What you can declare is exclusions (ignore this dependency you found). This is what I call working in positive space, because everything is visible, and I can carve out things I want the tool to ignore.

Its new, I have had this idea since working with `fabricate` years ago, which I liked but it had too many issues to be relied upon long term. Kizz takes a leaf out of several other tools like Riker, Rattle and BuildXL. Basically it works similar to strace, it uses Linux ptrace and seccomp-BPF to discover dependencies automatically across the entire process tree.

The architecture and design is mine, but full disclosure I used AI to generate substantial portions of it because it would have taken time I don't have and never found to build by hand.

Possibly its best most immediate use case is to use it to discover what a command is actually using for its dependencies, so even if your not using it as a build tool, you can use it to diagnose why your dependencies are incomplete.

The following shows running `cat LICENSE` inside a container, `kizz` tracks and categorizes everything neatly.

root@sjbox:/repo# kizz execute --output=kizz.out -- cat LICENSE

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
   ...

root@sjbox:/repo# cat kizz.out
kizz observation report, version 1, hierarchical
trace: complete
totals: commands 1, cached 0, processes 1, programs 1, paths 16, connections 0
paths by access: read 3, probe 12, list 0, write 0, exec 2, xattr 0

command 1: cat LICENSE
  program: /usr/bin/cat
  directory: /repo
  outcome: exited with 0
  trace: complete
  process 1, pid 7, exited with 0
    program /usr/bin/cat: cat LICENSE
      read:
        /etc/ld.so.cache: ok
        /lib/x86_64-linux-gnu/libc.so.6: ok
        /repo/LICENSE: ok
      probe:
        /etc/ld.so.preload: ENOENT
        /opt/android-ndk/cat: ENOENT
        /opt/android-sdk/cmdline-tools/latest/bin/cat: ENOENT
        /opt/android-sdk/emulator/cat: ENOENT
        /opt/android-sdk/platform-tools/cat: ENOENT
        /opt/toolchain/bin/cat: ENOENT
        /root/.cargo/bin/cat: ENOENT
        /root/go/cat: ENOENT
        /usr/bin/cat: ok
        /usr/local/bin/cat: ENOENT
        /usr/local/sbin/cat: ENOENT
        /usr/sbin/cat: ENOENT
      exec:
        /lib64/ld-linux-x86-64.so.2: ok
        /usr/bin/cat: ok
1 Upvotes

5 comments sorted by

2

u/kantorcodes1 15d ago

Your README's observation report splits paths into read, probe, list, write and exec, and most of the probes are ENOENT misses along the PATH search. When kizz turns a traced run into a dependency graph, do those probe misses count as dependencies that can invalidate a cached result, or are probes kept in the report only and out of the rebuild decision?

1

u/strontiumk9 15d ago

yes, probes and directory scans are dependencies. So if a file that was ENOENT appears or new directory entities appear in a scanned directory then its seen as a dependency change that invalidates cache results

1

u/kantorcodes1 15d ago

That ENOENT detail matters. A probe miss today becomes a dependency tomorrow, so a file appearing on a PATH search path invalidates the cache even though nothing in the project changed.

I work on HOL Guard. Guard keeps command-source descriptors for tools that run commands, under contributions/command-sources/ in the hol-guard repo. KIZZ would fit as command.kizz.json, next to analogues like command.cicd.github.json for CI runners. KIZZ executes the commands in a kizz.md task, and your observation report already splits what those commands did into read, probe, list, write and exec. The first fixture could pair a task run whose commands write outside the project tree with one that only reads and writes inside it.

Would you be up for opening that PR? The command extension guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extensions/contributing.md

1

u/strontiumk9 14d ago

kizz doesn't discriminate on inside/outside the project tree because its an artificial boundary.
The compiler for example is a dependency, if it changes, that breaks cache. If a linker config file changes, that breaks the cache. If a system header changes that a build references that breaks cache, config files, they can be anywhere. So kizz doesn't make assumptions like that, its simply records what commands do.

So, I am not sure how that fits with HOL, because its very deep behaviour, its not superficially inside anything. In fact kizz doesn't even have repo boundaries by design. If you run kizz in a directory with 10 github repos, it will run and organize dependencies and build ordering across all 10 repos.

I adopted the view if you want isolation, run kizz inside a container.

I couldnt see a clean way to do what your asking because kizz by design runs arbitrary commands itself.

1

u/kantorcodes1 14d ago

You are right that kizz draws no such line, and the descriptor would not ask it to. command.kizz.json records kizz itself as the command source: programs in a kizz.md file and kizz execute run arbitrary commands, with no fixed safe subset. Your observation report is the evidence for that record, since every traced command already lands as read, probe, list, write or exec.

Your container point is the isolation note the descriptor would carry. Kizz makes no repo assumptions, so containing it stays the operator's call, exactly as you put it. A first fixture needs no kizz changes: take one kizz execute run, bind its observation report to the descriptor, and check that the report categories match what the descriptor declares.

Would you open that PR? It is the source file, one fixture, and a trust binding. Guide: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extensions/contributing.md