orquesta-cli 0.2.5 → 0.2.7

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.
@@ -4,5 +4,6 @@ export declare const CONFIG_FILE_PATH: string;
4
4
  export declare const DOCS_DIR: string;
5
5
  export declare const BACKUPS_DIR: string;
6
6
  export declare const PROJECTS_DIR: string;
7
+ export declare function cwdToProjectSegment(cwd?: string): string;
7
8
  export declare const APP_VERSION = "4.2.2";
8
9
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -6,5 +6,11 @@ export const CONFIG_FILE_PATH = path.join(LOCAL_HOME_DIR, 'config.json');
6
6
  export const DOCS_DIR = path.join(LOCAL_HOME_DIR, 'docs');
7
7
  export const BACKUPS_DIR = path.join(LOCAL_HOME_DIR, 'backups');
8
8
  export const PROJECTS_DIR = path.join(LOCAL_HOME_DIR, 'projects');
9
+ export function cwdToProjectSegment(cwd = process.cwd()) {
10
+ return cwd
11
+ .replace(/[/\\]/g, '-')
12
+ .replace(/[:*?"<>|]/g, '')
13
+ .replace(/^-+/, '');
14
+ }
9
15
  export const APP_VERSION = '4.2.2';
10
16
  //# sourceMappingURL=constants.js.map
@@ -322,11 +322,22 @@ export class ConfigManager {
322
322
  added++;
323
323
  }
324
324
  }
325
- if (!config.currentEndpoint && config.endpoints.length > 0) {
326
- config.currentEndpoint = config.endpoints[0].id;
327
- const firstModel = config.endpoints[0].models.find((m) => m.enabled);
328
- if (firstModel) {
329
- config.currentModel = firstModel.id;
325
+ const currentExists = !!config.currentEndpoint && config.endpoints.some((e) => e.id === config.currentEndpoint);
326
+ if (!currentExists && config.endpoints.length > 0) {
327
+ const fallback = config.endpoints.find((e) => e.provider === 'batuta' || e.id === 'batuta-proxy') ||
328
+ config.endpoints[0];
329
+ config.currentEndpoint = fallback.id;
330
+ const enabledModel = fallback.models.find((m) => m.enabled) || fallback.models[0];
331
+ if (enabledModel)
332
+ config.currentModel = enabledModel.id;
333
+ }
334
+ else if (currentExists) {
335
+ const ep = config.endpoints.find((e) => e.id === config.currentEndpoint);
336
+ const modelExists = ep.models.some((m) => m.id === config.currentModel);
337
+ if (!modelExists) {
338
+ const enabledModel = ep.models.find((m) => m.enabled) || ep.models[0];
339
+ if (enabledModel)
340
+ config.currentModel = enabledModel.id;
330
341
  }
331
342
  }
332
343
  await this.saveConfig();
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { configManager } from '../config/config-manager.js';
4
- import { PROJECTS_DIR } from '../../constants.js';
4
+ import { PROJECTS_DIR, cwdToProjectSegment } from '../../constants.js';
5
5
  import { initializeJsonStreamLogger } from '../../utils/json-stream-logger.js';
6
6
  import { logger } from '../../utils/logger.js';
7
7
  export class SessionManager {
@@ -13,8 +13,7 @@ export class SessionManager {
13
13
  this.currentSessionCreatedAt = new Date().toISOString();
14
14
  }
15
15
  getSessionsDir() {
16
- const cwd = process.cwd().replace(/\//g, '-').replace(/^-/, '');
17
- return path.join(PROJECTS_DIR, cwd);
16
+ return path.join(PROJECTS_DIR, cwdToProjectSegment());
18
17
  }
19
18
  normalizeMessages(messages) {
20
19
  return messages.map(msg => {
@@ -2,7 +2,7 @@ import { createWriteStream } from 'fs';
2
2
  import { mkdir, access, readFile, writeFile } from 'fs/promises';
3
3
  import { dirname, join } from 'path';
4
4
  import chalk from 'chalk';
5
- import { PROJECTS_DIR } from '../constants.js';
5
+ import { PROJECTS_DIR, cwdToProjectSegment } from '../constants.js';
6
6
  const FLUSH_INTERVAL_MS = 1000;
7
7
  function getLogCategory(type) {
8
8
  switch (type) {
@@ -787,7 +787,7 @@ export async function initializeJsonStreamLogger(sessionId, append = false, verb
787
787
  if (globalJsonStreamLogger) {
788
788
  await globalJsonStreamLogger.close();
789
789
  }
790
- const cwd = process.cwd().replace(/\//g, '-').replace(/^-/, '');
790
+ const cwd = cwdToProjectSegment();
791
791
  const projectLogDir = join(PROJECTS_DIR, cwd);
792
792
  const logFile = join(projectLogDir, `${sessionId}_log.json`);
793
793
  const errorLogFile = join(projectLogDir, `${sessionId}_error.json`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquesta-cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Orquesta CLI - AI-powered coding assistant with team collaboration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",