Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
debdd4a
feat: implement Config pattern using functional options with defaults…
iYashMaurya Mar 2, 2026
d3b59e0
feat: add LocalizationParams struct for localization parameters
iYashMaurya Mar 2, 2026
e50cede
refactor: improve naming consistency, centralize error handling, and …
iYashMaurya Mar 2, 2026
43aff63
feat: introduce Client with configurable initialization and HTTP client
iYashMaurya Mar 2, 2026
5365041
feat: add custom valueError type for structured error handling
iYashMaurya Mar 4, 2026
bbf33bb
refactor: standardize error handling using custom error type in Confi…
iYashMaurya Mar 4, 2026
83289c7
refactor: introduce new RuntimeError error and fix ValueError visibility
iYashMaurya Mar 4, 2026
cae49cc
feat: add truncateResponse and safeParseJSON utilities
iYashMaurya Mar 4, 2026
0f6817d
feat: implement http request execution with response parsing and erro…
iYashMaurya Mar 5, 2026
bf04b74
feat: add request models for localization api payload
iYashMaurya Mar 5, 2026
5db4ab3
feat: add recursive word counting utility for request payload
iYashMaurya Mar 5, 2026
191e477
feat: add exponential backoff retry logic to do method
iYashMaurya Mar 26, 2026
a4fbee6
feat: implement localizeRaw orchestrator
iYashMaurya Mar 26, 2026
8b4c61a
feat: implement LocalizeText and LocalizeObject
iYashMaurya Mar 26, 2026
3e9d762
feat: implement LocalizeChat
iYashMaurya Mar 26, 2026
4b0acea
feat: implement RecognizeLocale and WhoAmI
iYashMaurya Mar 26, 2026
bb66680
feat: implement batch localization methods
iYashMaurya Mar 26, 2026
cbc422d
test: add comprehensive unit and integration tests
iYashMaurya Mar 26, 2026
c97e641
chore: add Makefile and CI/CD pipeline for automated testing
iYashMaurya Mar 27, 2026
97d4c09
chore: add git-chglog for automated changelog generation
iYashMaurya Mar 27, 2026
d627b6a
refactor: make do return full JSON response, let callers extract fields
iYashMaurya Mar 27, 2026
475e225
chores: add example for reference and populated readme
iYashMaurya Mar 27, 2026
19d31f4
chore: add .gitignore
iYashMaurya Mar 27, 2026
b6ef38b
refactor: complete codebase review fixes
iYashMaurya Mar 27, 2026
2ece32c
fix: correct coverage reporting and test filter regex
iYashMaurya Mar 27, 2026
bb45a43
Update Discord community link in README
iYashMaurya Mar 27, 2026
beb023c
Update README.md
iYashMaurya Mar 27, 2026
60540cb
fix: address code review findings from CodeRabbit
iYashMaurya Mar 27, 2026
85cda55
fix: capture loop variables for Go 1.21 compatibility
iYashMaurya Mar 27, 2026
b05e900
Update client.go
iYashMaurya Mar 27, 2026
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
30 changes: 30 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})

{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
35 changes: 35 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/lingodotdev/sdk-go

options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- docs
- chore
- test
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
docs: Documentation
chore: Maintenance
test: Tests
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\!?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Description
Brief description of the changes in this PR.

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring

## Testing
- [ ] Tests pass locally
- [ ] New tests added for new functionality
- [ ] Integration tests pass

## Checklist
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] New and existing unit tests pass locally with my changes

## Commit Message Format
Please ensure your commit messages follow the conventional commits format:
- `feat: add new feature`
- `fix: resolve bug`
- `docs: update documentation`
- `style: format code`
- `refactor: refactor code`
- `test: add tests`
- `chore: update dependencies`
60 changes: 60 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Pull Request

on:
pull_request:
branches: [main]

jobs:
test:
name: Test Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22']
env:
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Download dependencies
run: go mod tidy

- name: Verify dependencies
run: go mod verify

- name: Build
run: make build

- name: Vet
run: make vet

- name: Format check
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "The following files are not formatted:"
gofmt -l .
exit 1
fi

- name: Unit tests with coverage
run: go test ./tests/... -skip "TestRealAPI" -v -count=1 -timeout 60s -coverpkg=github.com/lingodotdev/sdk-go -coverprofile=coverage.out

- name: Upload coverage
if: matrix.go-version == '1.22'
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false

- name: Integration tests
if: env.LINGODOTDEV_API_KEY != ''
run: make test-integration
167 changes: 167 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Release

on:
push:
branches: [main]

jobs:
test:
name: Test Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Download dependencies
run: go mod tidy

- name: Verify dependencies
run: go mod verify

- name: Build
run: make build

- name: Vet
run: make vet

- name: Unit tests with coverage
run: go test ./tests/... -skip "TestRealAPI" -v -count=1 -timeout 60s -coverpkg=github.com/lingodotdev/sdk-go -coverprofile=coverage.out

- name: Upload coverage
if: matrix.go-version == '1.22'
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false

integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true

- name: Download dependencies
run: go mod tidy

- name: Verify dependencies
run: go mod verify

- name: Integration tests
env:
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}
run: make test-integration

release:
name: Release
runs-on: ubuntu-latest
needs: [test, integration]
if: always() && needs.test.result == 'success' && (needs.integration.result == 'success' || needs.integration.result == 'skipped')
concurrency: release
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true

- name: Install git-chglog
run: go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest

- name: Check for version tag
id: check_tag
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
COMMITS_SINCE=$(git rev-list ${LATEST_TAG}..HEAD --count 2>/dev/null || echo "0")
if [ "$COMMITS_SINCE" -gt "0" ]; then
echo "release_needed=true" >> $GITHUB_OUTPUT
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "Release needed: $COMMITS_SINCE commits since $LATEST_TAG"
else
echo "release_needed=false" >> $GITHUB_OUTPUT
echo "No new commits since $LATEST_TAG"
fi

- name: Determine next version
if: steps.check_tag.outputs.release_needed == 'true'
id: next_version
run: |
LATEST_TAG=${{ steps.check_tag.outputs.latest_tag }}
VERSION=${LATEST_TAG#v}
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"

COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" 2>/dev/null || git log --pretty=format:"%s")

if echo "$COMMITS" | grep -qiE "^(feat|feature)(\(.+\))?!:|BREAKING CHANGE"; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi

NEXT_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo "Next version: $NEXT_VERSION"

- name: Generate changelog
if: steps.check_tag.outputs.release_needed == 'true'
run: |
git-chglog --next-tag ${{ steps.next_version.outputs.version }} -o CHANGELOG.md

- name: Commit changelog
if: steps.check_tag.outputs.release_needed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "chore: update CHANGELOG for ${{ steps.next_version.outputs.version }}" || echo "No changes to commit"
git push
Comment on lines +144 to +151
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there's any documentation about branch protection or release workflow setup
fd -e md | xargs -I {} grep -l -i "branch protection\|release workflow\|bot\|token" {} 2>/dev/null || echo "No relevant documentation found"

Repository: lingodotdev/sdk-go

Length of output: 93


🏁 Script executed:

cat -n .github/workflows/release.yml

Repository: lingodotdev/sdk-go

Length of output: 6021


🏁 Script executed:

fd -type f -name "*.yml" -o -name "*.yaml" | xargs grep -l "branch.*protection\|protection.*rule\|bypass" 2>/dev/null || echo "No branch protection config found"

Repository: lingodotdev/sdk-go

Length of output: 283


🏁 Script executed:

find . -type f \( -name "*.json" -o -name "*.toml" -o -name "*.yaml" -o -name "*.yml" \) | head -20

Repository: lingodotdev/sdk-go

Length of output: 141


🏁 Script executed:

# Check git configuration or any special setup
find .github -type f | head -20

Repository: lingodotdev/sdk-go

Length of output: 149


🏁 Script executed:

ls -la | grep -i readme

Repository: lingodotdev/sdk-go

Length of output: 121


🏁 Script executed:

git log --oneline -20 | head -20

Repository: lingodotdev/sdk-go

Length of output: 123


🏁 Script executed:

head -100 README.md

Repository: lingodotdev/sdk-go

Length of output: 2889


Direct push requires either a PAT with bypass permissions or disabling branch protection for the bot.

The workflow uses GITHUB_TOKEN with contents: write, which does not bypass branch protection rules requiring pull requests or reviews. If the main branch is protected with PR requirements, the git push at line 151 will fail. Either:

  1. Use a Personal Access Token (PAT) with appropriate scopes, or
  2. Create a bot account with bypass permissions and use its token, or
  3. Configure branch protection rules to allow the github-actions[bot] account to push directly, or
  4. Document this as a prerequisite for the release workflow
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 144 - 151, The "Commit changelog"
job currently performs a direct git push using the default GITHUB_TOKEN which
cannot bypass branch protection, so update the step to either (A) use a PAT/bot
token stored in a secret (e.g., replace git push with setting git remote to
https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{
github.repository }}.git before pushing) and ensure the secret has
repo:status/contents/write and bypass protections, or (B) document in the
workflow README that branch protection must allow github-actions[bot] pushes;
modify the step named "Commit changelog" (which checks
steps.check_tag.outputs.release_needed and uses
steps.next_version.outputs.version) to use the chosen approach so the git push
will succeed under protected branches.


- name: Create GitHub release
if: steps.check_tag.outputs.release_needed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ steps.next_version.outputs.version }}
git tag "$VERSION"
git push origin "$VERSION"

NOTES=$(git-chglog --next-tag "$VERSION" "$VERSION")

gh release create "$VERSION" \
--title "$VERSION" \
--notes "$NOTES" \
--latest
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Coverage
coverage.out

# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary
*.test

# Go workspace
go.work
go.work.sum

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to this project will be documented in this file.
Loading