Files
memind/scripts/resolve-release-ci-status.mjs
john a6a9bb4eab feat(release): add incremental gate and auto CI status for 103 publish
When the runtime artifact is unchanged, carry forward prior gate results and
re-run only REL scenarios; resolve REL-02 from Gitea commit status and allow
stable promotion when canary matches the same artifact bundle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 08:32:12 +08:00

33 lines
1.0 KiB
JavaScript

#!/usr/bin/env node
import { runCommand } from '../release-gate/runner.mjs';
import { resolveReleaseCiStatus } from '../release-gate/ci-status.mjs';
const ROOT = new URL('..', import.meta.url).pathname;
function parseArgs(argv) {
const options = { commit: null };
for (let index = 2; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === '--commit') options.commit = argv[++index] ?? '';
else throw new Error(`Unknown argument: ${arg}`);
}
return options;
}
async function git(...args) {
const result = await runCommand('git', args, { cwd: ROOT, timeoutMs: 30_000 });
if (result.code !== 0) throw new Error(`git ${args.join(' ')} failed`);
return result.stdout.trim();
}
try {
const options = parseArgs(process.argv);
const commitSha = options.commit ?? await git('rev-parse', 'HEAD');
const status = await resolveReleaseCiStatus(commitSha);
process.stdout.write(`${status}\n`);
process.exit(status === 'success' ? 0 : 1);
} catch (error) {
console.error(error.message);
process.exit(1);
}