refactor(cron): simplify main-summary prefix config
This commit is contained in:
@@ -163,11 +163,7 @@ export function registerCronCli(program: Command) {
|
||||
"Do not fail the job if delivery fails",
|
||||
false,
|
||||
)
|
||||
.option(
|
||||
"--post-to-main",
|
||||
"Deprecated: isolated jobs always post a summary to main; use --post-prefix to customize",
|
||||
false,
|
||||
)
|
||||
.option("--post-to-main", "Deprecated (no-op)", false)
|
||||
.option(
|
||||
"--post-prefix <prefix>",
|
||||
"Prefix for summary system event",
|
||||
@@ -271,12 +267,16 @@ export function registerCronCli(program: Command) {
|
||||
);
|
||||
}
|
||||
|
||||
const isolation = opts.postToMain
|
||||
? {
|
||||
postToMain: true,
|
||||
postToMainPrefix: String(opts.postPrefix ?? "Cron"),
|
||||
}
|
||||
: undefined;
|
||||
const isolation =
|
||||
payload.kind === "agentTurn"
|
||||
? {
|
||||
postToMainPrefix:
|
||||
typeof opts.postPrefix === "string" &&
|
||||
opts.postPrefix.trim()
|
||||
? opts.postPrefix.trim()
|
||||
: "Cron",
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const params = {
|
||||
name:
|
||||
@@ -347,11 +347,7 @@ export function registerCronCli(program: Command) {
|
||||
"Do not fail job if delivery fails",
|
||||
false,
|
||||
)
|
||||
.option(
|
||||
"--post-to-main",
|
||||
"Deprecated: isolated jobs always post a summary to main; use --post-prefix to customize",
|
||||
false,
|
||||
)
|
||||
.option("--post-to-main", "Deprecated (no-op)", false)
|
||||
.option("--post-prefix <prefix>", "Prefix for summary system event")
|
||||
.action(async (id, opts) => {
|
||||
try {
|
||||
@@ -420,11 +416,11 @@ export function registerCronCli(program: Command) {
|
||||
};
|
||||
}
|
||||
|
||||
if (opts.postToMain) {
|
||||
if (typeof opts.postPrefix === "string") {
|
||||
patch.isolation = {
|
||||
postToMain: true,
|
||||
postToMainPrefix:
|
||||
typeof opts.postPrefix === "string" ? opts.postPrefix : "Cron",
|
||||
postToMainPrefix: opts.postPrefix.trim()
|
||||
? opts.postPrefix
|
||||
: "Cron",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user