dsh-better-workspace 0.4.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/LICENSE +21 -0
- package/README.md +118 -0
- package/README_EN.md +100 -0
- package/cordis.patch.yml +22 -0
- package/dsh.plugin.json +13 -0
- package/package.json +66 -0
- package/src/client.js +2053 -0
- package/src/index.js +50 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-better-workspace — host half (plain JavaScript, no build step).
|
|
3
|
+
*
|
|
4
|
+
* The feature lives in the client half (src/client.js): the hierarchy tree,
|
|
5
|
+
* the add-workspace parent-group popup, and view state (persisted in the
|
|
6
|
+
* browser through the dsh client store). This host half exists so the cordis
|
|
7
|
+
* plugin row has a valid Node entry, and to give future server-side features
|
|
8
|
+
* (host-persisted folder registry, a settings-page backend) a home. It is
|
|
9
|
+
* intentionally side-effect free.
|
|
10
|
+
*/
|
|
11
|
+
export const name = 'dsh-better-workspace'
|
|
12
|
+
|
|
13
|
+
export function apply(ctx) {
|
|
14
|
+
const log = ctx && ctx.logger && typeof ctx.logger.info === 'function'
|
|
15
|
+
? (msg) => ctx.logger.info(msg)
|
|
16
|
+
: (msg) => console.log(msg)
|
|
17
|
+
log('[dsh-better-workspace] host half loaded; UI runs in the browser (client half)')
|
|
18
|
+
if (!ctx || typeof ctx.inject !== 'function') return
|
|
19
|
+
// Register the settings namespace so the browser card appears in
|
|
20
|
+
// Settings → Plugins. The tab dispatches the intersection of served
|
|
21
|
+
// namespaces and settings.plugin.item cards, and `settings` is a
|
|
22
|
+
// cross-cutting service that may appear after this plugin's apply — so the
|
|
23
|
+
// registration waits for its injection (the same pattern dsh-context uses).
|
|
24
|
+
// The dsh-settings and zod modules resolve only through the dsh Loader; the
|
|
25
|
+
// smoke test imports this file in plain Node with a logger-only ctx and
|
|
26
|
+
// never reaches this path.
|
|
27
|
+
ctx.inject(['settings'], (sctx) => {
|
|
28
|
+
log('[dsh-better-workspace] settings inject fired')
|
|
29
|
+
// The settings service calls the schema AS A FUNCTION to resolve a value
|
|
30
|
+
// (schema(mergeLayers(...))) — that is @deepseek-ai/schemastery's contract:
|
|
31
|
+
// its schemas are callable and fill defaults on undefined. zod objects are
|
|
32
|
+
// NOT callable, so a zod schema throws "TypeError: ... is not a function"
|
|
33
|
+
// at register(); the namespace is then never served and the Settings →
|
|
34
|
+
// Plugins tab (served namespaces ∩ settings.plugin.item cards) never
|
|
35
|
+
// dispatches our card. Both modules resolve at runtime through normal Node
|
|
36
|
+
// resolution from the plugin's own node_modules (the same static-import
|
|
37
|
+
// pattern dsh-context uses).
|
|
38
|
+
Promise.all([import('@deepseek-ai/dsh-settings'), import('@deepseek-ai/schemastery')])
|
|
39
|
+
.then(([ds, sm]) => {
|
|
40
|
+
const settings = sctx && sctx.settings
|
|
41
|
+
if (!settings || typeof settings.register !== 'function') return
|
|
42
|
+
const Schema = sm.default
|
|
43
|
+
settings.register(ds.settingsNamespace('better-workspace'), Schema.object({ compactChains: Schema.boolean().default(true) }))
|
|
44
|
+
log('[dsh-better-workspace] settings namespace registered: better-workspace')
|
|
45
|
+
})
|
|
46
|
+
.catch((error) => {
|
|
47
|
+
log('[dsh-better-workspace] settings namespace registration FAILED: ' + (error && error.stack || String(error)))
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}
|