@@ -10,11 +10,7 @@ import {
1010import { emitResult , emitBare } from "bailian-cli-runtime" ;
1111import { AGENTS , VALID_AGENT_NAMES , type WriteParams } from "./writers.ts" ;
1212import { decodeTokenPlanKey } from "./decode-key.ts" ;
13- import {
14- resolveRegionBaseUrl ,
15- findLatestBackup ,
16- restoreLatestBackup ,
17- } from "./writers/utils.ts" ;
13+ import { resolveRegionBaseUrl , findLatestBackup , restoreLatestBackup } from "./writers/utils.ts" ;
1814
1915const FLAGS = {
2016 agent : {
@@ -54,8 +50,7 @@ const FLAGS = {
5450 contextWindow : {
5551 type : "number" ,
5652 valueHint : "<tokens>" ,
57- description :
58- "OpenClaw only: model context window in tokens (default: 256000)" ,
53+ description : "OpenClaw only: model context window in tokens (default: 256000)" ,
5954 } ,
6055 wireApi : {
6156 type : "string" ,
@@ -85,27 +80,17 @@ export default defineCommand({
8580 ] ,
8681 validate ( flags ) {
8782 if ( flags . restore ) {
88- const writeFlags = [
89- flags . baseUrl ,
90- flags . region ,
91- flags . apiKey ,
92- flags . key ,
93- flags . model ,
94- ] ;
83+ const writeFlags = [ flags . baseUrl , flags . region , flags . apiKey , flags . key , flags . model ] ;
9584 if ( writeFlags . some ( ( value ) => value !== undefined ) ) {
9685 return "--restore cannot be combined with --base-url/--region/--api-key/--key/--model" ;
9786 }
9887 return undefined ;
9988 }
10089 if ( ! flags . model ) return "--model is required" ;
101- if ( ! flags . baseUrl && ! flags . region )
102- return "one of --base-url or --region is required" ;
103- if ( flags . baseUrl && flags . region )
104- return "--base-url and --region are mutually exclusive" ;
105- if ( ! flags . apiKey && ! flags . key )
106- return "one of --api-key or --key is required" ;
107- if ( flags . apiKey && flags . key )
108- return "--api-key and --key are mutually exclusive" ;
90+ if ( ! flags . baseUrl && ! flags . region ) return "one of --base-url or --region is required" ;
91+ if ( flags . baseUrl && flags . region ) return "--base-url and --region are mutually exclusive" ;
92+ if ( ! flags . apiKey && ! flags . key ) return "one of --api-key or --key is required" ;
93+ if ( flags . apiKey && flags . key ) return "--api-key and --key are mutually exclusive" ;
10994 return undefined ;
11095 } ,
11196 async run ( ctx ) {
@@ -146,8 +131,7 @@ export default defineCommand({
146131 if ( ! settings . quiet ) {
147132 emitBare ( `${ agentDef . label } config restored from backup.` ) ;
148133 for ( const result of results ) {
149- if ( result . backupPath )
150- emitBare ( ` Restored: ${ result . path } <- ${ result . backupPath } ` ) ;
134+ if ( result . backupPath ) emitBare ( ` Restored: ${ result . path } <- ${ result . backupPath } ` ) ;
151135 else emitBare ( ` Skipped (no backup): ${ result . path } ` ) ;
152136 }
153137 }
@@ -158,9 +142,7 @@ export default defineCommand({
158142 const model = flags . model ! ;
159143 // --region is a Token Plan convenience: convert it into a base URL and use
160144 // it exactly as --base-url would be.
161- const baseUrl = flags . region
162- ? resolveRegionBaseUrl ( flags . region )
163- : flags . baseUrl ! ;
145+ const baseUrl = flags . region ? resolveRegionBaseUrl ( flags . region ) : flags . baseUrl ! ;
164146 // --key carries the web console's obfuscated form; decode it up front so
165147 // even --dry-run validates the token.
166148 const apiKey = flags . key ? decodeTokenPlanKey ( flags . key ) : flags . apiKey ! ;
0 commit comments