dsh-better-edit 0.4.0-rc.1 → 0.4.0

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
@@ -6,16 +6,32 @@ Entries link to the originating spec issue in [pi-hashline-edit-lsz](https://git
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.0] - 2026-08-24
10
+
11
+ ### Added
12
+
13
+ - Configurable store tenancy with central default (`$DSH_HOME/plugins/dsh-better-edit/runtime/<name>-<hash8>/`), `workspace` legacy opt-in, and custom `/abs` root — yaml at `$DSH_HOME/plugins/dsh-better-edit/config.yaml` (`storeDir` — where the store lives, `autoGitignore` — workspace .gitignore handling, `undo_ttl_s` — undo TTL in seconds (-1 = forever), `storeMaxAgeS` — central janitor max idle age in seconds (default 30 days), `storeMaxTotalBytes` — central janitor max total bytes) + god envs `DSH_BETTER_EDIT_STORE_DIR`/`DSH_BETTER_EDIT_AUTO_GITIGNORE` (`env > yaml > central`) with malformed fallback to central and warnings. DB files are disposable caches — safe to delete, rebuilt on next `read` ([#24](https://github.com/Rianico/dsh-better-edit/issues/24)). Thanks to [@MrWeiCodes](https://github.com/MrWeiCodes) for the proposal and design discussion.
14
+ - Readable `runtime/<name>-<hash8>/` with `.wsPath` sidecar for collision proof.
15
+
16
+ ### Changed
17
+
18
+ - Default store location moved from workspace-co-located to central `runtime/` to eliminate git pollution and zip privacy leakage — `workspace` now requires explicit `storeDir: workspace`.
19
+ - Store lifecycle now plugin-owned for central/custom (throttled janitor on `apply` + `agent/session-start` >24h, `mtime>storeMaxAgeS` (default 30 days / 2592000 s, unified to seconds with `undo_ttl_s`) then LRU to `count<100 && sum<500MB`, never deleting live `hash(workspaceCwd)`), `wal_checkpoint(TRUNCATE)` on close/janitor, `undo` TTL `undo_ttl_s` (default 7d, `-1` = forever, seconds), `pruneMissing` batch 64 — workspace mode remains user-owned with row TTL only. DB files are disposable caches — safe to delete, rebuilt on next `read`.
20
+
21
+ ### Fixed
22
+
23
+ - `.gitignore` pollution warning for `workspace` mode and idempotent `autoGitignore` opt-in (yaml+env `true|false`).
24
+
9
25
  ## [0.4.0-rc.1] - 2026-08-24
10
26
 
11
27
  ### Added
12
28
 
13
29
  - Configurable store tenancy with central default (`$DSH_HOME/plugins/dsh-better-edit/runtime/<name>-<hash8>/`), `workspace` legacy opt-in, and custom `/abs` root — yaml at `$DSH_HOME/plugins/dsh-better-edit/config.yaml` (`storeDir` — where the store lives, `autoGitignore` — workspace .gitignore handling, `undo_ttl_s` — undo TTL in seconds (-1 = forever), `storeMaxAgeS` — central janitor max idle age in seconds (default 30 days), `storeMaxTotalBytes` — central janitor max total bytes) + god envs `DSH_BETTER_EDIT_STORE_DIR`/`DSH_BETTER_EDIT_AUTO_GITIGNORE` (`env > yaml > central`) with malformed fallback to central and warnings. DB files are disposable caches — safe to delete, rebuilt on next `read` ([#24](https://github.com/Rianico/dsh-better-edit/issues/24)). Thanks to [@MrWeiCodes](https://github.com/MrWeiCodes) for the proposal and design discussion.
14
- - Migration probe copies legacy `<workspace>/.dsh_better_edit/` once on first central open; readable `runtime/<name>-<hash8>/` with `.wsPath` sidecar for collision proof.
30
+ - Readable `runtime/<name>-<hash8>/` with `.wsPath` sidecar for collision proof.
15
31
 
16
32
  ### Changed
17
33
 
18
- - Default store location moved from workspace-co-located to central `runtime/` to eliminate git pollution and zip privacy leakage — `workspace` now requires explicit `storeDir: workspace`. Existing workspace stores are migrated automatically on first access.
34
+ - Default store location moved from workspace-co-located to central `runtime/` to eliminate git pollution and zip privacy leakage — `workspace` now requires explicit `storeDir: workspace`.
19
35
  - Store lifecycle now plugin-owned for central/custom (throttled janitor on `apply` + `agent/session-start` >24h, `mtime>storeMaxAgeS` (default 30 days / 2592000 s, unified to seconds with `undo_ttl_s`) then LRU to `count<100 && sum<500MB`, never deleting live `hash(workspaceCwd)`), `wal_checkpoint(TRUNCATE)` on close/janitor, `undo` TTL `undo_ttl_s` (default 7d, `-1` = forever, seconds), `pruneMissing` batch 64 — workspace mode remains user-owned with row TTL only. DB files are disposable caches — safe to delete, rebuilt on next `read`.
20
36
 
21
37
  ### Fixed
@@ -1,18 +1,16 @@
1
1
  /**
2
2
  * StoreTenancy — deep module owning tenancy (where DB lives).
3
3
  * Owns config (yaml+env, validation, fallback, mtime cache), canonical path via
4
- * CanonicalPath seam, hash/sanitized basename, sidecar, migration, and
4
+ * CanonicalPath seam, hash/sanitized basename, sidecar, and
5
5
  * tenancyFor() → {dir, mode, runtimeDir, canonical}. File-per-workspace
6
6
  * central keeps static prepare() and isolated WAL; no PID level.
7
7
  * @module dsh-better-edit/store-tenancy
8
8
  */
9
- import { homedir } from "node:os";
10
- import { isAbsolute, join, dirname, parse } from "node:path";
9
+ import { join, parse } from "node:path";
11
10
  import { resolve as resolvePath } from "node:path";
12
- import { cpSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
11
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
13
12
  import { createHash } from "node:crypto";
14
13
  import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
15
- import { errCode } from "./utils.js";
16
14
  import { canonicalSync } from "./canonical-path.js";
17
15
  import { loadConfig } from "./store-config.js";
18
16
  export { loadConfig, _resetConfigCache, expand } from "./store-config.js";
@@ -42,22 +40,6 @@ function ensureWsPathSidecar(dir, canonicalWs) {
42
40
  // best-effort, never throw at path resolution
43
41
  }
44
42
  }
45
- function migrateLegacyIfNeeded(cwd, centralDir) {
46
- try {
47
- const legacyDir = join(resolvePath(cwd), ".dsh_better_edit");
48
- const centralDb = join(centralDir, "hash-store.sqlite");
49
- const legacyDb = join(legacyDir, "hash-store.sqlite");
50
- if (!existsSync(centralDb) && existsSync(legacyDb)) {
51
- mkdirSync(centralDir, { recursive: true });
52
- cpSync(legacyDir, centralDir, { recursive: true, force: false, errorOnExist: false });
53
- ensureWsPathSidecar(centralDir, canonicalSync(cwd));
54
- console.warn(`dsh-better-edit: migrated legacy workspace store ${legacyDir} -> ${centralDir}`);
55
- }
56
- }
57
- catch {
58
- // best-effort
59
- }
60
- }
61
43
  export function tenancyFor(cwd) {
62
44
  if (cwd === undefined) {
63
45
  return {
@@ -76,12 +58,10 @@ export function tenancyFor(cwd) {
76
58
  if (sd === "central") {
77
59
  const dir = join(resolveDshHome(), "plugins", "dsh-better-edit", "runtime", `${sanitizedBasename(cwd)}-${h}`);
78
60
  ensureWsPathSidecar(dir, canonical);
79
- migrateLegacyIfNeeded(cwd, dir);
80
61
  return { dir, mode: "central", runtimeDir: join(resolveDshHome(), "plugins", "dsh-better-edit", "runtime"), canonical };
81
62
  }
82
63
  const dir = join(sd, h);
83
64
  ensureWsPathSidecar(dir, canonical);
84
- migrateLegacyIfNeeded(cwd, dir);
85
65
  return { dir, mode: "custom", runtimeDir: sd, canonical };
86
66
  }
87
67
  // Compat shims — paths.ts delegates here
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-better-edit",
3
- "version": "0.4.0-rc.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Hash-anchored read/edit/undo_last_edit tools for DeepSeek Harness (dsh). Every line gets a unique 3-char hash (A-Za-z0-9) that stays stable across edits; stale or ambiguous anchors are rejected, never fuzzy-matched. Undo persists across restarts.",
6
6
  "main": "lib/index.js",