- Added priority markers (e.g., "Priority: X of 12") to existing queued TODOs like audit, changelog, profile, scaffold. - Introduced new detailed TODO markdowns for agent integrations: cnotes, git-chglog, gotools, make, pprof, rg, tea. - Enhances planning for grokkit agent tooling ecosystem.
2.7 KiB
2.7 KiB
grokkit agent tea integration
Priority: 5 of 12
Description: Safe, AI-orchestrated wrappers for Gitea tea CLI commands. Enables Grok to manage repos (list/create PRs/issues, comments) as part of agent workflows, with previews and confirmations.
Problem It Solves
Grokkit's agent excels at code edits but lacks repo mgmt. Developers context-switch to browser/CLI for Gitea actions. Integrate tea for seamless: "Review PRs, create issue for bugs, log progress".
Benefits
- Safe execution: Whitelisted commands/args, dry-run previews, confirm destructive ops (merge/push).
- AI reasoning: Grok decides when to call
tea(e.g., "After edits, create PR"). - Logging: All calls logged to
~/.config/grokkit/tools.log. - Repo-aware: Combines with git (
internal/git), code edits. - No new deps: Uses
os/execfortea(assume installed).
Agent Tool Examples
grokkit agent "List open PRs, pick one to work on, create branch"
# Grok: tea pr ls → Analyzes → tea branch create fix-123 → edits files
grokkit agent "Fix lint, create issue if high-risk changes"
# Grok: Runs lint → tea issue create "High-risk refactor"
High-Level Implementation
- Detect tea: Check
exec.Command("tea", "version"). - Tool schemas (Grok tool-calling JSON):
list_prs(state: "open") → stringcreate_pr(title, body, base) → pr_urlcomment_pr(pr_id, body)merge_pr(pr_id)
- Wrapper funcs in
internal/tools/tea.go:func ListPRs(ctx context.Context, args map[string]any) (string, error) - Agent loop (
cmd/agent.go): Parse tool calls → Execute → Feed output back. - Safety:
- Whitelist: pr ls/create/comment/merge, issue create/comment.
- Preview: Print
tea ...+ expected output. - Confirm: User y/n for each.
- Config:
[tools.tea.enabled],[tools.tea.gitea_url].
Flags / Config
| Key | Description |
|---|---|
tools.tea.enabled |
Enable tea tools |
tools.tea.gitea_url |
Override repo URL |
--dry-run |
Simulate tool calls |
Implementation Notes
- Extend agent: Modify plan phase to include tool suggestions.
- Error handling:
internal/errors+ GitError-like TeaError. - Tests: Table-driven
TestTeaToolswith mocks (exec.Commandpatching). - Effort: Medium (~200 LOC). Reuse
grokclient, agent UX. - Prereq: User installs
tea(go install github.com/go-tea/tea/cmd/tea@latest).
ROI
High. Closes workflow gap:
| Stage | Covered |
|---|---|
| Code edit | agent ✓ |
| Repo mgmt | tea tools ← new |
| Logging | cnotes (next) |
Force-multiplies daily PR/issue workflows.