orquesta-cli 0.2.30 → 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.
@@ -1,17 +1,34 @@
1
1
  import { configManager } from '../core/config/config-manager.js';
2
2
  import { logger } from '../utils/logger.js';
3
+ import { readHookConfig } from './hook-init.js';
3
4
  const ORQUESTA_API = process.env['ORQUESTA_API_URL'] || 'https://getorquesta.com';
4
5
  export async function fetchOrquestaProjects(token) {
6
+ let response;
5
7
  try {
6
- const response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/projects`, {
8
+ response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/projects`, {
7
9
  headers: {
8
10
  Authorization: `Bearer ${token}`,
9
11
  'Content-Type': 'application/json',
10
12
  },
11
13
  });
12
- if (!response.ok) {
13
- 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();
14
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 {
15
32
  return (await response.json());
16
33
  }
17
34
  catch {
@@ -194,6 +211,8 @@ export async function submitPromptToOrquesta(prompt) {
194
211
  if (!orquestaConfig?.token) {
195
212
  return { success: false, error: 'Not connected to Orquesta' };
196
213
  }
214
+ const cwd = prompt.context?.['cwd'] || process.cwd();
215
+ const effectiveProjectId = readHookConfig(cwd)?.projectId || orquestaConfig.projectId;
197
216
  try {
198
217
  const response = await fetch(`${ORQUESTA_API}/api/orquesta-cli/prompts`, {
199
218
  method: 'POST',
@@ -206,6 +225,7 @@ export async function submitPromptToOrquesta(prompt) {
206
225
  context: prompt.context,
207
226
  cliType: 'orquesta-cli',
208
227
  llmConfig: prompt.llmConfig,
228
+ projectId: effectiveProjectId,
209
229
  }),
210
230
  });
211
231
  if (!response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquesta-cli",
3
- "version": "0.2.30",
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",