style: fix pint issues in ContentService and AgentToolRegistryTest
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
938081f2f5
commit
6cd9ca09d7
2 changed files with 38 additions and 8 deletions
|
|
@ -172,11 +172,13 @@ class ContentService
|
||||||
if ($progress !== null) {
|
if ($progress !== null) {
|
||||||
$progress['articles'][$slug]['status'] = 'skipped';
|
$progress['articles'][$slug]['status'] = 'skipped';
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dryRun) {
|
if ($dryRun) {
|
||||||
$results['articles'][$slug] = ['status' => 'would_generate', 'path' => $draftPath];
|
$results['articles'][$slug] = ['status' => 'would_generate', 'path' => $draftPath];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,6 +186,7 @@ class ContentService
|
||||||
if (($progress['articles'][$slug]['status'] ?? 'pending') === 'generated') {
|
if (($progress['articles'][$slug]['status'] ?? 'pending') === 'generated') {
|
||||||
$results['articles'][$slug] = ['status' => 'skipped', 'reason' => 'previously generated'];
|
$results['articles'][$slug] = ['status' => 'skipped', 'reason' => 'previously generated'];
|
||||||
$results['skipped']++;
|
$results['skipped']++;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,35 @@ function makeTool(string $name, array $scopes = [], string $category = 'test'):
|
||||||
private readonly string $toolCategory,
|
private readonly string $toolCategory,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function name(): string { return $this->toolName; }
|
public function name(): string
|
||||||
public function description(): string { return 'Test tool'; }
|
{
|
||||||
public function inputSchema(): array { return []; }
|
return $this->toolName;
|
||||||
public function handle(array $args, array $context = []): array { return ['success' => true]; }
|
}
|
||||||
public function requiredScopes(): array { return $this->toolScopes; }
|
|
||||||
public function category(): string { return $this->toolCategory; }
|
public function description(): string
|
||||||
|
{
|
||||||
|
return 'Test tool';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function inputSchema(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(array $args, array $context = []): array
|
||||||
|
{
|
||||||
|
return ['success' => true];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requiredScopes(): array
|
||||||
|
{
|
||||||
|
return $this->toolScopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(): string
|
||||||
|
{
|
||||||
|
return $this->toolCategory;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,6 +74,7 @@ function makeApiKey(int $id, array $scopes = [], ?array $toolScopes = null): Api
|
||||||
$key = new class($id, $scopes, $toolScopes) extends ApiKey
|
$key = new class($id, $scopes, $toolScopes) extends ApiKey
|
||||||
{
|
{
|
||||||
private int $keyId;
|
private int $keyId;
|
||||||
|
|
||||||
private array $keyScopes;
|
private array $keyScopes;
|
||||||
|
|
||||||
public function __construct(int $id, array $scopes, ?array $toolScopes)
|
public function __construct(int $id, array $scopes, ?array $toolScopes)
|
||||||
|
|
@ -61,7 +85,10 @@ function makeApiKey(int $id, array $scopes = [], ?array $toolScopes = null): Api
|
||||||
$this->attributes['tool_scopes'] = $toolScopes;
|
$this->attributes['tool_scopes'] = $toolScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getKey(): mixed { return $this->keyId; }
|
public function getKey(): mixed
|
||||||
|
{
|
||||||
|
return $this->keyId;
|
||||||
|
}
|
||||||
|
|
||||||
public function hasScope(string $scope): bool
|
public function hasScope(string $scope): bool
|
||||||
{
|
{
|
||||||
|
|
@ -113,7 +140,7 @@ describe('forApiKey caching', function () {
|
||||||
|
|
||||||
$apiKey = makeApiKey(1, ['plans.write']);
|
$apiKey = makeApiKey(1, ['plans.write']);
|
||||||
|
|
||||||
$first = $registry->forApiKey($apiKey)->keys()->all();
|
$first = $registry->forApiKey($apiKey)->keys()->all();
|
||||||
$second = $registry->forApiKey($apiKey)->keys()->all();
|
$second = $registry->forApiKey($apiKey)->keys()->all();
|
||||||
|
|
||||||
expect($second)->toBe($first);
|
expect($second)->toBe($first);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue