feat(mcp): scaffold tool, config/env conventions, and scaffold-hygiene rules
Major release to v1.0.0, aligned with the v1.0.0 framework. The MCP documented the wiring conventions but not the config half of a project, and its example main.go omitted the godotenv autoload — so an assistant starting a service from zero still hand-rolled main.go and the launcher, and got config wrong. This adds a first-class scaffold, completes the config/.env.example conventions, and adds rules that catch the "mess in main" pattern. internal/tools: - New get_scaffold: returns the canonical minimum application scaffold as ready-to-write files (main.go with godotenv autoload + wire.Run(), wire.go, a composed config.go, a health hook, .env.example), with import paths filled from a `module` argument. Registered in tools.go. internal/rules: - Three new validate_snippet rules, appended in scaffold_rules.go: main.dirty (launcher/components built in main instead of internal/wire), main.no-godotenv-autoload (a wire-convention main that never loads .env), and config.raw-getenv (an EINHERJAR_* var read via os.Getenv instead of composing the component Config; EINHERJAR_LOG_* stays with logz.direct-env-read). - scaffold_rules_test.go — internal/rules had no tests; asserts each new rule fires and that a clean main is not flagged. internal/index (builtins): - The synthetic wire module gains a Config section (compose the framework's component configs, load with caarlos0/env, APP_* app fields / EINHERJAR_* framework fields) and a Config & .env.example discipline (every env var the config reads is documented in .env.example, kept in lock-step). - main.go now shows the `_ "github.com/joho/godotenv/autoload"` blank import, previously omitted. The assembly file is renamed launcher.go -> wire.go. - Migrations and seeding removed from the documented scaffold — developer choices, not framework conventions. Re-synced against iron-dough-api / pei-api. Version: - Badge and serverVersion const were stale at v0.1.0; both now v1.0.0. Docs: - README (eleven tools, eleven validation rules) and CHANGELOG updated. No new dependencies. The wire conventions are embedded at build time (//go:embed builtins/README.md) and the new tool and rules are compiled in, so a deployment must be rebuilt to serve them; a server still running the v0.2.0 binary keeps serving the old conventions until redeployed.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# einherjar/mcp
|
||||
|
||||
[](https://code.nochebuena.dev/einherjar/mcp)
|
||||
[](https://code.nochebuena.dev/einherjar/mcp)
|
||||
[](LICENSE)
|
||||
[](https://go.dev)
|
||||
|
||||
@@ -38,7 +38,7 @@ under pressure.
|
||||
|
||||
## Tools
|
||||
|
||||
The server exposes **ten** tools to MCP-aware clients (Claude desktop, Claude Code,
|
||||
The server exposes **eleven** tools to MCP-aware clients (Claude desktop, Claude Code,
|
||||
Cursor, Zed, and anything else that speaks MCP):
|
||||
|
||||
| Tool | Purpose |
|
||||
@@ -50,14 +50,16 @@ Cursor, Zed, and anything else that speaks MCP):
|
||||
| `list_adrs` | List architectural decision records, optionally restricted to one module |
|
||||
| `get_adr` | Fetch a single ADR's markdown body |
|
||||
| `get_example` | Canonical usage snippet — pulled from module READMEs and from the synthetic `wire` conventions |
|
||||
| `get_scaffold` | The canonical **minimum application scaffold** as ready-to-write files — a clean `main.go`, `internal/wire/wire.go`, a composed `internal/config`, a health hook, and `.env.example`. Use it when starting a new Einherjar service |
|
||||
| `get_compliance` | Interface assertions and structural test names from a module's `compliance_test.go` |
|
||||
| `get_changelog` | Full `CHANGELOG.md` markdown for one module |
|
||||
| `validate_snippet` | Pattern-match a Go snippet against framework conventions; returns findings with severity, hint, and line |
|
||||
|
||||
`validate_snippet` ships **eight** wiring-convention rules at v0.1.0:
|
||||
`validate_snippet` ships **eleven** wiring-convention rules at v1.0.0:
|
||||
`launcher.missing-run`, `launcher.no-components`, `launcher.run-error-discarded`,
|
||||
`logz.direct-env-read`, `web.server-not-appended`, `wire.hook-bad-signature`,
|
||||
`wire.hook-outside-beforestart`, and `wire.route-specific-after-param`.
|
||||
`wire.hook-outside-beforestart`, `wire.route-specific-after-param`,
|
||||
`main.dirty`, `main.no-godotenv-autoload`, and `config.raw-getenv`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user