Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## Unreleased

- **A closed stderr or stdout pipe no longer aborts the run (#40).** `context-builder … 2>&1 | head -3` used to panic with exit code 101 and could leave the output file missing. Progress and warning lines now ignore write errors, and `-o - | head` ends with exit code 0.

## v0.11.0 (2026-10-10) — "Quiet Defaults"

v0.11.0 trims what a default run puts in the document and removes the surprises around it. **Breaking changes** (details below):
Expand Down
12 changes: 10 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ impl CacheManager {
for pattern in &old_cache_patterns {
let old_cache_path = self.cache_dir.join(pattern);
if old_cache_path.exists() {
eprintln!("Migrating old cache format: removing {}", pattern);
let _ = writeln!(
std::io::stderr(),
"Migrating old cache format: removing {}",
pattern
);
let _ = fs::remove_file(&old_cache_path);
}
}
Expand All @@ -128,7 +132,11 @@ impl CacheManager {
let file_name = entry.file_name();
let name = file_name.to_string_lossy();
if name.ends_with(".md") && (name.contains("_20") || name.starts_with("output_")) {
eprintln!("Migrating old cache format: removing {}", name);
let _ = writeln!(
std::io::stderr(),
"Migrating old cache format: removing {}",
name
);
let _ = fs::remove_file(entry.path());
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use serde::Deserialize;
use std::fs;
use std::io::Write as _;
use std::path::Path;

use crate::content_filter::{self, DEFAULT_MAX_FILE_SIZE_BYTES};
Expand Down Expand Up @@ -222,7 +223,8 @@ pub fn load_config() -> Option<Config> {
match toml::from_str(&content) {
Ok(config) => Some(config),
Err(e) => {
eprintln!(
let _ = writeln!(
std::io::stderr(),
"⚠️ Failed to parse context-builder.toml: {}. Config will be ignored.",
e
);
Expand All @@ -243,7 +245,8 @@ pub fn load_config_from_path(project_root: &Path) -> Option<Config> {
match toml::from_str(&content) {
Ok(config) => Some(config),
Err(e) => {
eprintln!(
let _ = writeln!(
std::io::stderr(),
"⚠️ Failed to parse {}: {}. Config will be ignored.",
config_path.display(),
e
Expand Down
2 changes: 1 addition & 1 deletion src/content_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub fn report_skips(skipped: &[SkippedFile], silent: bool) {
return;
}
for line in report_lines(skipped) {
eprintln!("{line}");
let _ = writeln!(std::io::stderr(), "{line}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/file_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ fn can_prompt(stdin_tty: bool, stderr_tty: bool) -> bool {
/// Prompts must not go to stdout: `-o -` and any caller capturing stdout would
/// otherwise treat the question as document content.
fn prompt_yes(prompt: &str) -> io::Result<bool> {
eprint!("{prompt}");
let _ = write!(std::io::stderr(), "{prompt}");
io::stderr().flush()?;
let mut input = String::new();
io::stdin().read_line(&mut input)?;
Expand Down
Loading
Loading