Summary
nblm sources add only accepts inline --text arguments. Let users provide longer notes via --text-file path (and optionally --text-stdin) so they can reuse existing documents without copy/paste hassle.
Motivation
- Research notes and transcripts often live in files; pasting them into the command line is error-prone.
- Other CLI tools (e.g.
gh, kubectl) support --*-file patterns, making automation easier.
- Implementing this unlocks richer CLI workflows and makes the project more attractive to power users.
Tasks
- Extend
crates/nblm-cli/src/ops/sources.rs to accept --text-file <PATH> (multiple allowed). Read each file, trim it, and push the content as UserContent::Text with an optional --text-name pairing.
- Optionally add
--text-stdin that reads from standard input when present; ensure it can’t be combined with other stdin-consuming flags.
- Update
docs/cli/sources.md with usage examples and note constraints (e.g. empty files should error).
- Add or update tests in
crates/nblm-cli/tests/sources_add.rs to cover the new flags (use temp files in the test helper).
Verification
- Run
cargo test --package nblm-cli to ensure CLI tests pass.
- Manual smoke test:
cargo run -- sources add --notebook-id demo --text-file sample.txt using a known notebook ID and mock server/base URL.
Recommended for Contributors
- You’ll need to touch both the CLI implementation and documentation, so be comfortable reading Rust and Markdown.
- When reading files, surface friendly errors (e.g. file not found, unreadable). Follow existing error style (use
anyhow::Context).
Summary
nblm sources addonly accepts inline--textarguments. Let users provide longer notes via--text-file path(and optionally--text-stdin) so they can reuse existing documents without copy/paste hassle.Motivation
gh,kubectl) support--*-filepatterns, making automation easier.Tasks
crates/nblm-cli/src/ops/sources.rsto accept--text-file <PATH>(multiple allowed). Read each file, trim it, and push the content asUserContent::Textwith an optional--text-namepairing.--text-stdinthat reads from standard input when present; ensure it can’t be combined with other stdin-consuming flags.docs/cli/sources.mdwith usage examples and note constraints (e.g. empty files should error).crates/nblm-cli/tests/sources_add.rsto cover the new flags (use temp files in the test helper).Verification
cargo test --package nblm-clito ensure CLI tests pass.cargo run -- sources add --notebook-id demo --text-file sample.txtusing a known notebook ID and mock server/base URL.Recommended for Contributors
anyhow::Context).