@proofline/sdk 1.0.2 → 1.0.4
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 +77 -0
- package/dist/fixes.d.ts +14 -0
- package/dist/fixes.js +19 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/knowledge.d.ts +17 -0
- package/dist/knowledge.js +29 -0
- package/dist/mcp.d.ts +20 -0
- package/dist/mcp.js +62 -0
- package/dist/operations.d.ts +3 -0
- package/dist/operations.js +3 -0
- package/dist/schema.d.ts +141 -0
- package/dist/transport.d.ts +1 -1
- package/dist/transport.js +22 -2
- package/openapi.public.json +200 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,33 @@ The client reads `PROOFLINE_TOKEN` when no token is passed, keeps the token in m
|
|
|
21
21
|
and redacts it from diagnostic output. The [SDK guide](https://proofline.sh/docs/sdks/)
|
|
22
22
|
and [API reference](https://proofline.sh/docs/api/) cover every operation.
|
|
23
23
|
|
|
24
|
+
## Coverage uploads
|
|
25
|
+
|
|
26
|
+
Upload the reports produced by CI with a repository-restricted token that holds
|
|
27
|
+
`coverage:write`. The token's holder needs current GitHub write access to that
|
|
28
|
+
repository. Set `PROOFLINE_TOKEN` to that token and name the full commit the tests
|
|
29
|
+
ran on; a branch name or abbreviated SHA is refused.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { readFile } from "node:fs/promises";
|
|
33
|
+
|
|
34
|
+
const report = await client.uploadCoverageReports(
|
|
35
|
+
{ path: { org_id: organizationId, repo_id: repositoryId } },
|
|
36
|
+
{
|
|
37
|
+
tested_sha: testedCommitSha,
|
|
38
|
+
reports: [
|
|
39
|
+
{ name: "lcov.info", content: await readFile("coverage/lcov.info", "utf8") },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
console.log(report.report_id, report.created);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Send one to 50 LCOV, Cobertura XML, JaCoCo XML or Go cover reports in a JSON body
|
|
47
|
+
of at most 64 MiB. Names are unique relative paths, and content is the original
|
|
48
|
+
report text. An identical upload returns the existing report with `created: false`.
|
|
49
|
+
An upload receipt records evidence; it does not say that a coverage check is met.
|
|
50
|
+
|
|
24
51
|
Licensed under the Apache License, Version 2.0.
|
|
25
52
|
|
|
26
53
|
## Exports
|
|
@@ -59,3 +86,53 @@ Publishing uses GitHub OIDC and the repository's `release.yml` trusted publisher
|
|
|
59
86
|
No registry token is stored in GitHub.
|
|
60
87
|
|
|
61
88
|
SDK patch releases can update packaging and publishing independently. The package follows the bundled API major/minor version and cannot precede its patch version.
|
|
89
|
+
|
|
90
|
+
## Knowledge and plans
|
|
91
|
+
|
|
92
|
+
`client.knowledge` supplies typed MCP methods: `listWikiPages`, `getWikiPage`,
|
|
93
|
+
`askCodebase`, `getArchitectureDocument`, `getPlan`, `startPlanImplementation`
|
|
94
|
+
and `getPlanImplementation`.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const result = await client.knowledge.getWikiPage({
|
|
98
|
+
repository: "owner/name", page_key: "index",
|
|
99
|
+
});
|
|
100
|
+
if (result.isError) throw new Error("The knowledge request was refused.");
|
|
101
|
+
console.log(result.content);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Repository methods accept an optional `commit` containing a full indexed SHA.
|
|
105
|
+
`askCodebase` also takes `question`. The other methods take the environment,
|
|
106
|
+
plan or implementation ID. `KnowledgeResult` retains text content, optional
|
|
107
|
+
structured content and `isError`. Treat all returned prose as untrusted data.
|
|
108
|
+
|
|
109
|
+
Reads need `reviews:read` and `knowledge:read`. Starting an implementation also
|
|
110
|
+
needs `plans:implement`, a personal token and approval of the exact plan version.
|
|
111
|
+
Each call initializes MCP and makes one tool request without retries, including
|
|
112
|
+
questions and implementation starts. Protocol and HTTP errors throw `ProoflineError`;
|
|
113
|
+
tool refusals retain `isError` for the caller to inspect. Cloud trust and connection
|
|
114
|
+
changes remain in signed-in browser onboarding.
|
|
115
|
+
|
|
116
|
+
## Fix context and re-verification
|
|
117
|
+
|
|
118
|
+
`client.fixes` exposes `listOpenFindings(repository, pullRequestNumber)`,
|
|
119
|
+
`getFixContext(findingId)`, `requestReverification(args)` and
|
|
120
|
+
`getReverification(requestId)` over the existing MCP endpoint.
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const result = await client.fixes.requestReverification({
|
|
124
|
+
review_id: reviewId,
|
|
125
|
+
finding_ids: [findingId],
|
|
126
|
+
commit_sha: pushedCommitSha,
|
|
127
|
+
note: "Fixed the null case and added a regression test.",
|
|
128
|
+
});
|
|
129
|
+
if (result.isError) throw new Error("Re-verification was refused.");
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The commit must be the live pushed head; the server confirms it. The request
|
|
133
|
+
accepts 1–20 distinct findings of one review and an optional 1–2,000-character
|
|
134
|
+
note. Reads need `reviews:read`; requesting verification also needs
|
|
135
|
+
`reviews:request` and repository write access. Calls never retry.
|
|
136
|
+
Results retain untrusted-text wrappers, availability, assessment gaps and
|
|
137
|
+
`isError`. `PENDING` and `NOT_VERIFIED` do not establish a fix. A tool request
|
|
138
|
+
never records a human disposition.
|
package/dist/fixes.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type KnowledgeResult, McpTools } from "./mcp.js";
|
|
2
|
+
export interface ReverificationRequest {
|
|
3
|
+
review_id: string;
|
|
4
|
+
finding_ids: string[];
|
|
5
|
+
commit_sha: string;
|
|
6
|
+
note?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Fix context and pushed-head verification. Tool refusals retain isError. */
|
|
9
|
+
export declare class FixesClient extends McpTools {
|
|
10
|
+
listOpenFindings(repository: string, pullRequestNumber: number): Promise<KnowledgeResult>;
|
|
11
|
+
getFixContext(findingId: string): Promise<KnowledgeResult>;
|
|
12
|
+
requestReverification(args: ReverificationRequest): Promise<KnowledgeResult>;
|
|
13
|
+
getReverification(requestId: string): Promise<KnowledgeResult>;
|
|
14
|
+
}
|
package/dist/fixes.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { McpTools } from "./mcp.js";
|
|
2
|
+
/** Fix context and pushed-head verification. Tool refusals retain isError. */
|
|
3
|
+
export class FixesClient extends McpTools {
|
|
4
|
+
listOpenFindings(repository, pullRequestNumber) {
|
|
5
|
+
return this.call("list_open_findings", {
|
|
6
|
+
repository,
|
|
7
|
+
pull_request_number: pullRequestNumber,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
getFixContext(findingId) {
|
|
11
|
+
return this.call("get_fix_context", { finding_id: findingId });
|
|
12
|
+
}
|
|
13
|
+
requestReverification(args) {
|
|
14
|
+
return this.call("request_reverification", args);
|
|
15
|
+
}
|
|
16
|
+
getReverification(requestId) {
|
|
17
|
+
return this.call("get_reverification", { request_id: requestId });
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { FixesClient } from "./fixes.js";
|
|
2
|
+
export type { ReverificationRequest } from "./fixes.js";
|
|
3
|
+
import { KnowledgeClient } from "./knowledge.js";
|
|
4
|
+
export type { KnowledgeResult, RepositoryKnowledge } from "./knowledge.js";
|
|
1
5
|
import { type ExportPage, type ExportParameters } from "./exports.js";
|
|
2
6
|
export type { ExportPage, ExportParameters } from "./exports.js";
|
|
3
7
|
import { type ListReviewsParameters, Operations } from "./operations.js";
|
|
@@ -35,6 +39,8 @@ export interface WaitOptions {
|
|
|
35
39
|
}
|
|
36
40
|
export declare class ProoflineClient extends Operations {
|
|
37
41
|
#private;
|
|
42
|
+
readonly knowledge: KnowledgeClient;
|
|
43
|
+
readonly fixes: FixesClient;
|
|
38
44
|
constructor(options: ClientOptions);
|
|
39
45
|
exportReviews(parameters: ExportParameters): Promise<ExportPage>;
|
|
40
46
|
iterReviews(parameters: ListReviewsParameters, options?: {
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import { FixesClient } from "./fixes.js";
|
|
2
|
+
import { KnowledgeClient } from "./knowledge.js";
|
|
1
3
|
import { decodeExport, } from "./exports.js";
|
|
2
4
|
import { Operations } from "./operations.js";
|
|
3
5
|
import { sleep, Transport } from "./transport.js";
|
|
4
6
|
export { ProoflineError, SecretToken } from "./transport.js";
|
|
5
7
|
export class ProoflineClient extends Operations {
|
|
6
8
|
#transport;
|
|
9
|
+
knowledge;
|
|
10
|
+
fixes;
|
|
7
11
|
constructor(options) {
|
|
8
12
|
const transport = new Transport(options);
|
|
9
13
|
super((method, path, parameters, body) => transport.request(method, path, parameters, undefined, body));
|
|
10
14
|
this.#transport = transport;
|
|
15
|
+
this.knowledge = new KnowledgeClient(transport);
|
|
16
|
+
this.fixes = new FixesClient(transport);
|
|
11
17
|
}
|
|
12
18
|
async exportReviews(parameters) {
|
|
13
19
|
const format = parameters.query.format ?? "ndjson";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type KnowledgeResult, McpTools } from "./mcp.js";
|
|
2
|
+
export type { KnowledgeResult, RepositoryKnowledge } from "./mcp.js";
|
|
3
|
+
import type { RepositoryKnowledge } from "./mcp.js";
|
|
4
|
+
/** Published knowledge operations through the scoped MCP server. */
|
|
5
|
+
export declare class KnowledgeClient extends McpTools {
|
|
6
|
+
listWikiPages(args: RepositoryKnowledge): Promise<KnowledgeResult>;
|
|
7
|
+
getWikiPage(args: RepositoryKnowledge & {
|
|
8
|
+
page_key: string;
|
|
9
|
+
}): Promise<KnowledgeResult>;
|
|
10
|
+
askCodebase(args: RepositoryKnowledge & {
|
|
11
|
+
question: string;
|
|
12
|
+
}): Promise<KnowledgeResult>;
|
|
13
|
+
getArchitectureDocument(environmentId: string): Promise<KnowledgeResult>;
|
|
14
|
+
getPlan(planId: string): Promise<KnowledgeResult>;
|
|
15
|
+
startPlanImplementation(planId: string): Promise<KnowledgeResult>;
|
|
16
|
+
getPlanImplementation(implementationId: string): Promise<KnowledgeResult>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { McpTools } from "./mcp.js";
|
|
2
|
+
/** Published knowledge operations through the scoped MCP server. */
|
|
3
|
+
export class KnowledgeClient extends McpTools {
|
|
4
|
+
listWikiPages(args) {
|
|
5
|
+
return this.call("list_wiki_pages", args);
|
|
6
|
+
}
|
|
7
|
+
getWikiPage(args) {
|
|
8
|
+
return this.call("get_wiki_page", args);
|
|
9
|
+
}
|
|
10
|
+
askCodebase(args) {
|
|
11
|
+
return this.call("ask_codebase", args);
|
|
12
|
+
}
|
|
13
|
+
getArchitectureDocument(environmentId) {
|
|
14
|
+
return this.call("get_architecture_document", {
|
|
15
|
+
environment_id: environmentId,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
getPlan(planId) {
|
|
19
|
+
return this.call("get_plan", { plan_id: planId });
|
|
20
|
+
}
|
|
21
|
+
startPlanImplementation(planId) {
|
|
22
|
+
return this.call("start_plan_implementation", { plan_id: planId });
|
|
23
|
+
}
|
|
24
|
+
getPlanImplementation(implementationId) {
|
|
25
|
+
return this.call("get_plan_implementation", {
|
|
26
|
+
implementation_id: implementationId,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Transport } from "./transport.js";
|
|
2
|
+
/** Strings in tool results remain untrusted; structuredContent is server-owned JSON. */
|
|
3
|
+
export interface KnowledgeResult {
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
structuredContent?: Record<string, unknown>;
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RepositoryKnowledge {
|
|
12
|
+
repository: string;
|
|
13
|
+
commit?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Typed knowledge operations over Proofline's stateless MCP endpoint. Calls never retry. */
|
|
16
|
+
export declare class McpTools {
|
|
17
|
+
private readonly transport;
|
|
18
|
+
constructor(transport: Transport);
|
|
19
|
+
protected call(name: string, args: object): Promise<KnowledgeResult>;
|
|
20
|
+
}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ProoflineError } from "./transport.js";
|
|
2
|
+
const PROTOCOL = "2025-11-25";
|
|
3
|
+
function object(value) {
|
|
4
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function refused() {
|
|
7
|
+
return new ProoflineError(0, "urn:proofline:sdk:mcp", "Invalid or refused MCP response");
|
|
8
|
+
}
|
|
9
|
+
function envelope(value, id) {
|
|
10
|
+
if (!object(value) ||
|
|
11
|
+
value.jsonrpc !== "2.0" ||
|
|
12
|
+
value.id !== id ||
|
|
13
|
+
"error" in value ||
|
|
14
|
+
!object(value.result))
|
|
15
|
+
throw refused();
|
|
16
|
+
return value.result;
|
|
17
|
+
}
|
|
18
|
+
/** Typed knowledge operations over Proofline's stateless MCP endpoint. Calls never retry. */
|
|
19
|
+
export class McpTools {
|
|
20
|
+
transport;
|
|
21
|
+
constructor(transport) {
|
|
22
|
+
this.transport = transport;
|
|
23
|
+
}
|
|
24
|
+
async call(name, args) {
|
|
25
|
+
const invoke = (body, phase) => this.transport.request("POST", "/mcp", {}, undefined, body, (text) => {
|
|
26
|
+
if (phase === "notification") {
|
|
27
|
+
if (text !== "")
|
|
28
|
+
throw refused();
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(text);
|
|
32
|
+
}, "application/json, text/event-stream", phase);
|
|
33
|
+
const initialized = envelope(await invoke({
|
|
34
|
+
jsonrpc: "2.0",
|
|
35
|
+
id: 1,
|
|
36
|
+
method: "initialize",
|
|
37
|
+
params: {
|
|
38
|
+
protocolVersion: PROTOCOL,
|
|
39
|
+
capabilities: {},
|
|
40
|
+
clientInfo: { name: "proofline-typescript", version: "1" },
|
|
41
|
+
},
|
|
42
|
+
}, "initialize"), 1);
|
|
43
|
+
if (initialized.protocolVersion !== PROTOCOL)
|
|
44
|
+
throw refused();
|
|
45
|
+
await invoke({ jsonrpc: "2.0", method: "notifications/initialized" }, "notification");
|
|
46
|
+
const result = envelope(await invoke({
|
|
47
|
+
jsonrpc: "2.0",
|
|
48
|
+
id: 2,
|
|
49
|
+
method: "tools/call",
|
|
50
|
+
params: { name, arguments: args },
|
|
51
|
+
}, "call"), 2);
|
|
52
|
+
if (!Array.isArray(result.content) ||
|
|
53
|
+
result.content.some((item) => !object(item) ||
|
|
54
|
+
item.type !== "text" ||
|
|
55
|
+
typeof item.text !== "string") ||
|
|
56
|
+
(result.isError !== undefined && typeof result.isError !== "boolean") ||
|
|
57
|
+
(result.structuredContent !== undefined &&
|
|
58
|
+
!object(result.structuredContent)))
|
|
59
|
+
throw refused();
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist/operations.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type StartAgentSessionBody = NonNullable<paths["/api/v1/organizations/{or
|
|
|
8
8
|
export type GetFindingFixPromptParameters = paths["/api/v1/organizations/{org_id}/findings/{finding_id}/fix-prompt"]["get"]["parameters"];
|
|
9
9
|
export type RequestCommitReviewParameters = paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/commit-reviews"]["post"]["parameters"];
|
|
10
10
|
export type RequestCommitReviewBody = NonNullable<paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/commit-reviews"]["post"]["requestBody"]>["content"]["application/json"];
|
|
11
|
+
export type UploadCoverageReportsParameters = paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/coverage-reports"]["post"]["parameters"];
|
|
12
|
+
export type UploadCoverageReportsBody = NonNullable<paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/coverage-reports"]["post"]["requestBody"]>["content"]["application/json"];
|
|
11
13
|
export type RequestFileReviewParameters = paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews"]["post"]["parameters"];
|
|
12
14
|
export type RequestFileReviewBody = NonNullable<paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews"]["post"]["requestBody"]>["content"]["application/json"];
|
|
13
15
|
export type RequestPatchReviewParameters = paths["/api/v1/organizations/{org_id}/repositories/{repo_id}/patch-reviews"]["post"]["parameters"];
|
|
@@ -34,6 +36,7 @@ export declare class Operations {
|
|
|
34
36
|
startAgentSession(parameters: StartAgentSessionParameters, body: StartAgentSessionBody): Promise<components["schemas"]["AgentSession"]>;
|
|
35
37
|
getFindingFixPrompt(parameters: GetFindingFixPromptParameters): Promise<components["schemas"]["FindingFixPrompt"]>;
|
|
36
38
|
requestCommitReview(parameters: RequestCommitReviewParameters, body: RequestCommitReviewBody): Promise<components["schemas"]["CommitReviewResponse"]>;
|
|
39
|
+
uploadCoverageReports(parameters: UploadCoverageReportsParameters, body: UploadCoverageReportsBody): Promise<components["schemas"]["CoverageUploadResponse"]>;
|
|
37
40
|
requestFileReview(parameters: RequestFileReviewParameters, body: RequestFileReviewBody): Promise<components["schemas"]["FileReviewResponse"]>;
|
|
38
41
|
requestPatchReview(parameters: RequestPatchReviewParameters, body: RequestPatchReviewBody): Promise<components["schemas"]["PatchReviewResponse"]>;
|
|
39
42
|
requestReview(parameters: RequestReviewParameters, body?: RequestReviewBody): Promise<components["schemas"]["RunNowResponse"]>;
|
package/dist/operations.js
CHANGED
|
@@ -21,6 +21,9 @@ export class Operations {
|
|
|
21
21
|
requestCommitReview(parameters, body) {
|
|
22
22
|
return this.invoke("POST", "/api/v1/organizations/{org_id}/repositories/{repo_id}/commit-reviews", parameters, body);
|
|
23
23
|
}
|
|
24
|
+
uploadCoverageReports(parameters, body) {
|
|
25
|
+
return this.invoke("POST", "/api/v1/organizations/{org_id}/repositories/{repo_id}/coverage-reports", parameters, body);
|
|
26
|
+
}
|
|
24
27
|
requestFileReview(parameters, body) {
|
|
25
28
|
return this.invoke("POST", "/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews", parameters, body);
|
|
26
29
|
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -144,6 +144,26 @@ export interface paths {
|
|
|
144
144
|
patch?: never;
|
|
145
145
|
trace?: never;
|
|
146
146
|
};
|
|
147
|
+
"/api/v1/organizations/{org_id}/repositories/{repo_id}/coverage-reports": {
|
|
148
|
+
parameters: {
|
|
149
|
+
query?: never;
|
|
150
|
+
header?: never;
|
|
151
|
+
path?: never;
|
|
152
|
+
cookie?: never;
|
|
153
|
+
};
|
|
154
|
+
get?: never;
|
|
155
|
+
put?: never;
|
|
156
|
+
/**
|
|
157
|
+
* Upload coverage reports
|
|
158
|
+
* @description Records the LCOV, Cobertura, JaCoCo or Go coverage reports a CI run produced for one exact commit GitHub has in the repository, for COVERAGE checks that accept uploads. A branch, tag or abbreviated SHA, or a report that cannot be read, gets 422 and stores nothing. Requires a repository-restricted token and live GitHub write access; the same reports for the same commit return the report already recorded.
|
|
159
|
+
*/
|
|
160
|
+
post: operations["upload_coverage_reports"];
|
|
161
|
+
delete?: never;
|
|
162
|
+
options?: never;
|
|
163
|
+
head?: never;
|
|
164
|
+
patch?: never;
|
|
165
|
+
trace?: never;
|
|
166
|
+
};
|
|
147
167
|
"/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews": {
|
|
148
168
|
parameters: {
|
|
149
169
|
query?: never;
|
|
@@ -838,6 +858,60 @@ export interface components {
|
|
|
838
858
|
/** @description The evaluation World recorded, which holds every condition. */
|
|
839
859
|
world_evaluation_id: string;
|
|
840
860
|
};
|
|
861
|
+
/**
|
|
862
|
+
* @description An upload refused for its content: a symbolic or unknown commit, or a
|
|
863
|
+
* report that cannot be read. Nothing is stored.
|
|
864
|
+
*/
|
|
865
|
+
CoverageRefused: {
|
|
866
|
+
/** @description One sentence naming what was refused and why. */
|
|
867
|
+
detail: string;
|
|
868
|
+
/**
|
|
869
|
+
* Format: uint16
|
|
870
|
+
* @description Always 422.
|
|
871
|
+
*/
|
|
872
|
+
status: number;
|
|
873
|
+
/** @description Always `unprocessable coverage upload`. */
|
|
874
|
+
title: string;
|
|
875
|
+
};
|
|
876
|
+
/** @description The coverage reports a CI run produced for one commit. */
|
|
877
|
+
CoverageUploadRequest: {
|
|
878
|
+
/**
|
|
879
|
+
* @description One to 50 reports, each LCOV, Cobertura XML, `JaCoCo` XML or a Go
|
|
880
|
+
* cover profile, in a JSON body of at most 64 MiB.
|
|
881
|
+
*/
|
|
882
|
+
reports: components["schemas"]["UploadedReport"][];
|
|
883
|
+
/**
|
|
884
|
+
* @description The full 40-character commit the tests ran on. GitHub must have it in
|
|
885
|
+
* this repository. A merge commit counts for a pull request head that is
|
|
886
|
+
* one of its two parents.
|
|
887
|
+
*/
|
|
888
|
+
tested_sha: string;
|
|
889
|
+
};
|
|
890
|
+
/** @description The report the upload recorded, or the one an identical upload recorded. */
|
|
891
|
+
CoverageUploadResponse: {
|
|
892
|
+
/**
|
|
893
|
+
* Format: uint64
|
|
894
|
+
* @description Covered lines among those instrumented lines.
|
|
895
|
+
*/
|
|
896
|
+
covered_lines: number;
|
|
897
|
+
/** @description False when the same reports for this commit were already recorded. */
|
|
898
|
+
created: boolean;
|
|
899
|
+
/** @description The format of each report, in upload order. */
|
|
900
|
+
formats: string[];
|
|
901
|
+
/**
|
|
902
|
+
* Format: uint64
|
|
903
|
+
* @description Instrumented lines across the reports, a file two reports name under
|
|
904
|
+
* one path counted once.
|
|
905
|
+
*/
|
|
906
|
+
instrumented_lines: number;
|
|
907
|
+
/**
|
|
908
|
+
* Format: uuid
|
|
909
|
+
* @description The recorded report.
|
|
910
|
+
*/
|
|
911
|
+
report_id: string;
|
|
912
|
+
/** @description The commit the reports tested, as the upload named it. */
|
|
913
|
+
tested_sha: string;
|
|
914
|
+
};
|
|
841
915
|
CustomerAssessment: {
|
|
842
916
|
/** @description The deterministic World checks recorded for this assessment. */
|
|
843
917
|
checks: components["schemas"]["CustomerChecks"];
|
|
@@ -3503,6 +3577,15 @@ export interface components {
|
|
|
3503
3577
|
/** @description The text itself. Render it as plain text only. */
|
|
3504
3578
|
untrusted_text: string;
|
|
3505
3579
|
};
|
|
3580
|
+
UploadedReport: {
|
|
3581
|
+
/** @description The report text, exactly as the coverage tool wrote it. */
|
|
3582
|
+
content: string;
|
|
3583
|
+
/**
|
|
3584
|
+
* @description A relative name for the report, such as `web/lcov.info`, unique in
|
|
3585
|
+
* the upload.
|
|
3586
|
+
*/
|
|
3587
|
+
name: string;
|
|
3588
|
+
};
|
|
3506
3589
|
WalkthroughFileView: {
|
|
3507
3590
|
/**
|
|
3508
3591
|
* Format: int64
|
|
@@ -3834,6 +3917,64 @@ export interface operations {
|
|
|
3834
3917
|
};
|
|
3835
3918
|
};
|
|
3836
3919
|
};
|
|
3920
|
+
upload_coverage_reports: {
|
|
3921
|
+
parameters: {
|
|
3922
|
+
query?: never;
|
|
3923
|
+
header?: never;
|
|
3924
|
+
path: {
|
|
3925
|
+
org_id: string;
|
|
3926
|
+
repo_id: string;
|
|
3927
|
+
};
|
|
3928
|
+
cookie?: never;
|
|
3929
|
+
};
|
|
3930
|
+
/** @description The coverage reports a CI run produced for one commit. */
|
|
3931
|
+
requestBody: {
|
|
3932
|
+
content: {
|
|
3933
|
+
"application/json": components["schemas"]["CoverageUploadRequest"];
|
|
3934
|
+
};
|
|
3935
|
+
};
|
|
3936
|
+
responses: {
|
|
3937
|
+
/** @description The report the upload recorded, or the one an identical upload recorded. */
|
|
3938
|
+
200: {
|
|
3939
|
+
headers: {
|
|
3940
|
+
[name: string]: unknown;
|
|
3941
|
+
};
|
|
3942
|
+
content: {
|
|
3943
|
+
"application/json": components["schemas"]["CoverageUploadResponse"];
|
|
3944
|
+
};
|
|
3945
|
+
};
|
|
3946
|
+
/** @description The report the upload recorded, or the one an identical upload recorded. */
|
|
3947
|
+
201: {
|
|
3948
|
+
headers: {
|
|
3949
|
+
[name: string]: unknown;
|
|
3950
|
+
};
|
|
3951
|
+
content: {
|
|
3952
|
+
"application/json": components["schemas"]["CoverageUploadResponse"];
|
|
3953
|
+
};
|
|
3954
|
+
};
|
|
3955
|
+
/**
|
|
3956
|
+
* @description An upload refused for its content: a symbolic or unknown commit, or a
|
|
3957
|
+
* report that cannot be read. Nothing is stored.
|
|
3958
|
+
*/
|
|
3959
|
+
422: {
|
|
3960
|
+
headers: {
|
|
3961
|
+
[name: string]: unknown;
|
|
3962
|
+
};
|
|
3963
|
+
content: {
|
|
3964
|
+
"application/json": components["schemas"]["CoverageRefused"];
|
|
3965
|
+
};
|
|
3966
|
+
};
|
|
3967
|
+
/** @description An RFC 9457 problem; the HTTP status remains authoritative. */
|
|
3968
|
+
default: {
|
|
3969
|
+
headers: {
|
|
3970
|
+
[name: string]: unknown;
|
|
3971
|
+
};
|
|
3972
|
+
content: {
|
|
3973
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
3974
|
+
};
|
|
3975
|
+
};
|
|
3976
|
+
};
|
|
3977
|
+
};
|
|
3837
3978
|
request_file_review: {
|
|
3838
3979
|
parameters: {
|
|
3839
3980
|
query?: never;
|
package/dist/transport.d.ts
CHANGED
|
@@ -33,6 +33,6 @@ export declare class Transport {
|
|
|
33
33
|
#private;
|
|
34
34
|
constructor(options: ClientOptions);
|
|
35
35
|
reviewUrl(orgId: string, reviewId: string): string;
|
|
36
|
-
request<T>(method: string, template: string, parameters: Parameters, deadline?: number, body?: object, decode?: (text: string, headers: Headers) => unknown, accept?: string): Promise<T>;
|
|
36
|
+
request<T>(method: string, template: string, parameters: Parameters, deadline?: number, body?: object, decode?: (text: string, headers: Headers) => unknown, accept?: string, mcpPhase?: "initialize" | "notification" | "call"): Promise<T>;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
package/dist/transport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const VERSION = "1.0.
|
|
1
|
+
const VERSION = "1.0.4";
|
|
2
2
|
const MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
3
3
|
const MAX_RETRIES = 3;
|
|
4
4
|
const MAX_RETRY_SECONDS = 60;
|
|
@@ -188,7 +188,7 @@ export class Transport {
|
|
|
188
188
|
reviewUrl(orgId, reviewId) {
|
|
189
189
|
return new URL(`/orgs/by-id/${coordinate(orgId)}/reviews/${coordinate(reviewId)}`, this.#base).href;
|
|
190
190
|
}
|
|
191
|
-
async request(method, template, parameters, deadline, body, decode = (text) => JSON.parse(text), accept = "application/json, application/problem+json") {
|
|
191
|
+
async request(method, template, parameters, deadline, body, decode = (text) => JSON.parse(text), accept = "application/json, application/problem+json", mcpPhase) {
|
|
192
192
|
const path = Object.entries(parameters.path ?? {}).reduce((value, [key, coordinateValue]) => value.replace(`{${key}}`, coordinate(coordinateValue)), template);
|
|
193
193
|
if (/[{}]/.test(path))
|
|
194
194
|
throw new TypeError("a required path coordinate is missing");
|
|
@@ -198,6 +198,8 @@ export class Transport {
|
|
|
198
198
|
url.searchParams.set(key, String(value));
|
|
199
199
|
}
|
|
200
200
|
const requestBody = body === undefined ? undefined : JSON.stringify(body);
|
|
201
|
+
if (mcpPhase && new TextEncoder().encode(requestBody).length > 8192)
|
|
202
|
+
throw new TypeError("MCP request exceeds 8192 bytes");
|
|
201
203
|
for (let attempt = 0;; attempt += 1) {
|
|
202
204
|
const headers = new Headers({
|
|
203
205
|
Accept: accept,
|
|
@@ -205,6 +207,11 @@ export class Transport {
|
|
|
205
207
|
});
|
|
206
208
|
if (requestBody !== undefined)
|
|
207
209
|
headers.set("Content-Type", "application/json");
|
|
210
|
+
if (mcpPhase) {
|
|
211
|
+
headers.set("Origin", this.#base.origin);
|
|
212
|
+
if (mcpPhase !== "initialize")
|
|
213
|
+
headers.set("MCP-Protocol-Version", "2025-11-25");
|
|
214
|
+
}
|
|
208
215
|
this.#token.apply(headers);
|
|
209
216
|
const now = performance.now();
|
|
210
217
|
const waitRemaining = deadline === undefined ? this.#timeout : deadline - now;
|
|
@@ -230,6 +237,19 @@ export class Transport {
|
|
|
230
237
|
throw new ProoflineError(0, "urn:proofline:sdk:timeout", "the review wait deadline expired");
|
|
231
238
|
throw new ProoflineError(0, "urn:proofline:sdk:transport", "the request did not receive a response within its timeout");
|
|
232
239
|
}
|
|
240
|
+
if (mcpPhase && response.ok) {
|
|
241
|
+
const notification = mcpPhase === "notification";
|
|
242
|
+
if (response.status !== (notification ? 202 : 200) ||
|
|
243
|
+
response.headers.has("mcp-session-id") ||
|
|
244
|
+
(!notification &&
|
|
245
|
+
response.headers.get("content-type")?.split(";")[0]?.trim() !==
|
|
246
|
+
"application/json")) {
|
|
247
|
+
await response.body?.cancel();
|
|
248
|
+
throw new ProoflineError(0, "urn:proofline:sdk:mcp", "Unsupported MCP response");
|
|
249
|
+
}
|
|
250
|
+
if (notification && !response.body)
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
233
253
|
const value = await decoded(response, requestDeadline, signal, waitTimeout, decode);
|
|
234
254
|
if (response.ok)
|
|
235
255
|
return value;
|
package/openapi.public.json
CHANGED
|
@@ -953,6 +953,100 @@
|
|
|
953
953
|
],
|
|
954
954
|
"type": "object"
|
|
955
955
|
},
|
|
956
|
+
"CoverageRefused": {
|
|
957
|
+
"description": "An upload refused for its content: a symbolic or unknown commit, or a\n report that cannot be read. Nothing is stored.",
|
|
958
|
+
"properties": {
|
|
959
|
+
"detail": {
|
|
960
|
+
"description": "One sentence naming what was refused and why.",
|
|
961
|
+
"type": "string"
|
|
962
|
+
},
|
|
963
|
+
"status": {
|
|
964
|
+
"description": "Always 422.",
|
|
965
|
+
"format": "uint16",
|
|
966
|
+
"maximum": 65535,
|
|
967
|
+
"minimum": 0,
|
|
968
|
+
"type": "integer"
|
|
969
|
+
},
|
|
970
|
+
"title": {
|
|
971
|
+
"description": "Always `unprocessable coverage upload`.",
|
|
972
|
+
"type": "string"
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
"required": [
|
|
976
|
+
"title",
|
|
977
|
+
"status",
|
|
978
|
+
"detail"
|
|
979
|
+
],
|
|
980
|
+
"type": "object"
|
|
981
|
+
},
|
|
982
|
+
"CoverageUploadRequest": {
|
|
983
|
+
"additionalProperties": false,
|
|
984
|
+
"description": "The coverage reports a CI run produced for one commit.",
|
|
985
|
+
"properties": {
|
|
986
|
+
"reports": {
|
|
987
|
+
"description": "One to 50 reports, each LCOV, Cobertura XML, `JaCoCo` XML or a Go\n cover profile, in a JSON body of at most 64 MiB.",
|
|
988
|
+
"items": {
|
|
989
|
+
"$ref": "#/components/schemas/UploadedReport"
|
|
990
|
+
},
|
|
991
|
+
"type": "array"
|
|
992
|
+
},
|
|
993
|
+
"tested_sha": {
|
|
994
|
+
"description": "The full 40-character commit the tests ran on. GitHub must have it in\n this repository. A merge commit counts for a pull request head that is\n one of its two parents.",
|
|
995
|
+
"type": "string"
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
"required": [
|
|
999
|
+
"tested_sha",
|
|
1000
|
+
"reports"
|
|
1001
|
+
],
|
|
1002
|
+
"type": "object"
|
|
1003
|
+
},
|
|
1004
|
+
"CoverageUploadResponse": {
|
|
1005
|
+
"description": "The report the upload recorded, or the one an identical upload recorded.",
|
|
1006
|
+
"properties": {
|
|
1007
|
+
"covered_lines": {
|
|
1008
|
+
"description": "Covered lines among those instrumented lines.",
|
|
1009
|
+
"format": "uint64",
|
|
1010
|
+
"minimum": 0,
|
|
1011
|
+
"type": "integer"
|
|
1012
|
+
},
|
|
1013
|
+
"created": {
|
|
1014
|
+
"description": "False when the same reports for this commit were already recorded.",
|
|
1015
|
+
"type": "boolean"
|
|
1016
|
+
},
|
|
1017
|
+
"formats": {
|
|
1018
|
+
"description": "The format of each report, in upload order.",
|
|
1019
|
+
"items": {
|
|
1020
|
+
"type": "string"
|
|
1021
|
+
},
|
|
1022
|
+
"type": "array"
|
|
1023
|
+
},
|
|
1024
|
+
"instrumented_lines": {
|
|
1025
|
+
"description": "Instrumented lines across the reports, a file two reports name under\n one path counted once.",
|
|
1026
|
+
"format": "uint64",
|
|
1027
|
+
"minimum": 0,
|
|
1028
|
+
"type": "integer"
|
|
1029
|
+
},
|
|
1030
|
+
"report_id": {
|
|
1031
|
+
"description": "The recorded report.",
|
|
1032
|
+
"format": "uuid",
|
|
1033
|
+
"type": "string"
|
|
1034
|
+
},
|
|
1035
|
+
"tested_sha": {
|
|
1036
|
+
"description": "The commit the reports tested, as the upload named it.",
|
|
1037
|
+
"type": "string"
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
"required": [
|
|
1041
|
+
"report_id",
|
|
1042
|
+
"tested_sha",
|
|
1043
|
+
"created",
|
|
1044
|
+
"formats",
|
|
1045
|
+
"instrumented_lines",
|
|
1046
|
+
"covered_lines"
|
|
1047
|
+
],
|
|
1048
|
+
"type": "object"
|
|
1049
|
+
},
|
|
956
1050
|
"CustomerAssessment": {
|
|
957
1051
|
"properties": {
|
|
958
1052
|
"checks": {
|
|
@@ -6217,6 +6311,24 @@
|
|
|
6217
6311
|
],
|
|
6218
6312
|
"type": "object"
|
|
6219
6313
|
},
|
|
6314
|
+
"UploadedReport": {
|
|
6315
|
+
"additionalProperties": false,
|
|
6316
|
+
"properties": {
|
|
6317
|
+
"content": {
|
|
6318
|
+
"description": "The report text, exactly as the coverage tool wrote it.",
|
|
6319
|
+
"type": "string"
|
|
6320
|
+
},
|
|
6321
|
+
"name": {
|
|
6322
|
+
"description": "A relative name for the report, such as `web/lcov.info`, unique in\n the upload.",
|
|
6323
|
+
"type": "string"
|
|
6324
|
+
}
|
|
6325
|
+
},
|
|
6326
|
+
"required": [
|
|
6327
|
+
"name",
|
|
6328
|
+
"content"
|
|
6329
|
+
],
|
|
6330
|
+
"type": "object"
|
|
6331
|
+
},
|
|
6220
6332
|
"WalkthroughFileView": {
|
|
6221
6333
|
"properties": {
|
|
6222
6334
|
"additions": {
|
|
@@ -6882,6 +6994,94 @@
|
|
|
6882
6994
|
"x-proofline-token-scope": "reviews:request"
|
|
6883
6995
|
}
|
|
6884
6996
|
},
|
|
6997
|
+
"/api/v1/organizations/{org_id}/repositories/{repo_id}/coverage-reports": {
|
|
6998
|
+
"post": {
|
|
6999
|
+
"description": "Records the LCOV, Cobertura, JaCoCo or Go coverage reports a CI run produced for one exact commit GitHub has in the repository, for COVERAGE checks that accept uploads. A branch, tag or abbreviated SHA, or a report that cannot be read, gets 422 and stores nothing. Requires a repository-restricted token and live GitHub write access; the same reports for the same commit return the report already recorded.",
|
|
7000
|
+
"operationId": "upload_coverage_reports",
|
|
7001
|
+
"parameters": [
|
|
7002
|
+
{
|
|
7003
|
+
"in": "path",
|
|
7004
|
+
"name": "org_id",
|
|
7005
|
+
"required": true,
|
|
7006
|
+
"schema": {
|
|
7007
|
+
"format": "uuid",
|
|
7008
|
+
"type": "string"
|
|
7009
|
+
},
|
|
7010
|
+
"style": "simple"
|
|
7011
|
+
},
|
|
7012
|
+
{
|
|
7013
|
+
"in": "path",
|
|
7014
|
+
"name": "repo_id",
|
|
7015
|
+
"required": true,
|
|
7016
|
+
"schema": {
|
|
7017
|
+
"format": "uuid",
|
|
7018
|
+
"type": "string"
|
|
7019
|
+
},
|
|
7020
|
+
"style": "simple"
|
|
7021
|
+
}
|
|
7022
|
+
],
|
|
7023
|
+
"requestBody": {
|
|
7024
|
+
"content": {
|
|
7025
|
+
"application/json": {
|
|
7026
|
+
"schema": {
|
|
7027
|
+
"$ref": "#/components/schemas/CoverageUploadRequest"
|
|
7028
|
+
}
|
|
7029
|
+
}
|
|
7030
|
+
},
|
|
7031
|
+
"description": "The coverage reports a CI run produced for one commit.",
|
|
7032
|
+
"required": true
|
|
7033
|
+
},
|
|
7034
|
+
"responses": {
|
|
7035
|
+
"200": {
|
|
7036
|
+
"content": {
|
|
7037
|
+
"application/json": {
|
|
7038
|
+
"schema": {
|
|
7039
|
+
"$ref": "#/components/schemas/CoverageUploadResponse"
|
|
7040
|
+
}
|
|
7041
|
+
}
|
|
7042
|
+
},
|
|
7043
|
+
"description": "The report the upload recorded, or the one an identical upload recorded."
|
|
7044
|
+
},
|
|
7045
|
+
"201": {
|
|
7046
|
+
"content": {
|
|
7047
|
+
"application/json": {
|
|
7048
|
+
"schema": {
|
|
7049
|
+
"$ref": "#/components/schemas/CoverageUploadResponse"
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
},
|
|
7053
|
+
"description": "The report the upload recorded, or the one an identical upload recorded."
|
|
7054
|
+
},
|
|
7055
|
+
"422": {
|
|
7056
|
+
"content": {
|
|
7057
|
+
"application/json": {
|
|
7058
|
+
"schema": {
|
|
7059
|
+
"$ref": "#/components/schemas/CoverageRefused"
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
7062
|
+
},
|
|
7063
|
+
"description": "An upload refused for its content: a symbolic or unknown commit, or a\n report that cannot be read. Nothing is stored."
|
|
7064
|
+
},
|
|
7065
|
+
"default": {
|
|
7066
|
+
"content": {
|
|
7067
|
+
"application/problem+json": {
|
|
7068
|
+
"schema": {
|
|
7069
|
+
"$ref": "#/components/schemas/Problem"
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
},
|
|
7073
|
+
"description": "An RFC 9457 problem; the HTTP status remains authoritative."
|
|
7074
|
+
}
|
|
7075
|
+
},
|
|
7076
|
+
"security": [
|
|
7077
|
+
{
|
|
7078
|
+
"bearerAuth": []
|
|
7079
|
+
}
|
|
7080
|
+
],
|
|
7081
|
+
"summary": "Upload coverage reports",
|
|
7082
|
+
"x-proofline-token-scope": "coverage:write"
|
|
7083
|
+
}
|
|
7084
|
+
},
|
|
6885
7085
|
"/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews": {
|
|
6886
7086
|
"post": {
|
|
6887
7087
|
"description": "Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and verifies every path at that commit. The retained selection is immutable; a repeat by the same person returns its review. Results remain in Proofline and are never posted to GitHub.",
|