19 lines
494 B
TypeScript
19 lines
494 B
TypeScript
import { tool } from "@opencode-ai/plugin"
|
|
import { $ } from "bun"
|
|
|
|
export const whoami = tool({
|
|
description: "Get current logged-in user info for the Gitea instance",
|
|
args: {},
|
|
async execute(args, context) {
|
|
try {
|
|
const result = await $`tea whoami --output json`.text()
|
|
return result
|
|
} catch (error: any) {
|
|
return {
|
|
error: "Failed to get current user info",
|
|
message: error.message,
|
|
stderr: error.stderr?.toString(),
|
|
}
|
|
}
|
|
},
|
|
}) |