dsh-git-badge 0.17.2 → 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,20 @@ 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
+
13
27
  ## [0.17.2] - 2026-09-17
14
28
 
15
29
  ### Fixed
@@ -722,7 +736,8 @@ npm. 0.6.0 is the first release recorded here.
722
736
  - `detail=1` is annotated as having no consumer yet (the hover card remains
723
737
  pending). Its comment previously claimed `log -1` while the code ran `log -3`.
724
738
 
725
- [Unreleased]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/compare/v0.17.2...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
726
741
  [0.17.2]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.2
727
742
  [0.17.1]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.1
728
743
  [0.17.0]: https://github.com/Kevin-McIsaac/dsh-workspace-git-badge/releases/tag/v0.17.0
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.2",
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",