_run-execute.mjs 1.29 KB
#!/usr/bin/env node
import { execFileSync } from "node:child_process";
import path from "node:path";
import process from "node:process";
import { fileURLToPath } from "node:url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, "..");

process.env.FIGMA_API_KEY = "figd_Cs0tDjz-UVojDvRlC2c-_4g5xR-hSwm7xP6kFzwd";
process.env.AI_DIRECT_OPENAI_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
process.env.AI_DIRECT_OPENAI_API_KEY = "sk-954dfaed75e040b6a06f9c908b0a8c85";
process.env.AI_DIRECT_OPENAI_MODEL = "qwen3.7-max";
process.env.AI_DIRECT_VISION_MODEL = "qwen3.6-plus";

const bundleFile = path.join(
	repoRoot,
	"apps/web/ai-workspace/.ai-direct/allocationconfirmation/allocationconfirmation.ai-direct-context-bundle.json",
);

const args = [
	"scripts/ai-direct-execute.mjs",
	"--bundle-file", bundleFile,
	"--provider", "openai-compatible",
	"--model", "qwen3.7-max",
	"--auto-repair",
	"--without-variables",
	"--preview-dir", "apps/web/ai-previews",
	"--force",
];

try {
	execFileSync(process.execPath, args, {
		cwd: repoRoot,
		stdio: "inherit",
		env: process.env,
		timeout: 600_000,
	});
	console.log("\n[run-execute] ✓ 完成");
} catch (error) {
	console.error(`\n[run-execute] ✗ 失败: ${error.message}`);
	process.exit(1);
}