Repository navigation
feat(ux): drop command-not-found package search hints; add opt-in wpm-only hint - #251
Merged
Merged
Conversation
…-only hint
niubash#249: every typo triggered an unsolicited package-manager search
suggestion — naming winget (third-party) over niu's own wpm. Owner ruled
it over-defensive and harmful UX.
- Remove the unconditional 'niubash: package search hints' block
(winget/scoop/choco) entirely; third-party managers are never
recommended again. Recipe/wpm install hints for exact, known tool
names (rg, awk, ...) stay - targeted advice, not typo-triggered ads.
- New opt-in channel: 'niu config set command-not-found-hint wpm'
persists the policy in the new ~/.niubash/config.toml (mirrors.toml
convention; NIU_CONFIG relocates it, NIU_COMMAND_NOT_FOUND_HINT
overrides, everything degrades to off on any read problem).
- When enabled, the suggestion is wpm-only ('wpm search --name ...',
Windows builds) and fires only for high-confidence near-misses:
dropping the word's last character (edit distance <= 1 by truncation)
hits an installed command or a known package command name, so pure
typos like 'win' stay quiet even with the switch on.
- New 'niu config get/list/set' subcommand manages the setting.
- Tests: default-policy repro ('win' -> zero hint lines), third-party
managers never named, wpm-only near-miss shapes, silence for
arbitrary typos under the opt-in, Shell-field emission gating via
the channel capture seam, config parse/round-trip/degradation.
caomengxuan666
added a commit
that referenced
this pull request
Oct 10, 2026
…notes draft (#254) - Version 1.3.4 -> 1.4.0 (workspace root + crates/niubash-runtime; Cargo.lock synced; internal niubash-runtime dep requirement aligned 1.2.5 -> 1.4.0). The rubash engine requirement stays 1.3.4: it is semver-open (^1.3.4 admits the engine's 1.4.0), and the committed [patch] resolves it to the local ../rubash worktree, whose Cargo.toml still says 1.3.4 until the engine cuts its own release. - CHANGELOG: the Unreleased section becomes [1.4.0] - 2026-10-10. Also repairs the committed merge damage from #243 (stray conflict marker and the #241 doctor-advice entry glued onto the carapace entry) and folds in the merged cycle: #235 #239 #246 #247 #250 #251 #252 #253 plus a compact rubash 1.4.0 engine summary. #240's P2-batch content stays under [1.3.4] where the file already records it (no dup). - docs/release-notes-1.4.0-draft.md: zh+en draft release notes (Added / Fixed / Performance), winuxcmd #1151/#1154-#1157 marked as in-flight for the coordinator, plus the local verification log: release build PASS (niu.exe 10.6 MB), MSIX packed unsigned with a placeholder identity (5.1 MB), wpm-source main carries all four preinstall packages, and cargo publish --dry-run chain findings (rubash -> niubash-runtime -> niubash, blocked on the engine's crates.io release). No tag, no release workflow trigger, no in-flight PRs merged.
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.
Closes #249
What
command-not-found 不再默认插播包管理器搜索建议(owner 实测反感,判定过度防御):
niubash: package search hints块——第三方管理器永不再推荐;win这类纯手滑只输出 GNU 形态的一行niu: win: command not found。rg/awk等精确命中已知工具名时的定向建议——非拼写错误触发的广告)。niu config set command-not-found-hint wpm持久化到新增的~/.niubash/config.toml(mirrors.toml 约定;NIU_CONFIG可重定位,NIU_COMMAND_NOT_FOUND_HINT环境变量覆盖文件,任何读取问题一律降级为 off,不阻塞 command-not-found 路径)。wpm search --name '<word>',仅 Windows 构建),且触发收紧为高置信邻近命中:去掉尾部字符(截断式编辑距离 ≤1)后命中已安装命令或已知包命令名——纯手滑(如win)即使开着开关也保持安静。niu config get/list/set子命令面。验收对照
win只输出一行(交互-C与脚本-c两条路径均验证)✓jqq(jq 邻近命中)→niubash: package search hints:+wpm search --name 'jqq';win→ 无第二段 ✓set off恢复默认;env 覆盖双向验证;非法值/未知键报错 ✓测试
cargo fmt --check -p niubash✓cargo test -p niubash-runtime --lib --locked:423 passedcargo test --workspace --locked --no-fail-fast:除 host_contract 的closed_stdout_pipe_does_not_print_broken_pipe_error外全绿。该用例在 base(origin/master e8b7b5c)上同样确定性失败(已用 HEAD 基线构建复跑确认),为本机既有失败,与本 PR 无关。sh scripts/check-rename-clean.sh在 base 上即失败(docs/audit、scripts/audit、harvest 快照中的既有 Winuxsh 残留),非本 PR 引入。