@@ -6,26 +6,23 @@ import { resolveExecApprovalsPath } from "./exec-approvals-config.js";
66const DOCTOR_CLAIM_SUFFIX = ".doctor-importing" ;
77const legacyPresenceCache = new Map < string , boolean > ( ) ;
88
9- /** POSIX single-quote so a state directory containing spaces stays one shell word. */
10- function shellQuoteStateDir ( stateDir : string ) : string {
11- return `'${ stateDir . replaceAll ( "'" , "'\\''" ) } '` ;
12- }
13-
149/**
1510 * Doctor repairs whichever state directory its own environment resolves to, so a bare
1611 * `openclaw doctor --fix` repairs the default root while a scoped install stays blocked.
17- * Name the directory whenever this process is scoped to a non-default one.
12+ * Name the directory whenever this process is scoped to a non-default one. Say it in
13+ * prose rather than as a `VAR=value cmd` one-liner, which no Windows shell accepts.
1814 */
19- function formatDoctorFixCommand ( filePath : string ) : string {
15+ function doctorFixInstruction ( filePath : string ) : string {
16+ const command = "Run `openclaw doctor --fix`" ;
2017 return process . env . OPENCLAW_STATE_DIR ?. trim ( )
21- ? `OPENCLAW_STATE_DIR= ${ shellQuoteStateDir ( path . dirname ( filePath ) ) } openclaw doctor --fix `
22- : "openclaw doctor --fix" ;
18+ ? `${ command } with OPENCLAW_STATE_DIR set to ${ path . dirname ( filePath ) } `
19+ : command ;
2320}
2421
2522export class ExecApprovalsMigrationRequiredError extends Error {
2623 constructor ( filePath : string ) {
2724 super (
28- `Legacy exec approvals exist at ${ filePath } . Run \` ${ formatDoctorFixCommand ( filePath ) } \` before using exec approvals.` ,
25+ `Legacy exec approvals exist at ${ filePath } . ${ doctorFixInstruction ( filePath ) } before using exec approvals.` ,
2926 ) ;
3027 this . name = "ExecApprovalsMigrationRequiredError" ;
3128 }
0 commit comments