modelstudioai / modelstudioai/cli
[bug]: bl skill init / skill remove ignore --dry-run and perform real changes
還沒有人認領這個 Issue。
- 主要語言
- TypeScript
- 星號
- 333
- 分支
- 28
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 33
描述
Environment
- CLI: bl 1.26.0 (npm install; upgraded from 1.3.2 via
bl updatetoday) - Skill: 1.26.0 (
bailian-cli, installed bybl skill init) - Node: v22.22.2
- OS: darwin 25.6.0 (macOS)
- Region: cn
Summary
--dry-run is listed under "Global Flags" in bl skill init --help, bl skill remove --help (and add / update), but the whole skill command group ignores it: bl skill init --dry-run performed a full real installation (10 skills fanned out into 56 agent directories), and bl skill remove --name <x> --dry-run really deleted the skill. Exit code 0 in both cases.
Reproduce
# 1. "Preview" what init would do -> actually installs everything
bl skill init --dry-run
# 2. "Preview" a removal -> actually removes it
bl skill remove --name bailian-web-search --dry-run
Expected
With --dry-run, nothing is written or deleted; the command prints the plan (skills, target agent directories, link paths). Alternatively, if dry-run is not supported for these commands, the flag is rejected with a USAGE error and not advertised in their --help.
Actual
bl skill init --dry-run printed:
{
"status": "success",
"skills": [
"bailian-cli", "bailian-finetune", "bailian-gen", "bailian-managed-agent",
"bailian-protocol", "bailian-sandbox", "bailian-web-search",
"bailian-docs-llm-wiki", "bailian-model-recommend", "bailian-train-deploy"
]
}
and on disk, all within the same second:
~/.bailian/skills/<10 skills>/were created (~33 MB, mostlybailian-docs-llm-wiki) and~/.bailian/skills/skill-lock.jsonwas written.- Symlinks were fanned out into 56 detected agent skill directories (
~/.claude/skills,~/.agents/skills,~/.codex/skills,~/.gemini/skills, ...). - The pre-existing real directory
~/.agents/skills/bailian-cli(installed from GitHub vianpx skills add modelstudioai/cliand refreshed bybl updatea few minutes earlier) was replaced by a symlink to~/.bailian/skills/bailian-cli. I did not find a backup of the replaced directory. ~/.bailian/telemetry.jsonlrecorded a plain{"command":"skill init", ..., "params":{}}entry with no dry-run marker.
bl skill remove --name bailian-web-search --dry-run printed:
{
"skills": [
{ "name": "bailian-web-search", "status": "removed", "removedLinks": 56 }
]
}
and the canonical directory plus all 56 links were really gone; a subsequent real bl skill remove --name bailian-web-search reported "reason": "not installed".
Likely cause
At HEAD, packages/commands/src/commands/skill/{init,add,remove,update,list}.ts never read ctx.settings.dryRun (there is no occurrence of dryRun anywhere under skill/). init.ts calls installSkillWithFanout(...) unconditionally and remove.ts calls unlinkSkillFromAgents(...) / removeSkillDir(...) unconditionally, while the global --dry-run flag is still rendered in every bl skill ... --help.
Why it matters
--dry-runis the documented way for agents to preview a mutating command before asking the user for consent (bailian-protocol). Here it silently performs the mutation, so an agent that follows the protocol ends up installing 10 skills into every detected agent app on the machine, which also changes default routing in those agents (e.g.bailian-gen/bailian-web-searchclaim generation / search requests by default).bl update(npm path) and the automatic update check both runbl skill initafterwards (see also #200), so there is currently no non-mutating way to see what a skill install/update is going to write.
Suggested fix
Either honor dryRun in the skill group (print planned installs/removals with target agent directories and link paths, write nothing), or make these commands reject --dry-run with a USAGE error and drop it from their --help so it cannot be mistaken for a safe preview.
Already tried
-
bl updatedone today; skill version (1.26.0) aligned with CLI (1.26.0) -
bl auth statusOK (not relevant:skillcommands are[No Auth]) - Different network / region: not applicable, purely local operation
Notes
- Frequency: Always (reproduced with both
skill initandskill remove) - Invoked via: Agent (Claude Code)
- Registry:
https://bailian-wiki.oss-cn-hangzhou.aliyuncs.com/skills
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 packages/commands/src/commands/skill/{init,add,remove,update,list}.ts 開始,檢查 ctx.settings.dryRun 如何傳遞到 skill 命令。追蹤 init.ts 經過 installSkillWithFanout 的路徑,以及 remove.ts 經過 unlinkSkillFromAgents 和 removeSkillDir 的路徑,然後執行文件中記錄的 init 和 remove 重現步驟。完成標準是 dry-run 輸出計畫但不執行寫入、刪除或建立連結,或者被拒絕且不出現在說明資訊中。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- typescript
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 72/100