Codex/atomic 9 terminal log structured#20
Open
himax12 wants to merge 4 commits intoclawgreen:mainfrom
Open
Conversation
…en#7) - New `TerminalMarker` component with typed props and JSDoc - Props: label, timestamp?, variant ('info'|'success'|'warning'|'error'|'neutral') - Theme-aware via CSS custom properties (--term-* variables) - Semantic background tint with color-mix for visual hierarchy (consistent with TerminalBadge) - Responsive: min-w-0 + truncate on timestamp prevents overflow on narrow viewports - Export added to components/terminal.tsx (no breaking changes) - Playground demo added to app/playground/page.tsx
) - New TerminalLogLine component with typed props and JSDoc - Props: message (ReactNode), level, timestamp?, source? - Level badge using 3-char uppercase labels (DBG/INF/WRN/ERR/OK) for consistent monospace alignment - Theme-aware via CSS custom properties; error level colors message text red - Responsive: min-w-0 + wrap-break-word on message prevents overflow - Export added to components/terminal.tsx with re-exported type - Playground demo added with 8 representative log lines
- Add color-mix background tints to level badges (consistent with TerminalBadge) - Fix badge alignment: use w-[calc(3ch+0.5rem)] + justify-center so all 5 levels (DBG/INF/WRN/ERR/OK) render at identical pixel width in monospace layout - Update levelClasses to Tailwind v4 CSS variable shorthand (text-/border-(--term-*)) - Remove 'OK ' trailing-space hack (HTML collapses whitespace); fixed-width badge container is the correct approach
…compat
- New LogEntry type { id?, message, level?, timestamp?, source? }
- New optional entries prop on TerminalLog — takes precedence over lines
- Existing lines?: string[] consumers continue to work with zero changes
- Internally reuses TerminalLogLine for structured rendering (level badges,
timestamps, source labels, color-mix tints)
- maxLines and autoScroll work identically on both paths
- Export LogEntry from components/terminal.tsx
- Add StructuredLogDemo to playground (streaming entries with all 5 levels)
- Use Tailwind v4 CSS variable shorthand in terminal-log.tsx
There was a problem hiding this comment.
Pull request overview
This PR adds structured logging primitives to the terminal UI component set and updates the playground to demonstrate both string-based and structured log rendering (including per-row level/timestamp/source and phase markers).
Changes:
- Introduces
TerminalLogLine(structured log row) andTerminalMarker(phase separator) components. - Extends
TerminalLogto support a new structuredentriesprop while keepinglinesfor backward compatibility. - Enhances the playground with new demos for structured logs, markers, and log-line primitives.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| components/terminal.tsx | Re-exports new terminal primitives/types and does minor formatting cleanup. |
| components/terminal-marker.tsx | Adds a new phase/section marker row component for terminal feeds. |
| components/terminal-log.tsx | Adds structured entries rendering mode using TerminalLogLine while retaining string mode. |
| components/terminal-log-line.tsx | Adds the structured log row primitive with level badge, timestamp, source, and message. |
| app/playground/page.tsx | Updates playground to showcase string vs structured logs, markers, and log-line examples. |
| app/playground/log-demo.tsx | Adds StructuredLogDemo simulating a streaming structured log feed. |
Comments suppressed due to low confidence (4)
components/terminal-log.tsx:112
- The Tailwind CSS variable shorthand here (
border-(--glass-border),bg-(--term-bg)/40) is inconsistent with the rest of the repo (which usesborder-[var(--...)]/bg-[var(--...)]/..) and may not compile as intended. Consider switching these back to the bracket-based arbitrary value form for border/background to match existing components (e.g.components/terminal-badge.tsx).
className={`max-h-64 overflow-auto rounded border border-(--glass-border) bg-(--term-bg)/40 p-3 font-mono text-xs ${className}`.trim()}
components/terminal-log.tsx:130
- This uses the CSS variable shorthand
text-(--term-fg-dim), but the rest of the codebase consistently usestext-[var(--term-fg-dim)]. To avoid styling inconsistencies (and potential Tailwind parsing issues), align this with the establishedtext-[var(...)]pattern used elsewhere.
className="whitespace-pre-wrap break-all text-(--term-fg-dim) leading-5 py-0.5"
components/terminal-log-line.tsx:35
- These level class strings mix Tailwind CSS variable syntaxes (
border-(--glass-border),text-(--term-blue)) with the bracket-basedborder-[var(...)]style used throughout the repo. Please standardize these to the repo’s existing pattern (seecomponents/terminal-badge.tsx) so colors render consistently and future maintenance is simpler.
badge: 'border-(--glass-border) text-(--term-fg-dim) bg-[rgba(255,255,255,0.03)]',
message: 'text-(--term-fg-dim)',
},
info: {
badge:
'border-[var(--term-blue)]/40 text-(--term-blue) bg-[color-mix(in_oklab,var(--term-blue)_10%,transparent)]',
message: 'text-(--term-fg)',
components/terminal-log-line.tsx:121
wrap-break-worddoesn’t appear to be a Tailwind utility (and isn’t used elsewhere in the repo), so this likely won’t apply any wrapping behavior. Consider replacing it with Tailwind’s built-in wrapping utilities (e.g.break-words/break-all) depending on the desired behavior for long tokens like stack traces.
<span className={`min-w-0 wrap-break-word ${cls.message}`}>{message}</span>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Problem / Motivation
This pull request introduces a new structured log row primitive (
TerminalLogLine) and adds support for structured log entries in theTerminalLogcomponent, enhancing the playground demo to showcase both string-based and structured logging modes. It also updates the playground page to demonstrate new terminal features, including log rows with level badges, timestamps, and source labels, as well as phase markers for terminal feeds.Structured logging support:
TerminalLogLinecomponent, which renders a single log row with level badge, timestamp, source label, and message, using theme-aware colors and consistent layout.TerminalLogto support a newentriesprop for structured log entries, rendering each entry withTerminalLogLine. The component now supports both string and structured modes, with backward compatibility. [1] [2]Playground demo enhancements:
StructuredLogDemotolog-demo.tsx, simulating a streaming log feed using structured entries with levels, timestamps, and sources. [1] [2]page.tsx) to showcase both string and structured log demos, and added new sections forTerminalMarker(phase separators) andTerminalLogLine(row primitives). [1] [2] [3] [4]General UI and code improvements: