@@ -137,7 +137,18 @@ async function downloadCliBinary(platform, cliVersion, cacheDir) {
137137 return cachedBinary ;
138138}
139139
140- async function buildWheel ( platform , pkgVersion , cliVersion , outputDir ) {
140+ function getCliLicensePath ( ) {
141+ // Use license from node_modules (requires npm ci in nodejs/ first)
142+ const licensePath = join ( repoRoot , "nodejs" , "node_modules" , "@github" , "copilot" , "LICENSE.md" ) ;
143+ if ( ! existsSync ( licensePath ) ) {
144+ throw new Error (
145+ `CLI LICENSE.md not found at ${ licensePath } . Run 'npm ci' in nodejs/ first.`
146+ ) ;
147+ }
148+ return licensePath ;
149+ }
150+
151+ async function buildWheel ( platform , pkgVersion , cliVersion , outputDir , licensePath ) {
141152 const [ wheelTag , binaryName ] = PLATFORMS [ platform ] ;
142153 console . log ( `\nBuilding wheel for ${ platform } ...` ) ;
143154
@@ -169,9 +180,15 @@ async function buildWheel(platform, pkgVersion, cliVersion, outputDir) {
169180 // Create __init__.py
170181 writeFileSync ( join ( binDir , "__init__.py" ) , '"""Bundled Copilot CLI binary."""\n' ) ;
171182
172- // Copy and modify pyproject.toml
183+ // Copy and modify pyproject.toml - replace license reference with file
173184 let pyprojectContent = readFileSync ( join ( pythonDir , "pyproject.toml" ) , "utf-8" ) ;
174185
186+ // Replace the license specification with file reference
187+ pyprojectContent = pyprojectContent . replace (
188+ 'license = {text = "MIT"}' ,
189+ 'license = {file = "CLI-LICENSE.md"}'
190+ ) ;
191+
175192 // Add package-data configuration
176193 const packageDataConfig = `
177194[tool.setuptools.package-data]
@@ -185,6 +202,9 @@ async function buildWheel(platform, pkgVersion, cliVersion, outputDir) {
185202 cpSync ( join ( pythonDir , "README.md" ) , join ( buildDir , "README.md" ) ) ;
186203 }
187204
205+ // Copy CLI LICENSE
206+ cpSync ( licensePath , join ( buildDir , "CLI-LICENSE.md" ) ) ;
207+
188208 // Build wheel using uv (faster and doesn't require build package to be installed)
189209 const distDir = join ( buildDir , "dist" ) ;
190210 execSync ( "uv build --wheel" , {
@@ -314,12 +334,15 @@ async function main() {
314334
315335 mkdirSync ( outputDir , { recursive : true } ) ;
316336
337+ // Get CLI license from node_modules
338+ const licensePath = getCliLicensePath ( ) ;
339+
317340 const platforms = platform ? [ platform ] : Object . keys ( PLATFORMS ) ;
318341 const wheels = [ ] ;
319342
320343 for ( const p of platforms ) {
321344 try {
322- const wheel = await buildWheel ( p , pkgVersion , cliVersion , outputDir ) ;
345+ const wheel = await buildWheel ( p , pkgVersion , cliVersion , outputDir , licensePath ) ;
323346 wheels . push ( wheel ) ;
324347 } catch ( e ) {
325348 console . error ( `Error building wheel for ${ p } :` , e . message ) ;
0 commit comments