Skip to content

Commit dccb0ad

Browse files
committed
refactor: implement execution abstraction, unified exception handling, and SSH config abstraction
- Add BlockExecutor protocol with LocalExecutor and RemoteExecutor implementations - Create ExecutorFactory for dependency injection and testability - Implement ShellflowExceptionHandler for consistent error handling across all execution paths - Abstract SSH configuration with SSHConfigProvider protocol and multiple provider implementations - Refactor run_script function to use new abstractions (previously reduced from 254 to 111 lines) - Maintain 100% test coverage with all 143 unit tests and 17 BDD scenarios passing Closes architectural debt items C02, C03, and C04.
1 parent bc6785d commit dccb0ad

3 files changed

Lines changed: 495 additions & 244 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,20 @@ Shellflow intentionally does not provide:
224224

225225
Those decisions belong in the outer agent or automation layer.
226226

227+
### Agent-Native Logging Optimizations
228+
229+
Shellflow includes several logging optimizations specifically designed for LLM agent consumption:
230+
231+
- **ANSI Escape Sequence Stripping**: Automatically removes color codes, cursor movements, and other terminal control sequences that would consume unnecessary tokens in LLM context windows.
232+
233+
- **Command-Level Granularity**: Uses `set -x` with custom `PS4` prompts to provide per-command execution traces, allowing agents to pinpoint exactly which command failed in a multi-command block.
234+
235+
- **Stream Debouncing**: Implements intelligent buffering for progress bars and streaming output, preventing token waste from rapid `\r` updates while ensuring important output isn't lost.
236+
237+
- **Semantic Pipeline**: Transforms raw terminal output into structured, agent-friendly data with clean text and preserved timing information.
238+
239+
These optimizations ensure that when agents process Shellflow's JSONL output, they receive clean, actionable data without the visual formatting artifacts that make terminal output human-friendly but LLM-confusing.
240+
227241
## CLI
228242

229243
```text

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "shellflow"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "A minimal shell script orchestrator with SSH support"
55
readme = "README.md"
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)