Skip to content

fix(cli): reject file arguments with --stdin - #166

Merged
luojiyin1987 merged 1 commit into
masterfrom
fix/reject-files-with-stdin
Aug 22, 2026
Merged

fix(cli): reject file arguments with --stdin#166
luojiyin1987 merged 1 commit into
masterfrom
fix/reject-files-with-stdin

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

Closes #165

改动

--stdin 与文件参数同时出现时报错退出,不再静默忽略 files:

[lint-md] --stdin cannot be used with file arguments.
  • 新增 CliErrorCodeCONFLICTING_INPUT
  • 冲突检查放在 action 最前:读取 stdin、file discovery、配置加载都未开始,冲突命令零副作用
  • -i 短形式同样覆盖(commander 归一化为 stdin)

测试(新增 2 个)

单元层直接证明"不读取 stdin、不执行 file lint":

  • fixture.md --stdin → 报错信息 + runStdinLint 未调用 + runFileLint 未调用 + exit 1
  • -i fixture.md → 同上

--stdin 单独与 files 单独的正常路径由既有 213 个用例覆盖,另手动复验。

验证

检查项 结果
npm run typecheck 通过
npm test -- --runInBand 25 suites / 213 tests 通过
手动 CLI:--stdin 单独 / 文件单独 / 两者混合 exit 0 / 0 / 1,符合预期

@luojiyin1987
luojiyin1987 merged commit fed8235 into master Aug 22, 2026
6 checks passed
@luojiyin1987
luojiyin1987 deleted the fix/reject-files-with-stdin branch August 22, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): reject file arguments with --stdin

1 participant