--- title: "ADR 0044: tkn pac cel input modes and header file formats" --- * Status: accepted * Code: [`pkg/cmd/tknpac/cel/cel.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/cmd/tknpac/cel/cel.go) (`Command`, `parseGosmeeScript`, `parseCurlHeaders`) ## Context The command evaluates CEL against a saved webhook delivery. Deliveries are saved in different ways, and the command is used both by hand and from scripts and tests. ## Decision * The headers file format is chosen by content, in this order: a first non-space character of `{` or `[` is parsed as JSON; text that `isGosmeeScript` accepts is parsed as curl commands, taking each `-H "Name: Value"` and letting later commands override earlier ones; anything else is parsed as plain HTTP headers. * Commands in a gosmee script that fail to parse are skipped rather than failing the whole file. * The `files` CEL variable is always `all`, `added`, `deleted`, `modified` and `renamed`, each an empty list, because there is no changed-files source in the CLI. * If stdin is a terminal, the command opens a readline prompt with completion and a history file at `~/.cache/tkn-pac/cel-history`; `/help` and `/exit` are handled, and EOF or interrupt ends the loop. * If stdin is not a terminal, each line is evaluated as an expression and printed. Empty input returns without error; the tests rely on this to run the command with no stdin. * Completion and key extraction from the body are limited to three levels of nesting. ## Consequences * A malformed gosmee curl command is dropped silently. * Expressions on `files` always see empty lists, so file-based `on-cel-expression` rules cannot be tested here. * Evaluation errors in either mode are printed and do not stop the session.