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
75 changes: 75 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Claude PR Review with Progress Tracking

# This example demonstrates how to use the track_progress feature to get
# visual progress tracking for PR reviews, similar to v0.x agent mode.

on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
workflow_dispatch:

jobs:
review-with-tracking:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1

- name: Claude PR Review with Progress Tracking
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

# Enable progress tracking
track_progress: true

# Your custom review instructions
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Perform a comprehensive code review with the following focus areas:

1. **Code Quality**
- Clean code principles and best practices
- Proper error handling and edge cases
- Code readability and maintainability

2. **Security**
- Check for potential security vulnerabilities
- Validate input sanitization
- Review authentication/authorization logic

3. **Performance**
- Identify potential performance bottlenecks
- Review database queries for efficiency
- Check for memory leaks or resource issues

4. **Testing**
- Verify adequate test coverage
- Review test quality and edge cases
- Check for missing test scenarios

5. **Documentation**
- Ensure code is properly documented
- Verify README updates for new features
- Check API documentation accuracy

Provide detailed feedback using inline comments for specific issues.
Use top-level comments for general observations or praise.

# Tools for comprehensive PR review
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"

# When track_progress is enabled:
# - Creates a tracking comment with progress checkboxes
# - Includes all PR context (comments, attachments, images)
# - Updates progress as the review proceeds
# - Marks as completed when done
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "smartling/wordpress-connector",
"license": "GPL-2.0-or-later",
"version": "5.2.0",
"version": "5.3.0",
"description": "",
"type": "wordpress-plugin",
"repositories": [
Expand All @@ -19,7 +19,7 @@
"symfony/expression-language": "~5.4",
"symfony/config": "~5.4",
"symfony/yaml": "~5.4",
"smartling/api-sdk-php": "3.9.2",
"smartling/api-sdk-php": "5.0.5",
"ext-dom": "*",
"ext-libxml": "*",
"ext-json": "*"
Expand Down
100 changes: 89 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions inc/Smartling/ApiWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,22 @@ public function acquireLock(ConfigurationProfileEntity $profile, string $key, in
->acquireLock("{$profile->getProjectId()}-$key", $ttlSeconds);
}

/**
* @throws SmartlingApiException
*/
public function getSourceLocale(ConfigurationProfileEntity $profile): string
{
$api = ProjectApi::create(
$this->getAuthProvider($profile),
$profile->getProjectId(),
$this->getLogger()
);

$details = $api->getProjectDetails();

return $details['sourceLocaleId'];
}

public function renewLock(ConfigurationProfileEntity $profile, string $key, int $ttlSeconds): \DateTime
{
return DistributedLockServiceApi::create($this->getAuthProvider($profile), $profile->getProjectId(), $this->getLogger())
Expand Down
2 changes: 2 additions & 0 deletions inc/Smartling/ApiWrapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ interface ApiWrapperInterface
*/
public function acquireLock(ConfigurationProfileEntity $profile, string $key, int $ttlSeconds): \DateTime;

public function getSourceLocale(ConfigurationProfileEntity $profile): string;

/**
* @throws SmartlingApiException
*/
Expand Down
7 changes: 7 additions & 0 deletions inc/Smartling/ApiWrapperWithRetries.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public function acquireLock(ConfigurationProfileEntity $profile, string $key, in
});
}

public function getSourceLocale(ConfigurationProfileEntity $profile): string
{
return $this->withRetry(function () use ($profile) {
return $this->base->getSourceLocale($profile);
});
}

public function renewLock(ConfigurationProfileEntity $profile, string $key, int $ttlSeconds): \DateTime
{
return $this->withRetry(function () use ($profile, $key, $ttlSeconds) {
Expand Down
2 changes: 1 addition & 1 deletion inc/Smartling/Base/SmartlingCoreUploadTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

trait SmartlingCoreUploadTrait
{
private function renewContentHash(SubmissionEntity $submission): SubmissionEntity
public function renewContentHash(SubmissionEntity $submission): SubmissionEntity
{
$content = $this->getContentHelper()->readSourceContent($submission);
$newHash = $this->getContentSerializationHelper()->calculateHash($submission);
Expand Down
54 changes: 54 additions & 0 deletions inc/Smartling/FTS/FileTranslationsApiExtended.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace Smartling\FTS;

use Smartling\Vendor\GuzzleHttp\RequestOptions;
use Smartling\Vendor\Smartling\AuthApi\AuthApiInterface;
use Smartling\Vendor\Smartling\FileTranslations\FileTranslationsApi;

class FileTranslationsApiExtended extends FileTranslationsApi
{
private const SERVICE_ORIGIN_HEADER = 'X-SL-ServiceOrigin';
private const SERVICE_ORIGIN_VALUE = 'wordpress';

private array $additionalHeaders = [];

public function __construct($accountUid, $client, $logger = null, $service_url = null)
{
parent::__construct($accountUid, $client, $logger, $service_url);

$this->additionalHeaders[self::SERVICE_ORIGIN_HEADER] = self::SERVICE_ORIGIN_VALUE;
}

/**
* @param string $accountUid
*/
public static function create(
AuthApiInterface $authProvider,
$accountUid,
$logger = null,
): FileTranslationsApiExtended {
$client = self::initializeHttpClient(self::ENDPOINT_URL);

$instance = new self($accountUid, $client, $logger, self::ENDPOINT_URL);
$instance->setAuth($authProvider);

return $instance;
}

protected function getDefaultRequestData($parametersType, $parameters, $auth = true, $httpErrors = false): array
{
$data = parent::getDefaultRequestData($parametersType, $parameters, $auth, $httpErrors);

if (!isset($data[RequestOptions::HEADERS])) {
$data[RequestOptions::HEADERS] = [];
}

$data[RequestOptions::HEADERS] = array_merge(
$data[RequestOptions::HEADERS],
$this->additionalHeaders
);

return $data;
}
}
Loading
Loading