@skyramp/mcp 0.1.3 → 0.1.5
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.
|
@@ -120,8 +120,9 @@ export function registerSubmitReportTool(server) {
|
|
|
120
120
|
.string()
|
|
121
121
|
.optional()
|
|
122
122
|
.default(DEFAULT_COMMIT_MESSAGE)
|
|
123
|
-
.describe("Succinct commit message (under 72 chars) summarizing what
|
|
124
|
-
"e.g. 'add contract tests for /products endpoint' or 'update smoke tests for order API changes'"
|
|
123
|
+
.describe("Succinct commit message (if possible, under 72 chars) summarizing what Testbot did, " +
|
|
124
|
+
"e.g. 'add contract tests for /products endpoint' or 'update smoke tests for order API changes'. " +
|
|
125
|
+
"Used as both the git commit subject and the side PR title — the consumer applies truncation as needed."),
|
|
125
126
|
},
|
|
126
127
|
_meta: {
|
|
127
128
|
keywords: ["report", "summary", "testbot", "submit"],
|
|
@@ -161,7 +162,7 @@ export function registerSubmitReportTool(server) {
|
|
|
161
162
|
testResults: params.testResults,
|
|
162
163
|
issuesFound: params.issuesFound,
|
|
163
164
|
nextSteps: params.nextSteps ?? [],
|
|
164
|
-
commitMessage: (params.commitMessage ?? "").replace(/[\r\n]+/g, " ").trim()
|
|
165
|
+
commitMessage: (params.commitMessage ?? "").replace(/[\r\n]+/g, " ").trim() || DEFAULT_COMMIT_MESSAGE,
|
|
165
166
|
}, null, 2);
|
|
166
167
|
logger.info("Submitting testbot report", {
|
|
167
168
|
outputFile: params.summaryOutputFile,
|
|
@@ -128,7 +128,7 @@ describe("registerSubmitReportTool", () => {
|
|
|
128
128
|
const written = JSON.parse(await fs.readFile(outputFile, "utf-8"));
|
|
129
129
|
expect(written.commitMessage).toBe("Added recommendations by Skyramp Testbot.");
|
|
130
130
|
});
|
|
131
|
-
it("should sanitize commitMessage (newlines,
|
|
131
|
+
it("should sanitize commitMessage (collapse newlines, trim whitespace)", async () => {
|
|
132
132
|
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "submit-report-test-"));
|
|
133
133
|
tmpDirs.push(tmpDir);
|
|
134
134
|
const outputFile = path.join(tmpDir, "report.json");
|
|
@@ -139,7 +139,21 @@ describe("registerSubmitReportTool", () => {
|
|
|
139
139
|
expect(result.isError).toBeUndefined();
|
|
140
140
|
const written = JSON.parse(await fs.readFile(outputFile, "utf-8"));
|
|
141
141
|
expect(written.commitMessage).toBe("line one line two line three");
|
|
142
|
-
|
|
142
|
+
// No length cap — truncation is the consumer's responsibility (SKYR-3757).
|
|
143
|
+
});
|
|
144
|
+
it("should preserve commitMessage longer than 72 chars without truncation", async () => {
|
|
145
|
+
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "submit-report-test-"));
|
|
146
|
+
tmpDirs.push(tmpDir);
|
|
147
|
+
const outputFile = path.join(tmpDir, "report.json");
|
|
148
|
+
const longMessage = "add contract and integration tests for the new PATCH /orders/{order_id} endpoint including discount recalculation and line-item edits";
|
|
149
|
+
const result = await handler({
|
|
150
|
+
...sampleReportParams(outputFile),
|
|
151
|
+
commitMessage: longMessage,
|
|
152
|
+
});
|
|
153
|
+
expect(result.isError).toBeUndefined();
|
|
154
|
+
const written = JSON.parse(await fs.readFile(outputFile, "utf-8"));
|
|
155
|
+
expect(written.commitMessage).toBe(longMessage);
|
|
156
|
+
expect(written.commitMessage.length).toBeGreaterThan(72);
|
|
143
157
|
});
|
|
144
158
|
it("should use default commitMessage when provided as empty string", async () => {
|
|
145
159
|
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "submit-report-test-"));
|