Skip to content

Commit 8710583

Browse files
committed
Store upgrade version in context instead of displaying immediately
- AuthCommand returns SUCCESS instead of FAILURE when no authentication configured - CheckForUpdates pipeline step now stores available upgrade version in SessionContext instead of displaying it via prompt - Updated tests to verify context state instead of prompt output
1 parent 18dd436 commit 8710583

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

app/Commands/AuthCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ protected function showStatus(AuthManager $auth): int
3838
warning('No authentication configured.');
3939
note('Run `clave auth` to set up a Claude Code token.');
4040

41-
return self::FAILURE;
41+
return self::SUCCESS;
4242
}
43-
43+
4444
$method_label = match ($info['method']) {
4545
'api_key' => 'API Key',
4646
'oauth' => 'OAuth Token',

tests/Feature/Pipelines/Steps/CheckForUpdatesTest.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use App\Pipelines\Steps\CheckForUpdates;
55
use Illuminate\Http\Client\ConnectionException;
66
use Illuminate\Support\Facades\Http;
7-
use Laravel\Prompts\Prompt;
87

98
function makeUpdateContext(): SessionContext
109
{
@@ -24,7 +23,6 @@ function makeUpdateContext(): SessionContext
2423
]),
2524
]);
2625

27-
Prompt::fake();
2826

2927
$step = app(CheckForUpdates::class);
3028
$context = makeUpdateContext();
@@ -38,20 +36,18 @@ function makeUpdateContext(): SessionContext
3836

3937
expect($next_called)->toBeTrue();
4038
expect($result)->toBe($context);
41-
42-
Prompt::assertStrippedOutputDoesntContain('new version of Clave is available');
39+
expect($context->upgrade_version_available)->toBeNull();
4340

4441
Http::assertSentCount(1);
4542
});
4643

47-
test('shows update notice when newer version is available', function() {
44+
test('stores upgrade version when newer version is available', function() {
4845
Http::fake([
4946
'api.github.com/repos/glhd/clave/releases/latest' => Http::response([
5047
'tag_name' => 'v99.99.99',
5148
]),
5249
]);
5350

54-
Prompt::fake();
5551

5652
$step = app(CheckForUpdates::class);
5753
$context = makeUpdateContext();
@@ -65,18 +61,14 @@ function makeUpdateContext(): SessionContext
6561

6662
expect($next_called)->toBeTrue();
6763
expect($result)->toBe($context);
68-
69-
Prompt::assertStrippedOutputContains('new version of Clave is available');
70-
Prompt::assertStrippedOutputContains('v99.99.99');
64+
expect($context->upgrade_version_available)->toBe('99.99.99');
7165

7266
Http::assertSentCount(1);
7367
});
7468

7569
test('passes through silently when the HTTP request fails', function() {
7670
Http::fake(fn() => throw new ConnectionException('Connection timed out'));
7771

78-
Prompt::fake();
79-
8072
$step = app(CheckForUpdates::class);
8173
$context = makeUpdateContext();
8274

@@ -89,8 +81,7 @@ function makeUpdateContext(): SessionContext
8981

9082
expect($next_called)->toBeTrue();
9183
expect($result)->toBe($context);
92-
93-
Prompt::assertStrippedOutputDoesntContain('new version of Clave is available');
84+
expect($context->upgrade_version_available)->toBeNull();
9485
});
9586

9687
test('passes through silently when response is missing tag_name', function() {
@@ -100,7 +91,6 @@ function makeUpdateContext(): SessionContext
10091
]),
10192
]);
10293

103-
Prompt::fake();
10494

10595
$step = app(CheckForUpdates::class);
10696
$context = makeUpdateContext();
@@ -114,8 +104,7 @@ function makeUpdateContext(): SessionContext
114104

115105
expect($next_called)->toBeTrue();
116106
expect($result)->toBe($context);
117-
118-
Prompt::assertStrippedOutputDoesntContain('new version of Clave is available');
107+
expect($context->upgrade_version_available)->toBeNull();
119108

120109
Http::assertSentCount(1);
121110
});

0 commit comments

Comments
 (0)