d365fo-mcp 1.19.0 → 1.19.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.
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export type BridgeAction = 'none' | 'optional' | 'required';
|
|
15
15
|
export declare function bridgeAction(hadBridge: boolean, existsNow: boolean): BridgeAction;
|
|
16
|
+
/**
|
|
17
|
+
* Where `npm install -g` runs. Anywhere but the package itself.
|
|
18
|
+
*
|
|
19
|
+
* runShell defaults to repoRoot, which for an npm install IS the directory
|
|
20
|
+
* npm is about to replace — and npm replaces it by renaming it aside first.
|
|
21
|
+
* Windows refuses to rename a directory that any process has as its working
|
|
22
|
+
* directory, so the shell and npm spawned there held the very lock that made
|
|
23
|
+
* the rename fail with EBUSY/EPERM. The home directory is outside every
|
|
24
|
+
* global prefix npm uses.
|
|
25
|
+
*/
|
|
26
|
+
export declare function globalInstallCwd(): string;
|
|
16
27
|
export declare function updateCommand(opts: {
|
|
17
28
|
yes?: boolean;
|
|
18
29
|
}): Promise<void>;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* build); an npm install reinstalls itself from the registry.
|
|
8
8
|
*/
|
|
9
9
|
import * as fs from 'node:fs';
|
|
10
|
-
import {
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { DOTNET_MISSING, bridgeBuildCommand, installMode, isWindows, paths, repoRoot } from '../context.js';
|
|
11
12
|
import { commandExists, runExe, runShell } from '../exec.js';
|
|
12
13
|
import { listInstances } from '../instances.js';
|
|
13
14
|
import { checkRelease } from '../npmRegistry.js';
|
|
@@ -19,6 +20,19 @@ export function bridgeAction(hadBridge, existsNow) {
|
|
|
19
20
|
return 'none';
|
|
20
21
|
return existsNow ? 'optional' : 'required';
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Where `npm install -g` runs. Anywhere but the package itself.
|
|
25
|
+
*
|
|
26
|
+
* runShell defaults to repoRoot, which for an npm install IS the directory
|
|
27
|
+
* npm is about to replace — and npm replaces it by renaming it aside first.
|
|
28
|
+
* Windows refuses to rename a directory that any process has as its working
|
|
29
|
+
* directory, so the shell and npm spawned there held the very lock that made
|
|
30
|
+
* the rename fail with EBUSY/EPERM. The home directory is outside every
|
|
31
|
+
* global prefix npm uses.
|
|
32
|
+
*/
|
|
33
|
+
export function globalInstallCwd() {
|
|
34
|
+
return homedir();
|
|
35
|
+
}
|
|
22
36
|
export async function updateCommand(opts) {
|
|
23
37
|
p.intro('d365fo-mcp update');
|
|
24
38
|
if (!requireFullInstall())
|
|
@@ -47,7 +61,7 @@ export async function updateCommand(opts) {
|
|
|
47
61
|
// as "this install never needed writes" and silently moving on.
|
|
48
62
|
const hadBridge = isWindows && fs.existsSync(paths.bridgeExe);
|
|
49
63
|
const steps = installMode === 'npm'
|
|
50
|
-
? [['npm install -g d365fo-mcp@latest', () => runShell('npm install -g d365fo-mcp@latest')]]
|
|
64
|
+
? [['npm install -g d365fo-mcp@latest', () => runShell('npm install -g d365fo-mcp@latest', { cwd: globalInstallCwd() })]]
|
|
51
65
|
: [
|
|
52
66
|
['git pull', () => runExe('git', ['pull'])],
|
|
53
67
|
['npm install', () => runShell('npm install')],
|
|
@@ -57,6 +71,12 @@ export async function updateCommand(opts) {
|
|
|
57
71
|
p.log.step(label);
|
|
58
72
|
if (await run() !== 0) {
|
|
59
73
|
p.log.error(`${label} failed — fix the error above and re-run.`);
|
|
74
|
+
if (installMode === 'npm' && isWindows) {
|
|
75
|
+
// The other thing that pins the package directory: a server still
|
|
76
|
+
// running from it (VS Code / Visual Studio keep MCP servers alive) or
|
|
77
|
+
// its bridge, when an older release built the bridge inside the package.
|
|
78
|
+
p.log.info(`If npm reports EPERM/EBUSY on ${repoRoot}, close VS Code / Visual Studio (or stop the MCP server) and run the update again.`);
|
|
79
|
+
}
|
|
60
80
|
process.exitCode = 1;
|
|
61
81
|
return;
|
|
62
82
|
}
|