taskchef 7.15.1 → 7.15.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskchef",
3
- "version": "7.15.1",
3
+ "version": "7.15.2",
4
4
  "description": "Dispatch work from a data-only workspace to visible Codex project tasks.",
5
5
  "author": {
6
6
  "name": "Favo Yang",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskchef",
3
- "version": "7.15.1",
3
+ "version": "7.15.2",
4
4
  "description": "A non-blocking interactive dispatcher for visible Codex tasks.",
5
5
  "license": "MIT",
6
6
  "author": "Favo Yang",
@@ -61,18 +61,22 @@ const elements = {
61
61
  };
62
62
  let notificationDescriptionSerial = 0;
63
63
 
64
- function referenceLink(link, { compact = false, typePrefix = false } = {}) {
64
+ function typedReferenceLabel(link, label, typePrefix) {
65
+ if (!typePrefix) return label;
66
+ if (link.type === "pull") return `PR ${label}`;
67
+ if (link.type === "issue") return `Issue ${label}`;
68
+ return label;
69
+ }
70
+
71
+ function referenceLink(link, { compact = false, displayLabel, typePrefix = false } = {}) {
65
72
  const anchor = document.createElement("a");
66
73
  anchor.className = compact ? "github-link github-link-compact" : "github-link";
67
74
  anchor.href = link.url;
68
75
  anchor.target = "_blank";
69
76
  anchor.rel = "noopener noreferrer";
70
77
  const label = link.label ?? link.text;
71
- const visibleLabel = typePrefix && link.type === "pull"
72
- ? `PR ${label}`
73
- : typePrefix && link.type === "issue"
74
- ? `Issue ${label}`
75
- : label;
78
+ const visibleLabel = typedReferenceLabel(link, displayLabel ?? label, typePrefix);
79
+ const accessibleLabel = typedReferenceLabel(link, label, typePrefix);
76
80
  anchor.textContent = visibleLabel;
77
81
  const githubKind = link.type === "issue"
78
82
  ? ", GitHub issue"
@@ -81,7 +85,7 @@ function referenceLink(link, { compact = false, typePrefix = false } = {}) {
81
85
  : link.provider === "github" || link.owner ? " on GitHub" : "";
82
86
  anchor.setAttribute(
83
87
  "aria-label",
84
- `${visibleLabel}${githubKind} (opens in a new tab)`,
88
+ `${accessibleLabel}${githubKind} (opens in a new tab)`,
85
89
  );
86
90
  anchor.addEventListener("click", (event) => event.stopPropagation());
87
91
  return anchor;
@@ -115,7 +119,18 @@ function relatedGitHubLinks(task, { compact = false } = {}) {
115
119
  const container = document.createElement("nav");
116
120
  container.className = `github-links${compact ? " github-links-compact" : ""}`;
117
121
  container.setAttribute("aria-label", `Related GitHub links for ${task.title}`);
118
- const children = links.map((link) => referenceLink(link, { compact }));
122
+ const seenRepositories = new Set();
123
+ const children = links.map((link) => {
124
+ const repository = link.owner && link.repository
125
+ ? `${link.owner}/${link.repository}`
126
+ : null;
127
+ const repeatedRepository = repository && seenRepositories.has(repository);
128
+ if (repository) seenRepositories.add(repository);
129
+ const displayLabel = repeatedRepository && link.number
130
+ ? `#${link.number}`
131
+ : link.label;
132
+ return referenceLink(link, { compact, displayLabel, typePrefix: true });
133
+ });
119
134
  if (task.relatedGitHubLinksTruncated) {
120
135
  const more = document.createElement("span");
121
136
  more.className = "github-links-more";