taskplane 0.5.8 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1163,46 +1163,74 @@ export default function (pi: ExtensionAPI) {
|
|
|
1163
1163
|
);
|
|
1164
1164
|
|
|
1165
1165
|
// ── Step 3: Execute integration mode ─────────────────
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
} catch (err: unknown) {
|
|
1178
|
-
const e = err as { stdout?: string; stderr?: string; message?: string };
|
|
1179
|
-
return {
|
|
1180
|
-
ok: false,
|
|
1181
|
-
stdout: (e.stdout ?? "").toString().trim(),
|
|
1182
|
-
stderr: (e.stderr ?? e.message ?? "unknown error").toString().trim(),
|
|
1183
|
-
};
|
|
1166
|
+
// In workspace mode, integrate in every repo that has the orch branch.
|
|
1167
|
+
const resolvedOrchBranch = (resolution as IntegrationContext).orchBranch;
|
|
1168
|
+
const wsConfig = execCtx!.workspaceConfig;
|
|
1169
|
+
const reposToIntegrate: { id: string; root: string }[] = [];
|
|
1170
|
+
|
|
1171
|
+
if (wsConfig) {
|
|
1172
|
+
for (const [repoId, repoConf] of wsConfig.repos) {
|
|
1173
|
+
// Check if orch branch exists in this repo
|
|
1174
|
+
const branchCheck = runGit(["rev-parse", "--verify", `refs/heads/${resolvedOrchBranch}`], repoConf.path);
|
|
1175
|
+
if (branchCheck.ok) {
|
|
1176
|
+
reposToIntegrate.push({ id: repoId, root: repoConf.path });
|
|
1184
1177
|
}
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
if (!integrationResult.success) {
|
|
1190
|
-
ctx.ui.notify(integrationResult.error!, "error");
|
|
1191
|
-
return;
|
|
1178
|
+
}
|
|
1179
|
+
} else {
|
|
1180
|
+
reposToIntegrate.push({ id: "(default)", root: repoRoot });
|
|
1192
1181
|
}
|
|
1193
1182
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1183
|
+
let totalCommits = 0;
|
|
1184
|
+
let allSucceeded = true;
|
|
1185
|
+
const repoMessages: string[] = [];
|
|
1186
|
+
|
|
1187
|
+
for (const repo of reposToIntegrate) {
|
|
1188
|
+
const integrationResult = executeIntegration(parsed.mode, resolution as IntegrationContext, {
|
|
1189
|
+
runGit: (gitArgs: string[]) => runGit(gitArgs, repo.root),
|
|
1190
|
+
runCommand: (cmd: string, cmdArgs: string[]) => {
|
|
1191
|
+
try {
|
|
1192
|
+
const stdout = execFileSync(cmd, cmdArgs, {
|
|
1193
|
+
encoding: "utf-8",
|
|
1194
|
+
timeout: 60_000,
|
|
1195
|
+
cwd: repo.root,
|
|
1196
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1197
|
+
}).trim();
|
|
1198
|
+
return { ok: true, stdout, stderr: "" };
|
|
1199
|
+
} catch (err: unknown) {
|
|
1200
|
+
const e = err as { stdout?: string; stderr?: string; message?: string };
|
|
1201
|
+
return {
|
|
1202
|
+
ok: false,
|
|
1203
|
+
stdout: (e.stdout ?? "").toString().trim(),
|
|
1204
|
+
stderr: (e.stderr ?? e.message ?? "unknown error").toString().trim(),
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
deleteBatchState: () => { /* handled once after all repos */ },
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
if (!integrationResult.success) {
|
|
1212
|
+
ctx.ui.notify(`❌ Integration failed in ${repo.id}:\n${integrationResult.error}`, "error");
|
|
1213
|
+
allSucceeded = false;
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// Count commits for this repo
|
|
1218
|
+
const countResult = runGit(["rev-list", "--count", `HEAD...${resolvedOrchBranch}`], repo.root);
|
|
1219
|
+
const repoCommits = countResult.ok ? parseInt(countResult.stdout) || 0 : 0;
|
|
1220
|
+
totalCommits += repoCommits;
|
|
1221
|
+
repoMessages.push(` ${repo.id}: ${integrationResult.message}`);
|
|
1197
1222
|
}
|
|
1198
1223
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1224
|
+
if (!allSucceeded) return;
|
|
1225
|
+
|
|
1226
|
+
// Clean up batch state after all repos integrated
|
|
1227
|
+
try { deleteBatchState(repoRoot); } catch { /* best effort */ }
|
|
1228
|
+
|
|
1229
|
+
const summary = wsConfig
|
|
1230
|
+
? `✅ Integrated ${resolvedOrchBranch} across ${reposToIntegrate.length} repo(s).\n${repoMessages.join("\n")}\n${totalCommits} total commit(s) applied.`
|
|
1231
|
+
: `${repoMessages[0] || "✅ Integrated."}\n${commitsAhead} commit(s) applied.`;
|
|
1232
|
+
|
|
1233
|
+
ctx.ui.notify(summary, "info");
|
|
1206
1234
|
},
|
|
1207
1235
|
});
|
|
1208
1236
|
|