From 2b6dab61369af5b36dda3f19a2e41a9e3b529129 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Thu, 16 Apr 2026 15:11:03 -0400 Subject: [PATCH] fix(extensions): fix bundling for examples (#25542) --- package-lock.json | 1 + package.json | 1 + scripts/copy_bundle_assets.js | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/package-lock.json b/package-lock.json index 2deefae51f..edc96948c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,6 +62,7 @@ "prettier": "^3.5.3", "react-devtools-core": "^6.1.2", "react-dom": "^19.2.0", + "read-package-up": "^11.0.0", "semver": "^7.7.2", "strip-ansi": "^7.1.2", "ts-prune": "^0.10.3", diff --git a/package.json b/package.json index 7746d5e87e..ef8e34fc3c 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ ], "devDependencies": { "@agentclientprotocol/sdk": "^0.16.1", + "read-package-up": "^11.0.0", "@octokit/rest": "^22.0.0", "@types/marked": "^5.0.2", "@types/mime-types": "^3.0.1", diff --git a/scripts/copy_bundle_assets.js b/scripts/copy_bundle_assets.js index 667e911f0e..f1ea297ba9 100644 --- a/scripts/copy_bundle_assets.js +++ b/scripts/copy_bundle_assets.js @@ -120,4 +120,21 @@ if (existsSync(ripgrepVendorSrc)) { console.log('Copied ripgrep vendor binaries to bundle/vendor/ripgrep/'); } +// 8. Copy Extension Examples +const extensionExamplesSrc = join( + root, + 'packages/cli/src/commands/extensions/examples', +); +const extensionExamplesDest = join(bundleDir, 'examples'); +const EXCLUDED_EXAMPLE_DIRS = ['node_modules', 'dist']; + +if (existsSync(extensionExamplesSrc)) { + cpSync(extensionExamplesSrc, extensionExamplesDest, { + recursive: true, + dereference: true, + filter: (src) => !EXCLUDED_EXAMPLE_DIRS.some((dir) => src.includes(dir)), + }); + console.log('Copied extension examples to bundle/examples/'); +} + console.log('Assets copied to bundle/');