@@ -7,10 +7,8 @@ import { getClientId } from "../../../utils/version";
77import { createViemClients } from "../../../utils/viemClients" ;
88import chalk from "chalk" ;
99import { formatAppRelease } from "../../../utils/releases" ;
10- import { Address , isAddress } from "viem" ;
11- import Table from "cli-table3" ;
10+ import { Address } from "viem" ;
1211import {
13- terminalWidth ,
1412 formatRepoDisplay ,
1513 extractRepoName ,
1614 formatImageDisplay ,
@@ -132,20 +130,8 @@ export default class AppReleases extends Command {
132130 return ;
133131 }
134132
135- type Row = {
136- rel : string ;
137- block : string ;
138- created : string ;
139- repo : string ;
140- commit : string ;
141- digest : string ;
142- image : string ;
143- build : string ;
144- prov : string ;
145- deps : string ;
146- } ;
147-
148- const rows : Row [ ] = releases . map ( ( r , i ) => {
133+ for ( let i = 0 ; i < releases . length ; i ++ ) {
134+ const r = releases [ i ] ! ;
149135 const rel = r . rmsReleaseId ?? String ( i ) ;
150136 const block = r . createdAtBlock ? String ( r . createdAtBlock ) : "-" ;
151137 const created = r . createdAt ? formatHumanTime ( r . createdAt ) : "-" ;
@@ -155,100 +141,21 @@ export default class AppReleases extends Command {
155141 const image = formatImageDisplay ( r . build ?. imageUrl ?? r . registryUrl ?? "-" ) ;
156142 const build = r . build ?. buildId ?? "-" ;
157143 const prov = provenanceSummaryFromBuild ( r . build ) ;
158- const depCount = r . build ?. dependencies ? Object . keys ( r . build . dependencies ) . length : 0 ;
159- const deps = depCount > 0 ? `deps:${ depCount } ` : "-" ;
160- return { rel, block, created, repo, commit, digest, image, build, prov, deps } ;
161- } ) ;
162-
163- const headers = {
164- rel : chalk . bold ( "Rel" ) ,
165- block : chalk . bold ( "Block" ) ,
166- created : chalk . bold ( "Created" ) ,
167- repo : chalk . bold ( "Repo" ) ,
168- commit : chalk . bold ( "Commit" ) ,
169- digest : chalk . bold ( "Digest" ) ,
170- image : chalk . bold ( "Image" ) ,
171- build : chalk . bold ( "Build" ) ,
172- prov : chalk . bold ( "Prov" ) ,
173- deps : chalk . bold ( "Deps" ) ,
174- } ;
175144
176- const tw = terminalWidth ( ) ;
177- // With 10 columns this gets unreadable on narrow terminals; fall back to stacked.
178- const shouldStack = tw < 140 ;
179-
180- if ( shouldStack ) {
181- for ( const r of rows ) {
182- this . log ( `${ chalk . cyan ( r . rel ) } ${ r . created } (block ${ r . block } )` ) ;
183- this . log ( ` Repo: ${ r . repo } ` ) ;
184- this . log ( ` Commit: ${ r . commit } ` ) ;
185- this . log ( ` Digest: ${ r . digest } ` ) ;
186- this . log ( ` Image: ${ r . image } ` ) ;
187- this . log ( ` Build: ${ r . build } ` ) ;
188- this . log ( ` Provenance: ${ r . prov } ` ) ;
189- const relObj = releases . find ( ( x , idx ) => ( x . rmsReleaseId ?? String ( idx ) ) === r . rel ) ;
190- const depLines = formatDepLines ( relObj ?. build ?. dependencies ) ;
191- if ( depLines . length ) {
192- for ( const l of depLines ) this . log ( l ) ;
193- }
194- this . log ( chalk . gray ( " ───────────────────────────────────────────────────────────────" ) ) ;
145+ this . log ( `${ chalk . cyan ( rel ) } ${ created } (block ${ block } )` ) ;
146+ this . log ( ` Repo: ${ repo } ` ) ;
147+ this . log ( ` Commit: ${ commit } ` ) ;
148+ this . log ( ` Digest: ${ digest } ` ) ;
149+ this . log ( ` Image: ${ image } ` ) ;
150+ this . log ( ` Build: ${ build } ` ) ;
151+ this . log ( ` Provenance: ${ prov } ` ) ;
152+ const depLines = formatDepLines ( r . build ?. dependencies ) ;
153+ if ( depLines . length ) {
154+ for ( const l of depLines ) this . log ( l ) ;
195155 }
196- this . log ( "" ) ;
197- this . log (
198- chalk . gray (
199- `Tip: use ${ chalk . yellow ( "--full" ) } for detailed release output, ${ chalk . yellow (
200- "--json" ,
201- ) } to copy/paste, and ${ chalk . yellow (
202- "ecloud compute build info <buildId>" ,
203- ) } for full build/provenance details.`,
204- ) ,
205- ) ;
206- return ;
156+ this . log ( chalk . gray ( " ───────────────────────────────────────────────────────────────" ) ) ;
207157 }
208158
209- // Allocate flexible width to the "wide" columns based on terminal width.
210- // Note: cli-table3 includes borders/padding; this is intentionally approximate.
211- const fixed = 6 + 10 + 20 + 36 + 12 + 8 + 10 ; // rel + block + created + build + prov + deps + commit(min-ish)
212- const remaining = Math . max ( 60 , tw - fixed ) ;
213- const repoW = Math . max ( 18 , Math . floor ( remaining * 0.25 ) ) ;
214- const digestW = Math . max ( 18 , Math . floor ( remaining * 0.35 ) ) ;
215- const imageW = Math . max ( 18 , remaining - repoW - digestW ) ;
216-
217- const table = new Table ( {
218- head : [
219- headers . rel ,
220- headers . block ,
221- headers . created ,
222- headers . repo ,
223- headers . commit ,
224- headers . digest ,
225- headers . image ,
226- headers . build ,
227- headers . prov ,
228- headers . deps ,
229- ] ,
230- colWidths : [ 6 , 10 , 20 , repoW , 10 , digestW , imageW , 36 , 12 , 8 ] ,
231- wordWrap : true ,
232- style : { "padding-left" : 0 , "padding-right" : 1 , head : [ ] , border : [ ] } ,
233- } ) ;
234-
235- for ( const r of rows ) {
236- table . push ( [
237- r . rel ,
238- r . block ,
239- r . created ,
240- r . repo ,
241- r . commit ,
242- r . digest ,
243- r . image ,
244- r . build ,
245- r . prov ,
246- r . deps ,
247- ] ) ;
248- }
249-
250- this . log ( table . toString ( ) ) ;
251-
252159 this . log ( "" ) ;
253160 this . log (
254161 chalk . gray (
0 commit comments