Imported from qiaopengjun5162/gogen (
AGENTS.md). Install upstream withnpx skills add qiaopengjun5162/gogen. Copyright stays with the author.
AGENTS.md
Project Shape
gogenis a Go CLI for generating projects from Git repositories or local template directories.- The root package is the only implementation. Do not reintroduce duplicate split packages for the same CLI logic.
main.goshould stay as the thin entrypoint. Keep parsing, prompting, generation, processors, file operations, and logging in their existing module files.
Commands
- Format:
gofmt -w *.go - Check:
just check - Test:
GOCACHE=/private/tmp/gogen-go-cache GOMODCACHE=/private/tmp/gogen-go-mod-cache go test ./... - Build:
GOCACHE=/private/tmp/gogen-go-cache GOMODCACHE=/private/tmp/gogen-go-mod-cache go build ./... - Release-style build:
go build -v -ldflags "-X main.GitCommit=$(git rev-parse --short HEAD)" -o gogen .
Production Standard
- Treat
gogenas a production CLI, not a demo or throwaway scaffold. - Every behavior change must have tests or a recorded reason why automated coverage is not practical.
- Review changes for correctness, error handling, test coverage, documentation drift, and build/release impact before committing.
- Any user-facing flag, output, error message, build command, release workflow, or template-processing behavior must be reflected in
README.md,README.zh.md,DEVLOG.md, andPRODUCTION.mdwhen relevant. - Prefer small, complete changes that can be formatted, tested, committed, and pushed in the same session.
- Do not leave known broken workflows undocumented. If a local tool is missing, record the exact blocker and the manual verification used instead.
- Before commit, run the production gate in
PRODUCTION.mdor record which parts could not run and why.
Implementation Notes
- Build the package with
go build ., notgo build ./main.go; the CLI is now modular. justfileis the canonical developer task entrypoint; keepMakefileas a thin compatibility wrapper only.justfileintentionally unsetsGOROOTfor Go commands so stale GVM settings cannot mismatch the active Go binary.--localmust preserve the provided template path inConfig.TemplateSrc.--namesetsConfig.ProjectName;--yesand-yskip confirmation prompts.--var key=valuecan be repeated for custom template variables;project_nameis reserved.--versionmust not require--gitor--local.- Local template copying intentionally skips
.gitdirectories. - Template variable replacement intentionally skips
.gitdirectories and binary files. - PR CI jobs must not reference tag-only container actions; GitHub can prepare container actions before evaluating step-level conditions.
- Pushing a
v*tag triggers.github/workflows/build.ymlrelease jobs. Existing GitHub Release assets are overwritten bysoftprops/action-gh-release@v2; release notes come fromCHANGELOG.md. - Keep tests focused on CLI behavior and filesystem effects before adding new features.
Change Recording
- Update
DEVLOG.mdwhenever code, documentation, configuration, build scripts, or release workflow files change. - Each record should include the concrete files or areas changed, validation commands, problems encountered, and how they were resolved.
- If a commit uses
--no-verify, record the exact hook blocker and the checks that were run manually.