Skip to content

Ux/cli trace view#629

Open
promisszn wants to merge 21 commits intodotandev:mainfrom
promisszn:ux/cli-trace-view
Open

Ux/cli trace view#629
promisszn wants to merge 21 commits intodotandev:mainfrom
promisszn:ux/cli-trace-view

Conversation

@promisszn
Copy link

Closes #81

- Add internal/trace/printer.go: PrintExecutionTrace and PrintTraceTree
  with tree-style ASCII connectors, color-coded icons per event type,
  CPU/MEM budget lines, and a summary footer (Steps / Errors / Status)
- Add --print and --no-color flags to 'erst trace' CLI command
- Use github.com/fatih/color v1.18.0 for ANSI styling with NoColor support
- Add printer_test.go: TestPrintTraceTree_NoColor, TestPrintExecutionTrace_NoColor, TestPrintOptions_Width
- Add internal/visualizer/ansi.go: SGR constants for visualizer package
- Fix pre-existing compilation/test errors:
  visualizer/color.go: bad merge + NO_COLOR/TERM=dumb env var support
  dwarf/parser.go: invalid stdlib DWARF API calls
  dwarf/parser_test.go: dwOpStackValue constant, duplicate struct fields
  trace/navigation.go: duplicate struct fields from bad merge
  trace/node.go: missing fmt import, unused variable
  trace/treeui.go: unused scrollPos variable
  trace/trap.go + trap_test.go: wrong SourceLocation type
  trace/viewer.go: redundant newline, add expand keyword to help
  trace/node_test.go + search_unicode_test.go: test compilation fixes
Copilot AI review requested due to automatic review settings February 25, 2026 15:55
Copy link

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 implements a rich terminal trace visualization feature for the CLI, addressing Issue #81. It adds the ability to render execution traces as color-coded ASCII trees with support for both interactive viewing and one-shot printing suitable for CI/CD pipelines.

Changes:

  • Added trace printer with tree-style ASCII output and color coding using fatih/color library
  • Implemented --print and --no-color flags for non-interactive trace viewing
  • Refactored color handling in visualizer package to support dynamic NO_COLOR/FORCE_COLOR environment variables
  • Cleaned up duplicate struct fields, unused variables, and improved DWARF parser comments

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/trace/printer.go New file: Core trace printing implementation with tree rendering, color palette, and formatting utilities
internal/trace/printer_test.go New file: Tests for printer functionality covering no-color mode and narrow terminal scenarios
internal/visualizer/color.go Enhanced ColorEnabled() to check NO_COLOR/FORCE_COLOR/TERM env vars; refactored Colorize, Symbol, and indicator functions
internal/visualizer/ansi.go New file: ANSI SGR escape code constants for visualizer package
internal/cmd/trace.go Added --print and --no-color flags with integration to PrintExecutionTrace
internal/trace/viewer.go Added help text for new "expand" command
internal/trace/treeui.go Removed unused variable in scrollbar calculation
internal/trace/search_unicode_test.go Fixed duplicate EventData field in test case
internal/trace/node_test.go Added missing closing brace for test function
internal/trace/node.go Added fmt import and removed unused variable
internal/trace/navigation.go Deduplicated ExecutionState struct fields
internal/dwarf/parser_test.go Clarified comment about Rust name demangling behavior
internal/dwarf/parser.go Cleaned up parseWASM to stub out WASM support, improved comments, removed unused fields/functions
go.mod, go.sum Added fatih/color and supporting dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

promisszn and others added 15 commits February 25, 2026 17:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add TxStreamer interface with Stream(ctx, hash) channel API
- Implement wsStreamer: persistent WebSocket connection with periodic
  getTransaction JSON-RPC calls at 2s intervals
- Implement pollingStreamer: HTTPS JSON-RPC polling at 3s intervals
- NewTxStreamer factory probes for WebSocket support (3s timeout)
  and selects wsStreamer or pollingStreamer transparently
- WebSocket protocol implemented per RFC 6455 using stdlib only:
  wsDialUpgrade, wsWriteFrame (masked), wsReadFrame, wsGenKey,
  wsAcceptKey -- no new external dependencies
- Add telemetry spans: rpc_tx_stream_ws and rpc_tx_stream_poll
- TxStatus constants: PENDING, SUCCESS, FAILED, NOT_FOUND
- Add txstream_test.go with 15 tests covering unit + integration
- Fix pre-existing compilation errors in verification.go,
  verification_test.go, client_test.go, client_retry_test.go
- Standardized formatting in `internal/trace/trap.go`, `internal/trace/trap_test.go`, and `internal/trace/treeui.go` for improved readability.
- Updated `internal/updater/checker.go` to enhance update checking logic and error handling.
- Modified `internal/visualizer/color.go` to adjust symbol representation.
- Cleaned up imports in `internal/watch/spinner.go` and ensured consistent code style.
- Added missing newline at the end of `main.go` for better file formatting.
- Updated licensing headers in various scripts and test files to reflect authorship and licensing information.
- Improved code structure and readability in `simulator/src/main.rs` and `simulator/src/runner.rs`.
- Enhanced error handling and logging in `simulator/src/stack_trace.rs`.
- Added licensing headers to TypeScript files in the audit and command directories.
- Ensured consistent formatting and licensing in test files across the project.
@dotandev
Copy link
Owner

fix the newest conflicts, please.

@gitguardian
Copy link

gitguardian bot commented Feb 26, 2026

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@promisszn
Copy link
Author

fixed

@dotandev
Copy link
Owner

check ci, they're failing

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.

29. [Decoder] Implement Trace visualization in CLI

3 participants