@soyrageagency/docker-mcp 1.1.0
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 +882 -0
- package/dist/ai/credentials.d.ts +72 -0
- package/dist/ai/credentials.js +157 -0
- package/dist/ai/credentials.js.map +1 -0
- package/dist/ai/login.d.ts +22 -0
- package/dist/ai/login.js +189 -0
- package/dist/ai/login.js.map +1 -0
- package/dist/ai/provider.d.ts +29 -0
- package/dist/ai/provider.js +113 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/assets.d.ts +20 -0
- package/dist/assets.js +56 -0
- package/dist/assets.js.map +1 -0
- package/dist/branding.d.ts +31 -0
- package/dist/branding.js +61 -0
- package/dist/branding.js.map +1 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +128 -0
- package/dist/config.js.map +1 -0
- package/dist/docker/client.d.ts +66 -0
- package/dist/docker/client.js +161 -0
- package/dist/docker/client.js.map +1 -0
- package/dist/docker/compose.d.ts +74 -0
- package/dist/docker/compose.js +126 -0
- package/dist/docker/compose.js.map +1 -0
- package/dist/entry.d.ts +15 -0
- package/dist/entry.js +33 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +25 -0
- package/dist/logger.js +68 -0
- package/dist/logger.js.map +1 -0
- package/dist/panel/index.d.ts +16 -0
- package/dist/panel/index.js +53 -0
- package/dist/panel/index.js.map +1 -0
- package/dist/panel/public/app.js +1004 -0
- package/dist/panel/public/index.html +243 -0
- package/dist/panel/public/styles.css +428 -0
- package/dist/panel/server.d.ts +23 -0
- package/dist/panel/server.js +355 -0
- package/dist/panel/server.js.map +1 -0
- package/dist/panel/service.d.ts +327 -0
- package/dist/panel/service.js +1356 -0
- package/dist/panel/service.js.map +1 -0
- package/dist/plugins.d.ts +50 -0
- package/dist/plugins.js +121 -0
- package/dist/plugins.js.map +1 -0
- package/dist/ragedocker.d.ts +21 -0
- package/dist/ragedocker.js +164 -0
- package/dist/ragedocker.js.map +1 -0
- package/dist/tools/about.d.ts +15 -0
- package/dist/tools/about.js +55 -0
- package/dist/tools/about.js.map +1 -0
- package/dist/tools/compose.d.ts +19 -0
- package/dist/tools/compose.js +145 -0
- package/dist/tools/compose.js.map +1 -0
- package/dist/tools/containers.d.ts +13 -0
- package/dist/tools/containers.js +119 -0
- package/dist/tools/containers.js.map +1 -0
- package/dist/tools/context.d.ts +37 -0
- package/dist/tools/context.js +13 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/images.d.ts +11 -0
- package/dist/tools/images.js +38 -0
- package/dist/tools/images.js.map +1 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/index.js +34 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lifecycle.d.ts +16 -0
- package/dist/tools/lifecycle.js +165 -0
- package/dist/tools/lifecycle.js.map +1 -0
- package/dist/tools/logs.d.ts +15 -0
- package/dist/tools/logs.js +110 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/system.d.ts +14 -0
- package/dist/tools/system.js +108 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tui/ansi.d.ts +66 -0
- package/dist/tui/ansi.js +118 -0
- package/dist/tui/ansi.js.map +1 -0
- package/dist/tui/app.d.ts +160 -0
- package/dist/tui/app.js +1339 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/box.d.ts +18 -0
- package/dist/tui/box.js +38 -0
- package/dist/tui/box.js.map +1 -0
- package/dist/tui/index.d.ts +19 -0
- package/dist/tui/index.js +66 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/update/channel.d.ts +82 -0
- package/dist/update/channel.js +178 -0
- package/dist/update/channel.js.map +1 -0
- package/dist/updates.json +42 -0
- package/dist/utils/format.d.ts +24 -0
- package/dist/utils/format.js +69 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/result.d.ts +35 -0
- package/dist/utils/result.js +31 -0
- package/dist/utils/result.js.map +1 -0
- package/package.json +90 -0
- package/scripts/install.mjs +132 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/tools/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,sBAAsB,CAAC,GAAgB;IACrD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAE/C,2DAA2D;IAC3D,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,6DAA6D;YAC7D,8BAA8B;QAChC,WAAW,EAAE;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SAC/D;KACF,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CACtB,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC,cAAc,aAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAC3E,CAAC;Q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,MAAM,CAAC,CAAC,CAAC;oBACvC,OAAO;gBACT,CAAC;gBACD,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAC7C,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC;gBACzB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;gBAChE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;YACxB,CAAC;YACD,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container log retrieval.
|
|
3
|
+
*
|
|
4
|
+
* • container_logs — fetch the tail of a container's stdout/stderr.
|
|
5
|
+
*
|
|
6
|
+
* Docker multiplexes stdout and stderr over a single stream with an 8-byte
|
|
7
|
+
* header per frame when a TTY is not allocated. We demultiplex it here so the
|
|
8
|
+
* LLM receives clean, readable text.
|
|
9
|
+
*
|
|
10
|
+
* Part of Docker MCP Server.
|
|
11
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolContext } from "./context.js";
|
|
15
|
+
export declare function registerLogTools({ server, docker, config }: ToolContext): void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container log retrieval.
|
|
3
|
+
*
|
|
4
|
+
* • container_logs — fetch the tail of a container's stdout/stderr.
|
|
5
|
+
*
|
|
6
|
+
* Docker multiplexes stdout and stderr over a single stream with an 8-byte
|
|
7
|
+
* header per frame when a TTY is not allocated. We demultiplex it here so the
|
|
8
|
+
* LLM receives clean, readable text.
|
|
9
|
+
*
|
|
10
|
+
* Part of Docker MCP Server.
|
|
11
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { normalizeName } from "../docker/client.js";
|
|
16
|
+
import { guard, ok } from "../utils/result.js";
|
|
17
|
+
/**
|
|
18
|
+
* Strip Docker's stream-multiplexing headers from a non-TTY log buffer.
|
|
19
|
+
* Each frame is: [stream(1)][000][size(4, big-endian)][payload(size)].
|
|
20
|
+
* If the buffer doesn't look framed (TTY containers), it is returned as-is.
|
|
21
|
+
*/
|
|
22
|
+
function demultiplex(buffer) {
|
|
23
|
+
const chunks = [];
|
|
24
|
+
let offset = 0;
|
|
25
|
+
while (offset + 8 <= buffer.length) {
|
|
26
|
+
const streamType = buffer[offset];
|
|
27
|
+
// A valid header has stream type 0, 1 or 2 and three zero bytes after it.
|
|
28
|
+
const looksFramed = (streamType === 0 || streamType === 1 || streamType === 2) &&
|
|
29
|
+
buffer[offset + 1] === 0 &&
|
|
30
|
+
buffer[offset + 2] === 0 &&
|
|
31
|
+
buffer[offset + 3] === 0;
|
|
32
|
+
if (!looksFramed)
|
|
33
|
+
return buffer.toString("utf8");
|
|
34
|
+
const size = buffer.readUInt32BE(offset + 4);
|
|
35
|
+
const start = offset + 8;
|
|
36
|
+
const end = start + size;
|
|
37
|
+
if (end > buffer.length)
|
|
38
|
+
break;
|
|
39
|
+
chunks.push(buffer.subarray(start, end).toString("utf8"));
|
|
40
|
+
offset = end;
|
|
41
|
+
}
|
|
42
|
+
return chunks.length > 0 ? chunks.join("") : buffer.toString("utf8");
|
|
43
|
+
}
|
|
44
|
+
export function registerLogTools({ server, docker, config }) {
|
|
45
|
+
server.registerTool("container_logs", {
|
|
46
|
+
title: "Read container logs",
|
|
47
|
+
description: "Fetch the most recent log lines from a container's stdout/stderr. " +
|
|
48
|
+
"Use this to diagnose crashes, watch startup output or confirm a " +
|
|
49
|
+
"deployment. Supports an optional time window via `since`.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
container: z
|
|
52
|
+
.string()
|
|
53
|
+
.min(1)
|
|
54
|
+
.describe("Container name, short id or full id."),
|
|
55
|
+
tail: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.positive()
|
|
59
|
+
.max(5000)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("Number of trailing lines to return (default from server config)."),
|
|
62
|
+
since: z
|
|
63
|
+
.string()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Only return logs newer than this. Accepts a Unix timestamp " +
|
|
66
|
+
"(seconds) or a relative value like '10m' or '2h'."),
|
|
67
|
+
timestamps: z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Prefix each line with its timestamp (default: false)."),
|
|
71
|
+
},
|
|
72
|
+
}, async ({ container, tail, since, timestamps }) => guard(async () => {
|
|
73
|
+
const handle = await docker.resolveContainer(container);
|
|
74
|
+
const options = {
|
|
75
|
+
stdout: true,
|
|
76
|
+
stderr: true,
|
|
77
|
+
tail: tail ?? config.defaultLogTail,
|
|
78
|
+
timestamps: timestamps ?? false,
|
|
79
|
+
};
|
|
80
|
+
const sinceSeconds = parseSince(since);
|
|
81
|
+
if (sinceSeconds !== undefined)
|
|
82
|
+
options.since = sinceSeconds;
|
|
83
|
+
const raw = (await handle.logs(options));
|
|
84
|
+
const text = demultiplex(Buffer.from(raw)).trimEnd();
|
|
85
|
+
const name = normalizeName(container);
|
|
86
|
+
if (!text) {
|
|
87
|
+
return ok(`No log output for "${name}" in the requested window.`);
|
|
88
|
+
}
|
|
89
|
+
return ok(`Last ${options.tail} line(s) for "${name}":\n\n\`\`\`log\n${text}\n\`\`\``);
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Convert a `since` argument into an absolute Unix timestamp (seconds).
|
|
94
|
+
* Accepts raw seconds ("1700000000") or relative durations ("10m", "2h", "1d").
|
|
95
|
+
*/
|
|
96
|
+
function parseSince(since) {
|
|
97
|
+
if (!since)
|
|
98
|
+
return undefined;
|
|
99
|
+
const value = since.trim();
|
|
100
|
+
if (/^\d+$/.test(value))
|
|
101
|
+
return Number.parseInt(value, 10);
|
|
102
|
+
const match = /^(\d+)\s*(s|m|h|d)$/i.exec(value);
|
|
103
|
+
if (!match)
|
|
104
|
+
return undefined;
|
|
105
|
+
const amount = Number.parseInt(match[1], 10);
|
|
106
|
+
const unitSeconds = { s: 1, m: 60, h: 3600, d: 86400 };
|
|
107
|
+
const seconds = amount * unitSeconds[match[2].toLowerCase()];
|
|
108
|
+
return Math.floor(Date.now() / 1000) - seconds;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/tools/logs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;GAIG;AACH,SAAS,WAAW,CAAC,MAAc;IACjC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,OAAO,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,0EAA0E;QAC1E,MAAM,WAAW,GACf,CAAC,UAAU,KAAK,CAAC,IAAI,UAAU,KAAK,C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AAU,CAC5E,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAE7B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7C,MAAM,WAAW,GAA2B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IAC/E,MAAM,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host- and daemon-level tools.
|
|
3
|
+
*
|
|
4
|
+
* • system_info — daemon summary (version, OS, resources, counts).
|
|
5
|
+
* • disk_usage — reclaimable space across images/containers/volumes.
|
|
6
|
+
* • list_networks — user and default networks.
|
|
7
|
+
* • list_volumes — named volumes and their drivers.
|
|
8
|
+
*
|
|
9
|
+
* Part of Docker MCP Server.
|
|
10
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolContext } from "./context.js";
|
|
14
|
+
export declare function registerSystemTools({ server, docker }: ToolContext): void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host- and daemon-level tools.
|
|
3
|
+
*
|
|
4
|
+
* • system_info — daemon summary (version, OS, resources, counts).
|
|
5
|
+
* • disk_usage — reclaimable space across images/containers/volumes.
|
|
6
|
+
* • list_networks — user and default networks.
|
|
7
|
+
* • list_volumes — named volumes and their drivers.
|
|
8
|
+
*
|
|
9
|
+
* Part of Docker MCP Server.
|
|
10
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
import { formatBytes, renderTable, truncate } from "../utils/format.js";
|
|
14
|
+
import { guard, ok } from "../utils/result.js";
|
|
15
|
+
export function registerSystemTools({ server, docker }) {
|
|
16
|
+
server.registerTool("system_info", {
|
|
17
|
+
title: "System info",
|
|
18
|
+
description: "Summarise the Docker daemon: engine version, host OS/architecture, " +
|
|
19
|
+
"CPU and memory available, and how many containers/images exist. Use " +
|
|
20
|
+
"this to answer 'what does this server look like?'.",
|
|
21
|
+
inputSchema: {},
|
|
22
|
+
}, async () => guard(async () => {
|
|
23
|
+
const [info, version] = await Promise.all([
|
|
24
|
+
docker.info(),
|
|
25
|
+
docker.version(),
|
|
26
|
+
]);
|
|
27
|
+
const get = (obj, key) => obj[key] === undefined ? "n/a" : String(obj[key]);
|
|
28
|
+
const memBytes = Number(info.MemTotal ?? 0);
|
|
29
|
+
const lines = [
|
|
30
|
+
`Engine: ${get(version, "Version")} (API ${get(version, "ApiVersion")})`,
|
|
31
|
+
`Host OS: ${get(info, "OperatingSystem")} / ${get(info, "OSType")}-${get(info, "Architecture")}`,
|
|
32
|
+
`Kernel: ${get(info, "KernelVersion")}`,
|
|
33
|
+
`CPUs: ${get(info, "NCPU")}`,
|
|
34
|
+
`Memory: ${formatBytes(memBytes)}`,
|
|
35
|
+
`Containers: ${get(info, "Containers")} (running ${get(info, "ContainersRunning")}, stopped ${get(info, "ContainersStopped")})`,
|
|
36
|
+
`Images: ${get(info, "Images")}`,
|
|
37
|
+
`Storage driver:${" "}${get(info, "Driver")}`,
|
|
38
|
+
`Docker root: ${get(info, "DockerRootDir")}`,
|
|
39
|
+
];
|
|
40
|
+
return ok(lines.join("\n"));
|
|
41
|
+
}));
|
|
42
|
+
server.registerTool("disk_usage", {
|
|
43
|
+
title: "Disk usage",
|
|
44
|
+
description: "Report Docker disk usage across images, containers and volumes " +
|
|
45
|
+
"(equivalent to `docker system df`), highlighting reclaimable space.",
|
|
46
|
+
inputSchema: {},
|
|
47
|
+
}, async () => guard(async () => {
|
|
48
|
+
const df = await docker.diskUsage();
|
|
49
|
+
const sumSize = (items) => Array.isArray(items)
|
|
50
|
+
? items.reduce((sum, item) => sum + Number(item.Size ?? 0), 0)
|
|
51
|
+
: 0;
|
|
52
|
+
const images = df.Images;
|
|
53
|
+
const containers = df.Containers;
|
|
54
|
+
const volumes = df.Volumes;
|
|
55
|
+
const rows = [
|
|
56
|
+
[
|
|
57
|
+
"Images",
|
|
58
|
+
String(Array.isArray(images) ? images.length : 0),
|
|
59
|
+
formatBytes(sumSize(images)),
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"Containers",
|
|
63
|
+
String(Array.isArray(containers) ? containers.length : 0),
|
|
64
|
+
formatBytes(sumSize(containers)),
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"Volumes",
|
|
68
|
+
String(Array.isArray(volumes) ? volumes.length : 0),
|
|
69
|
+
formatBytes(Array.isArray(volumes)
|
|
70
|
+
? volumes.reduce((sum, v) => sum +
|
|
71
|
+
Number(v.UsageData
|
|
72
|
+
?.Size ?? 0), 0)
|
|
73
|
+
: 0),
|
|
74
|
+
],
|
|
75
|
+
];
|
|
76
|
+
return ok(renderTable(["TYPE", "COUNT", "SIZE"], rows));
|
|
77
|
+
}));
|
|
78
|
+
server.registerTool("list_networks", {
|
|
79
|
+
title: "List networks",
|
|
80
|
+
description: "List Docker networks with their driver and scope. Useful to " +
|
|
81
|
+
"understand how containers can reach one another.",
|
|
82
|
+
inputSchema: {},
|
|
83
|
+
}, async () => guard(async () => {
|
|
84
|
+
const networks = await docker.listNetworks();
|
|
85
|
+
const rows = networks.map((net) => [
|
|
86
|
+
truncate(net.Name, 28),
|
|
87
|
+
(net.Id ?? "").slice(0, 12),
|
|
88
|
+
net.Driver ?? "—",
|
|
89
|
+
net.Scope ?? "—",
|
|
90
|
+
]);
|
|
91
|
+
return ok(renderTable(["NAME", "ID", "DRIVER", "SCOPE"], rows));
|
|
92
|
+
}));
|
|
93
|
+
server.registerTool("list_volumes", {
|
|
94
|
+
title: "List volumes",
|
|
95
|
+
description: "List named Docker volumes and their storage driver. These persist " +
|
|
96
|
+
"data beyond a container's lifecycle.",
|
|
97
|
+
inputSchema: {},
|
|
98
|
+
}, async () => guard(async () => {
|
|
99
|
+
const volumes = await docker.listVolumes();
|
|
100
|
+
const rows = volumes.map((vol) => [
|
|
101
|
+
truncate(vol.Name, 32),
|
|
102
|
+
vol.Driver ?? "—",
|
|
103
|
+
truncate(vol.Mountpoint ?? "—", 40),
|
|
104
|
+
]);
|
|
105
|
+
return ok(renderTable(["NAME", "DRIVER", "MOUNTPOINT"], rows));
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAe;IACjE,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AG;SACjB,CAAC,CAAC;QACH,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CACL,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,oEAAoE;YACpE,sCAAsC;QACxC,WAAW,EAAE,EAAE;KAChB,EACD,KAAK,IAAI,EAAE,CACT,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;YAChC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,IAAI,GAAG;YACjB,QAAQ,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,EAAE,EAAE,CAAC;SACpC,CAAC,CAAC;QACH,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI terminal helpers.
|
|
3
|
+
*
|
|
4
|
+
* A tiny, dependency-free toolkit for the terminal UI: colours, cursor control
|
|
5
|
+
* and width-aware padding/truncation that accounts for invisible escape codes
|
|
6
|
+
* so columns line up perfectly.
|
|
7
|
+
*
|
|
8
|
+
* Part of Docker MCP Server.
|
|
9
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
10
|
+
* MIT licensed (see LICENSE).
|
|
11
|
+
*/
|
|
12
|
+
/** Raw control sequences. */
|
|
13
|
+
export declare const ctl: {
|
|
14
|
+
enterAlt: string;
|
|
15
|
+
exitAlt: string;
|
|
16
|
+
hideCursor: string;
|
|
17
|
+
showCursor: string;
|
|
18
|
+
clear: string;
|
|
19
|
+
home: string;
|
|
20
|
+
clearLine: string;
|
|
21
|
+
clearBelow: string;
|
|
22
|
+
};
|
|
23
|
+
/** Move the cursor to a 1-based (row, col). */
|
|
24
|
+
export declare function moveTo(row: number, col: number): string;
|
|
25
|
+
export declare const color: {
|
|
26
|
+
reset: string;
|
|
27
|
+
dim: (s: string) => string;
|
|
28
|
+
bold: (s: string) => string;
|
|
29
|
+
black: (s: string) => string;
|
|
30
|
+
red: (s: string) => string;
|
|
31
|
+
green: (s: string) => string;
|
|
32
|
+
yellow: (s: string) => string;
|
|
33
|
+
blue: (s: string) => string;
|
|
34
|
+
magenta: (s: string) => string;
|
|
35
|
+
cyan: (s: string) => string;
|
|
36
|
+
white: (s: string) => string;
|
|
37
|
+
gray: (s: string) => string;
|
|
38
|
+
brightBlue: (s: string) => string;
|
|
39
|
+
brightCyan: (s: string) => string;
|
|
40
|
+
brightGreen: (s: string) => string;
|
|
41
|
+
brightRed: (s: string) => string;
|
|
42
|
+
brightYellow: (s: string) => string;
|
|
43
|
+
/** SoyRage accent (256-colour blue). */
|
|
44
|
+
accent: (s: string) => string;
|
|
45
|
+
/** Inverse video for selection highlight. */
|
|
46
|
+
invert: (s: string) => string;
|
|
47
|
+
/** Background helpers. */
|
|
48
|
+
bgAccent: (s: string) => string;
|
|
49
|
+
};
|
|
50
|
+
/** Strip ANSI escapes to measure the visible length of a string. */
|
|
51
|
+
export declare function stripAnsi(s: string): string;
|
|
52
|
+
/** Visible length (ignoring escape codes). */
|
|
53
|
+
export declare function visLen(s: string): number;
|
|
54
|
+
/** Truncate to a visible width, preserving trailing reset. */
|
|
55
|
+
export declare function truncate(s: string, width: number): string;
|
|
56
|
+
/** Pad a string on the right to a visible width. */
|
|
57
|
+
export declare function padEnd(s: string, width: number): string;
|
|
58
|
+
/** Pad a string on the left to a visible width. */
|
|
59
|
+
export declare function padStart(s: string, width: number): string;
|
|
60
|
+
/** Centre a string within a visible width. */
|
|
61
|
+
export declare function center(s: string, width: number): string;
|
|
62
|
+
/**
|
|
63
|
+
* Render a horizontal usage bar of the given inner width, coloured by level.
|
|
64
|
+
* Example: `[██████░░░░]`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function bar(percent: number, width: number): string;
|
package/dist/tui/ansi.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI terminal helpers.
|
|
3
|
+
*
|
|
4
|
+
* A tiny, dependency-free toolkit for the terminal UI: colours, cursor control
|
|
5
|
+
* and width-aware padding/truncation that accounts for invisible escape codes
|
|
6
|
+
* so columns line up perfectly.
|
|
7
|
+
*
|
|
8
|
+
* Part of Docker MCP Server.
|
|
9
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
10
|
+
* MIT licensed (see LICENSE).
|
|
11
|
+
*/
|
|
12
|
+
const ESC = "\x1b[";
|
|
13
|
+
/** Raw control sequences. */
|
|
14
|
+
export const ctl = {
|
|
15
|
+
enterAlt: `${ESC}?1049h`,
|
|
16
|
+
exitAlt: `${ESC}?1049l`,
|
|
17
|
+
hideCursor: `${ESC}?25l`,
|
|
18
|
+
showCursor: `${ESC}?25h`,
|
|
19
|
+
clear: `${ESC}2J`,
|
|
20
|
+
home: `${ESC}H`,
|
|
21
|
+
clearLine: `${ESC}K`,
|
|
22
|
+
clearBelow: `${ESC}J`,
|
|
23
|
+
};
|
|
24
|
+
/** Move the cursor to a 1-based (row, col). */
|
|
25
|
+
export function moveTo(row, col) {
|
|
26
|
+
return `${ESC}${row};${col}H`;
|
|
27
|
+
}
|
|
28
|
+
/** SGR colour wrappers. */
|
|
29
|
+
const sgr = (code) => (s) => `${ESC}${code}m${s}${ESC}0m`;
|
|
30
|
+
export const color = {
|
|
31
|
+
reset: `${ESC}0m`,
|
|
32
|
+
dim: sgr(2),
|
|
33
|
+
bold: (s) => `${ESC}1m${s}${ESC}22m`,
|
|
34
|
+
black: sgr(30),
|
|
35
|
+
red: sgr(31),
|
|
36
|
+
green: sgr(32),
|
|
37
|
+
yellow: sgr(33),
|
|
38
|
+
blue: sgr(34),
|
|
39
|
+
magenta: sgr(35),
|
|
40
|
+
cyan: sgr(36),
|
|
41
|
+
white: sgr(37),
|
|
42
|
+
gray: sgr(90),
|
|
43
|
+
brightBlue: sgr(94),
|
|
44
|
+
brightCyan: sgr(96),
|
|
45
|
+
brightGreen: sgr(92),
|
|
46
|
+
brightRed: sgr(91),
|
|
47
|
+
brightYellow: sgr(93),
|
|
48
|
+
/** SoyRage accent (256-colour blue). */
|
|
49
|
+
accent: (s) => `${ESC}38;5;39m${s}${ESC}0m`,
|
|
50
|
+
/** Inverse video for selection highlight. */
|
|
51
|
+
invert: (s) => `${ESC}7m${s}${ESC}27m`,
|
|
52
|
+
/** Background helpers. */
|
|
53
|
+
bgAccent: (s) => `${ESC}48;5;24m${s}${ESC}0m`,
|
|
54
|
+
};
|
|
55
|
+
// eslint-disable-next-line no-control-regex
|
|
56
|
+
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
57
|
+
/** Strip ANSI escapes to measure the visible length of a string. */
|
|
58
|
+
export function stripAnsi(s) {
|
|
59
|
+
return s.replace(ANSI_RE, "");
|
|
60
|
+
}
|
|
61
|
+
/** Visible length (ignoring escape codes). */
|
|
62
|
+
export function visLen(s) {
|
|
63
|
+
return stripAnsi(s).length;
|
|
64
|
+
}
|
|
65
|
+
/** Truncate to a visible width, preserving trailing reset. */
|
|
66
|
+
export function truncate(s, width) {
|
|
67
|
+
if (visLen(s) <= width)
|
|
68
|
+
return s;
|
|
69
|
+
// Walk characters, counting only visible ones, keeping escapes intact.
|
|
70
|
+
let out = "";
|
|
71
|
+
let visible = 0;
|
|
72
|
+
let i = 0;
|
|
73
|
+
while (i < s.length && visible < width - 1) {
|
|
74
|
+
if (s[i] === "\x1b") {
|
|
75
|
+
const match = /^\x1b\[[0-9;]*m/.exec(s.slice(i));
|
|
76
|
+
if (match) {
|
|
77
|
+
out += match[0];
|
|
78
|
+
i += match[0].length;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
out += s[i];
|
|
83
|
+
visible += 1;
|
|
84
|
+
i += 1;
|
|
85
|
+
}
|
|
86
|
+
return `${out}…${color.reset}`;
|
|
87
|
+
}
|
|
88
|
+
/** Pad a string on the right to a visible width. */
|
|
89
|
+
export function padEnd(s, width) {
|
|
90
|
+
const len = visLen(s);
|
|
91
|
+
return len >= width ? truncate(s, width) : s + " ".repeat(width - len);
|
|
92
|
+
}
|
|
93
|
+
/** Pad a string on the left to a visible width. */
|
|
94
|
+
export function padStart(s, width) {
|
|
95
|
+
const len = visLen(s);
|
|
96
|
+
return len >= width ? truncate(s, width) : " ".repeat(width - len) + s;
|
|
97
|
+
}
|
|
98
|
+
/** Centre a string within a visible width. */
|
|
99
|
+
export function center(s, width) {
|
|
100
|
+
const len = visLen(s);
|
|
101
|
+
if (len >= width)
|
|
102
|
+
return truncate(s, width);
|
|
103
|
+
const left = Math.floor((width - len) / 2);
|
|
104
|
+
return " ".repeat(left) + s + " ".repeat(width - len - left);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Render a horizontal usage bar of the given inner width, coloured by level.
|
|
108
|
+
* Example: `[██████░░░░]`.
|
|
109
|
+
*/
|
|
110
|
+
export function bar(percent, width) {
|
|
111
|
+
const clamped = Math.max(0, Math.min(100, percent));
|
|
112
|
+
const filled = Math.round((clamped / 100) * width);
|
|
113
|
+
const fill = "█".repeat(filled);
|
|
114
|
+
const rest = "░".repeat(Math.max(0, width - filled));
|
|
115
|
+
const paint = clamped >= 80 ? color.red : clamped >= 50 ? color.yellow : color.green;
|
|
116
|
+
return `${paint(fill)}${color.gray(rest)}`;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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
+
* Terminal UI application.
|
|
3
|
+
*
|
|
4
|
+
* A creative, dependency-free TUI in the spirit of lazydocker: a full-screen
|
|
5
|
+
* dashboard with a live container list, per-container CPU/memory gauges, a
|
|
6
|
+
* details/logs pane and one-key lifecycle actions — wrapped in a SoyRage
|
|
7
|
+
* Agency welcome that thanks you for using the repo and asks for a ⭐.
|
|
8
|
+
*
|
|
9
|
+
* Rendering is a hand-rolled ANSI frame (no curses library), which keeps the
|
|
10
|
+
* dependency surface at zero and the styling fully under our control.
|
|
11
|
+
*
|
|
12
|
+
* Part of Docker MCP Server.
|
|
13
|
+
* Crafted by SoyRage Agency — https://soyrage.es/
|
|
14
|
+
* MIT licensed (see LICENSE).
|
|
15
|
+
*/
|
|
16
|
+
import type { PanelService } from "../panel/service.js";
|
|
17
|
+
export type Input = "normal" | "ai" | "confirm" | "message" | "filter" | "volume" | "snapshots" | "menu";
|
|
18
|
+
/** The interactive terminal application. */
|
|
19
|
+
export declare class TuiApp {
|
|
20
|
+
private readonly service;
|
|
21
|
+
private readonly out;
|
|
22
|
+
private readonly inp;
|
|
23
|
+
private mode;
|
|
24
|
+
private containers;
|
|
25
|
+
private system;
|
|
26
|
+
private selected;
|
|
27
|
+
private showLogs;
|
|
28
|
+
private logs;
|
|
29
|
+
private status;
|
|
30
|
+
private timer;
|
|
31
|
+
private refreshing;
|
|
32
|
+
private input;
|
|
33
|
+
private aiInput;
|
|
34
|
+
private message;
|
|
35
|
+
private messageTitle;
|
|
36
|
+
private pending;
|
|
37
|
+
private update;
|
|
38
|
+
/** Lazy-loaded inspect detail for the selected container (LazyDocker-style). */
|
|
39
|
+
private detail;
|
|
40
|
+
private detailFor;
|
|
41
|
+
/** An in-flight lifecycle animation (start/stop/restart). */
|
|
42
|
+
private anim;
|
|
43
|
+
private animTimer;
|
|
44
|
+
private filter;
|
|
45
|
+
private sortKey;
|
|
46
|
+
private sortDesc;
|
|
47
|
+
private frozen;
|
|
48
|
+
private freezeOverride;
|
|
49
|
+
private logFollow;
|
|
50
|
+
private logTail;
|
|
51
|
+
private volumeInput;
|
|
52
|
+
private tick;
|
|
53
|
+
private ticker;
|
|
54
|
+
private menuIndex;
|
|
55
|
+
private menuItems;
|
|
56
|
+
constructor(service: PanelService, out?: NodeJS.WriteStream & {
|
|
57
|
+
fd: 1;
|
|
58
|
+
}, inp?: NodeJS.ReadStream & {
|
|
59
|
+
fd: 0;
|
|
60
|
+
});
|
|
61
|
+
/** Enter alt-screen, wire input, show splash, then run. */
|
|
62
|
+
start(): Promise<void>;
|
|
63
|
+
private readonly onData;
|
|
64
|
+
private setupInput;
|
|
65
|
+
/**
|
|
66
|
+
* Hand the terminal to an interactive child (a shell, an editor), then take it
|
|
67
|
+
* back. We leave the alt-screen and raw mode, detach our key handler, run the
|
|
68
|
+
* child with inherited stdio, and on exit restore everything and repaint.
|
|
69
|
+
*/
|
|
70
|
+
private runInteractive;
|
|
71
|
+
private onKey;
|
|
72
|
+
private onAiKey;
|
|
73
|
+
private onConfirmKey;
|
|
74
|
+
/** Live-editing the container name/image filter. */
|
|
75
|
+
private onFilterKey;
|
|
76
|
+
/** Typing the "host:container[:ro]" bind spec. */
|
|
77
|
+
private onVolumeKey;
|
|
78
|
+
/** Cycle the sort column: name → cpu → mem → state → name. */
|
|
79
|
+
private cycleSort;
|
|
80
|
+
/** Copy the selected container's full ID to the clipboard (OSC 52). */
|
|
81
|
+
private copyId;
|
|
82
|
+
/** Full inspect overlay: command, health, networks, mounts and env. */
|
|
83
|
+
private showInspect;
|
|
84
|
+
/** Networks overlay. */
|
|
85
|
+
private showNetworks;
|
|
86
|
+
/** Volumes overlay. */
|
|
87
|
+
private showVolumes;
|
|
88
|
+
/** Current alerts overlay. */
|
|
89
|
+
private showAlerts;
|
|
90
|
+
/** Confirm then snapshot the selected container (image commit). */
|
|
91
|
+
private confirmSnapshot;
|
|
92
|
+
/** Open an interactive shell inside the selected container (docker exec -it). */
|
|
93
|
+
private openShell;
|
|
94
|
+
/** Edit a compose file in the user's $EDITOR (suspends the dashboard). */
|
|
95
|
+
private editCompose;
|
|
96
|
+
/** Open the per-container action menu over the current selection. */
|
|
97
|
+
private openMenu;
|
|
98
|
+
private onMenuKey;
|
|
99
|
+
/** The action-menu body, with the highlighted row and shortcut hints. */
|
|
100
|
+
private menuText;
|
|
101
|
+
/** Snapshot picker → restore (numbered overlay). */
|
|
102
|
+
private openSnapshots;
|
|
103
|
+
/** Attach an extra volume via a one-line "host:container[:ro]" prompt. */
|
|
104
|
+
private startVolume;
|
|
105
|
+
private submitVolume;
|
|
106
|
+
/** Handle key presses while the snapshot picker is open. */
|
|
107
|
+
private onSnapshotsKey;
|
|
108
|
+
/** Ask the AI copilot; propose the docker command and confirm before running. */
|
|
109
|
+
private runAi;
|
|
110
|
+
private runAiCommand;
|
|
111
|
+
private showMessage;
|
|
112
|
+
private helpText;
|
|
113
|
+
/** Containers after the active filter and sort — what the list actually shows. */
|
|
114
|
+
private visible;
|
|
115
|
+
private move;
|
|
116
|
+
/** Jump to the first or last row. */
|
|
117
|
+
private jump;
|
|
118
|
+
/** Fetch the inspect summary for the selected container, once, lazily. */
|
|
119
|
+
private loadDetail;
|
|
120
|
+
private current;
|
|
121
|
+
private enterMain;
|
|
122
|
+
/** Fetch the update channel once in the background; silent on any failure. */
|
|
123
|
+
private checkUpdate;
|
|
124
|
+
private action;
|
|
125
|
+
/** Begin the lifecycle spinner and drive its frames. */
|
|
126
|
+
private startAnim;
|
|
127
|
+
private stopAnim;
|
|
128
|
+
private loadLogs;
|
|
129
|
+
private refresh;
|
|
130
|
+
private quit;
|
|
131
|
+
private cols;
|
|
132
|
+
private rows;
|
|
133
|
+
/** Paint the whole frame from a line array. */
|
|
134
|
+
private paint;
|
|
135
|
+
/** Build the welcome-splash lines (also used by `--splash` snapshot mode). */
|
|
136
|
+
splashLines(cols?: number, rows?: number): string[];
|
|
137
|
+
private renderSplash;
|
|
138
|
+
/**
|
|
139
|
+
* Render one static main frame to a string (no cursor control). Used by the
|
|
140
|
+
* `--frame` snapshot mode to document the TUI. Refreshes data first.
|
|
141
|
+
*/
|
|
142
|
+
frame(cols?: number, rows?: number, demoInput?: Input): Promise<string>;
|
|
143
|
+
private render;
|
|
144
|
+
private buildMainLines;
|
|
145
|
+
private headerLine;
|
|
146
|
+
private resourceLine;
|
|
147
|
+
private containerRows;
|
|
148
|
+
private detailRows;
|
|
149
|
+
private logRows;
|
|
150
|
+
private footerKeys;
|
|
151
|
+
/** Overlay a centered modal box (help / AI answers) onto the frame. */
|
|
152
|
+
private overlay;
|
|
153
|
+
/** A single-line update notice under the resource bar; null when up to date. */
|
|
154
|
+
private updateBanner;
|
|
155
|
+
/** The numbered snapshot list shown in the restore picker. */
|
|
156
|
+
private snapshotsText;
|
|
157
|
+
/** The modal body for [u]: every release newer than what's running. */
|
|
158
|
+
private changelogText;
|
|
159
|
+
private footerBrand;
|
|
160
|
+
}
|