mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 11:00:22 +08:00
feat: 发布 1.1.1,回退上一句并清掉待发送队列
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
25e415ca7c
commit
3f5c0c8281
7 files changed
+986
-25
No files matched your search
+29
-7
@@ -3266,10 +3266,14 @@ function patchApplied(text, patch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function patchHasRemainingWork(text, patch) {
|
||||
function patchHasRemainingWork(text, patch, fp = "") {
|
||||
const hay = asLf(text);
|
||||
const yaml = isYamlPath(fp);
|
||||
for (const { pattern, replace } of patchReplacements(patch)) {
|
||||
if (pattern && typeof replace === "string" && hay.includes(asLf(pattern))) return true;
|
||||
if (!pattern || typeof replace !== "string") continue;
|
||||
// 与 apply 一致:YAML 里无缩进 identity 不能 replaceAll,不算待做。
|
||||
if (yaml && isBareIdentityNeedle(pattern)) continue;
|
||||
if (hay.includes(asLf(pattern))) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -3286,13 +3290,20 @@ function isLayoutSoftPatch(patch) {
|
||||
return isIdentityLayoutPatch(patch) || isApprovalSentencePatch(patch);
|
||||
}
|
||||
|
||||
function filePatchSettled(text, patch) {
|
||||
function filePatchSettled(text, patch, fp = "") {
|
||||
if (patchApplied(text, patch)) return true;
|
||||
// 官方副本布局不同、或审批句已被 0.1.5 改写时,没有残留 pattern 就算完成。
|
||||
if (isLayoutSoftPatch(patch)) return !patchHasRemainingWork(text, patch);
|
||||
if (isLayoutSoftPatch(patch)) return !patchHasRemainingWork(text, patch, fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
function filePatchOutcome(text, patch, fp = "") {
|
||||
if (filePatchSettled(text, patch, fp)) return "applied";
|
||||
if (patchHasRemainingWork(text, patch, fp)) return "pending";
|
||||
// 原文对不上、再点应用也变不了:可选/布局软补丁显示跳过,不再假装待应用。
|
||||
return "skipped";
|
||||
}
|
||||
|
||||
function fileKeysOf(p) {
|
||||
return Array.isArray(p.file) ? p.file : [p.file];
|
||||
}
|
||||
@@ -3444,7 +3455,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (filePatchSettled(text, p)) {
|
||||
if (filePatchSettled(text, p, fp)) {
|
||||
if (p.id === 21 && webFetchWorkspacePaths(aiBase) && !webFetchWorkspaceLinkReady(aiBase)) {
|
||||
const linked = ensureWebFetchWorkspaceLink(aiBase);
|
||||
lastError = linked.status;
|
||||
@@ -3484,6 +3495,7 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) {
|
||||
const keys = fileKeysOf(p);
|
||||
let applied = 0;
|
||||
let pending = 0;
|
||||
let skipped = 0;
|
||||
let missing = 0;
|
||||
for (const key of keys) {
|
||||
const fps = pathsOf(files, key);
|
||||
@@ -3502,12 +3514,19 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) {
|
||||
const runtimeReady = p.id !== 21
|
||||
|| !webFetchWorkspacePaths(aiBase)
|
||||
|| webFetchWorkspaceLinkReady(aiBase);
|
||||
if (filePatchSettled(text, p) && runtimeReady) applied += 1;
|
||||
else pending += 1;
|
||||
if (!runtimeReady) {
|
||||
pending += 1;
|
||||
continue;
|
||||
}
|
||||
const outcome = filePatchOutcome(text, p, fp);
|
||||
if (outcome === "applied") applied += 1;
|
||||
else if (outcome === "pending") pending += 1;
|
||||
else skipped += 1;
|
||||
}
|
||||
}
|
||||
if (pending > 0) status[p.id] = "pending";
|
||||
else if (applied > 0) status[p.id] = "applied";
|
||||
else if (skipped > 0) status[p.id] = "skipped";
|
||||
else status[p.id] = "missing_file";
|
||||
}
|
||||
return status;
|
||||
@@ -3984,9 +4003,11 @@ export async function gatherState() {
|
||||
const patch_status = aiBase ? await patchStatus(aiBase) : {};
|
||||
let patches_applied = 0;
|
||||
let patches_pending = 0;
|
||||
let patches_skipped = 0;
|
||||
for (const s of Object.values(patch_status)) {
|
||||
if (s === "applied") patches_applied += 1;
|
||||
if (s === "pending") patches_pending += 1;
|
||||
if (s === "skipped" || s === "missing_file") patches_skipped += 1;
|
||||
}
|
||||
let shim_cmd = "missing";
|
||||
let shim_ps1 = "missing";
|
||||
@@ -4005,6 +4026,7 @@ export async function gatherState() {
|
||||
patch_status,
|
||||
patches_applied,
|
||||
patches_pending,
|
||||
patches_skipped,
|
||||
has_backup: aiBase ? await hasBackup(aiBase) : false,
|
||||
shim_cmd,
|
||||
shim_ps1,
|
||||
|
||||
Reference in new issue
Block a user