dsh-git-badge 0.10.0 → 0.10.1

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,22 @@ npm. 0.6.0 is the first release recorded here.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.10.1] - 2026-09-14
14
+
15
+ ### Fixed
16
+
17
+ - **Revert backups now live in a stable, user-level store.** They defaulted to
18
+ the patcher's own directory — which for `npx dsh-git-badge` is a cache entry
19
+ keyed by package version, so a backup written by one `apply` was invisible to
20
+ the next `revert`, which then had to refuse ("patched but no backup exists")
21
+ even though the bytes were on disk somewhere. The default is now
22
+ `$DSH_HOME/git-badge-seam` (else `~/.dsh/git-badge-seam`), shared by npx
23
+ runs, the profile bin, the repo wrapper and the postinstall hook;
24
+ `SEAM_DATA_DIR` still overrides. Backups written by older versions to their
25
+ install directories are not migrated — the no-backup refusal now says so and
26
+ names both remaining routes (the repo wrapper's backup, or reinstalling the
27
+ DSH package).
28
+
13
29
  ## [0.10.0] - 2026-09-14
14
30
 
15
31
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-git-badge",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
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",
package/seam/apply.js CHANGED
@@ -33,8 +33,10 @@
33
33
  *
34
34
  * Environment:
35
35
  * DSH_INSTALL the DSH package root. Default: `<global npm root>/@deepseek-ai/dsh`.
36
- * SEAM_DATA_DIR where revert backups are written. Default: this script's
37
- * directory (inside the installed package).
36
+ * SEAM_DATA_DIR where revert backups are written. Default:
37
+ * `$DSH_HOME/git-badge-seam` (else `~/.dsh/git-badge-seam`) —
38
+ * a stable, user-level store shared by every way this tool
39
+ * can run. See the note at the definition below.
38
40
  *
39
41
  * Usage: apply.js apply | apply.js revert | apply.js status
40
42
  */
@@ -54,7 +56,17 @@ import {
54
56
  } from "./anchors.js";
55
57
 
56
58
  const HERE = dirname(fileURLToPath(import.meta.url));
57
- const DATA_DIR = process.env.SEAM_DATA_DIR || HERE;
59
+ /**
60
+ * Where revert backups live. A STABLE, user-level directory by default — NOT
61
+ * this script's own directory. For an npx run that directory is a cache entry
62
+ * keyed by package version: a backup written by one `npx dsh-git-badge apply`
63
+ * was invisible to the next `npx dsh-git-badge revert`, which then had to
64
+ * refuse ("patched but no backup exists") even though the bytes were on disk
65
+ * somewhere. Sharing one store across npx runs, the profile bin and the repo
66
+ * wrapper makes the apply→revert round trip reliable for everyone. Override
67
+ * with SEAM_DATA_DIR (the test suite does, to stay hermetic).
68
+ */
69
+ const DATA_DIR = process.env.SEAM_DATA_DIR || join(process.env.DSH_HOME || join(process.env.HOME || "", ".dsh"), "git-badge-seam");
58
70
 
59
71
  // sha256 of the upstream build the anchors were last verified against. ADVISORY:
60
72
  // status prints it for orientation; apply does NOT require it.
@@ -291,9 +303,13 @@ if (verb === "apply") {
291
303
  } else {
292
304
  const r = inspect();
293
305
  if (r.state === "ours-current" || r.state === "ours-stale" || r.state === "ours-corrupt") {
294
- console.error("REFUSING: the installed file is patched but no backup exists, so the");
295
- console.error("original bytes are unknown. Reinstall the package to clear the patch:");
296
- console.error(" npm rebuild -g @deepseek-ai/dsh # or your package manager's equivalent");
306
+ console.error("REFUSING: the installed file is patched but no backup exists in");
307
+ console.error(`${DATA_DIR}, so the original bytes are unknown here. Options:`);
308
+ console.error(" 1. If you applied from a clone of the plugin's repository, run its");
309
+ console.error(" wrapper instead — it keeps its own backup:");
310
+ console.error(" <clone>/seam/apply.sh revert");
311
+ console.error(" 2. Otherwise reinstall the package — pristine files, guaranteed:");
312
+ console.error(" npm i -g @deepseek-ai/dsh@latest");
297
313
  process.exit(1);
298
314
  }
299
315
  console.log("no backup present and nothing of ours installed; client.js left untouched.");
@@ -29,6 +29,12 @@ import { applyPatch, firstFailure, isOurs, seamPresent } from "./anchors.js";
29
29
 
30
30
  const HERE = dirname(fileURLToPath(import.meta.url));
31
31
  const HINT = "Sidebar session-row badges need one manual step: `npx dsh-git-badge apply`, then restart dsh web.";
32
+ /**
33
+ * Same stable backup store apply.js defaults to — the backup this hook takes
34
+ * must be findable by a LATER `npx dsh-git-badge revert` running from a
35
+ * different cache entry. SEAM_DATA_DIR overrides (test suite).
36
+ */
37
+ const DATA_DIR = process.env.SEAM_DATA_DIR || join(process.env.DSH_HOME || join(process.env.HOME || "", ".dsh"), "git-badge-seam");
32
38
 
33
39
  function dshClientPath() {
34
40
  try {
@@ -68,9 +74,9 @@ function main() {
68
74
  return;
69
75
  }
70
76
  // The one state we act on: pristine upstream, anchors resolve.
71
- mkdirSync(HERE, { recursive: true });
72
- copyFileSync(client, join(HERE, "backup-client.js"));
73
- copyFileSync(index, join(HERE, "backup-index.js"));
77
+ mkdirSync(DATA_DIR, { recursive: true });
78
+ copyFileSync(client, join(DATA_DIR, "backup-client.js"));
79
+ copyFileSync(index, join(DATA_DIR, "backup-index.js"));
74
80
  writeFileSync(client, applyPatch(text));
75
81
  copyFileSync(join(HERE, "stub-index.js"), index);
76
82
  console.log("[dsh-git-badge] seam applied — RESTART dsh web to get sidebar session-row badges.");