Skip to content

feat(launcher): accept -EncodedCommand/--ec spellings for the verbatim handoff - #477

Merged
caomengxuan666 merged 1 commit into
masterfrom
feat/474-encoded-command-aliases
Oct 20, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
feat/474-encoded-command-aliases

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

  • --encoded-command verbatim handoff now accepts two more spellings: -EncodedCommand (PowerShell spelling, matched case-insensitively like every PowerShell parameter name, so tooling that already emits pwsh -EncodedCommand <b64> command lines plugs in unchanged) and the short --ec alias.
  • A single is_encoded_command_word() predicate backs all three parser sites — the leading-option group, the launcher-dispatch walk, and the argument-taking arm — so every spelling feeds the same decode + -c re-entry with byte-identical results, identical v1: prefix guard, and identical missing-argument diagnostics.
  • Only the whole word matches: single-dash -ec keeps its GNU -e -c cluster meaning, and double-dash GNU spellings stay case-sensitive (--Encoded-Command is left for the engine to reject).
  • niu --help groups the three spellings under a "Verbatim handoff" heading.

Fixes #474

Test plan

  • cargo test --locked --bin niu — 44 passed, including new spelling_table_is_exactly_the_alias_family, encoded_command_aliases_are_launcher_words, encoded_command_aliases_keep_cluster_and_operand_boundaries
  • cargo test --locked --test issue474_encoded_command_aliases — 6 passed (byte-identical output across all spellings, v1: guard under every spelling, identical missing-arg diagnostic, -e errexit contract under aliases, -ec stays the GNU cluster, help grouping)
  • cargo test --locked --test issue390_encoded_command_flags — 7 passed, zero regression
  • cargo fmt --check -p niubash

Generated with Devin

…m handoff

The `--encoded-command` route is the machine-to-machine channel that CI,
agents, and schedulers already generate command lines for — most notably
the PowerShell ecosystem, where `pwsh -EncodedCommand <b64>` is the
established spelling. Matching `-EncodedCommand` case-insensitively (like
every PowerShell parameter name) lets existing tooling reach niu
unchanged; the short `--ec` alias cuts the friction for hand-typed and
token-counted agent invocations.

All three spellings feed the same decode + `-c` re-entry: a single
is_encoded_command_word() predicate backs the leading-option group, the
launcher-dispatch walk, and the argument-taking arm, so payloads,
v1:-prefix guard, and missing-argument diagnostics stay byte-identical.
Only the whole word matches — single-dash `-ec` keeps its GNU `-e -c`
cluster meaning, and double-dash GNU spellings stay case-sensitive.

Fixes #474

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 merged commit 8bd4336 into master Oct 20, 2026
10 of 11 checks passed
@caomengxuan666
caomengxuan666 deleted the feat/474-encoded-command-aliases branch October 21, 2026 08:15
caomengxuan666 added a commit that referenced this pull request Oct 22, 2026
* docs(skill): refresh agent skill bundle for the 1.4.3 surface

The corpus transcript predated the GNU invocation face and the verbatim
handoff, and the prose still described the retired oh-my-niu stack
(niubash#145) and the managed-block rc era (niubash#359).

- corpus: recapture `niu --help` (GNU long/short option face, verbatim
  handoff spellings --encoded-command/-EncodedCommand/--ec + v1:,
  --cwd-state, --install-wt-shortcuts, plugin migrate-rc, skill
  install|status, portal lines, primary-only rc wording)
- SKILL.md: 83/83 suite ledger (2026-10-12 re-run), argv[0] hardlink
  faces, generated-loader startup (before rc, NIU_PLUGIN_LOADER=off,
  migrate-rc), NIU_SHELL+SHELL exports, behavior notes for the gather
  wedge / bare-drive / negative-cache / unset-inherited / marker-zone /
  dolbrace / ordered-fd / CJK-readline fixes, verbatim handoff for hosts
  that cannot quote
- references: prompt-plugins.md rewritten for the spec+lockfile+loader
  model; paths.md gains bare drive designators; wpm.md notes same-session
  visibility of fresh installs; quickref.md gains the host-level verbs
- generate-skill.py: capability snapshot names `config`, the verbatim
  handoff, and `migrate-rc`
- check-rename-clean.baseline regenerated: drops the retired winuxshrc-
  migration help line, absorbs docs/src residue already on master, and
  records the intentional WINUXSH_SHELL mention in SKILL.md

Refs niubash#474 #477 #481 #482 #483 #484 #490 #943 #948 #952 niubash#359
Refs rubash#940 #947 #951 #952 #953 #955 #957 #976 #977 #979

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs(skill): correct SHELL export claim — filled only when unset

NIU_SHELL is exported unconditionally, but SHELL is backfilled with the
niu.exe path only when the host left it unset (shell.rs shell_was_missing
gate); a parent-supplied SHELL passes through. Aligns the NIU_SHELL
paragraph with the actual behavior per review on #498.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enhancement][launcher] --encoded-command 别名增强:-EncodedCommand(PowerShell 生态兼容)+ --ec 短别名 + 命名先例调研

1 participant