fix: Bundle default policies for npx distribution (#14457)

This commit is contained in:
Allen Hutchison
2025-12-03 10:53:18 -08:00
committed by GitHub
parent b8c038f41f
commit f588219bb9

View File

@@ -31,10 +31,26 @@ if (!existsSync(bundleDir)) {
mkdirSync(bundleDir);
}
// Find and copy all .sb files from packages to the root of the bundle directory
// 1. Copy Sandbox definitions (.sb)
const sbFiles = glob.sync('packages/**/*.sb', { cwd: root });
for (const file of sbFiles) {
copyFileSync(join(root, file), join(bundleDir, basename(file)));
}
// 2. Copy Policy definitions (.toml)
const policyDir = join(bundleDir, 'policies');
if (!existsSync(policyDir)) {
mkdirSync(policyDir);
}
// Locate policy files specifically in the core package
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/`);
console.log('Assets copied to bundle/');