Skip to content

Conversation

@jhaynie
Copy link
Member

@jhaynie jhaynie commented May 23, 2025

Ode to the Feature That Might Have Been

Oh darling thread of clever code,
A spark within the dev abode,
You promised grace, you whispered speed,
A perfect match for every need.

You shimmered bright in demos fair,
With animated flair to spare—
A marvel born of sleepless nights,
And countless merge conflicts and fights.

You danced through mock-ups, lived in dreams,
You dazzled all our beta teams.
But truth, that harsh and stubborn friend,
Declared your glory near its end.

The bugs crept in, the edge case grew,
Our unit tests all turned askew.
You crashed the build, you drained our will,
No patch, no hack could tame you still.

So now we part, you phantom gem,
Unshipped, unsung, like many them—
Yet in the changelogs you remain,
A ghost of joy, a hint of pain.

Farewell, sweet feature none shall see,
You almost were—but couldn't be.

Summary by CodeRabbit

  • Refactor

    • Simplified the development server experience by removing the interactive terminal UI and custom TUI loggers. Logging and status updates now use standard output and a global logger with a streamlined spinner interface.
    • Introduced a new styled info box for displaying DevMode URLs directly in the terminal output.
  • Chores

    • Cleaned up dependencies by removing unused packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 23, 2025

Walkthrough

This update removes the custom TUI-based UI and logger infrastructure from the development server workflow, simplifying logging and user interaction. All TUI abstractions are deleted, and the system now uses a global logger and standard output for logs and status messages. A new info box generator is introduced for displaying URLs.

Changes

File(s) Change Summary
cmd/dev.go Refactored to remove TUI UI/loggers; uses global logger, spinner, and prints info box directly to stdout.
go.mod Removed golang.org/x/term as direct dependency; removed github.com/sahilm/fuzzy indirect dependency.
internal/dev/pending_logger.go Deleted; removed the PendingLogger type and all related log buffering logic.
internal/dev/tui.go, internal/dev/tui_logger.go Deleted; removed all TUI UI and TUI logger code, including Bubble Tea integration and log streaming.
internal/dev/server.go Removed pendingLogger field and logic; simplified Connect method; added GenerateInfoBox for URL display.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DevCmd
    participant Server
    participant Logger

    User->>DevCmd: Run dev command
    DevCmd->>Logger: Log startup info
    DevCmd->>Server: Connect()
    Server-->>DevCmd: Connection result
    DevCmd->>Logger: Log build/watch/restart events
    DevCmd->>Server: GenerateInfoBox()
    DevCmd->>User: Print info box to stdout
    DevCmd->>Logger: Log shutdown/teardown
Loading

Possibly related PRs

  • Devmode: Improved logging output and sourcemap support #321: Both PRs modify the logging and server connection code; this PR removes the TUI logger and UI abstractions that the referenced PR enhances, making them closely related in terms of logging and connection interface changes.
  • DevMode: improvements around feedback #300: This PR removes the TUI UI and logger components from the dev server, while the referenced PR enhances TUI features and fallback modes, both affecting the dev mode UI and logging subsystem.

Suggested reviewers

  • robindiddams

Poem

In the warren where code once spun and danced,
The TUI has hopped away, no longer entranced.
Now logs are simple, clear, and bright,
With spinners whirling in plain daylight.
URLs in a box, so easy to see—
Simpler dev mode for you and me!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dee4a67 and 3302014.

📒 Files selected for processing (1)
  • internal/dev/server.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/dev/server.go
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
internal/dev/server.go (1)

608-633: Make the info-box width adaptive to terminal size.

Hard-coding Width(100) risks ugly wrapping on narrow terminals and wasted space on wide ones.
Lipgloss can query the TTY width (lipgloss.Width / lipgloss.TerminalWidth()) allowing:

w, _ := lipgloss.Size()
if w == 0 || w > 100 { w = 100 }       // fallback / cap
devmodeBox := lipgloss.NewStyle().Width(w)...

Consider this small tweak so the pretty box stays pretty across environments.

cmd/dev.go (1)

100-111: Spinner output mixes with os.Stdout from the bundler.

bundler.Bundle streams its log output to os.Stdout, while tui.ShowSpinner is rendering the animated spinner on the same file descriptor. The two streams can interleave, causing scrambled output.

If keeping the spinner, route the bundler output to an in-memory buffer (shown when done) or to tui.SpinnerWriter() (if the lib provides one). Otherwise drop the spinner for the build step.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08b0d17 and dee4a67.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • cmd/dev.go (1 hunks)
  • go.mod (1 hunks)
  • internal/dev/pending_logger.go (0 hunks)
  • internal/dev/server.go (4 hunks)
  • internal/dev/tui.go (0 hunks)
  • internal/dev/tui_logger.go (0 hunks)
💤 Files with no reviewable changes (3)
  • internal/dev/pending_logger.go
  • internal/dev/tui_logger.go
  • internal/dev/tui.go
🧰 Additional context used
🪛 golangci-lint (1.64.8)
internal/dev/server.go

600-600: var runningColor is unused

(unused)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build and Test (macos-latest)
  • GitHub Check: Test CLI Upgrade Path (windows-latest)
🔇 Additional comments (2)
internal/dev/server.go (1)

572-579: Channel-closing hazard in Connect().

Connect()(caller) → reads from s.connected and immediately close(s.connected).
If, for any reason, Connect() were ever called a second time (e.g. future refactor, test helper) the second invocation would panic when it tries to close the already-closed channel. A tiny guard prevents a latent foot-gun:

-err := <-s.connected
-close(s.connected)
+err := <-s.connected
+select {
+case <-s.connected: // drain if already closed
+default:
+	close(s.connected)
+}

Or make Connect idempotent by storing a sync.Once around the close.

go.mod (1)

60-60: Confirm the x/term dependency can stay indirect.

The module is now flagged as // indirect. If nothing in your code imports golang.org/x/term, go mod tidy will eventually drop it, otherwise Go will promote it back to direct. Run go mod tidy && go test ./... to verify.

Comment on lines +172 to +174
defer watcher.Close(log)

tuiLogger.Trace("starting project server")
if err := projectServerCmd.Start(); err != nil {
errsystem.New(errsystem.ErrInvalidConfiguration, err, errsystem.WithContextMessage(fmt.Sprintf("Failed to start project: %s", err))).ShowErrorAndExit()
}
initRun := func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

watcher.Close is invoked twice – second call may error.

You defer watcher.Close(log) right after the watcher is created and call the same method again inside teardown().
Unless (*Watcher).Close is explicitly idempotent this double-close can return an error or panic (e.g. “send on closed channel”). Remove one of the calls – the defer is usually sufficient.

-		defer watcher.Close(log)
...
-		teardown := func() {
-			watcher.Close(log)
+		teardown := func() {
 			server.Close()
 			dev.KillProjectServer(log, projectServerCmd, pid)
 		}

Also applies to: 230-233

🤖 Prompt for AI Agents
In cmd/dev.go around lines 172 to 174 and also lines 230 to 233, the
watcher.Close(log) method is called twice: once deferred immediately after
watcher creation and again inside the teardown() function. This double close can
cause errors or panics if Close is not idempotent. To fix this, remove the
explicit call to watcher.Close(log) inside teardown() and rely solely on the
deferred call to ensure the watcher is closed exactly once.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@jhaynie jhaynie merged commit e18a483 into main May 23, 2025
14 checks passed
@jhaynie jhaynie deleted the bye-bye-tui branch May 23, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants