feat(understatus): render --source lterm + --oneline (Phase 1)#5
Merged
Conversation
Codex CLI가 custom statusline을 지원하지 않아, lterm(세션 데몬)의 하단 status row를 command-backed로 확장해 understatus를 statusline으로 띄우는 Phase 1 설계 문서. ralplan 합의(Planner·Architect·Critic, deliberate)로 코드와 대조 검증 후 APPROVE. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lterm이 합성한 JSON을 stdin으로 받아 statusline 한 줄을 출력하는 어댑터. - parse_lterm_input: parse_claude_input 대칭의 lenient 파서. lterm JSON (session/pane/session_key/agent/cwd/cols/rows/version)을 내부 모델에 매핑. version은 읽되 무시(forward-compat), git 세그먼트 비활성, cwd는 표시용. session_key 부재 시 "<session>/<pane>"로 합성. - render --source <claude|lterm> / --oneline 플래그 파서 추가. 순서 무관, 미지 값은 ExitCode::FAILURE. run_render_pipeline(source, oneline)로 배선. - --oneline: chain 미수행, 코어 render 1행을 후행 개행 없이 출력. - 테스트: parse_lterm_input 11, parse_render_args 8, 통합 oneline 5. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RawLtermInput의 version/cols/rows/source가 strict Option<u32>/Option<String>이라
lterm이 "version":"1"·"cols":"120"처럼 타입이 어긋난 값을 보내면 serde_json::from_str이
전체 실패해, parse_lterm_input이 ClaudeInput::default()로 저하되며 정상
session/pane/agent/cwd까지 소실됐다.
forward-compat·미소비 필드(version/cols/rows/source)를 Option<serde_json::Value>로
관대하게 받아, 이들의 타입 불일치가 다른 필드 매핑을 깨지 않게 한다("version은 읽되
무시" 설계 의도 충족). cols/rows는 Phase 1 미소비이므로 Value로 충분하며, 추후 소비
시점에 숫자 변환을 별도 처리한다.
테스트: 타입 드리프트한 ignored 필드가 있어도 useful 필드가 보존됨을 검증
(lterm_ignored_field_type_drift_preserves_useful_fields). 기존 lenient 동작
(빈/깨진 JSON→default)과 lterm_version_is_ignored(정상 u32)는 그대로 유지.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chain 실행이 그동안 --oneline로만 차단되고 --source lterm로는 차단되지 않아,
render --source lterm을 --oneline 없이 부르면 chain이 실행돼 lterm JSON이 Claude용
chain으로 전달될 수 있었다. spec §6.3("--source lterm은 chain 기본 off")대로
source == Source::Lterm이면 oneline 여부와 무관하게 chain을 미수행한다(oneline이
아니면 정상 줄바꿈 출력은 유지, chain만 생략).
테스트 강화(tests/oneline.rs): 기존 oneline_does_not_run_chain은 기본
config(chain_command=None)를 써서 chain-skip을 실제로 증명하지 못했다. 이제 실제
chain_command가 설정된 임시 config([chain] chain_command = "printf CHAINSENTINEL")를
UNDERSTATUS_CONFIG로 주입해 세 분기를 대조 검증한다:
- --oneline(claude): 센티널 없음(chain 미수행),
- 대조군 --oneline 없이(claude): 센티널 있음(chain이 실제로 돎),
- --source lterm(--oneline 없이): 센티널 없음(chain 기본 off).
각 분기는 서로 다른 session_key를 써서 chain 캐시 교차 오염을 피한다.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
quad-review가 지적한 CLI 표기 불일치 정리. - --help 문구를 render 옵션이 `render` 서브커맨드와 함께 쓰임이 명확하도록 정정(기존 `[render] [옵션]`은 render가 선택처럼 읽혔음). 무인자 `understatus` (기본 render)와 `understatus render [옵션]`을 별도 줄로 명시. - `--source` 중복 시 마지막 값이 이기는 last-wins 계약을 단위 테스트로 고정. `understatus --source lterm`(render 생략)이 FAILURE인 것은 spec 확정 결정 (render 서브커맨드 + 플래그)대로의 의도된 동작이며 유지한다. parse_render_args의 index-0 render 처리는 디스패처가 전체 args를 그대로 넘기므로 실제 사용되는 코드여서 보존(quad-review의 dead-code 지적은 오탐). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
개요
lterm(세션 데몬) 안에서 Codex 등 에이전트를 돌릴 때, lterm이 합성한 JSON을 stdin으로 받아 understatus가 statusline 한 줄을 출력하도록 하는 Phase 1 (understatus 측) 변경입니다. Codex CLI가 custom statusline을 지원하지 않는 문제를 lterm 레이어에서 우회하기 위한 첫 단계.
변경
parse_lterm_input(src/claude.rs):parse_claude_input대칭의 lenient 파서. lterm JSON(session/pane/session_key/agent/cwd/cols/rows/version)을 내부 모델에 매핑.version은 읽되 무시(forward-compat), git 세그먼트 비활성,cwd는 표시용.session_key부재 시"<session>/<pane>"합성.render --source <claude|lterm>/--oneline(src/main.rs): 플래그 파서 추가(순서 무관, 미지 값 →ExitCode::FAILURE).run_render_pipeline(source, oneline)로 배선.--oneline은 chain 미수행 + 코어 1행을 후행 개행 없이 출력.parse_lterm_input11,parse_render_args8, 통합tests/oneline.rs5.검증 (rustup cargo)
cargo test: 203 passed (198 lib/bin + 5 integration), 0 failedcargo clippy --all-targets -- -D warnings: 클린cargo fmt --check: 클린echo '{"source":"lterm",...}' | understatus render --source lterm --oneline→ 정확히 1행·무개행·git 없음. 빈{}무패닉. 미지 source/플래그 → exit 1. 무인자/render무회귀.범위
LTERM_STATUS_COMMAND, SGR-only 안전 게이트, 명령 스레드, draw 통합)은 별도 레포에서 Phase 1 후속.