resholve icon indicating copy to clipboard operation
resholve copied to clipboard

ecosystem tool: command-variant/lineage/version detector

Open abathur opened this issue 3 years ago • 0 comments

I haven't really considered specifics, but it would be nice to have a tool that can help figure out what variant/version of a command/utility a given script is using just based on its invocations.

Thoughts:

  • This somewhat overlaps with the command parsers resholve is already accruing (and which it might be feasible to eventually separate out into argfarce.
  • Hand-writing parsers scales about as poorly as you'd expect also somewhat overlaps with the ~help/manpage-parsing work that drives explainshell.
    • Though, to be fair, the set of identically-named divergent CLIs relevant for Shell scripting is probably not growing all that quickly...
  • This would probably accept invocations on stdin or in a file and indicate any utilities with this name that it can't rule out. Maybe there's an overall judgement, and then a judgement per invocation?
    • It should reflect awareness that sometimes scripts design around this--their source may contain invocations that are idiomatic to multiple different variants and then detect the system or feature-test the utility to decide which ones it should use.
    • Ideally, this tool would also attempt to account for history as well as the present. It's less-critical than variant detection, but it could still be a big help to know that a script uses a flag that is only supported in some specific versions.
  • Even if the utility can't be accurate enough to drive decisions automatically from within resholve, I think it can at least serve as an automated or manual ~sidecar tool used when resolving new projects to make sure you're plugging in compatible utilities (or noticing if the script is completely incompatible with the variants you have available).
  • The ~first target is things like BSD | GNU versions, but ideally this would be sensitive to drop-in replacements, reimplementations, forks, etc.
  • In the longer run, there might be some synergy with binlore to make collecting high-quality data going forward easier.
    • Currently, resholve's Nix API invokes binlore. In the longer run, I kind of imagine nixpkgs, for example, automatically collecting binlore for everything that outputs executables.
    • I vaguely hope that some of the information resholve needs can be ~formalized in a generic format that projects themselves could carry (whether the format is resholve-specific or not). Version, target shell(s), dependencies, supported arguments, etc.

abathur avatar Jan 30 '22 05:01 abathur