orquesta-cli 0.2.27 → 0.2.29

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/dist/cli.js CHANGED
@@ -31,6 +31,46 @@ import { PROVIDERS } from './core/config/providers.js';
31
31
  const require = createRequire(import.meta.url);
32
32
  const packageJson = require('../package.json');
33
33
  const program = new Command();
34
+ async function resolveHookToken(explicitToken) {
35
+ await configManager.initialize();
36
+ const saved = configManager.getOrquestaConfig();
37
+ const token = explicitToken || saved?.token;
38
+ if (!token) {
39
+ console.error(chalk.red('Error: not connected to Orquesta.'));
40
+ console.error('Run ' + chalk.cyan('orquesta --login') + ' first, or pass ' + chalk.cyan('--token oat_…') + '.');
41
+ process.exit(1);
42
+ }
43
+ return { token: token, savedProjectId: saved?.projectId };
44
+ }
45
+ async function runHookEnable(opts) {
46
+ const { token, savedProjectId } = await resolveHookToken(opts.token);
47
+ const { initHooks } = await import('./orquesta/hook-init.js');
48
+ const preferredProjectId = opts.project || (opts.ignoreSaved || opts.token ? undefined : savedProjectId);
49
+ await initHooks(token, undefined, preferredProjectId);
50
+ }
51
+ async function runUpdate() {
52
+ const ora = (await import('ora')).default;
53
+ const { checkForCliUpdate, runCliUpdate, setSkippedVersion } = await import('./utils/update-checker.js');
54
+ const spinner = ora({ text: chalk.cyan('Checking npm for a newer version…'), color: 'cyan' }).start();
55
+ const info = await checkForCliUpdate(packageJson.version);
56
+ if (!info) {
57
+ spinner.succeed(chalk.green(`You're on the latest version (v${packageJson.version}).`));
58
+ return;
59
+ }
60
+ spinner.text = chalk.cyan(`Updating v${info.current} → v${info.latest}…`);
61
+ const result = await runCliUpdate(info.latest, (line) => {
62
+ if (line)
63
+ spinner.text = chalk.dim(line.replace(/\s+/g, ' ').slice(0, 70));
64
+ });
65
+ if (result.success) {
66
+ setSkippedVersion(info.latest);
67
+ spinner.succeed(chalk.green(`Updated to v${info.latest}. Restart orquesta to use it.`));
68
+ }
69
+ else {
70
+ spinner.fail(chalk.red(result.error || 'Update failed'));
71
+ process.exit(1);
72
+ }
73
+ }
34
74
  program
35
75
  .name('orquesta')
36
76
  .description('Orquesta CLI - AI-powered coding assistant with local LLM support')
@@ -55,6 +95,7 @@ program
55
95
  .option('--add-provider <providerId>', 'Add a specific provider by ID (e.g., openai, anthropic, ollama)')
56
96
  .option('--init', 'Enable the Claude Code hook in this directory (reuses your login; or pass --token)')
57
97
  .option('--disable-hook', 'Disable the Claude Code hook in this directory')
98
+ .option('--update', 'Update orquesta-cli to the latest published version and exit')
58
99
  .action(async (options) => {
59
100
  if (options.appendSystemPrompt) {
60
101
  setAppendedSystemPrompt(options.appendSystemPrompt);
@@ -63,18 +104,12 @@ program
63
104
  await runEvalMode();
64
105
  return;
65
106
  }
107
+ if (options.update) {
108
+ await runUpdate();
109
+ return;
110
+ }
66
111
  if (options.init) {
67
- await configManager.initialize();
68
- const saved = configManager.getOrquestaConfig();
69
- const token = options.token || saved?.token;
70
- if (!token) {
71
- console.error(chalk.red('Error: not connected to Orquesta.'));
72
- console.error('Run ' + chalk.cyan('orquesta --login') + ' first, or pass ' + chalk.cyan('orquesta --init --token oat_…') + '.');
73
- process.exit(1);
74
- }
75
- const { initHooks } = await import('./orquesta/hook-init.js');
76
- const preferredProjectId = options.project || (options.token ? undefined : saved?.projectId);
77
- await initHooks(token, undefined, preferredProjectId);
112
+ await runHookEnable({ token: options.token, project: options.project });
78
113
  return;
79
114
  }
80
115
  if (options.disableHook) {
@@ -305,6 +340,49 @@ program
305
340
  }
306
341
  }
307
342
  });
343
+ const hook = program
344
+ .command('hook')
345
+ .description('Manage the Claude Code hook for the current directory');
346
+ hook
347
+ .command('enable')
348
+ .description('Enable the hook here (asks which project if ambiguous)')
349
+ .option('--project <projectId>', 'Project this directory should stream into')
350
+ .option('--token <token>', 'Use a specific token instead of your saved login')
351
+ .action(async (opts) => {
352
+ await runHookEnable({ token: opts.token, project: opts.project });
353
+ process.exit(0);
354
+ });
355
+ hook
356
+ .command('switch')
357
+ .description('Change which project this directory streams into')
358
+ .option('--project <projectId>', 'Project to switch to (skips the prompt)')
359
+ .action(async (opts) => {
360
+ await runHookEnable({ project: opts.project, ignoreSaved: true });
361
+ process.exit(0);
362
+ });
363
+ hook
364
+ .command('disable')
365
+ .description('Disable the hook in this directory')
366
+ .action(async () => {
367
+ const { disableHooks } = await import('./orquesta/hook-init.js');
368
+ disableHooks();
369
+ process.exit(0);
370
+ });
371
+ hook
372
+ .command('status')
373
+ .description('Show the hook + target project for this directory')
374
+ .action(async () => {
375
+ await configManager.initialize();
376
+ showConnectionStatus();
377
+ process.exit(0);
378
+ });
379
+ program
380
+ .command('update')
381
+ .description('Update orquesta-cli to the latest published version')
382
+ .action(async () => {
383
+ await runUpdate();
384
+ process.exit(0);
385
+ });
308
386
  program.showHelpAfterError(false);
309
387
  program.configureOutput({
310
388
  outputError: (str, write) => {
@@ -318,14 +396,17 @@ program.configureOutput({
318
396
  });
319
397
  program.on('command:*', () => {
320
398
  console.error(chalk.red('⚠️ Unknown command.'));
321
- console.log(chalk.white('Usage: orquesta [options]\n'));
399
+ console.log(chalk.white('Usage: orquesta [options] | orquesta hook <enable|switch|disable|status>\n'));
322
400
  console.log(chalk.white(' -p, --print <prompt> Execute a prompt and exit\n'));
323
401
  console.log(chalk.white(' --token <token> Connect to Orquesta dashboard\n'));
324
402
  console.log(chalk.white(' --project <id> Select project when connecting\n'));
325
- console.log(chalk.white(' --switch-project [id] Switch to a different project\n'));
403
+ console.log(chalk.white(' --switch-project [id] Switch the CLI to a different project\n'));
326
404
  console.log(chalk.white(' --status Show connection + hook status\n'));
327
- console.log(chalk.white(' --init Enable the Claude Code hook here\n'));
328
- console.log(chalk.white(' --disable-hook Disable the Claude Code hook here\n'));
405
+ console.log(chalk.white(' hook enable Enable the Claude Code hook here\n'));
406
+ console.log(chalk.white(' hook switch Move this directory to another project\n'));
407
+ console.log(chalk.white(' hook disable Disable the Claude Code hook here\n'));
408
+ console.log(chalk.white(' hook status Show the hook + target project here\n'));
409
+ console.log(chalk.white(' update Update orquesta-cli to the latest version\n'));
329
410
  console.log(chalk.white(' --sync Sync configurations with Orquesta\n'));
330
411
  console.log(chalk.white(' --disconnect Disconnect from Orquesta\n'));
331
412
  console.log(chalk.white(' --scan Scan for available LLM providers\n'));
@@ -291,11 +291,12 @@ export function showConnectionStatus() {
291
291
  console.log(chalk.green('Claude Code hook: enabled in this directory'));
292
292
  console.log(chalk.dim(` Streaming into: ${name}`));
293
293
  console.log(chalk.dim(` Project ID: ${hook.projectId}`));
294
- console.log(chalk.dim(` Disable with: orquesta --disable-hook`));
294
+ console.log(chalk.dim(` Change project: orquesta hook switch`));
295
+ console.log(chalk.dim(` Disable: orquesta hook disable`));
295
296
  }
296
297
  else {
297
298
  console.log(chalk.yellow('Claude Code hook: not enabled in this directory'));
298
- console.log(chalk.dim(` Enable with: orquesta --init`));
299
+ console.log(chalk.dim(` Enable with: orquesta hook enable`));
299
300
  }
300
301
  }
301
302
  //# sourceMappingURL=first-run-setup.js.map
@@ -34,6 +34,7 @@ import { processFileReferences } from '../hooks/atFileProcessor.js';
34
34
  import { executeSlashCommand, isSlashCommand, } from '../../core/slash-command-handler.js';
35
35
  import { closeJsonStreamLogger } from '../../utils/json-stream-logger.js';
36
36
  import { configManager } from '../../core/config/config-manager.js';
37
+ import { readHookConfig } from '../../orquesta/hook-init.js';
37
38
  import { logger } from '../../utils/logger.js';
38
39
  import { usageTracker } from '../../core/usage-tracker.js';
39
40
  import { UpdateNotification } from '../UpdateNotification.js';
@@ -88,6 +89,16 @@ function getStatusText({ phase, todos, currentToolName }) {
88
89
  }
89
90
  export const PlanExecuteApp = ({ llmClient: initialLlmClient, modelInfo }) => {
90
91
  const { exit } = useApp();
92
+ const hookBinding = useMemo(() => {
93
+ const cfg = readHookConfig(process.cwd());
94
+ if (!cfg)
95
+ return null;
96
+ const oc = configManager.getOrquestaConfig();
97
+ const name = oc?.projectId === cfg.projectId && oc?.projectName
98
+ ? oc.projectName
99
+ : cfg.projectId.slice(0, 8);
100
+ return { projectName: name };
101
+ }, []);
91
102
  const [messages, setMessages] = useState([]);
92
103
  const { input, setInput, handleHistoryPrev, handleHistoryNext, addToHistory } = useInputHistory();
93
104
  const [isProcessing, setIsProcessing] = useState(false);
@@ -1412,6 +1423,11 @@ export const PlanExecuteApp = ({ llmClient: initialLlmClient, modelInfo }) => {
1412
1423
  React.createElement(Text, { color: "cyan" }, currentModelInfo.model),
1413
1424
  React.createElement(Text, { color: "gray" }, " \u2502 "),
1414
1425
  React.createElement(Text, { color: "gray" }, shortenPath(process.cwd())),
1426
+ hookBinding && (React.createElement(React.Fragment, null,
1427
+ React.createElement(Text, { color: "gray" }, " \u2502 "),
1428
+ React.createElement(Text, { color: "green" },
1429
+ "\u2B21 hook \u2192 ",
1430
+ hookBinding.projectName))),
1415
1431
  (planExecutionState.todos.length > 0 || batutaUsage) && (React.createElement(React.Fragment, null,
1416
1432
  React.createElement(Text, { color: "gray" }, " \u2502 "),
1417
1433
  React.createElement(TodoStatusBar, { todos: planExecutionState.todos, projectName: configManager.getOrquestaConfig()?.projectName, batutaUsage: batutaUsage, isProcessing: isProcessing })))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquesta-cli",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "description": "Orquesta CLI - AI-powered coding assistant with team collaboration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",