bcdocker 1.0.1 → 1.0.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/dist/cli.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/ps/BCDocker.psm1 +1 -0
- package/ps/Container.ps1 +48 -11
- package/ps/Helpers.ps1 +20 -0
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ export function createCliProgram() {
|
|
|
7
7
|
program
|
|
8
8
|
.name("bcd")
|
|
9
9
|
.description("CLI for Business Central Docker container management")
|
|
10
|
-
.version("1.0.
|
|
10
|
+
.version("1.0.2");
|
|
11
11
|
// ── Containers ───────────────────────────────────────────
|
|
12
12
|
program
|
|
13
13
|
.command("list")
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
import * as handlers from "./server-handlers.js";
|
|
7
7
|
export const server = new McpServer({
|
|
8
8
|
name: "bcd",
|
|
9
|
-
version: "1.0.
|
|
9
|
+
version: "1.0.2",
|
|
10
10
|
});
|
|
11
11
|
// ── Container Tools ──────────────────────────────────────
|
|
12
12
|
server.tool("list-containers", "List all Business Central Docker containers with their running status", {}, handlers.handleListContainers);
|
package/package.json
CHANGED
package/ps/BCDocker.psm1
CHANGED
package/ps/Container.ps1
CHANGED
|
@@ -97,13 +97,29 @@ function New-BCDContainer {
|
|
|
97
97
|
Write-BCSuccess "Resolved: $artifactUrl"
|
|
98
98
|
|
|
99
99
|
if ($BypassCDN) {
|
|
100
|
-
$
|
|
101
|
-
|
|
100
|
+
$cdnReplacements = @{
|
|
101
|
+
'bcartifacts.azureedge.net' = 'bcartifacts.blob.core.windows.net'
|
|
102
|
+
'bcartifacts-exdbf9fwegejdqak.b02.azurefd.net' = 'bcartifacts.blob.core.windows.net'
|
|
103
|
+
'bcinsider.azureedge.net' = 'bcinsider.blob.core.windows.net'
|
|
104
|
+
'bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net' = 'bcinsider.blob.core.windows.net'
|
|
105
|
+
'bcpublicpreview.azureedge.net' = 'bcpublicpreview.blob.core.windows.net'
|
|
106
|
+
'bcpublicpreview-f2ajahg0e2cudpgh.b02.azurefd.net' = 'bcpublicpreview.blob.core.windows.net'
|
|
107
|
+
'businesscentralapps.azureedge.net' = 'businesscentralapps.blob.core.windows.net'
|
|
108
|
+
'businesscentralapps-hkdrdkaeangzfydv.b02.azurefd.net'= 'businesscentralapps.blob.core.windows.net'
|
|
109
|
+
}
|
|
110
|
+
foreach ($cdn in $cdnReplacements.Keys) {
|
|
111
|
+
if ($artifactUrl -match [regex]::Escape($cdn)) {
|
|
112
|
+
$artifactUrl = $artifactUrl.Replace($cdn, $cdnReplacements[$cdn])
|
|
113
|
+
Write-BCInfo "CDN bypass: $cdn -> $($cdnReplacements[$cdn])"
|
|
114
|
+
break
|
|
115
|
+
}
|
|
116
|
+
}
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
# Step 5 — Connectivity test
|
|
105
120
|
Write-BCStep "5/8" "Testing connectivity..."
|
|
106
|
-
|
|
121
|
+
$artifactHost = ([uri]$artifactUrl).Host
|
|
122
|
+
foreach ($endpoint in @($artifactHost, "bcartifacts.blob.core.windows.net")) {
|
|
107
123
|
try {
|
|
108
124
|
$tcp = Test-NetConnection -ComputerName $endpoint -Port 443 `
|
|
109
125
|
-WarningAction SilentlyContinue -ErrorAction SilentlyContinue
|
|
@@ -212,8 +228,8 @@ function New-BCDContainer {
|
|
|
212
228
|
|
|
213
229
|
Write-BCBanner "Container Created Successfully" "Green"
|
|
214
230
|
|
|
215
|
-
$bcVersion = Get-BcContainerNavVersion -
|
|
216
|
-
$webclientUrl = Get-
|
|
231
|
+
$bcVersion = Get-BcContainerNavVersion -containerOrImageName $ContainerName
|
|
232
|
+
$webclientUrl = Get-BCDockerWebClientUrl -ContainerName $ContainerName -UseHttps:$false
|
|
217
233
|
$testMode = if (-not $IncludeTestToolkit) { "None" }
|
|
218
234
|
elseif ($TestLibrariesOnly) { "Libraries only" }
|
|
219
235
|
else { "Full test framework apps" }
|
|
@@ -278,7 +294,14 @@ function Start-BCDContainer {
|
|
|
278
294
|
}
|
|
279
295
|
|
|
280
296
|
Write-BCStep "START" "Starting '$ContainerName'..."
|
|
281
|
-
|
|
297
|
+
$prevEAP = $ErrorActionPreference; $ErrorActionPreference = 'Continue'
|
|
298
|
+
$null = docker start $ContainerName 2>&1
|
|
299
|
+
$ErrorActionPreference = $prevEAP
|
|
300
|
+
if ($LASTEXITCODE -ne 0) {
|
|
301
|
+
$msg = "Failed to start '$ContainerName'. Container may not exist."
|
|
302
|
+
Write-BCError $msg
|
|
303
|
+
return
|
|
304
|
+
}
|
|
282
305
|
Write-BCSuccess "Container '$ContainerName' started."
|
|
283
306
|
}
|
|
284
307
|
|
|
@@ -296,7 +319,14 @@ function Stop-BCDContainer {
|
|
|
296
319
|
}
|
|
297
320
|
|
|
298
321
|
Write-BCStep "STOP" "Stopping '$ContainerName'..."
|
|
299
|
-
|
|
322
|
+
$prevEAP = $ErrorActionPreference; $ErrorActionPreference = 'Continue'
|
|
323
|
+
$null = docker stop $ContainerName 2>&1
|
|
324
|
+
$ErrorActionPreference = $prevEAP
|
|
325
|
+
if ($LASTEXITCODE -ne 0) {
|
|
326
|
+
$msg = "Failed to stop '$ContainerName'. Container may not exist or is not running."
|
|
327
|
+
Write-BCError $msg
|
|
328
|
+
return
|
|
329
|
+
}
|
|
300
330
|
Write-BCSuccess "Container '$ContainerName' stopped."
|
|
301
331
|
}
|
|
302
332
|
|
|
@@ -314,7 +344,14 @@ function Restart-BCDContainer {
|
|
|
314
344
|
}
|
|
315
345
|
|
|
316
346
|
Write-BCStep "RESTART" "Restarting '$ContainerName'..."
|
|
317
|
-
|
|
347
|
+
$prevEAP = $ErrorActionPreference; $ErrorActionPreference = 'Continue'
|
|
348
|
+
$null = docker restart $ContainerName 2>&1
|
|
349
|
+
$ErrorActionPreference = $prevEAP
|
|
350
|
+
if ($LASTEXITCODE -ne 0) {
|
|
351
|
+
$msg = "Failed to restart '$ContainerName'. Container may not exist."
|
|
352
|
+
Write-BCError $msg
|
|
353
|
+
return
|
|
354
|
+
}
|
|
318
355
|
Write-BCSuccess "Container '$ContainerName' restarted."
|
|
319
356
|
}
|
|
320
357
|
|
|
@@ -362,8 +399,8 @@ function Get-BCDContainerInfo {
|
|
|
362
399
|
if (-not $ContainerName) { return }
|
|
363
400
|
}
|
|
364
401
|
|
|
365
|
-
$bcVersion = Get-BcContainerNavVersion -
|
|
366
|
-
$webUrl = Get-
|
|
402
|
+
$bcVersion = Get-BcContainerNavVersion -containerOrImageName $ContainerName
|
|
403
|
+
$webUrl = Get-BCDockerWebClientUrl -ContainerName $ContainerName -UseHttps:$false
|
|
367
404
|
$inspect = docker inspect $ContainerName --format '{{.State.Status}}' 2>$null
|
|
368
405
|
$statusColor = if ($inspect -eq "running") { "Green" } else { "Red" }
|
|
369
406
|
|
|
@@ -391,7 +428,7 @@ function Open-BCDWebClient {
|
|
|
391
428
|
if (-not $ContainerName) { return }
|
|
392
429
|
}
|
|
393
430
|
|
|
394
|
-
$url = Get-
|
|
431
|
+
$url = Get-BCDockerWebClientUrl -ContainerName $ContainerName -UseHttps:$false
|
|
395
432
|
Write-BCInfo "Opening $url"
|
|
396
433
|
Start-Process $url
|
|
397
434
|
}
|
package/ps/Helpers.ps1
CHANGED
|
@@ -68,6 +68,26 @@ function Assert-BcContainerHelper {
|
|
|
68
68
|
return $true
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
function Get-BCDockerWebClientUrl {
|
|
72
|
+
<#
|
|
73
|
+
.SYNOPSIS
|
|
74
|
+
Resolves Web Client URL for a BC container (BcContainerHelper has no Get-BcContainerUrl in recent versions).
|
|
75
|
+
#>
|
|
76
|
+
param(
|
|
77
|
+
[Parameter(Mandatory)][string]$ContainerName,
|
|
78
|
+
[switch]$UseHttps
|
|
79
|
+
)
|
|
80
|
+
try {
|
|
81
|
+
$cfg = Get-BcContainerServerConfiguration -ContainerName $ContainerName -ErrorAction SilentlyContinue
|
|
82
|
+
if ($null -ne $cfg -and $cfg.PublicWebBaseUrl -and -not [string]::IsNullOrWhiteSpace([string]$cfg.PublicWebBaseUrl)) {
|
|
83
|
+
return ([string]$cfg.PublicWebBaseUrl).TrimEnd('/')
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch { }
|
|
87
|
+
$scheme = if ($UseHttps) { 'https' } else { 'http' }
|
|
88
|
+
return "$($scheme)://$ContainerName/BC"
|
|
89
|
+
}
|
|
90
|
+
|
|
71
91
|
function Select-BCContainer {
|
|
72
92
|
[CmdletBinding()]
|
|
73
93
|
param(
|