| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import { copyFileSync, existsSync, mkdirSync, cpSync } from 'node:fs'; |
| import { dirname, join, basename } from 'node:path'; |
| import { fileURLToPath } from 'node:url'; |
| import { glob } from 'glob'; |
|
|
| const __dirname = dirname(fileURLToPath(import.meta.url)); |
| const root = join(__dirname, '..'); |
| const bundleDir = join(root, 'bundle'); |
|
|
| |
| if (!existsSync(bundleDir)) { |
| mkdirSync(bundleDir); |
| } |
|
|
| |
| const sbFiles = glob.sync('packages/**/*.sb', { cwd: root }); |
| for (const file of sbFiles) { |
| copyFileSync(join(root, file), join(bundleDir, basename(file))); |
| } |
|
|
| |
| const policyDir = join(bundleDir, 'policies'); |
| if (!existsSync(policyDir)) { |
| mkdirSync(policyDir); |
| } |
|
|
| |
| const policyFiles = glob.sync('packages/core/src/policy/policies/*.toml', { |
| cwd: root, |
| }); |
|
|
| for (const file of policyFiles) { |
| copyFileSync(join(root, file), join(policyDir, basename(file))); |
| } |
|
|
| console.log(`Copied ${policyFiles.length} policy files to bundle/policies/`); |
|
|
| |
| const a2aPolicyDir = join(root, 'packages/a2a-server/dist/policies'); |
| if (!existsSync(a2aPolicyDir)) { |
| mkdirSync(a2aPolicyDir, { recursive: true }); |
| } |
| for (const file of policyFiles) { |
| copyFileSync(join(root, file), join(a2aPolicyDir, basename(file))); |
| } |
| console.log( |
| `Copied ${policyFiles.length} policy files to packages/a2a-server/dist/policies/`, |
| ); |
|
|
| |
| const docsSrc = join(root, 'docs'); |
| const docsDest = join(bundleDir, 'docs'); |
| if (existsSync(docsSrc)) { |
| cpSync(docsSrc, docsDest, { recursive: true, dereference: true }); |
| console.log('Copied docs to bundle/docs/'); |
| } |
|
|
| |
| const builtinSkillsSrc = join(root, 'packages/core/src/skills/builtin'); |
| const builtinSkillsDest = join(bundleDir, 'builtin'); |
| if (existsSync(builtinSkillsSrc)) { |
| cpSync(builtinSkillsSrc, builtinSkillsDest, { |
| recursive: true, |
| dereference: true, |
| }); |
| console.log('Copied built-in skills to bundle/builtin/'); |
| } |
|
|
| |
| const bundleMcpSrc = join(root, 'packages/core/dist/bundled'); |
| const bundleMcpDest = join(bundleDir, 'bundled'); |
| if (!existsSync(bundleMcpSrc)) { |
| console.error( |
| `Error: chrome-devtools-mcp bundle not found at ${bundleMcpSrc}.\n` + |
| `Run "npm run bundle:browser-mcp -w @google/gemini-cli-core" first.`, |
| ); |
| process.exit(1); |
| } |
| cpSync(bundleMcpSrc, bundleMcpDest, { recursive: true, dereference: true }); |
| console.log('Copied bundled chrome-devtools-mcp to bundle/bundled/'); |
|
|
| |
| 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/'); |
|
|