Repository navigation
feat: --encoded-command takes a base64 payload for agent/CI callers - #271
Merged
caomengxuan666 merged 1 commit intoOct 12, 2026
Merged
Conversation
New launcher word executes an RFC 4648 base64 command string through the same one-shot path as -c. Agents get a quoting-free channel: no heredoc gymnastics, no base64.exe subprocess, and no second interpretation layer between the caller and the parser. Padding is optional and ASCII whitespace is ignored so pre-wrapped payloads pass through untouched; the payload must decode to valid UTF-8. An optional prefix is stripped defensively — MSYS path conversion rewrites arguments starting with '/', and a base64 payload can start with '/' (sextet 63); 'v' pins the first character. Same -c contract applies: BASH_ENV/NIU_ENV are sourced, the payload is exposed as BASH_EXECUTION_STRING, and parser diagnostics carry the __RUBASH_IS_C tag (niubash#160). Adapted from x2410516039/xgr-niubash commits 890f3b1 + deb7211 (2026-09-16). The v1: prefix came from a live failure: routing the payload through a Git Bash wrapper rewrote a leading '/' and corrupted the command. Verified here: decode unit tests (padding, whitespace, v1: prefix, invalid character, non-UTF-8 rejection), cargo check/fmt clean.
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
…1.4.0 section (#326) - The [Unreleased] entries (#284/#287, #293-#304, #313) move into [1.4.0]; [Unreleased] is empty again. - Newly recorded (today's wave): Git Bash compatible factory default prompt (#292, headline), WT-form shortcuts (#290/#211), the paste burst trailing-Enter fix (#308/#291), self-update SHA256 + release pinning (#311/#312), managed-block convergence (#324), completion tables/NIU_COMPDEFS/NIU_ENV probe (#305-#307), -s on-demand stdin (rubash#586 host half), bash/rbash invocation faces (#321/#322). - Older gaps recorded: closed-stdout pipe contract (#245/#286), history session-end write-back (#265), sh POSIX contract (#262), PWD persona alignment (#283), one-shot fast path (#270), --cwd-state (#272), --encoded-command (#271), REPL-command highlighting (#281), docs passes (#255/#225/#226/#227), MSRV (#267), easter-egg prune (#264). CHANGELOG-only change; no version claims.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
来源
适配自 x2410516039/xgr-niubash 提交
890f3b1+deb7211(2026-09-16),保留原作者署名。Stacked on #270(走其 one-shot 路径;若 #270 先合并,本 PR base 会自动改回 master)。问题
agent 宿主向
niu -c传复杂命令要过两层引号地狱(宿主包装层 → shell 解析层),heredoc/嵌套引号易碎,base64 | niu又多一个进程与一层管道。作者的做法:新增 launcher 词niu --encoded-command <b64>,RFC 4648 base64 载荷直达执行器——零引号、零中间解释层、零额外子进程。v1:前缀是他的现场教训:base64 载荷可能以/开头(sextet 63,概率 1/64),MSYS 路径启发式会把它改写成 Windows 路径,命令在经 Git Bash 中转时被静默破坏;v1:把首字符钉在 'v' 上,接收端剥离。契约(与 -c 对齐)
BASH_EXECUTION_STRING;带__RUBASH_IS_C诊断标签(parser 错误取$0: -c: line N:形态,niubash#160)验证
v1:前缀、非法字符、非 UTF-8 拒绝(本分析移植时对测试向量逐一用独立实现复验过,含//8=→ 0xFF 0xFF 的非 UTF-8 案例)--encoded-command ZWNobyBoZWxsbw==→hello;v1:变体同cargo check --locked/cargo fmt --check --all干净