cwm-assistant 0.4.2 → 0.4.3
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.
|
@@ -2619,7 +2619,7 @@ var Type = type_exports2;
|
|
|
2619
2619
|
|
|
2620
2620
|
// ../../packages/contracts/src/assistant.ts
|
|
2621
2621
|
var ASSISTANT_PROTOCOL = 1;
|
|
2622
|
-
var ASSISTANT_VERSION = "0.4.
|
|
2622
|
+
var ASSISTANT_VERSION = "0.4.3";
|
|
2623
2623
|
var ASSISTANT_PORT = 46322;
|
|
2624
2624
|
|
|
2625
2625
|
// ../../packages/contracts/src/index.ts
|
|
@@ -5959,7 +5959,7 @@ async function frozenRefs(git4, cwd) {
|
|
|
5959
5959
|
}
|
|
5960
5960
|
function scopeStatus(conflict, branches, nonVersionEntries) {
|
|
5961
5961
|
if (conflict) return "CONFLICT";
|
|
5962
|
-
return branches.some((branch) => (branch.missingCommits || []).length) || nonVersionEntries.length ? "WARN" : "PASS";
|
|
5962
|
+
return branches.some((branch) => branch.unresolved || (branch.missingCommits || []).length) || nonVersionEntries.length ? "WARN" : "PASS";
|
|
5963
5963
|
}
|
|
5964
5964
|
async function branchScope(git4, cwd, productionSha, stagingSha, refs, branches, production, staging) {
|
|
5965
5965
|
const nodes = lines(
|
|
@@ -5974,6 +5974,10 @@ async function branchScope(git4, cwd, productionSha, stagingSha, refs, branches,
|
|
|
5974
5974
|
};
|
|
5975
5975
|
const accounted = /* @__PURE__ */ new Set();
|
|
5976
5976
|
for (const branch of branches) {
|
|
5977
|
+
if (branch.unresolved) {
|
|
5978
|
+
branch.status = "UNRESOLVED";
|
|
5979
|
+
continue;
|
|
5980
|
+
}
|
|
5977
5981
|
const expected = [...await history(branch.sha)];
|
|
5978
5982
|
branch.expectedCommits = expected;
|
|
5979
5983
|
branch.coveredCommits = expected.filter((sha) => incoming.has(sha));
|
|
@@ -6067,6 +6071,7 @@ function reviewLabel(status) {
|
|
|
6067
6071
|
return status === "PASS" ? "\u5BA1\u67E5\u901A\u8FC7" : "\u5BA1\u67E5\u4E0D\u901A\u8FC7";
|
|
6068
6072
|
}
|
|
6069
6073
|
function inclusionLabel(branch, incomplete) {
|
|
6074
|
+
if (branch.unresolved) return "\u5206\u652F\u5F02\u5E38\uFF1A" + branch.unresolved;
|
|
6070
6075
|
if (incomplete || !branch.expectedCommits) return "\u672A\u5B8C\u6210\u68C0\u67E5";
|
|
6071
6076
|
const missing = branch.missingCommits || [];
|
|
6072
6077
|
if (!missing.length) return "\u5DF2\u5305\u542B";
|
|
@@ -6087,25 +6092,31 @@ function readableReport(snapshot, result, createdAt, _runId) {
|
|
|
6087
6092
|
"\u7ED3\u679C\uFF1A" + reviewLabel(result),
|
|
6088
6093
|
"\u5BA1\u67E5\u65F6\u95F4\uFF1A" + createdAt,
|
|
6089
6094
|
...uncoveredRequirementLines(snapshot.uncoveredRequirements),
|
|
6090
|
-
...snapshot.results.flatMap((repo) =>
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
...repo.error ? [repo.error] : [],
|
|
6094
|
-
...repo.status === "CONFLICT" ? ["staging \u5408\u5165 production \u5B58\u5728\u51B2\u7A81"] : [],
|
|
6095
|
-
"| \u7248\u672C\u5185\u5206\u652F | staging \u662F\u5426\u5305\u542B |",
|
|
6096
|
-
"| --- | --- |",
|
|
6097
|
-
...repo.branches.map(
|
|
6098
|
-
(b) => `| ${safe(b.name)} | ${inclusionLabel(b, repo.status === "ERROR")} |`
|
|
6099
|
-
),
|
|
6100
|
-
...(repo.nonVersionEntries || []).length ? [
|
|
6095
|
+
...snapshot.results.flatMap((repo) => {
|
|
6096
|
+
const unresolved = (repo.branches || []).filter((branch) => branch.unresolved);
|
|
6097
|
+
return [
|
|
6101
6098
|
"",
|
|
6102
|
-
"
|
|
6099
|
+
"## " + repo.alias,
|
|
6100
|
+
...repo.error ? [repo.error] : [],
|
|
6101
|
+
...unresolved.length ? [
|
|
6102
|
+
"\u5206\u652F\u5F02\u5E38\uFF08\u8FDC\u7AEF\u4E0D\u5B58\u5728\uFF0C\u53EF\u80FD\u5C1A\u672A\u63A8\u9001\uFF1B\u540C\u4ED3\u5E93\u5176\u4ED6\u5206\u652F\u5DF2\u7167\u5E38\u68C0\u67E5\uFF09\uFF1A" + unresolved.map((branch) => branch.name).join("\u3001")
|
|
6103
|
+
] : [],
|
|
6104
|
+
...repo.status === "CONFLICT" ? ["staging \u5408\u5165 production \u5B58\u5728\u51B2\u7A81"] : [],
|
|
6105
|
+
"| \u7248\u672C\u5185\u5206\u652F | staging \u662F\u5426\u5305\u542B |",
|
|
6103
6106
|
"| --- | --- |",
|
|
6104
|
-
...repo.
|
|
6105
|
-
(
|
|
6106
|
-
)
|
|
6107
|
-
|
|
6108
|
-
|
|
6107
|
+
...repo.branches.map(
|
|
6108
|
+
(b) => `| ${safe(b.name)} | ${inclusionLabel(b, repo.status === "ERROR")} |`
|
|
6109
|
+
),
|
|
6110
|
+
...(repo.nonVersionEntries || []).length ? [
|
|
6111
|
+
"",
|
|
6112
|
+
"| staging \u591A\u51FA\u7684\u975E\u7248\u672C\u5185\u5206\u652F / commit ID | \u7ED3\u679C |",
|
|
6113
|
+
"| --- | --- |",
|
|
6114
|
+
...repo.nonVersionEntries.map(
|
|
6115
|
+
(entry) => `| ${safe(entry.name || entry.sha)} | ${safe(entry.reason)} |`
|
|
6116
|
+
)
|
|
6117
|
+
] : []
|
|
6118
|
+
];
|
|
6119
|
+
})
|
|
6109
6120
|
].join("\n");
|
|
6110
6121
|
}
|
|
6111
6122
|
|
|
@@ -6180,14 +6191,19 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
|
|
|
6180
6191
|
await git3(root, ["clone", "--no-checkout", "--no-local", "--", remote, directory]);
|
|
6181
6192
|
result2.remoteRefs = await frozenRefs(git3, directory);
|
|
6182
6193
|
log("\u5DF2\u83B7\u53D6\u8FDC\u7AEF\u5FEB\u7167\uFF1A" + repo.alias);
|
|
6183
|
-
const
|
|
6184
|
-
|
|
6185
|
-
|
|
6194
|
+
const cleanBranchName = (branch) => branch.replace(/^refs\/remotes\/origin\//, "").replace(/^origin\//, "").replace(/^refs\/heads\//, "");
|
|
6195
|
+
const resolveOptional = async (branch) => {
|
|
6196
|
+
if (!valid(branch)) return { sha: "", error: "\u9700\u6C42\u5206\u652F\u540D\u65E0\u6548\u6216\u7F3A\u5931" };
|
|
6197
|
+
const clean = cleanBranchName(branch);
|
|
6186
6198
|
const ref = result2.remoteRefs.find(
|
|
6187
6199
|
(item) => item.name === clean
|
|
6188
6200
|
);
|
|
6189
|
-
|
|
6190
|
-
|
|
6201
|
+
return ref ? { sha: ref.sha, error: "" } : { sha: "", error: repo.alias + "\uFF1A\u8FDC\u7AEF\u5206\u652F\u4E0D\u5B58\u5728\uFF1A" + clean };
|
|
6202
|
+
};
|
|
6203
|
+
const resolveBranch = async (branch) => {
|
|
6204
|
+
const { sha, error } = await resolveOptional(branch);
|
|
6205
|
+
if (!sha) throw new Error(error);
|
|
6206
|
+
return sha;
|
|
6191
6207
|
};
|
|
6192
6208
|
const compareName = (repo.compare_branch || "").replace(/^origin\//, "") || production;
|
|
6193
6209
|
const baseSha = await resolveBranch(compareName).catch(() => "");
|
|
@@ -6224,12 +6240,16 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
|
|
|
6224
6240
|
log("\u4ED3\u5E93\u5FEB\u7167\u5DF2\u83B7\u53D6\uFF1A" + repo.alias);
|
|
6225
6241
|
const p = await resolveBranch(production), s = await resolveBranch(staging);
|
|
6226
6242
|
result2.refs = { production: p, staging: s };
|
|
6227
|
-
for (const branch of [...new Set(activeEntries.map((entry) => entry.branch))])
|
|
6243
|
+
for (const branch of [...new Set(activeEntries.map((entry) => entry.branch))]) {
|
|
6244
|
+
const resolution = await resolveOptional(branch);
|
|
6228
6245
|
result2.branches.push({
|
|
6229
6246
|
name: branch,
|
|
6230
|
-
sha:
|
|
6247
|
+
sha: resolution.sha,
|
|
6248
|
+
...resolution.error ? { unresolved: resolution.error } : {},
|
|
6231
6249
|
requirementIds: activeEntries.filter((entry) => entry.branch === branch).map((entry) => entry.requirement_id)
|
|
6232
6250
|
});
|
|
6251
|
+
if (resolution.error) log(resolution.error);
|
|
6252
|
+
}
|
|
6233
6253
|
log("\u5F00\u59CB\u5B8C\u6574\u6027\u68C0\u67E5\uFF1A" + repo.alias);
|
|
6234
6254
|
let mergeConflict = false;
|
|
6235
6255
|
try {
|
|
@@ -6950,4 +6970,4 @@ async function cli(args, entry) {
|
|
|
6950
6970
|
export {
|
|
6951
6971
|
cli
|
|
6952
6972
|
};
|
|
6953
|
-
//# sourceMappingURL=cli-
|
|
6973
|
+
//# sourceMappingURL=cli-7R2P2XQE.js.map
|