@@ -21,8 +21,10 @@ import { defineConfig, loadEnv, type Plugin } from "vite";
2121import tsconfigPaths from "vite-tsconfig-paths" ;
2222// @ts -expect-error - plain ESM helper shared with packages/agent/tsup.config.ts
2323import {
24+ CLAUDE_CLI_SUPPORT_DIRS ,
25+ CLAUDE_CLI_SUPPORT_FILES ,
2426 claudeBinName ,
25- nativeBinaryCandidates as sdkNativeBinaryCandidates ,
27+ claudeExecutableCandidates as sdkClaudeExecutableCandidates ,
2628 targetArch ,
2729 targetPlatform ,
2830} from "../../packages/agent/build/native-binary.mjs" ;
@@ -145,6 +147,24 @@ function signClaudeBinary(destPath: string): void {
145147 }
146148}
147149
150+ function copyClaudeSupportAssets ( sourcePath : string , destDir : string ) : void {
151+ const sourceDir = dirname ( sourcePath ) ;
152+
153+ for ( const file of CLAUDE_CLI_SUPPORT_FILES ) {
154+ const source = join ( sourceDir , file ) ;
155+ if ( existsSync ( source ) ) {
156+ copyFileSync ( source , join ( destDir , file ) ) ;
157+ }
158+ }
159+
160+ for ( const dir of CLAUDE_CLI_SUPPORT_DIRS ) {
161+ const source = join ( sourceDir , dir ) ;
162+ if ( existsSync ( source ) ) {
163+ cpSync ( source , join ( destDir , dir ) , { recursive : true } ) ;
164+ }
165+ }
166+ }
167+
148168function copyClaudeExecutable ( ) : Plugin {
149169 return {
150170 name : "copy-claude-executable" ,
@@ -170,8 +190,8 @@ function copyClaudeExecutable(): Plugin {
170190 binName ,
171191 ) ,
172192 join ( __dirname , "../../packages/agent/dist/claude-cli" , binName ) ,
173- ...sdkNativeBinaryCandidates ( join ( __dirname , "node_modules" ) ) ,
174- ...sdkNativeBinaryCandidates ( join ( __dirname , "../../node_modules" ) ) ,
193+ ...sdkClaudeExecutableCandidates ( join ( __dirname , "node_modules" ) ) ,
194+ ...sdkClaudeExecutableCandidates ( join ( __dirname , "../../node_modules" ) ) ,
175195 ] ;
176196
177197 const source = packageCandidates . find ( ( p : string ) => existsSync ( p ) ) ;
@@ -187,6 +207,7 @@ function copyClaudeExecutable(): Plugin {
187207 if ( targetPlatform ( ) !== "win32" ) {
188208 execSync ( `chmod +x "${ destBinary } "` ) ;
189209 }
210+ copyClaudeSupportAssets ( source , destDir ) ;
190211 verifyBinaryArch ( destBinary ) ;
191212 signClaudeBinary ( destBinary ) ;
192213 claudeCliCopied = true ;
0 commit comments