arch(#12): split _send.py by responsibility (run / inject / stdin / probe)#375
Merged
arch(#12): split _send.py by responsibility (run / inject / stdin / probe)#375
Conversation
…robe) Pure move. `_send.py` drops from 600 LOC to 53 LOC and now just holds the `send` command plus re-exports. The run pipeline (run command, wrapper build, echo-row scoping, timeout clamp, interrupt ladder) lives in `_run.py`; the inject/key surface (encoder, key map, parser, both commands) lives in `_inject.py`; `--stdin` path-traversal validation in `_stdin.py`; shell- integration probe, prompt-is-back check, interrupt ladder, and output trim in `_probe.py`; shared `--force-*` decorator in `_force.py`. All existing imports (`from ita._send import run, send, inject, key, _parse_key, _trim_output_lines, _encode_inject_payload, _load_stdin_script, _has_shell_integration`) keep working via re-export. No behavior change; fast-lane 587/12/195/56 (baseline 580/14/195/56, no regressions). Unblocks #13 inject→envelope conversion as a single-file edit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits `src/ita/_send.py` (600 LOC) into responsibility-separated modules. Public API preserved via re-exports.
Module boundaries:
Back-compat verified: `from ita._send import run, send, inject, key, _parse_key, _trim_output_lines, _encode_inject_payload, _load_stdin_script, _has_shell_integration` all still work.
Fast-lane: 580 pass / 14 fail → 587 pass / 12 fail (+7 pass, -2 fail; no regressions).
Flagged (minor): `_run.py` landed at 277 LOC, slightly above the ~250 target. The `run` Click body is inherently large (stdin prep, inner async closure with wrapper + scoping + ladder, plain/json output branches). Agent extracted `_build_wrapped_command` to trim ~25 LOC; further splitting would fracture the single pipeline unhelpfully.
Unblocks: task #13 (inject → @ita_command envelope) can now proceed in `_inject.py` in isolation.
Closes #12 (task, not issue).
Test plan
injecttext mode silently mangles chars above U+00FF #229)run --stdinaccepts file path with no path traversal validation #325)🤖 Generated with Claude Code