@paretools/docker 0.3.0 → 0.5.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/README.md +44 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/docker-runner.d.ts.map +1 -1
- package/dist/lib/docker-runner.js +4 -3
- package/dist/lib/docker-runner.js.map +1 -1
- package/dist/lib/formatters.d.ts +15 -1
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +41 -0
- package/dist/lib/formatters.js.map +1 -1
- package/dist/lib/parsers.d.ts +15 -1
- package/dist/lib/parsers.d.ts.map +1 -1
- package/dist/lib/parsers.js +93 -0
- package/dist/lib/parsers.js.map +1 -1
- package/dist/schemas/index.d.ts +82 -176
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +39 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/compose-down.d.ts +3 -0
- package/dist/tools/compose-down.d.ts.map +1 -0
- package/dist/tools/compose-down.js +44 -0
- package/dist/tools/compose-down.js.map +1 -0
- package/dist/tools/compose-up.d.ts +3 -0
- package/dist/tools/compose-up.d.ts.map +1 -0
- package/dist/tools/compose-up.js +48 -0
- package/dist/tools/compose-up.js.map +1 -0
- package/dist/tools/exec.d.ts +3 -0
- package/dist/tools/exec.d.ts.map +1 -0
- package/dist/tools/exec.js +37 -0
- package/dist/tools/exec.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/pull.d.ts +3 -0
- package/dist/tools/pull.d.ts.map +1 -0
- package/dist/tools/pull.js +35 -0
- package/dist/tools/pull.js.map +1 -0
- package/dist/tools/run.d.ts +3 -0
- package/dist/tools/run.d.ts.map +1 -0
- package/dist/tools/run.js +78 -0
- package/dist/tools/run.js.map +1 -0
- package/package.json +18 -7
package/README.md
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
# @paretools/docker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@paretools/docker)
|
|
4
|
+
[](https://github.com/Dave-London/pare/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
**Structured, token-efficient Docker output for AI agents.** Up to 95% fewer tokens than raw `docker` CLI output.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
| -------- | --------------------------------------------------- |
|
|
9
|
-
| `ps` | List containers with status, ports, and state |
|
|
10
|
-
| `build` | Build image, returns image ID, duration, and errors |
|
|
11
|
-
| `logs` | Retrieve container logs as structured line arrays |
|
|
12
|
-
| `images` | List images with repository, tag, and size info |
|
|
8
|
+
Part of the [Pare](https://github.com/Dave-London/pare) suite of MCP servers.
|
|
13
9
|
|
|
14
|
-
##
|
|
10
|
+
## Tools (9)
|
|
11
|
+
|
|
12
|
+
| Tool | Description |
|
|
13
|
+
| -------------- | ---------------------------------------------------- |
|
|
14
|
+
| `ps` | List containers with status, ports, and state |
|
|
15
|
+
| `build` | Build image, returns image ID, duration, and errors |
|
|
16
|
+
| `logs` | Retrieve container logs as structured line arrays |
|
|
17
|
+
| `images` | List images with repository, tag, and size info |
|
|
18
|
+
| `run` | Run a container from an image with structured result |
|
|
19
|
+
| `exec` | Execute a command in a running container |
|
|
20
|
+
| `compose-up` | Start Docker Compose services with structured status |
|
|
21
|
+
| `compose-down` | Stop Docker Compose services with structured status |
|
|
22
|
+
| `pull` | Pull an image from a registry with digest info |
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx -y @paretools/docker
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Add to your MCP client config:
|
|
15
31
|
|
|
16
32
|
```json
|
|
17
33
|
{
|
|
18
34
|
"mcpServers": {
|
|
19
35
|
"pare-docker": {
|
|
20
36
|
"command": "npx",
|
|
21
|
-
"args": ["@paretools/docker"]
|
|
37
|
+
"args": ["-y", "@paretools/docker"]
|
|
22
38
|
}
|
|
23
39
|
}
|
|
24
40
|
}
|
|
@@ -43,6 +59,24 @@ Pare MCP server for **Docker**. Returns structured output from Docker commands.
|
|
|
43
59
|
}
|
|
44
60
|
```
|
|
45
61
|
|
|
62
|
+
## All Pare Servers (62 tools)
|
|
63
|
+
|
|
64
|
+
| Package | Tools | Wraps |
|
|
65
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------- |
|
|
66
|
+
| [@paretools/git](https://www.npmjs.com/package/@paretools/git) | status, log, diff, branch, show, add, commit, push, pull, checkout | git |
|
|
67
|
+
| [@paretools/test](https://www.npmjs.com/package/@paretools/test) | run, coverage | pytest, jest, vitest, mocha |
|
|
68
|
+
| [@paretools/npm](https://www.npmjs.com/package/@paretools/npm) | install, audit, outdated, list, run, test, init | npm |
|
|
69
|
+
| [@paretools/build](https://www.npmjs.com/package/@paretools/build) | tsc, build, esbuild, vite-build, webpack | tsc, esbuild, vite, webpack |
|
|
70
|
+
| [@paretools/lint](https://www.npmjs.com/package/@paretools/lint) | lint, format-check, prettier-format, biome-check, biome-format | eslint, prettier, biome |
|
|
71
|
+
| [@paretools/python](https://www.npmjs.com/package/@paretools/python) | pip-install, mypy, ruff-check, pip-audit, pytest, uv-install, uv-run, black | pip, mypy, ruff, pytest, uv, black |
|
|
72
|
+
| **@paretools/docker** | ps, build, logs, images, run, exec, compose-up, compose-down, pull | docker, docker compose |
|
|
73
|
+
| [@paretools/cargo](https://www.npmjs.com/package/@paretools/cargo) | build, test, clippy, run, add, remove, fmt, doc, check | cargo |
|
|
74
|
+
| [@paretools/go](https://www.npmjs.com/package/@paretools/go) | build, test, vet, run, mod-tidy, fmt, generate | go, gofmt |
|
|
75
|
+
|
|
76
|
+
## Compatible Clients
|
|
77
|
+
|
|
78
|
+
Works with any MCP-compatible client: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Claude Desktop](https://claude.ai/download), [Cursor](https://cursor.com), [Windsurf](https://codeium.com/windsurf), [VS Code / GitHub Copilot](https://code.visualstudio.com), [Cline](https://github.com/cline/cline), [Roo Code](https://roocode.com), [Zed](https://zed.dev), [Continue.dev](https://continue.dev), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [OpenAI Codex](https://openai.com/index/codex/)
|
|
79
|
+
|
|
46
80
|
## Links
|
|
47
81
|
|
|
48
82
|
- [Pare monorepo](https://github.com/Dave-London/pare)
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { registerAllTools } from "./tools/index.js";
|
|
5
5
|
const server = new McpServer({ name: "@paretools/docker", version: "0.2.0" }, {
|
|
6
|
-
instructions: "Structured Docker operations (ps, build, logs, images). Use instead of running docker commands via bash. Returns typed JSON with structured container, image, and build data.",
|
|
6
|
+
instructions: "Structured Docker operations (ps, build, logs, images, run, exec, compose-up, compose-down, pull). Use instead of running docker commands via bash. Returns typed JSON with structured container, image, and build data.",
|
|
7
7
|
});
|
|
8
8
|
registerAllTools(server);
|
|
9
9
|
const transport = new StdioServerTransport();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC/C;IACE,YAAY,EACV
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC/C;IACE,YAAY,EACV,0NAA0N;CAC7N,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-runner.d.ts","sourceRoot":"","sources":["../../src/lib/docker-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"docker-runner.d.ts","sourceRoot":"","sources":["../../src/lib/docker-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAK7E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { run } from "@paretools/shared";
|
|
2
2
|
export async function docker(args, cwd) {
|
|
3
|
-
// Docker build/pull operations can take minutes; use 5-minute timeout
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
// Docker build/pull/run/compose operations can take minutes; use 5-minute timeout
|
|
4
|
+
const longOps = new Set(["build", "pull", "run", "compose"]);
|
|
5
|
+
const isLong = longOps.has(args[0]);
|
|
6
|
+
return run("docker", args, { cwd, timeout: isLong ? 300_000 : 30_000 });
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=docker-runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-runner.js","sourceRoot":"","sources":["../../src/lib/docker-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc,EAAE,GAAY;IACvD,
|
|
1
|
+
{"version":3,"file":"docker-runner.js","sourceRoot":"","sources":["../../src/lib/docker-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc,EAAE,GAAY;IACvD,kFAAkF;IAClF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/lib/formatters.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import type { DockerPs, DockerBuild, DockerLogs, DockerImages } from "../schemas/index.js";
|
|
1
|
+
import type { DockerPs, DockerBuild, DockerLogs, DockerImages, DockerRun, DockerExec, DockerComposeUp, DockerComposeDown, DockerPull } from "../schemas/index.js";
|
|
2
|
+
/** Formats structured Docker container data into a human-readable listing with state and ports. */
|
|
2
3
|
export declare function formatPs(data: DockerPs): string;
|
|
4
|
+
/** Formats structured Docker build results into a human-readable success/failure summary. */
|
|
3
5
|
export declare function formatBuild(data: DockerBuild): string;
|
|
6
|
+
/** Formats structured Docker logs data into a human-readable output with container name and line count. */
|
|
4
7
|
export declare function formatLogs(data: DockerLogs): string;
|
|
8
|
+
/** Formats structured Docker image data into a human-readable listing with repository, tag, and size. */
|
|
5
9
|
export declare function formatImages(data: DockerImages): string;
|
|
10
|
+
/** Formats structured Docker run output into a human-readable summary. */
|
|
11
|
+
export declare function formatRun(data: DockerRun): string;
|
|
12
|
+
/** Formats structured Docker exec output into a human-readable summary. */
|
|
13
|
+
export declare function formatExec(data: DockerExec): string;
|
|
14
|
+
/** Formats structured Docker Compose up output into a human-readable summary. */
|
|
15
|
+
export declare function formatComposeUp(data: DockerComposeUp): string;
|
|
16
|
+
/** Formats structured Docker Compose down output into a human-readable summary. */
|
|
17
|
+
export declare function formatComposeDown(data: DockerComposeDown): string;
|
|
18
|
+
/** Formats structured Docker pull output into a human-readable summary. */
|
|
19
|
+
export declare function formatPull(data: DockerPull): string;
|
|
6
20
|
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAE7B,mGAAmG;AACnG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAS/C;AAED,6FAA6F;AAC7F,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAarD;AAED,2GAA2G;AAC3G,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED,yGAAyG;AACzG,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CASvD;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIjD;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAMnD;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAI7D;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAGjE;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAInD"}
|
package/dist/lib/formatters.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Formats structured Docker container data into a human-readable listing with state and ports. */
|
|
1
2
|
export function formatPs(data) {
|
|
2
3
|
const lines = [`${data.total} containers (${data.running} running, ${data.stopped} stopped)`];
|
|
3
4
|
for (const c of data.containers) {
|
|
@@ -8,6 +9,7 @@ export function formatPs(data) {
|
|
|
8
9
|
}
|
|
9
10
|
return lines.join("\n");
|
|
10
11
|
}
|
|
12
|
+
/** Formats structured Docker build results into a human-readable success/failure summary. */
|
|
11
13
|
export function formatBuild(data) {
|
|
12
14
|
if (data.success) {
|
|
13
15
|
const parts = [`Build succeeded in ${data.duration}s`];
|
|
@@ -23,9 +25,11 @@ export function formatBuild(data) {
|
|
|
23
25
|
}
|
|
24
26
|
return lines.join("\n");
|
|
25
27
|
}
|
|
28
|
+
/** Formats structured Docker logs data into a human-readable output with container name and line count. */
|
|
26
29
|
export function formatLogs(data) {
|
|
27
30
|
return `${data.container} (${data.total} lines)\n${data.lines.join("\n")}`;
|
|
28
31
|
}
|
|
32
|
+
/** Formats structured Docker image data into a human-readable listing with repository, tag, and size. */
|
|
29
33
|
export function formatImages(data) {
|
|
30
34
|
if (data.total === 0)
|
|
31
35
|
return "No images found.";
|
|
@@ -36,4 +40,41 @@ export function formatImages(data) {
|
|
|
36
40
|
}
|
|
37
41
|
return lines.join("\n");
|
|
38
42
|
}
|
|
43
|
+
/** Formats structured Docker run output into a human-readable summary. */
|
|
44
|
+
export function formatRun(data) {
|
|
45
|
+
const name = data.name ? ` (${data.name})` : "";
|
|
46
|
+
const mode = data.detached ? "detached" : "attached";
|
|
47
|
+
return `Container ${data.containerId}${name} started from ${data.image} [${mode}]`;
|
|
48
|
+
}
|
|
49
|
+
/** Formats structured Docker exec output into a human-readable summary. */
|
|
50
|
+
export function formatExec(data) {
|
|
51
|
+
const status = data.success ? "succeeded" : `failed (exit code ${data.exitCode})`;
|
|
52
|
+
const lines = [`Exec ${status}`];
|
|
53
|
+
if (data.stdout)
|
|
54
|
+
lines.push(data.stdout);
|
|
55
|
+
if (data.stderr)
|
|
56
|
+
lines.push(`stderr: ${data.stderr}`);
|
|
57
|
+
return lines.join("\n");
|
|
58
|
+
}
|
|
59
|
+
/** Formats structured Docker Compose up output into a human-readable summary. */
|
|
60
|
+
export function formatComposeUp(data) {
|
|
61
|
+
if (!data.success)
|
|
62
|
+
return "Compose up failed";
|
|
63
|
+
if (data.started === 0)
|
|
64
|
+
return "Compose up succeeded (no new services started)";
|
|
65
|
+
return `Compose up: ${data.started} services started (${data.services.join(", ")})`;
|
|
66
|
+
}
|
|
67
|
+
/** Formats structured Docker Compose down output into a human-readable summary. */
|
|
68
|
+
export function formatComposeDown(data) {
|
|
69
|
+
if (!data.success)
|
|
70
|
+
return "Compose down failed";
|
|
71
|
+
return `Compose down: ${data.stopped} stopped, ${data.removed} removed`;
|
|
72
|
+
}
|
|
73
|
+
/** Formats structured Docker pull output into a human-readable summary. */
|
|
74
|
+
export function formatPull(data) {
|
|
75
|
+
if (!data.success)
|
|
76
|
+
return `Pull failed for ${data.image}:${data.tag}`;
|
|
77
|
+
const digest = data.digest ? ` (${data.digest.slice(0, 19)}...)` : "";
|
|
78
|
+
return `Pulled ${data.image}:${data.tag}${digest}`;
|
|
79
|
+
}
|
|
39
80
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAYA,mGAAmG;AACnG,MAAM,UAAU,QAAQ,CAAC,IAAc;IACrC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,gBAAgB,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;IAC9F,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM;YAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YAC9H,CAAC,CAAC,EAAE,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,W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AE,OAAO,mBAAmB,CAAC;IAC9C,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC;QAAE,OAAO,gDAAgD,CAAC;IAChF,OAAO,eAAe,IAAI,CAAC,OAAO,sBAAsB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACtF,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,iBAAiB,CAAC,IAAuB;IACvD,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,qBAAqB,CAAC;IAChD,OAAO,iBAAiB,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,OAAO,UAAU,CAAC;AAC1E,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,mBAAmB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,OAAO,UAAU,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC;AACrD,CAAC"}
|
package/dist/lib/parsers.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import type { DockerPs, DockerBuild, DockerLogs, DockerImages } from "../schemas/index.js";
|
|
1
|
+
import type { DockerPs, DockerBuild, DockerLogs, DockerImages, DockerRun, DockerExec, DockerComposeUp, DockerComposeDown, DockerPull } from "../schemas/index.js";
|
|
2
|
+
/** Parses `docker ps --format json` output into structured container data with ports and state. */
|
|
2
3
|
export declare function parsePsJson(stdout: string): DockerPs;
|
|
4
|
+
/** Parses `docker build` output into structured results with success status, image ID, and errors. */
|
|
3
5
|
export declare function parseBuildOutput(stdout: string, stderr: string, exitCode: number, duration: number): DockerBuild;
|
|
6
|
+
/** Parses `docker logs` output into structured data with container name and log lines. */
|
|
4
7
|
export declare function parseLogsOutput(stdout: string, container: string): DockerLogs;
|
|
8
|
+
/** Parses `docker images --format json` output into structured image data with repository, tag, and size. */
|
|
5
9
|
export declare function parseImagesJson(stdout: string): DockerImages;
|
|
10
|
+
/** Parses `docker run` output into structured data with container ID and image info. */
|
|
11
|
+
export declare function parseRunOutput(stdout: string, image: string, detached: boolean, name?: string): DockerRun;
|
|
12
|
+
/** Parses `docker exec` output into structured data with exit code, stdout, stderr, and success. */
|
|
13
|
+
export declare function parseExecOutput(stdout: string, stderr: string, exitCode: number): DockerExec;
|
|
14
|
+
/** Parses `docker compose up` output into structured data with service names and started count. */
|
|
15
|
+
export declare function parseComposeUpOutput(stdout: string, stderr: string, exitCode: number): DockerComposeUp;
|
|
16
|
+
/** Parses `docker compose down` output into structured data with stopped and removed counts. */
|
|
17
|
+
export declare function parseComposeDownOutput(stdout: string, stderr: string, exitCode: number): DockerComposeDown;
|
|
18
|
+
/** Parses `docker pull` output into structured data with image, tag, digest, and success flag. */
|
|
19
|
+
export declare function parsePullOutput(stdout: string, stderr: string, exitCode: number, image: string): DockerPull;
|
|
6
20
|
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAE7B,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAwBpD;AAgCD,sGAAsG;AACtG,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,WAAW,CAwBb;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAO7E;AAED,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAc5D;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CASX;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAO5F;AAED,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,eAAe,CA2BjB;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,iBAAiB,CA4BnB;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,UAAU,CAkBZ"}
|
package/dist/lib/parsers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Parses `docker ps --format json` output into structured container data with ports and state. */
|
|
1
2
|
export function parsePsJson(stdout) {
|
|
2
3
|
// docker ps --format json returns one JSON object per line
|
|
3
4
|
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
@@ -46,6 +47,7 @@ function parsePorts(portsStr) {
|
|
|
46
47
|
return { container: port, protocol };
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
/** Parses `docker build` output into structured results with success status, image ID, and errors. */
|
|
49
51
|
export function parseBuildOutput(stdout, stderr, exitCode, duration) {
|
|
50
52
|
const errors = [];
|
|
51
53
|
const imageIdMatch = stdout.match(/writing image sha256:([a-f0-9]+)/i) ||
|
|
@@ -67,6 +69,7 @@ export function parseBuildOutput(stdout, stderr, exitCode, duration) {
|
|
|
67
69
|
errors,
|
|
68
70
|
};
|
|
69
71
|
}
|
|
72
|
+
/** Parses `docker logs` output into structured data with container name and log lines. */
|
|
70
73
|
export function parseLogsOutput(stdout, container) {
|
|
71
74
|
const lines = stdout.split("\n").filter(Boolean);
|
|
72
75
|
return {
|
|
@@ -75,6 +78,7 @@ export function parseLogsOutput(stdout, container) {
|
|
|
75
78
|
total: lines.length,
|
|
76
79
|
};
|
|
77
80
|
}
|
|
81
|
+
/** Parses `docker images --format json` output into structured image data with repository, tag, and size. */
|
|
78
82
|
export function parseImagesJson(stdout) {
|
|
79
83
|
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
80
84
|
const images = lines.map((line) => {
|
|
@@ -89,4 +93,93 @@ export function parseImagesJson(stdout) {
|
|
|
89
93
|
});
|
|
90
94
|
return { images, total: images.length };
|
|
91
95
|
}
|
|
96
|
+
/** Parses `docker run` output into structured data with container ID and image info. */
|
|
97
|
+
export function parseRunOutput(stdout, image, detached, name) {
|
|
98
|
+
// When detached, docker run outputs the full container ID
|
|
99
|
+
const containerId = stdout.trim().split("\n").pop()?.trim() ?? "";
|
|
100
|
+
return {
|
|
101
|
+
containerId: containerId.slice(0, 12),
|
|
102
|
+
image,
|
|
103
|
+
detached,
|
|
104
|
+
...(name ? { name } : {}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Parses `docker exec` output into structured data with exit code, stdout, stderr, and success. */
|
|
108
|
+
export function parseExecOutput(stdout, stderr, exitCode) {
|
|
109
|
+
return {
|
|
110
|
+
exitCode,
|
|
111
|
+
stdout,
|
|
112
|
+
stderr,
|
|
113
|
+
success: exitCode === 0,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** Parses `docker compose up` output into structured data with service names and started count. */
|
|
117
|
+
export function parseComposeUpOutput(stdout, stderr, exitCode) {
|
|
118
|
+
// Compose v2 outputs to stderr; service names appear in lines like:
|
|
119
|
+
// ✔ Container myapp-web-1 Started
|
|
120
|
+
// ✔ Container myapp-db-1 Started
|
|
121
|
+
// Or: Container myapp-web-1 Creating / Created / Starting / Started
|
|
122
|
+
const combined = stdout + "\n" + stderr;
|
|
123
|
+
const serviceSet = new Set();
|
|
124
|
+
// Match "Container <name> Started" or "Container <name> Running"
|
|
125
|
+
const startedPattern = /Container\s+(\S+)\s+(?:Started|Running|Created)/g;
|
|
126
|
+
let match;
|
|
127
|
+
while ((match = startedPattern.exec(combined)) !== null) {
|
|
128
|
+
serviceSet.add(match[1]);
|
|
129
|
+
}
|
|
130
|
+
// Also match "service "<name>" started" pattern (older compose output)
|
|
131
|
+
const servicePattern = /[Ss]ervice\s+"?(\S+?)"?\s+(?:started|created)/g;
|
|
132
|
+
while ((match = servicePattern.exec(combined)) !== null) {
|
|
133
|
+
serviceSet.add(match[1]);
|
|
134
|
+
}
|
|
135
|
+
const services = [...serviceSet];
|
|
136
|
+
return {
|
|
137
|
+
success: exitCode === 0,
|
|
138
|
+
services,
|
|
139
|
+
started: services.length,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** Parses `docker compose down` output into structured data with stopped and removed counts. */
|
|
143
|
+
export function parseComposeDownOutput(stdout, stderr, exitCode) {
|
|
144
|
+
const combined = stdout + "\n" + stderr;
|
|
145
|
+
let stopped = 0;
|
|
146
|
+
let removed = 0;
|
|
147
|
+
// Match "Container <name> Stopped"
|
|
148
|
+
const stoppedPattern = /Container\s+\S+\s+Stopped/g;
|
|
149
|
+
while (stoppedPattern.exec(combined) !== null) {
|
|
150
|
+
stopped++;
|
|
151
|
+
}
|
|
152
|
+
// Match "Container <name> Removed"
|
|
153
|
+
const removedPattern = /Container\s+\S+\s+Removed/g;
|
|
154
|
+
while (removedPattern.exec(combined) !== null) {
|
|
155
|
+
removed++;
|
|
156
|
+
}
|
|
157
|
+
// Also count network/volume removals as part of removed
|
|
158
|
+
const networkPattern = /Network\s+\S+\s+Removed/g;
|
|
159
|
+
while (networkPattern.exec(combined) !== null) {
|
|
160
|
+
removed++;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
success: exitCode === 0,
|
|
164
|
+
stopped,
|
|
165
|
+
removed,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** Parses `docker pull` output into structured data with image, tag, digest, and success flag. */
|
|
169
|
+
export function parsePullOutput(stdout, stderr, exitCode, image) {
|
|
170
|
+
const combined = stdout + "\n" + stderr;
|
|
171
|
+
// Extract tag from image string (e.g., "nginx:latest" -> "latest", "nginx" -> "latest")
|
|
172
|
+
const parts = image.split(":");
|
|
173
|
+
const tag = parts.length > 1 ? parts[parts.length - 1] : "latest";
|
|
174
|
+
const imageName = parts.length > 1 ? parts.slice(0, -1).join(":") : image;
|
|
175
|
+
// Extract digest from "Digest: sha256:abc123..."
|
|
176
|
+
const digestMatch = combined.match(/Digest:\s*(sha256:[a-f0-9]+)/);
|
|
177
|
+
const digest = digestMatch?.[1];
|
|
178
|
+
return {
|
|
179
|
+
image: imageName,
|
|
180
|
+
tag,
|
|
181
|
+
...(digest ? { digest } : {}),
|
|
182
|
+
success: exitCode === 0,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
92
185
|
//# sourceMappingURL=parsers.js.map
|
package/dist/lib/parsers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/l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;IAE1E,iDAAiD;IACjD,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAEhC,OAAO;QACL,KAAK,EAAE,SAAS;QAChB,GAAG;QACH,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,QAAQ,KAAK,CAAC;KACxB,CAAC;AACJ,CAAC"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,187 +1,85 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Zod schema for a single Docker container with ID, name, image, state, and port mappings. */
|
|
2
3
|
export declare const ContainerSchema: z.ZodObject<{
|
|
3
4
|
id: z.ZodString;
|
|
4
5
|
name: z.ZodString;
|
|
5
6
|
image: z.ZodString;
|
|
6
7
|
status: z.ZodString;
|
|
7
|
-
state: z.ZodEnum<
|
|
8
|
+
state: z.ZodEnum<{
|
|
9
|
+
running: "running";
|
|
10
|
+
exited: "exited";
|
|
11
|
+
paused: "paused";
|
|
12
|
+
restarting: "restarting";
|
|
13
|
+
dead: "dead";
|
|
14
|
+
created: "created";
|
|
15
|
+
removing: "removing";
|
|
16
|
+
}>;
|
|
8
17
|
ports: z.ZodArray<z.ZodObject<{
|
|
9
18
|
host: z.ZodOptional<z.ZodNumber>;
|
|
10
19
|
container: z.ZodNumber;
|
|
11
|
-
protocol: z.ZodEnum<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, {
|
|
17
|
-
container: number;
|
|
18
|
-
protocol: "tcp" | "udp";
|
|
19
|
-
host?: number | undefined;
|
|
20
|
-
}>, "many">;
|
|
20
|
+
protocol: z.ZodEnum<{
|
|
21
|
+
tcp: "tcp";
|
|
22
|
+
udp: "udp";
|
|
23
|
+
}>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
21
25
|
created: z.ZodString;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
name: string;
|
|
25
|
-
image: string;
|
|
26
|
-
status: string;
|
|
27
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
28
|
-
created: string;
|
|
29
|
-
ports: {
|
|
30
|
-
container: number;
|
|
31
|
-
protocol: "tcp" | "udp";
|
|
32
|
-
host?: number | undefined;
|
|
33
|
-
}[];
|
|
34
|
-
}, {
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
image: string;
|
|
38
|
-
status: string;
|
|
39
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
40
|
-
created: string;
|
|
41
|
-
ports: {
|
|
42
|
-
container: number;
|
|
43
|
-
protocol: "tcp" | "udp";
|
|
44
|
-
host?: number | undefined;
|
|
45
|
-
}[];
|
|
46
|
-
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** Zod schema for structured docker ps output with container list and running/stopped counts. */
|
|
47
28
|
export declare const DockerPsSchema: z.ZodObject<{
|
|
48
29
|
containers: z.ZodArray<z.ZodObject<{
|
|
49
30
|
id: z.ZodString;
|
|
50
31
|
name: z.ZodString;
|
|
51
32
|
image: z.ZodString;
|
|
52
33
|
status: z.ZodString;
|
|
53
|
-
state: z.ZodEnum<
|
|
34
|
+
state: z.ZodEnum<{
|
|
35
|
+
running: "running";
|
|
36
|
+
exited: "exited";
|
|
37
|
+
paused: "paused";
|
|
38
|
+
restarting: "restarting";
|
|
39
|
+
dead: "dead";
|
|
40
|
+
created: "created";
|
|
41
|
+
removing: "removing";
|
|
42
|
+
}>;
|
|
54
43
|
ports: z.ZodArray<z.ZodObject<{
|
|
55
44
|
host: z.ZodOptional<z.ZodNumber>;
|
|
56
45
|
container: z.ZodNumber;
|
|
57
|
-
protocol: z.ZodEnum<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, {
|
|
63
|
-
container: number;
|
|
64
|
-
protocol: "tcp" | "udp";
|
|
65
|
-
host?: number | undefined;
|
|
66
|
-
}>, "many">;
|
|
46
|
+
protocol: z.ZodEnum<{
|
|
47
|
+
tcp: "tcp";
|
|
48
|
+
udp: "udp";
|
|
49
|
+
}>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
67
51
|
created: z.ZodString;
|
|
68
|
-
},
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
image: string;
|
|
72
|
-
status: string;
|
|
73
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
74
|
-
created: string;
|
|
75
|
-
ports: {
|
|
76
|
-
container: number;
|
|
77
|
-
protocol: "tcp" | "udp";
|
|
78
|
-
host?: number | undefined;
|
|
79
|
-
}[];
|
|
80
|
-
}, {
|
|
81
|
-
id: string;
|
|
82
|
-
name: string;
|
|
83
|
-
image: string;
|
|
84
|
-
status: string;
|
|
85
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
86
|
-
created: string;
|
|
87
|
-
ports: {
|
|
88
|
-
container: number;
|
|
89
|
-
protocol: "tcp" | "udp";
|
|
90
|
-
host?: number | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
}>, "many">;
|
|
52
|
+
}, z.core.$strip>>;
|
|
93
53
|
total: z.ZodNumber;
|
|
94
54
|
running: z.ZodNumber;
|
|
95
55
|
stopped: z.ZodNumber;
|
|
96
|
-
},
|
|
97
|
-
running: number;
|
|
98
|
-
containers: {
|
|
99
|
-
id: string;
|
|
100
|
-
name: string;
|
|
101
|
-
image: string;
|
|
102
|
-
status: string;
|
|
103
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
104
|
-
created: string;
|
|
105
|
-
ports: {
|
|
106
|
-
container: number;
|
|
107
|
-
protocol: "tcp" | "udp";
|
|
108
|
-
host?: number | undefined;
|
|
109
|
-
}[];
|
|
110
|
-
}[];
|
|
111
|
-
total: number;
|
|
112
|
-
stopped: number;
|
|
113
|
-
}, {
|
|
114
|
-
running: number;
|
|
115
|
-
containers: {
|
|
116
|
-
id: string;
|
|
117
|
-
name: string;
|
|
118
|
-
image: string;
|
|
119
|
-
status: string;
|
|
120
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
121
|
-
created: string;
|
|
122
|
-
ports: {
|
|
123
|
-
container: number;
|
|
124
|
-
protocol: "tcp" | "udp";
|
|
125
|
-
host?: number | undefined;
|
|
126
|
-
}[];
|
|
127
|
-
}[];
|
|
128
|
-
total: number;
|
|
129
|
-
stopped: number;
|
|
130
|
-
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
131
57
|
export type DockerPs = z.infer<typeof DockerPsSchema>;
|
|
58
|
+
/** Zod schema for structured docker build output with success status, image ID, and build errors. */
|
|
132
59
|
export declare const DockerBuildSchema: z.ZodObject<{
|
|
133
60
|
success: z.ZodBoolean;
|
|
134
61
|
imageId: z.ZodOptional<z.ZodString>;
|
|
135
62
|
duration: z.ZodNumber;
|
|
136
63
|
steps: z.ZodOptional<z.ZodNumber>;
|
|
137
|
-
errors: z.ZodArray<z.ZodString
|
|
138
|
-
},
|
|
139
|
-
success: boolean;
|
|
140
|
-
duration: number;
|
|
141
|
-
errors: string[];
|
|
142
|
-
imageId?: string | undefined;
|
|
143
|
-
steps?: number | undefined;
|
|
144
|
-
}, {
|
|
145
|
-
success: boolean;
|
|
146
|
-
duration: number;
|
|
147
|
-
errors: string[];
|
|
148
|
-
imageId?: string | undefined;
|
|
149
|
-
steps?: number | undefined;
|
|
150
|
-
}>;
|
|
64
|
+
errors: z.ZodArray<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
151
66
|
export type DockerBuild = z.infer<typeof DockerBuildSchema>;
|
|
67
|
+
/** Zod schema for structured docker logs output with container name, log lines, and total count. */
|
|
152
68
|
export declare const DockerLogsSchema: z.ZodObject<{
|
|
153
69
|
container: z.ZodString;
|
|
154
|
-
lines: z.ZodArray<z.ZodString
|
|
70
|
+
lines: z.ZodArray<z.ZodString>;
|
|
155
71
|
total: z.ZodNumber;
|
|
156
|
-
},
|
|
157
|
-
container: string;
|
|
158
|
-
total: number;
|
|
159
|
-
lines: string[];
|
|
160
|
-
}, {
|
|
161
|
-
container: string;
|
|
162
|
-
total: number;
|
|
163
|
-
lines: string[];
|
|
164
|
-
}>;
|
|
72
|
+
}, z.core.$strip>;
|
|
165
73
|
export type DockerLogs = z.infer<typeof DockerLogsSchema>;
|
|
74
|
+
/** Zod schema for a single Docker image with ID, repository, tag, size, and creation time. */
|
|
166
75
|
export declare const ImageSchema: z.ZodObject<{
|
|
167
76
|
id: z.ZodString;
|
|
168
77
|
repository: z.ZodString;
|
|
169
78
|
tag: z.ZodString;
|
|
170
79
|
size: z.ZodString;
|
|
171
80
|
created: z.ZodString;
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
created: string;
|
|
175
|
-
repository: string;
|
|
176
|
-
tag: string;
|
|
177
|
-
size: string;
|
|
178
|
-
}, {
|
|
179
|
-
id: string;
|
|
180
|
-
created: string;
|
|
181
|
-
repository: string;
|
|
182
|
-
tag: string;
|
|
183
|
-
size: string;
|
|
184
|
-
}>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/** Zod schema for structured docker images output with image list and total count. */
|
|
185
83
|
export declare const DockerImagesSchema: z.ZodObject<{
|
|
186
84
|
images: z.ZodArray<z.ZodObject<{
|
|
187
85
|
id: z.ZodString;
|
|
@@ -189,38 +87,46 @@ export declare const DockerImagesSchema: z.ZodObject<{
|
|
|
189
87
|
tag: z.ZodString;
|
|
190
88
|
size: z.ZodString;
|
|
191
89
|
created: z.ZodString;
|
|
192
|
-
},
|
|
193
|
-
id: string;
|
|
194
|
-
created: string;
|
|
195
|
-
repository: string;
|
|
196
|
-
tag: string;
|
|
197
|
-
size: string;
|
|
198
|
-
}, {
|
|
199
|
-
id: string;
|
|
200
|
-
created: string;
|
|
201
|
-
repository: string;
|
|
202
|
-
tag: string;
|
|
203
|
-
size: string;
|
|
204
|
-
}>, "many">;
|
|
90
|
+
}, z.core.$strip>>;
|
|
205
91
|
total: z.ZodNumber;
|
|
206
|
-
},
|
|
207
|
-
total: number;
|
|
208
|
-
images: {
|
|
209
|
-
id: string;
|
|
210
|
-
created: string;
|
|
211
|
-
repository: string;
|
|
212
|
-
tag: string;
|
|
213
|
-
size: string;
|
|
214
|
-
}[];
|
|
215
|
-
}, {
|
|
216
|
-
total: number;
|
|
217
|
-
images: {
|
|
218
|
-
id: string;
|
|
219
|
-
created: string;
|
|
220
|
-
repository: string;
|
|
221
|
-
tag: string;
|
|
222
|
-
size: string;
|
|
223
|
-
}[];
|
|
224
|
-
}>;
|
|
92
|
+
}, z.core.$strip>;
|
|
225
93
|
export type DockerImages = z.infer<typeof DockerImagesSchema>;
|
|
94
|
+
/** Zod schema for structured docker run output with container ID, image, and detach status. */
|
|
95
|
+
export declare const DockerRunSchema: z.ZodObject<{
|
|
96
|
+
containerId: z.ZodString;
|
|
97
|
+
image: z.ZodString;
|
|
98
|
+
detached: z.ZodBoolean;
|
|
99
|
+
name: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export type DockerRun = z.infer<typeof DockerRunSchema>;
|
|
102
|
+
/** Zod schema for structured docker exec output with exit code, stdout, stderr, and success flag. */
|
|
103
|
+
export declare const DockerExecSchema: z.ZodObject<{
|
|
104
|
+
exitCode: z.ZodNumber;
|
|
105
|
+
stdout: z.ZodString;
|
|
106
|
+
stderr: z.ZodString;
|
|
107
|
+
success: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type DockerExec = z.infer<typeof DockerExecSchema>;
|
|
110
|
+
/** Zod schema for structured docker compose up output with service list and started count. */
|
|
111
|
+
export declare const DockerComposeUpSchema: z.ZodObject<{
|
|
112
|
+
success: z.ZodBoolean;
|
|
113
|
+
services: z.ZodArray<z.ZodString>;
|
|
114
|
+
started: z.ZodNumber;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type DockerComposeUp = z.infer<typeof DockerComposeUpSchema>;
|
|
117
|
+
/** Zod schema for structured docker compose down output with stopped and removed counts. */
|
|
118
|
+
export declare const DockerComposeDownSchema: z.ZodObject<{
|
|
119
|
+
success: z.ZodBoolean;
|
|
120
|
+
stopped: z.ZodNumber;
|
|
121
|
+
removed: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type DockerComposeDown = z.infer<typeof DockerComposeDownSchema>;
|
|
124
|
+
/** Zod schema for structured docker pull output with image, tag, digest, and success flag. */
|
|
125
|
+
export declare const DockerPullSchema: z.ZodObject<{
|
|
126
|
+
image: z.ZodString;
|
|
127
|
+
tag: z.ZodString;
|
|
128
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
129
|
+
success: z.ZodBoolean;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
export type DockerPull = z.infer<typeof DockerPullSchema>;
|
|
226
132
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+FAA+F;AAC/F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;iBAc1B,CAAC;AAEH,iGAAiG;AACjG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,qGAAq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@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Zod schema for a single Docker container with ID, name, image, state, and port mappings. */
|
|
2
3
|
export const ContainerSchema = z.object({
|
|
3
4
|
id: z.string(),
|
|
4
5
|
name: z.string(),
|
|
@@ -12,12 +13,14 @@ export const ContainerSchema = z.object({
|
|
|
12
13
|
})),
|
|
13
14
|
created: z.string(),
|
|
14
15
|
});
|
|
16
|
+
/** Zod schema for structured docker ps output with container list and running/stopped counts. */
|
|
15
17
|
export const DockerPsSchema = z.object({
|
|
16
18
|
containers: z.array(ContainerSchema),
|
|
17
19
|
total: z.number(),
|
|
18
20
|
running: z.number(),
|
|
19
21
|
stopped: z.number(),
|
|
20
22
|
});
|
|
23
|
+
/** Zod schema for structured docker build output with success status, image ID, and build errors. */
|
|
21
24
|
export const DockerBuildSchema = z.object({
|
|
22
25
|
success: z.boolean(),
|
|
23
26
|
imageId: z.string().optional(),
|
|
@@ -25,11 +28,13 @@ export const DockerBuildSchema = z.object({
|
|
|
25
28
|
steps: z.number().optional(),
|
|
26
29
|
errors: z.array(z.string()),
|
|
27
30
|
});
|
|
31
|
+
/** Zod schema for structured docker logs output with container name, log lines, and total count. */
|
|
28
32
|
export const DockerLogsSchema = z.object({
|
|
29
33
|
container: z.string(),
|
|
30
34
|
lines: z.array(z.string()),
|
|
31
35
|
total: z.number(),
|
|
32
36
|
});
|
|
37
|
+
/** Zod schema for a single Docker image with ID, repository, tag, size, and creation time. */
|
|
33
38
|
export const ImageSchema = z.object({
|
|
34
39
|
id: z.string(),
|
|
35
40
|
repository: z.string(),
|
|
@@ -37,8 +42,42 @@ export const ImageSchema = z.object({
|
|
|
37
42
|
size: z.string(),
|
|
38
43
|
created: z.string(),
|
|
39
44
|
});
|
|
45
|
+
/** Zod schema for structured docker images output with image list and total count. */
|
|
40
46
|
export const DockerImagesSchema = z.object({
|
|
41
47
|
images: z.array(ImageSchema),
|
|
42
48
|
total: z.number(),
|
|
43
49
|
});
|
|
50
|
+
/** Zod schema for structured docker run output with container ID, image, and detach status. */
|
|
51
|
+
export const DockerRunSchema = z.object({
|
|
52
|
+
containerId: z.string(),
|
|
53
|
+
image: z.string(),
|
|
54
|
+
detached: z.boolean(),
|
|
55
|
+
name: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/** Zod schema for structured docker exec output with exit code, stdout, stderr, and success flag. */
|
|
58
|
+
export const DockerExecSchema = z.object({
|
|
59
|
+
exitCode: z.number(),
|
|
60
|
+
stdout: z.string(),
|
|
61
|
+
stderr: z.string(),
|
|
62
|
+
success: z.boolean(),
|
|
63
|
+
});
|
|
64
|
+
/** Zod schema for structured docker compose up output with service list and started count. */
|
|
65
|
+
export const DockerComposeUpSchema = z.object({
|
|
66
|
+
success: z.boolean(),
|
|
67
|
+
services: z.array(z.string()),
|
|
68
|
+
started: z.number(),
|
|
69
|
+
});
|
|
70
|
+
/** Zod schema for structured docker compose down output with stopped and removed counts. */
|
|
71
|
+
export const DockerComposeDownSchema = z.object({
|
|
72
|
+
success: z.boolean(),
|
|
73
|
+
stopped: z.number(),
|
|
74
|
+
removed: z.number(),
|
|
75
|
+
});
|
|
76
|
+
/** Zod schema for structured docker pull output with image, tag, digest, and success flag. */
|
|
77
|
+
export const DockerPullSchema = z.object({
|
|
78
|
+
image: z.string(),
|
|
79
|
+
tag: z.string(),
|
|
80
|
+
digest: z.string().optional(),
|
|
81
|
+
success: z.boolean(),
|
|
82
|
+
});
|
|
44
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,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AM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAIH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-down.d.ts","sourceRoot":"","sources":["../../src/tools/compose-down.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAyCxD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseComposeDownOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatComposeDown } from "../lib/formatters.js";
|
|
6
|
+
import { DockerComposeDownSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerComposeDownTool(server) {
|
|
8
|
+
server.registerTool("compose-down", {
|
|
9
|
+
title: "Docker Compose Down",
|
|
10
|
+
description: "Stops Docker Compose services and returns structured status. Use instead of running `docker compose down` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().describe("Directory containing docker-compose.yml"),
|
|
13
|
+
volumes: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(false)
|
|
17
|
+
.describe("Also remove named volumes (default: false)"),
|
|
18
|
+
removeOrphans: z
|
|
19
|
+
.boolean()
|
|
20
|
+
.optional()
|
|
21
|
+
.default(false)
|
|
22
|
+
.describe("Remove orphan containers (default: false)"),
|
|
23
|
+
file: z.string().optional().describe("Compose file path (default: docker-compose.yml)"),
|
|
24
|
+
},
|
|
25
|
+
outputSchema: DockerComposeDownSchema,
|
|
26
|
+
}, async ({ path, volumes, removeOrphans, file }) => {
|
|
27
|
+
const args = ["compose"];
|
|
28
|
+
if (file)
|
|
29
|
+
args.push("-f", file);
|
|
30
|
+
args.push("down");
|
|
31
|
+
if (volumes)
|
|
32
|
+
args.push("--volumes");
|
|
33
|
+
if (removeOrphans)
|
|
34
|
+
args.push("--remove-orphans");
|
|
35
|
+
const result = await docker(args, path);
|
|
36
|
+
const data = parseComposeDownOutput(result.stdout, result.stderr, result.exitCode);
|
|
37
|
+
if (result.exitCode !== 0 && data.stopped === 0 && data.removed === 0) {
|
|
38
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
39
|
+
throw new Error(`docker compose down failed: ${errorMsg.trim()}`);
|
|
40
|
+
}
|
|
41
|
+
return dualOutput(data, formatComposeDown);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=compose-down.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-down.js","sourceRoot":"","sources":["../../src/tools/compose-down.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;A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CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YACtE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-up.d.ts","sourceRoot":"","sources":["../../src/tools/compose-up.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QA6CtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseComposeUpOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatComposeUp } from "../lib/formatters.js";
|
|
6
|
+
import { DockerComposeUpSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerComposeUpTool(server) {
|
|
8
|
+
server.registerTool("compose-up", {
|
|
9
|
+
title: "Docker Compose Up",
|
|
10
|
+
description: "Starts Docker Compose services and returns structured status. Use instead of running `docker compose up` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().describe("Directory containing docker-compose.yml"),
|
|
13
|
+
services: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default([])
|
|
17
|
+
.describe("Specific services to start (default: all)"),
|
|
18
|
+
detach: z.boolean().optional().default(true).describe("Run in background (default: true)"),
|
|
19
|
+
build: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.optional()
|
|
22
|
+
.default(false)
|
|
23
|
+
.describe("Build images before starting (default: false)"),
|
|
24
|
+
file: z.string().optional().describe("Compose file path (default: docker-compose.yml)"),
|
|
25
|
+
},
|
|
26
|
+
outputSchema: DockerComposeUpSchema,
|
|
27
|
+
}, async ({ path, services, detach, build, file }) => {
|
|
28
|
+
const args = ["compose"];
|
|
29
|
+
if (file)
|
|
30
|
+
args.push("-f", file);
|
|
31
|
+
args.push("up");
|
|
32
|
+
if (detach)
|
|
33
|
+
args.push("-d");
|
|
34
|
+
if (build)
|
|
35
|
+
args.push("--build");
|
|
36
|
+
if (services && services.length > 0) {
|
|
37
|
+
args.push(...services);
|
|
38
|
+
}
|
|
39
|
+
const result = await docker(args, path);
|
|
40
|
+
const data = parseComposeUpOutput(result.stdout, result.stderr, result.exitCode);
|
|
41
|
+
if (result.exitCode !== 0 && data.started === 0) {
|
|
42
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
43
|
+
throw new Error(`docker compose up failed: ${errorMsg.trim()}`);
|
|
44
|
+
}
|
|
45
|
+
return dualOutput(data, formatComposeUp);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=compose-up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-up.js","sourceRoot":"","sources":["../../src/tools/compose-up.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,M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QAAQ,CAAC,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC3C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/tools/exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAmCjD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseExecOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatExec } from "../lib/formatters.js";
|
|
6
|
+
import { DockerExecSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerExecTool(server) {
|
|
8
|
+
server.registerTool("exec", {
|
|
9
|
+
title: "Docker Exec",
|
|
10
|
+
description: "Executes a command in a running Docker container and returns structured output. Use instead of running `docker exec` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
container: z.string().describe("Container name or ID"),
|
|
13
|
+
command: z.array(z.string()).describe('Command to execute (e.g., ["ls", "-la"])'),
|
|
14
|
+
workdir: z.string().optional().describe("Working directory inside the container"),
|
|
15
|
+
env: z
|
|
16
|
+
.array(z.string())
|
|
17
|
+
.optional()
|
|
18
|
+
.default([])
|
|
19
|
+
.describe('Environment variables (e.g., ["KEY=VALUE"])'),
|
|
20
|
+
path: z.string().optional().describe("Host working directory (default: cwd)"),
|
|
21
|
+
},
|
|
22
|
+
outputSchema: DockerExecSchema,
|
|
23
|
+
}, async ({ container, command, workdir, env, path }) => {
|
|
24
|
+
assertNoFlagInjection(container, "container");
|
|
25
|
+
const args = ["exec"];
|
|
26
|
+
if (workdir)
|
|
27
|
+
args.push("-w", workdir);
|
|
28
|
+
for (const e of env ?? []) {
|
|
29
|
+
args.push("-e", e);
|
|
30
|
+
}
|
|
31
|
+
args.push(container, ...command);
|
|
32
|
+
const result = await docker(args, path);
|
|
33
|
+
const data = parseExecOutput(result.stdout, result.stderr, result.exitCode);
|
|
34
|
+
return dualOutput(data, formatExec);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/tools/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE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AE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5E,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAUjD"}
|
package/dist/tools/index.js
CHANGED
|
@@ -2,10 +2,20 @@ import { registerPsTool } from "./ps.js";
|
|
|
2
2
|
import { registerBuildTool } from "./build.js";
|
|
3
3
|
import { registerLogsTool } from "./logs.js";
|
|
4
4
|
import { registerImagesTool } from "./images.js";
|
|
5
|
+
import { registerRunTool } from "./run.js";
|
|
6
|
+
import { registerExecTool } from "./exec.js";
|
|
7
|
+
import { registerComposeUpTool } from "./compose-up.js";
|
|
8
|
+
import { registerComposeDownTool } from "./compose-down.js";
|
|
9
|
+
import { registerPullTool } from "./pull.js";
|
|
5
10
|
export function registerAllTools(server) {
|
|
6
11
|
registerPsTool(server);
|
|
7
12
|
registerBuildTool(server);
|
|
8
13
|
registerLogsTool(server);
|
|
9
14
|
registerImagesTool(server);
|
|
15
|
+
registerRunTool(server);
|
|
16
|
+
registerExecTool(server);
|
|
17
|
+
registerComposeUpTool(server);
|
|
18
|
+
registerComposeDownTool(server);
|
|
19
|
+
registerPullTool(server);
|
|
10
20
|
}
|
|
11
21
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/tools/pull.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAmCjD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parsePullOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatPull } from "../lib/formatters.js";
|
|
6
|
+
import { DockerPullSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerPullTool(server) {
|
|
8
|
+
server.registerTool("pull", {
|
|
9
|
+
title: "Docker Pull",
|
|
10
|
+
description: "Pulls a Docker image from a registry and returns structured result with digest info. Use instead of running `docker pull` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
image: z.string().describe("Image to pull (e.g., nginx:latest, ubuntu:22.04)"),
|
|
13
|
+
platform: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Target platform (e.g., "linux/amd64", "linux/arm64")'),
|
|
17
|
+
path: z.string().optional().describe("Working directory (default: cwd)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: DockerPullSchema,
|
|
20
|
+
}, async ({ image, platform, path }) => {
|
|
21
|
+
assertNoFlagInjection(image, "image");
|
|
22
|
+
const args = ["pull"];
|
|
23
|
+
if (platform)
|
|
24
|
+
args.push("--platform", platform);
|
|
25
|
+
args.push(image);
|
|
26
|
+
const result = await docker(args, path);
|
|
27
|
+
if (result.exitCode !== 0) {
|
|
28
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
29
|
+
throw new Error(`docker pull failed: ${errorMsg.trim()}`);
|
|
30
|
+
}
|
|
31
|
+
const data = parsePullOutput(result.stdout, result.stderr, result.exitCode, image);
|
|
32
|
+
return dualOutput(data, formatPull);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AAC;QAEjB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAExC,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnF,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QA4EhD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseRunOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatRun } from "../lib/formatters.js";
|
|
6
|
+
import { DockerRunSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerRunTool(server) {
|
|
8
|
+
server.registerTool("run", {
|
|
9
|
+
title: "Docker Run",
|
|
10
|
+
description: "Runs a Docker container from an image and returns structured container ID and status. Use instead of running `docker run` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
image: z.string().describe("Docker image to run (e.g., nginx:latest)"),
|
|
13
|
+
name: z.string().optional().describe("Container name"),
|
|
14
|
+
ports: z
|
|
15
|
+
.array(z.string())
|
|
16
|
+
.optional()
|
|
17
|
+
.default([])
|
|
18
|
+
.describe('Port mappings (e.g., ["8080:80", "443:443"])'),
|
|
19
|
+
volumes: z
|
|
20
|
+
.array(z.string())
|
|
21
|
+
.optional()
|
|
22
|
+
.default([])
|
|
23
|
+
.describe('Volume mounts (e.g., ["/host/path:/container/path"])'),
|
|
24
|
+
env: z
|
|
25
|
+
.array(z.string())
|
|
26
|
+
.optional()
|
|
27
|
+
.default([])
|
|
28
|
+
.describe('Environment variables (e.g., ["KEY=VALUE"])'),
|
|
29
|
+
detach: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.default(true)
|
|
33
|
+
.describe("Run container in background (default: true)"),
|
|
34
|
+
rm: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.optional()
|
|
37
|
+
.default(false)
|
|
38
|
+
.describe("Remove container after exit (default: false)"),
|
|
39
|
+
command: z
|
|
40
|
+
.array(z.string())
|
|
41
|
+
.optional()
|
|
42
|
+
.default([])
|
|
43
|
+
.describe("Command to run in the container"),
|
|
44
|
+
path: z.string().optional().describe("Working directory (default: cwd)"),
|
|
45
|
+
},
|
|
46
|
+
outputSchema: DockerRunSchema,
|
|
47
|
+
}, async ({ image, name, ports, volumes, env, detach, rm, command, path }) => {
|
|
48
|
+
assertNoFlagInjection(image, "image");
|
|
49
|
+
const args = ["run"];
|
|
50
|
+
if (detach)
|
|
51
|
+
args.push("-d");
|
|
52
|
+
if (rm)
|
|
53
|
+
args.push("--rm");
|
|
54
|
+
if (name)
|
|
55
|
+
args.push("--name", name);
|
|
56
|
+
for (const p of ports ?? []) {
|
|
57
|
+
args.push("-p", p);
|
|
58
|
+
}
|
|
59
|
+
for (const v of volumes ?? []) {
|
|
60
|
+
args.push("-v", v);
|
|
61
|
+
}
|
|
62
|
+
for (const e of env ?? []) {
|
|
63
|
+
args.push("-e", e);
|
|
64
|
+
}
|
|
65
|
+
args.push(image);
|
|
66
|
+
if (command && command.length > 0) {
|
|
67
|
+
args.push(...command);
|
|
68
|
+
}
|
|
69
|
+
const result = await docker(args, path);
|
|
70
|
+
if (result.exitCode !== 0) {
|
|
71
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
72
|
+
throw new Error(`docker run failed: ${errorMsg.trim()}`);
|
|
73
|
+
}
|
|
74
|
+
const data = parseRunOutput(result.stdout, image, detach ?? true, name);
|
|
75
|
+
return dualOutput(data, formatRun);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,4IAA4I;QAC9I,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;YACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACtD,KAAK,EAAE,CAAC;iBACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,EAAE,CAAC;iB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+1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paretools/docker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"mcpName": "io.github.Dave-London/docker",
|
|
5
5
|
"description": "MCP server for Docker with structured, token-efficient output",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,11 +9,22 @@
|
|
|
9
9
|
"mcp-server",
|
|
10
10
|
"model-context-protocol",
|
|
11
11
|
"structured-output",
|
|
12
|
-
"
|
|
12
|
+
"ai",
|
|
13
|
+
"ai-agent",
|
|
14
|
+
"claude",
|
|
15
|
+
"cursor",
|
|
16
|
+
"copilot",
|
|
17
|
+
"token-efficient",
|
|
18
|
+
"devtools",
|
|
19
|
+
"cli",
|
|
20
|
+
"docker",
|
|
21
|
+
"docker-compose",
|
|
22
|
+
"container",
|
|
23
|
+
"devops"
|
|
13
24
|
],
|
|
14
25
|
"homepage": "https://github.com/Dave-London/pare/tree/main/packages/server-docker",
|
|
15
26
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
27
|
+
"node": ">=20"
|
|
17
28
|
},
|
|
18
29
|
"type": "module",
|
|
19
30
|
"bin": {
|
|
@@ -38,13 +49,13 @@
|
|
|
38
49
|
],
|
|
39
50
|
"dependencies": {
|
|
40
51
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
41
|
-
"zod": "^3.
|
|
42
|
-
"@paretools/shared": "0.
|
|
52
|
+
"zod": "^4.3.6",
|
|
53
|
+
"@paretools/shared": "0.5.0"
|
|
43
54
|
},
|
|
44
55
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^25.2.3",
|
|
46
57
|
"typescript": "^5.7.0",
|
|
47
|
-
"vitest": "^
|
|
58
|
+
"vitest": "^4.0.18",
|
|
48
59
|
"@paretools/tsconfig": "0.0.0"
|
|
49
60
|
},
|
|
50
61
|
"scripts": {
|