ela
Contents

ManualAgents

Commands a line runs

In the terminalela --spec commands-a-line-runs

ela --agent commands shows every command a line would run, without running it. A check of your own, such as "a scan before every push", reads this list instead of the line's text, so it also finds a push hidden in a script file, a proc or an imported file.

$ ela --agent commands 'ela publish.ela'publish.ela:6:5: git -C $repo? push origin main  (in proc publish, with dir "site")publish.ela:11:1: $tool? status

How it reads the line:

  • Every ela script in it is parsed: a script file, -c code or a here-document, and every file it imports.
  • It looks inside procs, with blocks, captures, jobs and defer⁠s, and inside any ela -c or bash -c they run.
  • Each word is filled in where the script fixes it before running: a literal, a constant, or a variable set once. A word it can't know is marked with ?, like $tool? above.

With --json, the output is:

FieldHolds
oktrue when every script was read and every import found
elatrue when the whole line is ela, which is what the hook lets through
problemsanything it couldn't read
commandsone entry per command: file, line, col, words, unresolved (the indexes of the words marked ?), proc, with, text

A command written in bash in the line itself has the file bash. - reads the line from stdin, or a hook's tool call. In a script, ela.commands(line) gives the same list as data (ela --spec the-ela-package).