@siming-org/cli 0.8.8 → 0.8.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.
- package/dist/index.js +52 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1458,10 +1458,27 @@ var defaultGitRunner = async (args, cwd) => {
|
|
|
1458
1458
|
return { ok: false, stdout: e.stdout ?? "", stderr: e.stderr ?? e.message ?? String(err2) };
|
|
1459
1459
|
}
|
|
1460
1460
|
};
|
|
1461
|
+
var KNOWN_BRANCH_PREFIXES = ["refs/remotes/origin/", "refs/heads/", "refs/remotes/", "origin/"];
|
|
1462
|
+
function normalizeBaseBranch(raw) {
|
|
1463
|
+
let name = raw.trim();
|
|
1464
|
+
let stripped = true;
|
|
1465
|
+
while (stripped) {
|
|
1466
|
+
stripped = false;
|
|
1467
|
+
for (const prefix of KNOWN_BRANCH_PREFIXES) {
|
|
1468
|
+
if (name.startsWith(prefix)) {
|
|
1469
|
+
name = name.slice(prefix.length);
|
|
1470
|
+
stripped = true;
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return name.length > 0 ? name : null;
|
|
1476
|
+
}
|
|
1461
1477
|
async function resolveCheckContextWithRunner(base, vcs, cwd, scan) {
|
|
1462
1478
|
const result = scan !== void 0 ? scan(cwd) : scanWorkspaceRepos(cwd);
|
|
1463
1479
|
const alignRecord = base.nodeRecords["ALIGN"];
|
|
1464
|
-
const
|
|
1480
|
+
const normalizeSource = (value) => value !== void 0 && value !== "" ? normalizeBaseBranch(value) : null;
|
|
1481
|
+
const baseBranch = normalizeSource(alignRecord?.baseBranch) ?? normalizeSource(vcs.baseBranch) ?? null;
|
|
1465
1482
|
return {
|
|
1466
1483
|
...base,
|
|
1467
1484
|
repos: result.repos,
|
|
@@ -3742,7 +3759,7 @@ function createTaskCommand() {
|
|
|
3742
3759
|
renderResult(opts.format, result, { fields: result.success ? nodeFields(result.data) : [] });
|
|
3743
3760
|
});
|
|
3744
3761
|
const record = task.command("record").description("Node execution records \u2014 summary/checks/artifacts/confirmations/decisions/review (draft-writable, small-step append)");
|
|
3745
|
-
withCommonOpts(record.command("set <taskId>"), "fancy").description("Set node record fields \u2014 --summary and/or structured fields (T202609230001: baseBranch/testReport/... ; at least one required)").requiredOption("--node <nid>", "node id (see `task context`)").option("--summary <text>", "node summary text").option("--base-branch <branch>", "align \u57FA\u7840\u5206\u652F\uFF08test-integrate \u7B49\u8282\u70B9\u7ED3\u6784\u5316\u5199\u5165\uFF09").option("--verified-commit <sha>", "\u9A8C\u8BC1\u901A\u8FC7\u5BF9\u5E94\u7684\u63D0\u4EA4\u53F7\uFF08verifiedCommit\uFF09").option("--fixes-applied <n>", "fixesApplied \u4FEE\u590D\u6B21\u6570\uFF08\u975E\u8D1F\u6574\u6570\uFF1BB4 \u6761\u4EF6\u95E8\u7981\uFF1A>0 \u987B\u8BC4\u5BA1 verdict=pass\uFF09").option("--test-report <json>", `testReport JSON\uFF1A'{"command":"pnpm test","passed":10,"failed":0,"skipped":0}'`).option("--deferred-issues <list>", "\u5EF6\u540E\u95EE\u9898 id \u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09").option("--evidence-files <list>", "\u8BC1\u636E\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09").action(
|
|
3762
|
+
withCommonOpts(record.command("set <taskId>"), "fancy").description("Set node record fields \u2014 --summary and/or structured fields (T202609230001: baseBranch/testReport/... ; at least one required)").requiredOption("--node <nid>", "node id (see `task context`)").option("--summary <text>", "node summary text").option("--base-branch <branch>", "align \u57FA\u7840\u5206\u652F\uFF08test-integrate \u7B49\u8282\u70B9\u7ED3\u6784\u5316\u5199\u5165\uFF09").option("--verified-commit <sha>", "\u9A8C\u8BC1\u901A\u8FC7\u5BF9\u5E94\u7684\u63D0\u4EA4\u53F7\uFF08verifiedCommit\uFF09").option("--fixes-applied <n>", "fixesApplied \u4FEE\u590D\u6B21\u6570\uFF08\u975E\u8D1F\u6574\u6570\uFF1BB4 \u6761\u4EF6\u95E8\u7981\uFF1A>0 \u987B\u8BC4\u5BA1 verdict=pass\uFF09").option("--test-report <json>", `testReport JSON\uFF1A'{"command":"pnpm test","passed":10,"failed":0,"skipped":0}'`).option("--deferred-issues <list>", "\u5EF6\u540E\u95EE\u9898 id \u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\u6216 JSON \u5B57\u7B26\u4E32\u6570\u7EC4\uFF09").option("--evidence-files <list>", "\u8BC1\u636E\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\u6216 JSON \u5B57\u7B26\u4E32\u6570\u7EC4\uFF09").action(
|
|
3746
3763
|
async (taskId, opts) => {
|
|
3747
3764
|
const client = createClient(opts.url);
|
|
3748
3765
|
let fixesApplied;
|
|
@@ -3763,9 +3780,39 @@ function createTaskCommand() {
|
|
|
3763
3780
|
return;
|
|
3764
3781
|
}
|
|
3765
3782
|
}
|
|
3766
|
-
const
|
|
3767
|
-
|
|
3768
|
-
|
|
3783
|
+
const parseListField = (label, raw) => {
|
|
3784
|
+
const trimmed = raw.trim();
|
|
3785
|
+
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
3786
|
+
try {
|
|
3787
|
+
const parsed = JSON.parse(trimmed);
|
|
3788
|
+
if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
|
|
3789
|
+
return { ok: true, value: parsed.filter((s) => s.trim().length > 0) };
|
|
3790
|
+
}
|
|
3791
|
+
return { ok: false, message: `${label} JSON \u6570\u7EC4\u5143\u7D20\u987B\u5168\u4E3A\u5B57\u7B26\u4E32\uFF08\u6536\u5230 ${raw}\uFF09` };
|
|
3792
|
+
} catch {
|
|
3793
|
+
return { ok: false, message: `${label} JSON \u6570\u7EC4\u89E3\u6790\u5931\u8D25\uFF08\u6536\u5230 ${raw}\uFF09` };
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3796
|
+
return { ok: true, value: raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0) };
|
|
3797
|
+
};
|
|
3798
|
+
let deferredIssues;
|
|
3799
|
+
if (opts.deferredIssues !== void 0) {
|
|
3800
|
+
const parsed = parseListField("--deferred-issues", opts.deferredIssues);
|
|
3801
|
+
if (!parsed.ok) {
|
|
3802
|
+
renderResult(opts.format, fail({ message: parsed.message, httpStatus: 0 }));
|
|
3803
|
+
return;
|
|
3804
|
+
}
|
|
3805
|
+
deferredIssues = parsed.value;
|
|
3806
|
+
}
|
|
3807
|
+
let evidenceFiles;
|
|
3808
|
+
if (opts.evidenceFiles !== void 0) {
|
|
3809
|
+
const parsed = parseListField("--evidence-files", opts.evidenceFiles);
|
|
3810
|
+
if (!parsed.ok) {
|
|
3811
|
+
renderResult(opts.format, fail({ message: parsed.message, httpStatus: 0 }));
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3814
|
+
evidenceFiles = parsed.value;
|
|
3815
|
+
}
|
|
3769
3816
|
const fields = {
|
|
3770
3817
|
...opts.summary !== void 0 ? { summary: opts.summary } : {},
|
|
3771
3818
|
...opts.baseBranch !== void 0 ? { baseBranch: opts.baseBranch } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siming-org/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Wuchao",
|
|
6
6
|
"engines": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"picocolors": "^1.1.1",
|
|
28
28
|
"yaml": "^2.6.0",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@siming-org/core": "0.8.
|
|
31
|
-
"@siming-org/server": "0.8.
|
|
30
|
+
"@siming-org/core": "0.8.9",
|
|
31
|
+
"@siming-org/server": "0.8.9"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsup": "^8.3.5",
|