From a7ab382a899d1bcfeb1757de39aed80dbed6b245 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Sat, 28 Feb 2026 11:00:42 +0100 Subject: [PATCH] chore(prompts): add skill and prompt to update supported Go versions (#1561) * chore(prompts): add supported Go version update skill and prompt * docs: add usage for supported Go version update prompt --- .../update-supported-go-versions.prompt.md | 12 +++ .../skills/gosec-update-go-versions/SKILL.md | 78 +++++++++++++++++++ DEVELOPMENT.md | 36 +++++++++ 3 files changed, 126 insertions(+) create mode 100644 .github/prompts/update-supported-go-versions.prompt.md create mode 100644 .github/skills/gosec-update-go-versions/SKILL.md diff --git a/.github/prompts/update-supported-go-versions.prompt.md b/.github/prompts/update-supported-go-versions.prompt.md new file mode 100644 index 0000000..a0d7ce2 --- /dev/null +++ b/.github/prompts/update-supported-go-versions.prompt.md @@ -0,0 +1,12 @@ +--- +name: Update Supported Go Versions +mode: agent +description: Update gosec to the latest patch versions of the two latest Go major versions and open a pull request. +--- + +Use the skill Update Supported Go Versions from .github/skills/gosec-update-go-versions/SKILL.md. + +Requirements: +- Use https://go.dev/doc/devel/release as source of truth for latest stable releases. +- Carefully find and update all places in the repository where active supported Go versions are configured or documented. +- Open a pull request with the required title and summary from the skill contract. diff --git a/.github/skills/gosec-update-go-versions/SKILL.md b/.github/skills/gosec-update-go-versions/SKILL.md new file mode 100644 index 0000000..fc8f44d --- /dev/null +++ b/.github/skills/gosec-update-go-versions/SKILL.md @@ -0,0 +1,78 @@ +--- +name: Update Supported Go Versions +description: Update gosec to the latest patch versions of the two latest supported Go major versions using go.dev release data. +--- + +# Update supported Go versions across the repository + +Use this skill when you want to bump repository Go versions to the newest patch releases of the latest two supported Go major versions. + +Reference source for versions: +- https://go.dev/doc/devel/release + +## Required behavior + +1. Fetch and parse the release page. +2. Detect the latest two Go major.minor series and their latest patch versions. + - Example shape: latest series `1.26.x` and previous series `1.25.x`. +3. Derive: + - `latest_patch` (for newest series, full patch string, e.g. `1.26.3`) + - `previous_patch` (for second newest series, full patch string, e.g. `1.25.9`) + - `latest_minor` (e.g. `1.26`) + - `previous_minor` (e.g. `1.25`) +4. Apply updates carefully across all relevant files. + +## Version update rules + +Use repository-wide search and update all applicable occurrences, including but not limited to: + +- GitHub Actions workflow `go-version` values: + - Matrix entries for supported versions must include exactly the two patch versions: + - `previous_patch` + - `latest_patch` + - Single-version setup-go steps should use `latest_patch`. +- Build argument and build tool defaults: + - `GO_VERSION=` style values should use `latest_minor`. +- Module/toolchain minimum version markers: + - `go.mod` `go` directive should be set to `previous_minor.0`. + - Embedded temporary `go.mod` contents in tests/benchmarks should use `previous_minor` (without patch) unless file style requires otherwise. +- Documentation and skill/prompt metadata that state supported versions: + - Update text to match the new supported pair (`previous_minor` and `latest_minor`). + - Update "requires Go X or newer" style statements to `previous_minor`. + +## Discovery checklist (must run) + +Search the full repository for version markers and review each hit: + +- `go-version:` +- `setup-go` +- `GO_VERSION` +- `golang:` +- `^go [0-9]+\.[0-9]+(\.[0-9]+)?$` +- `Go 1.` +- `1\.[0-9]+\.[0-9]+` + +Do not change unrelated historical references unless they represent active supported-version policy. + +## Validation + +1. Confirm all intended files were updated and no obvious supported-version location was missed. +2. Run targeted checks: + - `go test ./...` +3. Re-run search to ensure old supported pair is removed from active config/docs. + +## Git and PR workflow + +1. Create branch: `chore/update-go-versions-` +2. Commit message: `chore(go): update supported Go versions to and ` +3. Push branch. +4. Open PR to `master` with: + - Title: `chore(go): update supported Go versions to and ` + - Body summary listing key files changed and source link to go.dev release page. + +## Output requirements + +- Report detected versions (`previous_patch`, `latest_patch`, `previous_minor`, `latest_minor`). +- List all updated files grouped by category (workflows, build config, module/tests, docs/metadata). +- Report test command result. +- Report branch name, commit SHA, PR title, and PR URL. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 8e14892..213050e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -15,6 +15,7 @@ - [Common taint sources](#common-taint-sources) - [AI-generated rule workflow (Copilot)](#ai-generated-rule-workflow-copilot) - [AI-generated bug fix workflow (Copilot)](#ai-generated-bug-fix-workflow-copilot) +- [AI-supported Go version update workflow (Copilot)](#ai-supported-go-version-update-workflow-copilot) - [Rule development utilities](#rule-development-utilities) - [SARIF types generation](#sarif-types-generation) - [Performance regression guard](#performance-regression-guard) @@ -282,6 +283,41 @@ After confirmation, the workflow should: - add or update `testutils/` code samples when appropriate for reproducing/validating the issue - validate with build, tests, `golangci-lint`, and a `gosec` CLI run against a sample +## AI-supported Go version update workflow (Copilot) + +This repository includes a Copilot skill and prompt to update supported Go versions to the latest patch versions of the two newest major Go series. + +- Skill file: `.github/skills/gosec-update-go-versions/SKILL.md` +- Prompt file: `.github/prompts/update-supported-go-versions.prompt.md` + +### Use via `/prompt` (recommended) + +1. In VS Code Copilot Chat, run `/prompt` and select **Update Supported Go Versions**. +2. Submit the prompt (no additional fields required). +3. The workflow should: + - read `https://go.dev/doc/devel/release` + - detect latest two supported Go series and latest patch for each + - update all active repository locations where supported Go versions are configured or documented + - run validation checks + - create branch, commit, push, and open a PR + +### Use the skill directly (without `/prompt`) + +Send this in Copilot Chat: + +```text +Use the skill "Update Supported Go Versions" from .github/skills/gosec-update-go-versions/SKILL.md. +``` + +### Expected outputs + +The result should include: + +- detected versions (`previous_patch`, `latest_patch`, `previous_minor`, `latest_minor`) +- grouped file update summary +- test command result +- branch, commit SHA, PR title, and PR URL + ## Rule development utilities Use these tools while building or debugging rules: