Skip to content

Commit b688502

Browse files
authored
Add make agent-finished task for pre-completion verification (#48)
1 parent 7b4c6c1 commit b688502

2 files changed

Lines changed: 55 additions & 11 deletions

File tree

AGENTS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Quick reference for AI agents working with MCP Gateway (Go-based MCP proxy serve
1111
**Coverage**: `make coverage` (tests with coverage report)
1212
**Format**: `make format` (auto-format code with gofmt)
1313
**Clean**: `make clean` (remove build artifacts)
14+
**Agent-Finished**: `make agent-finished` (run format, build, lint, test - ALWAYS run before completion)
1415
**Run**: `./awmg --config config.toml`
1516

1617
## Project Structure
@@ -63,6 +64,34 @@ args = ["run", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "-i", "ghcr.io/gith
6364
**Add Guard**: Implement in `internal/guard/` and register
6465
**Add Test**: Create `*_test.go` with Go testing package
6566

67+
## Agent Completion Checklist
68+
69+
**CRITICAL: Before returning to the user, ALWAYS run `make agent-finished`**
70+
71+
This command runs the complete verification pipeline:
72+
1. **Format** - Auto-formats all Go code with gofmt
73+
2. **Build** - Ensures the project compiles successfully
74+
3. **Lint** - Runs go vet and gofmt checks
75+
4. **Test** - Executes the full test suite
76+
77+
**Requirements:**
78+
- **ALL failures must be fixed** before completion
79+
- If `make agent-finished` fails at any stage, debug and fix the issue
80+
- Re-run `make agent-finished` after fixes to verify success
81+
- Only report completion to the user after seeing "✓ All agent-finished checks passed!"
82+
83+
**Example workflow:**
84+
```bash
85+
# Make your code changes
86+
# ...
87+
88+
# Run verification before completion
89+
make agent-finished
90+
91+
# If any step fails, fix the issues and run again
92+
# Only complete the task after all checks pass
93+
```
94+
6695
## Debug Logging
6796

6897
**ALWAYS use the logger package for debug logging:**

Makefile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build lint test coverage test-ci format clean install release help
1+
.PHONY: build lint test coverage test-ci format clean install release help agent-finished
22

33
# Default target
44
.DEFAULT_GOAL := help
@@ -29,6 +29,20 @@ test:
2929
@echo "Running tests..."
3030
@go test -v ./...
3131

32+
# Run format, build, lint, and test (for agents before completion)
33+
agent-finished:
34+
@echo "Running agent-finished checks..."
35+
@echo ""
36+
@$(MAKE) format
37+
@echo ""
38+
@$(MAKE) build
39+
@echo ""
40+
@$(MAKE) lint
41+
@echo ""
42+
@$(MAKE) test
43+
@echo ""
44+
@echo "✓ All agent-finished checks passed!"
45+
3246
# Run tests with coverage
3347
coverage:
3448
@echo "Running tests with coverage..."
@@ -168,13 +182,14 @@ install:
168182
# Display help information
169183
help:
170184
@echo "Available targets:"
171-
@echo " build - Build the CLI binary"
172-
@echo " lint - Run all linters (go vet, gofmt check)"
173-
@echo " test - Run all tests"
174-
@echo " coverage - Run tests with coverage report"
175-
@echo " test-ci - Run tests with coverage and JSON output for CI"
176-
@echo " format - Format Go code using gofmt"
177-
@echo " clean - Clean build artifacts"
178-
@echo " install - Install required toolchains and dependencies"
179-
@echo " release - Create and push a release tag (usage: make release patch|minor|major)"
180-
@echo " help - Display this help message"
185+
@echo " build - Build the CLI binary"
186+
@echo " lint - Run all linters (go vet, gofmt check)"
187+
@echo " test - Run all tests"
188+
@echo " coverage - Run tests with coverage report"
189+
@echo " test-ci - Run tests with coverage and JSON output for CI"
190+
@echo " format - Format Go code using gofmt"
191+
@echo " clean - Clean build artifacts"
192+
@echo " install - Install required toolchains and dependencies"
193+
@echo " release - Create and push a release tag (usage: make release patch|minor|major)"
194+
@echo " agent-finished - Run format, build, lint, and test (for agents before completion)"
195+
@echo " help - Display this help message"

0 commit comments

Comments
 (0)