feat: add tea-context.ts tool for context helpers (whoami)
This commit is contained in:
19
.opencode/tools/tea-context.ts
Normal file
19
.opencode/tools/tea-context.ts
Normal 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(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user