Commit 3279d2d
authored
✨ Add JSON output, review commands, and user auth for CLI (#203)
## Summary
Comprehensive update to make the CLI fully scriptable and LLM-friendly:
**JSON Output (`--json`)**
- All commands support `--json` for machine-readable output
- Optional field selection: `--json field1,field2`
- Consistent output format: `{status, data}` or `{status, error}`
**New Discovery Commands**
- `vizzly orgs` - List organizations user has access to
- `vizzly projects` - List projects (with `--org` filter)
- `vizzly builds` - List and query builds
- `vizzly comparisons` - Query and search comparisons
- `vizzly baselines` - List local TDD baselines
**New Review Commands**
- `vizzly approve <comparison-id>` - Approve a comparison
- `vizzly reject <comparison-id> -r "reason"` - Reject with reason
- `vizzly comment <build-id> "message"` - Add build comment
**User Authentication**
- Config loader now falls back to user JWT from `vizzly login`
- Enables interactive CLI usage without project tokens
- Works alongside existing project token auth for CI
**Developer Experience**
- Help examples added to all new commands
- Workflow guidance in help output
- `npm run cli` script for local development
## Test plan
All commands manually tested against local API:
- [x] `vizzly whoami --json` - Shows auth status, user info, orgs
- [x] `vizzly orgs --json` - Lists 2 orgs with role and project count
- [x] `vizzly projects --json` - Lists projects with build counts
- [x] `vizzly builds --json --limit 3` - Lists builds with pagination
- [x] `vizzly builds -b <id> --json` - Gets single build details
- [x] `vizzly builds -b <id> --comparisons --json` - Build with
comparisons
- [x] `vizzly comparisons -b <id> --json` - Lists comparisons for build
- [x] `vizzly comparisons --id <id> --json` - Gets single comparison
- [x] `vizzly comparisons --name "index" --json` - Searches by name
- [x] `vizzly approve <id> --json` - Approved, verified user ID in audit
trail
- [x] `vizzly reject <id> -r "Testing CLI rejection" --json` - Rejected
with reason
- [x] `vizzly comment <build-id> "Testing build comments from CLI"
--json` - Comment created with user attribution
- [x] `vizzly baselines --json` - Lists 21 local baselines
- [x] `vizzly api /api/sdk/builds -q limit=1 --json` - Raw API access
works
- [x] `vizzly builds --help` - Shows examples and workflow guidance
- [x] `vizzly approve --help` - Shows examples with workflow steps
- [x] Human-readable output tested for all commands1 parent f5f2e71 commit 3279d2d
File tree
26 files changed
+4374
-67
lines changed- docs
- src
- commands
- utils
- tests/commands
26 files changed
+4374
-67
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
0 commit comments