repo-audit-tool 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +67 -0
- package/AUDIT.md +802 -0
- package/BEST-PRACTICES.md +268 -0
- package/CLAUDE.md +1 -0
- package/CONTRIBUTING.md +42 -0
- package/DEVELOPMENT.md +112 -0
- package/HANDOFF.md +124 -0
- package/LICENSE +21 -0
- package/PUBLISHING.md +66 -0
- package/README.en.md +71 -0
- package/README.md +71 -0
- package/REPO-AUDIT.md +107 -0
- package/REPO-CLASSIFICATION.md +137 -0
- package/SECURITY.md +19 -0
- package/docs/repo-audit/AGENT-GUIDE.md +474 -0
- package/docs/repo-audit/HUMAN-GUIDE.md +749 -0
- package/package.json +36 -0
- package/repo-audit.mjs +1507 -0
- package/rules/categories/archive.yaml +48 -0
- package/rules/categories/content.yaml +34 -0
- package/rules/categories/dsh-plugin.yaml +79 -0
- package/rules/categories/go-service.yaml +67 -0
- package/rules/categories/product-oss.yaml +75 -0
- package/rules/categories/python-app.yaml +60 -0
- package/rules/categories/sandbox.yaml +33 -0
- package/rules/domains/docs.yaml +105 -0
- package/rules/domains/git.yaml +52 -0
- package/rules/domains/quality.yaml +69 -0
- package/rules/domains/security.yaml +79 -0
- package/shim/repo-audit.cmd +7 -0
- package/shim/repo-audit.ps1 +4 -0
- package/shim/repo-audit.sh +5 -0
- package/templates/AGENT-GUIDE.md +331 -0
- package/templates/README.md +192 -0
- package/templates/UPDATE-MODEL.md +141 -0
- package/templates/UPDATE-PLAN.md +79 -0
- package/templates/categories/content/AGENTS-append.md +6 -0
- package/templates/categories/content/CATEGORY.md +26 -0
- package/templates/categories/content/README.en.md +12 -0
- package/templates/categories/content/README.md +14 -0
- package/templates/categories/content/gitignore-append.md +6 -0
- package/templates/categories/dsh-plugin/AGENTS-append.md +21 -0
- package/templates/categories/dsh-plugin/CATEGORY.md +9 -0
- package/templates/categories/dsh-plugin/CONTRIBUTING-append.md +22 -0
- package/templates/categories/dsh-plugin/DEVELOPMENT-append.md +71 -0
- package/templates/categories/dsh-plugin/PUBLISHING-append.md +53 -0
- package/templates/categories/dsh-plugin/README-append.md +28 -0
- package/templates/categories/dsh-plugin/README.en.md +44 -0
- package/templates/categories/dsh-plugin/gitignore-append.md +15 -0
- package/templates/categories/go-service/.githooks/pre-commit +13 -0
- package/templates/categories/go-service/.github/workflows/ci.yml +31 -0
- package/templates/categories/go-service/.github/workflows/release.yml +58 -0
- package/templates/categories/go-service/.goreleaser.yaml +86 -0
- package/templates/categories/go-service/AGENTS-append.md +7 -0
- package/templates/categories/go-service/CATEGORY.md +33 -0
- package/templates/categories/go-service/CONTRIBUTING-append.md +13 -0
- package/templates/categories/go-service/DEVELOPMENT-append.md +21 -0
- package/templates/categories/go-service/Makefile +21 -0
- package/templates/categories/go-service/PUBLISHING-append.md +48 -0
- package/templates/categories/go-service/PUBLISHING.md +59 -0
- package/templates/categories/go-service/README-append.md +26 -0
- package/templates/categories/go-service/README.en.md +43 -0
- package/templates/categories/go-service/gitignore-append.md +13 -0
- package/templates/categories/product-oss/.github/CODEOWNERS +6 -0
- package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/bug_report.yml +52 -0
- package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/templates/categories/product-oss/.github/dependabot.yml +28 -0
- package/templates/categories/product-oss/.github/workflows/dependency-review.yml +18 -0
- package/templates/categories/product-oss/.github/workflows/release-please.yml +39 -0
- package/templates/categories/product-oss/.release-please-manifest.json +3 -0
- package/templates/categories/product-oss/CATEGORY.md +27 -0
- package/templates/categories/product-oss/CHANGELOG.md +14 -0
- package/templates/categories/product-oss/PULL_REQUEST_TEMPLATE.md +15 -0
- package/templates/categories/product-oss/SUPPORT.md +71 -0
- package/templates/categories/product-oss/release-please-config.json +10 -0
- package/templates/categories/python-app/.githooks/pre-commit +13 -0
- package/templates/categories/python-app/.github/workflows/ci.yml +33 -0
- package/templates/categories/python-app/.github/workflows/publish.yml +112 -0
- package/templates/categories/python-app/AGENTS-append.md +18 -0
- package/templates/categories/python-app/CATEGORY.md +34 -0
- package/templates/categories/python-app/CONTRIBUTING-append.md +13 -0
- package/templates/categories/python-app/DEVELOPMENT-append.md +21 -0
- package/templates/categories/python-app/PUBLISHING-append.md +52 -0
- package/templates/categories/python-app/PUBLISHING.md +61 -0
- package/templates/categories/python-app/README-append.md +27 -0
- package/templates/categories/python-app/README.en.md +44 -0
- package/templates/categories/python-app/gitignore-append.md +19 -0
- package/templates/categories/python-app/pyproject.toml +41 -0
- package/templates/categories/python-app/scripts/verify.py +39 -0
- package/templates/categories/sandbox/AGENTS-append.md +7 -0
- package/templates/categories/sandbox/CATEGORY.md +31 -0
- package/templates/categories/sandbox/README.en.md +24 -0
- package/templates/categories/sandbox/README.md +23 -0
- package/templates/check-single-source.mjs +107 -0
- package/templates/common/AGENTS-core.md +28 -0
- package/templates/common/CONTRIBUTING-core.md +21 -0
- package/templates/common/DEVELOPMENT-core.md +45 -0
- package/templates/common/PUBLISHING-core.md +31 -0
- package/templates/common/README-core.md +60 -0
- package/templates/common/SECURITY-core.md +19 -0
- package/templates/common/copilot-instructions.md +5 -0
- package/templates/common/gitignore-core.md +11 -0
- package/templates/repo-root/.githooks/pre-commit +20 -0
- package/templates/repo-root/.github/workflows/ci.yml +45 -0
- package/templates/repo-root/.github/workflows/publish.yml +77 -0
- package/templates/repo-root/CLAUDE.md +3 -0
- package/templates/repo-root/LICENSE +21 -0
- package/templates/repo-root/package.json +71 -0
- package/templates/repo-root/scripts/build.mjs +24 -0
- package/templates/repo-root/scripts/check-deploy.mjs +176 -0
- package/templates/repo-root/scripts/verify.mjs +52 -0
- package/templates/repo-root/src/config.ts +25 -0
- package/templates/repo-root/src/index.ts +40 -0
- package/templates/repo-root/tsconfig.build.json +22 -0
- package/templates/repo-root/tsconfig.json +23 -0
- package/templates/scaffold.mjs +793 -0
- package/templates/skill/SKILL.md +47 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Go Release 工作流(GoReleaser v2)
|
|
2
|
+
#
|
|
3
|
+
# 触发 = v* tag(semver);GoReleaser 负责:跨平台矩阵构建 → 归档 → checksum →
|
|
4
|
+
# 分组 changelog → GitHub Release 上传。
|
|
5
|
+
# permissions:contents: write 必需(建 Release/传产物);启用 cosign keyless 时加
|
|
6
|
+
# id-token: write;推 GHCR 镜像时加 packages: write。
|
|
7
|
+
# 验证链前置:ci.yml(make verify)应在 main/PR 上已把住质量关——发布 job 只做构建上传。
|
|
8
|
+
name: release
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags:
|
|
13
|
+
- 'v*'
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
# id-token: write # 启用 cosign keyless 签名时解开
|
|
18
|
+
# packages: write # 推 GHCR 镜像时解开
|
|
19
|
+
|
|
20
|
+
concurrency:
|
|
21
|
+
group: go-release
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
goreleaser:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@<commit-SHA> # actions/checkout@v7
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 0 # GoReleaser changelog 需要全量历史
|
|
32
|
+
- name: Setup Go
|
|
33
|
+
uses: actions/setup-go@<commit-SHA> # actions/setup-go@v7
|
|
34
|
+
with:
|
|
35
|
+
go-version: stable
|
|
36
|
+
cache: true
|
|
37
|
+
# —— 可选:供应链加固工具(GoReleaser 不会自动安装)——
|
|
38
|
+
# - name: Install cosign # 启用 .goreleaser.yaml signs 段时解开
|
|
39
|
+
# uses: sigstore/cosign-installer@<commit-SHA> # cosign-installer@v4
|
|
40
|
+
# - name: Install syft # 启用 sboms 段时解开
|
|
41
|
+
# uses: anchore/sbom-action/download-syft@<commit-SHA> # v0.24
|
|
42
|
+
# —— 可选:容器镜像(GoReleaser dockers_v2;与 .goreleaser.yaml dockers_v2 段配套)——
|
|
43
|
+
# - name: Set up Docker Buildx
|
|
44
|
+
# uses: docker/setup-buildx-action@<commit-SHA> # v4
|
|
45
|
+
# - name: Login to GHCR
|
|
46
|
+
# uses: docker/login-action@<commit-SHA> # v4
|
|
47
|
+
# with:
|
|
48
|
+
# registry: ghcr.io
|
|
49
|
+
# username: ${{ github.actor }}
|
|
50
|
+
# password: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
- name: Run GoReleaser
|
|
52
|
+
uses: goreleaser/goreleaser-action@<commit-SHA> # goreleaser-action@v7
|
|
53
|
+
with:
|
|
54
|
+
distribution: goreleaser
|
|
55
|
+
version: '~> v2'
|
|
56
|
+
args: release --clean
|
|
57
|
+
env:
|
|
58
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# .goreleaser.yaml — GoReleaser v2 最小可用配置(Go 服务发布)
|
|
2
|
+
#
|
|
3
|
+
# 本地验证:goreleaser check && goreleaser release --snapshot --clean
|
|
4
|
+
# 来源依据:goreleaser.com/customization(v2.18,2026-09 核实)
|
|
5
|
+
# 使用提示:project_name 与 main 路径按本库实际改;可选段(SBOM/cosign/容器)按需解开。
|
|
6
|
+
|
|
7
|
+
version: 2
|
|
8
|
+
|
|
9
|
+
project_name: <name>
|
|
10
|
+
|
|
11
|
+
before:
|
|
12
|
+
hooks:
|
|
13
|
+
- go mod tidy
|
|
14
|
+
|
|
15
|
+
builds:
|
|
16
|
+
- id: <name>
|
|
17
|
+
main: ./cmd/<name>
|
|
18
|
+
binary: <name>
|
|
19
|
+
env:
|
|
20
|
+
- CGO_ENABLED=0
|
|
21
|
+
goos: [linux, darwin, windows]
|
|
22
|
+
goarch: [amd64, arm64]
|
|
23
|
+
# 默认 ldflags 已注入 -s -w 与 main.version={{.Version}} / main.commit / main.date;
|
|
24
|
+
# 需要显式控制时解开:
|
|
25
|
+
# ldflags:
|
|
26
|
+
# - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
|
27
|
+
|
|
28
|
+
archives:
|
|
29
|
+
- id: <name>
|
|
30
|
+
formats: [tar.gz] # v2.6+ 用复数 formats(单数 format 已废弃)
|
|
31
|
+
format_overrides:
|
|
32
|
+
- goos: windows
|
|
33
|
+
format: zip # goreleaser v2:override 内为单数 format(外层才是复数 formats)
|
|
34
|
+
name_template: >-
|
|
35
|
+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
|
|
36
|
+
files:
|
|
37
|
+
- README*
|
|
38
|
+
- LICENSE*
|
|
39
|
+
|
|
40
|
+
checksum:
|
|
41
|
+
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
|
|
42
|
+
algorithm: sha256
|
|
43
|
+
|
|
44
|
+
changelog:
|
|
45
|
+
# 按 conventional commits 分组(与 CONTRIBUTING 提交规范同源)
|
|
46
|
+
sort: asc
|
|
47
|
+
filters:
|
|
48
|
+
exclude:
|
|
49
|
+
- "^docs:"
|
|
50
|
+
- "^test:"
|
|
51
|
+
- "^chore:"
|
|
52
|
+
- Merge pull request
|
|
53
|
+
- Merge branch
|
|
54
|
+
groups:
|
|
55
|
+
- title: Features
|
|
56
|
+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
|
|
57
|
+
order: 0
|
|
58
|
+
- title: Bug fixes
|
|
59
|
+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
|
|
60
|
+
order: 1
|
|
61
|
+
- title: Others
|
|
62
|
+
order: 999
|
|
63
|
+
|
|
64
|
+
release:
|
|
65
|
+
# GoReleaser 用 GITHUB_TOKEN 建 GitHub Release 并上传全部产物
|
|
66
|
+
# draft: true # 想人工确认后再发布就打开
|
|
67
|
+
|
|
68
|
+
# ── 可选段(小库务实取舍:默认注释;启用需同步改 release.yml)──
|
|
69
|
+
# SBOM(需 workflow 装 anchore/sbom-action/download-syft):
|
|
70
|
+
# sboms:
|
|
71
|
+
# - artifacts: archive # 每个 archive 生成 .sbom.json(syft)
|
|
72
|
+
|
|
73
|
+
# cosign keyless 签名:只签 checksum 文件(业界惯例,一份覆盖全链)
|
|
74
|
+
# 需 workflow 装 sigstore/cosign-installer + permissions 加 id-token: write
|
|
75
|
+
# signs:
|
|
76
|
+
# - cmd: cosign
|
|
77
|
+
# signature: "${artifact}.sigstore.json"
|
|
78
|
+
# artifacts: checksum
|
|
79
|
+
# args: ["sign-blob", "--bundle=${signature}", "${artifact}", "--yes"]
|
|
80
|
+
|
|
81
|
+
# 容器镜像(dockers_v2,GoReleaser ≥ v2.12;buildx 一次 build --push 出多平台 manifest)
|
|
82
|
+
# 需 workflow 装 buildx + login GHCR;与下方 buildx 独立方案二选一,不要同时开
|
|
83
|
+
# dockers_v2:
|
|
84
|
+
# - images: [ghcr.io/<org>/<name>]
|
|
85
|
+
# tags: ["v{{ .Version }}", latest]
|
|
86
|
+
# platforms: [linux/amd64, linux/arm64]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!-- ===== append:go-service 分类纪律(拼接到 AGENTS-core 之后) ===== -->
|
|
2
|
+
|
|
3
|
+
## 构建纪律(本分类硬性)
|
|
4
|
+
|
|
5
|
+
1. **提交前门**:`make verify`(gofmt → vet → test → build)全绿;pre-commit 钩子自动执行(启用:`git config core.hooksPath .githooks`)。gofmt/go vet 是 Go 社区强约定,CI required,本地无借口。
|
|
6
|
+
2. **格式与静态检查不绕过**:gofmt -l 有输出即 FAIL。
|
|
7
|
+
3. `deploy/` 下配置只写模板不写真值(机密红线见上方 AI 协作守则第 3 条)。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!-- 模板说明(用后删除):D 类"Go 服务"分类 delta 模板(语言基类)。
|
|
2
|
+
叠加规则同 python-app:通用文档层照用;npm/TS 专属文件删除。 -->
|
|
3
|
+
|
|
4
|
+
# D 类 · Go 服务(语言基类)
|
|
5
|
+
|
|
6
|
+
> 实证来源:jinteng(go.mod + cmd/ + Makefile + deploy/docs/examples;个人自用服务)。
|
|
7
|
+
|
|
8
|
+
## 文件 delta(相对 repo-root 基类)
|
|
9
|
+
|
|
10
|
+
| 动作 | 文件 | 说明 |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| **新增** | `go.mod`(`go mod init github.com/<org>/<repo>` 自生成,不模板化) | 模块路径按实际仓库 |
|
|
13
|
+
| **新增** | `cmd/<svc>/main.go`(自写) | 服务入口 |
|
|
14
|
+
| **新增** | `Makefile`(本目录提供骨架) | build/test/lint/run 四件套 |
|
|
15
|
+
| **替换** | `.github/workflows/ci.yml`(本目录提供) | go test/go vet/gofmt 验证 |
|
|
16
|
+
| **删除** | npm/TS 专属全套(package.json/tsconfig*/src TS/scripts/*.mjs) | — |
|
|
17
|
+
| **保留** | 通用文档层 + LICENSE/.gitignore(Go 版) | .gitignore 需补 `bin/`(构建产物) |
|
|
18
|
+
|
|
19
|
+
## 验证链
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
gofmt -l . | grep -q . && exit 1 # 格式
|
|
23
|
+
go vet ./... # 静态检查
|
|
24
|
+
go test ./... # 单测
|
|
25
|
+
go build ./... # 编译
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 发布面
|
|
29
|
+
|
|
30
|
+
- **制品 = 二进制/容器**(jinteng 实况:deploy/ + docs/ + examples/)——无 npm/PyPI 段;
|
|
31
|
+
PUBLISHING.md 收敛为:版本 tag → GitHub Release(附二进制或镜像说明)→ CHANGELOG
|
|
32
|
+
- AGENTS.md:无部署纪律/无 npm 段;保留机密纪律 + `make verify` 提交前门
|
|
33
|
+
- gofmt/go vet 是 Go 社区强约定,CI 必须 required
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- ===== append:go-service 分类段(拼接到 CONTRIBUTING-core 之后) ===== -->
|
|
2
|
+
|
|
3
|
+
## 开发环境
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
go mod download # 或 go mod tidy(go.sum 必须入库)
|
|
7
|
+
make verify # 验证链单源:gofmt → vet → test → build(本地与 CI 同一入口)
|
|
8
|
+
go run ./cmd/<name> # 本地起服务
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 发版流程
|
|
12
|
+
|
|
13
|
+
见 [PUBLISHING.md](PUBLISHING.md)(tag v* → GoReleaser 矩阵构建 → GitHub Release)。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- ===== append:go-service 分类段(拼接到 DEVELOPMENT-core 之后) ===== -->
|
|
2
|
+
|
|
3
|
+
## 分类纪律:Go 实现规范
|
|
4
|
+
|
|
5
|
+
- 布局:cmd/<name>/ 入口 + 内部包按域拆分;入口声明 `var version = "dev"`(GoReleaser 默认 ldflags 注入)
|
|
6
|
+
- gofmt/go vet 零容忍(Makefile verify 单源第一、二步);公共函数带注释(godoc 惯例)
|
|
7
|
+
- 提交前门:`make verify`(gofmt → vet → test → build)全绿;pre-commit 钩子已指向它
|
|
8
|
+
- go.sum 必须入库(go mod tidy 生成)
|
|
9
|
+
|
|
10
|
+
## 分类 DoD 补充(Go)
|
|
11
|
+
|
|
12
|
+
- [ ] `make verify` 全绿;`go vet` 零告警
|
|
13
|
+
- [ ] 发布前 `goreleaser check && goreleaser release --snapshot --clean` 本地演练通过
|
|
14
|
+
- [ ] deploy/ 配置只写模板不写真值
|
|
15
|
+
|
|
16
|
+
## 速查表预置(回顾追加)
|
|
17
|
+
|
|
18
|
+
| 坑 | 症状 | 拦截环节 |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| 忘记 go mod tidy,go.sum 漂移 | CI `go build` 失败 | Makefile build 步 + PR 检查 |
|
|
21
|
+
| tag 与代码内版本不一致 | 二进制 --version 错报 | GoReleaser ldflags 注入(以 tag 为准) |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# <name>(Go 服务)
|
|
2
|
+
|
|
3
|
+
# Makefile 四件套:verify 为验证链单源(CI 与本地同入口)
|
|
4
|
+
.PHONY: verify fmt lint test build run
|
|
5
|
+
|
|
6
|
+
verify: fmt lint test build
|
|
7
|
+
|
|
8
|
+
fmt:
|
|
9
|
+
@out="$$(gofmt -l .)"; if [ -n "$$out" ]; then echo "✗ 需 gofmt:$$out"; exit 1; fi
|
|
10
|
+
|
|
11
|
+
lint:
|
|
12
|
+
go vet ./...
|
|
13
|
+
|
|
14
|
+
test:
|
|
15
|
+
go test ./...
|
|
16
|
+
|
|
17
|
+
build:
|
|
18
|
+
go build ./...
|
|
19
|
+
|
|
20
|
+
run:
|
|
21
|
+
go run ./cmd/<name>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!-- ===== append:go-service 分类段(拼接到 PUBLISHING-core 之后) ===== -->
|
|
2
|
+
|
|
3
|
+
## 发布通道(GoReleaser → GitHub Release)
|
|
4
|
+
|
|
5
|
+
**制品**:跨平台二进制/归档(GoReleaser)→ GitHub Release;可选 GHCR 容器镜像。
|
|
6
|
+
**前置验证**:ci.yml(make verify)把住质量关——release 只做构建上传。
|
|
7
|
+
|
|
8
|
+
## 日常发布流程
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
# ① 发布前本地演练(必跑——配置错误本地暴露,不烧 CI)
|
|
12
|
+
goreleaser check
|
|
13
|
+
goreleaser release --snapshot --clean # 产物进 dist/,不建 Release
|
|
14
|
+
|
|
15
|
+
# ② 显式 tag + push(发布是人的决定)
|
|
16
|
+
git commit -am "chore: release v<x.y.z> — <一句话主旨>"
|
|
17
|
+
git tag v<x.y.z>
|
|
18
|
+
git push && git push --tags # ③ release.yml 接手:矩阵构建 → GitHub Release
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- **版本注入**:GoReleaser 默认 ldflags 注入 `main.version`(tag 去 v 前缀)/`main.commit`/`main.date`
|
|
22
|
+
- **changelog**:GoReleaser 按 conventional commits 分组生成(与 CONTRIBUTING 提交规范同源)
|
|
23
|
+
- 可选人工确认:`.goreleaser.yaml` release.draft: true
|
|
24
|
+
|
|
25
|
+
## 首次发布前置(一次性)
|
|
26
|
+
|
|
27
|
+
1. `go mod init github.com/<org>/<repo>`;`cmd/<name>/main.go` 入口就位
|
|
28
|
+
2. workflow 的 `<commit-SHA>` 固定(checkout@v7、setup-go@v7、goreleaser-action@v7 对应 SHA)
|
|
29
|
+
3. 可选启用项(.goreleaser.yaml + release.yml 成对解开):SBOM(syft)/ cosign keyless 签名 / GHCR 镜像(dockers_v2)
|
|
30
|
+
4. 首发验证:GitHub Release 页产物齐全(各平台归档 + checksums.txt);`shasum -a 256 -c` 本地复核
|
|
31
|
+
|
|
32
|
+
## 应急手动发布(CI 不可用时)
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
make verify
|
|
36
|
+
goreleaser release --snapshot --clean # 本地产物
|
|
37
|
+
gh release create v<x.y.z> dist/* --generate-notes # 本机 gh 登录态手工上传
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 与 release-please 的分工(可选升级,B 类多人协作时)
|
|
41
|
+
|
|
42
|
+
小库最省事路线 = 手工打 `v*` tag + GoReleaser changelog 分组(本模板现状)。
|
|
43
|
+
需要严格 CHANGELOG.md 文件与自动版本号时引入 release-please(v5):它管**版本晋升**
|
|
44
|
+
(开 Release PR、合并时打 tag),GoReleaser 跑在它打的 tag 上构建上传(Release 已存在会更新,不撞车)。
|
|
45
|
+
|
|
46
|
+
## 维护要点
|
|
47
|
+
|
|
48
|
+
- GoReleaser v2 配置变更先过 `goreleaser check`;deprecated 字段盯 goreleaser.com/resources/deprecations(v3 将移除 dockers 旧写法,用 dockers_v2)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# 发布记录:<repo>(Go 服务)
|
|
2
|
+
|
|
3
|
+
**发布制品**:跨平台二进制/归档(GoReleaser)→ GitHub Release;可选 GHCR 容器镜像。
|
|
4
|
+
**验证链前置**:ci.yml(make verify)把住质量关——release 只做构建上传。
|
|
5
|
+
|
|
6
|
+
## 发布状态(<日期> 更新)
|
|
7
|
+
|
|
8
|
+
| 项 | 状态 |
|
|
9
|
+
|---|---|
|
|
10
|
+
| GitHub Release | <最新 tag / Release 链接> |
|
|
11
|
+
| 产物 | tar.gz(linux/darwin/windows × amd64/arm64)+ zip(windows)+ checksums.txt |
|
|
12
|
+
| 本地验证 | <make verify + goreleaser snapshot 实测> |
|
|
13
|
+
|
|
14
|
+
## 日常发布流程
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
# ① 发布前本地演练(必跑——配置错误本地暴露,不烧 CI)
|
|
18
|
+
goreleaser check
|
|
19
|
+
goreleaser release --snapshot --clean # 产物进 dist/,不建 Release
|
|
20
|
+
|
|
21
|
+
# ② 显式 bump + tag + push(发布是人的决定)
|
|
22
|
+
npm 式 bump 在 Go 里手工做:
|
|
23
|
+
V=<x.y.z>
|
|
24
|
+
# 改代码内版本(若引用 main.version 则以 tag 注入为准,无需改源码)
|
|
25
|
+
git commit -am "chore: release v$V — <一句话主旨>"
|
|
26
|
+
git tag v$V
|
|
27
|
+
git push && git push --tags # ③ release.yml 接手:矩阵构建 → Release
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **版本注入**:GoReleaser 默认 ldflags 注入 `main.version`(tag 去 v 前缀)/`main.commit`/`main.date`——入口文件声明 `var version = "dev"` 即可自动获得
|
|
31
|
+
- **changelog**:GoReleaser 按 conventional commits 分组生成(feat/fix/Others),与 CONTRIBUTING 提交规范同源
|
|
32
|
+
- 可选人工确认:`.goreleaser.yaml` release.draft: true
|
|
33
|
+
|
|
34
|
+
## 首次发布前置(一次性)
|
|
35
|
+
|
|
36
|
+
1. `go mod init github.com/<org>/<repo>`;`cmd/<name>/main.go` 入口就位
|
|
37
|
+
2. workflow 的 `<commit-SHA>` 固定(actions/checkout@v7、setup-go@v7、goreleaser-action@v7 对应 SHA)
|
|
38
|
+
3. 可选启用项(.goreleaser.yaml + release.yml 成对解开):SBOM(syft)/ cosign keyless 签名 / GHCR 镜像(dockers_v2)
|
|
39
|
+
4. 首发验证:GitHub Release 页产物齐全(各平台归档 + checksums.txt);`shasum -a 256 -c` 本地复核
|
|
40
|
+
|
|
41
|
+
## 应急手动发布(CI 不可用时)
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
make verify
|
|
45
|
+
goreleaser release --snapshot --clean # 本地产物
|
|
46
|
+
gh release create v$V dist/* --generate-notes # 本机 gh 登录态手工上传
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 与 release-please 的分工(可选升级)
|
|
50
|
+
|
|
51
|
+
小库最省事路线 = 手工打 `v*` tag + GoReleaser changelog 分组(本模板现状)。
|
|
52
|
+
当需要严格 CHANGELOG.md 文件与自动版本号时引入 release-please(v5):它负责**版本晋升**
|
|
53
|
+
(从 conventional commits 算 next version、开 Release PR、合并时打 tag),GoReleaser 跑在
|
|
54
|
+
它打出的 tag 上构建上传(Release 已存在时会更新而非报错,不撞车)。
|
|
55
|
+
|
|
56
|
+
## 维护要点
|
|
57
|
+
|
|
58
|
+
- GoReleaser v2 配置变更先过 `goreleaser check`;deprecated 字段盯 goreleaser.com/resources/deprecations(v3 会移除 dockers 旧写法,用 dockers_v2)
|
|
59
|
+
- 应急发布无 checksum 分组生成?——snapshot 产物含 checksums.txt,保持一致
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!-- ===== append:go-service 分类段(拼接到 README-core 之后) ===== -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
- <功能点 1:一句话说清用户得到什么>
|
|
6
|
+
- <功能点 2>
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
> 要求 Go >= <版本>(见 go.mod);或直接下载 Release 二进制。
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
go install github.com/<org>/<repo>/cmd/<name>@latest
|
|
14
|
+
# 或从 GitHub Release 下载对应平台归档(含 checksums.txt 校验)
|
|
15
|
+
# 服务部署:deploy/ 下模板 + docs/ 说明
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 使用
|
|
19
|
+
|
|
20
|
+
<最小可复制示例:启动命令 / 配置文件最小样例。示例代码块必须可直接粘贴执行。>
|
|
21
|
+
|
|
22
|
+
## 配置
|
|
23
|
+
|
|
24
|
+
| 配置项 | 默认 | 说明 |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `<field>` | `<default>` | <作用与生效方式(重启生效 /热更新)> |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# <name>
|
|
2
|
+
|
|
3
|
+
<One-line English description>(与中文版 README 首句同义).
|
|
4
|
+
|
|
5
|
+
[中文](README.md) | English is a mirror; the Chinese README is authoritative and may lag behind.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- <Feature 1>
|
|
10
|
+
- <Feature 2>
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
> Requires Go >= <version> (see go.mod); or grab a binary from GitHub Releases.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
go install github.com/<org>/<repo>/cmd/<name>@latest
|
|
18
|
+
# Or download the platform archive from GitHub Releases (checksums.txt included)
|
|
19
|
+
# Deployment: templates under deploy/ + docs/
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
<Minimal copy-paste example: launch command / minimal config sample.>
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
| Option | Default | Description |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `<field>` | `<default>` | <What it does; restart or hot-reload> |
|
|
31
|
+
|
|
32
|
+
## Docs
|
|
33
|
+
|
|
34
|
+
- [Design](docs/DESIGN.md) <!-- remove this line if no docs/ directory -->
|
|
35
|
+
- [Development & verification discipline](DEVELOPMENT.md) · [Publishing](PUBLISHING.md)
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). AI collaborators read [AGENTS.md](AGENTS.md) first (AI-collaboration rules).
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Bug report(缺陷报告)
|
|
2
|
+
description: 报告一个可复现的问题
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
感谢反馈!请先搜索已有 issue 避免重复。
|
|
9
|
+
安全漏洞**不要**在此报告——请使用 Security 标签页的
|
|
10
|
+
"Report a vulnerability"(私密报告)。
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: repro
|
|
13
|
+
attributes:
|
|
14
|
+
label: 复现步骤
|
|
15
|
+
description: 一步一步描述如何触发问题;附最小复现代码更好
|
|
16
|
+
placeholder: |
|
|
17
|
+
1. 运行 '...'
|
|
18
|
+
2. 看到 '...'
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: expected
|
|
23
|
+
attributes:
|
|
24
|
+
label: 期望行为与实际行为
|
|
25
|
+
validations:
|
|
26
|
+
required: true
|
|
27
|
+
- type: input
|
|
28
|
+
id: version
|
|
29
|
+
attributes:
|
|
30
|
+
label: 版本
|
|
31
|
+
placeholder: "例如 v1.2.3 或 commit sha"
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
- type: dropdown
|
|
35
|
+
id: os
|
|
36
|
+
attributes:
|
|
37
|
+
label: 运行环境
|
|
38
|
+
options:
|
|
39
|
+
- Linux
|
|
40
|
+
- macOS
|
|
41
|
+
- Windows
|
|
42
|
+
- 其他(请在补充说明中注明)
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
- type: textarea
|
|
46
|
+
id: logs
|
|
47
|
+
attributes:
|
|
48
|
+
label: 日志/截图
|
|
49
|
+
description: 拖拽文件或直接粘贴
|
|
50
|
+
render: shell
|
|
51
|
+
validations:
|
|
52
|
+
required: false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Dependabot:依赖与 CI action 的自动升级(分组合 PR,控制噪音)
|
|
2
|
+
# 起点配置;库类可加 versioning-strategy: widen;schedule 错开到周初
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: "github-actions"
|
|
6
|
+
directory: "/"
|
|
7
|
+
schedule:
|
|
8
|
+
interval: "weekly"
|
|
9
|
+
day: "monday"
|
|
10
|
+
groups:
|
|
11
|
+
actions-minor-and-patch:
|
|
12
|
+
update-types:
|
|
13
|
+
- "minor"
|
|
14
|
+
- "patch"
|
|
15
|
+
open-pull-requests-limit: 10
|
|
16
|
+
|
|
17
|
+
# 按语言基类增删 ecosystem:npm(dsh-plugin)/ pip(python-app)/ gomod(go-service)
|
|
18
|
+
- package-ecosystem: "npm"
|
|
19
|
+
directory: "/"
|
|
20
|
+
schedule:
|
|
21
|
+
interval: "weekly"
|
|
22
|
+
day: "tuesday"
|
|
23
|
+
groups:
|
|
24
|
+
deps-minor-and-patch:
|
|
25
|
+
update-types:
|
|
26
|
+
- "minor"
|
|
27
|
+
- "patch"
|
|
28
|
+
open-pull-requests-limit: 10
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PR 依赖安全审查:新增依赖引入已知漏洞时拦下(fail-on-severity 从 high 起步,避免误伤阻塞)
|
|
2
|
+
name: dependency-review
|
|
3
|
+
|
|
4
|
+
on: [pull_request]
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
dependency-review:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@<commit-SHA> # actions/checkout@v7
|
|
15
|
+
- name: Dependency Review
|
|
16
|
+
uses: actions/dependency-review-action@<commit-SHA> # dependency-review-action@v5
|
|
17
|
+
with:
|
|
18
|
+
fail-on-severity: high
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Release PR + tag + GitHub Release 全自动:解析 Conventional Commits
|
|
2
|
+
# (release-please-action 最新 v5.0.0(node24);保守可 pin @v4;正式仓库 uses 固定到 <commit-SHA>)
|
|
3
|
+
name: release-please
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write # 更新 CHANGELOG/版本号、打 tag、发 Release
|
|
11
|
+
issues: write
|
|
12
|
+
pull-requests: write # 创建/更新 Release PR
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release-please:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Release Please
|
|
19
|
+
uses: googleapis/release-please-action@v5 # TODO: 固定 SHA
|
|
20
|
+
id: release
|
|
21
|
+
with:
|
|
22
|
+
config-file: release-please-config.json
|
|
23
|
+
manifest-file: .release-please-manifest.json
|
|
24
|
+
# 默认 GITHUB_TOKEN 即可建 Release PR/tag/Release;但 GITHUB_TOKEN 触发的事件
|
|
25
|
+
# 不会再触发其他 workflow——Release PR 合并后要自动跑发布(npm/PyPI/GoReleaser)
|
|
26
|
+
# 时改用 PAT:token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
27
|
+
|
|
28
|
+
# ——(可选)Release 合并后自动发布(按语言基类的 publish/release 工作流衔接)——
|
|
29
|
+
# 方式 A:这里直接跑发布步骤(需 PAT 触发下游);
|
|
30
|
+
# 方式 B(推荐):release-please 打的 tag 天然触发语言基类的 publish/release.yml——
|
|
31
|
+
# 此时无需本段,且 token 不必换 PAT。二选一,避免双发布。
|
|
32
|
+
# - uses: actions/checkout@<commit-SHA>
|
|
33
|
+
# if: ${{ steps.release.outputs.release_created }}
|
|
34
|
+
# - uses: actions/setup-node@<commit-SHA> # 按语言替换
|
|
35
|
+
# if: ${{ steps.release.outputs.release_created }}
|
|
36
|
+
# - run: npm ci && npm publish
|
|
37
|
+
# if: ${{ steps.release.outputs.release_created }}
|
|
38
|
+
# env:
|
|
39
|
+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!-- 模板说明(用后删除):B 类"产品/多人协作 OSS"叠加规范(overlay)。
|
|
2
|
+
用法:先用语言基类(python-app / go-service / dsh-plugin)脚手架建库,
|
|
3
|
+
再把本目录文件叠加(CHANGELOG.md / PULL_REQUEST_TEMPLATE.md 覆盖或新增),
|
|
4
|
+
并按 SUPPORT.md 修订 CONTRIBUTING(PR 流)与 AGENTS/DEVELOPMENT(门禁从 pre-commit 扩展为 CI required)。 -->
|
|
5
|
+
|
|
6
|
+
# B 类 · 产品/多人协作 OSS(overlay)
|
|
7
|
+
|
|
8
|
+
适用实证:qingfu-envoy(PR #23)/ neonforge / fuyao-nomad / Voyage。
|
|
9
|
+
|
|
10
|
+
## 叠加内容(scaffold `--overlay product-oss` 全部自动落位)
|
|
11
|
+
|
|
12
|
+
| 文件 | 动作 | 说明 |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| `CHANGELOG.md` | 覆盖/新增 | 变更唯一事实源(Keep a Changelog) |
|
|
15
|
+
| `.github/PULL_REQUEST_TEMPLATE.md` | 新增 | 自检清单(验证链/机密/文档/兼容性) |
|
|
16
|
+
| `.github/ISSUE_TEMPLATE/bug_report.yml` + `config.yml` | 新增 | YAML issue forms(复现步骤/环境)+ 私密漏洞报告指路 |
|
|
17
|
+
| `.github/CODEOWNERS` | 新增 | 评审责任人锁定(自身必须有 owner) |
|
|
18
|
+
| `.github/dependabot.yml` | 新增 | 依赖与 action 自动升级(minor/patch 成组) |
|
|
19
|
+
| `.github/workflows/release-please.yml` + `release-please-config.json` + `.release-please-manifest.json` | 新增 | **版本晋升自动化**:conventional commits → Release PR → 合并即 tag + Release + CHANGELOG |
|
|
20
|
+
| `.github/workflows/dependency-review.yml` | 新增 | PR 依赖安全审查(fail-on-severity: high 起步) |
|
|
21
|
+
| `SUPPORT.md` | 供人读(不进产物) | 协作流/发布节奏/红线差异说明 |
|
|
22
|
+
|
|
23
|
+
## 与语言基类的联动
|
|
24
|
+
|
|
25
|
+
- 基类的验证链单源(verify.mjs/verify.py/Makefile)不变——CI required 是 PR 门禁本体
|
|
26
|
+
- pre-commit 部署纪律(dsh 插件)保留在库内;贡献者无法执行时由维护者发版前代跑(SUPPORT.md 已注明)
|
|
27
|
+
- ROADMAP.md:从语言基类的 DEVELOPMENT「核心循环」延展为阶段收口文档(实践库惯例:阶段末评审报告入库)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本仓所有对外可见变更的唯一事实源。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
|
|
4
|
+
版本遵循 [SemVer](https://semver.org/lang/zh-CN/);PR 合并即在此登记(分类:Added/Changed/Deprecated/Removed/Fixed/Security)。
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- 初始结构。
|
|
10
|
+
|
|
11
|
+
<!-- 模板说明(用后删除):
|
|
12
|
+
- 与 PUBLISHING.md 的分工:PUBLISHING 管"发布状态与流程",本文件管"变更事实"——Release 文案从对应版本段落取,不复制全文
|
|
13
|
+
- 版本行格式:## [x.y.z] - YYYY-MM-DD
|
|
14
|
+
-->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- PR 标题即 conventional commits:feat(scope): 中文描述 —— 合并后作为 CHANGELOG 素材 -->
|
|
2
|
+
|
|
3
|
+
## 变更说明
|
|
4
|
+
|
|
5
|
+
<改了什么 + 为什么(用户视角一句话 + 实现要点)>
|
|
6
|
+
|
|
7
|
+
## 自检清单
|
|
8
|
+
|
|
9
|
+
- [ ] CI 绿(ci.yml 验证链通过;本机 `npm test` / `make verify` / `python scripts/verify.py` 同源复跑过)
|
|
10
|
+
- [ ] 无本机私有信息(绝对路径/邮箱/token/部署实况)——`git grep -nE '/home/[a-z]|/mnt/[a-z]|/Users/[a-z]'`
|
|
11
|
+
- [ ] CHANGELOG.md 已登记(Unreleased 段)
|
|
12
|
+
- [ ] 文档同步(README / DEVELOPMENT 速查表 / SECURITY 支持面,按影响面)
|
|
13
|
+
- [ ] 兼容性:breaking 在标题加 `!` 并在描述中给出迁移路径
|
|
14
|
+
|
|
15
|
+
<!-- 维护者注意:无法本地跑 check:deploy 的贡献者在 PR 说明注明,由维护者发版前代跑部署纪律自检 -->
|