omp packages

@villavic/no-heredoc1.0.2

Blocks shell heredocs (<<) in bash tool calls using a tree-sitter-bash AST check.

GitHub Actions Published 13 days ago MIT ~501 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

no-heredoc

Blocks shell heredocs (<<) in bash tool calls before execution.

The intent

Heredocs (cat <<EOF, python3 - <<PY, git commit -m "$(cat <<EOF ...)") are a common way to bypass Pi's write/edit tools and to inject inline scripts. They also defeat the per-section prompt cache and tool-declaration freeze that npm:@villavic/pi-prompt-rewriter relies on. This extension rejects any bash command whose AST contains a heredoc_redirect node, steering the model toward write and edit instead.

Detection uses web-tree-sitter + tree-sitter-bash (WASM, no native build) and parses the full command, so heredocs are caught anywhere: pipelines, subshells, command substitution, and compound statements.

What it blocks / allows

  • Blocked: heredoc_redirect nodes — <<EOF, <<'EOF', <<"EOF", <<-EOF, <<PY, etc.
  • Allowed: here-strings (<<< "single line"), << inside quoted strings (echo "a << b"), and bit-shift operators in arithmetic (echo $((1 << 4))).

Install

pi install npm:@villavic/no-heredoc

Test

pi -e ./extensions/no-heredoc/index.ts
node tests/test-no-heredoc.mjs