11import { Command } from "commander" ;
22
3+ import { setup } from "./setup.ts" ;
34import type { VerifyData , XMbSpec } from "../config/types" ;
45import { PluginService } from "../services/plugin" ;
5- import { deployedUrl } from "../utils/deployed-url" ;
6- import { validateAndParseOpenApiSpec } from "../utils/openapi" ;
7- import { getHostname , getSpecUrl } from "../utils/url" ;
86
97export const verifyCommand = new Command ( )
108 . name ( "verify" )
@@ -43,20 +41,7 @@ export const verifyCommand = new Command()
4341 } ,
4442 )
4543 . action ( async ( options ) => {
46- const url = options . url || deployedUrl ;
47-
48- if ( ! url ) {
49- console . error ( "Deployed URL could not be determined." ) ;
50- return ;
51- }
52-
53- const pluginId = getHostname ( url ) ;
54- const specUrl = getSpecUrl ( url ) ;
55- const xMbSpec = await validateAndParseOpenApiSpec ( specUrl ) ;
56- if ( ! xMbSpec ) {
57- console . error ( "OpenAPI specification validation failed." ) ;
58- return ;
59- }
44+ const { pluginId, xMbSpec } = await setup ( options . url ) ;
6045
6146 try {
6247 const agentData = formVerifyData ( options , xMbSpec ) ;
@@ -71,7 +56,7 @@ export const verifyCommand = new Command()
7156 } ) ;
7257
7358function formVerifyData ( options : unknown , spec : XMbSpec ) : VerifyData {
74- const verifyData : VerifyData = {
59+ return {
7560 accountId : spec [ "account-id" ] ,
7661 email :
7762 ( ( options as { email ?: string } ) . email ?? spec . email ) ||
@@ -91,5 +76,4 @@ function formVerifyData(options: unknown, spec: XMbSpec): VerifyData {
9176 chainIds :
9277 ( options as { chains ?: number [ ] } ) . chains ?? spec . assistant . chainIds ,
9378 } ;
94- return verifyData ;
9579}
0 commit comments