Import Once
A DeepSeek Harness plugin that imports the project folders your other AI tools already remember into the DSH sidebar — once, from a single model tool call.
dsh_import_once({ dryRun = false, maxAdd = 50 })
→ { dryRun, tools: [{ id, found }], scanned, missing, added, skipped, errors }
It is the one-shot import shell of Workspace Hub. Hub's long-term sync is no longer maintained; this package keeps only the scanning recipes and the one action that was actually useful.
What it is (and what it is not)
- One action only. No ledger file, no interval timer, no background queue, no Git sync, no pins, no exclude list, no state directory, no CLI subcommands.
- Read-only scan. It asks each AI tool's own state file where its projects are. It never copies project contents, never uploads anything, never phones home.
- Add-only. The only write is one
workspaceRegistry.create(path, title)per missing folder — the same durable call the official sidebar makes. It never renames, reorders, or deletes an existing workspace. - Idempotent without state. Folders DSH already owns are matched by real path, so a second call reports
added: 0. Nothing is remembered between calls because there is nothing to remember. - Dry run is a real empty run.
dryRun: truereports exactly what a real call would do and writes nothing at all.
Install
dsh plugin --profile desktop add dsh-import-once # or --profile web
Restart DSH. Installing does nothing on its own — activation registers one tool and performs no scan, so your sidebar only changes when a model (or you) calls dsh_import_once.
Use
Ask the model to import, or call the tool directly:
Import my projects from other AI tools into DSH. Dry run first.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
dryRun |
boolean | false |
Plan only; report the numbers and write nothing |
maxAdd |
integer | 50 |
Maximum workspaces created by this call; 0 = unlimited |
A dry run against this machine's live DSH store (2026-11-09, macOS, DSH 0.2.2-rc.1) took 1.2 s to read 18 adapters and reduce 1304 raw records to 364 distinct project folders, of which 349 were already in the sidebar — so missing: 28 and a real call with maxAdd: 50 would create all 28 in one pass.
Result fields
| Field | Meaning |
|---|---|
dryRun |
Whether this call only planned |
tools[] |
One row per adapter: its id and found = raw records that adapter reported (0 = tool absent, nothing to read, or not applicable) |
scanned |
Distinct project folders found on disk after filters and real-path dedupe |
missing |
Of those, how many the DSH sidebar did not own before this call |
added |
Workspaces created by this call (in a dry run: that would be created) |
skipped |
Missing folders left for later: over maxAdd, aborted, or failed |
errors[] |
Adapter faults ({ tool, message }) and failed creates ({ path, message }) |
Two invariants always hold: missing = added + skipped, and sum(tools.found) ≥ scanned (the difference is duplicates across tools, app-managed scratch folders, and records whose directory is gone).
What it reads
Every path below is opened read-only, and only the project folder path (plus a display title) is extracted.
| Tool id | Truth source |
|---|---|
dsh |
~/.dsh/storages/workspace.json |
codex-app |
~/.codex/state_5.sqlite (fallback ~/.codex/.codex-global-state.json) |
claude-code |
~/.claude.json |
claude-desktop |
app data …/Claude/claude-code-sessions/<account>/<project>/ |
trae / cursor / antigravity |
VS Code-fork state.vscdb (history.recentlyOpenedPathsList) |
workbuddy |
~/.workbuddy/workbuddy.db |
kimi |
~/.kimi/kimi.json + ~/.kimi/sessions |
uking |
~/.uking/tasks.json |
qwenwork |
~/.qwenworkcn/projects |
codebuddy |
~/.codebuddy/projects |
pi |
~/.pi/agent/sessions |
qoder |
~/.qoder/projects |
deepseek-tui |
~/.deepseek/sessions |
hermes |
~/.hermes/state.db |
doubao / doubao-work |
probe only — no workdirs (doubao-work is cloud-only), always found: 0 |
Truth source per platform differs from the table where the app stores state elsewhere (for example WorkBuddy on Windows uses %USERPROFILE%\.workbuddy); the adapters resolve that themselves.
Things it will never do
- Copy, move, archive, or read the contents of a project folder — only the folder path is used.
- Upload, sync, or send anything anywhere. There is no network code in this package.
- Modify another tool's state file. Some adapters copy a live SQLite database into the system temp directory to read it without lock risk, then delete that copy immediately; nothing persistent is left behind.
- Delete, rename, or reorder a workspace. Removal stays a manual sidebar action.
- Write a ledger, cache, or
.statefile. There is no state directory at all — the DSH registry is the only state, and it is the host's.
Relation to Workspace Hub
Workspace Hub (dsh-plugin-workspace-hub 0.3.7) scanned 14+ tools, wrote a ledger, planned, seeded the sidebar, offered an interval timer, a wshub CLI, and optional cross-device Git sync. Long-term sync turned out to be the hard part to maintain, so the product was cut back to the one action users kept asking for.
What went away with it: ledger (ledger.json), pins, excludes, interval timer, background queue, Git sync, state directory, CLI subcommands.
What stayed is the knowledge of how to read each tool, copied byte-for-byte from Hub with its comments intact — see vendor/README.md for the source commit, per-file SHA-256, and the license note. test/package.test.mjs fails if a copied file drifts from the Hub checkout.
Add it to DSH Discover (optional)
DSH 0.2.2 ships an experimental plugin market with a Discover tab. It has no official catalog; Discover lists only the index sources a user adds. This repository is one:
https://raw.githubusercontent.com/dongsheng123132/dsh-import-once/main/plugin-index.json
Open Plugins → Discover → Add index source, paste the URL, then search for import-once.
Limits
- Verified on macOS 26.2 + DSH 0.2.2-rc.1 only. The Windows and Linux branches exist in the vendored adapters (same code Hub shipped) but were not exercised on real machines for this release.
- Coverage is the Hub adapter set: a tool that is not in the table above is not imported.
- Only folders that still exist are imported. Stale records are filtered silently — that is why
sum(tools.found)can be much larger thanscanned. app-managedrecords are skipped on purpose: several tools create scratch directories per task (WorkBuddy~/WorkBuddy/<timestamp>/, Kimi temp scratch, …) and those belong to their own tool, not to your sidebar.- A workspace imported by mistake must be removed by hand; this plugin deliberately has no delete path.
- Tool description and rendered text are English only; this README and its Chinese companion are the only localized surfaces.
- Sidebar order: the registry prepends every new workspace, so the call creates in reverse scan order. The top of the sidebar therefore follows scan order, not the other tool's activity order.
Develop
npm install
npm run check # typecheck + build + test
npm pack --dry-run # what actually ships
Layout:
src/ TypeScript: adapters loader, scan, plan, execute, service, tool
lib/ build output (committed; `npm run build` regenerates it)
vendor/ byte-for-byte copies from Workspace Hub, MIT (see vendor/README.md)
test/ behaviour tests, real-composition test, package-boundary test
cordis.patch.yml / dsh-plugin.naming.json / tsconfig.json
License
MIT. The vendored files under vendor/ are MIT as well, Copyright (c) 2026 He Fangsheng — one LICENSE covers both.
中文速读
做什么:把别的 AI 工具(Codex、Claude Code、Trae、Cursor、WorkBuddy、Kimi、Hermes…)里已经记着的项目目录,一次性补进 DSH 左侧工作区。只有一个模型工具 dsh_import_once({ dryRun, maxAdd })。
只读:只读各工具自己的状态文件,取出「项目目录路径 + 显示名」,不读项目内容、不复制、不上传、不改别人的文件。少数 SQLite 库会先复制到系统临时目录再读,读完立刻删除。
只加不删:唯一的写操作是对每个缺失目录调用宿主官方 workspaceRegistry.create。不重命名、不排序、不删除已有工作区。
幂等:按 realpath 去重 + 与现有工作区比对,连点两次第二次 added: 0,不靠任何账本文件。
DRY RUN 会空跑:dryRun: true 只报数字,什么都不写。
没有:账本、pins、exclude、定时器、Git 同步、后台队列、state 目录、CLI 子命令 —— 这些是 Workspace Hub 里被砍掉的部分。
与 Workspace Hub 的关系:本包是它的一次性导入外壳。Hub 不再维护长期同步;扫描器按源码逐字节复制到 vendor/(保留原注释,来源 commit 与每个文件 SHA-256 见 vendor/README.md,MIT 同作者)。
已知限制:只在 macOS 26.2 + DSH 0.2.2-rc.1 实测;Windows/Linux 分支沿用 Hub 代码但未真机验证;误导入的工作区只能手动在侧栏删除;工具描述与渲染文案只有英文。
No comments yet. Be the first to write one.