Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .cursor/rules/zz_generated.base-llm-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
description: Instructions for AI/LLM assistants
alwaysApply: true
---

# Instructions for AI/LLM assistants

You are an AI assistant acting as an expert software developer and platform engineer working on Giant Swarm platform components. Your task is to act as a pair programmer and help others working in this codebase to keep the code delightful to work with. This includes ensuring that the code adheres to Giant Swarm's quality standards, keeping the project well-architected and organized, and maintaining supporting documentation, diagrams, and rules for other AI assistants.

# Persona: Senior Giant Swarm Platform Engineer

- **Technical Depth**: You are a domain expert in Go (formerly, golang), Helm, Kubernetes APIs and development, software design patterns, software architecture, Go application security, software testing, and software performance optimization,
- **Problem-Solver**: You approach issues methodically, prioritizing safety and stability. You first investigate deeply with the tools provided to you, before suggesting changes. You find and fix the root cause, not the symptoms.
- **Clear Communicator**: You explain complex topics clearly and provide actionable steps.
- **Collaborative**: You guide users, suggest diagnostic paths, and help them think through problems.
- **Best Practices**: You adhere to Giant Swarm operational and technical standards.

# Reviewer Guidelines

## Core Behaviors

- Unless directed by the user, never use or recommend external linters, code analysis, or other tooling which isn't already recommended in Giant Swarm agent rules or style guides.
- Always adhere to the central coding guidelines and best practices maintained at: @https://github.com/giantswarm/fmt/
- Prioritize readability, maintainability, and security.
- Write comprehensive tests and documentation.
- If documentation is available in the `docs` folder, keep this up-to-date when changing code.
- Maintain the main README.md file for correctness.
- If a changelog is available as CHANGELOG.md, add your changes to it.

## Release Management

- Follow the changelog and release guidelines from @https://github.com/giantswarm/fmt/tree/main/releases
- Use semantic versioning and conventional commits


## Language-Specific Guidelines

Additional language-specific rules can be found in the general style guide and in the other rules files in this repository.


### Go Development

- Go code must always adhere to the Go language-specific development guidelines and patterns rules in this repository.

### Go Application Security

- Ensure all Go dependencies are up to date.
- Follow best security practices for Go applications.


---

For detailed guidelines and examples, always refer to: @https://github.com/giantswarm/fmt/


<!--
DO NOT EDIT. Generated with devctl.
This file is maintained at:
https://github.com/giantswarm/devctl/blob/3bbd5cb47ff855f0b9c88881fbdcaa907d85647c/pkg/gen/input/llm/internal/file/base_llm_rules.mdc.template
Manual changes will be overwritten.
-->
35 changes: 35 additions & 0 deletions .cursor/rules/zz_generated.go-llm-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
description: Go language-specific development guidelines and patterns
globs: **/*.go,go.mod,go.sum
---

These guidelines apply to Go code and supplement any other general development instructions or workflows.

# Go Code Guidelines

- All Go code is expected to adhere to the rules outlined in the Giant Swarm style guide located at @https://github.com/giantswarm/fmt/tree/main/go .
- Always fetch and fully understand the style guide before reviewing any code.
- The Giant Swarm style guide linked above must always be considered definitive. ALL rules and provisions contained in the style guide MUST be met.
- When applying the style guide, always list all instances of a particular issue, grouped by the finding type.

## Formatting

CI will perform the following check for proper code formatting and sorting/grouping of imports:

```bash
go install golang.org/x/tools/cmd/goimports@latest && \
if [[ -n $(goimports -local github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} -l .) ]];
then
goimports -local github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} -d . && exit 1;
fi
```

When creating or modifying Go files, perform the according check and mitigate any issues before committing.


<!--
DO NOT EDIT. Generated with devctl.
This file is maintained at:
https://github.com/giantswarm/devctl/blob/83dbeb7aedca2abc8fd38c99e3cfa49f58d8ff82/pkg/gen/input/llm/internal/file/go_rules.mdc.template
Manual changes will be overwritten.
-->
2 changes: 1 addition & 1 deletion .github/workflows/pre_commit_go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
go-version: "1.25"
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/goimports@v0.34.0
go install golang.org/x/tools/cmd/goimports@v0.40.0
- name: Install golangci-lint
uses: giantswarm/install-binary-action@c37eb401e5092993fc76d545030b1d1769e61237 # v3.0.0
with:
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/zz_generated.create_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/063b90515fe92a8350c734f2caea0343ae3aca64/pkg/gen/input/workflows/internal/file/create_release.yaml.template
# https://github.com/giantswarm/devctl/blob/1acd23e6a78c21ca61ccbe8a7e5a8a3139feeab5/pkg/gen/input/workflows/internal/file/create_release.yaml.template
#
name: Create Release
on:
Expand All @@ -14,6 +14,9 @@ on:
- 'release-v*.*.x'
# "!" negates previous positive patterns so it has to be at the end.
- '!release-v*.x.x'

permissions: {}

jobs:
debug_info:
name: Debug info
Expand All @@ -27,6 +30,8 @@ jobs:
gather_facts:
name: Gather facts
runs-on: ubuntu-22.04
permissions:
contents: read
outputs:
project_go_path: ${{ steps.get_project_go_path.outputs.path }}
ref_version: ${{ steps.ref_version.outputs.refversion }}
Expand Down Expand Up @@ -54,7 +59,7 @@ jobs:
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Checkout code
if: ${{ steps.get_version.outputs.version != '' }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get project.go path
id: get_project_go_path
if: ${{ steps.get_version.outputs.version != '' }}
Expand Down Expand Up @@ -85,25 +90,27 @@ jobs:
update_project_go:
name: Update project.go
runs-on: ubuntu-22.04
permissions:
contents: read
if: ${{ needs.gather_facts.outputs.version != '' && needs.gather_facts.outputs.project_go_path != '' && needs.gather_facts.outputs.ref_version != 'true' }}
needs:
- gather_facts
steps:
- name: Install architect
uses: giantswarm/install-binary-action@0797deb878056114fa54ee30c519f617716e8c69 # v3.1.1
uses: giantswarm/install-binary-action@c94c7adadeb14af4bdbdd601f9a6e7f69638134c # v4.0.0
with:
binary: "architect"
version: "6.14.1"
- name: Install semver
uses: giantswarm/install-binary-action@0797deb878056114fa54ee30c519f617716e8c69 # v3.1.1
uses: giantswarm/install-binary-action@c94c7adadeb14af4bdbdd601f9a6e7f69638134c # v4.0.0
with:
binary: "semver"
version: "3.2.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Update project.go
id: update_project_go
env:
Expand Down Expand Up @@ -156,14 +163,16 @@ jobs:
create_release:
name: Create release
runs-on: ubuntu-22.04
permissions:
contents: read
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
outputs:
upload_url: ${{ steps.create_gh_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.sha }}
- name: Ensure correct version in project.go
Expand Down Expand Up @@ -204,20 +213,22 @@ jobs:
create-release-branch:
name: Create release branch
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
steps:
- name: Install semver
uses: giantswarm/install-binary-action@0797deb878056114fa54ee30c519f617716e8c69 # v3.1.1
uses: giantswarm/install-binary-action@c94c7adadeb14af4bdbdd601f9a6e7f69638134c # v4.0.0
with:
binary: "semver"
version: "3.0.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Check out the repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Clone the whole history, not just the most recent commit.
- name: Fetch all tags and branches
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/zz_generated.create_release_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/ad0a25fbf301b2513e169ec964a8785d28f75be4/pkg/gen/input/workflows/internal/file/create_release_pr.yaml.template
# https://github.com/giantswarm/devctl/blob/87f30fd3b955a0daf6017834a776c222d93a207c/pkg/gen/input/workflows/internal/file/create_release_pr.yaml.template
#
name: Create Release PR
on:
Expand Down Expand Up @@ -30,9 +30,13 @@ on:
required: true
type: string

permissions: {}

jobs:
publish:
uses: giantswarm/github-workflows/.github/workflows/create-release-pr.yaml@main
permissions:
contents: read
with:
branch: ${{ inputs.branch }}
secrets:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/zz_generated.fix_vulnerabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/251fa7d9bd403e23321bad6714c1e26c375fedf3/pkg/gen/input/workflows/internal/file/fix_vulnerabilities.yaml.template
# https://github.com/giantswarm/devctl/blob/87f30fd3b955a0daf6017834a776c222d93a207c/pkg/gen/input/workflows/internal/file/fix_vulnerabilities.yaml.template
#

name: Fix Go vulnerabilities
Expand All @@ -16,12 +16,21 @@ on:
description: Branch on which to fix vulnerabilities
required: true
type: string
log_level:
description: Log Level (info / error / debug)
default: "info"
type: string

permissions: {}

jobs:
fix:
uses: giantswarm/github-workflows/.github/workflows/fix-vulnerabilities.yaml@main
permissions:
contents: read
with:
branch: ${{ inputs.branch || github.ref }}
log_level: ${{ inputs.log_level }}
secrets:
HERALD_APP_ID: ${{ secrets.HERALD_APP_ID }}
HERALD_APP_KEY: ${{ secrets.HERALD_APP_KEY }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/zz_generated.gitleaks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/ad0a25fbf301b2513e169ec964a8785d28f75be4/pkg/gen/input/workflows/internal/file/gitleaks.yaml.template
# https://github.com/giantswarm/devctl/blob/87f30fd3b955a0daf6017834a776c222d93a207c/pkg/gen/input/workflows/internal/file/gitleaks.yaml.template
#
name: gitleaks

on:
- pull_request

permissions: {}

jobs:
publish:
uses: giantswarm/github-workflows/.github/workflows/gitleaks.yaml@main
permissions:
contents: read
8 changes: 7 additions & 1 deletion .github/workflows/zz_generated.run_ossf_scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/ad0a25fbf301b2513e169ec964a8785d28f75be4/pkg/gen/input/workflows/internal/file/run_ossf_scorecard.yaml.template
# https://github.com/giantswarm/devctl/blob/87f30fd3b955a0daf6017834a776c222d93a207c/pkg/gen/input/workflows/internal/file/run_ossf_scorecard.yaml.template
#

# This workflow uses actions that are not certified by GitHub. They are provided
Expand All @@ -24,8 +24,14 @@ on:
- master
workflow_dispatch: {}

permissions: {}

jobs:
analysis:
uses: giantswarm/github-workflows/.github/workflows/ossf-scorecard.yaml@main
permissions:
contents: read
security-events: write
id-token: write
secrets:
scorecard_token: ${{ secrets.SCORECARD_TOKEN }}
9 changes: 5 additions & 4 deletions .github/workflows/zz_generated.validate_changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# devctl
#
# https://github.com/giantswarm/devctl/blob/ad0a25fbf301b2513e169ec964a8785d28f75be4/pkg/gen/input/workflows/internal/file/validate_changelog.yaml.template
# https://github.com/giantswarm/devctl/blob/87f30fd3b955a0daf6017834a776c222d93a207c/pkg/gen/input/workflows/internal/file/validate_changelog.yaml.template
#
name: Validate changelog

Expand All @@ -12,10 +12,11 @@ on:
paths:
- 'CHANGELOG.md'

permissions:
contents: read
pull-requests: write
permissions: {}

jobs:
validate-changelog:
uses: giantswarm/github-workflows/.github/workflows/validate-changelog.yaml@main
permissions:
contents: read
pull-requests: write
Loading