Skip to content

feat(privacy): add --format json, --output flags and summary to scan results (#31) - #32

Open
shabbirAlam wants to merge 2 commits into
RevylAI:mainfrom
shabbirAlam:main
Open

feat(privacy): add --format json, --output flags and summary to scan results (#31)#32
shabbirAlam wants to merge 2 commits into
RevylAI:mainfrom
shabbirAlam:main

Conversation

@shabbirAlam

@shabbirAlam shabbirAlam commented Sep 1, 2026

Copy link
Copy Markdown

Fixes #31
Problem
greenlight privacy /path --format json failed with Error: unknown flag: --format, while codescan, preflight and playscan all support --format json / --output. Privacy JSON output also lacked the summary object (total, critical, high, warns, infos, files_scanned, passed) present in other scanners.
Solution
Bring privacy to parity with other commands.

Verification
make build

1. JSON to stdout (now works)

./build/greenlight privacy /path/to/project --format json

2. JSON to file

./build/greenlight privacy /path/to/project --format json --output report.json
cat report.json # contains summary + elapsed

3. Terminal unchanged (default)

./build/greenlight privacy /path/to/project

4. Tests

make test # all pass
Example output (--format json):
{
"project_path": "/path/to/project",
"has_privacy_info": false,
"detected_apis": ["User Defaults"],
"summary": {
"total": 2,
"critical": 2,
"high": 0,
"warns": 0,
"infos": 0,
"files_scanned": 0,
"passed": false
},
"elapsed": "290ms"
}
Checklist

  • Follows existing patterns in internal/cli/codescan.go:56 and internal/cli/playscan.go:64
  • Summary JSON tags match codescan.Summary
  • No breaking change to terminal output
  • make test passes

Note

Low Risk
CLI-only reporting changes with default terminal behavior preserved; no auth or data-path changes.

Overview
Brings greenlight privacy in line with codescan, preflight, and playscan by adding --format (terminal default, json) and --output to write reports to a file instead of stdout.

JSON mode skips the colored banner, emits an indented payload that embeds the scan result plus elapsed, and includes a new summary block (counts by severity, files_scanned, passed) computed at the end of privacy.Scan. Terminal rendering is unchanged in content but now writes through a shared io.Writer so the same report can go to stdout or a file.

Reviewed by Cursor Bugbot for commit 9579d82. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d3d9af5. Configure here.

Comment thread internal/cli/privacy.go
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.

--format json not available for greenlight privacy

1 participant