Introspection agent demo (#15232)

This commit is contained in:
Tommaso Sciortino
2025-12-19 14:11:32 -08:00
committed by GitHub
parent db67bb106a
commit 10ba348a3a
17 changed files with 533 additions and 16 deletions

View File

@@ -18,20 +18,32 @@
// limitations under the License.
import { execSync } from 'node:child_process';
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { writeFileSync, existsSync, cpSync } from 'node:fs';
import { join, basename } from 'node:path';
if (!process.cwd().includes('packages')) {
console.error('must be invoked from a package directory');
process.exit(1);
}
const packageName = basename(process.cwd());
// build typescript files
execSync('tsc --build', { stdio: 'inherit' });
// copy .{md,json} files
execSync('node ../../scripts/copy_files.js', { stdio: 'inherit' });
// Copy documentation for the core package
if (packageName === 'core') {
const docsSource = join(process.cwd(), '..', '..', 'docs');
const docsTarget = join(process.cwd(), 'dist', 'docs');
if (existsSync(docsSource)) {
cpSync(docsSource, docsTarget, { recursive: true, dereference: true });
console.log('Copied documentation to dist/docs');
}
}
// touch dist/.last_build
writeFileSync(join(process.cwd(), 'dist', '.last_build'), '');
process.exit(0);

View File

@@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { copyFileSync, existsSync, mkdirSync } from 'node:fs';
import { copyFileSync, existsSync, mkdirSync, cpSync } from 'node:fs';
import { dirname, join, basename } from 'node:path';
import { fileURLToPath } from 'node:url';
import { glob } from 'glob';
@@ -53,4 +53,13 @@ for (const file of policyFiles) {
}
console.log(`Copied ${policyFiles.length} policy files to bundle/policies/`);
// 3. Copy Documentation (docs/)
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/');
}
console.log('Assets copied to bundle/');