8000 [WIP] Add `make debug` to improve debugging capabilities of coding agents by lukasmasuch · Pull Request #13721 · streamlit/streamlit · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

Describe your changes

Added vite-plugin-terminal plugin to the Vite dev server config, which pipes browser console logs to the terminal. This is useful for debugging since coding agents can read terminal output directly.

The plugin is opt-in and only activates during dev server when TERMINAL_CONSOLE=1 make frontend-dev is run.

Testing Plan

  • No new tests needed; this is a dev tool configuration
  • Manual testing: TERMINAL_CONSOLE=1 make frontend-dev and verify console.log() calls appear in terminal
  • Builds are unaffected; the plugin only runs during dev server mode

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Enable browser console logs to be piped to the dev server terminal with TERMINAL_CONSOLE=1 make frontend-dev. This allows coding agents to read and debug browser console output from terminal logs.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 27, 2026 17:19
@github-actions
Copy link
Contributor
github-actions bot commented Jan 27, 2026

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13721/streamlit-1.53.1-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13721.streamlit.app (☁️ Deploy here if not accessible)

@lukasmasuch lukasmasuch marked this pull request as draft January 27, 2026 17:20
@lukasmasuch lukasmasuch changed the title Add vite-plugin-terminal for console debugging [WIP] Add vite-plugin-terminal for console debugging Jan 27, 2026
@snyk-io
Copy link
Contributor
snyk-io bot commented Jan 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Contributor
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds vite-plugin-terminal as an optional development debugging tool that pipes browser console logs to the terminal output. This feature is designed to help coding agents (AI assistants) debug frontend code by making browser console output directly accessible in terminal logs.

Changes:

  • Added vite-plugin-terminal@^1.4.0 as a dev dependency
  • Configured the plugin to activate only during dev server mode when TERMINAL_CONSOLE=1 environment variable is set
  • Updated yarn.lock with the new package and its transitive dependencies

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
frontend/app/package.json Added vite-plugin-terminal as a devDependency at version ^1.4.0
frontend/app/vite.config.ts Imported the plugin and conditionally enabled it only during dev server when TERMINAL_CONSOLE env var is set
frontend/yarn.lock Added lockfile entries for vite-plugin-terminal and its dependencies (@polka/url, @rollup/plugin-strip, sirv, mrmime, totalist, updated ufo and kolorist versions)

lukasmasuch and others added 3 commits January 27, 2026 18:35
Adds a new make target that starts both Streamlit and Vite dev server
with console logging enabled. Usage: `make debug my-script.py`

Co-Authored-By: Claude <noreply@anthropic.com>
- Write logs to .debug/backend.log and .debug/frontend.log
- Logs persist after exit for post-mortem analysis
- Check if ports 3000/8501 are available before starting
- Show helpful error with PIDs if ports are in use
- Document debug command in AGENTS.md

Co-Authored-By: Claude <noreply@anthropic.com>
Rename log files to debug-backend.log and debug-frontend.log
in the existing work-tmp/ directory.

Co-Authored-By: Claude <noreply@anthropic.com>
@lukasmasuch lukasmasuch changed the title [WIP] Add vite-plugin-terminal for console debugging [WIP] Add make debug to improve debugging capabilities of coding agents Jan 27, 2026
- Start servers in background and poll health endpoints until ready
- Add streamlit flags for headless mode, runOnSave, and developmentMode
- Move cleanup trap before server startup for proper signal handling
- Use `wait` to keep process running until Ctrl+C

Co-Authored-By: Claude <noreply@anthropic.com>
@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:other PR contains other type of change impact:internal PR changes only affect internal code labels Jan 27, 2026
lukasmasuch and others added 2 commits January 27, 2026 20:42
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:other PR contains other type of change impact:internal PR changes only affect internal code security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0