ai-project-manage-cli 3.0.7 → 3.0.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 +32 -2
- package/package.json +1 -1
- package/template/apm.config.json +0 -1
package/dist/index.js
CHANGED
|
@@ -516,6 +516,26 @@ function tasksForStatusYaml(tasks) {
|
|
|
516
516
|
executor: t.executorType
|
|
517
517
|
}));
|
|
518
518
|
}
|
|
519
|
+
function escapeForCdata(text) {
|
|
520
|
+
return text.replace(/\]\]>/g, "]]]]><![CDATA[>");
|
|
521
|
+
}
|
|
522
|
+
function defectsToXml(defects) {
|
|
523
|
+
const sorted = [...defects].sort(
|
|
524
|
+
(a, b) => new Date(a.createdAt ?? 0).getTime() - new Date(b.createdAt ?? 0).getTime()
|
|
525
|
+
);
|
|
526
|
+
const lines = ["<defects>"];
|
|
527
|
+
for (const d of sorted) {
|
|
528
|
+
lines.push(` <defect id="${xmlEscape(d.id)}">`);
|
|
529
|
+
lines.push(` <status>${xmlEscape(d.status)}</status>`);
|
|
530
|
+
lines.push(` <current><![CDATA[${escapeForCdata(d.currentState ?? "")}]]></current>`);
|
|
531
|
+
lines.push(
|
|
532
|
+
` <expected><![CDATA[${escapeForCdata(d.expectedEffect ?? "")}]]></expected>`
|
|
533
|
+
);
|
|
534
|
+
lines.push(` </defect>`);
|
|
535
|
+
}
|
|
536
|
+
lines.push("</defects>", "");
|
|
537
|
+
return lines.join("\n");
|
|
538
|
+
}
|
|
519
539
|
async function runPull(requirementId) {
|
|
520
540
|
const cfg = await ensureLoggedConfig();
|
|
521
541
|
const api = createApmApiClient(cfg);
|
|
@@ -560,7 +580,7 @@ async function runPull(requirementId) {
|
|
|
560
580
|
""
|
|
561
581
|
].join("\n");
|
|
562
582
|
writeFileSync3(join4(WORKITEMS_DIR, "reviews.xml"), reviewsXml, "utf8");
|
|
563
|
-
const defectsXml =
|
|
583
|
+
const defectsXml = defectsToXml(data.defects ?? []);
|
|
564
584
|
writeFileSync3(join4(WORKITEMS_DIR, "defect.xml"), defectsXml, "utf8");
|
|
565
585
|
const testCasesXml = unknownArrayToXml(
|
|
566
586
|
"testcases",
|
|
@@ -730,6 +750,16 @@ function req(v, field) {
|
|
|
730
750
|
}
|
|
731
751
|
return v;
|
|
732
752
|
}
|
|
753
|
+
function reqTopLevelName(cfg) {
|
|
754
|
+
const n = (cfg.name ?? "").trim();
|
|
755
|
+
if (!n) {
|
|
756
|
+
console.error(
|
|
757
|
+
"\u8BF7\u5728 apm.config.json \u9876\u5C42\u914D\u7F6E name\uFF08\u4E0E\u524D\u7AEF\u5236\u54C1\u524D\u7F00\u3001\u540E\u7AEF\u955C\u50CF\u540D\u5171\u7528\uFF09"
|
|
758
|
+
);
|
|
759
|
+
process.exit(1);
|
|
760
|
+
}
|
|
761
|
+
return n;
|
|
762
|
+
}
|
|
733
763
|
function reqBackendPositiveInt(v, field) {
|
|
734
764
|
const n = Number(v);
|
|
735
765
|
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 1) {
|
|
@@ -762,7 +792,7 @@ function resolveBackendDeployFromApmConfig(cfg) {
|
|
|
762
792
|
mappings = rawPorts.map((x) => String(x).trim()).filter(Boolean);
|
|
763
793
|
}
|
|
764
794
|
return {
|
|
765
|
-
name:
|
|
795
|
+
name: reqTopLevelName(cfg),
|
|
766
796
|
registryHost: req(b.registryHost, "registryHost").trim(),
|
|
767
797
|
registryNamespace: req(b.registryNamespace, "registryNamespace").trim(),
|
|
768
798
|
registryUser: req(b.registryUser, "registryUser").trim(),
|
package/package.json
CHANGED