@kangyishuai/dsh-projects 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Unofficial plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/de
12
12
  > Details: `docs/runtime/0.2.2-rc.3.md` §11.24–§11.26.
13
13
 
14
14
  > **Status: M4 done, pre-1.0.** Projects, context injection, isolated parallel threads, an opt-in coordinator,
15
- > and a gated approval/executor layer are implemented, unit-tested (274 tests) and covered by a 51-assertion
15
+ > and a gated approval/executor layer are implemented, unit-tested (276 tests) and covered by a 50-assertion
16
16
  > web end-to-end smoke plus an 11-assertion desktop read-only regression.
17
17
  > Remote writes (push / PR / merge) are wired and verified locally against a bare remote and a stub `gh`;
18
18
  > the real-GitHub effect still needs one release confirmation. Project **sharing** is deferred ([ADR 0018](../../docs/adr/0018-projects-defer-liveshare-sharing.md)).
@@ -47,7 +47,7 @@ Restart the DSH desktop app afterwards.
47
47
 
48
48
  ## Side effects & risks
49
49
 
50
- - **Writes metadata** under `$DSH_HOME/projects/projects.json` (or `config.dataRoot` when set). Atomic replace via a temp file; a corrupt file is renamed aside and never deleted.
50
+ - **Writes metadata** under `$DSH_HOME/projects/projects.json` (or `config.dataRoot` when set; a desktop app that does not export `DSH_HOME` falls back to `~/.dsh/projects`). Atomic replace via a temp file; a corrupt file is renamed aside and never deleted.
51
51
  - **Creates Git worktrees** next to your repository (never inside it and never inside `.git/`) when you create a thread for a project that has a Git directory. Archiving the thread removes the worktree again **only** when it is clean, has no unpushed commits, and is not the current session's directory; otherwise it is kept and reported.
52
52
  - **Runs `git`** through `node:child_process` for worktree create/remove and the cleanliness checks. No network, no credentials.
53
53
  - **Never touches session logs.** Detaching or archiving a project leaves every `session.v*.jsonl.zstd` untouched.
@@ -65,9 +65,12 @@ does not do over a remote connection.
65
65
 
66
66
  ## Compatibility
67
67
 
68
- | Plugin | Verified on DSH |
69
- | ------ | --------------- |
70
- | 0.1.x | 0.2.2-rc.3 |
68
+ | Plugin | Verified on DSH |
69
+ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
+ | 0.1.1 | 0.2.2-rc.5: no code change needed. 276 unit tests + `pnpm probe:runtime` 72/72 + web smoke 50/0/0 + desktop read-only regression **11 PASS / 0 SKIP / 0 FAIL** |
71
+ | 0.1.x | 0.2.2-rc.3 |
72
+
73
+ The private host seams this plugin uses (`dsh-session`, `dsh-workspace`, `dsh-api-gateway`, `dsh-typert-protocol`, `dsh-agent`, …) are byte-identical between rc.3 and rc.5 — a 43-package diff found no change ([runtime rc.5 §1.1](../../docs/runtime/0.2.2-rc.5.md)).
71
74
 
72
75
  ## License
73
76
 
package/README.zh-CN.md CHANGED
@@ -11,7 +11,7 @@
11
11
  > 细节见 `docs/runtime/0.2.2-rc.3.md` §11.24–§11.26。
12
12
 
13
13
  > **状态:M4 已完成,仍是 1.0 之前。** 项目、上下文注入、隔离的并行线程、可选协调器,以及带闸门的审批/执行层均已实现,
14
- > 有 274 项单测、51 项 web 端到端冒烟与 11 项桌面只读回归覆盖。
14
+ > 有 276 项单测、50 项 web 端到端冒烟与 11 项桌面只读回归覆盖。
15
15
  > 远端写入(推分支 / 开 PR / 合并)已接线,并用本地 bare 远端 + 桩 `gh` 完成端到端验证;
16
16
  > 真实 GitHub 上的效果还需发版后确认一次。**项目共享**已推迟([ADR 0018](../../docs/adr/0018-projects-defer-liveshare-sharing.md))。
17
17
 
@@ -47,7 +47,7 @@ dsh plugin --profile desktop add @kangyishuai/dsh-projects
47
47
 
48
48
  ## 副作用与风险
49
49
 
50
- - **写元数据**到 `$DSH_HOME/projects/projects.json`(配置了 `config.dataRoot` 时写到那里)。用临时文件原子替换;文件损坏时**改名隔离**,绝不删除。
50
+ - **写元数据**到 `$DSH_HOME/projects/projects.json`(配置了 `config.dataRoot` 时写到那里;桌面版不导出 `DSH_HOME` 时回落到 `~/.dsh/projects`)。用临时文件原子替换;文件损坏时**改名隔离**,绝不删除。
51
51
  - **会创建 Git worktree**(在仓库同级、绝不进仓库或 `.git/` 内)。归档线程时**只有**同时满足"干净、无未推送提交、不是当前会话目录"才会删除它,否则保留并报告。
52
52
  - **会调用 `git`**(`node:child_process`)做 worktree 创建/删除与干净度检查。不走网络、不读凭据。
53
53
  - **不碰会话日志。** 解绑或归档项目不会改动任何 `session.v*.jsonl.zstd`。
@@ -64,9 +64,12 @@ dsh plugin --profile desktop add @kangyishuai/dsh-projects
64
64
 
65
65
  ## 兼容性
66
66
 
67
- | 插件版本 | 已验证的 DSH 版本 |
68
- | -------- | ----------------- |
69
- | 0.1.x | 0.2.2-rc.3 |
67
+ | 插件版本 | 已验证的 DSH 版本 |
68
+ | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | 0.1.1 | 0.2.2-rc.5:这一版不需要改代码。276 项单测 + `pnpm probe:runtime` 72/72 + web 冒烟 50/0/0 + 桌面只读回归 **11 PASS / 0 SKIP / 0 FAIL** |
70
+ | 0.1.x | 0.2.2-rc.3 |
71
+
72
+ 本插件依赖的私有 seam(`dsh-session`、`dsh-workspace`、`dsh-api-gateway`、`dsh-typert-protocol`、`dsh-agent` 等)在 rc.3 与 rc.5 之间**逐字节相同**(43 包逐包 diff 未发现变化,[runtime rc.5 §1.1](../../docs/runtime/0.2.2-rc.5.md))。
70
73
 
71
74
  ## License
72
75
 
package/lib/paths.js ADDED
@@ -0,0 +1,28 @@
1
+ // @ts-check
2
+ // 数据根解析(**纯函数**,便于 node --test 直接引用)。
3
+ //
4
+ // 优先级与 btw / session-delete 一致:config.dataRoot → DSH_HOME(+ /projects)→ ~/.dsh/projects。
5
+ //
6
+ // 为什么必须有 ~/.dsh 回落:DSH 桌面版的进程环境里**不导出 DSH_HOME**(实测 2026-11-18:
7
+ // 主进程 env 只有 HOME),此前这里直接抛错,结果 projects 面板在真实桌面里显示
8
+ // `projects: store is unavailable`,只有 web 冒烟(显式设了 DSH_HOME)才是好的。
9
+ import { homedir } from "node:os";
10
+ import { join, resolve } from "node:path";
11
+
12
+ /**
13
+ * 解析 projects 的数据根(`projects.json` 所在目录)。
14
+ * @param {{ dataRoot?: unknown } | Record<string, unknown> | undefined} [config]
15
+ * @param {NodeJS.ProcessEnv} [env]
16
+ * @param {string} [home]
17
+ * @returns {string}
18
+ */
19
+ export function resolveDataRoot(config, env = process.env, home = homedir()) {
20
+ const configured =
21
+ config !== null && typeof config === "object" && "dataRoot" in config
22
+ ? config.dataRoot
23
+ : undefined;
24
+ if (typeof configured === "string" && configured.trim() !== "") return resolve(configured);
25
+ const fromEnv = typeof env?.DSH_HOME === "string" ? env.DSH_HOME.trim() : "";
26
+ if (fromEnv !== "") return resolve(join(fromEnv, "projects"));
27
+ return resolve(join(home, ".dsh", "projects"));
28
+ }
package/lib/service.js CHANGED
@@ -23,6 +23,7 @@ import { runCommand } from "./exec.js";
23
23
  import { checkExecutable, planCommand, recoveryEvidence } from "./executor.js";
24
24
  import { appendEntry } from "./memory.js";
25
25
  import { initialView, reduce, sortRows } from "./overview.js";
26
+ import { resolveDataRoot } from "./paths.js";
26
27
  import { buildPersona } from "./persona.js";
27
28
  import { readProjectFiles } from "./project-files.js";
28
29
  import { decideRoute } from "./routing.js";
@@ -110,19 +111,6 @@ function dirSize(dir) {
110
111
  return total;
111
112
  }
112
113
 
113
- /**
114
- * 数据根必须可注入:优先配置项,其次进程环境给的 DSH_HOME。
115
- * @param {Record<string, unknown>|undefined} config
116
- * @returns {string}
117
- */
118
- export function resolveDataRoot(config) {
119
- const configured = config?.dataRoot;
120
- if (typeof configured === "string" && configured.trim() !== "") return configured;
121
- const home = process.env.DSH_HOME;
122
- if (typeof home === "string" && home !== "") return `${home}/projects`;
123
- throw new Error("projects: no data root; set config.dataRoot or export DSH_HOME");
124
- }
125
-
126
114
  export class ProjectsService extends TypertRemoteService {
127
115
  /**
128
116
  * @param {any} ctx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangyishuai/dsh-projects",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Project-level context for DeepSeek Harness: group sessions into projects, inject instructions and memory, run isolated parallel threads, and coordinate them with an optional auditable coordinator.",
5
5
  "keywords": [
6
6
  "dsh",