@jurislm/woodpecker-ci-plugin 1.1.8 → 2.0.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/.codex-plugin/plugin.json +1 -2
- package/README.md +43 -19
- package/api/manifest.json +8 -0
- package/contracts/woodpecker-mcp-v2.json +2653 -0
- package/dist/api.d.ts +11 -0
- package/dist/api.js +23 -0
- package/dist/api.js.map +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +49 -7
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +2 -5
- package/dist/config.js +3 -30
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +29 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/operations.d.ts +1 -0
- package/dist/generated/operations.js +105 -118
- package/dist/generated/operations.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +19 -35
- package/dist/server.js.map +1 -1
- package/dist/tools/pipelines.d.ts +3 -0
- package/dist/tools/pipelines.js +47 -0
- package/dist/tools/pipelines.js.map +1 -0
- package/openapi/woodpecker-dev.yaml +4747 -0
- package/package.json +6 -4
- package/plugin.json +1 -1
- package/skills/woodpecker-ci/SKILL.md +1 -1
- package/.app.json +0 -3
- package/dist/generated/woodpecker-zod.d.ts +0 -1229
- package/dist/generated/woodpecker-zod.js +0 -56
- package/dist/generated/woodpecker-zod.js.map +0 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type FetchLike } from "./client.js";
|
|
3
3
|
import type { WoodpeckerConfig } from "./config.js";
|
|
4
4
|
export declare function createServer(config: WoodpeckerConfig, fetchImpl?: FetchLike): McpServer;
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { createApiRequest, withApiErrorHandling } from "./api.js";
|
|
4
|
+
import { WoodpeckerClient, redactSensitive } from "./client.js";
|
|
4
5
|
import { operations } from "./generated/operations.js";
|
|
6
|
+
import { registerPipelineTools } from "./tools/pipelines.js";
|
|
5
7
|
import packageJson from "../package.json" with { type: "json" };
|
|
6
8
|
const outputRequestSchema = z.object({
|
|
7
9
|
method: z.string(),
|
|
@@ -9,12 +11,13 @@ const outputRequestSchema = z.object({
|
|
|
9
11
|
});
|
|
10
12
|
export function createServer(config, fetchImpl) {
|
|
11
13
|
const client = new WoodpeckerClient(config, fetchImpl);
|
|
14
|
+
const apiRequest = createApiRequest(client);
|
|
12
15
|
const server = new McpServer({ name: "woodpecker-ci-plugin", version: packageJson.version }, {
|
|
13
|
-
instructions: "Use read tools to resolve exact Woodpecker IDs and permissions before mutations. Never expose tokens or secret values in narration or logs.",
|
|
16
|
+
instructions: "Use read tools to resolve exact Woodpecker IDs and permissions before mutations. Never expose tokens or secret values in tool results, narration, or logs.",
|
|
14
17
|
});
|
|
15
18
|
for (const operation of operations) {
|
|
16
19
|
server.registerTool(operation.name, {
|
|
17
|
-
title: operation.
|
|
20
|
+
title: operation.title,
|
|
18
21
|
description: operation.description,
|
|
19
22
|
inputSchema: operation.inputSchema,
|
|
20
23
|
outputSchema: z.object({
|
|
@@ -23,39 +26,20 @@ export function createServer(config, fetchImpl) {
|
|
|
23
26
|
request: outputRequestSchema,
|
|
24
27
|
}),
|
|
25
28
|
annotations: operation.annotations,
|
|
26
|
-
}, async (input) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
const details = error instanceof WoodpeckerApiError
|
|
41
|
-
? {
|
|
42
|
-
code: "WOODPECKER_API_ERROR",
|
|
43
|
-
status: error.status,
|
|
44
|
-
method: error.method,
|
|
45
|
-
path: error.path,
|
|
46
|
-
message: error.message,
|
|
47
|
-
}
|
|
48
|
-
: {
|
|
49
|
-
code: "WOODPECKER_TOOL_ERROR",
|
|
50
|
-
message: error instanceof Error ? error.message : String(error),
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
isError: true,
|
|
54
|
-
content: [{ type: "text", text: JSON.stringify({ error: details }) }],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
29
|
+
}, async (input) => withApiErrorHandling(async () => {
|
|
30
|
+
const envelope = await apiRequest(operation, input);
|
|
31
|
+
const structuredContent = {
|
|
32
|
+
data: redactSensitive(envelope.data),
|
|
33
|
+
status: envelope.status,
|
|
34
|
+
request: envelope.request,
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
structuredContent,
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent) }],
|
|
39
|
+
};
|
|
40
|
+
}, [config.token]));
|
|
58
41
|
}
|
|
42
|
+
registerPipelineTools(server, apiRequest, [config.token]);
|
|
59
43
|
return server;
|
|
60
44
|
}
|
|
61
45
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,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AAI,EAAE;YAC7C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,KAAgC,CAAC,CAAC;YAC/E,MAAM,iBAAiB,GAAG;gBACxB,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACpC,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;aAC1B,CAAC;YACF,OAAO;gBACL,iBAAiB;gBACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC;aAC9E,CAAC;QACN,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CACnB,CAAC;IACJ,CAAC;IAED,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withApiErrorHandling } from "../api.js";
|
|
3
|
+
import { operations } from "../generated/operations.js";
|
|
4
|
+
function getOperation(name) {
|
|
5
|
+
const operation = operations.find((candidate) => candidate.name === name);
|
|
6
|
+
if (!operation)
|
|
7
|
+
throw new Error("Generated Woodpecker operation is missing: " + name);
|
|
8
|
+
return operation;
|
|
9
|
+
}
|
|
10
|
+
const lookupRepository = getOperation("woodpecker_lookup_repository_full_name");
|
|
11
|
+
const getPipeline = getOperation("woodpecker_get_repositories_pipeline");
|
|
12
|
+
const getPipelineMetadata = getOperation("woodpecker_get_metadata_pipeline_or_specific_workflow_including_previous_pipeline_info");
|
|
13
|
+
export function registerPipelineTools(server, apiRequest, tokens = []) {
|
|
14
|
+
server.registerTool("woodpecker_inspect_pipeline", {
|
|
15
|
+
title: "Inspect a pipeline",
|
|
16
|
+
description: "Resolve a repository by full name, then return a pipeline and its commit metadata.",
|
|
17
|
+
inputSchema: z.object({
|
|
18
|
+
repository: z.string().min(1).describe("Repository full name, for example owner/repository."),
|
|
19
|
+
pipeline_number: z.number().int().positive(),
|
|
20
|
+
}).strict(),
|
|
21
|
+
outputSchema: z.object({
|
|
22
|
+
repository: z.object({ id: z.number(), full_name: z.string() }),
|
|
23
|
+
pipeline: z.unknown(),
|
|
24
|
+
metadata: z.unknown(),
|
|
25
|
+
}).strict(),
|
|
26
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
27
|
+
}, async ({ repository: fullName, pipeline_number }) => withApiErrorHandling(async () => {
|
|
28
|
+
const repository = await apiRequest(lookupRepository, { repo_full_name: fullName });
|
|
29
|
+
const repo = repository.data;
|
|
30
|
+
if (typeof repo.id !== "number")
|
|
31
|
+
throw new Error("Woodpecker repository lookup returned no numeric ID");
|
|
32
|
+
const [pipeline, metadata] = await Promise.all([
|
|
33
|
+
apiRequest(getPipeline, { repo_id: repo.id, pipeline_number }),
|
|
34
|
+
apiRequest(getPipelineMetadata, { repo_id: repo.id, pipeline_number }),
|
|
35
|
+
]);
|
|
36
|
+
const structuredContent = {
|
|
37
|
+
repository: { id: repo.id, full_name: typeof repo.full_name === "string" ? repo.full_name : fullName },
|
|
38
|
+
pipeline: pipeline.data,
|
|
39
|
+
metadata: metadata.data,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
structuredContent,
|
|
43
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent) }],
|
|
44
|
+
};
|
|
45
|
+
}, tokens));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=pipelines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../src/tools/pipelines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,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