Skip to content

feat: read offline CLI text from file or stdin - #33

Merged
PerishCode merged 2 commits into
PerishCode:mainfrom
LiberteCode:liberte/im-reply-file-stdin
Jul 6, 2026
Merged

PerishCode merged 2 commits into
PerishCode:mainfrom
LiberteCode:liberte/im-reply-file-stdin

Conversation

@LiberteCode

@LiberteCode LiberteCode commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add santi im reply --file <path> (with - meaning stdin) and --stdin as alternatives to the positional text argument
  • add the same --file / --stdin input modes to santi inbox seed, so offline "come look" records can avoid shell quoting friction too
  • keep the old positional <text> forms working while enforcing exactly one text source at the clap layer
  • share the text-source resolution path across IM replies and inbox seeds, backed by the common file/stdin reader
  • add CLI parsing and file-source tests for the new input modes, including the multi-line/backtick case

Why

I hit this friction myself while replying through the new IM channel: multi-line replies and text containing shell-sensitive characters such as backticks are awkward and easy to misquote when the only interface is a shell positional argument.

inbox seed has the same shape and is also an offline store-writer, so it benefits from the same affordance for self-upgrade seed records and other durable "come look" messages.

Validation

  • cargo fmt --all --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • env -u SANTI_WEBHOOK_GITHUB_ALLOW -u SANTI_WEBHOOK_GITHUB_LOGIN cargo test --locked --workspace
  • dogfooded the locally built verification binary with both target/debug/santi im reply --file ... and target/debug/santi im reply --stdin

Note: the local box has runtime webhook env vars set; without unsetting them, an existing GitHub webhook unit test is affected by the allowlist environment. No local binary was installed or published.

@PerishCode

Copy link
Copy Markdown
Owner

很漂亮的一版,而且比"照抄 compact --summary-file"更进一步——把 file/stdin 读取抽成共享 read_text_file helper、显式区分 --stdin 与 --file -、三选一在 clap 层就锁死,测试也覆盖了你自己踩的那个多行反引号场景。env -u SANTI_WEBHOOK_* 那个干净环境的判断尤其到位。

一个顺带的观察,想听你的判断:santi inbox seed <text> 也是个 positional text: String,和 im reply 改之前一模一样的多行/引号摩擦——它同样是 offline store-writer,自升级流程 seed "come look" 记录时也可能带多行内容。要不要把你这次抽出来的 read_text_file helper 顺手也用到 inbox seed(同样加 --file/--stdin)?可以这个 PR 里一起,也可以留个 follow-up,你来定。

不急,按你的节奏。

@LiberteCode LiberteCode changed the title feat: read IM replies from file or stdin feat: read offline CLI text from file or stdin Jul 6, 2026
@LiberteCode

Copy link
Copy Markdown
Contributor Author

我判断这个和 im reply 是同一类摩擦,而且 inbox seed 也是 offline store-writer,不会扩大运行时边界,所以我直接放进这个 PR 里一起做了。

已追加:

  • santi inbox seed <text> 保持兼容;
  • 新增 santi inbox seed --file <PATH> / --file - / --stdin;
  • 与 im reply 共享同一套 text-source 解析和 file/stdin reader;
  • 补了 inbox seed 的 clap 互斥/必选测试,以及 file-source 读取覆盖。

我已 push 新提交 abbd6fc,并把 PR 标题/说明更新成覆盖两个 offline CLI text 入口。验证重新跑过:

  • cargo fmt --all --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • env -u SANTI_WEBHOOK_GITHUB_ALLOW -u SANTI_WEBHOOK_GITHUB_LOGIN cargo test --locked --workspace

@PerishCode
PerishCode merged commit 0971f82 into PerishCode:main Jul 6, 2026
3 checks passed
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.

2 participants