21 lines
661 B
TypeScript
21 lines
661 B
TypeScript
import { tool } from "@opencode-ai/plugin"
|
|
import { $ } from "bun"
|
|
|
|
export const notificationList = tool({
|
|
description: "List unread notifications including PR reviews, mentions, and other updates",
|
|
args: {
|
|
limit: tool.schema.number().default(30).describe("Number of notifications to return"),
|
|
},
|
|
async execute(args, context) {
|
|
try {
|
|
const result = await $`tea notification list --output json --limit ${args.limit}`.text()
|
|
return JSON.parse(result)
|
|
} catch (error: any) {
|
|
return {
|
|
error: "Failed to list notifications",
|
|
message: error.message,
|
|
stderr: error.stderr?.toString(),
|
|
}
|
|
}
|
|
},
|
|
}) |