feat: initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
## General Guidelines for Code Generation
|
||||
|
||||
- **Overall Style:**
|
||||
- Write clear, concise, and well-commented code.
|
||||
- Follow idiomatic coding practices that prioritize readability, maintainability, and simplicity.
|
||||
- Apply the DRY (Don't Repeat Yourself) principle to avoid duplication.
|
||||
|
||||
## Backend (Go) Specifics
|
||||
|
||||
- **Routing & Handlers:**
|
||||
|
||||
- Use go-chi for routing and maintain a modular structure.
|
||||
- Write handler functions that perform one clear task: parsing requests, interacting with PostgreSQL, and returning JSON responses.
|
||||
- Include inline comments to explain complex logic and error handling.
|
||||
|
||||
- **Error Handling & Patterns:**
|
||||
|
||||
- Check for errors at each step and use context-aware patterns.
|
||||
- Use proper naming conventions (camelCase for variables and PascalCase for types).
|
||||
|
||||
- **Database & Caching:**
|
||||
- When interacting with PostgreSQL, use environment variables (e.g., `DATABASE_URL`) to read connection details and use parameterized queries to prevent SQL injection.
|
||||
- For Redis, initialize the client with context and perform error checking to ensure the connection is stable.
|
||||
|
||||
## Swagger Documentation
|
||||
|
||||
- **API Documentation:**
|
||||
- Generate Swagger (OpenAPI) YAML snippets to document each endpoint, including parameters, expected responses, and error messages.
|
||||
- Ensure the Swagger docs are clear and adhere to standardized formats.
|
||||
|
||||
## Frontend (NuxtJS) Specifics
|
||||
|
||||
- **Setup & Configuration:**
|
||||
- Assume a client-side only NuxtJS application.
|
||||
- Generate lightweight, reusable Vue components using the Composition API.
|
||||
- Use async/await syntax for API calls and refer to environment variables (e.g., API base URL) for configuration.
|
||||
|
||||
## Commit & PR Messaging
|
||||
|
||||
- **Descriptive Messaging:**
|
||||
- When generating commit messages or pull request descriptions, include:
|
||||
- A short summary of the changes.
|
||||
- The reason for the changes.
|
||||
- Optionally, emojis to indicate the type of update (e.g., :sparkles: for features, :bug: for fixes).
|
||||
|
||||
## Additional Guidance & Context
|
||||
|
||||
- **Suggestions & Improvements:**
|
||||
- When proposing code changes, suggest alternative approaches or improvements, particularly around error handling, security, and performance optimization.
|
||||
- Ask clarifying questions if the context is unclear to ensure alignment with project requirements.
|
||||
@@ -0,0 +1,39 @@
|
||||
name: Audit
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23.4"
|
||||
|
||||
- name: Verify dependencies
|
||||
run: go mod tidy
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
|
||||
- name: Run go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Install staticcheck
|
||||
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||
|
||||
- name: Run staticcheck
|
||||
run: staticcheck ./...
|
||||
|
||||
- name: Run Staticcheck
|
||||
run: staticcheck ./...
|
||||
|
||||
- name: Run tests
|
||||
run: go test -race ./...
|
||||
@@ -0,0 +1,24 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
name: Release Please
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: googleapis/release-please-action@v4
|
||||
with:
|
||||
# this assumes that you have created a personal access token
|
||||
# (PAT) and configured it as a GitHub action secret named
|
||||
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
|
||||
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
|
||||
# this is a built-in strategy in release-please, see "Action Inputs"
|
||||
# for more options
|
||||
release-type: simple
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Update Version and Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Extract latest version from CHANGELOG.md
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(grep -oP '\[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | head -1)
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update version in cmd/api/main.go
|
||||
run: |
|
||||
sed -i "s/const version = \".*\"/const version = \"${{ steps.get_version.outputs.VERSION }}\"/" cmd/api/main.go
|
||||
|
||||
- name: Commit and push if changed
|
||||
run: |
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "GitHub Action"
|
||||
git add cmd/api/main.go
|
||||
git commit -m "Update version to ${{ steps.get_version.outputs.VERSION }}" || echo "No changes to commit"
|
||||
git push
|
||||
Reference in New Issue
Block a user