Repository navigation
fix(plugins): add/rc audit P2 batch — honest hints, local-dir add, rc guards - #240
Merged
Merged
Conversation
… guards (closes #176) Per-item disposition of the P2 audit set: - add -h/--help is a usage request with its own verb usage (was 'unknown plugin source option'); usage texts now document --url. - A cwd directory named like a catalog id (oh-my-bash/) is adopted as a local tree: the add path no longer re-resolves an existing local path through the catalog to the official GitHub origin. - Local path targets are stored cwd-independent in the spec (lexically normalized absolute, forward slashes) instead of the raw relative spelling that strands after a directory change. - The already-declared refusal names a removal path that works for the state it names: a stranded declaration (declared, never installed) points at 'niu plugin sync --prune'; an installed source keeps the 'niu plugin source remove' hint (declared_entry_state in sync). - User lines hand-written inside a managed rc block are migrated out (below the block, under a marker comment) with a stderr warning on every rewrite; managed theme/array/loader lines are classified and dropped with the spec as before. - A CRLF rc keeps CRLF through block rewrites (whole-file EOL detection; byte-identical rewrites no longer churn the file). - Hand-edited near-marker blocks (missing bracket) are repaired into the exact managed form instead of gaining a second unmanaged same-id block; a near begin with no end is an error, like the exact case. - Every plugin verb that rewrites the rc backs it up to ~/.niubash/backups first, and the backup set is pruned to the newest 10 (the wizard era never cleaned up). Tests: assets.rs unit tests (CRLF, migration, near-marker, backup retention), tests/issue176_rc_audit.rs (add -h usage, --url doc, no hijack, absolute targets, state-matched duplicate hints).
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 #176. 逐项处置(wt82-L08 P2 审计集合):
Fixed(本次修复,各配回归测试)
add -h报错形态错 →niu plugin add -h/--help现在是 usage 请求,新增 verb 级print_plugin_add_usage(含选项与后续步骤),不再报 "unknown plugin source option '-h'"。测试:plugin_add_h_is_a_usage_request。niu plugin sync --prune(wt83 [P1] 失败的 plugin add 留下无法移除的 spec 残条:每次启动永远打印 deferred 行,唯一出路是手编文件 #174 的既有出路);已安装场景保留niu plugin source remove提示。实现:sync::declared_entry_state(复用 record_for_entry 判安装态)。测试:already_declared_hint_matches_the_state。备注:残条本身(回滚/可清除)已由 wt83 [P1] 失败的 plugin add 留下无法移除的 spec 残条:每次启动永远打印 deferred 行,唯一出路是手编文件 #174([P2] add/rc 审计 P2 集合:错误信息误导、本地目录劫持、CRLF 全文件改写、插件动词不备份 rc、块内用户行静默丢弃 #176 的 P1 单)修复,本条修的是提示文案。local_dir_named_like_a_catalog_id_is_not_hijacked。relative_path_targets_are_stored_absolute。niu plugin --help与 add usage 均补--url <git-url>。测试:plugin_usage_mentions_url_option。user_lines_inside_a_managed_block_migrate_out(并验证 spec 删除的受管行不外迁、迁移后字节稳定)。禁用(remove)路径同样迁移用户行。crlf_rc_keeps_its_line_endings_through_block_writes。near_marker_block_is_repaired_not_duplicated。备注:缩进形态本就被 trim 匹配覆盖(现状核对:无问题)。write_managed_block/remove_managed_block写 rc 前一律备份到~/.niubash/backups/.niubashrc.<stamp>.bak(与向导同目录同命名),写后裁剪保留最近 10 份(向导的旧备份同样被治理)。测试:plugin_verbs_backup_the_rc_and_prune_old_backups。Already-fixed / 现状核对结论
sync --prune),本 PR 只修提示指向(上条第 2 项)。测试
cargo test -p niubash-runtime --lib plugins::assets(16 通过,含 4 个新单测)cargo test --test issue176_rc_audit(5 通过,新集成套件)plugin_spec_sync / plugin_assets / plugin_sources / defaults_floor / theme_preview_channel全绿。plugins::distros3 个 "offline" 用例与smoke_1_3_0 d2_wizard在干净 master 上同样失败(网络 reset / 交互 PTY 超时),与本 PR 无关。cargo fmt已过。未合并,等待 review。