dsh-relocate 1.0.0 → 1.0.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/README.en.md +68 -0
- package/README.md +62 -35
- package/package.json +3 -2
package/README.en.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# dsh-relocate
|
|
2
|
+
|
|
3
|
+
Move a directory to another drive and leave a junction at the original path, so
|
|
4
|
+
programs that hard-code the old location keep working while the data lives
|
|
5
|
+
elsewhere.
|
|
6
|
+
|
|
7
|
+
Built for the everyday "my `C:\` keeps filling up" problem: `C:\Users\me\.dsh`
|
|
8
|
+
stays a valid path, but the bytes sit on `D:\`.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
In DSH: **Settings → Plugins → Add plugin**, enter
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
dsh-relocate@1.0.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The bundle registers two Agent tools; no build step and no dependencies.
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
21
|
+
|
|
22
|
+
| Tool | Effect |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `storage_audit` | Read-only. Lists known DSH data roots (real path, link kind, size, file count) and the free space of the volumes that actually hold them. |
|
|
25
|
+
| `storage_relocate` | Plans first; with `confirm: true` it copies, renames, links, and verifies. Existing targets are never overwritten, the original is kept as `<path>.old-<timestamp>`, and a failed step rolls back. |
|
|
26
|
+
|
|
27
|
+
## Safety
|
|
28
|
+
|
|
29
|
+
- `$DSH_HOME`, the active profile, and the installation directory are refused
|
|
30
|
+
while the Host is running — their files are open, so they must be moved from a
|
|
31
|
+
terminal with DSH stopped.
|
|
32
|
+
- Copy failures leave the original untouched and remove the partial copy.
|
|
33
|
+
- Link creation failures restore the original directory.
|
|
34
|
+
|
|
35
|
+
## Limits
|
|
36
|
+
|
|
37
|
+
- A directory held open by a running process cannot be moved (`EPERM`/`EBUSY`).
|
|
38
|
+
- Junctions are a Windows capability; other platforms fall back to a symlink.
|
|
39
|
+
- No "move back" button: delete the link and rename `.old-*` yourself.
|
|
40
|
+
|
|
41
|
+
## Manual use
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
storage_audit
|
|
45
|
+
|
|
46
|
+
storage_relocate
|
|
47
|
+
source: C:\Users\me\AppData\Roaming\@deepseek-ai
|
|
48
|
+
target: D:\workspaces\dsh\desktop-userdata
|
|
49
|
+
|
|
50
|
+
# then, after checking the plan
|
|
51
|
+
storage_relocate
|
|
52
|
+
source: C:\Users\me\AppData\Roaming\@deepseek-ai
|
|
53
|
+
target: D:\workspaces\dsh\desktop-userdata
|
|
54
|
+
confirm: true
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Changelog
|
|
58
|
+
|
|
59
|
+
- 1.0.1 — Chinese documentation; audit now measures through links and resolves the real volume.
|
|
60
|
+
- 1.0.0 — first release.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
中文文档:[README.md](README.md)
|
package/README.md
CHANGED
|
@@ -1,58 +1,85 @@
|
|
|
1
|
-
# dsh-relocate
|
|
1
|
+
# dsh-relocate 目录搬家
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
programs that hard-code the old location keep working while the data lives
|
|
5
|
-
elsewhere.
|
|
3
|
+
把占用 C 盘的数据目录搬到其他盘,并在原路径留下**目录联接(junction)**,让所有写死旧路径的程序照常工作——旧路径还能读写,字节实际落在新盘。
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
stays a valid path, but the bytes sit on `D:\`.
|
|
5
|
+
专治:“我的 C 盘又红了,但这个软件只会往 `C:\Users\...` 里写。”
|
|
9
6
|
|
|
10
|
-
##
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
在 DSH 里:**设置 → 插件 → 添加插件**,填
|
|
11
10
|
|
|
12
11
|
```
|
|
13
|
-
|
|
14
|
-
dsh-relocate
|
|
12
|
+
dsh-relocate@1.0.1
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
或直接对助手说「安装 dsh-relocate 插件」。
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
装好后会多出两个工具:`storage_audit`、`storage_relocate`。
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|---|---|
|
|
23
|
-
| `storage_audit` | Read-only. Lists known DSH data roots (real path, link kind, size, file count) and the free space of the volumes that actually hold them. |
|
|
24
|
-
| `storage_relocate` | Plans first; with `confirm: true` it copies, renames, links, and verifies. Existing targets are never overwritten, the original is kept as `<path>.old-<timestamp>`, and a failed step rolls back. |
|
|
19
|
+
## 两个工具
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
| 工具 | 性质 | 作用 |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| `storage_audit` | **只读** | 列出 DSH 各数据目录:真实位置、是否已是联接、占用体积、文件数,以及相关磁盘剩余空间 |
|
|
24
|
+
| `storage_relocate` | **会改动** | 迁移:默认只出计划;带 `confirm: true` 才真正执行 |
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
while the Host is running — their files are open, so they must be moved from a
|
|
30
|
-
terminal with DSH stopped.
|
|
31
|
-
- Copy failures leave the original untouched and remove the partial copy.
|
|
32
|
-
- Link creation failures restore the original directory.
|
|
26
|
+
## 怎么用
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
先看清楚现状:
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
```
|
|
31
|
+
用 storage_audit 看看我的 C 盘数据都在哪
|
|
32
|
+
```
|
|
39
33
|
|
|
40
|
-
|
|
34
|
+
再迁移一个目录,先看计划:
|
|
41
35
|
|
|
42
36
|
```
|
|
43
|
-
|
|
37
|
+
把 C:\Users\me\AppData\Local\SomeApp\cache 搬到 D:\data\SomeApp-cache
|
|
38
|
+
```
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
source: C:\Users\me\AppData\Roaming\@deepseek-ai
|
|
47
|
-
target: D:\workspaces\dsh\desktop-userdata
|
|
40
|
+
确认无误后执行:
|
|
48
41
|
|
|
49
|
-
# then, after checking the plan
|
|
50
|
-
storage_relocate
|
|
51
|
-
source: C:\Users\me\AppData\Roaming\@deepseek-ai
|
|
52
|
-
target: D:\workspaces\dsh\desktop-userdata
|
|
53
|
-
confirm: true
|
|
54
42
|
```
|
|
43
|
+
同上,confirm: true
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
工具会依次:**复制 → 原目录改名为 `<原路径>.old-<时间戳>` → 在原位置建联接 → 校验联接**。
|
|
47
|
+
|
|
48
|
+
## 安全设计
|
|
49
|
+
|
|
50
|
+
- **不覆盖**:目标已存在直接拒绝;
|
|
51
|
+
- **不越界**:目标不能在源目录内部;
|
|
52
|
+
- **保护运行中的 DSH**:`$DSH_HOME`、当前 profile、安装目录一律拒绝,并提示先退出 DSH、在终端里迁移;
|
|
53
|
+
- **失败即回滚**:复制失败会删除自己创建的部分副本;改名或建联接失败会恢复原目录;
|
|
54
|
+
- **默认保留旧副本**(`keepOld: true`),出问题把 `.old-*` 改回原名即可。
|
|
55
|
+
|
|
56
|
+
## 已知限制
|
|
57
|
+
|
|
58
|
+
- 被进程占用的目录无法复制(Windows 报 `EPERM`/`EBUSY`),请先关闭对应程序;
|
|
59
|
+
- 目录联接是 Windows 能力,其他平台退化为符号链接;
|
|
60
|
+
- 没有“搬回来”按钮:需要时删除联接、把 `.old-*` 改回原名;
|
|
61
|
+
- 工具只报告剩余空间,不会替你判断目标盘够不够。
|
|
62
|
+
|
|
63
|
+
## 常见问题
|
|
64
|
+
|
|
65
|
+
**Q:DSH 自己的 `.dsh` 目录能搬吗?**
|
|
66
|
+
不能,在 DSH 运行时文件是打开的。要先退出 DSH,在终端里用脚本迁移,然后从新位置启动。本仓库的姊妹插件 `dsh-memory` 就是这种迁移之后继续工作的例子。
|
|
67
|
+
|
|
68
|
+
**Q:搬完程序找不到数据?**
|
|
69
|
+
检查原路径是不是联接:`storage_audit` 会显示 `[junction] -> 目标路径`。如果显示普通目录,说明迁移没完成。
|
|
70
|
+
|
|
71
|
+
**Q:会不会把数据弄丢?**
|
|
72
|
+
复制成功之前不会动原目录;复制成功后才改名并建联接;失败会回滚。默认还会保留一份 `.old-*`。
|
|
73
|
+
|
|
74
|
+
## 版本
|
|
75
|
+
|
|
76
|
+
- 1.0.1 — 增加中文文档,修正审计对联接目录的统计与卷信息解析
|
|
77
|
+
- 1.0.0 — 首次发布
|
|
55
78
|
|
|
56
79
|
## License
|
|
57
80
|
|
|
58
81
|
MIT
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
English documentation: [README.en.md](README.en.md)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-relocate",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Move a directory to another drive and leave a junction at the original path, so programs that hard-code C:\\ keep working while the data lives elsewhere.",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Move a directory to another drive and leave a junction at the original path, so programs that hard-code C:\\ keep working while the data lives elsewhere. 把占用 C 盘的数据目录搬到其他盘,原路径留目录联接。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"docs",
|
|
26
26
|
"icon.svg",
|
|
27
27
|
"README.md",
|
|
28
|
+
"README.en.md",
|
|
28
29
|
"LICENSE"
|
|
29
30
|
],
|
|
30
31
|
"engines": {
|