Support structured control flow (loops) in Bash and PowerShell grammars
維護者通常 1 天內回覆
還沒有人認領這個 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 則留言 ·
維護者通常 1 天內回覆
查看 Aaronontheweb/ShellSyntaxTree 的全部 Issue
相似的 Issue
-
[Simple] NavigationBar primary commands do not render AppBarButton.Content when it is a UIElement未關閉control/navigationbar kind/bug triage/untriaged
難度 2/5 1-3 小時 新手友好度 90/100
unoplatform/uno.toolkit.ui#1652 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
microsoft/copilot-camp#1053 ·
維護者通常 1 天內回覆
-
bug effort:S P3
難度 2/5 1-3 小時 新手友好度 84/100
nightscout/nocturne#1861 ·
維護者通常 1 天內回覆
-
agentic-workflows area/Docs partner/agentic-workflows
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/fluentui-blazor#5364 ·
維護者通常 1 天內回覆