grokkit/todo/queued/gotools.md
Greg Gauthier 95ce892fa4
All checks were successful
CI / Test (push) Successful in 34s
CI / Lint (push) Successful in 39s
CI / Build (push) Successful in 21s
docs(todo): update queued task priorities and add README
Adjusted priorities for features including audit, changelog, gotools, interactive-agent, and rg.
Added todo/README.md as a table of contents listing all queued and completed tasks.
2026-03-03 21:00:03 +00:00

1.6 KiB

grokkit agent Go tools integration

Priority: 4 of 12

Description: Wrappers for go subcommands: mod tidy, generate, vet, fmt. Ensures hygiene post-agent edits.

Problem It Solves

Agent changes may break deps/fmt/vet—manual fixes. Auto-run + fix loops.

Benefits

  • Hygiene auto: Tidy deps, fmt code, vet issues.
  • Generate: Run go:generate for boilerplate.
  • Safe mutations: Preview changes (git diff).
  • Workflow: Edit → gotools tidy → test.

Agent Tool Examples

grokkit agent "Add new import, tidy mods, vet all"
# Grok: edits → go mod tidy → go vet → reports clean

High-Level Implementation

  1. Detect: go version.
  2. Tool schemas:
    • tidy() → changes
    • vet(path?) → issues
    • generate() → output
    • fmt_diff() → diff
  3. Wrappers in internal/tools/gotools.go:
    func Tidy(ctx context.Context, args map[string]any) (string, error)
    
  4. Agent integration: Post-edit hygiene step.
  5. Safety:
    • Dry-run where possible (go fmt -d).
    • Whitelist subcmds.
    • Config: [tools.gotools.enabled].

Flags / Config

Key Description
tools.gotools.enabled Enable Go tools

Implementation Notes

  • Commands: go mod tidy, go vet ./..., go generate ./....
  • Parsing: Diff output, error lists.
  • Errors: GoToolError.
  • Tests: Mock, table-driven.
  • Effort: Low (~130 LOC).
  • Prereq: Go workspace.

ROI

High. Go-specific polish:

Stage Covered
Hygiene gotools ← new
Search rg (sibling)
Build make (sibling)