orquesta-cli 0.2.31 → 0.2.32

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.
@@ -3,16 +3,32 @@ import { logger } from '../utils/logger.js';
3
3
  import { readHookConfig } from './hook-init.js';
4
4
  const ORQUESTA_API = process.env['ORQUESTA_API_URL'] || 'https://getorquesta.com';
5
5
  export async function fetchOrquestaProjects(token) {
6
+ let response;
6
7
  try {
7
- const response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/projects`, {
8
+ response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/projects`, {
8
9
  headers: {
9
10
  Authorization: `Bearer ${token}`,
10
11
  'Content-Type': 'application/json',
11
12
  },
12
13
  });
13
- if (!response.ok) {
14
- return null;
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ if (response.status === 401) {
19
+ let detail = 'token has been revoked';
20
+ try {
21
+ const body = (await response.json());
22
+ if (body?.error)
23
+ detail = body.error.toLowerCase();
15
24
  }
25
+ catch { }
26
+ throw new Error(`Your Orquesta session has expired (${detail}). Run \`orquesta --login\` (or /login) to sign in again.`);
27
+ }
28
+ if (!response.ok) {
29
+ return null;
30
+ }
31
+ try {
16
32
  return (await response.json());
17
33
  }
18
34
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquesta-cli",
3
- "version": "0.2.31",
3
+ "version": "0.2.32",
4
4
  "description": "Orquesta CLI - AI-powered coding assistant with team collaboration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",