@aiwayds/dsh-mcp-adapter 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-mcp-adapter",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "dsh plugin: token-efficient prompt-side shim for the official MCP client — folds mcp__* tool schemas out of every assembled prompt and exposes two constant meta-tools (mcp_list / mcp_call) instead",
5
5
  "keywords": [
6
6
  "dsh",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "link-closure": "node scripts/link-dsh-closure.mjs",
32
- "postinstall": "node scripts/link-dsh-closure.mjs",
32
+ "prepare": "node scripts/link-dsh-closure.mjs",
33
33
  "build": "tsc -p tsconfig.json",
34
34
  "check": "tsc --noEmit -p tsconfig.json",
35
35
  "precheck": "node scripts/link-dsh-closure.mjs",
@@ -78,12 +78,12 @@
78
78
  "typescript": "~5.9.0",
79
79
  "@deepseek-ai/cordis": "4.1.0",
80
80
  "@deepseek-ai/schemastery": "3.19.0",
81
- "@deepseek-ai/dsh-commands": "0.2.2-rc.1",
82
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
83
- "@deepseek-ai/dsh-scope": "0.2.2-rc.1",
84
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
85
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
86
- "@deepseek-ai/dsh-util-values": "0.2.2-rc.1"
81
+ "@deepseek-ai/dsh-commands": "0.2.2-rc.2",
82
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.2",
83
+ "@deepseek-ai/dsh-scope": "0.2.2-rc.2",
84
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.2",
85
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.2",
86
+ "@deepseek-ai/dsh-util-values": "0.2.2-rc.2"
87
87
  },
88
88
  "dsh": {
89
89
  "bundle": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Postinstall linker: point every `node_modules/@deepseek-ai/*` entry at the
2
+ * Install-hook linker: point every `node_modules/@deepseek-ai/*` entry at the
3
3
  * global dsh closure.
4
4
  *
5
5
  * Why this exists: dsh-tui-pi is a plugin that runs *inside* the installed
@@ -17,7 +17,11 @@
17
17
  * (`Property 'settings' does not exist on type 'Context'`), so they must stay
18
18
  * *undeclared*. pnpm then treats the closure links as extraneous — and, as
19
19
  * it prunes entries it once managed, the links can still disappear after an
20
- * install. This script re-creates them on every `pnpm install` (postinstall).
20
+ * install. This script re-creates them on every root install (the `prepare`
21
+ * hook). It is deliberately NOT `postinstall`: pnpm 11 treats any dependency
22
+ * install hook as an unapproved build (strictDepBuilds) and fails the
23
+ * consumer's install, while `prepare` never runs for registry dependencies —
24
+ * so the published package carries no install hook at all.
21
25
  *
22
26
  * It is a no-op (exit 0) when no global dsh install is found — a dev machine
23
27
  * without dsh simply cannot typecheck against dsh types.
@@ -29,15 +33,26 @@ import { dirname, join } from 'node:path'
29
33
  import { fileURLToPath } from 'node:url'
30
34
 
31
35
  const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
32
- // Guard: this postinstall is a dev-machine convenience for THIS repo. A
33
- // published tarball carries scripts/ but no src/, and must never touch a
34
- // consumer's node_modules (it would delete their @deepseek-ai packages and
35
- // replace them with symlinks into their global dsh closure). pnpm ≥10 blocks
36
- // dependency lifecycle scripts by default, but npm would run this — exit
37
- // silently outside the repo.
36
+ // Guard: this hook is a dev-machine convenience for THIS repo. A published
37
+ // tarball carries scripts/ but no src/, and must never touch a consumer's
38
+ // node_modules (it would delete their @deepseek-ai packages and replace them
39
+ // with symlinks into their global dsh closure) — exit silently outside the
40
+ // repo.
38
41
  if (!existsSync(join(repoRoot, 'src'))) {
39
42
  process.exit(0)
40
43
  }
44
+ // Second guard: npm runs `prepare` inside a throwaway clone when installing a
45
+ // git dependency, and a root project install in a subdirectory walks up to
46
+ // this package with INIT_CWD elsewhere. Only a direct root install (INIT_CWD
47
+ // = repoRoot, or unset for `node scripts/...`) may link.
48
+ const initCwd = process.env.INIT_CWD
49
+ if (initCwd !== undefined && initCwd !== '') {
50
+ try {
51
+ if (realpathSync(initCwd) !== realpathSync(repoRoot)) process.exit(0)
52
+ } catch {
53
+ process.exit(0)
54
+ }
55
+ }
41
56
  const scopeDir = join(repoRoot, 'node_modules', '@deepseek-ai')
42
57
 
43
58
  /** The global dsh package's own `node_modules/@deepseek-ai` closure dir. */
@@ -46,7 +46,9 @@ function fail(message, output = '') {
46
46
  process.exit(1)
47
47
  }
48
48
 
49
- const pack = spawnSync('npm', ['pack', '--pack-destination', work], { cwd: repoRoot, encoding: 'utf8' })
49
+ // --ignore-scripts keeps the root `prepare` hook from writing to stdout and
50
+ // corrupting the filename parsed below (the build gate already produced lib/).
51
+ const pack = spawnSync('npm', ['pack', '--pack-destination', work, '--ignore-scripts'], { cwd: repoRoot, encoding: 'utf8' })
50
52
  if (pack.status !== 0 || pack.error) fail('npm pack failed', `${pack.stdout}\n${pack.stderr}`)
51
53
  const tarball = path.join(work, pack.stdout.trim().split('\n').at(-1))
52
54