@gh-symphony/cli 0.2.0 → 0.2.2
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/README.md +68 -0
- package/dist/{chunk-JU3WSGMZ.js → chunk-27UZ6KX2.js} +201 -7
- package/dist/{chunk-Q3UEPUE3.js → chunk-3SKN5L3I.js} +256 -18
- package/dist/{chunk-WOVNN5NW.js → chunk-4ICDSQCJ.js} +1 -0
- package/dist/{chunk-C44DYDNU.js → chunk-6PFFGP7S.js} +7 -3
- package/dist/{chunk-Z3NZOPLZ.js → chunk-BOM2BYZQ.js} +43 -0
- package/dist/{chunk-B6OHDUSH.js → chunk-FAU72YC2.js} +1 -1
- package/dist/{chunk-F46FTZJE.js → chunk-PLBG7TZA.js} +290 -30
- package/dist/{chunk-6I753NYO.js → chunk-RZ3WO7OV.js} +1 -1
- package/dist/{chunk-CTTFIZYG.js → chunk-X4QSP3AX.js} +117 -11
- package/dist/{config-cmd-2ADPUYWA.js → config-cmd-AOZVS6GU.js} +1 -1
- package/dist/{doctor-JPNA7OCD.js → doctor-GDZSGJIT.js} +602 -27
- package/dist/index.js +12 -8
- package/dist/{repo-OJLSMOR3.js → repo-SWEUWY4H.js} +7 -7
- package/dist/{setup-PD27LSPP.js → setup-XNOSJ3RX.js} +35 -32
- package/dist/{upgrade-HRI3KEO7.js → upgrade-ZWUAJLHK.js} +2 -2
- package/dist/{version-JSBTKS6Q.js → version-PLQK6X2P.js} +1 -1
- package/dist/worker-entry.js +77 -9
- package/dist/{workflow-KB3TX5Z4.js → workflow-2ERPNGRB.js} +7 -7
- package/package.json +5 -5
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
resolveWorkflowRuntimeTimeouts,
|
|
31
31
|
safeReadDir,
|
|
32
32
|
scheduleRetryAt
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3SKN5L3I.js";
|
|
34
34
|
import {
|
|
35
35
|
loadGlobalConfig,
|
|
36
36
|
loadProjectConfig
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4ICDSQCJ.js";
|
|
38
38
|
|
|
39
39
|
// ../tracker-github/src/adapter.ts
|
|
40
40
|
import { createHash } from "crypto";
|
|
@@ -158,7 +158,7 @@ function normalizePullRequestProjectItem(projectId, item, content, fieldValues,
|
|
|
158
158
|
async function fetchProjectIssues(config, fetchImpl = fetch) {
|
|
159
159
|
const issues = [];
|
|
160
160
|
let cursor = null;
|
|
161
|
-
const priorityOptionIds = config.priorityFieldName ? await fetchPriorityOptionOrder(
|
|
161
|
+
const priorityOptionIds = !config.priority && config.priorityFieldName ? await fetchPriorityOptionOrder(
|
|
162
162
|
config,
|
|
163
163
|
config.priorityFieldName,
|
|
164
164
|
fetchImpl
|
|
@@ -179,8 +179,11 @@ async function fetchProjectIssues(config, fetchImpl = fetch) {
|
|
|
179
179
|
item,
|
|
180
180
|
config.lifecycle,
|
|
181
181
|
{
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
explicit: config.priority,
|
|
183
|
+
legacy: {
|
|
184
|
+
fieldName: config.priorityFieldName,
|
|
185
|
+
optionIds: priorityOptionIds
|
|
186
|
+
}
|
|
184
187
|
},
|
|
185
188
|
latestRateLimits
|
|
186
189
|
);
|
|
@@ -248,7 +251,7 @@ async function fetchIssueStatesByIds(config, issueIds, fetchImpl = fetch) {
|
|
|
248
251
|
return issues;
|
|
249
252
|
}
|
|
250
253
|
async function fetchProjectIssueByRepositoryAndNumber(config, repository, issueNumber, fetchImpl = fetch) {
|
|
251
|
-
const priorityOptionIds = config.priorityFieldName ? await fetchPriorityOptionOrder(
|
|
254
|
+
const priorityOptionIds = !config.priority && config.priorityFieldName ? await fetchPriorityOptionOrder(
|
|
252
255
|
config,
|
|
253
256
|
config.priorityFieldName,
|
|
254
257
|
fetchImpl
|
|
@@ -281,8 +284,11 @@ async function fetchProjectIssueByRepositoryAndNumber(config, repository, issueN
|
|
|
281
284
|
projectItem,
|
|
282
285
|
config.lifecycle,
|
|
283
286
|
{
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
explicit: config.priority,
|
|
288
|
+
legacy: {
|
|
289
|
+
fieldName: config.priorityFieldName,
|
|
290
|
+
optionIds: priorityOptionIds
|
|
291
|
+
}
|
|
286
292
|
},
|
|
287
293
|
result.rateLimits
|
|
288
294
|
);
|
|
@@ -600,16 +606,114 @@ function findProjectItemByProjectId(nodes, projectId) {
|
|
|
600
606
|
return nodes.find((item) => item?.project?.id === projectId) ?? null;
|
|
601
607
|
}
|
|
602
608
|
function resolvePriority(item, priority) {
|
|
603
|
-
|
|
609
|
+
const normalizedPriority = normalizePriorityResolutionConfig(priority);
|
|
610
|
+
if (normalizedPriority.explicit) {
|
|
611
|
+
return resolveExplicitPriority(item, normalizedPriority.explicit);
|
|
612
|
+
}
|
|
613
|
+
if (!normalizedPriority.legacy?.fieldName || !normalizedPriority.legacy.optionIds) {
|
|
614
|
+
return null;
|
|
615
|
+
}
|
|
616
|
+
for (const node of item.fieldValues?.nodes ?? []) {
|
|
617
|
+
if (node?.__typename === "ProjectV2ItemFieldSingleSelectValue" && node.field?.name === normalizedPriority.legacy.fieldName && node.optionId) {
|
|
618
|
+
return normalizedPriority.legacy.optionIds[node.optionId] ?? null;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
function normalizePriorityResolutionConfig(priority) {
|
|
624
|
+
if ("explicit" in priority || "legacy" in priority) {
|
|
625
|
+
return priority;
|
|
626
|
+
}
|
|
627
|
+
return {
|
|
628
|
+
legacy: priority
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function resolveExplicitPriority(item, priority) {
|
|
632
|
+
if (priority.source === "disabled") {
|
|
604
633
|
return null;
|
|
605
634
|
}
|
|
635
|
+
if (priority.source === "project-field") {
|
|
636
|
+
return resolveProjectFieldPriority(item, priority);
|
|
637
|
+
}
|
|
638
|
+
return resolveLabelPriority(item, priority);
|
|
639
|
+
}
|
|
640
|
+
function resolveProjectFieldPriority(item, priority) {
|
|
606
641
|
for (const node of item.fieldValues?.nodes ?? []) {
|
|
607
|
-
if (node?.__typename === "ProjectV2ItemFieldSingleSelectValue" && node.field?.name === priority.
|
|
608
|
-
|
|
642
|
+
if (node?.__typename === "ProjectV2ItemFieldSingleSelectValue" && node.field?.name === priority.field && node.name) {
|
|
643
|
+
const resolved = priority.values[node.name] ?? null;
|
|
644
|
+
if (resolved === null) {
|
|
645
|
+
emitPriorityUnmapped(item, "project-field", [node.name]);
|
|
646
|
+
}
|
|
647
|
+
return resolved;
|
|
609
648
|
}
|
|
610
649
|
}
|
|
611
650
|
return null;
|
|
612
651
|
}
|
|
652
|
+
function resolveLabelPriority(item, priority) {
|
|
653
|
+
if (item.content?.__typename !== "Issue" && item.content?.__typename !== "PullRequest") {
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
const labels = rawLabelNames(item.content.labels?.nodes ?? []);
|
|
657
|
+
const matches = labels.flatMap((label) => {
|
|
658
|
+
const value = priority.labels[label];
|
|
659
|
+
return typeof value === "number" ? [{ label, value }] : [];
|
|
660
|
+
});
|
|
661
|
+
if (matches.length === 0) {
|
|
662
|
+
if (labels.length > 0) {
|
|
663
|
+
emitPriorityUnmapped(item, "labels", labels);
|
|
664
|
+
}
|
|
665
|
+
return null;
|
|
666
|
+
}
|
|
667
|
+
const chosenValue = Math.min(...matches.map((match) => match.value));
|
|
668
|
+
if (matches.length > 1) {
|
|
669
|
+
const chosenLabels = matches.filter((match) => match.value === chosenValue).map((match) => match.label);
|
|
670
|
+
emitPriorityLabelConflictResolved(item, matches, chosenValue, chosenLabels);
|
|
671
|
+
}
|
|
672
|
+
return chosenValue;
|
|
673
|
+
}
|
|
674
|
+
function rawLabelNames(nodes) {
|
|
675
|
+
return nodes.flatMap((label) => label?.name ? [label.name] : []);
|
|
676
|
+
}
|
|
677
|
+
function emitPriorityLabelConflictResolved(item, matched, chosenValue, chosenLabels) {
|
|
678
|
+
const issue = issueEventMetadata(item);
|
|
679
|
+
if (!issue) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
console.info(
|
|
683
|
+
JSON.stringify({
|
|
684
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
685
|
+
event: "priority.label_conflict_resolved",
|
|
686
|
+
issue,
|
|
687
|
+
matched,
|
|
688
|
+
chosenValue,
|
|
689
|
+
chosenLabels
|
|
690
|
+
})
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
function emitPriorityUnmapped(item, source, rawValues) {
|
|
694
|
+
const issue = issueEventMetadata(item);
|
|
695
|
+
if (!issue) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
console.info(
|
|
699
|
+
JSON.stringify({
|
|
700
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
701
|
+
event: "priority.unmapped",
|
|
702
|
+
issue,
|
|
703
|
+
source,
|
|
704
|
+
rawValues
|
|
705
|
+
})
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
function issueEventMetadata(item) {
|
|
709
|
+
if (item.content?.__typename !== "Issue" && item.content?.__typename !== "PullRequest") {
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
return {
|
|
713
|
+
identifier: `${item.content.repository.owner.login}/${item.content.repository.name}#${item.content.number}`,
|
|
714
|
+
id: item.content.id
|
|
715
|
+
};
|
|
716
|
+
}
|
|
613
717
|
function extractPriorityOptionOrder(fields, priorityFieldName) {
|
|
614
718
|
for (const field of fields) {
|
|
615
719
|
if (isSingleSelectProjectField(field) && field.name === priorityFieldName) {
|
|
@@ -1446,6 +1550,7 @@ function resolveGitHubTrackerConfig(project, dependencies = {}) {
|
|
|
1446
1550
|
token,
|
|
1447
1551
|
apiUrl: project.tracker.apiUrl,
|
|
1448
1552
|
assignedOnly: readBooleanTrackerSetting(project.tracker, "assignedOnly"),
|
|
1553
|
+
priority: project.tracker.priority ?? null,
|
|
1449
1554
|
priorityFieldName: readOptionalStringTrackerSetting(
|
|
1450
1555
|
project.tracker,
|
|
1451
1556
|
"priorityFieldName"
|
|
@@ -1458,6 +1563,7 @@ function buildProjectItemsCacheKey(config, _dependencies) {
|
|
|
1458
1563
|
adapter: "github-project",
|
|
1459
1564
|
apiUrl: config.apiUrl,
|
|
1460
1565
|
assignedOnly: config.assignedOnly ?? false,
|
|
1566
|
+
priority: config.priority ?? null,
|
|
1461
1567
|
priorityFieldName: config.priorityFieldName ?? null,
|
|
1462
1568
|
projectId: config.projectId,
|
|
1463
1569
|
timeoutMs: config.timeoutMs,
|