11/* eslint-disable perfectionist/sort-classes */
22import { Args , Command , Flags , ux } from '@oclif/core'
33import * as fs from 'node:fs'
4- import { Octokit } from 'octokit'
4+ import { Octokit } from '@ octokit/rest '
55import { read } from 'read'
66import { simpleGit } from 'simple-git'
7- import { Score , SizeUp as SizeUpCore } from 'sizeup-core'
7+ import { Score , SizeUp } from 'sizeup-core'
8+
9+ export default class Evaluate extends Command {
10+ static aliases = [ 'eval' ]
811
9- export default class SizeUp extends Command {
1012 static args = {
1113 diff : Args . string ( {
1214 default : '' ,
@@ -46,6 +48,7 @@ export default class SizeUp extends Command {
4648 'token-path' : Flags . string ( {
4749 char : 't' ,
4850 description : 'Path to a file containing a GitHub API token.\n'
51+ + 'When evaluated a pull request from a private repository, this token must have the full `repo` scope and may also need to be SSO-enabled for the appropriate organization.\n'
4952 + 'If this flag is omitted and the `diff` argument is a URL, then this tool will prompt for a token instead.' ,
5053 required : false ,
5154 } ) ,
@@ -59,7 +62,7 @@ export default class SizeUp extends Command {
5962 static strict = false
6063
6164 async run ( ) : Promise < void > {
62- const { args, flags} = await this . parse ( SizeUp )
65+ const { args, flags} = await this . parse ( Evaluate )
6366 let score : Score | undefined
6467
6568 if ( args . diff ?. startsWith ( 'https://' ) ) {
@@ -103,12 +106,12 @@ export default class SizeUp extends Command {
103106 const cloneDirectory = `/tmp/${ repo } `
104107
105108 // Clear the contents of the clone directory,
106- // otherwise SizeUpCore .evaluate will refuse to overwrite them.
109+ // otherwise SizeUp .evaluate will refuse to overwrite them.
107110 fs . rmSync ( cloneDirectory , { force : true , recursive : true } )
108111 fs . mkdirSync ( cloneDirectory , { recursive : true } )
109112
110113 return {
111- result : SizeUpCore . evaluate (
114+ result : SizeUp . evaluate (
112115 {
113116 baseRef : pull . data . base . ref ,
114117 cloneDirectory,
@@ -145,7 +148,7 @@ export default class SizeUp extends Command {
145148
146149 return this . reportProgress (
147150 `Evaluating the diff with the ${ this . configChoice ( flags ) } ` ,
148- async ( ) => ( { result : await SizeUpCore . evaluate ( diff , flags [ 'config-path' ] ) } ) ,
151+ async ( ) => ( { result : await SizeUp . evaluate ( diff , flags [ 'config-path' ] ) } ) ,
149152 )
150153 }
151154
@@ -165,7 +168,7 @@ export default class SizeUp extends Command {
165168
166169 return this . reportProgress (
167170 `Evaluating the diff with the ${ this . configChoice ( flags ) } ` ,
168- async ( ) => ( { result : await SizeUpCore . evaluate ( diff , flags [ 'config-path' ] ) } ) ,
171+ async ( ) => ( { result : await SizeUp . evaluate ( diff , flags [ 'config-path' ] ) } ) ,
169172 )
170173 }
171174
0 commit comments