dsh-git-badge 0.17.1 → 0.17.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,36 @@ npm. 0.6.0 is the first release recorded here.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.17.3] - 2026-09-17
14
+
15
+ ### Fixed
16
+
17
+ - **The default branch is now detected when `refs/remotes/origin/HEAD` is
18
+ missing.** `defaultBranchFor` read only that symref, so in a repo that has
19
+ none — `git clone --branch <x>`, a pruned ref, or any repo that was only ever
20
+ pushed to — it answered "no default branch" forever. Every default-branch rule
21
+ was therefore silently inert: the 0.17.2 merge row on `main` still said
22
+ `no pull request`, and the node half still suggested opening a pull request
23
+ FROM the default branch. The lookup now falls back, network-free, to the base
24
+ branch this module already probes (`origin/main`, then `origin/master`); a
25
+ repo whose default is neither still answers `undefined`, exactly as before.
26
+
27
+ ## [0.17.2] - 2026-09-17
28
+
29
+ ### Fixed
30
+
31
+ - **The default branch's branch hover no longer says `no pull request`.** The
32
+ always-render merge row (0.17.0) only ever made sense on a feature branch:
33
+ `main` is the base pull requests merge INTO, and none is ever opened FROM it,
34
+ so `no pull request` there read as a nag for something that cannot exist. When
35
+ the node half flags the branch as the default one (`defaultBranch: true`, the
36
+ same flag the action rules use to suppress "open a pull request" on `main`),
37
+ the row now reads `base branch · pull requests merge into this`. Its
38
+ base-relative counts are suppressed there too — `N ahead, M behind main` while
39
+ ON `main` is self-referential, and that divergence is already the chip's own
40
+ `↑a ↓b` token. Feature branches are unchanged: still `no pull request`, still
41
+ the counts when they are known.
42
+
13
43
  ## [0.17.1] - 2026-09-17
14
44
 
15
45
  ### Fixed
@@ -706,7 +736,10 @@ npm. 0.6.0 is the first release recorded here.
706
736
  - `detail=1` is annotated as having no consumer yet (the hover card remains
707
737
  pending). Its comment previously claimed `log -1` while the code ran `log -3`.
708
738
 
709
- [Unreleased]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/compare/v0.17.0...HEAD
739
+ [Unreleased]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/compare/v0.17.3...HEAD
740
+ [0.17.3]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.3
741
+ [0.17.2]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.2
742
+ [0.17.1]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.1
710
743
  [0.17.0]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.0
711
744
  [0.16.1]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.16.1
712
745
  [0.16.0]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.16.0
package/lib/client.js CHANGED
@@ -892,10 +892,22 @@ window.__ModuleLoader__.load({
892
892
  } else if (pr.state === "failing") mergeParts.push("blocked: checks failing");
893
893
  else if (pr.mergeState === "CLEAN" || (pr.state === "passing" && pr.review === "APPROVED")) mergeParts.push("ready to merge");
894
894
  else if (pr.review === "REVIEW_REQUIRED") mergeParts.push("blocked: review required");
895
+ } else if (info?.defaultBranch === true) {
896
+ // The default branch is the BASE, not a branch with a missing PR:
897
+ // pull requests merge INTO it and none is ever opened FROM it, so
898
+ // "no pull request" here reads as a nag for something that cannot
899
+ // exist. The node half computes `defaultBranch` for exactly this
900
+ // suppression (see the comment where it is set in lib/index.js);
901
+ // until now only the action rules consulted it, not this row.
902
+ mergeParts.push("base branch \u00B7 pull requests merge into this");
895
903
  } else {
896
904
  mergeParts.push("no pull request");
897
905
  }
898
- if (info?.mainAhead !== void 0 || info?.mainBehind !== void 0) {
906
+ // The counts are this branch's standing against its BASE, so on the
907
+ // base itself they are self-referential ("N ahead, M behind main" while
908
+ // ON main) and the divergence they would state is already the chip's own
909
+ // \u2191a \u2193b token. Suppress them on the default branch, with or without a PR.
910
+ if (info?.defaultBranch !== true && (info?.mainAhead !== void 0 || info?.mainBehind !== void 0)) {
899
911
  mergeParts.push((info.mainAhead || 0) + " ahead, " + (info.mainBehind || 0) + " behind main");
900
912
  }
901
913
  add("merge", mergeParts.join(" \u00B7 "));
package/lib/index.js CHANGED
@@ -263,7 +263,22 @@ function defaultBranchFor(toplevel, notify) {
263
263
  serve: (state) => state.value
264
264
  }, async (record) => {
265
265
  const out = await runGit(toplevel, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"]);
266
- const name = out.stdout === null ? "" : out.stdout.trim().replace(/^origin\//u, "");
266
+ let name = out.stdout === null ? "" : out.stdout.trim().replace(/^origin\//u, "");
267
+ if (name === "") {
268
+ // `refs/remotes/origin/HEAD` is absent far more often than not: `git
269
+ // clone --branch <x>`, a pruned ref, or any repo that was only ever
270
+ // pushed to never gets one. Reading the symref alone therefore answered
271
+ // "no default branch" forever, which silently disabled EVERY
272
+ // default-branch rule — the merge row's base-branch wording on `main`,
273
+ // and the node half's own "no pull-request suggestion on main". Fall
274
+ // back, network-free, to the same base branch this module already
275
+ // probes for its ahead/behind row. A repository whose default branch is
276
+ // neither main nor master still answers undefined, exactly as before.
277
+ for (const candidate of ["main", "master"]) {
278
+ const probe = await runGit(toplevel, ["rev-parse", "--verify", "--quiet", "refs/remotes/origin/" + candidate]);
279
+ if (probe.stdout !== null && probe.stdout.trim() !== "") { name = candidate; break; }
280
+ }
281
+ }
267
282
  const value = name === "" ? void 0 : name;
268
283
  if (record.value !== value) notify?.();
269
284
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-git-badge",
3
- "version": "0.17.1",
3
+ "version": "0.17.3",
4
4
  "description": "Git status badges for DeepSeek Harness: an input-row chip on every install, plus sidebar session-row badges (git status, PR/CI action tokens) after one manual step: `npx dsh-git-badge apply`, then restart dsh web. Event-driven freshness over SSE.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",