feat(mcp): scaffold tool, config/env conventions, and scaffold-hygiene rules (#2)
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. Reviewed-on: #2 Co-authored-by: Rene Nochebuena Guerrero <rene@nochebuena.dev> Co-committed-by: Rene Nochebuena Guerrero <rene@nochebuena.dev>
This commit was merged in pull request #2.
This commit is contained in:
@@ -6,6 +6,44 @@ This module adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html
|
||||
|
||||
---
|
||||
|
||||
## [1.0.0] — 2026-08-07
|
||||
|
||||
The MCP reaches **v1.0.0**, aligned with the v1.0.0 framework. The headline is the
|
||||
canonical application **scaffold**: the one opinionated starting point so an AI no longer
|
||||
hand-rolls `main.go` and the launcher when creating a service from zero.
|
||||
|
||||
### Added
|
||||
|
||||
- **`get_scaffold` tool.** Returns the canonical minimum application scaffold as
|
||||
ready-to-write files, with import paths filled from a `module` argument: a clean `main.go`
|
||||
(godotenv autoload + `wire.Run()`), `internal/wire/wire.go` (the launcher assembly), a
|
||||
composed `internal/config/config.go`, a health feature hook, and `.env.example`.
|
||||
- **Three `validate_snippet` rules** (now eleven total), with a rules test suite:
|
||||
`main.dirty` (the 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` (reading a framework `EINHERJAR_*` var via `os.Getenv` instead of
|
||||
composing the component's `Config` type).
|
||||
- **Config conventions in the `wire` builtin.** A `Config` section (compose the framework's
|
||||
component configs, load with `caarlos0/env`, `APP_*` for app-owned fields, `EINHERJAR_*`
|
||||
for framework ones) and a **Config & .env.example** section: every env var the config
|
||||
reads must also be documented in `.env.example`, kept in lock-step.
|
||||
|
||||
### Changed
|
||||
|
||||
- **`wire` builtin re-synced to the current gold standards** (`iron-dough-api`, `pei-api`):
|
||||
`main.go` now shows the `_ "github.com/joho/godotenv/autoload"` blank import (previously
|
||||
omitted, so the AI produced a `main` that never loaded `.env`); the assembly file is
|
||||
`wire.go` (was `launcher.go`).
|
||||
- **Version alignment.** The README badge and `serverVersion` were stale at `v0.1.0`; both
|
||||
now read `v1.0.0`.
|
||||
|
||||
### Removed
|
||||
|
||||
- **Migrations and seeding from the `wire` builtin.** How migrations run and how the first
|
||||
admin is seeded (via code, a DB team, an endpoint, a webhook, …) is the developer's
|
||||
choice — it belongs to no Einherjar module and is not a hard convention, so it is out of
|
||||
the scaffold and the documented conventions.
|
||||
|
||||
## [0.2.0] — 2026-06-10
|
||||
|
||||
Minor release. The indexer now captures the *members* of composite types, closing a gap where `get_symbol` and `search_symbols` could name a struct or interface but not describe its shape — most painfully, struct tags (env-var keys, json names) were invisible.
|
||||
|
||||
Reference in New Issue
Block a user