diff --git a/package.json b/package.json index aee26de..0aaac4d 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "private": true, "packageManager": "pnpm@10.33.0", "scripts": { + "check:agent": "node scripts/check-agent.mjs test", "dev": "pnpm --filter playground dev", "build": "pnpm -r --filter './packages/*' build", "test": "pnpm -r run test", diff --git a/scripts/check-agent.mjs b/scripts/check-agent.mjs new file mode 100644 index 0000000..963b695 --- /dev/null +++ b/scripts/check-agent.mjs @@ -0,0 +1,58 @@ +#!/usr/bin/env node +import { spawnSync } from 'node:child_process'; +import { existsSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const SUBTREE = 'Visimer'; +const ROOT = dirname(dirname(fileURLToPath(import.meta.url))); +const INSTALLED = 'node_modules/.modules.yaml'; +const INSTALL = `\`pnpm install\` in ${ROOT}`; + +function refuse(message, status) { + console.error(`check:agent (${SUBTREE}): ${message}`); + process.exit(status); +} + +const [script, ...rest] = process.argv.slice(2); +if (!script || script.startsWith('-')) { + refuse( + 'the manifest must name the script this round runs, as `node scripts/check-agent.mjs