feat: add tea-context.ts tool for context helpers (whoami)

This commit is contained in:
2026-05-03 16:35:46 +02:00
parent 622f791149
commit 3f49ef4589

View File

@@ -0,0 +1,19 @@
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 JSON.parse(result)
} catch (error: any) {
return {
error: "Failed to get current user info",
message: error.message,
stderr: error.stderr?.toString(),
}
}
},
})