Support structured control flow (loops) in Bash and PowerShell grammars
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
调研方向
从 SPEC.md 的第 4 节以及 Bash 和 PowerShell 现有的扁平命令/子句语法开始。跟踪 IsUnparseable 的设置方式以及 AST 如何公开子句,然后验证列出的结构化构造会生成 approval-gate 消费者可以遍历的子 body 子句,且不会触发 IsUnparseable。
由索引模型根据 Issue 内容生成。
描述
Problem
SPEC.md section 4 states v0.1 does not support control-flow keywords. for, while, do, done, then, fi, case, and esac set IsUnparseable = true.
The grammar is flat:
command := clause (compound_op clause)*
This is load-bearing for real consumers. NetClaw's shell approval gate walks parsed clauses to decide authorization. Commands that hit IsUnparseable fail closed to an approval prompt.
Why it matters
LLM agents emit loops and heredocs constantly. A production corpus of 45 approval-prompted shell commands showed 8 (18%) were for loops, heredocs, or process substitution. All tripped IsUnparseable.
Loops are static constructs. for f in *.txt; do rm "$f"; done does not hide a path behind $(). The approval risk is the body clause (rm). The existing clause model already evaluates that.
Request
Support structured control flow in both grammars:
- Bash:
for/while/until/if/casewithdo/done/then/else/fi/esac - PowerShell:
foreach/for/while/do/if/switch
Design intent: parse the loop header and expose body clauses as child clauses in the AST. The loop keyword adds no authorization scope. Consumers (approval gates) can walk body clauses with the same logic they use for && chains.
Priority
Corpus-based order for Bash: for loops first, then heredocs, then while / if. Also consider arithmetic expansion $(( ... )), which the same spec line excludes.
- 主要语言
- C#
- 星标
- 15
- 派生
- 0
- 平均合并
- 8 分钟
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Aaronontheweb/ShellSyntaxTree 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
Aaronontheweb/ShellSyntaxTree#69 · 1 条评论 ·
维护者通常 2 天内回复
查看 Aaronontheweb/ShellSyntaxTree 的全部 Issue
相似的 Issue
-
area-ai untriaged
难度 2/5 1-3 小时 新手友好度 85/100
dotnet/extensions#7790 ·
维护者通常 1 天内回复
-
P2 testing
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/runtime#134766 · 3 条评论 ·
维护者通常 1 天内回复
-
0 - Backlog Bug
难度 2/5 1-3 小时 新手友好度 88/100
BrighterCommand/Brighter#4444 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复