11#!/usr/bin/env node
22import 'dotenv/config' ;
33import { program } from 'commander' ;
4+ import { apiCommand , validateApiOptions } from './commands/api.js' ;
5+ import {
6+ baselinesCommand ,
7+ validateBaselinesOptions ,
8+ } from './commands/baselines.js' ;
9+ import { buildsCommand , validateBuildsOptions } from './commands/builds.js' ;
10+ import {
11+ comparisonsCommand ,
12+ validateComparisonsOptions ,
13+ } from './commands/comparisons.js' ;
14+ import { configCommand , validateConfigOptions } from './commands/config-cmd.js' ;
415import { doctorCommand , validateDoctorOptions } from './commands/doctor.js' ;
516import {
617 finalizeCommand ,
@@ -17,14 +28,13 @@ import {
1728 projectTokenCommand ,
1829 validateProjectOptions ,
1930} from './commands/project.js' ;
31+ import {
32+ approveCommand ,
33+ commentCommand ,
34+ rejectCommand ,
35+ } from './commands/review.js' ;
2036import { runCommand , validateRunOptions } from './commands/run.js' ;
2137import { statusCommand , validateStatusOptions } from './commands/status.js' ;
22- import { buildsCommand , validateBuildsOptions } from './commands/builds.js' ;
23- import { comparisonsCommand , validateComparisonsOptions } from './commands/comparisons.js' ;
24- import { configCommand , validateConfigOptions } from './commands/config-cmd.js' ;
25- import { baselinesCommand , validateBaselinesOptions } from './commands/baselines.js' ;
26- import { apiCommand , validateApiOptions } from './commands/api.js' ;
27- import { approveCommand , rejectCommand , commentCommand } from './commands/review.js' ;
2838import { tddCommand , validateTddOptions } from './commands/tdd.js' ;
2939import {
3040 runDaemonChild ,
@@ -90,10 +100,29 @@ const formatHelp = (cmd, helper) => {
90100 key : 'core' ,
91101 icon : '▸' ,
92102 title : 'Core' ,
93- names : [ 'run' , 'tdd' , 'upload' , 'status' , 'finalize' , 'preview' , 'builds' , 'comparisons' ] ,
103+ names : [
104+ 'run' ,
105+ 'tdd' ,
106+ 'upload' ,
107+ 'status' ,
108+ 'finalize' ,
109+ 'preview' ,
110+ 'builds' ,
111+ 'comparisons' ,
112+ ] ,
113+ } ,
114+ {
115+ key : 'review' ,
116+ icon : '▸' ,
117+ title : 'Review' ,
118+ names : [ 'approve' , 'reject' , 'comment' ] ,
119+ } ,
120+ {
121+ key : 'setup' ,
122+ icon : '▸' ,
123+ title : 'Setup' ,
124+ names : [ 'init' , 'doctor' , 'config' , 'baselines' ] ,
94125 } ,
95- { key : 'review' , icon : '▸' , title : 'Review' , names : [ 'approve' , 'reject' , 'comment' ] } ,
96- { key : 'setup' , icon : '▸' , title : 'Setup' , names : [ 'init' , 'doctor' , 'config' , 'baselines' ] } ,
97126 { key : 'advanced' , icon : '▸' , title : 'Advanced' , names : [ 'api' ] } ,
98127 {
99128 key : 'auth' ,
@@ -114,7 +143,14 @@ const formatHelp = (cmd, helper) => {
114143 } ,
115144 ] ;
116145
117- let grouped = { core : [ ] , setup : [ ] , advanced : [ ] , auth : [ ] , project : [ ] , other : [ ] } ;
146+ let grouped = {
147+ core : [ ] ,
148+ setup : [ ] ,
149+ advanced : [ ] ,
150+ auth : [ ] ,
151+ project : [ ] ,
152+ other : [ ] ,
153+ } ;
118154
119155 for ( let command of commands ) {
120156 let name = command . name ( ) ;
@@ -243,7 +279,10 @@ program
243279 '--log-level <level>' ,
244280 'Log level: debug, info, warn, error (default: info, or VIZZLY_LOG_LEVEL env var)'
245281 )
246- . option ( '--json [fields]' , 'JSON output, optionally specify fields (e.g., --json id,status,branch)' )
282+ . option (
283+ '--json [fields]' ,
284+ 'JSON output, optionally specify fields (e.g., --json id,status,branch)'
285+ )
247286 . option ( '--color' , 'Force colored output (even in non-TTY)' )
248287 . option ( '--no-color' , 'Disable colored output' )
249288 . option (
@@ -591,9 +630,17 @@ program
591630 . description ( 'List and query builds' )
592631 . option ( '-b, --build <id>' , 'Get a specific build by ID' )
593632 . option ( '--branch <branch>' , 'Filter by branch' )
594- . option ( '--status <status>' , 'Filter by status (created, pending, processing, completed, failed)' )
633+ . option (
634+ '--status <status>' ,
635+ 'Filter by status (created, pending, processing, completed, failed)'
636+ )
595637 . option ( '--environment <env>' , 'Filter by environment' )
596- . option ( '--limit <n>' , 'Maximum results to return (1-250)' , val => parseInt ( val , 10 ) , 20 )
638+ . option (
639+ '--limit <n>' ,
640+ 'Maximum results to return (1-250)' ,
641+ val => parseInt ( val , 10 ) ,
642+ 20
643+ )
597644 . option ( '--offset <n>' , 'Skip first N results' , val => parseInt ( val , 10 ) , 0 )
598645 . option ( '--comparisons' , 'Include comparisons when fetching a specific build' )
599646 . action ( async options => {
@@ -620,7 +667,12 @@ program
620667 . option ( '--name <pattern>' , 'Search comparisons by name (supports wildcards)' )
621668 . option ( '--status <status>' , 'Filter by status (identical, new, changed)' )
622669 . option ( '--branch <branch>' , 'Filter by branch (for name search)' )
623- . option ( '--limit <n>' , 'Maximum results to return (1-250)' , val => parseInt ( val , 10 ) , 50 )
670+ . option (
671+ '--limit <n>' ,
672+ 'Maximum results to return (1-250)' ,
673+ val => parseInt ( val , 10 ) ,
674+ 50
675+ )
624676 . option ( '--offset <n>' , 'Skip first N results' , val => parseInt ( val , 10 ) , 0 )
625677 . action ( async options => {
626678 const globalOptions = program . opts ( ) ;
@@ -641,7 +693,10 @@ program
641693program
642694 . command ( 'config' )
643695 . description ( 'Display current configuration' )
644- . argument ( '[key]' , 'Specific config key to get (dot notation, e.g., comparison.threshold)' )
696+ . argument (
697+ '[key]' ,
698+ 'Specific config key to get (dot notation, e.g., comparison.threshold)'
699+ )
645700 . action ( async ( key , options ) => {
646701 const globalOptions = program . opts ( ) ;
647702
@@ -683,10 +738,22 @@ program
683738 . command ( 'api' )
684739 . description ( 'Make raw API requests (for power users)' )
685740 . argument ( '<endpoint>' , 'API endpoint (e.g., /sdk/builds)' )
686- . option ( '-X, --method <method>' , 'HTTP method (GET or POST for approve/reject/comment)' , 'GET' )
741+ . option (
742+ '-X, --method <method>' ,
743+ 'HTTP method (GET or POST for approve/reject/comment)' ,
744+ 'GET'
745+ )
687746 . option ( '-d, --data <json>' , 'Request body (JSON)' )
688- . option ( '-H, --header <header>' , 'Add header (key:value), can be repeated' , ( val , prev ) => ( prev ? [ ...prev , val ] : [ val ] ) )
689- . option ( '-q, --query <param>' , 'Add query param (key=value), can be repeated' , ( val , prev ) => ( prev ? [ ...prev , val ] : [ val ] ) )
747+ . option (
748+ '-H, --header <header>' ,
749+ 'Add header (key:value), can be repeated' ,
750+ ( val , prev ) => ( prev ? [ ...prev , val ] : [ val ] )
751+ )
752+ . option (
753+ '-q, --query <param>' ,
754+ 'Add query param (key=value), can be repeated' ,
755+ ( val , prev ) => ( prev ? [ ...prev , val ] : [ val ] )
756+ )
690757 . action ( async ( endpoint , options ) => {
691758 const globalOptions = program . opts ( ) ;
692759
@@ -728,7 +795,11 @@ program
728795 . description ( 'Add a comment to a build' )
729796 . argument ( '<build-id>' , 'Build ID to comment on' )
730797 . argument ( '<message>' , 'Comment message' )
731- . option ( '-t, --type <type>' , 'Comment type: general, approval, rejection' , 'general' )
798+ . option (
799+ '-t, --type <type>' ,
800+ 'Comment type: general, approval, rejection' ,
801+ 'general'
802+ )
732803 . action ( async ( buildId , message , options ) => {
733804 const globalOptions = program . opts ( ) ;
734805 await commentCommand ( buildId , message , options , globalOptions ) ;
0 commit comments