Scaffold Forgejo issue sync plugin

This commit is contained in:
Paperclip Bot 2026-06-02 02:57:49 +00:00
commit 471520e6b3
21 changed files with 1970 additions and 0 deletions

View file

@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import { ATTACHMENT_NOTE } from "../src/constants.js";
import { assessAttachmentReview, buildForgejoSyncContent } from "../src/attachment-policy.js";
import manifest from "../src/manifest.js";
describe("attachment policy", () => {
it("appends the visible attachment note and metadata summary", () => {
const result = buildForgejoSyncContent("Bug report body", [
{
filename: "screenshot.png",
mimeType: "image/png",
sizeBytes: 2048,
sourceUrl: "https://forgejo.example/files/1",
sourceId: "1"
}
]);
expect(result.markdown).toContain(ATTACHMENT_NOTE);
expect(result.markdown).toContain("screenshot.png | image/png | 2.0 KiB");
expect(result.reviewSignal.reasonCode).toBe("attachment_metadata_present");
});
it("marks payloads for manual review when the text depends on attachments", () => {
const review = assessAttachmentReview("See attached screenshot for the only repro details.", [
{
filename: "repro.png",
mimeType: "image/png",
sizeBytes: 1024,
sourceUrl: null,
sourceId: "abc"
}
]);
expect(review.manualReviewRequired).toBe(true);
expect(review.reasonCode).toBe("attachments_context_required");
});
it("keeps managed resources out of the manifest", () => {
expect(manifest).not.toHaveProperty("agents");
expect(manifest).not.toHaveProperty("skills");
expect(manifest).not.toHaveProperty("routines");
expect(manifest.capabilities).not.toContain("agents.managed");
expect(manifest.capabilities).not.toContain("skills.managed");
});
});