Extension --help prints root help instead of running the extension
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
调研方向
从 src/cli.ts 开始,追踪 argv 预扫描如何设置 wantsHelp 并控制扩展分发;将其与 examples/extensions/basic/index.js 中捆绑的示例进行比较。使用 elastic demo --help 运行复现,并确认扩展收到其参数并打印自己的用法说明。
由索引模型根据 Issue 内容生成。
描述
Summary
When --help or -h appears anywhere in the arguments, the CLI does not dispatch to an installed extension; it prints the root elastic --help instead. Extensions cannot show their own help, and an extension cannot receive -h/--help as an argument at all.
This contradicts the bundled example, whose header says elastic demo --help # shows usage (examples/extensions/basic/index.js), and that extension does handle --help itself.
Reproduction
elastic extension create demo --path ./examples/extensions/basicelastic demo --help
Expected: the extension runs and prints Usage: elastic demo [--help].
Actual: root elastic --help output.
Seen with @elastic/cli 0.7.0 and a Rust extension (elastic console --help). Same code on main.
Notes
The argv pre-scan sets wantsHelp for any --help/-h, and extension dispatch is gated on it (src/cli.ts):
if (arg === '--help' || arg === '-h') wantsHelp = true
// ...
if (!wantsHelp && firstArg != null && !program.commands.some(c => c.name() === firstArg)) {
// findExtension / runExtension
}
A guess at a fix: when firstArg is an installed extension, dispatch regardless of wantsHelp, since everything after the extension name belongs to the extension (process.argv.slice(3) is already passed through).
Related
- #738 (extensions ignore
--use-context/--config-file), another case of argv handling around extension dispatch.
authored by Pi Coding Agent (Claude Opus 4)
- 主要语言
- TypeScript
- 星标
- 51
- 派生
- 27
- 平均合并
- 1 天 19 分钟
- 30 天内合并 PR
- 50
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
elastic/cli 的其他 Issue
-
feat: ship skills/elastic/SKILL.md for agent invocation可能已有人在做 @onatozmenn 于 26 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
tracking
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
Stale
难度 3/5 1-2 天 新手友好度 38/100
维护者通常 1 天内回复
-
refactor(config): drop unused safeParse wrappers and stale Zod comments in config/schema.ts可能已有人在做 @JoshMock 于 7 天前认领。 未关闭Stale
难度 3/5 半天 新手友好度 62/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
维护者通常 1 天内回复
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)可能已有人在做 @illya-havsiyevych 今天认领。 未关闭bug
难度 1/5 1-3 小时 新手友好度 87/100
epam/ai-dial-chat#9566 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
はさみアイコンを修正する未关闭bug
难度 1/5 1 小时以内 新手友好度 68/100
-
area: core
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复