Clarify replay policies in skills and support force in replay-test

This commit is contained in:
gitea committed 2026-09-12 23:12:51 +08:00
1 parent 35a3374d27
commit 4bcb935d15
6 files changed
+121 -73

No files matched your search

+19 -13
View File
@@ -789,19 +789,25 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
stringOption(args.options["prod-corp"]);
const prodCorp = selectCorp(targetCorpId);
if (!prodCorp.testCorpId) {
throw usageError(
`Production enterprise '${prodCorp.name}' (${prodCorp.id}) has no bound test enterprise.\n` +
`Run 'seal-use corps bind-test ${prodCorp.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,\n` +
`or use 'seal-use webhook replay <recordId> --force' if you explicitly intend to replay directly within production.`
);
}
const force = booleanOption(args.options.force) === true;
let testCorp: CorpConfig;
const testCorp = selectCorp(prodCorp.testCorpId);
if (testCorp.environment !== "test") {
throw new Error(
`Target enterprise '${testCorp.name}' (${testCorp.id}) is marked as '${testCorp.environment}', NOT 'test'. Aborting replay to protect non-test environments.`
);
if (!prodCorp.testCorpId) {
if (!force) {
throw usageError(
`Production enterprise '${prodCorp.name}' (${prodCorp.id}) has no bound test enterprise.\n` +
`Run 'seal-use corps bind-test ${prodCorp.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,\n` +
`or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`
);
}
testCorp = prodCorp;
} else {
testCorp = selectCorp(prodCorp.testCorpId);
if (testCorp.environment !== "test" && !force) {
throw new Error(
`Target enterprise '${testCorp.name}' (${testCorp.id}) is marked as '${testCorp.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`
);
}
}
const recordId =
@@ -824,7 +830,7 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
const endDate = stringOption(args.options.endDate) ?? stringOption(args.options["end-date"]);
const prodClient = await createSealClient(prodCorp);
const testClient = await createSealClient(testCorp);
const testClient = prodCorp.id === testCorp.id ? prodClient : await createSealClient(testCorp);
const selector = stringOption(args.options.webhook) ?? stringOption(args.options.selector);
const snSuffix = stringOption(args.options.snSuffix) ?? stringOption(args.options["sn-suffix"]);