@vibecodr/cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ - preserve encrypted offline sessions when refresh fails because the authorization server is temporarily unavailable
6
+ - continue clearing stored auth on OAuth `invalid_grant` so revoked or expired refresh tokens fail closed
7
+
3
8
  ## 0.2.0
4
9
 
5
10
  - rename the npm package to `@vibecodr/cli` while keeping `vibecodr` as the primary executable and `vibecodr-mcp` as a compatibility alias
@@ -23,6 +23,12 @@ function computeExpiresAt(expiresIn) {
23
23
  return undefined;
24
24
  return new Date(Date.now() + expiresIn * 1000).toISOString();
25
25
  }
26
+ function oauthErrorCode(error) {
27
+ if (!error || typeof error !== "object")
28
+ return undefined;
29
+ const code = error.errorCode;
30
+ return typeof code === "string" ? code : undefined;
31
+ }
26
32
  function normalizeServerUrlForSessionMatch(value) {
27
33
  if (!value)
28
34
  return undefined;
@@ -285,10 +291,17 @@ export class TokenManager {
285
291
  resource,
286
292
  ...(discovery.authorizationServerMetadata ? { metadata: discovery.authorizationServerMetadata } : {})
287
293
  }).catch(async (error) => {
288
- await this.secretStore.delete(profileName).catch(() => undefined);
289
- throw new CliError("auth.refresh_failed", "Failed to refresh the stored session.", EXIT_CODES.authFailed, {
294
+ const invalidGrant = oauthErrorCode(error) === "invalid_grant";
295
+ if (invalidGrant) {
296
+ await this.secretStore.delete(profileName).catch(() => undefined);
297
+ }
298
+ throw new CliError("auth.refresh_failed", invalidGrant
299
+ ? "The stored refresh token is invalid or expired."
300
+ : "Failed to refresh the stored session.", EXIT_CODES.authFailed, {
290
301
  cause: error,
291
- nextStep: "Run vibecodr login to re-authenticate."
302
+ nextStep: invalidGrant
303
+ ? "Run vibecodr login to re-authenticate."
304
+ : "Retry after the authorization server recovers. The stored offline session was preserved."
292
305
  });
293
306
  });
294
307
  const updated = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecodr/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Vibecodr CLI for login, live MCP tool discovery, and live tool invocation.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",