[codex] Add terminal image preview toggle#297
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (6)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{sh,bash,py,js,ts,jsx,tsx,go,java,rb,php}📄 CodeRabbit inference engine (Custom checks)
Files:
**/*.{py,js,ts,jsx,tsx,go,java,rb,php,sh,bash,c,cpp}📄 CodeRabbit inference engine (Custom checks)
Files:
**/*.{js,ts,jsx,tsx,py,java,go,rb,php,sh,bash,yml,yaml,json,env*,toml,cfg,config,dockerfile,dockerignore}📄 CodeRabbit inference engine (Custom checks)
Files:
**/*⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughДобавлена поддержка переключателя для управления автоматическим рендером inline-изображений в терминальной панели. Кнопка отображается в заголовке терминала, управляет булевым состоянием и сбрасывается при смене сессии. Логика условной записи сегментов интегрирована в очередь вывода терминала через новую функцию ChangesInline Image Preview Toggle Feature
🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/app/src/web/terminal-inline-images-core.ts`:
- Around line 56-69: Add comprehensive TSDoc and functional comment markers to
the writeTerminalOutputSegment function: document parameters and return, add
`@pure` (true/false), `@effect` listing required services/refs (e.g.,
inlineImagePreviewsEnabledRef), `@invariant/`@precondition (e.g., segment
non-null, writer implements writeText/writePreviewLineBreak/writePreviews),
`@postcondition` (onComplete invoked when done or when no previews), `@complexity`
(time/space), and `@throws` (enumerate possible error types from writer methods as
typed Effects). Also include CHANGE, WHY, QUOTE(ТЗ), PURITY (CORE|SHELL), and
COMPLEXITY functional comment markers above the function and reference
implicated symbols (writeTerminalOutputSegment, TerminalOutputSegmentWriteArgs,
writer.writeText, writer.writePreviewLineBreak, writer.writePreviews) so
reviewers can verify behavior and formal guarantees.
In `@packages/app/src/web/terminal-panel-runtime.ts`:
- Around line 227-236: Remove inlineImagePreviewsEnabledRef from the effect
dependency array: inlineImagePreviewsEnabledRef is a stable useRef identity and
its .current changes don’t require listing it as a dependency, so edit the
useEffect (the hook that currently lists connectionRef, hostRef,
inlineImagePreviewsEnabledRef, notifyMessage, onAttachFailure, runtimeRef,
session, setStatus) to omit inlineImagePreviewsEnabledRef while keeping the
other dependencies intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 17326686-6861-4855-98f5-fbcba78b29ad
📒 Files selected for processing (7)
packages/app/src/web/panel-terminal.tsxpackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/tests/docker-git/terminal-inline-images-core.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Implement Functional Core, Imperative Shell (FCIS) pattern: CORE layer contains only pure functions with immutable data and mathematical operations; SHELL layer isolates all effects (IO, network, database). Strict dependency direction: SHELL → CORE (never reverse).
Never useany,unknown,eslint-disable,ts-ignore, orastype assertions (except in rigorously justified cases with documentation). Always use exhaustive union type analysis through.exhaustive()pattern matching.
All external dependencies must be wrapped through typed interfaces and injected via Effect-TS Layer pattern. Never call external services directly from CORE functions.
Use monadic composition with Effect-TS for all effects:Effect<Success, Error, Requirements>. Compose effects throughpipe()andEffect.flatMap(). Implement dependency injection via Layer pattern. Handle errors without try/catch blocks.
All functions must be pure in the CORE layer: no side effects (logging, console output, IO operations, mutations). Separate all side effects into the SHELL layer.
Use exhaustive pattern matching with Effect.Match instead of switch statements. Example:Match.value(item).pipe(Match.when(...), Match.exhaustive).
Document all functions with comprehensive TSDoc including:@pure(true/false),@effect(required services),@invariant(mathematical invariants),@precondition,@postcondition,@complexity(time and space),@throwsNever (errors must be typed in Effect).
Use functional comment markers for code clarity: CHANGE (brief description), WHY (mathematical/architectural justification), QUOTE(ТЗ) (requirement citation), REF (RTM or message ID), SOURCE (external source with quote), FORMAT THEOREM (∀x ∈ Domain: P(x) → Q(f(x))), PURITY (CORE|SHELL), EFFECT (Effect type signature), INVARIANT (mathematical invariant), COMPLEXITY (time/space).
Define all external service dependencies as Context.Tag classes with fully typed methods returning Effect types. Example: `class Da...
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: Implement property-based testing using fast-check for mathematical properties and invariants. Example:fc.property(fc.array(messageArbitrary), (messages) => isChronologicallySorted(sortMessagesByTimestamp(messages))).
Mock external dependencies in unit tests using Effect's testing utilities. Run tests without Effect runtime for speed. Example:Effect.provide(MockService), Effect.runPromise.
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/tests/docker-git/panel-terminal-skiller.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Forbidden constructs in CORE code:any,eslint-disable,ts-ignore,async/await, raw Promise chains (then/catch),Promise.all,try/catchfor logic control,console.*, switch statements (use Match with .exhaustive() instead)
All functions must use Effect-TS for composing effects:Effect<Success, Error, Requirements>. No direct async/await, Promise chains, or try/catch in product logic.
Functional comments must include: CHANGE, WHY, QUOTE(ТЗ) or n/a, REF, SOURCE or n/a, FORMAT THEOREM, PURITY (CORE|SHELL), EFFECT signature for SHELL functions, INVARIANT, and COMPLEXITY.
All data mutations must use immutable patterns (ReadonlyArray, readonly properties, Object.freeze); mutation in SHELL only when absolutely necessary and documented.
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Property-based tests (fast-check) must verify mathematical invariants; unit tests must use Effect test utilities without async/await.
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/tests/docker-git/panel-terminal-skiller.test.ts
**/*.{sh,bash,py,js,ts,jsx,tsx,go,java,rb,php}
📄 CodeRabbit inference engine (Custom checks)
Fail if changed files introduce command injection or unsafe shell/process execution with user-controlled input
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
**/*.{py,js,ts,jsx,tsx,go,java,rb,php,sh,bash,c,cpp}
📄 CodeRabbit inference engine (Custom checks)
Fail if changed files introduce path traversal or writes outside intended project/container state directories
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
**/*.{js,ts,jsx,tsx,py,java,go,rb,php,sh,bash,yml,yaml,json,env*,toml,cfg,config,dockerfile,dockerignore}
📄 CodeRabbit inference engine (Custom checks)
Fail if changed files expose credentials, tokens, private-keys, or PII in source, generated config, logs, or CI output
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
**/*
⚙️ CodeRabbit configuration file
**/*: Ты строгий ревьюер SPEC DRIVEN DEVELOPMENT.Перед выводами изучи README.md, другие *.md файлы, linked issues,
PR description, PR comments/discussion и релевантную кодовую базу.Сверь изменения с исходным ТЗ/спекой и обсуждением. Флагай любой уход
от спеки, недокументированное изменение поведения, отсутствие тестов
для заявленного поведения и security-риск. Если спека не видна,
попроси автора добавить ее в issue или PR description.Проверь решение с точки зрения формальной верификации: какие инварианты,
предусловия и постусловия можно доказать математически, а где доказуемость
слабая. Оцени решение с точки зрения теории игр: устойчивы ли стимулы,
нет ли выгодного обхода правил, и какое решение было бы сильнее.
Files:
packages/app/tests/docker-git/terminal-inline-images-core.test.tspackages/app/src/web/terminal-inline-images-core.tspackages/app/src/web/terminal-panel-runtime-types.tspackages/app/tests/docker-git/panel-terminal-skiller.test.tspackages/app/src/web/terminal-panel-runtime-core.tspackages/app/src/web/terminal-panel-runtime.tspackages/app/src/web/panel-terminal.tsx
🔇 Additional comments (19)
packages/app/src/web/terminal-panel-runtime-types.ts (1)
4-7: LGTM!Also applies to: 44-44, 70-70
packages/app/src/web/terminal-panel-runtime-core.ts (2)
7-11: LGTM!
360-377: LGTM!packages/app/src/web/terminal-panel-runtime.ts (4)
74-86: LGTM!
88-120: LGTM!
122-159: LGTM!
170-202: LGTM!packages/app/src/web/panel-terminal.tsx (7)
262-286: LGTM!
313-404: LGTM!
406-455: LGTM!
605-613: LGTM!
625-628: LGTM!
635-642: LGTM!
688-720: LGTM!packages/app/tests/docker-git/panel-terminal-skiller.test.ts (3)
39-56: LGTM!
71-81: LGTM!
83-88: LGTM!packages/app/tests/docker-git/terminal-inline-images-core.test.ts (2)
4-7: LGTM!
72-107: LGTM!
Summary
Validation
bun install --frozen-lockfilebun run --cwd packages/app test -- tests/docker-git/terminal-inline-images-core.test.ts tests/docker-git/panel-terminal-skiller.test.tsbun run --cwd packages/app typecheckbun run --cwd packages/app build:webgit diff --checkCloses #248.