建议:新增 bl completion <shell> 命令,提供 zsh/bash/fish 自动补全
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- bash, fish, typescript, zsh
- Bereich
- cli
Rechercherichtung
Start by running bl --introspect and reading how the existing skill/reference generators consume its commands[].path / flags / choices / valueHint and globalFlags inside packages/cli; that gives the shape the conversion layer must emit. Then add a top-level completion <shell> command and a zsh generator following the flag-to-_arguments spec table and the two escaping pitfalls listed in the issue, validating against the four acceptance examples (bl text ch<TAB>, --sys<TAB>, --api <TAB>, --outpu<TAB>). Done means the generated script is emitted to stdout, passes pnpm check, and the --output global flag carries choices in the introspect schema. Note the author already prototyped this locally and offered to open the PR, so coordinate before starting.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
背景
bl 目前没有 shell 补全命令(bl completion 报 Unknown command),322 个多级子命令(如 memory node show、agents security alerts)加上每个命令十几个 flag,纯靠手敲和 --help 记忆成本比较高。
现状
bl --introspect已经输出结构化的命令元数据(commands[].path / flags / choices / description,globalFlags),天然适合作为补全的数据源,但目前只有 skill/reference 生成在消费它。- issues 里没有找到补全相关的既有讨论。
提议
新增顶层命令:
bl completion <zsh|bash|fish> # 输出补全脚本到 stdout(可重定向)
bl completion zsh --install # (可选)自动写入 rc 文件
数据流复用 --introspect:
introspect JSON → 转换层 → 各 shell 的补全脚本/函数
zsh 侧的转换规则(已在本地验证可行):
| introspect 字段 | zsh spec |
|---|---|
flags.choices: [chat, responses] |
'--api[desc]:value:(chat responses)' |
type: switch |
'--stream[desc]' |
valueHint 含 path/file |
':file:_files' |
| 其他 string | '--message[desc]:value:' |
多级命令用「收集已输入的非 flag 词 → 前缀匹配 → 前缀组补下一级 / 叶子命令补 flags」的 dispatch 即可,不需要为每个命令写死函数。
实现时值得注意的两个坑(本地原型踩过)
- zsh
_arguments里消费已输入子命令的占位 positional 必须写成'N:cmd:'(带尾冒号、空 action);写成'N:cmd'会被当成可补全位置参数,与 flag 候选形成"二义",导致单次 TAB 只列出不插入。 - flag 描述文本需要双层转义:shell 引号层 +
_arguments描述层的]和:(zh-CN 描述里的全角冒号没事,但半角冒号会截断 spec)。
顺带发现的数据缺口
--introspect 的 globalFlags 里 --output 没有带 choices: ["text", "json"],补全只能硬编码。建议在 schema 里补上这个字段,任何消费方都能受益。
验收示例(以 zsh 为例)
bl text ch<TAB> → bl text chat
bl text chat --sys<TAB> → --system(列出时带描述)
bl text chat --api <TAB> → chat / responses
bl --outpu<TAB> → --output
备注
我已按上述思路在本地基于 bl --introspect 生成 zsh 补全并逐项验证通过(bl 2.6.1,322 命令 / 81 命令组)。如果这个方向可行,我愿意提交 PR 把转换层按仓库结构(packages/cli + 单一逻辑改动 + pnpm check)实现。
- Vorherrschende Sprache
- TypeScript
- Sterne
- 364
- Forks
- 32
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 33
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelstudioai/cli
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
modelstudioai/cli#286 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 62/100
modelstudioai/cli#279 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 48/100
modelstudioai/cli#264 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
modelstudioai/cli#202 · 3 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
modelstudioai/cli#195 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelstudioai/cli
Ähnliche Issues
-
area:plugins area:security area:skills bug has repro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
anthropics/claude-code#105911 ·
Maintainer antworten meist innerhalb von 1 Tag
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Fission-AI/OpenSpec#2165 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🐞 bug 🧐 unconfirmed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Tencent/tdesign-vue-next#7032 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
gnosis/gnosis_vpn#661 ·
Maintainer antworten meist innerhalb von 1 Tag
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Offentriage:bug-verified
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
Maintainer antworten meist innerhalb von 1 Tag