Skip to content

Conversation

@shivasurya
Copy link
Owner

Summary

Adds visual progress bars for long-running operations using schollz/progressbar/v3. Progress bars display for graph building, callgraph construction, module registry, and rule execution.

Why this change?

  • User feedback: Provides real-time feedback for operations that take several seconds
  • Professional appearance: Modern CLI tools show progress indicators
  • Better debugging: Helps identify which stage is slow when performance issues occur
  • Reduced anxiety: Users know the tool is working, not hung

Changes

  • Add progressbar/v3 dependency
  • Extend Logger with progress bar methods:
    • StartProgress(description, total) - Begin progress tracking
    • UpdateProgress(delta) - Increment progress counter
    • FinishProgress() - Complete and clear progress bar
    • SetProgressDescription(desc) - Update progress message
  • Integrate progress bars in scan.go and ci.go for:
    • Code graph building (determinate)
    • Module registry building (indeterminate)
    • Callgraph construction (indeterminate)
    • Rule execution (determinate, per-rule)
  • Add 15 comprehensive tests (94.6% coverage)

Testing

  • Progress bar creation and lifecycle tests
  • TTY vs non-TTY fallback behavior
  • Determinate vs indeterminate progress
  • Multiple sequential operations
  • Edge cases (start/finish without updates, etc.)

Stack

  • Depends on: PR-01 (Banner system)
  • Part of CLI Output Enhancement initiative (PR-02 of 4)

🤖 Generated with Claude Code

@shivasurya shivasurya added the enhancement New feature or request label Jan 20, 2026
@shivasurya shivasurya self-assigned this Jan 20, 2026
@safedep
Copy link

safedep bot commented Jan 20, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

Package Details
Package Malware Vulnerability Risky License Report
icon github.com/common-nighthawk/go-figure @ v0.0.0-20210622060536-734e95fb86be
sast-engine/go.mod
ok icon
ok icon
ok icon
🔗
icon github.com/mitchellh/colorstring @ v0.0.0-20190213212951-d06e56a500db
sast-engine/go.mod
ok icon
ok icon
ok icon
🔗
icon github.com/rivo/uniseg @ v0.4.7
sast-engine/go.mod
ok icon
ok icon
ok icon
🔗
icon github.com/schollz/progressbar/v3 @ v3.19.0
sast-engine/go.mod
ok icon
ok icon
ok icon
🔗
icon golang.org/x/term @ v0.39.0
sast-engine/go.mod
ok icon
ok icon
ok icon
🔗

This report is generated by SafeDep Github App

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 35.80247% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.97%. Comparing base (423ca1d) to head (997f4be).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sast-engine/output/logger.go 50.87% 28 Missing ⚠️
sast-engine/cmd/ci.go 0.00% 12 Missing ⚠️
sast-engine/cmd/scan.go 0.00% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #474      +/-   ##
==========================================
- Coverage   80.25%   79.97%   -0.29%     
==========================================
  Files         101      101              
  Lines       11051    11114      +63     
==========================================
+ Hits         8869     8888      +19     
- Misses       1830     1874      +44     
  Partials      352      352              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner Author

shivasurya commented Jan 20, 2026

Copy link
Owner Author

shivasurya commented Jan 20, 2026

Merge activity

  • Jan 20, 3:40 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 20, 3:42 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jan 20, 3:43 AM UTC: @shivasurya merged this pull request with Graphite.

@shivasurya shivasurya changed the base branch from feature/cli-banner-tty-pr01 to graphite-base/474 January 20, 2026 03:40
@shivasurya shivasurya changed the base branch from graphite-base/474 to main January 20, 2026 03:41
Implements Phase 1 - Step 2 of CLI Output Enhancement with TTY-aware progress bars.

Modified files:
- output/logger.go: Add progress bar support with progressBar and showProgress fields
- output/logger_test.go: Add comprehensive tests for progress bar functionality
- cmd/scan.go: Integrate progress bars for graph building, module registry, callgraph, and rule execution
- cmd/ci.go: Integrate progress bars for all CI operations

Dependencies added:
- github.com/schollz/progressbar/v3: Native Go progress bar library

Features:
- Indeterminate progress bars (spinners) for long-running operations
- Determinate progress bars with percentages for rule execution
- TTY-aware automatic fallback to simple text messages in non-TTY environments
- Zero impact on CI/CD pipelines (progress bars hidden in pipes)
- StartProgress, UpdateProgress, FinishProgress, and SetProgressDescription methods
- IsProgressEnabled method for checking progress bar availability

Progress bars added for:
- Building code graph
- Building module registry
- Building callgraph
- Loading rules
- Executing rules (with per-rule progress updates)

Test coverage: 94.6% for output package (all progress bar methods tested)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@shivasurya shivasurya force-pushed the feature/cli-progress-bars-pr02 branch from 0e540a3 to 997f4be Compare January 20, 2026 03:41
@shivasurya shivasurya merged commit 3d99b86 into main Jan 20, 2026
5 checks passed
@shivasurya shivasurya deleted the feature/cli-progress-bars-pr02 branch January 20, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants