Skip to content
dsh.fish
Bundle

dsh-workspace-default-path

DSH plugin: remember the last used workspace directory for the Add-workspace flow (prefill + auto-memory over the official browse dialog)

Source
masknull
License
MIT
Updated
Updated 5 days ago

Readme

# dsh-workspace-default-path

> 中文版:[README.zh.md](README.zh.md) · DSH (DeepSeek Harness) plugin

Remember the last used workspace directory for the **Add workspace** flow (sidebar / conversation empty-state). Two lightweight hooks over the **official** flow — nothing is replaced, and the whole thing is a single on/off toggle in **Settings → General**.

## Features

- **Remember** — every workspace you add (from the browse dialog, the system dialog, or any other entry) is recorded automatically.
- **Prefill** — with a remembered path, the official "Add workspace" browse dialog opens directly on the last used directory, breadcrumb path bar included; all browsing, editing and confirm interactions stay 100% official.
- **Off = stock** — with the toggle off, both hooks are inert: no redirection, no recording, identical to an uninstalled plugin.
- **Hot-reloadable** — the toggle persists to `$DSH_HOME/settings.yaml` (`dsh-workspace-default-path.rememberLast` / `.lastPath`) and applies immediately, no restart.

## Install

From GitHub (standard, same as any other dsh plugin dependency):

```bash
dsh plugin --profile web add github:masknull/dsh-workspace-default-path
```

The package declares `dsh.bundle`, so the command also activates it (adds it to the profile's `dsh.profile.bundles`). If it is not auto-added, append `"dsh-workspace-default-path"` to that list in `$DSH_HOME/profiles/web/package.json` manually.

Runtime deps of the node half (`@deepseek-ai/schemastery` + `cosmokit` + `@standard-schema/spec`) are declared in `dependencies`, so pnpm resolves them into the profile's hoisted `node_modules` automatically — **no manual copying**.

Verify:

```bash
dsh --profile web --dump-config | grep workspace-default-path
```

Restart the web service after install or any code update (client HMR is disabled in the current web composition). Local development works the same way: `dsh plugin --profile web add '<local-path>'`.

## Usage

1. Open **Settings → General** → "Remember last workspace" → **On**.
2. Add a workspace as usual (any method). Its path is remembered.
3. Next time you click **Add workspace**, the dialog opens on that directory.
4. Toggle **Off** anytime to restore the default behavior.

## How it works

All over official seams; no official interaction is replaced.

| Hook | Mechanism |
|---|---|
| Remember (write) | Subscribes to `ctx.workspaces.list`; any newly appearing workspace's `path` is written to `lastPath` |
| Prefill (read) | The browse dialog opens with `listDirectory(undefined)` (host home). When remembering is on and `lastPath` exists, that initial call is redirected to `listDirectory(lastPath)`; all other calls pass through untouched |

## Version compatibility

- **v0.2.0+ requires DSH ≥ `dsh-v0.1.2-alpha.1`**: that release moved the snapshot-store primitives from `@deepseek-ai/dsh-client-runtime/client` into the frozen module-table word `@deepseek-ai/dsh-client-store`. On older hosts this plugin refuses to load with a clear diagnostic; use the v0.1.x line (built for the client-runtime era) there.
- Needs `@deepseek-ai/dsh-client-ui-workspace` for the `workspaces`/browse-dialog services (built into current DSH).

## Dependencies

- Node half (`lib/index.js`): `@deepseek-ai/schemastery` (+ `@deepseek-ai/cosmokit`, `@standard-schema/spec`) — declared in `dependencies`, installed by pnpm on `add`.
- Browser half: only official frozen-module-table entries (`react`, `@deepseek-ai/dsh-client-store`, `@deepseek-ai/dsh-client-ui-primitives`).

## License

MIT.

Install

dsh plugin --profile web add github:masknull/dsh-workspace-default-path

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source