Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/migrate-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pungrumpy/cursor-action": major
---

Migrate to the official `@cursor/sdk` and update action execution type to composite.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ env "INPUT_API-KEY=$CURSOR_API_KEY" \
"INPUT_MODEL=auto" \
"INPUT_PERMISSIONS=read-only" \
"INPUT_TIMEOUT=60" \
node dist/index.js
node dist/index.mjs
```

## CI and release notes
Expand Down
38 changes: 0 additions & 38 deletions __tests__/cursor-version.test.ts

This file was deleted.

34 changes: 16 additions & 18 deletions __tests__/input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,31 @@ describe("getInputs", () => {
expect(inputs.timeout).toBe(300);
});

it("accepts a pinned semver version", () => {
it("warns if cursor-version is provided and not latest", () => {
setupInputs({ "cursor-version": "1.2.3" });
const inputs = getInputs();
expect(inputs.cursorVersion).toBe("1.2.3");
expect(mockWarning).toHaveBeenCalledWith(
expect.stringContaining("deprecated")
);
});

it("accepts a pinned semver version with v prefix", () => {
setupInputs({ "cursor-version": "v1.2.3" });
const inputs = getInputs();
expect(inputs.cursorVersion).toBe("v1.2.3");
});

it("accepts a pinned Cursor lab build id", () => {
setupInputs({ "cursor-version": "2026.03.20-44cb435" });
it("treats empty cursor-version as omitted (undefined), matching optional typing", () => {
setupInputs({ "cursor-version": "" });
const inputs = getInputs();
expect(inputs.cursorVersion).toBe("2026.03.20-44cb435");
expect(inputs.cursorVersion).toBeUndefined();
expect(mockWarning).not.toHaveBeenCalledWith(
expect.stringContaining("deprecated")
);
});

it("accepts a pinned lab build id with v prefix", () => {
setupInputs({ "cursor-version": "v2026.03.20-44cb435" });
it("trims cursor-version whitespace", () => {
setupInputs({ "cursor-version": " 1.0.0 " });
const inputs = getInputs();
expect(inputs.cursorVersion).toBe("v2026.03.20-44cb435");
expect(inputs.cursorVersion).toBe("1.0.0");
expect(mockWarning).toHaveBeenCalledWith(
expect.stringContaining("deprecated")
);
});

it("throws on invalid permission value", () => {
Expand All @@ -87,11 +90,6 @@ describe("getInputs", () => {
expect(() => getInputs()).toThrow(/cannot be empty/);
});

it("throws on invalid version format", () => {
setupInputs({ "cursor-version": "not-a-version" });
expect(() => getInputs()).toThrow(/Invalid 'cursor-version'/);
});

it("warns on very long timeout", () => {
setupInputs({ timeout: "7200" });
getInputs();
Expand Down
85 changes: 0 additions & 85 deletions __tests__/installer.test.ts

This file was deleted.

21 changes: 9 additions & 12 deletions __tests__/output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ describe("setOutputs", () => {
stderr: "",
stdout: "Here is my analysis.",
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);

expect(mockSetOutput).toHaveBeenCalledWith(
"summary",
"Here is my analysis."
);
expect(mockSetOutput).toHaveBeenCalledWith("exit-code", "0");
expect(mockSetOutput).toHaveBeenCalledWith("cache-hit", "false");
expect(outputs.summary).toBe("Here is my analysis.");
expect(outputs.exitCode).toBe(0);
expect(outputs.cacheHit).toBe(false);
expect(mockSummaryChain.write).toHaveBeenCalled();
});

Expand All @@ -56,9 +54,8 @@ describe("setOutputs", () => {
stderr: "",
stdout: JSON.stringify({ response: "JSON response text" }),
};
const outputs = await setOutputs(result, true);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("JSON response text");
expect(outputs.cacheHit).toBe(true);
});

it("extracts summary from JSON summary field", async () => {
Expand All @@ -67,7 +64,7 @@ describe("setOutputs", () => {
stderr: "",
stdout: JSON.stringify({ summary: "Summary field text" }),
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("Summary field text");
});

Expand All @@ -77,7 +74,7 @@ describe("setOutputs", () => {
stderr: "",
stdout: JSON.stringify({ result: "Result field text" }),
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("Result field text");
});

Expand All @@ -87,7 +84,7 @@ describe("setOutputs", () => {
stderr: "",
stdout: JSON.stringify({ output: "Output field text" }),
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("Output field text");
});

Expand All @@ -97,13 +94,13 @@ describe("setOutputs", () => {
stderr: "",
stdout: JSON.stringify({ text: "Text field value" }),
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("Text field value");
});

it("handles empty stdout gracefully", async () => {
const result = { exitCode: 0, stderr: "", stdout: "" };
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("");
});

Expand All @@ -113,7 +110,7 @@ describe("setOutputs", () => {
stderr: "",
stdout: "\u001B[32mGreen text\u001B[0m",
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.summary).toBe("Green text");
});

Expand All @@ -123,7 +120,7 @@ describe("setOutputs", () => {
stderr: "something failed",
stdout: "error output",
};
const outputs = await setOutputs(result, false);
const outputs = await setOutputs(result);
expect(outputs.exitCode).toBe(1);
expect(mockSetOutput).toHaveBeenCalledWith("exit-code", "1");
});
Expand Down
Loading