@iridensity_gray/dsh-work-deleter 0.0.0-stage → 1.3.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/LICENSE +21 -0
- package/README.md +64 -2
- package/README.zh.md +54 -0
- package/cleanup.ps1 +46 -0
- package/client.js +1165 -0
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +86 -0
- package/docs/DETAIL.zh.md +68 -0
- package/docs/preview.svg +60 -0
- package/icon.svg +9 -0
- package/index.js +1442 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +63 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BDJC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-work-deleter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DeepSeek Harness bundle that removes a workspace as one unit — working
|
|
4
|
+
directory, session logs and `workspace.json` registration — and can restore it
|
|
5
|
+
from a complete backup.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Delete
|
|
10
|
+
|
|
11
|
+
The sidebar footer gains a button to the right of "Migrate". Choose **Delete**
|
|
12
|
+
at the top of the panel, tick one or more workspaces (select-all is supported),
|
|
13
|
+
review the paths that will be removed, then type the confirmation word.
|
|
14
|
+
|
|
15
|
+
Order of operations: **full backup → drop the registration → delete from disk**.
|
|
16
|
+
A failed backup stops the operation before anything is touched.
|
|
17
|
+
|
|
18
|
+
Workspaces blocked by the safety guard or referenced by an active scheduled task
|
|
19
|
+
are listed and skipped; the rest continue.
|
|
20
|
+
|
|
21
|
+
## Restore
|
|
22
|
+
|
|
23
|
+
Choose **Restore** in the same panel and pick a backup. The destination path can
|
|
24
|
+
be changed; missing files are written, existing files are kept unless "Allow
|
|
25
|
+
overwrite" is ticked, and the registration is inserted back at its original
|
|
26
|
+
position. Restore only writes, never deletes.
|
|
27
|
+
|
|
28
|
+
## Backups
|
|
29
|
+
|
|
30
|
+
Each deleted workspace is backed up separately under
|
|
31
|
+
`<DSH_HOME>/storages/work-deleter/backup-<stamp>/`, with the complete directory
|
|
32
|
+
tree, session logs, the `workspace.json` of that moment and a manifest.
|
|
33
|
+
|
|
34
|
+
## Safety
|
|
35
|
+
|
|
36
|
+
Deleting refuses the drive root, the user profile, the DSH data directory, the
|
|
37
|
+
backup directory, a directory containing another registered workspace, a
|
|
38
|
+
workspace referenced by an active scheduled task, and the plugin's own code or
|
|
39
|
+
the DSH installation. Restoring refuses to write into the plugin's own code.
|
|
40
|
+
|
|
41
|
+
## Limits
|
|
42
|
+
|
|
43
|
+
- **Restart DSH** after deleting or restoring; the running Host keeps its
|
|
44
|
+
in-memory workspace cache.
|
|
45
|
+
- A large working directory is copied into the backup first, so free disk space
|
|
46
|
+
must exceed its size.
|
|
47
|
+
- Developed and tested on Windows; other platforms are untested.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dsh plugin --profile <profile> add @iridensity_gray/dsh-work-deleter
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Restart DSH after installing so the sidebar button appears.
|
|
56
|
+
|
|
57
|
+
## Uninstall
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
dsh plugin --profile <profile> remove @iridensity_gray/dsh-work-deleter
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# dsh-work-deleter
|
|
2
|
+
|
|
3
|
+
DeepSeek Harness 插件:把一个工作作为整体删除——工作目录、会话日志和
|
|
4
|
+
`workspace.json` 登记一起处理,并能从完整备份恢复。
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## 删除
|
|
9
|
+
|
|
10
|
+
侧边栏底部「迁移」右边多一个按钮。在面板顶部选择**删除**,勾选一个或多个工作
|
|
11
|
+
(支持全选),核对将删除的路径,然后输入确认词。
|
|
12
|
+
|
|
13
|
+
顺序是:**完整备份 → 摘登记 → 删磁盘**。备份失败会在碰任何文件之前中止。
|
|
14
|
+
|
|
15
|
+
被安全护栏或活动定时任务拦下的工作会列出并跳过,其余继续。
|
|
16
|
+
|
|
17
|
+
## 恢复
|
|
18
|
+
|
|
19
|
+
在同一面板选择**恢复**,挑一个备份。目标路径可以改;默认只补缺失文件,
|
|
20
|
+
勾选「允许覆盖」才替换同名文件;登记会插回原来的位置。恢复只写不删。
|
|
21
|
+
|
|
22
|
+
## 备份
|
|
23
|
+
|
|
24
|
+
每个被删的工作单独备份在 `<DSH_HOME>/storages/work-deleter/backup-<时间戳>/`,
|
|
25
|
+
内含完整目录树、会话日志、删除时的 `workspace.json` 和清单。
|
|
26
|
+
|
|
27
|
+
## 安全
|
|
28
|
+
|
|
29
|
+
删除会拒绝盘符根、用户主目录、DSH 数据目录、备份目录、含有其他已登记工作的目录、
|
|
30
|
+
被活动定时任务引用的工作,以及插件自身代码和 DSH 安装目录。恢复不会写进插件自己的代码目录。
|
|
31
|
+
|
|
32
|
+
## 限制
|
|
33
|
+
|
|
34
|
+
- **删除或恢复后重启 DSH**;运行中的 Host 还持有内存里的工作区缓存。
|
|
35
|
+
- 大目录删除前会先完整备份,空闲磁盘需要大于目录体积。
|
|
36
|
+
- 在 Windows 上开发和测试,其他平台未验证。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
dsh plugin --profile <profile> add @iridensity_gray/dsh-work-deleter
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
安装后重启 DSH,侧边栏按钮才会出现。
|
|
45
|
+
|
|
46
|
+
## 卸载
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dsh plugin --profile <profile> remove @iridensity_gray/dsh-work-deleter
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 许可证
|
|
53
|
+
|
|
54
|
+
MIT
|
package/cleanup.ps1
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Deletes one DSH working directory, its session directories, and its
|
|
2
|
+
# workspace.json registration. Usage: cleanup.ps1 -Target <absolute directory>
|
|
3
|
+
param(
|
|
4
|
+
[Parameter(Mandatory = $true)]
|
|
5
|
+
[string]$Target
|
|
6
|
+
)
|
|
7
|
+
$ErrorActionPreference = 'SilentlyContinue'
|
|
8
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
9
|
+
|
|
10
|
+
function Test-Within ([string]$Child, [string]$Parent) {
|
|
11
|
+
$c = [System.IO.Path]::GetFullPath($Child).TrimEnd('\')
|
|
12
|
+
$p = [System.IO.Path]::GetFullPath($Parent).TrimEnd('\')
|
|
13
|
+
return ($c -eq $p) -or $c.StartsWith($p + '\', [System.StringComparison]::OrdinalIgnoreCase)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Resolve through symlinks so a junction cannot smuggle a protected path in.
|
|
17
|
+
$real = (Resolve-Path -LiteralPath $Target -ErrorAction SilentlyContinue).ProviderPath
|
|
18
|
+
if (-not $real) { exit 0 }
|
|
19
|
+
$full = [System.IO.Path]::GetFullPath($real)
|
|
20
|
+
|
|
21
|
+
# Refuse the disk root, the user profile, and the DSH home in any spelling.
|
|
22
|
+
if ($full.TrimEnd('\') -match '^[A-Za-z]:$') { Write-Error 'refused: drive root'; exit 2 }
|
|
23
|
+
$userProfile = $env:USERPROFILE
|
|
24
|
+
$dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $userProfile '.dsh' }
|
|
25
|
+
if ($userProfile -and ((Test-Within $full $userProfile) -or (Test-Within $userProfile $full))) {
|
|
26
|
+
Write-Error 'refused: user profile'; exit 2
|
|
27
|
+
}
|
|
28
|
+
if ($dshHome -and ((Test-Within $full $dshHome) -or (Test-Within $dshHome $full))) {
|
|
29
|
+
Write-Error 'refused: DSH home'; exit 2
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for ($attempt = 1; $attempt -le 2; $attempt++) {
|
|
33
|
+
if (-not (Test-Path -LiteralPath $full)) { exit 0 }
|
|
34
|
+
Remove-Item -LiteralPath $full -Recurse -Force -ErrorAction SilentlyContinue
|
|
35
|
+
if (-not (Test-Path -LiteralPath $full)) { exit 0 }
|
|
36
|
+
# Clear read-only/hidden attributes that block a recursive delete.
|
|
37
|
+
Get-ChildItem -LiteralPath $full -Recurse -Force -ErrorAction SilentlyContinue |
|
|
38
|
+
ForEach-Object { $_.Attributes = 'Normal' }
|
|
39
|
+
Remove-Item -LiteralPath $full -Recurse -Force -ErrorAction SilentlyContinue
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (Test-Path -LiteralPath $full) {
|
|
43
|
+
Write-Error "still present: $full (a file in it is open in another program)"
|
|
44
|
+
exit 1
|
|
45
|
+
}
|
|
46
|
+
exit 0
|