stack/apps/backend/scripts/config-agent/build-image.ts
mantrakp04 b4ed4dfb2c feat: enhance GitHub config agent integration
- Added support for a new shared backend package in the pnpm workspace.
- Updated the Prisma schema to include a new field for tracking the latest config agent run state.
- Refactored config agent scripts for improved clarity and functionality, including renaming the build image script.
- Removed obsolete scripts related to linking projects to GitHub and seeding config tests.
- Introduced a new API route to retrieve the state of the most recent config agent run, enhancing user feedback during updates.

Co-Authored-By: mantra <mantra@stack-auth.com>
2026-06-26 13:50:01 -07:00

28 lines
1.2 KiB
TypeScript

/**
* One-off: builds the shared config-agent base snapshot (node24 + Claude Agent SDK
* + git bot identity; no repo, no token) that every config write warm-boots from,
* in place of a custom Docker image. Re-run when AGENT_SDK_VERSION in repo-agent.ts
* changes; old snapshots can be deleted from the Vercel dashboard.
*
* cd apps/backend && pnpm run with-env:dev tsx scripts/config-agent/build-image.ts
*
* Then set the printed id as HEXCLAVE_CONFIG_AGENT_BASE_SNAPSHOT_ID. Needs
* HEXCLAVE_VERCEL_SANDBOX_TOKEN (+ team/project ids).
*/
import { buildConfigAgentBaseSnapshot } from "@/lib/config/repo-agent";
async function main() {
const t0 = Date.now();
const { snapshotId } = await buildConfigAgentBaseSnapshot((m) => console.log(` ${m}`));
const secs = ((Date.now() - t0) / 1000).toFixed(0);
console.log(`\n✅ Base snapshot built in ${secs}s.\n`);
console.log("Set this env var so config writes warm-boot from it:\n");
console.log(` HEXCLAVE_CONFIG_AGENT_BASE_SNAPSHOT_ID=${snapshotId}\n`);
}
// eslint-disable-next-line no-restricted-syntax
main().then(() => process.exit(0)).catch((error: unknown) => {
console.error("Failed to build the config-agent base snapshot:", error);
process.exit(1);
});