grokkit/todo/queued/make.md
Greg Gauthier b884f32758
All checks were successful
CI / Test (push) Successful in 33s
CI / Lint (push) Successful in 25s
CI / Build (push) Successful in 19s
chore(todo): add priorities to queued items and new tool integration plans
- 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.
2026-03-02 23:42:06 +00:00

2.2 KiB

grokkit agent make integration

Priority: 2 of 12

Description: Wrappers for Makefile targets (test/lint/build/cover). Enables Grok to run/verify builds mid-agent workflow (e.g., "edit, test, fix loops").

Problem It Solves

Agent edits code but can't auto-verify compilation/tests—manual make test context-switch.

Benefits

  • Automated verification: Post-edit make test + analyze failures.
  • Dry-runs: Preview make build output.
  • Safe: Whitelisted targets, timeout, project-dir.
  • Parse results: Extract pass/fail, coverage, errors for next agent step.
  • Workflow: "Refactor → test → fix → commit".

Agent Tool Examples

grokkit agent "Fix lint errors in cmd/, run make lint to verify, then test"
# Grok: edits → make lint → "All green!" → make test → fixes failures
grokkit agent "Benchmark changes before commit"
# Grok: make test-cover → "Coverage drop 2%" → optimizations

High-Level Implementation

  1. Detect: test -f Makefile or make --version.
  2. Tool schemas:
    • run_target(target: string) → {output: string, success: bool}
    • dry_run(target: string) → simulated_output
  3. Wrappers in internal/tools/make.go:
    func RunTarget(ctx context.Context, args map[string]any) (string, error)
    
  4. Agent integration: Tool call → parse stdout → feed to Grok ("Tests failed: fix?").
  5. Safety:
    • Whitelist: test, lint, build, test-cover, install.
    • 300s timeout.
    • No sudo/privileged.
    • Config: [tools.make.enabled].
  6. Parsing: Grep for "PASS/FAIL", coverage %.

Flags / Config

Key Description
tools.make.enabled Enable make tools
tools.make.timeout Per-target timeout (s)

Implementation Notes

  • Commands: make TARGET (no args).
  • Extend agent: Loop includes make calls post-edit.
  • Errors: MakeError with output.
  • Tests: Mock exec, table-driven (success/fail outputs).
  • Effort: Low (~120 LOC). Std exec + parsing.
  • Prereq: Makefile present.

ROI

High. Agent verification loop:

Stage Covered
Edit agent
Verify make ← new
Repo/log tea/cnotes

Instant feedback elevates agent reliability.