fix: restore jd01 sentinel follower status
This commit is contained in:
+24
-2
@@ -230,7 +230,7 @@ export function cicdHelp(): unknown {
|
||||
"bun scripts/cli.ts cicd branch-follower status --live",
|
||||
"bun scripts/cli.ts cicd branch-follower run-once --all --dry-run",
|
||||
"bun scripts/cli.ts cicd branch-follower run-once --follower hwlab-jd01-v03 --confirm --wait",
|
||||
"bun scripts/cli.ts cicd branch-follower events --follower agentrun-d601-v02",
|
||||
"bun scripts/cli.ts cicd branch-follower events --follower agentrun-jd01-v02",
|
||||
"bun scripts/cli.ts cicd branch-follower logs --follower web-probe-sentinel-master",
|
||||
],
|
||||
config: DEFAULT_CONFIG_PATH,
|
||||
@@ -869,7 +869,8 @@ async function readAdapterStatus(follower: FollowerSpec, options: ParsedOptions)
|
||||
"sourceCommit",
|
||||
"observedSha",
|
||||
"alignment.sourceCommit",
|
||||
], ["sourceCommit", "observedSha", "observedCommit", "selectedCommit", "selectedSourceCommit"]);
|
||||
], ["sourceCommit", "observedSha", "observedCommit", "selectedCommit", "selectedSourceCommit"])
|
||||
?? adapterObservedShaFromText(result.stdout, follower);
|
||||
const targetSha = firstStringPath(body, [
|
||||
"summary.targetCommit",
|
||||
"summary.targetSha",
|
||||
@@ -1367,6 +1368,27 @@ function firstStringByKey(root: unknown, keys: string[]): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function adapterObservedShaFromText(stdout: string, follower: FollowerSpec): string | null {
|
||||
if (stdout.trim().length === 0) return null;
|
||||
const branch = escapeRegex(follower.source.branch);
|
||||
const sourceLine = new RegExp(`${escapeRegex(follower.source.repository)}@${branch}\\s+([0-9a-f]{12,40})`, "iu").exec(stdout);
|
||||
if (sourceLine !== null) return sourceLine[1];
|
||||
for (const pattern of [
|
||||
/"sourceCommit"\s*:\s*"([0-9a-f]{40})"/iu,
|
||||
/"commit"\s*:\s*"([0-9a-f]{40})"/iu,
|
||||
/sourceCommit['"]?\s*[:=]\s*['"]?([0-9a-f]{40})/iu,
|
||||
/\bcommit['"]?\s*[:=]\s*['"]?([0-9a-f]{40})/iu,
|
||||
]) {
|
||||
const match = pattern.exec(stdout);
|
||||
if (match !== null) return match[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function escapeRegex(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
||||
}
|
||||
|
||||
function recordAt(root: Record<string, unknown>, path: string[]): Record<string, unknown> | null {
|
||||
let current: unknown = root;
|
||||
for (const item of path) {
|
||||
|
||||
Reference in New Issue
Block a user